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
This probaly could be done in more "specy" way with loop but this will do for now
def multiple_places_in_city_from_beermapping(city) allow(BeermappingApi).to receive(:places_in).with(city).and_return( [ Place.new( name:"Oljenkorsi", id: 1), Place.new( name:"Kello baari", id: 2), Place.new( name:"Hopeatuoppi", id: 3)] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputcase \n for i in [email protected] do\n\n isfit = checkMustHaveNotLimit @records.recordsArr[i]\n \n\n for j in [email protected][i].valuesArr.length do\n print parameters.paramsArr[j].elementsArr[@records.recordsArr[i].valuesArr[j]].value\n print ' '\n end\n puts ' '\n \n end\n end", "def pre_loop; end", "def setNumFromPairs record, sequenceArr,index\n paramindex=sequenceArr[index]\n tmpArry = []\n num =0\n tag = 1\n flag=1\n for i in [email protected][paramindex].elementsArr.length do\n\t\t flag=1\n for j in 0...index do\n tag =1\n for k in [email protected] do #for k do start\n if @pairs[k].secondParam == paramindex and @pairs[k].firstParam == sequenceArr[j] ####if start\n for h in 0...@pairs[k].pairsArr.length do #for h do start\n if @pairs[k].pairsArr[h].secondValue == i and @pairs[k].pairsArr[h].firstValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == false\n num+=1 \n tag=0\n break #break for h\n elsif @pairs[k].pairsArr[h].secondValue ==i and @pairs[k].pairsArr[h].firstValue == record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == 'disabled'\n flag=0\n break #break for h\n end \n end #for h do end\n elsif @pairs[k].firstParam == paramindex and @pairs[k].secondParam == sequenceArr[j] ####ifels\n for h in 0...@pairs[k].pairsArr.length do ##for h do start \n if @pairs[k].pairsArr[h].firstValue == i and @pairs[k].pairsArr[h].secondValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == false \n num+=1\n tag=0\n break #break for h\n elsif @pairs[k].pairsArr[h].firstValue ==i and @pairs[k].pairsArr[h].secondValue ==record.valuesArr[sequenceArr[j]] and @pairs[k].pairsArr[h].isVisited == 'disabled'\n flag=0\n break #break for h\n end\n end ##for h do end\n if tag == 0 or flag ==0\n break #break for k\n end\n end ####if end \n end #for k do end\n if flag ==0\n break #break for j\n end\n end\n if flag ==1\n tmpArry << [i , num]\n end\n num=0\n end\n return tmpArry\n end", "def assign_starts_of_streams_to_sets(sets,hw)\n stream_labels = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n if stream_labels[stream_starts_at_set].nil? then\n stream_labels[stream_starts_at_set]=stream[\"stream\"]\n else\n stream_labels[stream_starts_at_set] = stream_labels[stream_starts_at_set]+';'+stream[\"stream\"]\n end\n }\n 1.upto(sets.length-1) { |set_number|\n if stream_labels[set_number].nil? then stream_labels[set_number]='' end\n #print \"=== #{set_number}->#{stream_labels[set_number]}\\n\"\n }\n return stream_labels\nend", "def generate_kpi_from_key_counter(all_fomula,s1_ip,time_counter_hash,source_file,logger)\n\ncell_size=3\n\ntime_counter_hash.each do |start_time,one_time_counter|\n\n counter_hash=one_time_counter\n #logger.debug \"kpi calculation for start time=#{start_time}\"\n all_cell_hash=Hash.new\n\n all_fomula.each do |fomula|\n #puts fomula.name\n #logger.debug \"start calculate fomula #{fomula.name}\"\n\n fomula_hash=Hash.new\n\n #获取原始公式并替换处理\n new_fomula=fomula.fomula_exp1.gsub(/sum|avg|\\[|\\]/,\"\")\n #获取一个公示里面所有的counter,并存放在数组中\n counter_array=fomula.fomula_exp1.scan(/M\\d+C\\d+/)\n\n counter_array.each do |counter|\n fomula_hash[counter]=counter_hash[counter]\n end\n\n #logger.debug \"fomula hash=#{fomula_hash}\"\n\n# we need convert fomulu to map to the array we calculated above\n cell_fomula_array=[]\n\n 0.upto(cell_size-1).each do |i|\n\n new_fomula_2=String.new(new_fomula)\n formated_fomula=\"\"\n counter_array.uniq.each do |counter|\n\n if fomula.formularid==\"LTE_5218c\" || fomula.formularid==\"LTE_5023d\" || fomula.formularid==\"LTE_5017a\" || fomula.formularid==\"LTE_5017a\" || fomula.formularid==\"LTE_5035a\" || fomula.formularid==\"LTE_5082a\" \\\n || fomula.formularid==\"LTE_5114a\" || fomula.formularid==\"LTE_5035a\" ||fomula.formularid==\"LTE_5048b\" || fomula.formularid==\"LTE_5082a\" || fomula.formularid==\"LTE_5114a\" || fomula.formularid==\"LTE_5043a\" \\\n || fomula.formularid==\"LTE_5058b\" || fomula.formularid==\"LTE_5119c\" ||fomula.formularid==\"LTE_5025d\"\n formated_fomula= new_fomula_2.gsub!(\"#{counter}\",\"fomula_hash\\[\\\"#{counter}\\\"\\]\\[#{i}\\].to_f\")\n\n else\n formated_fomula= new_fomula_2.gsub!(\"#{counter}\",\"fomula_hash\\[\\\"#{counter}\\\"\\]\\[#{i}\\]\")\n end\n \n end #end of each counter sacn\n #save converted fomulr\n cell_fomula_array << formated_fomula\n\n #logger.debug \"formated_fomula=#{formated_fomula}\"\n end\n\n#logger.debug cell_fomula_array\n\n #对于每一个cell的公式\n cell_fomula_array.each_index do |index|\n all_cell_hash[\"#{start_time}_cell#{index}\"] ||={}\n # logger.debug \"calculation formuala=#{cell_fomula_array[index]}\"\n\n merged_hash=all_cell_hash[\"#{start_time}_cell#{index}\"]\n\n merged_hash[\"start_time\"]=start_time\n merged_hash[\"source_file\"]=source_file\n merged_hash[\"s1_ip\"]=s1_ip\n merged_hash[\"kpi_hash\"]||={} #KPI is empty\n merged_hash[\"scopelevel\"]=\"cell-#{index+1}\"\n\n begin\n #logger.debug cell_fomula_array\n kpi_result=eval(cell_fomula_array[index].to_s)\n logger.debug \"kpi_result=#{kpi_result}\"\n if kpi_result.kind_of?(Float)\n kpi_result=kpi_result.round(2).to_s+\"%\"\n end\n\n\n # logger.debug \"kpi result=#{kpi_result}\"\n merged_hash[\"kpi_hash\"]=merged_hash[\"kpi_hash\"].merge({fomula.name.to_s=>kpi_result})\n \n rescue Exception => ex\n # puts ex\n logger.debug ex.class\n\n \t#logger.debug \"merged_hash=#{merged_hash}\"\n \t#merged_hash[\"kpi_hash\"]||=Hash.new #KPI is empty\n \t#\traise unless merged_hash[\"kpi_hash\"].kind_of?(Hash)\n merged_hash[\"kpi_hash\"]=merged_hash[\"kpi_hash\"].merge({fomula.name.to_s=>\"#{ex.class}\"})\n end #end of rescue\n\n \n \n all_cell_hash[\"#{start_time}_cell#{index}\"]=merged_hash\n # puts merged_hash\n end # end of 3 cell calculation \n #logger.debug all_cell_hash\n\t\n end #end of all fomula\n\nall_cell_hash.each do |key,value|\n #logger.debug \"start_time =#{key},value hash size=#{value[\"kpi_hash\"].size}\"\n value[\"kpi_hash\"]=value[\"kpi_hash\"].to_s\n kpi=Kpi.where(:s1_ip=>s1_ip,:start_time=>value[\"start_time\"],:scopelevel=>value[\"scopelevel\"]).first\n \n if kpi.nil?\n Kpi.create(value) \n # else\n # kpi.update_attributes(value) \n end\n\nend\n\nend \n\n\n\nend", "def check_for_implication_loops\n # actually this is tricky\n end", "def classificateResult(label, sampleMap, foundAllArr)\n puts \"[classificateResult] started label #{label}\"\n foundArr = foundAllArr.select{|found| matchLabels?(found.label, label)}\n expRecognitionResult = Spnt::Exp::Data::ExpRecognitionResult.new()\n expRecognitionResult.falseNegative = []\n expRecognitionResult.falsePostive = []\n #missed = sampleArr - foundArr\n #1 step. filter that was found and transform to array\n substituted = sampleMap.select{|ekey, sample|\n if(matchLabels?( label, sample.label))\n nil == foundArr.detect{|found| sample.ekey == found.ekey && found.shouldStart != @@UNDEFINED_CELL} \n end\n }.collect { |k, v| v }\n deleted =foundArr.select{|found|\n found.foundStart == nil || found.foundStart == @@UNDEFINED_CELL \n }\n inserted =foundArr.select{|found|\n found.shouldStart == nil || found.shouldStart == @@UNDEFINED_CELL \n }\n \n puts \"[classificateResult] %s substituted: %i\" % [label, substituted.length]\n puts \"[classificateResult] %s deleted: %i\" % [label, deleted.length]\n puts \"[classificateResult] %s inserted: %i\" % [label, inserted.length]\n\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << substituted).flatten\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << deleted).flatten\n expRecognitionResult.falsePostive = (expRecognitionResult.falsePostive << inserted).flatten\n \n puts \"[classificateResult] %s falseNegative: %i\" % [label, expRecognitionResult.falseNegative.length]\n puts \"[classificateResult] %s falsePostive: %i\" % [label, expRecognitionResult.falsePostive.length]\n\n\n puts \"[classificateResult]substituted: \" + substituted.collect{|v| \" %i => %s[%s]\" % [v.id, v.ekey, v.foundStart]}.join(\"; \")\n\n# foundDuplicates = {}\n# expRecognitionResult.correct = foundArr.select{|found|\n# sample = sampleMap[found.ekey]\n# if(sample != nil && matchLabels?( label, found.label))\n# if(found.foundStart == nil)\n# #puts \"[classificateResult]falseNegative [#{found.ekey}] no start: #{sample.shouldStart} #{found.foundStart}\"\n# expRecognitionResult.falseNegative << sample\n# false\n# else\n# absStartDelta = (sample.shouldStart - found.foundStart).abs\n# absEndDelta = (sample.shouldEnd - found.foundEnd).abs\n# matched = sample.ekey == found.ekey && absStartDelta <= @@thresholdStart && absEndDelta <= @@thresholdEnd\n# if matched == true\n# foundDuplicateElement = foundDuplicates[found.ekey]\n# if foundDuplicateElement == nil\n# foundDuplicateElement = []\n# foundDuplicates[found.ekey] = foundDuplicateElement\n# end\n# foundDuplicateElement << found\n# #puts \"foundDuplicates[#{sample.ekey}] #{foundDuplicates[sample.ekey].length} #{matched && foundDuplicates[sample.ekey].length == 1}\"\n# end\n# matched && foundDuplicates[sample.ekey].length == 1\n# end\n# else\n# false\n# end\n# }\n #expRecognitionResult.falsePostive = foundArr.select{|found| !expRecognitionResult.correct.include?(found) && !expRecognitionResult.falseNegative.include?(found)}\n# expRecognitionResult.correct = foundArr.select{|found|\n# expRecognitionResult.falsePostive.include?(found) && expRecognitionResult.falseNegative.include?(found)\n# }\n expRecognitionResult.correct = foundArr.to_set - expRecognitionResult.falsePostive.to_set - expRecognitionResult.falseNegative.to_set;\n puts \"falsePostive[#{expRecognitionResult.falsePostive.length}] + falseNegative[#{expRecognitionResult.falseNegative.length}]+correct[#{expRecognitionResult.correct.length}] = foundArr[#{foundArr.length}]\"\n expRecognitionResult\n end", "def test_row_first(r)\n flag = false\n $pages[r-1].select{|p| (p.p >> PAGE_SHIFT).even? }.each {|p|\n $pages[r+1].select {|q| (q.p >> PAGE_SHIFT).even? and conflict?(p.v, q.v)\n }.each {|q|\n flag |= hammer_row(r, p, q, $ntime_max)\n } \n }\n return flag\nend", "def supplementaryCase records #generate the supplementary set for selected records \n [email protected][0].valuesArr.length\n \n recordset = Records.new\n tagset = []\n # add the @records and selected records (just the inputparameter 'records' into the recordset ) \n for i in [email protected] do #add the @records to recordset and set tagset=1\n recordset.recordsArr << @records.recordsArr[i]\n tagset << 1\n end\n for j in 0...records.recordsArr.length do #add the records to recordset and set tagset=0\n recordset.recordsArr << records.recordsArr[j]\n tagset << 0\n end\n\n sum = @parameters.paramsArr.length*(@parameters.paramsArr.length-1)/2\n print 'sum='\n puts sum\n\n\n\n for i in 0...recordset.recordsArr.length do\n isexist=0\n for h in [email protected] do\n for k in h+1 [email protected] do\n for j in i+1 ...recordset.recordsArr.length do\n if recordset.recordsArr[i].valuesArr[h]== recordset.recordsArr[j].valuesArr[h] and recordset.recordsArr[i].valuesArr[k] == recordset.recordsArr[j].valuesArr[k]\n isexist+=1 \n end\n end\n end\n end\n if isexist >=sum\n tagset[i]=0\n end \n end\n result = Records.new\n for m in 0...tagset.length do\n if tagset[m]==1\n result.recordsArr << recordset.recordsArr[m]\n end\n end\n return result\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 processdup_all(c)\n prev_base = nil\n show = false\n c.each do |l|\n base = get_base(l[:file])\n if prev_base && base != prev_base\n show = true\n break\n end\n prev_base = base\n end\n if show\n c.each do |l|\n puts \"#{get_file(l[:file])} similarity #{l[:count]}\"\n end\n puts \"\"\n end\nend", "def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend", "def run( current, positions, iterations, num_values )\n iterations.times do \n slice_start = current.next\n current.next = current.next.next.next.next\n destination = nil\n backoff = 1\n \n while ! destination \n search_for_label = current.value - backoff\n if search_for_label < 1\n search_for_label += num_values\n end \n destination = positions[search_for_label]\n if destination.value == slice_start.value ||\n destination.value == slice_start.next.value ||\n destination.value == slice_start.next.next.value \n destination = nil\n backoff += 1\n end\n end\n \n after_slice = destination.next\n destination.next = slice_start\n slice_start.next.next.next = after_slice\n current = current.next\n end\nend", "def updateUC record\n for i in 0...record.valuesArr.length do\n for j in i+1...record.valuesArr.length do\n for k in [email protected] do\n if @pairs[k].firstParam == i and @pairs[k].secondParam == j\n for h in 0...@pairs[k].pairsArr.length do\n if @pairs[k].pairsArr[h].firstValue == record.valuesArr[i] and @pairs[k].pairsArr[h].secondValue == record.valuesArr[j]\n @parameters.paramsArr[i].elementsArr[record.valuesArr[i]].minusTimes\n @parameters.paramsArr[j].elementsArr[record.valuesArr[j]].minusTimes\n @pairs[k].pairsArr[h].setIsVisited \n end\n end\n end \n end\n end\n end\n end", "def next() end", "def next() end", "def basic_13 (array_iterate)\n array_iterate.collect! { |n| n < 0 ? n = 'Dojo' : n }\n return array_iterate\nend", "def workbook(n, k, arr)\r\n # Write your code here\r\n sp = 0\r\n count = 0\r\n arr.each do |range|\r\n remainingArray = Array(1..range)\r\n until (remainingArray.empty?)\r\n count += 1\r\n x = remainingArray.slice!(0,k)\r\n sp +=1 if (x.include?count)\r\n end\r\n end\r\n return sp\r\nend", "def generateLoop2\n for i in 1...10 do #do optional\n puts i\n end\n end", "def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend", "def offences_by; end", "def getMostCover records\n numset = []\n num = 0\n wArry=[];\n for i in 0...@maxloopnum do\n for j in [email protected] do\n for k in j+1 [email protected] do\n for n in [email protected] do\n if @pairs[n].firstParam ==j and @pairs[n].secondParam ==k\n for m in 0...@pairs[n].pairsArr.length do\n if records.recordsArr[i].valuesArr[j] == @pairs[n].pairsArr[m].firstValue and records.recordsArr[i].valuesArr[k] ==@pairs[n].pairsArr[m].secondValue and @pairs[n].pairsArr[m].isVisited== false\n num+=1\n \n end\n end\n end\n end\n end\n end\n numset << num\n num =0\n end\n maxtag=0\n maxnum=0\n max = Array.new\n for i in 0...@maxloopnum do\n if numset[i] == maxnum\n max << i \n elsif numset[i] > maxnum\n maxnum = numset[i]\n max.clear\n max << i\n end \n end\n #addb by chuangye ----------------------start\n if @useweight==1\n for h in 0...max.length do\n weight=0\n for p in [email protected] do\n pos=records.recordsArr[max[h]].valuesArr[p]\n [email protected][p].elementsArr[pos].weight\n \n end\n wArry << [max[h],weight]\n end\n maxweight=wArry[0][1]\n maxArry=[]\n for x in 0... wArry.length do\n if wArry[x][1]==maxweight\n maxArry << wArry[x][0]\n elsif wArry[x][1]==maxweight\n maxArry.clear\n maxArry << wArry[x][0]\n end\n \n end\n tag= randchar(0,maxArry.length-1)\n return maxArry[tag]\n else \n #add by chuangye ------------------------end\n tag = randchar(0,max.length-1)\n return max[tag]\n end\n end", "def scan_gene_blo_seqs\n GeneBloSeq.destroy_all\n\n genes = Gene.find(:all)\n\n genes.each { |gn|\n\n #assemble gene file location\n gene_blo_runs_f = \"#{AppConfig.gene_blo_runs_dir}/#{gn.name}.fasta\"\n gene_blo_seqs_f = \"#{AppConfig.gene_blo_seqs_dir}/#{gn.name}.fasta\"\n gene_blo_seqs_p = \"#{AppConfig.gene_blo_seqs_dir}/#{gn.name}.phy\"\n\n \n gene_blo_runs_oa = @ud.fastafile_to_original_alignment(gene_blo_runs_f)\n gene_blo_seqs_oa = Bio::Alignment::OriginalAlignment.new\n\n\n\n puts \"gn.seqs_orig_nb:#{gn.seqs_orig_nb} oa_size: #{gene_blo_runs_oa.size}\"\n\n #schould be equal\n #should insert assertion here or make an rspec to detect source\n #puts oa.keys\n\n gene_blo_runs_oa.each_pair { |key, seq|\n puts key, seq\n gbs = GeneBloSeq.new\n #find corresponding gi\n ns = NcbiSeq.find_by_vers_access(key)\n #link to objects gene and gi\n gbs.gene = gn\n gbs.ncbi_seq = ns\n gbs.save\n gene_blo_seqs_oa.add_seq(seq,ns.id)\n\n }\n \n #save fasta file \n @ud.string_to_file(gene_blo_seqs_oa.output(:fasta),gene_blo_seqs_f)\n #save phylip file\n @ud.string_to_file(gene_blo_seqs_oa.output(:phylip),gene_blo_seqs_p)\n\n\n\n\n }\n\n end", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.join\n return u, v, d, table\n end\n end\n end\n d = -d\n end\n end\n puts \"Not found.\"\n exit\nend", "def each_identity; end", "def iterate rule, seed\n \"00#{seed}00\".chars.each_cons(3).map { |c| rule[c.join.to_i 2] }.join\nend", "def test_source_getall()\n # 1. no sources\n assert_equal [], One::EmailDirect::Facade.source_getall(@credentials)\n\n\n # 2. one source\n One::EmailDirect::Facade.source_add(@credentials, @source_getall1[:name], @source_getall1[:description])\n result = One::EmailDirect::Facade.source_getall(@credentials)\n expected = [{\n :element_name => @source_getall1[:name],\n :description => @source_getall1[:description]\n }]\n result.collect! {|element| element.delete(:element_id); element} # remove ids\n assert_equal expected, result\n\n\n # 3. two sources\n One::EmailDirect::Facade.source_add(@credentials, @source_getall2[:name], @source_getall2[:description])\n result = One::EmailDirect::Facade.source_getall(@credentials)\n expected = [{\n :element_name => @source_getall1[:name],\n :description => @source_getall1[:description]\n }, {\n :element_name => @source_getall2[:name],\n :description => @source_getall2[:description]\n }]\n result.collect! {|element| element.delete(:element_id); element} # remove ids\n assert_equal expected, result\n\n\n # 4. three sources\n One::EmailDirect::Facade.source_add(@credentials, @source_getall3[:name], @source_getall3[:description])\n result = One::EmailDirect::Facade.source_getall(@credentials)\n expected = [{\n :element_name => @source_getall1[:name],\n :description => @source_getall1[:description]\n }, {\n :element_name => @source_getall2[:name],\n :description => @source_getall2[:description]\n }, {\n :element_name => @source_getall3[:name],\n :description => @source_getall3[:description]\n }]\n result.collect! {|element| element.delete(:element_id); element} # remove ids\n assert_equal expected, result\n end", "def o_gen_rating(numbers, idx)\n return numbers.first if numbers.size == 1\n\n zeroes = []\n ones = []\n numbers.each { |num| num[idx] == \"0\" ? zeroes.push(num) : ones.push(num) }\n next_nums = zeroes.size <= ones.size ? numbers - zeroes : numbers - ones\n o_gen_rating(next_nums, idx + 1)\nend", "def generatePairs\n for i in [email protected] do \n for j in i+1 [email protected] do\n tmppairs = Pairs.new i,j\n for k in [email protected][i].elementsArr.length do\n for h in [email protected][j].elementsArr.length do \n tmppair = Pair.new k,h #there we store the index of value but not the true value\n @parameters.paramsArr[i].elementsArr[k].addTimes\n @parameters.paramsArr[j].elementsArr[h].addTimes\n tmppairs.addPair tmppair #temppairs just like ABpairs not all AB AC BC\n \n end\n end\n @pairs << tmppairs #@pairs is all the pairs like AB AC BC \n end\n end\n\n #if has limit then update the pairs with limit conditions\n if @haslimit\n \tputs \"update pairs with limit....\"\n updatePairsWithLimit\n end\n end", "def running_total_3(array)\n #total = 0\n #array_new = []\n array.each_with_object([]) do |i,x|\n next if i == 0\n x += array[i-1]\n end\nend", "def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_5_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each { |counter| assert_equal [1, 1, 1, 1, 1, 1], counter }\n end", "def my_select(collection)\n holder = [] #for collection at the end\n counter = 0 #start at beginning of array\n\n while counter < collection.length # condition to be met\n if yield(collection[counter]) == true #if the mumbojumbo results in true *which select gives\n holder.push(collection[counter]) #then push that element into the new array\n end\n counter += 1 #iterate throughout the array incremently\n end\n holder #show everyone your new array\nend", "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 run(adjust)\n a = IO.read(\"05.in\").split.map{|o|o.to_i}\n i = 0\n n = 0\n while true\n n += 1\n j = i + a[i]\n a[i] = adjust.(a[i])\n i = j\n return n if i < 0 or i >= a.length\n end\nend", "def determine_pair(main_code)\n #double for loop?\n test_code = main_code.clone\n\n for i in (0..99) do\n\n test_code[1] = i\n\n for i in (0..99) do\n test_code[2] = i\n computed = test_code.clone\n computer(computed)\n if computed[0]==19690720\n puts \"When origin=19690720, noun= #{test_code[1]}, verb=#{test_code[2]}\"\n\n end\n\n end\n\n end\n\nend", "def using_each(arr)\n result = []\n acc = []\n arr.each { |e| \n acc << e\n if (acc.length === 4 or e === arr.last)\n result << acc\n acc = []\n end\n }\n result\nend", "def fully_extend_all reps=nil\n dist.branches.times do |i|\n hits = mapee(i).hits\n len = mapee(i).length\n mapee(i).clear_hits\n reps = (@len.to_f / len).round if reps.nil?\n mapee(i).length = @len\n reps.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/reps)\n new_hits + (j.to_f / reps)\n# puts new_hits.hits.inspect\n mapee(i) << new_hits\n end\n# puts mapee(i).hits.hits.inspect\n end\n end", "def hw_to_sets(hw,book) \n sets = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n set_number = stream_starts_at_set\n stream[\"chunks\"].each { |chunk|\n if sets[set_number].nil? then sets[set_number]=[] end\n sets[set_number].push(chunk)\n set_number = set_number+1\n }\n }\n 1.upto(sets.length-1) { |set_number|\n if sets[set_number].nil? then sets[set_number]=[] end\n }\n\n read_problems_csv(book)\n\n 1.upto(sets.length-1) { |set_number|\n sets[set_number].each { |chunk|\n chunk.each { |fg|\n flags,probs = fg\n probs.each { |g|\n g.each { |p|\n k = [p[0],p[1]]\n if p[0]<0 then\n fatal_error(\"in hw_to_sets, chapter=#{p[0]} for a problem on hw #{set_number}\")\n end\n label = $num_to_label[k]\n if $problem_assigned_on_set[k].nil?\n $problem_assigned_on_set[k] = set_number\n else\n if p[2].nil? || p[2]=='' then\n fatal_error(\"problem #{p[0]}-#{p[1]}, #{label}, assigned on both hw #{$problem_assigned_on_set[k]} and hw #{set_number}, and no specific parts were given on the second hw\")\n end\n end\n }\n }\n }\n }\n }\n\n return sets\nend", "def late_materialization(db)\n part_result_1 = []\n part_result_2 = []\n db[\"country\"][\"dic\"].each_with_index do |v, i|\n if v == \"GER\" \n db[\"country\"][\"av\"].each.with_index do |val, ind|\n if val == i then part_result_1.push(ind) end\n end\n break\n end\n end\n db[\"gender\"][\"dic\"].each_with_index do |v, i|\n if v == \"M\" \n db[\"gender\"][\"av\"].each.with_index do |val, ind|\n if val == i then part_result_2.push(ind) end\n end\n break\n end\n end \n # with this returned array we can materialize the\n # row the length of the array is the aggregation\n # in this case the materialiation is not neccessarry\n (part_result_1 & part_result_2)\nend", "def cats_in_hats\n # your code here\n hats = Array.new(100, false) # hat status of 100 cats\n result = [] # result array contains indices of cats with hats\n \n # iterate 100 rounds of visiting cats\n (0..99).each do |j|\n round = j+1\n i = j\n while i < 100\n if hats[i] == true\n hats[i] = false\n else\n hats[i] = true\n end\n i += round\n end\n end\n \n \n hats.each_with_index do |h, i|\n result << i+1 if h == true\n end\n result\nend", "def generate_comprehensive\n\n end", "def test_should_find_optimum_fill_complex\n @swap = swaps(:registration_period)\n @old = swaps(:expired)\n (\"A\"..\"H\").each { |i| create_user(:login => \"user_#{i}\", :email => \"#{i}@test.com\") }\n @old_set_1 = @old.swapsets.create :name => \"Old Set 1\"\n @old_set_2 = @old.swapsets.create :name => \"Old Set 2\"\n @old_set_3 = @old.swapsets.create :name => \"Old Set 3\"\n @old_set_4 = @old.swapsets.create :name => \"Old Set 4\"\n @old_set_5 = @old.swapsets.create :name => \"Old Set 5\"\n @old_set_6 = @old.swapsets.create :name => \"Old Set 6\"\n @set = @swap.swapsets.create :name => \"New Set\"\n # old sets are constructed so that [G,H] is the best possible solution\n %w{ A E }.each { |i| @old_set_1.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B F }.each { |i| @old_set_2.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ C E }.each { |i| @old_set_3.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ D F }.each { |i| @old_set_4.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A G }.each { |i| @old_set_5.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B H }.each { |i| @old_set_6.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A B C D }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n @set.assign user\n end\n %w{ E F G H }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n user.registrations.find_by_swap_id(@swap).set_as_double\n end\n @swap.initialize_set(@swap.users, SWAPSET_SIZE, Swapset.find(:all).map {|set| set.users})\n @swap.fill_set(@set)\n @set.reload\n assert_equal 6, @set.users.size\n %w{ A B C D G H}.each do |i|\n assert @set.users.include?(User.find_by_login(\"user_#{i}\"))\n end\n %w{ E F }.each do |i|\n assert !(@set.users.include?(User.find_by_login(\"user_#{i}\")))\n end\n end", "def consolidate_cart(cart)\nindex = 0\nnew_cart = []\n\nwhile index < cart.length do\n item = find_item_by_name_in_collection(cart[index][:item],new_cart)\n if item\n new_cart_index = 0\n while new_cart_index < new_cart.length do\n if new_cart[new_cart_index][:item]===item[:item]\n new_cart[new_cart_index][:count]+=1\n end\n new_cart_index+=1\n end\n else \n cart[index][:count] = 1\n new_cart << cart[index]\n end\n index+=1\nend\nnew_cart\nend", "def output(list)\n # use traditional for loop instead of the advanced for loop because index\n # is needed in printing\n list.size.times do |i|\n # for each cell in the input_t, sweep the surrounding cells for mines and\n # store the number of mines in the cell\n output = CalculatedField.new(list[i])\n\n # print output in the format required\n puts\n puts(\"Field ##{i+1}:\")\n puts output\n end\nend", "def get_product_service_kpi_from_to(product_service_map,time,time_list)\n @pro_normalPv_list = Array.new\n @pro_delayPv_list = Array.new\n size = time.size\n 0.upto(size-1) do |i|\n new_p,new_s = new_and_old_service(time[i]) \n product_service_map = concat_pro_ser(product_service_map,new_p,new_s)\n pro_kpi,pro_pv,pro_normalPv,pro_delayPv = get_kpi_by_collection_name(@db,\"count_kpi\",product_service_map,time_list[i],time_list[i+1])\n @pro_normalPv_list.push(pro_normalPv)\n @pro_delayPv_list.push(pro_delayPv)\n end\n pro_size = @pro_normalPv_list.size\n @pro_pv = 0\n @pro_delayPv = 0\n 0.upto(pro_size-1) {|i|@pro_pv += @pro_normalPv_list[i]+@pro_delayPv_list[i]; @pro_delayPv+=@pro_delayPv_list[i]} \n @pro_kpi = (@pro_pv-@pro_delayPv)/(@pro_pv*1.0)*100\n last = time_list.size-1\n @ser_kpi,@ser_pv,@ser_normalPv,@ser_delayPv = get_kpi_by_collection_name(@db,\"search_kpi\",nil,time_list[0],time_list[last])\n @pro_avi,@pro_yes_num,@pro_no_num = get_availability_by_collection_name(@db,\"count_usable\",time_list[0],time_list[last])\n @ser_avi,@ser_yes_num,@ser_no_num = get_availability_by_collection_name(@db,\"search_usable\",time_list[0],time_list[last])\n puts \"Starttime: #{time_list[0]}\\t Endtime: #{time_list[last]}\\t timegap: #{time_list.size-1} \"\n print nil\n end", "def each_combination\n \n 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 cleanup(obs)\n obs = obs.take_while(&:present?)\n begin\n counts = obs.flatten.inject(Hash.new(0)) { |h, i| h[i] += 1 if i.is_a?(Integer); h }\n singles = counts.to_a.select { |e| e[1] == 1 }.map(&:first)\n\n # p singles.map {|u| SPCS[u]}\n\n obs.map! do |day|\n if day.is_a? Array\n cross = day & singles\n end\n if cross.present?\n cross.map { |c| SPCS[c] }.join(\", \")\n else\n day\n end\n end\n\n end until singles.empty?\nend", "def cleanup(obs)\n used_singles = []\n begin\n counts = obs.values.flatten.inject(Hash.new(0)) { |h, i| h[i] += 1 if i.is_a?(Integer); h }\n singles = counts.to_a.select { |e| e[1] == 1 }.map(&:first) - used_singles\n\n if singles.present?\n\n obs.each do |day, sps|\n cross = sps & singles\n if cross.present?\n used_singles.concat(cross)\n obs[day] = [cross.first]\n end\n end\n end\n\n end until singles.empty?\nend", "def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def cleanup(obs)\n prev_singles = []\n\n begin\n counts = obs.flatten.inject(Hash.new(0)) { |h, i| h[i] += 1 if i.is_a?(Integer); h }\n singles = counts.to_a.select { |e| e[1] == 1 }.map(&:first) - prev_singles\n\n # p singles.map {|u| SPCS[u]}\n\n obs.map! do |day|\n if day.is_a? Array\n cross = day & singles\n end\n if cross.present?\n cross.map { |c| SPCS[c] }.join(\", \")\n else\n day\n end\n end\n\n prev_singles = prev_singles + singles\n\n end until singles.empty?\nend", "def movies_with_director_key(name, movies_collection) #iterate over movies collection. \n new_array = []\n row_index = 0 \n while row_index < movies_collection.length do \n new_array << movie_with_director_name(name, movies_collection[row_index]) \n row_index += 1 \nend\nreturn new_array\nend", "def probers; end", "def destutter2(seq)\n result = [] #result will be a new array\n last = nil #keep track of last thing\n\n seq.each do |item|\n if item != last\n result.push(item)\n #result << item\n end\n last = item\n end\n result\nend", "def batch_badge_creator(badges)\n array=Array.new\n badges. each do |individuals|\n array=array.push(badge_maker(individuals))\n end\n return array;\n\nend", "def serviceLane(n, cases, width)\r\n # Write your code here\r\n allowedWidth = []\r\n finalResult = []\r\n cases.each do |tcase|\r\n (tcase[0]..tcase[1]).each do |indicie|\r\n allowedWidth << width[indicie]\r\n end\r\n finalResult << allowedWidth.sort.first\r\n allowedWidth = []\r\n end\r\n return finalResult\r\nend", "def test_speaker_list_generation\n s1 = FactoryGirl.create(:speaker, :last_name => \"Ttt\", :first_name => \"Sssss\")\n s2 = FactoryGirl.create(:speaker, :last_name => \"Zzz\", :first_name => \"Aaaaa\")\n\n a1 = 10.times.inject([]) { |a,x| a << FactoryGirl.create(:audio_message, :title => \"Message Title #{x}\", :subj => \"The Subject #{x}\", :speaker => s1) }\n a2 = 5.times.inject([]) { |a,x| a << FactoryGirl.create(:audio_message, :title => \"Message Title #{x}\", :subj => \"The Subject #{x}\", :speaker => s2) }\n\n speaker_list = generate_speaker_list_with_counts\n assert speaker_list.size >= 2,\"Speaker list should have at least two items\"\n a1_pos = -1\n a2_pos = -2\n speaker_list.each_with_index do |speaker,i|\n if speaker.last_name == \"Ttt\"\n assert_equal 10,speaker.active_message_count,\"Counts should be calculated for active messages of speaker 1\"\n a1_pos = i\n elsif speaker.last_name == \"Zzz\"\n assert_equal 5,speaker.active_message_count,\"Counts should be calculated for active messages of speaker 2\"\n a2_pos = i\n end\n end\n assert a1_pos >= 0,\"List must contain speaker 1\"\n assert a2_pos >= a1_pos,\"List must container speaker 2 after speaker 1\"\n end", "def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend", "def player_numbers(team_name)\n new_Arr = []\n game_hash.each do |place, team|\n if team_name == team[:team_name]\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n new_Arr.push(player[:number])\n # binding.pry\n end\n end\n end\n end\n end\n new_Arr\nend", "def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend", "def sequence(hidden, open)\n weight = { 1 => \"A\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", \n 10 => \"T\", 11 => \"J\", 12 => \"Q\", 13 => \"K\" }\n i = 0\n result = []\n inputs = 1\n differ = 0\n if weight.key(hidden[i]) > weight.key(hidden[i+2])\n small = weight.key(hidden[i+2])\n big = weight.key(hidden[i])\n differ = big - small\n elsif weight.key(hidden[i]) < weight.key(hidden[i+2])\n small = weight.key(hidden[i])\n big = weight.key(hidden[i+2])\n differ = big - small\n else\n return false\n end\n return false if differ > 4\n if differ > 1\n start = small + 1\n end1 = big - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n inputs += 1\n end \n end \n end \n end\n end\n return false unless differ == inputs \n if result.size < 6\n steps = (6-result.size)/2\n start = big + 1\n end1 = big + steps\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n if result.size < 6\n steps = (6-result.size)/2\n return false if small - steps < 1 \n start = small - steps\n end1 = small - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n return false if result.size < 6\n end\n end \n result \n end", "def run_bf(items)\n\n counts = Hash.new{|h,k| h[k] = 0}\n\n items.each {|item| counts[item] += 1 }\n \n dd = items.length / 10\n \n results = []\n counts.each {|item, count|\n results << item if count > dd\n }\n \n return results\n end", "def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend", "def early_materialization(db)\n aggregate = 0\n db[\"gender\"][\"dic\"].each_with_index do |v, i|\n if v == \"M\" \n c_pos = i \n db[\"gender\"][\"av\"].each_with_index do |v, i|\n if v == c_pos \n av_pos = db[\"country\"][\"av\"][i]\n dic_value = db[\"country\"][\"dic\"][av_pos]\n if dic_value == \"GER\"\n aggregate = aggregate + 1\n end\n end\n end\n break\n end\n end\n aggregate \nend", "def multiple_variable_crossover(datacollection, colums, rows)\n porcent = datacollection.count\n\n puts \"#{colums}\"\n puts \"#{rows}\"\n data_collection_advanced = []\n datacollection.each_with_index do |data, index|\n id = index + 1\n data['id'] = id\n data_collection_advanced.push(data)\n end\n\n\n last_group_array = []\n rows.each do |column|\n agroup_array_x = []\n @hashx.each_with_index do |h, index|\n data_collection = {}\n groped_x = h[column]\n data_collection[column] = groped_x\n agroup_array_x.push(data_collection)\n end\n\n hashedART = {}\n group_hash = agroup_array_x.group_by { |u| u[column] }.map { |k, v| \n hashedART[ if !k.nil?\n \"#{k}\".downcase \n else\n \"null\"\n end\n ] = v.size.to_f/porcent.to_f }\n group_hash = hashedART\n group_array = agroup_array_x.group_by { |u| u[column] }.map { |k, v| [\n if !k.nil?\n \"#{k}\".downcase \n else\n \"null\"\n end, v.size.to_f/porcent.to_f] }\n heads = hashedART.keys\n hx = {\"hash\": hashedART, \"array\": group_array, \"heads\": heads}\n\n last_group_array.push(hx)\n end\n\n values_in_col = []\n\n\n colums.each do |col|\n @hashx.each_with_index do |h, index|\n values_in_col.push(h[col])\n end\n end\n\n values_in_col = values_in_col.uniq{|x| x}\n\n values_in_row = []\n adv_array = []\n last_group_array.each do |op|\n op[:heads].each do |px|\n values_in_row.push(px)\n rows.each do |row|\n values_in_col.each do |vin|\n colums.each do |col|\n hashed = {}\n hashed[\"row\"] = row\n hashed[\"rowvin\"] = px\n hashed[\"col\"] = col\n hashed[\"colvin\"] = vin\n selected = data_collection_advanced.select {|hash| hash[\"#{row}\"] == px if hash[\"#{col}\"] == \"#{vin}\"}\n hashed[\"q\"]= selected.count\n adv_array.push(hashed)\n end\n end\n end\n end\n end\n\n\n @crossover = {data: adv_array,values_in_row: values_in_row , values_in_col: values_in_col}\n\n end", "def fix_machine(debris, product)\n\n counter_2 = product.size\n counter = debris.size\n\n while counter > counter_2\n first_num = puts debris[1] == product[2] #look thorugh the entire string\n counter -= 1\n\n\n end\nend", "def compute(name, ref, span, snps)\n return if span.length < 1\n\n span.sort! {|a,b| a[0] <=> b[0]}\n head = span.shift\n ss,ee = head[0],head[1]\n array = []\n \n array << ss \n span.each do |breaks|\n array << breaks[0]\n array << breaks[1]\n end\n array << ee \n\n while array.size > 0\n s = array.shift\n e = array.shift\n# $stderr.puts \"#{ref}\\t#{s}\\t#{e}\"\n (s..e).each do |i|\n @coverage[ref][i] += 1 #Compute coverage on base i\n end\n end\n\n snps.each_key do |pos|\n refbase = @seq[ref][pos-1,1].upcase\n curbase = snps[pos][:snpbase]\n if snps.key?(pos + 1) or snps.key?(pos + 2) or snps.key?(pos - 1) or snps.key?(pos - 2)\n if snps.key?(pos + 1) and refbase == snps[pos+1][:snpbase] and curbase == @seq[ref][pos,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 1) and refbase == snps[pos-1][:snpbase] and curbase == @seq[ref][pos-2,1].upcase \n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 2) and refbase == snps[pos+2][:snpbase] and curbase == @seq[ref][pos+1,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 2) and refbase == snps[pos-2][:snpbase] and curbase == @seq[ref][pos-3,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 1) or snps.key?(pos - 1) \n snps[pos][:info] << \"mnp;\"\n else\n snps[pos][:info] << \"snp;\" \n end\n else\n snps[pos][:info] << \"snp;\" \n end\n @snp[ref][pos] = '' unless @snp[ref].key?(pos)\n @snp[ref][pos] << snps[pos][:info]\n end\nend", "def private; end", "def test_result_id_05\n id_1 = original_files(:original_files_001).id\n id_2 = original_files(:original_files_002).id\n # case rule level = 1.\n old_result_id = OriginalFile.find(id_1).result_id(1)\n assert_equal 69,old_result_id\n new_result_id = OriginalFile.find(id_2).result_id(1)\n assert_equal OriginalFile.find(id_2).normal_result_id,new_result_id\n # case rule level = 2\n old_result_id = OriginalFile.find(id_1).result_id(2)\n assert_equal 68,old_result_id\n new_result_id = OriginalFile.find(id_2).result_id(2)\n assert_equal OriginalFile.find(2).hirisk_result_id,new_result_id\n # case rule level = 3\n old_result_id = OriginalFile.find(id_1).result_id(3)\n assert_equal 67,old_result_id\n new_result_id = OriginalFile.find(id_2).result_id(3)\n assert_equal OriginalFile.find(id_2).critical_result_id,new_result_id\n # case rule level != 1,2,3\n old_result_id = OriginalFile.find(id_1).result_id(4)\n assert_equal 69,old_result_id\n result_id = OriginalFile.find(id_2).result_id(4)\n assert_equal OriginalFile.find(id_2).normal_result_id,result_id\n end", "def claim_loop\n segments = []\n @eobs.each_with_index do |eob, index|\n @check_grouper.last_eob = eob\n @check = eob.check_information\n @job = @check.job\n if @check.micr_line_information && @check.micr_line_information.payer && @facility.details[:micr_line_info]\n @payer = @check.micr_line_information.payer\n else\n @payer = @check.payer\n end\n @facility_output_config = @facility.output_config(@payer.payer_type)\n @reason_codes = nil #this variable is used in child class for configurable section\n @eob = eob\n @claim = eob.claim_information\n @eob_index = index\n @services = eob.service_payment_eobs\n @is_claim_eob = (eob.category.upcase == \"CLAIM\")\n @count = count\n segments << transaction_set_line_number(index + 1)\n segments << transaction_statistics([eob])\n segments += generate_eobs\n end\n segments.flatten.compact\n end", "def iterate_over_exec_elem(fen_stage=0, win_status=nil, &aproc)\n cnt = 0\n\n #@genes[81..109].each { |gn|\n @genes.each { |gn|\n @gene = gn\n \n #skip project 3 gene rbcL\n next if @gene.name == \"rbcL\"\n #debugging\n #172 = secE, the smallest gene, without transfers\n #132 = thrC, the second smallest gene, with transfers\n #152 = oppA, problem in window 10/12-275-313 with all gaps\n #next if @gene.id != 152\n #puts \"cnt: #{cnt}, gn.id: #{@gene.id}, gn.name: #{@gene.name}, @genes[cnt]: #{@genes[cnt].id}\"\n\n if @stage==\"hgt-par\"\n iterate_over_win(fen_stage,win_status){ |win|\n aproc.call \"gn: #{@gene.id}, win: #{win}\"\n }\n else\n aproc.call \"gn: #{@gene.id}\"\n end\n\n #index starts at 0, so incremented at the end\n cnt += 1\n }\n\n\n\n end", "def test_confirm_point_values\n[:A,:E,:I,:O,:N,:R,:T,:L,:S,:U].each{|num| assert_equal 1, TileBag.points_for(num.to_sym)}\n\n[:D,:G].each{|num| assert_equal 2, TileBag.points_for(num.to_sym)}\n[:B,:C,:M,:P].each{|num| assert_equal 3, TileBag.points_for(num.to_sym)}\n[:F,:H,:V,:W,:Y].each{|num| assert_equal 4, TileBag.points_for(num.to_sym)}\n[:K].each{|num| assert_equal 5, TileBag.points_for(num.to_sym)} \n[:J,:X].each{|num| assert_equal 8, TileBag.points_for(num.to_sym)} \n[:Q,:Z].each{|num| assert_equal 10, TileBag.points_for(num.to_sym)} \n end", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def first_loop(letters)\n 0.upto(letters.length-1) do |idx1|\n (idx1+4).step(letters.length-1,2) do |idx2|\n return [idx1,idx2] if letters[idx1].casecmp(letters[idx2])==0\n end\n end\n nil\nend", "def find_small_set_of_string_in_large_string( large_string, small_string_set)\n \n #create and array of size L,\n small_string_size = small_string_set[0].size\n window_array = []\n \n (0..small_string_size-1).each do |index|\n window_array[index] = {}\n end\n \n #build dthe window array as we look a all the small string in a set\n small_string_set.each do |str|\n (0..str.size - 1).each do |index|\n if !window_array[index].has_key? str[index] \n #create new hash\n window_array[index][str[index]]={}\n end\n window_array[index][str[index]][str] = str\n end\n end\n\n all_found = []\n (0..large_string.size - small_string_size).each do |window_start|\n found_set = []\n first_set = true\n qualified_length = 0\n\n (window_start..window_start + small_string_size -1 ).each do |index|\n \n #puts \"String start at index #{window_start} '#{\"\"<<large_string[window_start]}'\"\n \n if window_array[ index - window_start ].has_key? large_string[index ]\n if first_set \n window_array[ index - window_start ][large_string[index]].each do |key, val|\n found_set.push(key)\n end\n first_set = false\n else\n window_array[ index - window_start ][large_string[index]].each do |key, val|\n if !found_set.include? key\n found_set.delete(key)\n end\n end\n end\n qualified_length += 1 if !found_set.empty? #suvire from the delete, increase the qualified lenghth\n elsif first_set == false and found_set.empty?\n #puts \"stop examing 1\"\n break\n else\n #puts \"stop examing 2 -- #{window_start.to_s} #{index.to_s}\"\n break\n end\n end #end of exampling each slow of the window\n #only print and save qualify string\n #p qualified_length , window_array.size\n if qualified_length == window_array.size\n all_found = all_found | found_set\n \n #puts \"Found:\" + found_set.join(\",\")\n end\n \n end\n #p window_array\n return all_found\nend", "def my_select(coll)\n # your code here!\n mod_coll = []\n i=0\n while i < coll.length\n if (yield(coll[i]))\n mod_coll.push(coll[i])\n end\n i = i+1\n end\n mod_coll\nend", "def freed_prisoners(arr)\n counter = 0\n return counter if arr[0] == 0\n arr.each do |cell|\n if cell == 1\n counter += 1\n arr.map! do |switch|\n if switch == 1\n switch = 0\n else\n swith = 1\n end\n end\n else\n next\n end\n end\n counter\nend", "def get_random_element_with_one_loop\n\tget_random_element\nend", "def one_rv\n count = 0\n for x in [email protected]\n if @elements[x].remaining_vals.length == 1\n count+=1\n end\n end\n count\n end", "def multiply(arr, beg, result)\n while arr[result*5].nil?\n arr.push(2 * arr[beg] + 1).push(3 * arr[beg] + 1).uniq!\n arr.sort!\n multiply(arr, beg + 1 ,result)\n end\nend", "def stderrs; end", "def calc_skill_names(match_id_groups_array, prev_type_exists, primary_pct, secondary_pct)\n is_primary_found = false\n primary_pct = 5 if prev_type_exists\n \n match_id_groups_array.each do |match_id_group|\n \n match_id_group.each do |match_id|\n if @matched_cells.has_key?(match_id)\n if !is_primary_found\n @pct += primary_pct\n is_primary_found = true\n else\n @pct += secondary_pct\n end\n \n break\n end\n end\n \n end\n end", "def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend", "def town_names(i=3)\nstarts = Array['Bed','Brunn','Dun','Far','Glen','Tarn']\nmiddles = Array['ding','fling','ly','ston']\nends = Array['bourough','burg','ditch','hall','pool','ville','way','worth']\n\nfinished_town_names = []\n\n\n (0...i).each do |element|\n finished_town_names[element] = starts.sample + middles.sample + ends.sample\n end\n\n return finished_town_names\n\nend", "def movies_with_director_key(name, movies_collection) \naoh = []\ni = 0\n while i < movies_collection.length do\n aoh << movie_with_director_name(name, movies_collection[i])\n i += 1\n end\n aoh\nend", "def find_four(ary)\n first = 0\n last = 3\n while last + 1 <= ary.length do\n test = []\n 4.times do |i|\n test << @posn[ary[first + i][0]][ary[first + i][1]]\n end\n if test.all? {|e| e.downcase == 'x'} || test.all? {|e| e.downcase == 'o'}\n 4.times do |i|\n if test[0].downcase == 'x'\n @posn[ary[first + i][0]][ary[first + i][1]] = 'X'\n else\n @posn[ary[first + i][0]][ary[first + i][1]] = 'O'\n end\n end\n test[0].downcase == 'x' ? @line_of_four = 'cpu' : @line_of_four = 'human'\n break\n end\n first += 1\n last += 1\n end\n end", "def every(objTemplate)\n results = Array.new\n foreach(objTemplate) do |item|\n results << item if !block_given?\n results << item if block_given? && (yield item)\n end\n results \nend", "def runs; end", "def getMostOccur \n tmpArry=[]\n tmpWArry=[];\n\t @maxparam =0 #use for store the param\n @maxelement =0 #use for store the element\n\t\t i=0\n while i<@parameters.paramsArr.length do\n \t temelementslength = @parameters.paramsArr[i].elementsArr.length\t\n \t j=0\n while j < temelementslength do\t\t\n if @parameters.paramsArr[i].elementsArr[j].times == @parameters.paramsArr[@maxparam].elementsArr[@maxelement].times\n \n tmpArry << [i , j]\n elsif @parameters.paramsArr[i].elementsArr[j].times > @parameters.paramsArr[@maxparam].elementsArr[@maxelement].times\n tmpArry.clear\n tmpArry << [i , j]\n\t\t \t @maxparam = i \n @maxelement = j\n end\t \n j+=1\n end\n i+=1\n end\n #add by chuangye -----------------------------start\n if @useweight==1\n [email protected][tmpArry[0][0]].elementsArr[tmpArry[0][1]].weight\n for k in 0...tmpArry.length do\n if @parameters.paramsArr[tmpArry[k][0]].elementsArr[tmpArry[k][1]].weight==maxweight\n tmpWArry << tmpArry[k]\n elsif @parameters.paramsArr[tmpArry[k][0]].elementsArr[tmpArry[k][1]].weight>maxweight\n tmpWArry.clear\n tmpWArry << tmpArry[k]\n end\n end\n tmp=randchar(0,tmpWArry.length-1)\n @maxparam = tmpWArry[tmp][0]\n @maxelement = tmpWArry[tmp][1]\n else\n #add by chuangye -----------------------------end\n tmp = randchar(0 , tmpArry.length-1)\n @maxparam = tmpArry[tmp][0]\n @maxelement = tmpArry[tmp][1]\n end\n end", "def do_stuff(id, sq)\n return if id.nil? or sq.empty?\n @n_in += 1\n sq.gsub!(/[^A-Za-z]/, '')\n i = 0\n @coll.extract(id, sq).each do |new_sq|\n @ofh.puts \">#{id}:#{i += 1}\"\n @ofh.puts new_sq\n @n_out += 1\n end\nend", "def cloneDataPerf\nraws = Array.new \nline = \"Stockage,Experiment,ExecTime\"\nraws.push(line)\n\nfor i in 0..@files_names.size-1 \ntemp = `less #{@files_names[i]} | grep overall` \nextension = @files_names[i].split(/\\.(\\S*)/)\narrExp = temp.split(\"\\n\")\n for j in 0..arrExp.size-1\n\tline = \"\"\n\texps = arrExp[j].split(/(Exp\\s\\s[1-9]), overall time taken is (\\d*)\\sm\\s(\\d*)/)\n\tline =\"#{extension[1].upcase},#{exps[1]},#{exps[2]}.#{exps[3]}\"\n\traws.push(line) if !line.empty?\n end #exp\n\nend # files\nputs raws.join(\"\\n\")\n\n\nend", "def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if fish1.length < fish2.length\n end\n\n return fish1 if max_length == true\n end\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def player_numbers(team_name)\n jersey_numbers = Array.new\n\n if !game_hash.keys.include?(:team_name)\n game_hash.each do |location, team_info|\n if team_info.keys.include?(:team_name)\n team_info.each do |attribute, quanity|\n if quanity == team_name\n team_info.each do |attribute, quanity|\n if attribute == :players\n # binding.pry\n quanity.each do |name, stats|\n if name.length > 0\n # binding.pry\n stats.each do |stat, stat_quanity|\n if stat == :number\n # binding.pry\n jersey_numbers << stat_quanity\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\nputs jersey_numbers\nreturn jersey_numbers\nend", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end" ]
[ "0.5171808", "0.5158201", "0.51521015", "0.51455355", "0.5117879", "0.5081813", "0.50799143", "0.5059243", "0.5039016", "0.50172246", "0.5005991", "0.5004115", "0.49803367", "0.49742758", "0.49685693", "0.49685693", "0.49677327", "0.4958952", "0.4946675", "0.4938495", "0.49338034", "0.4932331", "0.49284124", "0.49168205", "0.4908801", "0.48780018", "0.48779482", "0.48732388", "0.4870801", "0.48621365", "0.48594606", "0.48469013", "0.4841906", "0.48413172", "0.48299316", "0.48270783", "0.4818373", "0.48175782", "0.48132128", "0.4809388", "0.4802271", "0.4795683", "0.47894934", "0.47834864", "0.4782718", "0.47823215", "0.47770452", "0.4774311", "0.47686464", "0.47657603", "0.47656336", "0.47638276", "0.47605905", "0.47583768", "0.4758194", "0.47570312", "0.47538006", "0.47474828", "0.4739865", "0.47393408", "0.47378683", "0.47293994", "0.47275972", "0.47241205", "0.47241184", "0.47236088", "0.47202048", "0.4718164", "0.47144622", "0.47115344", "0.47015807", "0.4701304", "0.46996838", "0.46987677", "0.46987107", "0.46983275", "0.46974134", "0.46959245", "0.46946907", "0.46925268", "0.4690641", "0.46899578", "0.4688159", "0.4684127", "0.46820354", "0.4681851", "0.46806228", "0.46793628", "0.4675486", "0.46751484", "0.46736497", "0.46722886", "0.4670936", "0.467073", "0.46679208", "0.4667475", "0.4665397", "0.4665397", "0.4665397", "0.4665397", "0.4665397" ]
0.0
-1
Initialize this Pattern instance. site The Site. base The String path to the dir containing the pattern file. name The String filename of the pattern file. Returns the new Pattern.
def initialize(site, source, dir, name) @site = site @dir = dir @base = containing_dir(source, dir) @name = name read_yaml(@base, name) self.markup_escaped = CGI.escapeHTML(content) self.id = data.key?('id') ? data['id'].to_s : name.match(MATCHER)[1] self.section = data.key?('section') ? [data['section'].to_s] : [] self.usage = data.key?('usage') ? data['usage'].to_s : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(site, name, patterns)\n @site = site\n @dir = ''\n @name = name\n @patterns = patterns\n\n self.basename = name.gsub(' ', '-')\n self.ext = '.html'\n self.data = {\n 'layout' => 'pattern_library',\n 'patterns' => patterns,\n 'sections' => pattern_attr_hash('section'),\n 'title' => name\n }\n end", "def initialize(name)\n @name = @pattern = name\n @templatedir = \"#{PATTERNDIR}/#{@pattern}/templates\"\n @knownpatterns = Dir.entries(PATTERNDIR).reject {|x| [\"..\",\".\"].include?(x)}\n @manitemplates = Dir.entries(templatedir).reject {|x| [\"..\",\".\"].include?(x)}\n rescue Errno::ENOENT => e\n abort \"Pattern #{@pattern} is not defined within the patterns directory #{PATTERNDIR}\n Known patterns are:\n #{@knownpatterns.join(\"\\n\")}\"\n end", "def initialize(name, pattern)\n @name, @pattern = name, pattern\n end", "def initialize(site, base, name)\n @site = site\n @base = base\n @name = name\n\n if site.theme && site.theme.layouts_path.eql?(base)\n @base_dir = site.theme.root\n @path = site.in_theme_dir(base, name)\n else\n @base_dir = site.source\n @path = site.in_source_dir(base, name)\n end\n @relative_path = @path.sub(@base_dir, \"\")\n\n self.data = {}\n\n process(name)\n read_yaml(base, name)\n end", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @dirty = true\n\n self.process(name)\n self.read_yaml(File.join(base, dir), name)\n end", "def initialize(dir)\n # Create a new patterns hash\n @patterns = Hash.new\n\n # Get the pattern files in the directory\n dir += '/' if(!dir.end_with?('/'))\n files = Dir.glob(dir + \"*.pattern\")\n\n # Create a DesignPattern for each file\n files.each do |f|\n pattern = DesignPattern.new(f)\n @patterns[pattern.name] = pattern\n end\n end", "def initialize( name, pattern, *args, &block )\n\t\t\t@pattern = pattern\n\n\t\t\tsuper( name, *args, &block )\n\t\tend", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = if site.in_theme_dir(base) == base # we're in a theme\n site.in_theme_dir(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process(name)\n read_yaml(PathManager.join(base, dir), name)\n generate_excerpt if site.config[\"page_excerpts\"]\n\n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(relative_path, type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self\n end", "def initialize(site, base, dir, name); end", "def initialize(site, path)\n super\n @metadata = [ :layout ]\n \n @name = File.basename(source_path, source_ext)\n end", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name + \".html\"\n self.process(name + \".html\")\n self.data = Hash.new\n self.data[\"layout\"] = \"default\" #need to have a default layout\n end", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n @gallery_name = pathify(dir).name\n\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = File.join(base, dir, name)\n\n process_dir config.dir(:thumbs),\n config.dir(:galleries, :out), \n gallery_name,\n File.join(output_gallery_name, config.dir(:thumbs, :out))\n\n @relative_path = File.join(@dir, output_name)\n @extname = File.extname(@name)\n @data = @site.frontmatter_defaults.all(relative_path, type)\n end", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n\n @site = site\n @base = base\n @dir = dir\n @name = name ? name : 'index.html'\n @path = name ? File.join(base, dir, name) : ''\n\n read_file base, dir, name\n\n process_dir config.dir(:galleries), config.dir(:galleries, :out)\n process_name \n \n paginate config.items_per_page\n \n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(File.join(dir, @name), type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self \n end", "def initialize(name)\n @r = name\n list = FILE_LIST\n\n list = list << {:name=>\"lib/#{name}\", :file=>false}\n list = list << {:name=>\"spec/#{name}_spec.rb\", :file=>true}\n\n super(name, list)\n\n\n end", "def initialize(pattern)\n @pattern = pattern\n end", "def initialize(base, dir, name)\n @base = base\n @dir = dir\n @name = name\n \n self.data = {}\n \n self.process(name)\n self.read_yaml(File.join(base, dir), name)\n #self.transform\n end", "def initialize(site, base, dest_dir, dest_name, src_dir, src_name, data_mtime )\n @site = site\n @base = base\n @dir = dest_dir\n @dest_dir = dest_dir\n @dest_name = dest_name\n @dest_url = File.join( '/', dest_dir ) \n @dest_url = File.join( '/', dest_dir, dest_name ) if !dest_name.match( /index.html/i )\n @src_mtime = data_mtime\n\n src_file = File.join(base, src_dir, \"#{src_name}.markdown\" )\n src_name_with_ext = \"#{src_name}.markdown\" if File.exists?( src_file )\n src_name_with_ext ||= \"#{src_name}.html\"\n\n @name = src_name_with_ext\n self.process(src_name_with_ext)\n \n # Read the YAML from the specified page\n self.read_yaml(File.join(base, src_dir), src_name_with_ext )\n # byebug\n # Remember the mod time, used for site_map\n file_mtime = File.mtime( File.join(base, src_dir, src_name_with_ext) )\n @src_mtime = file_mtime if file_mtime > @src_mtime\n end", "def initialize(site, path)\n super\n @metadata = [ :title, :layout, :author ]\n \n @name = source_path[0..(-1-source_ext.length)].gsub(/\\//, '-')\n \n @tags = []\n unless source_metadata[:tags].nil?\n for tag in source_metadata[:tags]\n @tags << site.tags[tag]\n @tags.last << self\n end\n end\n \n if name =~ /^(\\d+-\\d+-\\d+)-(.+)$/\n @created = Time.parse $1\n @updated ||= @created\n @slug = $2\n @output_dir = created.strftime('%Y/%m/%d')\n @output_path = File.join output_dir, \"#{slug}.html\"\n @uri = \"/#{output_path}\"\n else\n raise ArgumentError, \"Bad file name: #{name}\"\n end\n end", "def initialize(site, path)\n super\n @metadata = [ :title, :layout ]\n \n src_base = File.basename(source_path, source_ext)\n output_ext = File.extname(src_base)\n if output_ext.nil? || output_ext.empty?\n output_ext = '.html'\n else\n src_base = File.basename(src_base, output_ext)\n end\n @output_dir, src_file = File.split(source_path)\n \n if output_dir == '.'\n prefix = ''\n else\n prefix = \"#{output_dir}/\"\n end\n @name = \"/#{prefix}#{src_base}\"\n @output_path = \"#{prefix}#{src_base}#{output_ext}\"\n \n if src_base == 'index'\n @uri = \"/#{output_dir}/\"\n else\n @uri = \"/#{output_path}\"\n end\n end", "def initialize(site, base, name); end", "def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end", "def load_pattern(pattern_name, pattern_group = \"default\", parent_binding = nil)\n load_from_file_in_template(pattern_name, parent_binding, pattern_group, :pattern)\n end", "def load_pattern(pattern_name, pattern_group = \"default\", parent_binding = nil)\n load_from_file_in_template(pattern_name, parent_binding, pattern_group, :pattern)\n end", "def initialize(name, path)\n @path = path\n @name = Inflecto.underscore(name)\n @klass = Inflecto.camelize(name)\n @version = Time.new.strftime \"%Y%m%d%H%M%S\"\n end", "def initialize(name)\n @fh = File.open(name, 'r')\n end", "def initialize(site, base, dir, name, from_plugin: false)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @ext = File.extname(name)\n @basename = File.basename(name, \".*\")\n @path = if from_plugin\n File.join(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process\n\n self.data ||= HashWithDotAccess::Hash.new\n\n Bridgetown::Hooks.trigger :generated_pages, :post_init, self\n end", "def initialize(name, file, *has)\n [name, file, has]\n\n @has = has\n @name = name\n\n @filename = File.basename(file, '.*')\n\n # :nocov:\n @url = (self.class.relative_from.nil? ?\n (self.class.link_to ? (self.class.link_to + '/' + File.basename(file)) : file)\n : (self.class.link_to ? (self.class.link_to + '/' + File.basename(file)) : file)).to_s[/.*(?=\\..+$)/]\n # :nocov:\n \n make_css\n end", "def initialize site, content, path\n super(site)\n @content = content\n @input_mtime = DateTime.now.to_time\n\n case (path)\n when Pathname\n @path = Pathname.new(File.join site.dir, 'synthetic', path)\n else\n @path = Pathname.new(File.join site.dir, 'synthetic', path.to_s)\n end\n end", "def pattern\n @pattern ||= Pattern.patterns[pattern_name]\n end", "def init(name)\n @name = name\n @package_files = Rake::FileList[\"README.txt\", \"HISTORY.txt\"]\n @package_dir = 'build'\n @need_sed = true\n @need_packer = true\n @images_dir = 'images'\n @css_dir = 'css'\n @js_dir = 'src'\n @js_files = Rake::FileList.new\n @js_files.include(\"#{@js_dir}/**/*.js\")\n @image_files = Rake::FileList.new\n @image_files.include(\"#{@js_dir}/#{@image_dir}/**/*.*\")\n @css_files = Rake::FileList.new\n @css_files.include(\"#{@js_dir}/#{@css_dir}/**/*.css\") \n end", "def initialize(base, name)\n @base = base\n @name = name\n \n self.data = {}\n \n self.process(name)\n self.read_yaml(base, name)\n end", "def initialize(base, name)\n @base = base\n @name = name\n \n self.data = {}\n \n self.process(name)\n self.read_yaml(base, name)\n end", "def initialize file_path\n md = file_path.match(/(\\d{4}-\\d{2}-\\d{2}-?(\\d{2}-\\d{2})?)-(\\w*)-([\\w-]*)/)\n\n unless md.nil?\n @date = Date.parse(md[1])\n @tags = md[4].split \"-\"\n end\n\n File.open(file_path) do |file|\n\n @title = \"\"\n @title = file.readline until md = @title.match(/^#+(.*)/) \n @title = md[1]\n\n if (md = @title.match /^\\[(.*)\\]\\((.*)\\)/)\n @title = md[1] \n @link = md[2]\n @type = :link\n else\n @type = :post\n end\n\n @content = Maruku.new(file.read).to_html\n @slug = @title.downcase.gsub(/[^\\w\\s]/, \"\").gsub /\\s+/, \"-\"\n @permalink = \"#{@slug}.html\"\n end\n end", "def initialize( fn )\n @path = fn\n @dir = ::Webby::Resources.dirname(@path)\n @name = ::Webby::Resources.basename(@path)\n @ext = ::Webby::Resources.extname(@path)\n @mtime = ::File.mtime @path\n\n @_meta_data = {}\n self._reset\n end", "def initialize(name = :excellent)\n @name = name\n @paths = nil || []\n @html = false\n yield self if block_given?\n define\n end", "def initialize(site, source, dir, name)\n @site = site\n @base = File.join(source, dir)\n @name = name\n self.data = {\"layout\" => \"photo\"}\n\n self.categories = [] # dir.split('/').reject { |x| x.empty? }\n self.tags = []\n\n self.process(name)\n\n self.content = <<content\n<img src=\"#{self.id}\" />\ncontent\n end", "def initialize(path)\n @path = Pathname.new(path)\n @name = @path.basename(@path.extname).to_s\n end", "def initialize absolute_name, relative_name = absolute_name\n super()\n @name = nil\n @absolute_name = absolute_name\n @relative_name = relative_name\n @file_stat = File.stat(absolute_name) rescue nil # HACK for testing\n @diagram = nil\n @parser = nil\n\n @classes_or_modules = []\n end", "def initialize(name)\n @name = name\n load \n end", "def initialize(file_name)\n super()\n @name = nil\n @relative_name = file_name\n @absolute_name = file_name\n @file_stat = File.stat(file_name) rescue nil # HACK for testing\n @diagram = nil\n @parser = nil\n\n RDoc::TopLevel.lock.synchronize do\n RDoc::TopLevel.files_hash[file_name] = self\n end\n end", "def initialize(name)\n super()\n\n @name = name\n build_document\n build_root\n end", "def initialize(site, base, dir, name, config={})\n @config = config\n super(site, base, dir, name)\n post_init if respond_to?(:post_init)\n end", "def instantiate_pattern\n pattern = Pattern.new\n doc.search('/RenoiseSong/Tracks/*').map(&:name).each do |track|\n type = track.gsub(/\\ASequencer/, 'Pattern')\n pattern.tracks << PatternTrack.new(type: type)\n end\n pattern\n end", "def initialize(name='barista:test') #:yields: self\n @name = name\n @pattern = '{test,spec}/coffeescripts/**/*.coffee'\n yield self if block_given?\n define\n end", "def initialize(path,logger=nil)\r\n @pathname = Pathname.new(path)\r\n @logger = logger\r\n scan_templates\r\n end", "def initialize(pat, descr)\n\t @pat = pat #instance varable\n\t @descr = descr\n\n end", "def initialize(path); end", "def initialize(path)\n @path = path\n @real_path = File.expand_path(@path)\n @dir_path = File.dirname(@real_path)\n @dir = File.directory?(@real_path)\n @name = File.basename(@real_path)\n unless @dir\n @ext = File.extname(@name, conf[:options][:dots])\n @name.gsub!(Regexp.new('.' << Regexp.escape(@ext) << '$'), '') unless @ext.empty?\n @level = 0\n else\n @level = @real_path.split('/').size\n end\n end", "def initialize(path)\n @path = Pathname.new(path).tap{ |check| check.stat }\n @namespace = @path.parent.basename.to_s\n @name = @path.basename.to_s\n initialize_specfile\n initialize_options\n initialize_directories\n initialize_models\n rescue Errno::ENOENT => error\n raise RuntimeError, error.message\n end", "def initialize(name)\n if name.is_a?(Regexp)\n @name = name\n else\n @name = normalize(name)\n end\n @aliases = []\n end", "def initialize(pattern, rep_name, block, params = {})\n # TODO: remove me\n unless pattern.is_a?(Nanoc::Int::StringPattern) || pattern.is_a?(Nanoc::Int::RegexpPattern)\n raise 'Can only create rules with patterns'\n end\n\n @pattern = pattern\n @rep_name = rep_name.to_sym\n @snapshot_name = params[:snapshot_name]\n\n @block = block\n end", "def initialize(name)\n @path, @name = nil\n\n if File.directory?(name)\n @path, @name = name, File.basename(name)\n\n elsif Main.respond_to?(:extensions_path)\n @name = name\n [Main.extensions_path].flatten.each do |dir|\n next unless @path.nil?\n @path = File.join(dir, name)\n @path = nil unless File.directory?(@path)\n end\n end\n\n raise ExtensionNotFound unless File.directory?(@path.to_s)\n end", "def initialize(group_name, file_path) # overriding the default initialize with a positional arguement group name\n @name = group_name # setting instance variable @name\n @path = file_path\n @names_array = self.path_to_array\n end", "def initialize name\n @name = name\n @version = nil\n @author = nil\n @files = {}\n end", "def initialize(path = \"NO_PATH_SPECIFIED\") \n path = path.to_s.split(/\\s/).first # remove trailing spaces \n @path, @name = path, extract_name_from(path)\n super()\n end", "def initialize(pattern, options = {})\n raise ArgumentError, 'pattern cannot be nil' unless pattern\n raise ArgumentError, 'pattern cannot be empty' if pattern.empty?\n @pattern = pattern\n @options = {\n :glob => :all\n }.merge(options)\n @paths = []\n end", "def initialize(site, base, dir, name, collection = T.unsafe(nil)); end", "def initialize(path)\n @dir = File.basename(path)\n @name = @dir.humanize\n end", "def initialize(path)\n @path = File.expand_path(path)\n end", "def file(name)\n Rule::File.new(name.to_s, path(name))\n end", "def initialize( field, name, *options, &block )\n\t\t\tname ||= field\n\t\t\t@pattern_name = name\n\t\t\tpattern = BUILTIN_CONSTRAINT_PATTERNS[ name.to_sym ] or\n\t\t\t\traise ScriptError, \"no such builtin constraint %p\" % [ name ]\n\n\t\t\tsuper( field, pattern, *options, &block )\n\t\tend", "def initialize\n super\n @name = \"rum\"\n @rakefiles = DEFAULT_RAKEFILES.dup\n end", "def initialize(name)\n @name = name #variable class diawali @, akan dibuat ketika object dibuat\n end", "def define_pattern(name, block)\n pattern_node = TmGrammar::Pattern.new(grammar, block).evaluate\n pattern_node.name = name\n node.add_pattern(pattern_node)\n end", "def initialize(name=:js_build)\n @name = name\n @description = \"Building/Concatenating the JS files\"\n @pattern = '*.js'\n @deps = []\n @outdir = \".\"\n @inputdirs = []\n\n # don't look here!\n @file_list = []\n\n yield self if block_given?\n define\n end", "def initialize(path)\n @path = path\n\n base = path.empty? ? docroot : \"#{docroot}/#{path}\"\n\n if File.directory? base\n @file = \"#{base}/README.md\"\n @dir = base\n @type = :readme\n elsif File.exist? \"#{base}.md\"\n @file = \"#{base}.md\"\n @dir = File.dirname file\n @type = :file\n else\n @file = ''\n @dir = docroot\n @type = :empty\n end\n end", "def initialize(name = :complexity) # :yield: self\r\n @name = name\r\n @files = Rake::FileList.new\r\n @output_dir = 'complexity'\r\n @cyclo = true\r\n @token = false\r\n\r\n yield self if block_given?\r\n\r\n define_tasks\r\n end", "def initialize(name)\r\n \t\t@name = name\r\n \tend", "def initialize name\n\t\t\t@name = name\n\t\tend", "def initialize(name) end", "def initialize(name, regex, proc=nil, &block)\n @name = name\n @regex = regex\n @proc = proc || block\n end", "def initialize(file)\r\n raise IOError, \"Cannot read #{file}\" unless File.readable? file\r\n @file = file\r\n @filename = File.basename file\r\n @name = File.basename file\r\n @keywords = @name.split\r\n @category = 'experimental uploader'\r\n @description = \"A video about #{@name}\"\r\n end", "def initialize(name)\n \t\t@name = name\n \tend", "def initialize(file_name, dir = default_dir)\n @dir = dir\n @file_name = file_name\n end", "def initialize(sitefile, opts={})\n Gumdrop.send :set_current_site, self\n @sitefile= sitefile.expand_path\n @options= Util::HashObject.from opts\n _options_updated!\n @root= File.dirname @sitefile\n @last_run= 0\n @_preparations= []\n\n @contents= ContentList.new\n @layouts= SpecialContentList.new \".layout\"\n @partials= SpecialContentList.new\n @generators= []\n @data= DataManager.new\n\n clear\n end", "def initialize path\n @path, @weight = path, 0\n @dependencies, @permissions, = [], []\n @name = File.basename(path).to_sym\n load_yaml\n end", "def initialize(file)\n @file = File.expand_path(file)\n @dir = File.dirname(@file)\n @semver = Versioning.find(@dir)\n end", "def initialize(path)\n @path = sanitize(path)\n end", "def initialize(name)\n @name = name #has a name\n @@all << self\n end", "def initialize(name, regexp)\n @name = name\n @regexp = regexp\n validate_input\n end", "def initialize(file_path)\n\t\tbegin\n\t\t\t@file_desc = File.open(file_path)\n\t\trescue\n\t\t\traise \"File not found\"\n\t\tend\n\tend", "def initialize(name, data)\n @name = name\n @extname = File.extname(name)\n @_data = data\n end", "def initialize(name)\n @name = name\n @files = []\n @quiet = false\n\n # Allow custom configuration to be defined in a block passed to constructor\n yield self if block_given?\n\n define\n end", "def initialize( *args )\n\t\t@template = nil\n\t\t@template_dir = GENERATOR_DIR + 'template/darkfish'\n\t\t\n\t\t@files = []\n\t\t@classes = []\n\t\t@hyperlinks = {}\n\n\t\t@basedir = Pathname.pwd.expand_path\n\n\t\tsuper\n\tend", "def initialize(name)\n name(name)\n end", "def initialize(file_path)\n\t\t@path = file_path\n\tend", "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 initialize(file)\n @file = file\n\n case ext = File.extname(file)\n when '.till', '.til'\n fname = file.chomp(ext)\n else\n fname = file\n end\n\n #@format = File.extname(fname)\n @location = File.dirname(File.expand_path(file))\n\n text = File.read(file).rstrip\n\n # front matter indicator\n if text =~ /\\A---/\n text = text.sub(/---.*?\\n/, '')\n meta, body = *text.split(/^---/)\n else\n meta = nil\n body = text\n end\n\n @content = body\n\n fm = meta ? YAML.load(meta) : {}\n\n self.filters = fm['filter'] || ['erb']\n\n self.format = fm['format'] || File.extname(fname)\n\n if fm['output']\n self.output = fm['output']\n else\n self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]\n end\n\n\n\n #@context = Context.new(@location) # prime context/scope\n end", "def initialize(raw)\n super(raw)\n match = REGEXP.match(raw.strip) or raise ParserError\n\n if match[1] == 'd'\n @dir = true\n else\n @file = true\n end\n\n # TODO: Permissions, users, groups, date/time.\n\n @basename = match[9]\n end", "def initialize(file)\n @uri = nil\n @path = ::File.expand_path(file)\n\n @package = Gem::Package.new @path\n @spec = @package.spec\n @name = @spec.name_tuple\n end", "def initialize(name=self.class.to_s[/::[^:]+$/][10..-1].downcase)\r\n super(name)\r\n end", "def initialize(website)\n\t\t@subpages = website.subpages\n\t\t@base_url = website.base_url\n\t\t@pattern_finder, @pattern_tester = PatternFinder.new(website), PatternTester.new(@subpages)\n\t\t@crawler_patterns, @duplicate_patterns = [], []\n\tend", "def initialize(dir)\n @root = dir\n raise \"Cannot find an engine in either #{dir}!\" if !File.exist?(@root)\n @name = File.basename(@root)\n @info = '(none)'\n end", "def initialize(name, template)\n @name = name\n @template = template\n end", "def initialize(file)\n @file = File.expand_path(file)\n fail \"Can't find file #{@file}\" unless File.exist?(@file)\n @dir = File.dirname(@file)\n IO.readlines(@file).each { |line| initialize_data line }\n @configuration = Configuration.new(self)\n @semver = Versioning.find(@dir)\n end", "def initialize(filename)\n super(filename, EXT)\n end", "def initialize(filename)\n super(filename, EXT)\n end", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend" ]
[ "0.72502935", "0.7065959", "0.7036724", "0.6972731", "0.68835664", "0.6836079", "0.68202406", "0.6737908", "0.65452296", "0.64780134", "0.6436933", "0.6425312", "0.6369336", "0.633542", "0.620871", "0.6206066", "0.6169135", "0.6148808", "0.6123083", "0.6087598", "0.6087352", "0.6066593", "0.6066593", "0.60463226", "0.6012869", "0.59566575", "0.5949281", "0.5924888", "0.591906", "0.5916533", "0.5910004", "0.5910004", "0.58846855", "0.5883981", "0.5853062", "0.58228636", "0.5814758", "0.5801341", "0.57941073", "0.57821774", "0.5780058", "0.5721551", "0.57049936", "0.5690192", "0.567645", "0.56635976", "0.56182784", "0.5591276", "0.5551673", "0.5539058", "0.5536519", "0.55360585", "0.5534628", "0.5533807", "0.5529017", "0.5526816", "0.5514843", "0.5510335", "0.5508285", "0.55056036", "0.5505282", "0.54780287", "0.5472705", "0.54702646", "0.54669785", "0.54602885", "0.54491484", "0.5434521", "0.5434403", "0.54226136", "0.5409738", "0.54087293", "0.54014224", "0.53931516", "0.53921777", "0.53894466", "0.53884417", "0.5387445", "0.53830075", "0.5381354", "0.5381155", "0.5379374", "0.53776824", "0.53770006", "0.5366769", "0.53608567", "0.53527343", "0.53518873", "0.5349753", "0.53472257", "0.53471136", "0.5341867", "0.53388405", "0.53266835", "0.53264946", "0.5326339", "0.5326339", "0.53234", "0.53234", "0.53234" ]
0.5914717
30
Get the full path to the directory containing the pattern files
def containing_dir(source, dir) File.join(source, dir, '_patterns') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end", "def dir(pattern, base=FOUNDATION_BOARD)\n Dir[File.join(base, pattern)].map {|name| File.basename name}\nend", "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 path_string\n pattern\n end", "def compute_glob_pattern(file_spec)\n segments = file_spec.split(Repositext::Cli::FILE_SPEC_DELIMITER)\n r = ''\n if segments.all? { |e| e =~ BASE_DIR_NAME_REGEX || e =~ FILE_PATTERN_NAME_REGEX }\n # file_spec consists of named base_dir and/or file_pattern\n bd = segments.detect { |e| e =~ BASE_DIR_NAME_REGEX } # e.g., 'content_dir'\n fp = segments.detect { |e| e =~ FILE_PATTERN_NAME_REGEX } # e.g., 'at_files'\n r << base_dir(bd) if bd\n r << file_pattern(fp) if fp\n else\n # interpret file_spec as glob pattern, either an absolute path, or\n # a relative path, based on current working directory.\n # NOTE: this doesn't necessarily have to contain '*'. It could be the\n # path to a single file.\n if '/' == file_spec[0]\n # absolute path, use as is\n r = file_spec\n else\n # relative path, based on current working directory\n # Note: we could use just the file_spec since relative paths are\n # based on pwd by default. I just wanted to make the behavior obvious.\n r = File.expand_path(file_spec, Dir.pwd)\n end\n end\n r\n end", "def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end", "def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end", "def source_dir_and_glob\n path = fix_path source\n dir, glob = File.dirname(path), File.basename(path)\n raise \"Can't handle ISS pattern #{source}\" if dir.include?('*')\n return dir, glob\n end", "def query\n parent_folders = @pattern.split('/')[0..-2]\n parent_folders << '*' if parent_folders[-1] != '*'\n File.join(*parent_folders)\n end", "def matching_file(path)\n File.join(root.folder, path)\n end", "def path_dir\n File.split(path).first\n end", "def path\n \"%s/%s\" % [dirname, filename]\n end", "def glob_to_directory glob\n glob.gsub(/(\\/\\*|\\/\\*\\*\\/\\*\\*?)$/, '')\n end", "def find_path_with_base(f)\n Dir.glob(f + \"*\").first || \"\" # don't return nil; makes for bad spec error messages\nend", "def glob_to_directory(glob); end", "def dir\n calc_dir(@basename)\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 containing_directory\n path.dirname\n end", "def file_path\n dir\n end", "def file_path\n dir_name + file_name\n end", "def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end", "def logfilter_path\n dir = File.expand_path(\".\")\n while true\n file = File.join(dir,FILTER_FILENAME)\n return file if File.exist?(file)\n break if dir.length < 2\n dir = File.dirname(dir)\n end\n nil\n end", "def glob(pattern)\n Dir.chdir(@output_dir) do\n Dir[pattern]\n end\n end", "def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end", "def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end", "def path_in_dir(file)\n \"#{@req.env['PATH_INFO']}/#{file}\".gsub('//', '/')\n end", "def filename\n Dir[glob].first if exists?\n end", "def file_dir\n 'files'\n end", "def directory_glob\n glob = File.join(directory_path, \"#{globular_file_parts}.*\")\n Dir.glob(glob)\n end", "def path_for original\n current_output_directory.join(file_time_by_filepath(original).strftime(settings[:ordered_time_pattern])).join(original.basename)\n end", "def output_path_without_extension\n File.join output_folder, processed_original_filename_without_extension\n end", "def fetch_path(start_path)\n ['', 'config'].each do |directory|\n ['', '.'].each do |prefix|\n path = File.join(start_path, directory, \"#{prefix}#{@file_name}\")\n return path if File.exist?(path)\n end\n end\n nil\n end", "def directory\n File.dirname @path\n end", "def dir_path\n File.expand_path(File.dirname(@path))\n end", "def file_paths\n Dir.glob(@filepath_pattern).sort\n end", "def file_dir\n @parent_generator.file_dir\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 directory\n File.dirname(@path) + '/'\n end", "def find_file_in_targetdir(endpath)\n pattern= [get_confManager.target_dir,\"**/**\"].join('/')\n # puts \"Searching for #{endpath} into #{pattern}\"\n Dir[pattern].find{|path| path =~ Regexp.new(\"#{endpath}$\")}\n end", "def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end", "def root\n '../' * file.count('/')\n end", "def recipe_path(recipe, group = '')\n File.join File.dirname(__FILE__), 'recipes', group.to_s, \"#{recipe.to_s}.rb\" \n end", "def result_paths( pattern = '*' )\n paths = nil\n Dir.chdir(dir) {\n paths = Dir.glob(pattern).map {|x| Pathname.new(x).expand_path }\n }\n # remove directories of Analysis\n anl_dirs = analyses.map {|anl| /^#{anl.dir.to_s}/ }\n paths.reject do |path|\n anl_dirs.find {|anl_dir| anl_dir =~ path.to_s }\n end\n end", "def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end", "def base_dir_for_path_parameters; end", "def file_path\n File.join(dir,filename)\n end", "def get_path(fullpath = \"\")\n (fullpath || \"\").scan(/^[\\w+|\\/]+/)[0]\n end", "def file_path(append_extension = true)\n\t\tpath = SOLUTION_PATH + folder_name + class_name\n\t\tpath += '.java' if append_extension\n\t\treturn path\n\tend", "def filepath_pattern(filepaths)\n return \"\" if filepaths.nil?\n\n filepaths.map! { |path| '^' + path + '$' }\n filepaths.join('|')\n end", "def path_to glob\n paths_to(glob).first\n end", "def rel_path(file)\n File.dirname(file)\n end", "def convert_glob_to_absolute(glob); 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 dir\n File.dirname(__FILE__)\n end", "def dir_name\n File.dirname(file_name)\n end", "def to_regex_str\n if pattern == \"**\"\n \".*\"\n else\n \"[^/]+\"\n end\n end", "def locate\r\n File.dirname(__FILE__)\r\n end", "def locate\r\n File.dirname(__FILE__)\r\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\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 work\n '/' + File.dirname(file)\n end", "def input_files_pattern\n @args.options[:input_files_pattern]\n end", "def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end", "def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end", "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 generate_intended_filename_regex conf\n prefix = \"#{ conf['local_hostname'] }-\\\\d{4}_\\\\d{2}_\\\\d{2}\"\n case conf['type']\n when /dir/\n dir_part = conf['path'].sub(/\\//,'').gsub(/\\//,\"-\")\n return \"#{ prefix }-#{ dir_part }\\\\.tar\\\\.gz\"\n when /mys/\n db_part = conf['database']\n return \"#{ prefix }-#{ db_part }\\\\.sql\\\\.gz\"\n end\nend", "def full_path\n \"templates/#{filename}\"\n end", "def path\n @absolute_path.sub(%r{^#{Slimdown.config.location}/(.*)\\.md}, '\\1')\n end", "def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end", "def directory\n self.path.directory\n end", "def get_web_sample_path()\n\t\treturn backslashify(File.join(Dir.pwd, WEB_SAMPLE_DIR))\n\tend", "def path\n @path ||= Pathname.new(dir) + filename\n end", "def dirname( fn )\n ::File.dirname(fn).sub(%r/\\A[^\\/]+\\/?/o, '')\n end", "def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end", "def get_asset_dir(path)\n root_paths.each { |root| return root if path.include?(root) }\n nil\n end", "def files_path\n File.expand_path(\"#{Config.project_root}/files\")\n end", "def dir\n Rails.root.join(ROOT, type, name).to_s\n end", "def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end", "def dir\n url.end_with?(\"/\") ? url : url_dir\n end", "def resource_path\n '.' + Dir[File.dirname(__FILE__)][/\\/resource\\/.*/]\n end", "def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end", "def path_as_r_glob\n path.map {|p| \"#{p}/**/#{self.base_as_r}\"}\n end", "def get_directory(prefix='')\n File.expand_path(prefix, File.dirname(__FILE__))\n end", "def path\n ::File.join(@folder, @file)\n end", "def path\n path = @file.sub(File.expand_path(root_path), '')\n\n # if xx.haml (but not xx.html.haml), \n if tilt?\n path = path.sub(/\\.[^\\.]*$/, \"\")\n path += \".#{default_ext}\" unless File.basename(path).include?('.')\n end\n\n path\n end", "def discover_path(root = @config.working_dir, folder = '', extension = '')\n return @path unless @path.blank?\n if is_middleman?\n File.join(root, 'source', folder)\n elsif is_rails?\n File.join(root, 'app', 'assets', folder)\n else\n extension.blank? ? File.join(root) : File.join(root, '/**', \"/*.#{extension}\")\n end\n end", "def templatepath(environment = nil)\n dirs = Puppet.settings.value(:templatedir, environment).split(File::PATH_SEPARATOR)\n dirs.select do |p|\n File::directory?(p)\n end\n end", "def base_export_dir\n \"#{@directory.slug}_files\"\n end", "def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end", "def output_directory_path\n if @output_directory.nil?\n directory = File.join(Rails.root, 'script')\n else\n directory = File.join(@output_directory, \"\")\n end\n directory\n end", "def path(match, options={})\n return [] if options[:from]\n\n found = []\n $LOAD_PATH.uniq.map do |path|\n list = Dir.glob(File.join(File.expand_path(path), match))\n list = list.map{ |d| d.chomp('/') }\n found.concat(list)\n end\n found.concat(data_path(match, options))\n found\n end", "def path\n @directory.path\n end", "def file_paths\n src_file_mask = File.join(@folder_path, '**', '*.c')\n @file_paths = Dir.glob(src_file_mask)\n return @file_paths\n end", "def path_for original\n current_output_directory.join(daily_directory_for(file_time(original).strftime(settings[:ordered_time_pattern]), original)).join(File.mtime(original.to_path).to_i.to_s).join(slug_for(processing_time, original))\n end", "def output_path_for(step)\n \"#{work_directory}/#{file_name}_#{step['name']}.#{step['extension']}\"\n end", "def relative_directory; end", "def company_program_files_dir\n return pretty_path(File.join(Dir::PROGRAM_FILES, 'RightScale'))\n end", "def pathDistSource\n\tpathDist + \"source/\"\nend" ]
[ "0.68543875", "0.6758664", "0.67166877", "0.66465354", "0.6623477", "0.66223437", "0.6523856", "0.65213394", "0.65061957", "0.64749914", "0.6433306", "0.64152014", "0.6384811", "0.6368883", "0.63144666", "0.629667", "0.62882304", "0.6281049", "0.6274255", "0.6221876", "0.6221184", "0.6184746", "0.6159102", "0.6148002", "0.61425364", "0.6133757", "0.61198956", "0.61146545", "0.6082105", "0.6049861", "0.60479224", "0.6035438", "0.6029595", "0.60221195", "0.60192245", "0.6018373", "0.6010069", "0.6005994", "0.60053617", "0.60036814", "0.6002003", "0.59897894", "0.5979602", "0.5978534", "0.5969906", "0.5955081", "0.59470487", "0.5943729", "0.59407175", "0.59270626", "0.5915692", "0.59101236", "0.59011114", "0.590045", "0.5889918", "0.5887827", "0.58726645", "0.58692527", "0.58692527", "0.5863038", "0.5862461", "0.5858987", "0.5858379", "0.58572936", "0.5854405", "0.58518034", "0.58469194", "0.58441526", "0.58186376", "0.5813938", "0.58102536", "0.580693", "0.5806796", "0.5804542", "0.58023196", "0.5800178", "0.57954085", "0.57815075", "0.57794774", "0.5771072", "0.57622474", "0.5753941", "0.5747032", "0.57425874", "0.574079", "0.57385176", "0.5736644", "0.5733059", "0.573069", "0.5729157", "0.57270867", "0.57270867", "0.5717603", "0.5717445", "0.57102406", "0.57067317", "0.5699074", "0.56974614", "0.56924427", "0.5689522" ]
0.71348125
0
Obtain destination path. dest The String path to the destination dir. Returns destination file path String.
def destination(dest) # The url needs to be unescaped in order to preserve the correct filename path = Jekyll.sanitized_path(dest, CGI.unescape(url)) path = File.join(path, 'index.html') if path[/\.html$/].nil? path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destination(dest)\n File.join(dest, @ddir, @name)\n end", "def destination(dest)\n File.join(dest, @dir, insert_before_last_dot(@name, @nameextension))\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dir, @name )\n# path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dest_dir, @dest_name )\n path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def destination(dest)\n @destination ||= {}\n @destination[dest] ||= begin\n path = site.in_dest_dir(dest, URL.unescape_path(url))\n path = File.join(path, \"index\") if url.end_with?(\"/\")\n path << output_ext unless path.end_with? output_ext\n path\n end\n end", "def get_source_filepath(dest)\n dest.gsub(@path_destination, @path_source)\n end", "def get_dest_filepath(source)\n # If is a directory ending with a dot, we remove the dot\n source = source[0..-3] + '/' if source[-2..-1] == './'\n # We change the prefix from source to dest\n source.gsub!(@path_source, @path_destination)\n source\n end", "def destination(dest)\n File.join(dest, CGI.unescape(self.url))\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename\n File.join(dest, CGI.unescape(full_url))\n end", "def dest_path\n @dest_path ||= remote_path.sub(/^~\\//, '').sub(/\\/$/, '')\n end", "def get_path(dest,path)\n if @prev[dest] != -1\n path += get_path(@prev[dest],\"\")\n end\n path += \">#{dest}\"\n end", "def fullDestPath(destPath)\n\t'generated/' + destPath\nend", "def given_destination\n dir\n end", "def write(dest)\n FileUtils.mkdir_p(File.join(dest, @dir))\n FileUtils.cp(File.join(@base, @dir, @name), File.join(dest, @dir, @name))\n end", "def write(dest)\n path = destination(dest)\n FileUtils.mkdir_p(File.dirname(path))\n File.open(path, 'w') do |f|\n src = File.join(@base, @name)\n f.write File.read( src )\n end\n end", "def destination_rel_dir\n @_dest_dir\n end", "def destination_path\n File.expand_path File.join(options[:root], destination) unless destination.nil?\n end", "def destination_root\n File.expand_path(options[:dest])\n end", "def destination_dir_pathname\n Pathname(ARGV[1])\n end", "def write(dest)\n FileUtils.mkdir_p(File.join(dest, @dir))\n \n name = @name\n if self.ext != \"\"\n name = @name.split(\".\")[0..-2].join('.') + self.ext\n end\n \n path = File.join(dest, @dir, name)\n File.open(path, 'w') do |f|\n f.write(self.output)\n end\n end", "def destination_path\n @destination_path ||= Pathname.new(self.destination_root)\n end", "def destination_dir\n if @desired_dir.nil?\n @original_dir\n else\n if not File.directory?(@desired_dir)\n FileUtils.mkdir_p(@desired_dir)\n else\n @desired_dir\n end\n end\n end", "def destination\n #configuration[:release_path]\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n\n end", "def download_dest\n ::File.join(Chef::Config[:file_cache_path],\n ::File.basename(URI.decode(download_source)).gsub(' ', ''))\n end", "def initialize dest\n @dest = dest || '.'\n end", "def destination(dest); end", "def destination(dest); end", "def dest; end", "def destination\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n end", "def dest(str)\n @@DEST_TABLE[str]\n end", "def copy_dir(src, dest)\n output = `rsync -r --exclude='.svn' --exclude='.git' --exclude='.gitignore' --filter=':- .gitignore' 2>&1 #{Shellwords.escape(src.to_s)}/ #{Shellwords.escape(dest.to_s)}`\n [output, $?]\n end", "def find_path(dest)\n if @previous[dest] != -1\n find_path @previous[dest]\n end\n @path << dest\n end", "def destination_path\n File.join(test_path, name)\n end", "def destination_path\n @_destination_path ||= \"#{@rf['project_id']}/#{@rf['booking_id']}/\" end", "def new_path\n if conf[:options][:dest].nil? or conf[:options][:dest].empty?\n File.join(@dir_path, @new_name)\n else\n File.join(conf[:options][:dest], @new_name)\n end\n end", "def relative_to_output(dest)\n if dest =~ /^\\//\n Pathname.new(dest).relative_path_from(output)\n else\n dest\n end\n end", "def relative_to_output(dest)\n if dest =~ /^\\//\n Pathname.new(dest).relative_path_from(output)\n else\n dest\n end\n end", "def destination_file_name\n return @destination_file_name\n end", "def get_destination\n File.join(@root_path, @config['save_path'], @random_filename + \".\" + @options['exportformat'])\n end", "def destination_path\n if @site.respond_to?(:in_dest_dir)\n @site.in_dest_dir(path)\n else\n Jekyll.sanitized_path(@site.dest, path)\n end\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 cp_r(dest)\n util.cp_r(path, dest)\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 path src, dest\n path = _path srcPaths: [[@nodes[src]]], dest: @nodes[dest]\n if !path.nil?\n path.map(&:value)\n end\n end", "def destination\n return @destination unless @destination.nil?\n\n @destination = ::File.join(::Webby.site.output_dir, directory, filename)\n ext = extension\n unless ext.nil? or ext.empty?\n @destination << '.' << ext\n end\n @destination\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 write_file(src, dest)\n file_path = \"#{@video_dir}/#{dest}\"\n dest = File.new(file_path, \"wb\")\n dest.write(src.read)\n dest.close\n end", "def print_path(dest)\n\t\tif @prev[dest] != -1\n\t\t\tprint_path @prev[dest]\n\t\tend\n\t\tprint \">#{dest}\"\n\tend", "def destination\n @_destination ||= \"#{@rf['project_id']}/#{@rf['booking_id']}/\"\\\n \"#{base_filename}.#{format}\"\n end", "def path_to(to)\n from = Pathname.new('/' + current_resource.destination_path).dirname\n rp = Pathname.new( Pathname.new(to).relative_path_from(from) ).cleanpath.to_s + '/'\n rp == './' ? '' : rp\n end", "def destination(base_directory); end", "def print_path(dest)\n if @prev[dest] != -1\n print_path @prev[dest]\n end\n print \">#{dest}\"\n end", "def dest_path( file )\n return File.join( ENV['HOME'], \".#{file}\" )\n end", "def to_dir\n @dst_dir\n end", "def dest_path(num, path, se_name = \"empty\")\n des = \"/stornext/snfs#{num}/next-gen/solid/results\"\n if !File.directory?(des)\n remove_lock(se_name)\n Helpers::log(\"snfs#{num} does not exist. exiting..\", 1)\n end\n dirs = @ses.path_parse(path)\n se = Sequence_event.new(@ses.run_name_from_path(path))\n des = des + \"/#{dirs.mach}/#{se.year}/#{se.month}\" +\n \"/#{dirs.rname}/#{dirs.sample}\"\n if (/csfasta/.match(path) || /qual/.match(path)) && /BC/.match(path)\n return des + \"/#{dirs.bc}\"\n end\n des\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 copy dest_bucket_or_path, dest_path = nil, options = {}\n ensure_connection!\n dest_bucket, dest_path, options = fix_copy_args dest_bucket_or_path,\n dest_path, options\n\n resp = connection.copy_file bucket, name,\n dest_bucket, dest_path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def write_file(src, dest)\n file_path = \"#{@news_dir}/#{dest}\"\n dest = File.new(file_path, \"wb\")\n if src.is_a?(String)\n dest.write(src)\n else\n dest.write(src.read)\n end\n dest.close\n end", "def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end", "def copy_to!(dest)\n Pow(dest).parent.create_directory\n copy_to(dest)\n end", "def photo_destination(naming_type, uri, dest_path, config)\n path = case naming_type\n when :short, :id\n File.join(dest_path, self.id.to_s + File.extname(uri.path))\n else\n File.join(dest_path, File.basename(uri.path))\n end\n config[:logger].debug {\"photo_destination(#{naming_type}, #{uri}, #{dest_path}) => #{path}\"}\n File.expand_path path\n end", "def copy_file(src, base, dest_dir)\n return if src == '/dev/null' or not File.exists?(src)\n dest = File.expand_path(base, dest_dir)\n puts \"Added: #{base}\"\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp src, dest\nend", "def ditto dst\n d = Pathname.new(dst)\n if file?\n FileUtils.cp to_s, d.to_s, :verbose => $DEBUG\n return (d.directory?) ? d+basename : d\n else\n d.mkpath\n FileUtils.cp_r to_s + '/.', d.to_s, :verbose => $DEBUG\n return d\n end\n end", "def _find_destination_from_args( args )\n raise ArgumentError.new(\"File #{self} must exist.\") unless self.exist?\n \n if args.first.is_a?(Pathname) \n raise ArgumentError.new( \"accepts a FilePath or string args, not both\" ) unless args.length == 1\n dest = args.first\n dest = dest.directory.join( dest ).expand if dest.relative?\n else\n dest = self.directory.join(*args).expand # expand gets rid of /../ (parent_dir)\n end\n \n if self.file? && dest.directory?\n dest = dest.join( self.basename )\n elsif self.directory? && dest.file?\n raise ArgumentError.new( \"cannot overwrite a file with a directory\" )\n end\n \n dest\n end", "def copy_dir(source, dest)\n files = Dir.glob(\"#{source}/**\")\n mkdir_p dest\n cp_r files, dest\n end", "def auto_destination= dest\n @auto_destination = (dest == '/') ? nil : dest\n end", "def destination_for_song(song, source, destination)\n basenames = []\n\n dirname, basename = File.split(song)\n basenames << basename \n \n while dirname != source\n dirname, basename = File.split(dirname)\n basenames << basename\n end\n \n File.join(destination, *basenames.reverse)\nend", "def print_path(dest)\n\t\tif @predecessor_node[dest] != -1\n\t\t\tprint_path @predecessor_node[dest]\n\t\tend\n\t\tprint \">#{dest}\"\n\tend", "def dest_pdf\n @zip_path[0..-5] << '.pdf'\n end", "def path\n File.join(@base, @dir.sub(@dst_dir, @src_dir), @name)\n end", "def dest\n File.join(Ichiban.project_root, 'compiled', dest_rel_to_compiled)\n end", "def rename(dest)\n @current_template_dest = File.join(File.dirname(@current_template_src), dest)\n end", "def copy(source_path, target_path)\n _ensure_directory_exists(target_path)\n target_path.open('wb', @permissions[:file]) do |io|\n lines = source_path.read.split(\"\\n\")\n lines.each do |line|\n\tio.write(line.chomp + @ending)\n end\n end\n puts \"#{source_path.to_s.ljust(25)} -> #{target_path}\"\n end", "def copy_file(src, dest)\r\n File.open(src, 'rb') {|r|\r\n File.open(dest, 'wb') {|w|\r\n copy_stream r, w\r\n }\r\n }\r\n end", "def relative_dest_path\n @relative_dest_path ||= begin\n path = case ext\n when \".scss\", \".slim\"\n path_without_ext\n when \".md\"\n path_without_ext.join('index.html')\n else\n @path\n end\n\n Pathname.new(path.to_s.downcase)\n end\n end", "def dest\n param(0)\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 dest_file\n @dest_file ||= File.join(root, \"bin\", \"#{Template.basename contents_template}.pdf\")\n end", "def get_destination_for_path(path)\n route, resource_path = extract_path_info(path)\n destination_info = destination_map[route.to_sym]\n fail DestinationNotFound.new(route) if destination_info.nil?\n\n URI.join(\"#{destination_info[:host]}:#{destination_info[:port]}\", resource_path.to_s)\n end", "def dest_get\n db_select 'destination'\n end", "def move_file_to_path(src, dest_path, overwrite: false)\n dest = File.join(dest_path, File.basename(src))\n move_file(src, dest, overwrite: overwrite)\n end", "def get_destination(project_key, environment_key, destination_id, opts = {})\n data, _status_code, _headers = get_destination_with_http_info(project_key, environment_key, destination_id, opts)\n data\n end", "def copy_file_if_missing(src, dest, opt={})\n unless File.exists? dest\n touch_directory File.dirname(dest), opt\n FileUtils.cp src, dest\n STDOUT.write \"Created #{dest.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n end", "def copy_dir(origin_path, dest_path)\n \n p origin_path if $DEBUG\n\n real_dir = get_non_linked_dir_path_for_path(origin_path)\n \n unless File.exist?(dest_path) and File.directory?(dest_path) then\n \n Dir.mkdir(dest_path)\n \n end\n \n Dir.foreach(real_dir) do |f|\n \n next if f == \".\" or f == \"..\"\n \n full_path= File.join(real_dir, f)\n \n #check if this is a hard link to a directory\n if File.exist?(full_path) and (not File.directory?(full_path)) and File.stat(full_path).nlink > @min_link_count then\n full_path = get_non_linked_dir_path_for_path(full_path)\n end\n \n if File.directory?(full_path) then\n copy_dir(full_path, File.join(dest_path, f))\n else\n \n if File.exist?(full_path) and not File.symlink?(full_path) then\n \n FileUtils.cp(full_path, dest_path)\n \n end\n \n end\n \n end\n \n nil\n \n end", "def check_dest_dir\n FileUtils.mkdir_p(dest_dir) unless Dir.exist?(dest_dir)\n end", "def dest_prompt\n db_prompt 'destination'\n end", "def destination(base_directory)\n @destination ||= {}\n @destination[base_directory] ||= begin\n path = site.in_dest_dir(base_directory, URL.unescape_path(url))\n if url.end_with? \"/\"\n path = File.join(path, \"index.html\")\n else\n path << output_ext unless path.end_with? output_ext\n end\n path\n end\n end", "def write(dest); end", "def write(dest); end", "def write(dest); 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 destination\n @attributes[:destination]\n end", "def getFileDest(name)\n return nil if name.index(@templateRoot) != 0\n @projectRoot + '/' + name[@templateRoot.length + 1 .. -1]\n end", "def upload_file_path(dest_path,is_attachment = false)\n work_space_directories = Rails.root.join('public', 'uploads', 'attachments').to_s\n unless File.directory?(work_space_directories)\n Dir.mkdir(work_space_directories)\n end\n work_space_directories = File.join(work_space_directories,dest_path)\n work_space_directories\n\n # current_path = Pathname.new(File.dirname(__FILE__)).realpath\n # work_space_directories = current_path.to_s.split(\"/\")\n # finial_file_path = []\n # work_space_directories.each do |directory|\n # if directory != \"app\"\n # finial_file_path.push(directory)\n # else\n # finial_file_path.push(\"public\")\n # finial_file_path.push(\"uploads\").push(\"attachments\") unless is_attachment\n # finial_file_path.push(dest_path)\n # break\n # end\n # end\n # File::join(finial_file_path)\n end", "def destination\n @destination ||= 'src/ios/vendor'\n end", "def destination\r\n @destination\r\n end", "def pathDistSource\n\tpathDist + \"source/\"\nend" ]
[ "0.8428197", "0.7794281", "0.77484876", "0.7536702", "0.7441646", "0.7441646", "0.7353197", "0.72095585", "0.71266216", "0.69978476", "0.6919035", "0.6918112", "0.6850506", "0.67687774", "0.67319864", "0.6726791", "0.669323", "0.66200346", "0.6385388", "0.62795645", "0.62481135", "0.62457305", "0.61790097", "0.6152352", "0.6133524", "0.61261934", "0.61257017", "0.61057436", "0.61057436", "0.6104438", "0.6096845", "0.60942185", "0.6094196", "0.6047613", "0.6045614", "0.604023", "0.60355705", "0.6003936", "0.6000365", "0.5966922", "0.58881485", "0.58778375", "0.58614385", "0.58458656", "0.58292836", "0.5823007", "0.579841", "0.57846075", "0.5782769", "0.5767375", "0.5749692", "0.56995773", "0.56994677", "0.5686045", "0.56672084", "0.5665706", "0.5653044", "0.56293327", "0.56047046", "0.5601316", "0.559306", "0.55860895", "0.55661875", "0.5531995", "0.5521108", "0.55183536", "0.5516021", "0.54726213", "0.54713154", "0.54700476", "0.54692334", "0.54668623", "0.5456324", "0.54312736", "0.5421938", "0.5420298", "0.54051447", "0.54043746", "0.5386693", "0.5367199", "0.5357992", "0.5357137", "0.5333303", "0.5325524", "0.53209156", "0.53184843", "0.53145516", "0.53017575", "0.5290068", "0.52888787", "0.52888787", "0.52888787", "0.5280296", "0.5280296", "0.52774537", "0.5276341", "0.5269466", "0.5257791", "0.5251097", "0.52389646" ]
0.6629053
17
Merge Pattern attributes to the data hash used by Liquid.
def to_liquid data.deep_merge({ 'id' => id, 'markup_escaped' => markup_escaped, 'markup' => content, 'section' => section }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend", "def pattern\n attributes.fetch(:pattern)\n end", "def pattern\n attributes.fetch(:pattern)\n end", "def pattern\n attributes.fetch(:pattern)\n end", "def generate_pattern(pattern)\n plist.dict do\n append_single('begin', pattern.begin)\n append_dictionary('beginCaptures', pattern.begin_captures)\n append_dictionary('captures', pattern.captures)\n append_single('comment', pattern.comment)\n append_single('contentName', pattern.content_name)\n append_single('disabled', 1) if pattern.disabled\n append_single('end', pattern.end)\n append_dictionary('endCaptures', pattern.end_captures)\n append_single('include', pattern.include)\n append_single('match', pattern.match)\n append_single('name', pattern.name)\n append_array('patterns', pattern.patterns)\n end\n end", "def hash\n [fully_qualified_rel,\n tmpl.pattern,\n templated?].hash\n end", "def to_liquid_hash\n # Wrap fields in quotes where appropriate for Liquid\n @to_hash = Hash[ATTRS_FROM_RAW.map {|k| [k.to_s, format_with_quotes(k, self.send(k))]}]\n # Process subject_specialties hash into a hash with string keys\n @to_hash[\"subject_specialties\"] = Hash[@to_hash[\"subject_specialties\"].map {|k, v| [k.to_s, v.map {|s| format_with_quotes(k, s)}]}]\n @to_hash\n end", "def hash\n [background_pattern_color, foreground_pattern_color, texture].hash\n end", "def pattern=(pattern)\n @pattern = pattern\n substitute_variables! # TODO: Remove this call\n end", "def word_pattern\n attributes.fetch(:wordPattern)\n end", "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:key] = self.key\n\t\tattrs[:value] = self.value\n\t\tattrs[:description] = self.description\n\t\tattrs[:reference_id] = self.id\n\t\tattrs[:rider_id] = self.rider_id\n\t\tattrs[:tag_list] = self.tag_list\n\n\t\tattrs\n\tend", "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "def to_hash\n super.merge({\n format: @regexp\n }).freeze\n end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def link_attributes(tag)\n Hash[$1.scan(/(\\w+)=\"([^\"]*)\"/)] if tag =~ link_regex\n end", "def render_rule(data)\n render_block data.values.reduce(&:merge).to_h\n end", "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "def prepare_pattern(pattern)\n pattern.scan(/(\\<[^\\>]+\\>[^\\<]?)/).flatten.map { |x| TagPattern.new(x) }.reverse\n end", "def link_data\n data = {}\n @options[:tags].keys.each do |key|\n data[key.to_sym] = self.instance_eval(key.to_s)\n end\n data\n end", "def tag_attributes\n attrs = {}\n @opts.each_pair{|k, v| attrs[k.to_s] = v.to_s}\n attrs[\"src\"] = image_url\n attrs.reject{|k,v| %w(host scheme).include? k.to_s}\n end", "def dynamic_attributes_hash\n @dynamic_attributes.inject({}) { |h, da| h[da.name] = da; h}\n end", "def hash\n @attrs\n end", "def data_attributes\n @schema.schema.select {|k,_| k.to_s.start_with?('data_') or k.to_s.start_with?('data-')}.inject({}) {|col,(k,v)| col[k[5..-1].to_sym]=v;col}\n end", "def set_pattern\n @pattern = Pattern.find_by(id: params[:id]) || Pattern.find_by(slug: params[:id])\n @yarn = @pattern&.yarn\n @default_colors = @pattern&.default_colors\n end", "def attributes\n { \"id\" => id, \"title\" => title, \"format\" => format, \"language\" => language, \"content\" => content, \"selector\" => selector }\n end", "def data_attribute(attributes = {})\n attributes = attributes.reject { |_, v| v.nil? }\n\n attributes[:reference_type] ||= self.class.reference_type\n attributes[:container] ||= 'body'\n attributes[:placement] ||= 'top'\n attributes.delete(:original) if context[:no_original_data]\n attributes.map do |key, value|\n %Q(data-#{key.to_s.dasherize}=\"#{escape_once(value)}\")\n end.join(' ')\n end", "def starting_hash_pattern\n super\n end", "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 set_ending_hash_pattern(opts)\n opts = check_params(opts,[:patterns])\n super(opts)\n end", "def to_hash\n {\n :patterns => (patterns ? Array(patterns) : patterns),\n :records => records,\n :tlds => tlds,\n :ipv4only => ipv4only\n }\n end", "def extract_data_by_pattern(regexp, message_pattern)\n if match = regexp.match(raw_message) then\n # Creates a hash maching :field_x => data\n new_data = Hash[match.names.zip(match.captures)].symbolize_keys\n\n new_data[:timestamp] = DateTime.strptime new_data[:timestamp], \n message_pattern.source.timestamp_definition\n new_data[:timestamp] += log.time_bias.seconds\n\n self.attributes = new_data\n self.message_pattern = message_pattern\n self.save\n end\n end", "def apply_to(pattern)\n @pattern = pattern\n end", "def add_keywords_regexps(attr, keyword)\n keys = [attr.to_s.humanize]\n if attr.is_a?(Symbol)\n if user && user.language.present?\n keys << l(\"field_#{attr}\", default: '', locale: user.language)\n end\n if Setting.default_language.present?\n keys << l(\"field_#{attr}\", default: '', locale: Setting.default_language)\n end\n end\n keys.reject! { |k| k.blank? }\n keys.collect! { |k| Regexp.escape(k) }\n @attributes_regexps ||= []\n keyword = Regexp.escape(keyword.to_s)\n # http://rubular.com/r/3Qtpatl12d\n @attributes_regexps << /(<{1}[^<\\/>]+>{1}\\s*){,1}\\s*(#{keys.join('|')})\\s*(<{1}\\/{1}[^<>]+>{1}\\s*)*\\s*(<{1}[^<>]+>{1}\\s*)*\\s*(:)\\s*(<{1}\\/{1}[^<>]+>{1}\\s*)*\\s*(<{1}[^<>]+>{1}\\s*)*\\s*(#{keyword})\\s*(<{1}\\/{1}[^<>]+>{1}\\s*){,1}/i\n end", "def collect(*args) # :nodoc:\n args.inject({}) do |buffer, attr_name|\n value = send(attr_name)\n buffer[attr_name] = value if value\n buffer\n end\n end", "def to_liquid(attrs = nil)\n further_data = \\\n (attrs || self.class::ATTRIBUTES_FOR_LIQUID).each_with_object({}) do |attribute, hsh|\n hsh[attribute] = send(attribute)\n end\n\n Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)\n end", "def ending_hash_pattern\n super\n end", "def all_patterns\n @mutex.synchronize do\n @patterns.keys.map{ |a_| a_.dup }\n end\n end", "def extract(data)\n return data if @markup.format == :txt\n data.gsub(/^\\{\\{\\{\\{\\{\\{ ?(.+?)\\r?\\n(.+?)\\r?\\n\\}\\}\\}\\}\\}\\}\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n @map[id] = { :style => $1, :code => $2 }\n id\n end\n end", "def attribs\r\n @attribs.dup\r\n end", "def populate_attributes\n theme_package.attributes.each{ |attribute_name| populate_attribute(attribute_name) }\n end", "def data_hash\n @data_hash ||= Hashie::Mash.new(sanitize_data(self.data || {}).reverse_merge(built_in_variables))\n end", "def initialize(pattern)\n # Duplication of data, but this lets us return everything in the exact\n # order it was received.\n @pattern = pattern\n @entries = []\n @entries_with_lines = {}\n @lines = []\n end", "def attributes\n Hash[instance_variables.map{|attrib| [attrib.to_s[1..attrib.to_s.size], nil]}]\n end", "def data_hash\n primary, included =\n resources_processor.process(Array(@data), @include, @fields)\n {}.tap do |hash|\n hash[:data] = @data.respond_to?(:to_ary) ? primary : primary[0]\n hash[:included] = included if included.any?\n end\n end", "def data_attributes(*attrs)\n attrs.map(&:to_s).each do |attr|\n define_method attr do\n @data ||= {}\n @data[attr.to_sym]\n end\n\n define_method \"#{attr}=\" do |arg|\n @data ||= {}\n @data[attr.to_sym] = arg\n end\n end\n end", "def group_data\n data_hash = {color: @color, bling: @bling, age: @age, functional: @functional}\n end", "def attrs\r\n @attrs ||= Utils.deep_merge(@attributes, _package_.env)\r\n end", "def set_starting_hash_pattern(opts)\n opts = check_params(opts,[:patterns])\n super(opts)\n end", "def markup_data\n cacheable_data\n .merge(plugin_data)\n .deep_stringify_keys\n end", "def prepare_data(data)\n d = {}\n data.each do |key, val|\n case key.to_s\n when /^<(.*?)>(.*)$/\n d[\"#{$1}#{$2}\"] = val\n when /^\\w/\n d[\"##{key}\"] = val\n else\n d[key.to_s] = val\n end\n end\n return d\n end", "def extract_tags!\n @tagmap = {}\n data.gsub!(/(.?)\\[\\[(.+?)\\]\\]([^\\[]?)/m) do\n if $1 == \"'\" && $3 != \"'\"\n \"[[#{$2}]]#{$3}\"\n elsif $2.include?('][')\n if $2[0..4] == 'file:'\n pre = $1\n post = $3\n parts = $2.split('][')\n parts[0][0..4] = \"\"\n link = \"#{parts[1]}|#{parts[0].sub(/\\.org/,'')}\"\n id = Digest::SHA1.hexdigest(link)\n @tagmap[id] = link\n \"#{pre}#{id}#{post}\"\n else\n $&\n end\n else\n id = Digest::SHA1.hexdigest($2)\n @tagmap[id] = $2\n \"#{$1}#{id}#{$3}\"\n end\n end\n nil\n end", "def attribute_hash\n build_literals(strip_tsim(solr_document.select do |k, _v|\n k.end_with?(\"tsim\")\n end))\n end", "def to_jaxb_json_hash\n _h = {}\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n if !patterns.nil?\n _ha = Array.new\n patterns.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['patterns'] = _ha\n end\n return _h\n end", "def data_attrs(_item)\n {}\n end", "def hash\n [fully_qualified_rel,\n raw_href,\n templated?].hash\n end", "def apply\n scalar_attrs.each { |m| applicator(m) { |r| send(m, r) } }\n list_attrs.each { |m| applicator(m) { |r| send(m, *r) } }\n hash_attrs.each { |m| applicator(m) { |r| send(m).merge!(r) } }\n path_attrs.each { |m| applicator(m) { |r| send(\"#{m}=\", r) } }\n end", "def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:year] = self.year\n\t\tattrs[:age] = self.age\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:rate] = self.rate\n\n\t\tattrs\n\tend", "def define_attributes\n @attributes = {}\n @attribute_map = {}\n yield # to the user defined block for further instruction\n @keys = @attributes.keys.freeze\n @attribute_map.freeze\n @attributes.freeze\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end", "def combined_hash\n y = if @process_global\n normalize(global_yaml).rmerge(normalize(yaml))\n else\n normalize(yaml)\n end\n @process_local ? y.rmerge(normalize(local_yaml)) : y\n end", "def serialize\n Marshal.dump(@patterns)\n end", "def attributes\n attrs = filter_partials(self.class._attributes.dup)\n filter(attrs).each_with_object({}) do |attr, hash|\n hash[camelize_value(attr)] = send(attr)\n end\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def attr_map \n h = {\n 'data-id' => id,\n 'data-posters' => (@posters || []).map do |p|\n p.attributes.merge(:web_location => p.href)\n end.to_json,\n 'data-year' => @year,\n 'class' => (thumbnail() ? 'withPoster lazyLoadNeeded' : 'noPoster')\n }\n h['data-thumb-src'] = thumbnail.href if thumbnail\n genres.split(',').reduce(h){ |ha, g| ha[\"data-category-#{g.downcase.gsub(' ', '_')}\"] = true; ha }\n end", "def attributes\n {\n :block_size => @block_size, :block_count => @blocks,\n :blocks => @block_data.map(&:dup)\n }\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def set_attr_filter(hash)\n src = [ \"def self.format_attr(a, flag)\" ]\n src << \"case a.key\"\n hash.each do |key, val|\n src << %Q[ when \"#{key}\" ; format_attr_default(Attr.new(:#{val}, a.value), flag)]\n end\n src << \"else; format_attr_default(a, flag)\"\n src << \"end\"\n src << \"end\"\n src << \"\"\n #puts src\n\n eval src.join(\"\\n\")\n rescue SctiptError, NameError\n puts src\n end", "def construct_fragments_attributes(hash, record, path)\n frag_identifiers = []\n frag_attributes = hash.collect do |frag_header, frag_content|\n tag, identifier = frag_header.split\n frag_hash = {\n identifier: identifier,\n tag: tag\n }\n\n # tracking fragments that need removing later\n frag_identifiers << identifier\n\n # based on tag we need to cram content in proper place and proper format\n case tag\n when \"date\", \"datetime\"\n frag_hash[:datetime] = frag_content\n when \"checkbox\"\n frag_hash[:boolean] = frag_content\n when \"file\", \"files\"\n files, file_ids_destroy = files_content(record, identifier, path, frag_content)\n frag_hash[:files] = files\n frag_hash[:file_ids_destroy] = file_ids_destroy\n else\n frag_hash[:content] = frag_content\n end\n\n frag_hash\n end\n\n [frag_identifiers, frag_attributes]\n end", "def keyword_value_hash\n self.data_attributes.inject({}) do |hsh, a| \n if a.class == ImportAttribute\n hsh.merge!(a.import_predicate => a.value)\n else # there are only two\n hsh.merge!(a.predicate.name => a.value)\n end\n end \n end", "def extract_tag_and_options(pattern)\n if match = pattern.match(/\\<([^\\>]+)\\>/)\n @tag = /#{match[1]}/\n end\n\n if match = pattern.match(/\\<[^\\>]+\\>(.)/)\n @conditions = match[1]\n end\n end", "def apply_vars_to_datafile(contents, matches, path, preserve_all: true, preserve_non_vars: false)\n return contents if matches.empty?\n\n data_vars = path.nil? ? {} : ConrefifierUtils.data_file_variables(config, path)\n\n config = { 'page' => data_vars }\n config = { 'site' => { 'data' => self.data, 'config' => self.config } }.merge(config)\n\n matches.each do |match|\n match = match.is_a?(Array) ? match.first : match\n safe_match = if preserve_all\n match.gsub(/\\{\\{/, '[[\\1')\n elsif preserve_non_vars\n match.gsub(/\\{\\{(\\s*)(?!\\s*(site|page))/, '[[\\1')\n end\n\n parsed_content = begin\n parsed = Liquid::Template.parse(safe_match).render(config)\n parsed.gsub(/\\[\\[/, '{{\\1') if preserve_all || preserve_non_vars\n rescue StandardError => e\n puts \"Parse error in \\n#{matches}: #{e}\"\n match\n end\n next if parsed_content.nil?\n contents = contents.sub(match, parsed_content)\n end\n contents\n end", "def data_attributes=(attributes)\n attributes.each do |k, v|\n self[\"data-#{k}\"] = v\n end\n end", "def extract_template_details(memo, mode, match)\n if mode == :localized\n memo[match[1]] ||= {}\n memo[match[1]][match[2]] ||= []\n memo[match[1]][match[2]] << match[3]\n else\n memo[match[1]] ||= []\n memo[match[1]] << match[2]\n end\n end", "def hash\n @hash ||= opts[:parser].parse(data.to_s.gsub(/\\<!\\[CDATA\\[([^\\]]+)\\]\\]\\>/) {$1})\n end", "def attributes=(attributes)\n @attributes = Layer::Patch::Hash.new(patch, attributes)\n end", "def pigeon_template\n pigeon_template = {}\n collect_pigeon_names(original_data).collect do |names|\n pigeon_template[names] = {}\n collect_attribute_labels(original_data).collect do |labels|\n pigeon_template[names][labels] = find_what_you_want(names, labels)\n end\n end \n pigeon_template \nend", "def global_template_data\n {'__design_id' => @stylesheet.design_id}\n end", "def merge_attributes\n %w( price area paragraph bullet file ).map(&:to_sym)\n end", "def pattern_params\n params[:pattern]\n end", "def make token_vals={}\n token_vals = token_val_defaults.merge token_vals\n token_vals[:timestamp] ||= Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n val = pattern.gsub(/:(\\w+)/){ replace($1, token_vals) }\n val\n end", "def make token_vals={}\n token_vals = token_val_defaults.merge token_vals\n token_vals[:timestamp] ||= Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n val = pattern.gsub(/:(\\w+)/){ replace($1, token_vals) }\n val\n end", "def markup_data\n {\n images: images,\n named_images: named_images,\n primary_image: image_urls(@page.image_to_display),\n post_action_image: image_urls(@page.post_action_image_to_display),\n shares: Shares.get_all(@page),\n locale: @page.language&.code || 'en',\n follow_up_url: follow_up_url\n }\n .merge(@page.liquid_data)\n .merge(LiquidHelper.globals(page: @page))\n .merge(plugin_data)\n .deep_stringify_keys\n end", "def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end", "def dump_data\n create_attr_hash\n end", "def load_data_with_partials(hash=nil)\n if(@partials != nil) #if a partial has actually been submitted\n hash ||= {}; #if nil, make a hash. (return value)\n hash[:htmlElts] = {}; #hash for each elementID<=>newHTML pair\n \n @partials.each { |p| #for each partial submitted\n partial_id = find_partial_name(p[0].to_s);\n\n #build the html from embedded ruby files in views and relevant inputs\n hash[:htmlElts][partial_id] = ERB.new(render_to_string(render_function_hash(p))).result;\n }\n end\n return hash;\n end", "def attributes\n Hash.new.tap do |atts|\n _attributes.instance_variables.each do |ivar|\n # todo: figure out why it's setting @constructor and @toString\n next if ivar == :@constructor || ivar == :@toString || ivar == :@_attributes || ivar == :@_data || ivar == :@_forms\n\n att = ivar[1..-1].to_sym\n atts[att] = _attributes.send(att)\n\n if form_name = _form[att.to_s.to_sym]\n atts[att] = wedge(form_name, atts[att].respond_to?(:attributes)? atts[att].attributes : atts[att]).attributes\n end\n end\n end\n end", "def merge_attributes(data)\n data.fetch(\"default\", {})\n .merge(data.fetch(\"normal\", {}))\n .merge(data.fetch(\"override\", {}))\n .merge(data.fetch(\"automatic\", {}))\n end", "def reload_attributes(atts = {})\n @attributes = {}\n @_memo = {}\n update_attributes(atts)\n end", "def extract_attributes(mods_node, template_node)\n return {} if mods_node == nil || template_node == nil\n attributes = {}\n mods_node.each do |attr_name, attr_value|\n header_code = template_node[attr_name]\n # Skip if value hardcoded in template rather than [[header code]]\n next if header_code == nil || !header_code.start_with?('[[')\n attributes[header_code.slice(2..-3)] = attr_value\n end\n attributes\n end", "def build_all_attrs(table)\n hash = {}\n table.each do |line|\n id, attrs = nil, {}\n line.sub(\" />\\n\", '').split(' PFWeb:').drop(1).each.with_index do |e, i|\n match = e.match(/(?<name>\\S*)=\"?(?<val>.*)\"/)\n id = match[:val].to_sym if i == 0\n attrs[match[:name].to_sym] = match[:val]\n end\n hash[id] = attrs\n end\n hash\n end", "def patches\n { :p0 => DATA }\n end", "def patches\n { :p0 => DATA }\n end", "def patches\n { :p0 => DATA }\n end", "def hash\n [rel, href].hash\n end", "def flatten!\n self.class.attributes.keys.select { |k| k.end_with?('_data') }.each do |data_attr|\n reference_attr = data_attr[/(.+?)_data$/, 1]\n value = send(data_attr)\n next if value.nil?\n\n send(\"#{data_attr}=\", value)\n send(\"#{reference_attr})\", nil)\n end\n\n self\n end", "def attr_rw_hash(*attrs)\n attrs.each do |attr|\n class_eval %{\n def self.#{attr}(args = {})\n unless instance_variable_defined?(:@#{attr})\n @#{attr} = InheritableAttr.inherit_for(self, :#{attr})\n end\n (@#{attr} ||= {}).merge!(args)\n end\n def self.#{attr}!(args = {})\n @#{attr} = {}\n @#{attr}.merge!(args)\n end\n def #{attr}\n self.class.#{attr}\n end\n }\n end\n\n register_attrs(:hash, *attrs)\n end" ]
[ "0.60892904", "0.60045403", "0.60045403", "0.60045403", "0.5958694", "0.5882634", "0.54726464", "0.5471879", "0.5376867", "0.5358489", "0.53488773", "0.52894545", "0.52724844", "0.5250469", "0.51854295", "0.5165312", "0.5159891", "0.51457417", "0.51019835", "0.50978655", "0.5094461", "0.50883865", "0.508809", "0.5075134", "0.50639194", "0.50574887", "0.5055106", "0.5019183", "0.50124145", "0.5008602", "0.5005019", "0.50025815", "0.4982287", "0.4977668", "0.4975695", "0.49711123", "0.4947506", "0.4938264", "0.4933858", "0.49310267", "0.49281764", "0.4927602", "0.4924011", "0.49151072", "0.49149963", "0.49105555", "0.48788998", "0.48785055", "0.48732513", "0.48558658", "0.48500207", "0.48418108", "0.48314843", "0.48281896", "0.48238194", "0.48200095", "0.48135585", "0.4808686", "0.4806474", "0.47915855", "0.47890463", "0.47859257", "0.4783874", "0.47788858", "0.4775441", "0.4773251", "0.4773251", "0.4773251", "0.4772938", "0.4767898", "0.47650543", "0.47520837", "0.47497183", "0.47463635", "0.47461748", "0.47425032", "0.47396475", "0.47358438", "0.47260168", "0.47240004", "0.47227588", "0.4722553", "0.47148722", "0.471401", "0.4712162", "0.4712162", "0.47085026", "0.47068304", "0.4702286", "0.47014865", "0.46995282", "0.46995273", "0.46916655", "0.46894485", "0.4684511", "0.46828237", "0.46828237", "0.46828237", "0.4682394", "0.4677321", "0.4676417" ]
0.0
-1
Compares Pattern objects. First compares the Pattern id. If the ids are equal, it compares the Pattern filename. other The other Pattern we are comparing to. Returns 1, 0, 1
def <=>(other) cmp = id <=> other.id if 0 == cmp cmp = name <=> other.name end cmp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n @pattern == other.pattern\n end", "def eql?(other)\n\t\t\tself.fileid.eql?(other.fileid)\n\t\tend", "def quick_compare(another)\n self == another || (self.kind_of?(File) && another.kind_of?(File) && self.path == another.path)\n end", "def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\n end", "def ==(other)\n return false unless @path && @file_id && other.path && other.file_id\n @path == other.path && @file_id == other.file_id\n end", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n background_pattern_color == other.background_pattern_color &&\n foreground_pattern_color == other.foreground_pattern_color &&\n texture == other.texture\n end", "def quick_compare(another)\n self == another || (\n (self.kind_of?(File) || self.kind_of?(Tempfile)) && \n (another.kind_of?(File) || another.kind_of?(Tempfile)) && \n self.path == another.path)\n end", "def same_as?(another_pattern)\n unless length == another_pattern.length\n raise \"Unexpected comparison of this pattern #{inspect} with another: #{another_pattern.inspect}\"\n end\n each_with_index do |bool, i|\n return false if bool != another_pattern[i]\n end\n return true\n end", "def compare_files(f1, f2)\n begin\n file1 = IO.read f1[:path]\n file2 = IO.read f2[:path]\n rescue => e # file doesn't exists, db have to be updated\n @show.call \"\\t[Error]: #{e} Please update your database\"\n return nil\n end\n # if 100% similarity and files have the same size\n if @options[\"p\"][:value] == 100\n return nil if f1[:size] != f2[:size]\n return 100 * (Algorithms.fdupes_match(file1, f1[:size], file2, f2[:size]) + 1)\n end\n Algorithms.diff(file1, file2)\n end", "def files_match(actual, expected)\n FileCompareAssertion.new(actual, expected)\n end", "def fcompares(fname1, sname, fname2)\n cmp = true\n if (fexists fname1, sname) and (fexists fname2, sname)\n x = eval \"$#{fname1}['#{sname},facets']\"\n y = eval \"$#{fname2}['#{sname},facets']\"\n if x == y\n (eval \"$#{fname1}\").each do |i|\n if sname.eql? i.scan(/^\\w+/)\n x = eval \"$#{fname1}[i]\"\n y = eval \"$#{fname2}[i]\"\n if x != y\n cmp = false\n end\n end\n end\n return cmp\n else \n return false\n end\n else\n reuturn false\n end\nend", "def same_tracks_as?(other_pattern)\n @tracks.keys.each do |track_name|\n other_pattern_track = other_pattern.tracks[track_name]\n if other_pattern_track == nil || @tracks[track_name].rhythm != other_pattern_track.rhythm\n return false\n end\n end\n \n return @tracks.length == other_pattern.tracks.length\n end", "def ==(other)\n o = other\n o = WalFile.parse(other.to_s) if !other.is_a? WalFile\n return o.timeline == @timeline && o.xlog == @xlog && o.segment == @segment\n end", "def same_tracks_as?(other_pattern)\n @tracks.keys.each do |track_name|\n other_pattern_track = other_pattern.tracks[track_name]\n if other_pattern_track.nil? || @tracks[track_name].rhythm != other_pattern_track.rhythm\n return false\n end\n end\n\n @tracks.length == other_pattern.tracks.length\n end", "def compare(other)\n ::GD2::GD2FFI.send(:gdImageCompare, image_ptr, other.image_ptr)\n end", "def different?(a, b)\n !FileUtils.compare_file(a, b)\n end", "def compare_file(a, b)\r\n return false unless File.size(a) == File.size(b)\r\n File.open(a, 'rb') {|fa|\r\n File.open(b, 'rb') {|fb|\r\n return compare_stream(fa, fb)\r\n }\r\n }\r\n end", "def compare_file(a, b)\n return false unless File.size(a) == File.size(b)\n File.open(a, 'rb') {|fa|\n File.open(b, 'rb') {|fb|\n return compare_stream(fa, fb)\n }\n }\n end", "def eql? other\n id == other.id &&\n path == other.path &&\n line == other.line\n end", "def test_refute_png_equal_with_different_image\n refute_png_equal(comparison_png(0), comparison_png(1))\n end", "def ==(other)\n return false if other.class != self.class\n # checking for lines.size is an optimisation\n @lines.size == other.lines.size and @lines.sort == other.lines.sort\n end", "def grouped_compare(a, b)\n\tloop {\n\t\ta_chunk, a = extract_alpha_or_number_group(a)\n\t\tb_chunk, b = extract_alpha_or_number_group(b)\n\n\t\tav = a_chunk.to_i\n\t\tbv = b_chunk.to_i\n\n\t\tif av.to_s != a_chunk or bv.to_s != b_chunk\n\t\t\tret = a_chunk <=> b_chunk\n\t\telse\n\t\t\tret = av <=> bv\n\t\tend\n\n\t\treturn -1 if a_chunk == ''\n\t\treturn ret if ret != 0\n\t}\nend", "def exact_matches(other_code)\n num_matches = 0\n self.pegs.each_with_index do |code, index|\n if(code == other_code[index])\n num_matches += 1\n end\n end\n num_matches\n end", "def ==(other)\n id == other.id && url == other.url\n end", "def compare(one, other)\n other_rem = other.remaining_same_calls\n one_rem = one.remaining_same_calls\n if one_rem == other_rem\n # Note: the line below is correctly reversing the operands\n # This is done to have the larger period ordered before the\n # shorter ones when the remaining hits are the same.\n other.period.granularity <=> one.period.granularity\n elsif other_rem == -1 || one_rem < other_rem\n -1\n else\n 1\n end\n end", "def == (other)\n @paths == other.paths\n end", "def compare(a, b)\n # ids, classes, tags\n a_ = [a.scan(/\\#\\w+/), a.scan(/\\.\\w+/), a.scan(/(?<=^|\\s)\\b(\\w+)\\b/)]\n b_ = [b.scan(/\\#\\w+/), b.scan(/\\.\\w+/), b.scan(/(?<=^|\\s)\\b(\\w+)\\b/)]\n return a if a_[0].count > b_[0].count\n return a if a_[0].count == b_[0].count && a_[1].count > b_[1].count\n return a if a_[0].count == b_[0].count && a_[1].count == b_[1].count && a_[2].count > b_[2].count\n return a if a_[0].count == b_[0].count && a_[1].count == b_[1].count && a_[2].count == b_[2].count && a_.count > b_.count\n b\nend", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n file_info == other.file_info &&\n output_path == other.output_path &&\n encoding == other.encoding &&\n recognize_lists == other.recognize_lists &&\n leading_spaces == other.leading_spaces &&\n trailing_spaces == other.trailing_spaces &&\n enable_pagination == other.enable_pagination\n end", "def ==(other)\n id == other.id\n end", "def ==(other)\n if other.is_a? self.class\n collect(&:id).sort == other.collect(&:id).sort\n else\n false\n end\n end", "def files_are_same(file1, file2)\n begin\n File.open(file1, 'rb').read == File.open(file1, 'rb').read\n rescue\n false\n end\nend", "def bindiff(file1, file2, tol)\n if tol.nil? then tol = 0 end #Ruby seriously needs to fix this nil/0 shit\n i = 0; small = 0; tol_count = 0; \n f1 = get_file_contents(file1)\n f2 = get_file_contents(file2)\n if f1.length() != f2.length() then\n puts \"The two files are of differing lengths.\"\n if f1.length() < f2.length() then small = f1.length() \n else small = f2.length() end\n end\n while i <= small\n if f1[i] != f2[i] then \n tol_count+=1\n if tol_count > tol then puts \"Files begin to differ at offset 0x#{i.to_s(16)}\" end\n end\n i+=1\n end\n if tol_count == 0 then puts \"Files are exactly the same.\" end\nend", "def ==(other)\n self.id == other.id\n end", "def ==(other)\n id == other.id\n end", "def ==(other)\n id == other.id\n end", "def ==(other)\n id == other.id\n end", "def ==(other)\n id == other.id\n end", "def ==(other)\n id == other.id\n end", "def similarity\n size1 = pixel_count(@image_path_1)\n size2 = pixel_count(@image_path_2)\n\n if size1 < size2\n big = @image_path_2\n small = @image_path_1\n else\n big = @image_path_1\n small = @image_path_2\n end\n\n min_size = size(small)\n width = min_size[0] * @resize_factor\n height = min_size[1] * @resize_factor\n\n a = \"convert #{Shellwords.escape(small)} #{Shellwords.escape(big)} -resize '#{width}'x'#{height}'\\! MIFF:- | compare -metric AE -fuzz \\\"#{@color_fuzz}%\\\" - null: 2>&1\"\n result = `#{a}`\n\n result.to_i / (width * height)\n end", "def compare_paths(src_path, dst_path)\n match = true\n # assume linux\n md5sum = \"md5sum\"\n md5sum = \"md5\" if node.platform == \"freebsd\"\n\n lib_files = `ls #{src_path}/`.split(/\\n/)\n lib_files.each do |file|\n src = `#{md5sum} #{src_path}/#{file}`.split(/\\s+/)\n dst = `#{md5sum} #{dst_path}/#{file}`.split(/\\s+/)\n match = false if (src[0] != dst[0])\n end\n return match\nend", "def compare_times_file dfile_question, dfile_compare, question\n mtime_question = dfile_question[:mtime]\n mtime_compare = dfile_compare[:mtime]\n fname = dfile_question[:name]\n if mtime_question == mtime_compare\n # => Fichiers synchro\n return 1\n elsif mtime_question > mtime_compare\n # => Premier fichier plus vieux\n return 2\n else\n # => Deuxième fichier plus vieux\n return 3\n end\n end", "def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\n end", "def eql?(other)\n self.to_cdfa <=> other.to_cdfa\n end", "def compare_to(other, skip=[])\n common = []\n unique = []\n #p [\"skip:\", skip.size]\n #p [\"first few:\", skip[0..10]]\n \n skip = Set.new(skip.map{|p| p.path})\n \n name_to_path.each do |name, path|\n size = path_to_size[path]\n\n opath_samesize = other.size_to_path[size]\n opath_samename = other.name_to_path[name] \n\n next if skip.include? opath_samename or skip.include? opath_samesize\n\n r = Result.new(root, path)\n\n if opath_samesize and opath_samename\n # same size, same name\n common << r\n\n elsif opath_samename\n # same name, different content\n osize = other.path_to_size[opath_samename]\n diff = (size - osize).abs\n r.message = \"#{diff} bytes #{size > osize ? \"<light_green>larger</light_green>\" : \"<light_red>smaller</light_red>\"}\"\n unique << r\n\n elsif opath_samesize\n # same size, different name\n if OPTIONS.verbose\n puts \"<yellow>* Size matches, comparing content:\\n <light_cyan>#{path}\\n <light_white>#{opath_samesize}\".colorize\n end\n\n if content_probably_matches?(path, opath_samesize)\n # same content (probably)\n oname = File.split(opath_samesize).last\n r.message = \"other name: #{oname}\"\n common << r\n else\n # different content\n unique << r\n end\n\n puts if OPTIONS.verbose\n \n else\n\n unique << r\n\n end\n end\n \n [common, unique]\n end", "def diff_files(file_id1, file_id2)\n\t\t\tfile1 = get_file(file_id1)\n\t\t\tfile2 = get_file(file_id2)\n\t\t\tfile1 = file1.lines\n\t\t\tfile2 = file2.lines\n\n\t\t\treturn ((file1 - file2) + (file2-file1))\n\t\tend", "def ==(other)\n @id == other.to_bin\n end", "def diff(file1, data)\n return true unless File.exists?(file1)\n f1 = File.open(file1)\n d1 = f1.read\n f1.close\n return ! (d1 == data)\n end", "def identical?(file1, file2)\n File.identical?(file1, file2)\n end", "def == other\n self.id == other.id\n end", "def is_equal?\n @is_equal ||= if prepared_expected.is_a? Pathname\n FileUtils.compare_file(prepared_expected, prepared_produced)\n else\n prepared_expected == prepared_produced\n end\n end", "def equal?(other)\n other.respond_to?(:mol) && mol.equal?(other.mol) && id == other.id \n end", "def <=>(other)\n if number and other.number\n return number <=> other.number\n elsif number\n return -1\n elsif other.number\n return 1\n else\n name_or_file.gsub(/\\s+|_|-/, '').split(/(\\d+)/).map {|s| s =~ /\\d+/ ? s.to_i : s } <=> \n other.name_or_file.gsub(/\\s+|_|-/, '').split(/(\\d+)/).map {|s| s =~ /\\d+/ ? s.to_i : s }\n end\n end", "def ==(other)\r\n self.id == other.id\r\n end", "def lane_equal other_sample\n [:genome, :protocol].each do |lane_data|\n # puts \"#{self.send(lane_data)}\"\n if self.send(lane_data) != other_sample.send(lane_data)\n return false\n end\n end\n true\n end", "def eql?(other)\n return false unless other.is_a?(::Net::FTP::List::Entry)\n return true if equal?(other)\n\n raw == other.raw # if it's exactly the same line then the objects are the same\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def eql?(other)\n other.class == self.class &&\n other.logical_path == self.logical_path &&\n other.mtime.to_i == self.mtime.to_i &&\n other.digest == self.digest\n end", "def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\n end", "def files_same?(file1, file2) \n if (File.size(file1) != File.size(file2)) then\n return false\n end\n f1 = IO.readlines(file1)\n f2 = IO.readlines(file2)\n if ((f1 - f2).size == 0) then\n return true\n else\n return false\n end\n end", "def equal?( other )\n return false unless other.kind_of? ::Webby::Resources::Resource\n (self.destination == other.destination) && (self.path == other.path)\n end", "def ==(other)\n (compare(other) & CMP_IMAGE).zero?\n end", "def equals(one, two)\n matched_by(one, two)\n matched_by(two, one)\n end", "def ==(other)\n BSON::ObjectId === other && data == other.data\n end", "def byteCompare(f1, f2)\n byteChunk = 1\n file1 = File.open(f1,\"rb\")\n file2 = File.open(f2,\"rb\")\n until file1.eof?\n buffer1 = file1.read(byteChunk).bytes\n buffer2 = file2.read(byteChunk).bytes\n if buffer1!=buffer2\n file1.close\n file2.close\n return false\n end\n #puts buffer1.join(\",\")\n #puts buffer2.join(\",\")\n end\n file1.close\n if !file2.eof?\n file2.close\n return false\n end\n file2.close\n return true\nend", "def <=>(other)\r\n pattern.map {|it| it || '~'} <=> other.pattern.map {|it| it || '~'}\r\n end", "def same(x, y)\n find(x) == find(y)\n end", "def ==(other)\n return false unless other.respond_to?(:encoded)\n\n if self.message_id && other.message_id\n self.encoded == other.encoded\n else\n self_message_id, other_message_id = self.message_id, other.message_id\n begin\n self.message_id, other.message_id = '<temp@test>', '<temp@test>'\n self.encoded == other.encoded\n ensure\n self.message_id, other.message_id = self_message_id, other_message_id\n end\n end\n end", "def ==(other)\n @styles.sort == other.styles.sort\n end", "def ==(other)\n return false if !other\n data == other.data && version == other.version\n end", "def find_files(src,dest,options)\r\n src_files = self.find_as_relative( src, options[:excludes] )\r\n dest_files = self.find_as_relative( dest, options[:excludes] )\r\n\r\n # output target files\r\n puts \"  元フォルダ:\" + src_files.size.to_s + \"件\" if self.debug?\r\n puts \"同期先フォルダ:\" + dest_files.size.to_s + \"件\" if self.debug?\r\n #pp src_files if self.debug?\r\n sleep 1 if self.debug?\r\n\r\n #両方にあるファイル名で中身が違うもので src の方が古いもの\r\n same_name_files = (dest_files & src_files)\r\n same_name_files.reject!{|e|\r\n #ファイルが同じモノは省く\r\n next unless File.exists?( File.expand_path(e,dest))\r\n puts \"compare file bin. #{e}\" if self.debug? || self.verbose?\r\n $stdout.flush if self.debug?\r\n FileUtils.cmp( File.expand_path(e,src) , File.expand_path(e,dest) ) \r\n } if options[:strict]\r\n same_name_files.reject!{|e|\r\n #ファイルサイズが同じモノを省く(全部比較する代替手段)\r\n next unless File.exists?( File.expand_path(e,dest))\r\n puts \"size/mtime compare #{e}\" if self.debug? || self.verbose?\r\n File.size(File.expand_path(e,src)) == File.size( File.expand_path(e,dest))\r\n #&& File.mtime(File.expand_path(e,src)) == File.mtime( File.expand_path(e,dest) )\r\n } unless options[:strict]\r\n if options[:update] then\r\n same_name_files= same_name_files.select{|e|\r\n puts \"mtime is newer #{e}\" if self.debug? || self.verbose?\r\n (File.mtime(File.expand_path(e,src)) > File.mtime( File.expand_path(e,dest)))\r\n }\r\n end\r\n if options[:overwrite] == false then\r\n same_name_files= same_name_files.reject{|e|\r\n puts \"can over write? #{e}\" if self.debug? || self.verbose?\r\n (File.exists?(File.expand_path(e,src)) && File.exists?( File.expand_path(e,dest)))\r\n }\r\n end\r\n $stdout.flush if self.debug?\r\n files_not_in_dest = (src_files - dest_files)\r\n #files\r\n files =[]\r\n files = (files_not_in_dest + same_name_files ).flatten\r\n files\r\n end", "def compare\n\t\t\t\n\t\t\tDir.foreach(@folder1) do |item|\n\t\t\t\tbegin\n \t\t\t\tnext if item == '.' or item == '..'\n \t\t\t\tfullfilename = File.expand_path(@folder1, item)\n \t\t\t\tthe_hash = Digest::MD5.hexdigest(File.read(File.join(File.expand_path(@folder1), item)))\n \t\t\t\titem = item.downcase\n \t\t\t\tfiledata = FileHashResults.new(item, the_hash, nil)\n \t\t\t\t@filehash[item] = filedata\n \t\t\trescue\n \t\t\t #puts \"Skipped:#{item.inspect}\"\n \t\t\tend\n\t\t\tend\n\n\t\t\tDir.foreach(@folder2) do |item|\n\t\t\t begin\n \t\t\t\tnext if item == '.' or item == '..'\n \t\t\t\tthe_hash = Digest::MD5.hexdigest(File.read(File.join(@folder2, item)))\n \t\t\t\titem = item.downcase\n if(@filehash[item]==nil)\n \t\t\t\t\tfiledata = FileHashResults.new(item, nil, the_hash)\n \t\t\t\t\t@filehash[item] = filedata\n \t\t\t\t\tnext\n \t\t\t\tend\n \t\t\t\t@filehash[item.downcase].file_hash2 = the_hash\n \t\t\trescue\n #puts \"Skipped:#{item.inspect}\"\n end\t\n\t\t\tend\n\t\tend", "def <=>(other)\n if self.file_name != other.file_name\n raise ArgumentError, \"Cannot compare different files\"\n end\n return self.decode_time <=> other.decode_time\n end", "def filematch(file1, file2)\n system(\"diff #{file1} #{file2} > /dev/null\")\nend", "def filematch(file1, file2)\n system(\"diff #{file1} #{file2} > /dev/null\")\nend", "def ==(other)\n contents == other.contents && pos == other.pos && allowed == other.allowed\n end", "def ==(other)\n self.id == other.id && self.class == other.class\n end", "def ==(other)\n return self.id == other.id\n end", "def assert_pathname_cmp(int, s1, s2)\n p1 = Pathname.new(s1)\n p2 = Pathname.new(s2)\n result = p1 <=> p2\n assert_equal(int, result)\n end", "def diffem\n\t\tputs \"\\nFile 1 [#{file1.size} bytes]\"\n\t\tputs \"File 2 [#{file2.size} bytes]\\n\\n\"\n\n\t\tcount = 0\n\n\t\[email protected]_byte do |byte|\n\t\t\tif byte == @file2[count]\n\t\t\t\tprint sprintf(ColorConstants::BLUE + \"%02x \", byte)\n\t\t\telse\n\t\t\t\tprint sprintf(ColorConstants::RED + \"%02x \", byte)\n\t\t\tend\n\n\t\t\tcount = count+1\n\n\t\t\tif count % 32 == 0\n\t\t\t\tprint \"\\n\"\n\t\t\tend\n\t\tend\n\n\t\tputs ColorConstants::NO_COLOR + \"\\n---\"\n\t\tcount = 0\n\n\t\[email protected]_byte do |byte|\n\t\t\tif byte == @file1[count]\n\t\t\t\tprint sprintf(ColorConstants::BLUE + \"%02x \", byte)\n\t\t\telse\n\t\t\t\tprint sprintf(ColorConstants::RED + \"%02x \", byte)\n\t\t\tend\n\n\t\t\tcount = count+1\n\n\t\t\tif count % 32 == 0\n\t\t\t\tprint \"\\n\"\n\t\t\tend\n\t\tend\n\tend", "def ==(other)\n return true if other.equal?(self)\n return false unless other.kind_of?(self.class)\n folder == other.folder && name == other.name\n end", "def ==(other)\n _feed_name == other._feed_name && id == other.id\n end", "def ==(other)\n\t\tfalse unless @id == other.id\n\tend", "def sameFile( fileA, fileB )\n\n # If symlinks, make sure they link to the same thing.\n if File.symlink?( fileA ) || File.symlink?( fileB )\n return false unless File.symlink?( fileA ) and File.symlink?( fileB )\n linkA = File.readlink( fileA )\n linkB = File.readlink( fileB )\n return linkA == linkB\n end\n\n # Both exist.\n return false unless File.exists?( fileA ) and File.exists?( fileB )\n # Both are the same size.\n aBytes = File.stat( fileA ).size\n bBytes = File.stat( fileB ).size\n return false unless aBytes == bBytes\n\n # Random sample comparison.\n same = true\n $options[:samples].times do\n start = rand( aBytes )\n length = [aBytes, start + SampleSize].min - start + 1\n aSample = File.read( fileA, length, start )\n bSample = File.read( fileB, length, start )\n same = same && aSample == bSample\n end\n return same\nrescue\n STDOUT.puts \"ERROR: Can't read file [#{fileA}]\"\n $errorCount += 1\n return true # So we don't get two messages for the same file\nend", "def ==(other)\n self.class == other.class && id == other.id\n end", "def assert_pathname_cmp(int, s1, s2)\n p1 = Pathname.new(s1)\n p2 = Pathname.new(s2)\n result = p1 <=> p2\n assert_equal(int, result)\n end", "def <=> (other)\n\t\treturn nil unless other.is_a?MatrizDensa\n\t\tc1=0\n\t\tc2=0\n\t\tfor i in ([email protected]_i)\n\t\t\tfor j in ([email protected]_i)\n\t\t\t\tif(self.mat[i][j] > other.mat[i][j])\n\t\t\t\t\tc1+=1\n\t\t\t\telsif(self.mat[i][j] < other.mat[i][j])\n\t\t\t\t\tc2+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t(c1)<=>(c2)\n\tend", "def <=>(other)\n cmp = self.date <=> other.date\n if 0 == cmp\n cmp = self.basename <=> other.basename\n end\n return cmp\n end", "def eql?(other)\n other.class == self.class &&\n other.id == self.id &&\n other.operands.sort_by(&:to_s) == self.operands.sort_by(&:to_s)\n end", "def ==(other)\n path == other.path\n end", "def ==(other)\n path == other.path\n end", "def similarity(another)\n return 0.0 if @type != another.type\n similarity = Resource.compare(before, another.after) * 0.8\n similarity += @name == another.name ? 0.2 : 0\n similarity\n end", "def same?(other)\n bag == other.bag && path == other.path\n end", "def eql?(other)\n return false unless other.instance_of?(self.class)\n folder == other.folder && name == other.name\n end", "def compare_folders(a, b)\n\n puts \"* Comparing contents...\".light_yellow\n puts if OPTIONS.verbose\n \n common_a, unique_to_a = a.compare_to(b)\n common_b, unique_to_b = b.compare_to(a, common_a)\n common = common_a | common_b\n\n puts\n [unique_to_a, common, unique_to_b]\nend", "def cmp(other)\n\t\t\tif (!other.kind_of?(Mask32))\n\t\t\t\traise ArgumentError, \"Expected an Mask32 object for 'other' but got a #{other.class}.\"\n\t\t\tend\n\t\t\tif (self.prefix_len < other.prefix_len)\n\t\t\t\treturn 1\n\t\t\telsif (self.prefix_len > other.prefix_len)\n\t\t\t\treturn -1\n\t\t\tend\n\t\t\treturn 0\n\t\tend", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def isogram_matcher(isogram1, isogram2)\n \n # get common, get match in same position\n # position\n positions = 0\n i = 0\n while i < isogram1.length\n if isogram1[i] == isogram2[i]\n positions += 1\n end\n i += 1\n end\n \n # common\n common = (isogram1.split(\"\") & isogram2.split(\"\")).length\n common = common - positions\n \n [positions, common]\n \nend", "def ==(other)\n if other.is_a?(Code)\n @other_lines = other.instance_variable_get(:@lines)\n @lines.each_with_index.all? do |(l, ln), i|\n l == @other_lines[i].first && ln == @other_lines[i].last\n end\n else\n to_s.chomp == other.to_s.chomp\n end\n end", "def identical?(record1, record2)\n if regexp\n if (str1_match_data = regexp.match(record1.whole)) and (str2_match_data = regexp.match(record2.whole))\n str1_match_data.captures.join.downcase == str2_match_data.captures.join.downcase\n else\n nil\n end\n else\n proc.call record1.original, record2.original\n end\n end" ]
[ "0.6466042", "0.59572023", "0.57648844", "0.5756986", "0.5749427", "0.57184607", "0.5709936", "0.5666147", "0.5665333", "0.54457366", "0.535312", "0.5300145", "0.5281808", "0.52757215", "0.527003", "0.52358925", "0.5234192", "0.5227244", "0.5216049", "0.5175559", "0.51613545", "0.5153775", "0.5136173", "0.51144964", "0.51119107", "0.5111138", "0.5089671", "0.50497836", "0.5038445", "0.5017801", "0.50174963", "0.50102484", "0.49911654", "0.49889025", "0.49879336", "0.49879336", "0.49879336", "0.49879336", "0.49858448", "0.49656922", "0.49620888", "0.4961564", "0.4960124", "0.49484348", "0.49417153", "0.49393317", "0.4938395", "0.49345425", "0.4928466", "0.49255407", "0.4922122", "0.49144578", "0.49120948", "0.49111453", "0.4906498", "0.49051937", "0.49051937", "0.49038061", "0.48979288", "0.48942065", "0.4890511", "0.48839578", "0.48822635", "0.48764873", "0.48762256", "0.48755604", "0.48710194", "0.48694092", "0.48547107", "0.48539847", "0.48492837", "0.48479843", "0.48465228", "0.48439655", "0.4841835", "0.4836571", "0.48354614", "0.4834427", "0.4820992", "0.48196912", "0.4819191", "0.4815559", "0.48148054", "0.4813526", "0.48029432", "0.47970143", "0.4784428", "0.4781365", "0.47761607", "0.4773964", "0.4773964", "0.47739437", "0.47654912", "0.4761259", "0.47596204", "0.47545224", "0.47509375", "0.47509375", "0.47411764", "0.4731058", "0.47272757" ]
0.0
-1
Returns the shorthand String identifier of this Pattern.
def inspect "<Pattern: #{id}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_identify\n \"# #{self.id}\"\n end", "def unique_format_name\n title + \" (#{id || \"?\"})\"\n end", "def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end", "def name_inline_pattern( rule_name )\n name = rule_name.is_a?(Name) ? rule_name.name : rule_name\n\n attempt = [\"#{name}__pattern_\", 1]\n attempt[1] += 1 while @pattern_defs.member?(attempt.join(\"\"))\n \n name = attempt.join(\"\")\n return create_name(name)\n end", "def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end", "def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end", "def id\n name.gsub /-/, '_'\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id @schema.title}.#{Model::to_id name}\"\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def unique_format_name\n format_name + \" (#{id || \"?\"})\"\n end", "def css_id name\n attr \"##{name}\"\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id(name)}\"\n end", "def format_identifier\n self.identifier.to_s\n end", "def css_id *a; CssString.new a.flatten.unshift(self).join '#' end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def unique_partial_format_name\n string_with_id(partial_format_name)\n end", "def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end", "def prefixed_id\n \"p-#{resource.id}\"\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def identifier_string\n name\n end", "def identifier_method_name #:nodoc:\n short_identifier.gsub(/[^a-z0-9_]/, '_')\n end", "def var_name()\n if self.id.start_with?(/\\Ah?l_/i)\n return self.id.downcase\n else\n return \"l_#{self.id.downcase}\"\n end\n end", "def name\n self._id.to_s\n end", "def unique_name(id)\n id.to_s\n end", "def simple_id\n \"_#{@table.id}_#{@id}\"\n end", "def default_abbreviation\n \"%03d\" % (id % 1000) if id\n end", "def unique_format_name\n string_with_id(format_name)\n end", "def short_code\n id.to_s 36\n end", "def output_identifier(v)\n v = 'untitled' if v == ''\n (i = identifier_output_method) ? v.to_s.send(i).to_sym : v.to_sym\n end", "def unique_text_name\n real_text_name + \" (#{id || \"?\"})\"\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def short_name\n short.to_s.sub(/^(-.).*$/, \"\\\\1\")\n end", "def expanded_identifier\n case type\n when :@ident, :@const, :@gvar, :@cvar, :@ivar, :@kw, :@op\n self[1]\n when :var_ref, :var_field, :const_ref, :symbol\n self[1].expanded_identifier\n when :top_const_ref, :top_const_field\n \"::#{self[1].expanded_identifier}\"\n when :const_path_ref, :const_path_field\n lhs, rhs = children\n \"#{lhs.expanded_identifier}::#{rhs.expanded_identifier}\"\n end\n end", "def name_prefix\n @singleton ? '::' : '#'\n end", "def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend", "def hyphenated_name\n definition.hyphenated_name\n end", "def class_name()\n return self.id.downcase.gsub(/\\Ah?l_/i, \"\")\n end", "def long_name\n long.to_s.sub(/^(--.+?)(\\s+|\\=|\\[).*$/, \"\\\\1\")\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def unique_text_name\n text_name + \" (#{id || \"?\"})\"\n end", "def unique_name\n if @columns.length == 1\n @alias || @columns.first.__name\n else\n @alias\n end\n end", "def make_id\n \"#{self.class.name.downcase}#{id}\"\n end", "def id\n name.gsub(':', '-')\n end", "def text_id\n \"#{name} (##{id})\"\n end", "def identifier_string\n title\n end", "def identifier_string\n title\n end", "def id\n super.to_s.tr('.', '_')\n end", "def unique_id\n \"#{@table.name}-#{@id}\"\n end", "def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end", "def name_prefix\n singleton ? '::' : '#'\n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def name\n short_code\n end", "def pattern_name\n return nil if (@data[:type].nil? || @data[:subtype].nil?)\n \"#{@data[:type].downcase}_#{@data[:subtype].downcase}\"\n end", "def get_id\n default_id = self.class.to_s.split('::').last\n default_id[0] = default_id[0].downcase\n return default_id\n end", "def pretty_name\n \"#{singleton ? '::' : '#'}#{@name}\"\n end", "def pretty_name\n \"#{singleton ? '::' : '#'}#{@name}\"\n end", "def name\n # The name must be a string\n id.to_s\n end", "def path_string\n type == :simple_resource_id ? \"\\#{#{resource_names[0]}}\" : pattern.gsub(\"{\", \"\\#{\")\n end", "def text_id\n \"#{title} (#{color})\"\n end", "def key\n \"#{@type}{#{@title}}]\"\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def to_s\n \"#<syntax:#{ @name }>\"\n end", "def name\n \"#{number}: #{short_name}\"\n end", "def gen_name\n \n \"markerOption_#{@@count}\"\n end", "def id_attribute_for(class_name)\n class_name = class_name.match(/([^:]+)$/)[1]\n class_name.gsub!(/([A-Z])([A-Z][a-z])/, '\\1_\\2')\n class_name.gsub!(/([a-z])([A-Z])/, '\\1_\\2')\n\n \"#{class_name.downcase}_id\"\n end", "def key(name = nil)\n \"#{@id}:#{name}\"\n end", "def inspect\n \"#<#{self.class}: #@identifier>\"\n end", "def shortened\n id.to_s(Radix)\n end", "def simplified_pattern\n pattern\n end", "def simplified_pattern\n pattern\n end", "def identifier\n id_value || super\n end", "def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end", "def scaffold_name\n self[:name] or id\n end", "def inspect\n \"#<#{self.class}: #@identifier>\"\n end", "def inspect\n \"#<#{self.class}: #@identifier>\"\n end", "def name\n underscore const_name\n end", "def definition_name\n return @definition_name if defined?(@definition_name)\n\n if name\n @definition_name = name.gsub(\"::\", \"__\").freeze\n else\n \"#{self.class.name}_#{object_id}\".gsub(\"::\", \"__\").freeze\n end\n end", "def str_prefix\n\t\t\t\t\"\"\n\t\t\tend", "def identifier\n \"#{record.type} - #{record.id} - #{record.path}\"\n end", "def to_s\n short || name[0]\n end", "def prefix\n \"#{name}::\"\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def to_identifier\n \"#{self.document_template.identifier}::#{self.identifier}\"\n end", "def name\n return text_get(0, id)\n end", "def identifier\n \"##{id} - #{area_code} #{end_year} (#{created_at.strftime(\"%m-%d %H:%M\")})\"\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def short_name\n @short_name ||= name.to_s.split('').shift\n end", "def identifier\n @record.uri.to_s\n end", "def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end", "def selector_string()\n return Sass::Script::String.new(environment.selector.to_s)\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def unique_format_name\n if target\n if target.respond_to?(:unique_format_name)\n target.unique_format_name\n else\n target.format_name + \" (#{target_id || \"?\"})\"\n end\n else\n orphan_title\n end\n end", "def identifier\n id || name || default_identifier\n end", "def object_identifier\n [\"#{self.class.name}\", (id.nil? ? nil : \"##{id}\"), \":0x#{self.object_id.to_s(16)}\"].join\n end" ]
[ "0.6508747", "0.63072586", "0.6242334", "0.62032664", "0.61931306", "0.6182131", "0.6154871", "0.6148119", "0.61242986", "0.61147285", "0.61147285", "0.6097492", "0.6067098", "0.5956153", "0.59534144", "0.59474945", "0.5936135", "0.5936135", "0.5911306", "0.58939284", "0.589104", "0.5890075", "0.588944", "0.58860713", "0.58851814", "0.58759487", "0.5863918", "0.58392245", "0.58316624", "0.58257955", "0.5823706", "0.58229923", "0.5811501", "0.58027834", "0.57914436", "0.57843906", "0.5773263", "0.5769101", "0.57524526", "0.572007", "0.5715137", "0.57086366", "0.57017875", "0.56955415", "0.56955415", "0.5680888", "0.56799424", "0.5677805", "0.56758344", "0.56745774", "0.56745774", "0.5669559", "0.566697", "0.56632185", "0.565935", "0.5653591", "0.5650681", "0.5626953", "0.5590071", "0.55883795", "0.55883795", "0.558231", "0.55766475", "0.5572006", "0.55710304", "0.55645084", "0.55638176", "0.5562541", "0.5562321", "0.556178", "0.556175", "0.5557838", "0.55485386", "0.55482256", "0.55482256", "0.5546976", "0.5542202", "0.5531593", "0.55287725", "0.55287725", "0.55280775", "0.551972", "0.5518083", "0.55155903", "0.55047524", "0.548932", "0.54875296", "0.54875296", "0.54871017", "0.5485774", "0.54788077", "0.5476562", "0.5474789", "0.5472207", "0.54699427", "0.5460501", "0.5459067", "0.5459067", "0.54580015", "0.5450273" ]
0.59110826
19
Initialize a LibraryPage instance. site The actual Site instance. name The String page name. patterns The Array of Pattern objects Returns a new LibraryPage instance.
def initialize(site, name, patterns) @site = site @dir = '' @name = name @patterns = patterns self.basename = name.gsub(' ', '-') self.ext = '.html' self.data = { 'layout' => 'pattern_library', 'patterns' => patterns, 'sections' => pattern_attr_hash('section'), 'title' => name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(site)\n patterns = read_content(site, '', '_patterns', Pattern)\n\n site.pages << LibraryPage.new(site, 'pattern library', patterns)\n end", "def initialize(website)\n\t\t@subpages = website.subpages\n\t\t@base_url = website.base_url\n\t\t@pattern_finder, @pattern_tester = PatternFinder.new(website), PatternTester.new(@subpages)\n\t\t@crawler_patterns, @duplicate_patterns = [], []\n\tend", "def initialize(page, site)\n @page = page\n @site = site\n end", "def initialize(page)\n raise ArgumentError, \"unsupported site #{page}\" unless self.class.supports?(page)\n\n @company = URI(page).path[1..-1]\n raise ArgumentError, \"#{page} does not have the company's name in its path\" unless @company.present?\n end", "def initialize pages, title =\"N/A\" #Now the title is not required\n \t@pages = pages\n \t@title = title\n \t@@library_count +=1 #everytime we initialize a book, it will add to the counter\n end", "def initialize(name, pattern)\n @name, @pattern = name, pattern\n end", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n\n @site = site\n @base = base\n @dir = dir\n @name = name ? name : 'index.html'\n @path = name ? File.join(base, dir, name) : ''\n\n read_file base, dir, name\n\n process_dir config.dir(:galleries), config.dir(:galleries, :out)\n process_name \n \n paginate config.items_per_page\n \n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(File.join(dir, @name), type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self \n end", "def initialize(site, month, posts)\n puts \"Creating page instance for the time period: \"+month;\n\n @site = site\n @month = month\n# @year = year\n self.ext = '.html'\n self.basename = 'index'\n self.content = <<-EOS\n<ul>\n{% for post in page.posts %}\n<li><a href=\"{{ post.url }}\">{{ post.title }}</a></li>\n{% endfor %}\n</ul>\nEOS\n self.data = {\n 'layout' => 'blogoverview',\n 'type' => 'archive',\n 'title' => \"Archive for #{month}\",\n 'posts' => posts,\n 'time' => @month\n }\n end", "def initialize(path, page)\n @path = path\n @page_name = page\n end", "def initialize( name, pattern, *args, &block )\n\t\t\t@pattern = pattern\n\n\t\t\tsuper( name, *args, &block )\n\t\tend", "def initialize( page )\n unless page.instance_of? Resources::Page\n raise ArgumentError,\n \"only page resources can be rendered '#{page.path}'\"\n end\n\n @page = page\n @pages = Resources.pages\n @partials = Resources.partials\n @content = nil\n @config = ::Webby.site\n\n @_bindings = []\n @log = Logging::Logger[self]\n end", "def initialize(site, base, dir, name); end", "def initialize(site, base, name); end", "def initialize(args={})\n unless args.is_a?(Hash)\n raise SiteObject::SiteInitError, \"You must provide hash arguments when initializing a site object. At a minimum you must specify a base_url. Example:\\ns = SiteObject.new(base_url: 'http://foo.com')\"\n end\n\n @arguments = args.with_indifferent_access\n @base_url = @arguments[:base_url]\n @browser = @arguments[:browser]\n @pages = self.class::Page.descendants.reject { |p| p.page_template? }\n\n # Set up accessor methods for each page and page checking methods..\n @pages.each do |current_page|\n unless current_page.page_template?\n current_page.set_url_template(@base_url)\n\n if current_page.url_matcher\n unless current_page.url_matcher.is_a? Regexp\n raise SiteObject::PageConfigError, \"A url_matcher was defined for the #{current_page} page but it was not a regular expression. Check the value provided to the set_url_matcher method in the class definition for this page. Object provided was a #{current_page.url_matcher.class.name}\"\n end\n end\n\n self.class.class_eval do\n define_method(current_page.to_s.underscore) do |args=nil, block=nil|\n current_page.new(self, args)\n end\n\n define_method(\"#{current_page.to_s.underscore}?\") do\n on_page? current_page\n end\n end\n end\n end\n\n visited = Set.new\n tmp = @pages.map {|p| p.instance_methods }.flatten\n tmp.each do |element|\n if visited.include?(element)\n else\n visited << element\n end\n end\n @unique_methods = visited\n end", "def initialize(pat, descr)\n\t @pat = pat #instance varable\n\t @descr = descr\n\n end", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = if site.in_theme_dir(base) == base # we're in a theme\n site.in_theme_dir(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process(name)\n read_yaml(PathManager.join(base, dir), name)\n generate_excerpt if site.config[\"page_excerpts\"]\n\n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(relative_path, type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self\n end", "def initialize(site, year, months)\n @site = site\n @year = year\n @months = months\n\n @base = Miq.site_dir\n @dir = \"blog/#{year}\"\n @name = \"index.html\"\n @path = File.join(@base, \"_layouts\", Miq.blog_year_template)\n\n process(name)\n read_yaml(File.join(@base, \"_layouts\"), Miq.blog_year_template)\n\n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(File.join(@dir, @name), type, key)\n end\n\n data['title'] = \"Blog Posts for #{year}\"\n data['months'] = month_pages\n\n Jekyll::Hooks.trigger :pages, :post_init, self\n end", "def initialize(name)\n @name = @pattern = name\n @templatedir = \"#{PATTERNDIR}/#{@pattern}/templates\"\n @knownpatterns = Dir.entries(PATTERNDIR).reject {|x| [\"..\",\".\"].include?(x)}\n @manitemplates = Dir.entries(templatedir).reject {|x| [\"..\",\".\"].include?(x)}\n rescue Errno::ENOENT => e\n abort \"Pattern #{@pattern} is not defined within the patterns directory #{PATTERNDIR}\n Known patterns are:\n #{@knownpatterns.join(\"\\n\")}\"\n end", "def initialize(url, body = nil, code = nil, headers = nil, aka = nil, response_time = nil)\n @url = url\n @code = code\n @headers = headers\n @links = []\n @aliases = []\n @data = OpenStruct.new\n @external = url.is_external?\n @content_length = headers['content-length'].first if headers && headers['content-length']\n @response_time = response_time\n \t \n @aliases << aka if !aka.nil?\n\n if body\n begin\n @doc = body\n rescue\n return\n end\n\n return if @doc.nil?\n \n if self.html?\n Link.find_all_links_in(self) \n end\n \n @links.uniq!\n end\n rescue Exception => exp\n puts \"An error occured [#{exp}]\"\n Page.new(url)\n end", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name + \".html\"\n self.process(name + \".html\")\n self.data = Hash.new\n self.data[\"layout\"] = \"default\" #need to have a default layout\n end", "def initialize(page_path)\n @page_path = page_path\n end", "def initialize(title, author, page)\n @title=title\n @author=author\n @page=page\n end", "def initialize(pattern)\n @pattern = pattern\n end", "def initialize(page)\n @page = page\n end", "def initialize(title=\"TITLE\", pages=0)\n\t\t@title = title\n\t\t@pages = pages\n @@book_count += 1\n\tend", "def initialize(dir)\n # Create a new patterns hash\n @patterns = Hash.new\n\n # Get the pattern files in the directory\n dir += '/' if(!dir.end_with?('/'))\n files = Dir.glob(dir + \"*.pattern\")\n\n # Create a DesignPattern for each file\n files.each do |f|\n pattern = DesignPattern.new(f)\n @patterns[pattern.name] = pattern\n end\n end", "def initialize(site, base, dir, name, collection = T.unsafe(nil)); end", "def initialize(site, base, index_files, dir, data, name, title, template, extension, defaults = {})\n @site = site\n @base = base\n\n # @dir is the directory where we want to output the page\n # @name is the name of the page to generate\n #\n # the value of these variables changes according to whether we\n # want to generate named folders or not\n if data[name] == nil\n puts \"error (datapage_gen). empty value for field '#{name}' in record #{data}\"\n else\n filename = sanitize_filename(data[name]).to_s\n\n @dir = dir + (index_files ? \"/\" + filename + \"/\" : \"\")\n @name = (index_files ? \"index\" : filename) + \".\" + extension.to_s\n\n self.process(@name)\n self.read_yaml(File.join(base, '_layouts'), template + \".html\")\n\n # original method to set page title to data[name]\n # self.data['title'] = data[name]\n\n if title\n self.data['title'] = data[title]\n elsif data['publiccode'] && data['publiccode']['name']\n self.data['title'] = data['publiccode']['name'] + ' - ' + defaults['title_suffix']\n else\n self.data['title'] = data[name]\n end\n\n self.data.merge!(defaults)\n # add all the information defined in _data for the current record to the\n # current page (so that we can access it with liquid tags)\n self.data.merge!(data)\n end\n end", "def build_pages( page_name )\n vars = {}\n paths = page_name.split( '/' )\n loop do\n try_page = paths.join( '_' ).gsub('-','_')\n if respond_to? \"skel_#{ try_page }\"\n section_path = File.dirname( page_name )\n path_storage = storage.path_storage( section_path )\n method( \"skel_#{ try_page }\" ).call( path_storage, section_path ) do |vars|\n vars[:weblog] = self\n raise TypeError, \"No `page' variable returned from skel_#{ try_page }.\" unless vars[:page]\n yield vars\n end\n return\n end\n break unless paths.slice!( -2 ) ## go up a directory\n end\n vars[:weblog] = self\n vars[:page] = Page.new( page_name )\n vars[:page].timestamp = Time.now\n yield vars\n end", "def initialize(title, author, pages)\n @title = title\n @author = author\n @pages = pages\n end", "def initialize(site, page, all_posts, num_pages = nil)\n @page = page\n @per_page = site.config['paginate'].to_i\n @total_pages = num_pages || Pager.calculate_pages(all_posts, @per_page)\n\n if @page > @total_pages\n raise RuntimeError, \"page number can't be greater than total pages: #{@page} > #{@total_pages}\"\n end\n\n init = (@page - 1) * @per_page\n offset = (init + @per_page - 1) >= all_posts.size ? all_posts.size : (init + @per_page - 1)\n\n @total_posts = all_posts.size\n @posts = all_posts[init..offset]\n @previous_page = @page != 1 ? @page - 1 : nil\n @previous_page_path = Pager.paginate_path(site, page, @previous_page)\n @next_page = @page != @total_pages ? @page + 1 : nil\n @next_page_path = Pager.paginate_path(site, page, @next_page)\n end", "def initialize(site)\n @site = site\n end", "def initialize(site)\n\t\t\tputs \"Rcrawl Version #{VERSION} initializing...\"\n\t\t\t@links_to_visit = Array.new\n\t\t\t@visited_links = Array.new\n\t\t\t@external_links = Array.new\n\t\t\t@raw_html = Hash.new\n\t\t\t@rules = RobotRules.new('Rcrawl')\n\t\t\t@user_agent = \"Rcrawl/#{VERSION} (http://rubyforge.org/projects/rcrawl/)\"\n\t\t\t@sites = Hash.new\n\t\t\t@errors = Hash.new\n\t\t\t@meta = Hash.new\n\t\t\t@site = URI.parse(site) || raise(\"You didn't give me a site to crawl\")\n\t\t\t@links_to_visit << site\n\t\t\tputs \"Ready to crawl #{site}\"\n\t\tend", "def initialize(site, page, all_posts, tag, num_pages = nil)\n @tag = tag\n super site, page, all_posts, num_pages\n\n # Prefix our _path variables with our tag name\n # TODO - This sucks! Prefix it with our page path instead!\n \n if @previous_page_path \n @previous_page_path = \"/#{tag}#{@previous_page_path}\"\n end\n\n if @next_page_path\n @next_page_path = \"/#{tag}#{@next_page_path}\"\n end\n\n end", "def initialize(site, page, all_posts, lang, num_pages = nil)\n @page = page\n @per_page = site.config['paginate_l'].to_i\n @total_pages = num_pages || Pager.calculate_pages(all_posts, @per_page)\n @current_lang = lang\n\n if @page > @total_pages\n raise RuntimeError, \"page number can't be greater than total pages: #{@page} > #{@total_pages}\"\n end\n\n init = (@page - 1) * @per_page\n offset = (init + @per_page - 1) >= all_posts.size ? all_posts.size : (init + @per_page - 1)\n\n @total_posts = all_posts.size\n @posts = all_posts[init..offset]\n @previous_page = @page != 1 ? @page - 1 : nil\n @previous_page_path = Pager.paginate_path(site, @previous_page)\n @next_page = @page != @total_pages ? @page + 1 : nil\n @next_page_path = Pager.paginate_path(site, @next_page)\n end", "def initialize(site, path)\n super\n @metadata = [ :title, :layout, :author ]\n \n @name = source_path[0..(-1-source_ext.length)].gsub(/\\//, '-')\n \n @tags = []\n unless source_metadata[:tags].nil?\n for tag in source_metadata[:tags]\n @tags << site.tags[tag]\n @tags.last << self\n end\n end\n \n if name =~ /^(\\d+-\\d+-\\d+)-(.+)$/\n @created = Time.parse $1\n @updated ||= @created\n @slug = $2\n @output_dir = created.strftime('%Y/%m/%d')\n @output_path = File.join output_dir, \"#{slug}.html\"\n @uri = \"/#{output_path}\"\n else\n raise ArgumentError, \"Bad file name: #{name}\"\n end\n end", "def initialize page, diario\n @page = page\n @uri = page.uri\n @diario = diario\n end", "def initialize(site, source, dir, name)\n @site = site\n @dir = dir\n @base = containing_dir(source, dir)\n @name = name\n\n read_yaml(@base, name)\n\n self.markup_escaped = CGI.escapeHTML(content)\n self.id = data.key?('id') ? data['id'].to_s : name.match(MATCHER)[1]\n self.section = data.key?('section') ? [data['section'].to_s] : []\n self.usage = data.key?('usage') ? data['usage'].to_s : nil\n end", "def initialize(urls, &block)\n @urls = [urls].flatten.map{ |url| URI(url) if url.is_a?(String) }\n @urls.each{ |url| url.path = '/' if url.path.empty? }\n \n @tentacles = []\n @pages = PageHash.new\n @on_every_page_blocks = []\n @on_pages_like_blocks = Hash.new { |hash,key| hash[key] = [] }\n @skip_link_patterns = []\n @after_crawl_blocks = []\n \n if Anemone.options.obey_robots_txt\n @robots = Robots.new(Anemone.options.user_agent)\n end\n \n block.call(self) if block\n end", "def set_page_by_name\n name = params[:page] || Rails.application.config.MAIN_PAGE\n\n @page = Page.new(name)\n end", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n @gallery_name = pathify(dir).name\n\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = File.join(base, dir, name)\n\n process_dir config.dir(:thumbs),\n config.dir(:galleries, :out), \n gallery_name,\n File.join(output_gallery_name, config.dir(:thumbs, :out))\n\n @relative_path = File.join(@dir, output_name)\n @extname = File.extname(@name)\n @data = @site.frontmatter_defaults.all(relative_path, type)\n end", "def instantiate_pattern\n pattern = Pattern.new\n doc.search('/RenoiseSong/Tracks/*').map(&:name).each do |track|\n type = track.gsub(/\\ASequencer/, 'Pattern')\n pattern.tracks << PatternTrack.new(type: type)\n end\n pattern\n end", "def initialize(site, page, all_posts, author, num_pages = nil)\n @author = author\n super site, page, all_posts, num_pages\n end", "def add_page(url)\n unless robot_txt_allowed?(url)\n @scanned_pages << url\n return nil\n end\n page = Page.new(url)\n @pages << page\n @scanned_pages << url\n end", "def initialize(url, body = nil, code = nil, headers = nil, aka = nil, referer = nil, depth = 0, response_time = nil)\n @url = url\n @code = code\n @headers = headers\n @links = []\n @aliases = []\n @data = OpenStruct.new\n @referer = referer\n @depth = depth || 0\n @response_time = response_time \n\n @aliases << aka if !aka.nil?\n\n if body\n begin\n @doc = Nokogiri::HTML(body)\n rescue\n return\n end\n\n return if @doc.nil?\n\n #get a list of distinct links on the page, in absolute url form\n @doc.css('a').each do |a| \n u = a.attributes['href'].content if a.attributes['href']\n next if u.nil?\n \n begin\n abs = to_absolute(URI(u))\n rescue\n next\n end\n\n @links << abs if in_domain?(abs)\n end\n \n @links.uniq!\n end\n end", "def initialize(page, _url = nil)\n @page = page\n #@page.click_button('Continue') if @page.has_text?('Maintainence')\n @page.visit(target_base_url + '/sources')\n end", "def initialize(name, url) \n\t\t@name = name \n\t\t@url = url \n\t\t@@all << self \n\tend", "def initialize(bank_page)\n return if bank_page.nil? # Enables possibility to instantiate object with nil argument(for testing)\n\n @bank_page = bank_page\n @browser = bank_page.browser\n @page = bank_page.load_page\n end", "def initialize( name )\n @name = name\n get_page_content\n get_total\n end", "def initialize(projectPattern, outDescription = nil, &block)\n @projectPattern = projectPattern\n @description = outDescription #|| projectPattern.sort\n @block = block\n end", "def initialize(site, base, name)\n @site = site\n @base = base\n @name = name\n\n if site.theme && site.theme.layouts_path.eql?(base)\n @base_dir = site.theme.root\n @path = site.in_theme_dir(base, name)\n else\n @base_dir = site.source\n @path = site.in_source_dir(base, name)\n end\n @relative_path = @path.sub(@base_dir, \"\")\n\n self.data = {}\n\n process(name)\n read_yaml(base, name)\n end", "def on_pages_like(*patterns, &block)\n if patterns\n patterns.each do |pattern|\n @on_pages_like_blocks[pattern.source] << block\n end\n end\n self\n end", "def on_pages_like(*patterns, &block)\n if patterns\n patterns.each do |pattern|\n @on_pages_like_blocks[pattern.source] << block\n end\n end\n self\n end", "def on_pages_like(*patterns, &block)\n if patterns\n patterns.each do |pattern|\n @on_pages_like_blocks[pattern.source] << block\n end\n end\n self\n end", "def initialize(site, base, dest_dir, dest_name, src_dir, src_name, data_mtime )\n @site = site\n @base = base\n @dir = dest_dir\n @dest_dir = dest_dir\n @dest_name = dest_name\n @dest_url = File.join( '/', dest_dir ) \n @dest_url = File.join( '/', dest_dir, dest_name ) if !dest_name.match( /index.html/i )\n @src_mtime = data_mtime\n\n src_file = File.join(base, src_dir, \"#{src_name}.markdown\" )\n src_name_with_ext = \"#{src_name}.markdown\" if File.exists?( src_file )\n src_name_with_ext ||= \"#{src_name}.html\"\n\n @name = src_name_with_ext\n self.process(src_name_with_ext)\n \n # Read the YAML from the specified page\n self.read_yaml(File.join(base, src_dir), src_name_with_ext )\n # byebug\n # Remember the mod time, used for site_map\n file_mtime = File.mtime( File.join(base, src_dir, src_name_with_ext) )\n @src_mtime = file_mtime if file_mtime > @src_mtime\n end", "def add_to_site(site, path, content)\n page = ::Awestruct::Page.new(site,\n ::Awestruct::Handlers::LayoutHandler.new(site,\n ::Awestruct::Handlers::TiltHandler.new(site,\n ::Aweplug::Handlers::SyntheticHandler.new(site, content, path))))\n page.layout = @layout\n page.output_path = path\n site.pages << page\n page\n end", "def initialize(page_url, name, course)\n @name = name\n @url = page_url\n @course = course\n @client = course.client\n \n page = @client.get_nokogiri @url\n unless page.css('#content p b').any? { |dom| dom.inner_text.strip == name }\n raise ArgumentError, 'Invalid homework page URL'\n end\n end", "def initialize(site, path, meta = nil)\n @site = site\n @path = path\n @meta = meta || Meta.new(path)\n end", "def method_missing(name, *args)\n @suite << PageTest.new(@prefix, name.to_s, args.first, url_params: @url_params)\n end", "def initialize pager, page; @pager, @page = pager, page; end", "def initialize(site, source, dir, name)\n @site = site\n @base = File.join(source, dir)\n @name = name\n self.data = {\"layout\" => \"photo\"}\n\n self.categories = [] # dir.split('/').reject { |x| x.empty? }\n self.tags = []\n\n self.process(name)\n\n self.content = <<content\n<img src=\"#{self.id}\" />\ncontent\n end", "def new \n @highlight = Page.new\n end", "def initialise(*url)\n @urls = [] \n list = File.open('url_list').each do |url|\n puts url\n doc = Nokogiri::HTML(open(url)) \n @urls.push(doc)\n end\n end", "def initialize(pattern, handler_method)\n @pattern = pattern\n @handler_method = handler_method\n end", "def initialize(l_name)\n\t\t@books = Array.new \n\t\t@members = Array.new\n\t\t@library_name=l_name #Set the library name with passed parameter.\n\t\tputs \"-------\\nWelcome to '#{@library_name}' Library, The world's Best library\\n-------\"\n\t\tload_book_data_from_yml\n\t\tload_member_data_from_yml\n\t\t#puts \"books loaded=#{@books.length} member loaded=#{@members.length}\"\n\t\t#print_book_list\n\t\t#print_member_list\n\tend", "def initialize(config_per_page, config_permalink, posts, cur_page_nr, num_pages, template_url, template_path )\r\n @page = cur_page_nr\r\n @per_page = config_per_page.to_i\r\n @total_pages = num_pages\r\n\r\n if @page > @total_pages\r\n raise RuntimeError, \"page number can't be greater than total pages: #{@page} > #{@total_pages}\"\r\n end\r\n\r\n init = (@page - 1) * @per_page\r\n offset = (init + @per_page - 1) >= posts.size ? posts.size : (init + @per_page - 1)\r\n\r\n @total_posts = posts.size\r\n @posts = posts[init..offset]\r\n @previous_page = @page != 1 ? @page - 1 : nil\r\n @previous_page_path = @page != 1 ? Utils.paginate_path(template_url, template_path, @previous_page, config_permalink) : nil\r\n @next_page = @page != @total_pages ? @page + 1 : nil\r\n @next_page_path = @page != @total_pages ? Utils.paginate_path(template_url, template_path, @next_page, config_permalink) : nil\r\n end", "def initialize(opts = {})\n o = {\n :name => nil,\n :aliases => []\n }.merge(opts)\n\n @name = o[:name]\n raise \"Parfait::Page requires a name to be defined\" unless @name\n raise \"Parfait::Page requires name to be a string\" unless @name.is_a?(String)\n\n @aliases = o[:aliases]\n if @aliases\n raise \"Parfait::Page requires aliases to be an array\" unless @aliases.is_a?(Array)\n @aliases.each do |my_alias|\n raise \"Parfait::Page requires each alias in the array to be a string\" unless my_alias.is_a?(String)\n end\n end\n \n @controls = Hash.new\n @regions = Hash.new\n @page_test = nil\n super\n end", "def create\n url = params['url']\n doc = Crawl::PageHandler.fetch_page(url)\n page_data = Crawl::PageHandler.parse_page(url, doc)\n page = Page.create(url: url,\n chksum: Zlib.crc32(url),\n parsed: page_data.to_json)\n render json: { url: page[:url],\n chksum: page[:chksum],\n parsed: page[:parsed] }\n end", "def on_pages_like(*patterns, &block)\n if patterns\n patterns.each do |pattern|\n @on_pages_like_blocks[pattern] << block\n end\n end\n self\n end", "def on_pages_like(*patterns, &block)\n if patterns\n patterns.each do |pattern|\n @on_pages_like_blocks[pattern] << block\n end\n end\n self\n end", "def initialize(dir, page_extension)\n @dir = dir\n @extension = page_extension\n end", "def initialize(site, base, dir, name, from_plugin: false)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @ext = File.extname(name)\n @basename = File.basename(name, \".*\")\n @path = if from_plugin\n File.join(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process\n\n self.data ||= HashWithDotAccess::Hash.new\n\n Bridgetown::Hooks.trigger :generated_pages, :post_init, self\n end", "def initialize(pattern, *options)\n case pattern\n when ::Regexp, PCRE2::Regexp\n @source = pattern.source\n else\n @source = pattern\n end\n\n @pattern_ptr = Lib.compile_pattern(source, options)\n end", "def initialize(site, path)\n super\n @metadata = [ :title, :layout ]\n \n src_base = File.basename(source_path, source_ext)\n output_ext = File.extname(src_base)\n if output_ext.nil? || output_ext.empty?\n output_ext = '.html'\n else\n src_base = File.basename(src_base, output_ext)\n end\n @output_dir, src_file = File.split(source_path)\n \n if output_dir == '.'\n prefix = ''\n else\n prefix = \"#{output_dir}/\"\n end\n @name = \"/#{prefix}#{src_base}\"\n @output_path = \"#{prefix}#{src_base}#{output_ext}\"\n \n if src_base == 'index'\n @uri = \"/#{output_dir}/\"\n else\n @uri = \"/#{output_path}\"\n end\n end", "def initialize(path,logger=nil)\r\n @pathname = Pathname.new(path)\r\n @logger = logger\r\n scan_templates\r\n end", "def new\n @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def initialize(site, tag)\n @site = site\n @tag = tag\n @base = site.source\n @dir, @name = tag_path\n process_tag_template\n setup_defaults\n end", "def initialize(name=nil, mainlink=nil, groupid=nil, grouplink=nil)\n @name = name\n @mainlink = mainlink\n @groupid = groupid\n @grouplink = grouplink\n @portfolios = []\n @views = []\n @local_dir = nil\n end", "def initialize(page_file, min_id, max_id, values = [])\n @page_file = page_file\n @min_id = min_id\n @max_id = max_id\n @page_entries = 0\n @page_idx = @page_file.new_page(self, values)\n end", "def page(name, version = 'master')\n @page_class.new(self).find(name, version)\n 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 initialize node, page\n\t\t@node = node\n\t\t@page = page\n\t\t@mech = page.mech\n\tend", "def initialize(pages)\n raise ArgumentError.new('Only array, or range') unless pages.is_a?(Array) || pages.is_a?(Range)\n @pages = pages || ('a'..'z')\n @browser = Selenium::WebDriver.for :firefox\n @data = []\n end", "def initialize( *patterns )\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end", "def initialize(page)\n if page\n @wiki = page.wiki\n @name = page.filename\n @data = page.text_data\n @version = page.version.id if page.version\n @format = page.format\n @sub_page = page.sub_page\n @parent_page = page.parent_page\n @page = page\n @dir = ::File.dirname(page.path)\n end\n @metadata = nil\n @to_xml_opts = { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^ 1, :indent => 0, :encoding => 'UTF-8' }\n end", "def initialize(tag, site:)\n @site = site\n @tag = tag\n @base = site.source\n @dir, @name = tag_path\n process_tag_template\n setup_defaults\n end", "def initialize pages\n raise ArgumentError.new('Only array, or range') unless pages.kind_of?(Array) || pages.kind_of?(Range)\n @pages = pages || ('a'..'z')\n @data = []\n end", "def initialize(blogURL)\n @blogURL = blogURL\n @posts = Array.new()\n end", "def initialize(source, dest, ignore_pattern = '^$')\n self.source = source\n self.dest = dest\n self.ignore_pattern = Regexp.new(ignore_pattern + '|^\\.(?!htaccess).*$|^_(?!posts).*$')\n self.layouts = {}\n self.posts = []\n self.categories = Hash.new { |hash, key| hash[key] = Array.new }\n self.read_settings\n self.options = {}\n\n config_file_path = File.join(self.source, '.jekyllrc')\n if File.exists?(config_file_path)\n self.options = YAML.load(File.read(config_file_path))\n end\n \n self.options['layouts_path'] ||= File.join(self.source, '_layouts')\n self.options['includes_path'] ||= File.join(self.source, '_includes')\n end", "def get(page)\n case page\n when Model\n page\n when String\n new site.get page\n when Sitepress::Resource\n new page\n else\n raise ModelNotFoundError, \"#{self.inspect} could not find #{page.inspect}\"\n end\n end", "def initialize(urls, opts = {})\n @urls = [urls].flatten.map{ |url| url.is_a?(URI) ? url : URI(url) }\n @urls.each{ |url| url.path = '/' if url.path.empty? }\n\n @tentacles = []\n @on_every_page_blocks = []\n @on_pages_like_blocks = Hash.new { |hash,key| hash[key] = [] }\n @skip_link_patterns = []\n @after_crawl_blocks = []\n @opts = opts\n @focus_crawl_block = nil\n\n\n yield self if block_given?\n end", "def initialize(site_path)\n require 'rack'\n require 'mime/types'\n\n # Set site\n @site_path = site_path\n\n # Create mutex to prevent parallel requests\n @mutex = Mutex.new\n end", "def create_tag_pages(items=nil, options={})\n options[:tag_pattern] ||= \"%%tag%%\"\n options[:title] ||= options[:tag_pattern]\n options[:identifier] ||= \"/tags/#{options[:tag_pattern]}/\"\n options[:template] ||= \"tag\"\n\n tag_set(items).each do |tagname|\n raw_content = \"<%= render('#{options[:template]}', :tag => '#{tagname}') %>\"\n attributes = { :title => options[:title].gsub(options[:tag_pattern], tagname) }\n identifier = options[:identifier].gsub(options[:tag_pattern], tagname)\n\n @items << Nanoc::Item.new(raw_content, attributes, identifier, :binary => false)\n end\n end", "def initialize(pattern, options = {})\n raise ArgumentError, 'pattern cannot be nil' unless pattern\n raise ArgumentError, 'pattern cannot be empty' if pattern.empty?\n @pattern = pattern\n @options = {\n :glob => :all\n }.merge(options)\n @paths = []\n end", "def initialize(sitefile, opts={})\n Gumdrop.send :set_current_site, self\n @sitefile= sitefile.expand_path\n @options= Util::HashObject.from opts\n _options_updated!\n @root= File.dirname @sitefile\n @last_run= 0\n @_preparations= []\n\n @contents= ContentList.new\n @layouts= SpecialContentList.new \".layout\"\n @partials= SpecialContentList.new\n @generators= []\n @data= DataManager.new\n\n clear\n end", "def initialize(page)\n super()\n @page = page\n @manager = RenderingManager.new(page)\n\n @object_id_to_object = Hash.new\n @registered_exceptions = Array.new\n end", "def init(options={})\n \t\t@pattern = options[:pattern]\n \t\t@number_of_verses = options[:number_of_verses]\n \tend", "def initialize file_path\n md = file_path.match(/(\\d{4}-\\d{2}-\\d{2}-?(\\d{2}-\\d{2})?)-(\\w*)-([\\w-]*)/)\n\n unless md.nil?\n @date = Date.parse(md[1])\n @tags = md[4].split \"-\"\n end\n\n File.open(file_path) do |file|\n\n @title = \"\"\n @title = file.readline until md = @title.match(/^#+(.*)/) \n @title = md[1]\n\n if (md = @title.match /^\\[(.*)\\]\\((.*)\\)/)\n @title = md[1] \n @link = md[2]\n @type = :link\n else\n @type = :post\n end\n\n @content = Maruku.new(file.read).to_html\n @slug = @title.downcase.gsub(/[^\\w\\s]/, \"\").gsub /\\s+/, \"-\"\n @permalink = \"#{@slug}.html\"\n end\n end", "def initialize(title, link)\n @title = title\n @link = link\n @@all << self\n end", "def initialize(pattern, rep_name, block, params = {})\n # TODO: remove me\n unless pattern.is_a?(Nanoc::Int::StringPattern) || pattern.is_a?(Nanoc::Int::RegexpPattern)\n raise 'Can only create rules with patterns'\n end\n\n @pattern = pattern\n @rep_name = rep_name.to_sym\n @snapshot_name = params[:snapshot_name]\n\n @block = block\n end" ]
[ "0.7092953", "0.57706034", "0.5765519", "0.5544619", "0.55328244", "0.5474454", "0.54677075", "0.5441894", "0.5421549", "0.5390345", "0.5369922", "0.52800405", "0.52580535", "0.5189265", "0.5183664", "0.5181913", "0.5167189", "0.5162886", "0.512814", "0.5125363", "0.5109584", "0.50978714", "0.50849015", "0.5032048", "0.5012194", "0.49816686", "0.49816465", "0.494086", "0.49054244", "0.48932236", "0.48900273", "0.48673725", "0.48507497", "0.4850171", "0.48464802", "0.48389378", "0.48319045", "0.4815665", "0.48152268", "0.47956714", "0.47940928", "0.47895664", "0.47871125", "0.47859955", "0.47702843", "0.4769692", "0.4762881", "0.47625685", "0.4746584", "0.47439465", "0.4715111", "0.4686464", "0.4686464", "0.4686464", "0.4683233", "0.4678822", "0.46785823", "0.4671277", "0.46690422", "0.46687272", "0.46681374", "0.46660107", "0.46545607", "0.4653029", "0.4624789", "0.46217602", "0.46217328", "0.46115693", "0.4609273", "0.4609273", "0.46071514", "0.4594105", "0.45916727", "0.45893145", "0.45860615", "0.4563368", "0.45571795", "0.45451275", "0.4544077", "0.4543633", "0.45346978", "0.4525456", "0.45233268", "0.45160618", "0.4506823", "0.45033428", "0.4502139", "0.44950902", "0.44911262", "0.4482276", "0.44795316", "0.4478962", "0.44711545", "0.4462045", "0.44591692", "0.4458134", "0.44499555", "0.4445137", "0.4443081", "0.4439188" ]
0.77669084
0
Generates pattern library pages. site The current Site instance. Returns nothing than an electric wind.
def generate(site) patterns = read_content(site, '', '_patterns', Pattern) site.pages << LibraryPage.new(site, 'pattern library', patterns) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(site)\n end", "def generate(site)\n site.data['pages'].each do |page|\n if !page['external']\n require 'cgi'\n\n page['name'] = CGI.escapeHTML(page['name']) if page['name']\n site.pages << SitePage.new(site, site.source, page)\n\n zones = {}\n keys = %w[content preferences]\n\n if page['block_instances'].length\n # create zone buckets\n page['block_instances'].each do |i|\n # go through all content\n if site.config.event?\n keys.each do |key|\n i[key].each do |k, v|\n if v.is_a?(String) && v.match(/\\{\\{/)\n # maintain the {{ t.foo }} variables\n v.gsub!(/(\\{\\{\\s*t\\.[a-z_.]+\\s*\\}\\})/, '{% raw %}\\1{% endraw %}')\n i[key][k] = Liquid::Template.parse(v).render('event' => site.data['event'], 'mappable' => site.data['mappable'])\n end\n end\n end\n end\n zones[i['zone']] = [] if zones[i['zone']].nil?\n zones[i['zone']] << i\n end\n\n # sort each bucket by widget weight\n zones.each do |k, zone|\n zone.sort! { |x, y| x['weight'] <=> y['weight'] }\n end\n\n page_source_path = File.join(site.source, page['slug'])\n FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)\n\n json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'\n\n File.open(File.join(page_source_path, json_filename), 'w') do |f|\n f.write zones.to_json\n f.close\n end\n\n site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)\n end\n end\n end\n end", "def generate(site)\n Jekyll.logger.info(\"Geolexica:\", \"Generating concept pages\")\n\n # Jekyll does not say why it's a good idea, and whether such approach\n # is thread-safe or not, but most plugins in the wild do exactly that,\n # including these authored by Jekyll team.\n @site = site\n @generated_pages = []\n\n make_pages\n sort_pages\n group_pages_in_collections\n end", "def generate(site)\n Joiner.join_data(site)\n CrossReferencer.build_xrefs(site.data)\n Canonicalizer.canonicalize_data(site.data)\n PrivateAssets.copy_to_site(site)\n Auth.generate_artifacts(site)\n Api.generate_api(site)\n\n Team.generate_pages(site)\n Locations.generate_pages(site)\n Projects.generate_pages(site)\n Departments.generate_pages(site)\n WorkingGroups.generate_pages(site)\n Snippets.generate_pages(site)\n Skills.generate_pages(site)\n end", "def generate(site)\n\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n\n index_files = site.config['page_gen-dirs'] == true\n\n # data contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n data = site.config['page_gen']\n types = site.config['data_types']\n if data\n data.each do |data_spec|\n # template = data_spec['template'] || data_spec['data']\n name = data_spec['name']\n # dir = data_spec['dir'] || data_spec['data']\n # Added 2 lines: Set context and type for JSON-LD \n context = data_spec['context'] || \"http://schema.org/\"\n # type = data_spec['type'] || \"Thing\"\n extension = data_spec['extension'] || \"html\"\n\n # records is the list of records defined in _data.yml\n # for which we want to generate different pages\n records = nil\n data_spec['data'].split('.').each do |level|\n if records.nil?\n records = site.data[level]\n else\n records = records[level]\n end\n end\n records.each do |record|\n # Added 3 lines: Add context and type for JSON-LD to each record\n collection = record[\"collection\"]\n dir = types[collection][\"dir\"] || collection\n template = types[collection][\"template\"]\n type = types[collection][\"type\"]\n record[\"@context\"] = context\n record[\"data\"][\"@type\"] = type\n record[\"data\"][\"name\"] = record[\"name\"]\n site.pages << DataPage.new(site, site.source, index_files, dir, record, name, template, extension)\n end\n end\n end\n end", "def template_page(site); end", "def generate(site)\n config = site.config.fetch('jekyll_rdf')\n\n graph = RDF::Graph.load(config['path'])\n sparql = SPARQL::Client.new(graph)\n\n # restrict RDF graph with restriction\n resources = extract_resources(config['restriction'], config['include_blank'], graph, sparql)\n\n site.data['sparql'] = sparql\n site.data['resources'] = []\n\n mapper = Jekyll::RdfTemplateMapper.new(config['template_mappings'], config['default_template'])\n\n # create RDF pages for each URI\n resources.each do |uri|\n resource = Jekyll::Drops::RdfResource.new(uri, graph)\n site.pages << RdfPageData.new(site, site.source, resource, mapper)\n end\n end", "def generate(site)\n # layout: tutorial_slides\n # layout: base_slides\n\n site.pages.select { |page| SLIDE_LAYOUTS.include? page.data['layout'] }.each do |page|\n dir = File.dirname(File.join('.', page.url))\n page2 = Jekyll::Page.new(site, site.source, dir, page.name)\n page2.data['layout'] = 'slides-plain'\n page2.basename = if page2.data.key?('lang')\n \"slides-plain_#{page2.data['lang'].upcase}\"\n else\n 'slides-plain'\n end\n page2.content = page2.content.gsub(/^name:\\s*([^ ]+)\\s*$/) do\n anchor = ::Regexp.last_match(1)\n\n \"<span id=\\\"#{anchor.strip}\\\"><i class=\\\"fas fa-link\\\" aria-hidden=\\\"true\\\"></i> #{anchor}</span>\"\n end\n if page2.data.key?('redirect_from')\n page2.data['redirect_from'].map { |x| x.gsub!(%r{/slides}, '/slides-plain') }\n end\n\n site.pages << page2\n end\n end", "def generate(site)\n site.pages.select{|x| x.data.key? 'redirects' }.each do |p|\n p.data['redirects'].each do |r|\n redirect = RedirectPage.new(site, site.source, r, p.url)\n redirect.render(site.layouts, site.site_payload)\n redirect.write(site.dest)\n site.pages << redirect\n end\n end\n end", "def generate\n # Ensure site is a directory\n FileUtils.mkdir_p site_path\n\n # If there is more than one language, then we need to create\n # multiple files, one for each language.\n if languages.size >= 1\n\n # Enter the most dastardly loop. \n # Create a View::Document with sections only containing the \n # specified language. \n languages.map do |language|\n document_views = documents.map do |document|\n document.sections = document.sections.map do |section|\n section.examples = section.examples.select {|ex| ex.language.blank? || ex.language == language }\n section\n end\n\n Views::Document.new document\n end\n\n # Use Mustache to create the file\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/#{language.underscore}.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # copy the default language to the index and were done!\n FileUtils.cp \"#{site_path}/#{default.underscore}.html\", \"#{site_path}/index.html\"\n\n # There are no languages specified, so we can just create one page\n # using a collection of Document::View.\n else \n document_views = documents.map do |document|\n Views::Document.new document\n end\n\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/index.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # Copy the logo if specified\n FileUtils.cp \"#{logo}\", \"#{site_path}/#{File.basename(logo)}\" if logo\n\n # Copy all the stylesheets into the static directory and that's it!\n resources_path = File.expand_path \"../resources\", __FILE__\n\n FileUtils.cp \"#{resources_path}/style.css\", \"#{site_path}/style.css\"\n FileUtils.cp \"#{resources_path}/syntax.css\", \"#{site_path}/syntax.css\"\n end", "def generate(site)\n\n # we only change link for pages that are from the wiki\n # our flag is the wiki menu be can also be the page path\n wiki_pages = site.pages.select{ |a| a.data['menu'] == 'wiki' }\n\n @conf = $wikiDatas['conf']\n\n wiki_pages.each do |p|\n\n jekyll_url = @conf['baseurl'] + '/' + @conf['wikiToJekyll']['wiki_dest'] + '/' + p.basename + '.html'\n\n $wikiDatas['pages'][p.basename] = {\n 'possible_uris' => get_possible_uris(p),\n 'jekyll_url' => jekyll_url\n }\n\n end\n end", "def generate(site)\n @site = site\n collections.each do |name, meta|\n Jekyll.logger.info \"Jekyll Feed:\", \"Generating feed for #{name}\"\n (meta[\"categories\"] + [nil]).each do |category|\n path = feed_path(:collection => name, :category => category)\n next if file_exists?(path)\n\n @site.pages << make_page(path, :collection => name, :category => category)\n end\n end\n generate_feed_by_tag if config[\"tags\"] && [email protected]?\n end", "def generate(site)\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n index_files = site.config['page_gen-dirs'] == true\n\n # data contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n data = site.config['page_gen']\n if data\n data.each do |data_spec|\n index_files_for_this_data = data_spec['index_files'] != nil ? data_spec['index_files'] : index_files\n template = data_spec['template'] || data_spec['data']\n name = data_spec['name']\n title = data_spec['title']\n dir = data_spec['dir'] || data_spec['data']\n extension = data_spec['extension'] || \"html\"\n\n if site.layouts.key? template\n # records is the list of records defined in _data.yml\n # for which we want to generate different pages\n records = nil\n data_spec['data'].split('.').each do |level|\n if records.nil?\n records = site.data[level]\n else\n records = records[level]\n end\n end\n\n # apply filtering conditions:\n # - filter requires the name of a boolean field\n # - filter_condition evals a ruby expression\n records = records.select { |r| r[data_spec['filter']] } if data_spec['filter']\n records = records.select { |record| eval(data_spec['filter_condition']) } if data_spec['filter_condition']\n\n records.each do |record|\n site.pages << DataPage.new(site, site.source, index_files_for_this_data, dir, record, name, title, template, extension, data_spec['defaults'])\n end\n else\n puts \"error (datapage_gen). could not find template #{template}\" if not site.layouts.key? template\n end\n end\n end\n end", "def generate(site)\n # page_gen_dirs determines whether we want to generate index pages\n # (name/index.html) or standard files (name.html). This information\n # is passed to the DataPage constructor, which sets the @dir variable\n # as required by this directive\n puts \"debug\"\n index_files = site.config['page_gen-dirs']\n index_files = true if index_files.nil?\n\n # config contains the specification of the data for which we want to generate\n # the pages (look at the README file for its specification)\n config = site.config['data_gen']\n\n # default configuration: get all data files, use the 'data_page.html' template,\n # output to /data\n path = nil\n template = 'data_page'\n dir = 'data'\n \n \n if config\n path = config['path'] || path\n template = config['template'] || template\n dir = config['dir'] || dir\n end\n\n if site.layouts.key? template\n data_files = path.nil? ? site.data : site.data[path]\n\n data_files.each do |name, record|\n site.pages << DataPage.new(site, site.source, index_files, dir, record, name, template, \"html\")\n end\n else\n puts \"DataPageGenerator error. could not find template #{template}\"\n end\n end", "def generate(site)\n puts \"Generating latest articles\" \n paginate(site)\n end", "def generate\n verify_path\n \n self.layouts.each {|layout| layout.write_file}\n self.pages.each {|page| page.write_file}\n \n Webby.site.content_dir = self.content_dir\n Webby.site.layout_dir = self.layout_dir\n Webby.site.template_dir = self.template_dir\n Webby.site.output_dir = self.output_dir\n \n Merb.logger.debug \"content_dir: #{Webby.site.content_dir}\"\n Merb.logger.debug \"layout_dir: #{Webby.site.layout_dir}\"\n Merb.logger.debug \"template_dir: #{Webby.site.template_dir}\"\n Merb.logger.debug \"output_dir: #{Webby.site.output_dir}\"\n \n # Use directory => '.' option to generate the site in output_dir\n Webby.site.page_defaults = {'layout' => self.default_layout.relative_path,\n 'directory' => '.',\n 'collision' => :force}\n \n Merb.logger.debug \"page_defaults: #{Webby.site.page_defaults}\" \n # returns nil if success \n # Webby::Builder.run\n Webby::Builder.run :rebuild => true\n end", "def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end", "def generate(site)\n puts 'Indexing pages...'\n \n # gather pages and posts\n items = site.pages.dup.concat(site.posts)\n\n # only process files that will be converted to .html and only non excluded files \n items = items.find_all {|i| i.output_ext == '.html' && ! @excludes.any? {|s| (i.absolute_url =~ Regexp.new(s)) != nil } } \n items.reject! {|i| i.data['exclude_from_search'] } \n \n # only process items that are changed since last regeneration\n items = items.find_all {|i| @last_indexed.nil? || File.mtime(i.full_path_to_source) > @last_indexed }\n\n # dont process index pages\n items.reject! {|i| i.is_a?(Jekyll::Page) && i.index? }\n\t\t\t \n while not @index.running?\n # wait for the indextank index to get ready\n sleep 0.5\n end\n \n items.each do |item| \n page_text = extract_text(site,item)\n\n @index.document(item.absolute_url).add({ \n :text => page_text,\n :title => item.data['title'] || item.name \n })\n puts 'Indexed ' << item.absolute_url\n end\n \n @last_indexed = Time.now\n write_last_indexed()\n \n puts 'Indexing done'\n end", "def generate(site)\n begin\n Dir.mkdir('scripts') unless Dir.exists?('scripts')\n Dir.mkdir('_data') unless Dir.exists?('_data')\n Dir.mkdir('_data/jailRoster') unless Dir.exists?('_data/jailRoster')\n rescue Exception => msg\n puts \"Error creating directories\"\n puts msg\n end\n\n begin\n # open('scripts/PrecinctInfo.js', 'w') do |file|\n # file << open('http://www.canyonco.org/CanyonCounty/Webparts/Elections/js/PrecinctInfo.js?v2').read\n # end\n\n open('_data/arrests.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/CurrentArrest').read\n end\n\n open('_data/jailList.json', 'w') do |file|\n file << open('http://api.canyonco.org/Sheriff/JailList').read\n end \n rescue Exception => msg\n puts \"Error downloading content\"\n puts msg\n end\n end", "def generate(site)\n site.pages.dup.each do |page|\n paginate(site, page) if Pager.pagination_enabled?(site.config, page.name)\n end\n end", "def generate_Genre_Pages\n template_doc = File.open(\"lib/templates/genre.html.erb\")\n template = ERB.new(template_doc.read)\n Genre.all.each do |genre|\n File.write(\"_site/genre/#{genre.url}\", template.result(binding))\n end\n end", "def generate_simple(site)\n lang = site.config['prime_lang'] || site.config['lang'] || 'en'\n Jekyll.logger.info \"Generating w/o multilang support for '#{lang}'\"\n\n prefix = [site.source, \"_langs\", lang, ''].join '/'\n allfiles = File.join prefix, '**', '*.*'\n\n Dir.glob(allfiles) do |source_file|\n file_name = File.basename source_file\n relative_dir = File.dirname source_file.sub(prefix, '')\n create_page(site, source_file, relative_dir, file_name, lang)\n end\n end", "def generate(site)\n puts '[GTN/Sitemap] Generating'\n result = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n result += '<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ' \\\n 'xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 ' \\\n 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" ' \\\n 'xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">'\n\n site.pages.reject { |t| t.path =~ /ipynb$/ }.each do |t|\n begin\n d = Gtn::ModificationTimes.obtain_time(t.path)\n d.format = '%FT%T%:z'\n formatted_date = d.to_s\n rescue StandardError\n d = Time.new\n formatted_date = d.strftime('%FT%T%:z')\n end\n\n result += \"<url><loc>#{site.config['url'] + site.config['baseurl'] + t.url}</loc>\" \\\n \"<lastmod>#{formatted_date}</lastmod></url>\"\n end\n result += '</urlset>'\n\n page2 = PageWithoutAFile.new(site, '', '.', 'sitemap.xml')\n page2.content = result\n site.pages << page2\n end", "def write_page_assets(site_dir)\n end", "def generate(site)\n @site = site\n @site.config[\"time\"] = Time.new\n unless feed_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << path\n end\n end", "def generate(site)\n # Configuration\n sitemap_config = site.config['sitemap'] || {}\n\n # create destination directory if it doesn't exist yet\n Dir::mkdir(site.dest) if !File.directory? site.dest\n $fileHtml = File.new(File.join(site.dest, FILE_NAME), \"w+\")\n\n $base = site.dest\n\n traverse(File.join(site.dest, \"/setups\"))\n\n $fileHtml.close()\n\n # Keep the file from being cleaned by Jekyll\n site.static_files << Jekyll::SitemapFile.new(site, site.dest, \"/\", FILE_NAME)\n\n FileUtils.cd('./include')\n FileUtils.cp File.join(site.dest, FILE_NAME), File.join(FileUtils.pwd(), \"scen.html\")\n end", "def add_to_site(site, path, content)\n page = ::Awestruct::Page.new(site,\n ::Awestruct::Handlers::LayoutHandler.new(site,\n ::Awestruct::Handlers::TiltHandler.new(site,\n ::Aweplug::Handlers::SyntheticHandler.new(site, content, path))))\n page.layout = @layout\n page.output_path = path\n site.pages << page\n page\n end", "def seed_cms_home\n seed_cms\n # we need to add extra pages for pa categories on the home page\n FactoryGirl.create(:cms_page, site: @site, layout: @layout, slug: 'marine-protected-areas')\n FactoryGirl.create(:cms_page, site: @site, layout: @layout, slug: 'green-list')\n # and the CTAs\n FactoryGirl.create(:cms_cta, css_class: 'api')\n FactoryGirl.create(:cms_cta, css_class: 'live-report')\n\n end", "def fake_site(page_count: nil)\n fake = Sitepress::FakeSiteGenerator.new\n begin\n fake.generate_pages(count: page_count) if page_count\n yield fake\n ensure\n fake.delete\n end\n end", "def fake_site(page_count: nil)\n fake = Sitepress::FakeSiteGenerator.new\n begin\n fake.generate_pages(count: page_count) if page_count\n yield fake\n ensure\n fake.delete\n end\n end", "def generate(site)\r\n if site.config['paginate_tag_basepath']\r\n posts_by_tag = get_posts_by_tag(site)\r\n \r\n site.pages << Index.new(site, site.source, posts_by_tag)\r\n \r\n posts_by_tag.each do |tag, posts|\r\n paginate_tag(site, tag, posts)\r\n end\r\n end\r\n end", "def generate(site)\n unnest_site_api_data(site)\n site.data['guest_users'] = []\n\n Joiner.join_data(site)\n # Auth.generate_artifacts(site)\n Team.generate_pages(site)\n WorkingGroups.generate_pages(site)\n Stats.assign_stats(site)\n end", "def generate_pages(count: , &block)\n dir = @dir.join(\"pages\")\n FileUtils.mkdir_p dir.join(\"pages\")\n next_page_name.take(count).map do |page_name|\n path = dir.join(page_name)\n block ? block.call(path) : File.write(path, '<h1>Some glorius content!</h1>')\n @pages.push path\n end\n end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "def initialize(site, name, patterns)\n @site = site\n @dir = ''\n @name = name\n @patterns = patterns\n\n self.basename = name.gsub(' ', '-')\n self.ext = '.html'\n self.data = {\n 'layout' => 'pattern_library',\n 'patterns' => patterns,\n 'sections' => pattern_attr_hash('section'),\n 'title' => name\n }\n end", "def generate(site)\n Jekyll.logger.info \"Lunr:\", 'Creating search index...'\n\n @site = site\n # gather pages and posts\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n template_docs = {}\n\n items.each_with_index do |item, i|\n entry = SearchEntry.create(item, content_renderer, @data_field_names)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file)\n\n index_doc = {\n 'id' => i,\n }\n @index_field_names.each do |fieldname|\n index_doc[fieldname] = entry.get_by_name(fieldname)\n end\n\n @js_lunr_builder.add(index_doc)\n\n template_doc = {\n 'id' => i,\n }\n @template_field_names.each do |fieldname|\n template_doc[fieldname] = entry.get_by_name(fieldname)\n end\n\n template_docs[i] = template_doc\n\n Jekyll.logger.debug \"Lunr:\", (entry.title ? \"#{entry.title} (#{entry.url})\" : entry.url)\n end\n\n FileUtils.mkdir_p(File.join(site.dest, @js_dir))\n filename = File.join(@js_dir, 'index.json')\n\n Jekyll.logger.debug 'Lunr:', \"created file #{filename}\"\n\n js_index = @js_lunr_builder.build().toJSON()\n\n total = {\n \"docs\" => template_docs,\n \"index\" => js_index.to_hash\n }\n\n filepath = File.join(site.dest, filename)\n File.open(filepath, \"w\") { |f| f.write(JSON.dump(total)) }\n Jekyll.logger.info \"Lunr:\", \"Index ready (lunr.js v#{@js_lunr.version})\"\n added_files = [filename]\n\n site_js = File.join(site.dest, @js_dir)\n # If we're using the gem, add the lunr and search JS files to the _site\n if File.expand_path(site_js) != File.dirname(@lunr_path)\n extras = Dir.glob(File.join(File.dirname(@lunr_path), \"*.min.js\"))\n FileUtils.cp(extras, site_js)\n extras.map! { |min| File.join(@js_dir, File.basename(min)) }\n Jekyll.logger.debug \"Lunr:\", \"Added JavaScript to #{@js_dir}\"\n added_files.push(*extras)\n end\n\n # Keep the written files from being cleaned by Jekyll\n added_files.each do |filename|\n site.static_files << SearchIndexFile.new(site, site.dest, \"/\", filename)\n end\n end", "def generate(site)\n\n @site = site\n index_dest = @site.instance_variable_get(:@dest)\n rebuild = @module_config['rebuild']\n index_file = index_dest + @module_config['index_file']\n\n if plugin_disabled?\n Jekyll.logger.info 'J1 Lunr:', 'disabled'\n return\n else\n Jekyll.logger.info 'J1 Lunr:', 'enabled'\n Jekyll.logger.info 'J1 Lunr:', 'generate search index'\n end\n\n if @module_config['rebuild'] == false\n if File.exist?(index_file)\n Jekyll.logger.info 'J1 Lunr:', 'rebuild index disabled'\n # Keep the index file from being cleaned by Jekyll\n #\n site.static_files << SearchIndexFile.new(site, site.dest, '/', @module_config['index_file'])\n return\n end\n end\n\n # gather posts and pages\n #\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n # index = []\n # rebuild = @module_config['rebuild']\n\n index_js = open(@lunr_path).read\n\n # NOTE: all settings must be added within the index function\n #\n index_js << 'var idx = lunr(function() {'\n\n @lunr_config['fields'].each_pair do |name, boost|\n index_js << \"this.field('#{name}', {'boost': #{boost}});\"\n end\n\n items.each_with_index do |item, i|\n entry = SearchEntry.create(item, content_renderer)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file)\n\n doc = {\n 'id' => i,\n 'title' => entry.title,\n 'tagline' => entry.tagline,\n 'url' => entry.url,\n 'date' => entry.date,\n 'tags' => entry.tags,\n 'categories' => entry.categories,\n 'description' => entry.description,\n 'is_post' => entry.is_post,\n 'body' => entry.body\n }\n\n # remove unwanted categories (if any)\n #\n doc['categories'] -= @strip_categories unless doc['categories'] == nil\n\n index_js << 'this.add(' << ::JSON.generate(doc, quirks_mode: true) << ');'\n\n # reduce the size of the doc array by deleting the body key\n #\n doc.delete('body')\n @docs[i] = doc\n\n end\n index_js << '});'\n\n filename = File.join(@index_dir, \"#{@index_name}\")\n ctx = ExecJS.compile(index_js)\n index = ctx.eval('JSON.stringify(idx)')\n\n total = {\n 'docs' => @docs,\n 'index' => ::JSON.parse(index, {:max_nesting => false})\n }\n filepath = File.join(site.dest, filename)\n\n # create data path if not already exists\n #\n FileUtils.mkdir_p(File.dirname(filepath))\n File.open(filepath, 'w') { |f| f.write(JSON.dump(total)) }\n# Jekyll.logger.info 'J1 Lunr:', \"finished, index ready.\"\n added_files = [filename]\n\n # Keep the written files from being cleaned by Jekyll\n #\n added_files.each do |fname|\n site.static_files << SearchIndexFile.new(site, site.dest, '/', fname)\n end\n end", "def pages; end", "def generate(site)\n if site.layouts.key? 'tag_index'\n dir = site.config['tag_dir'] || 'tag'\n ## Create Top level tag list /tag/index.html\n write_all_tags_index(site, dir, site.tags.keys.sort_by { |x| x.downcase } )\n \n ## Create /tag/{{tag}}/index.html\n site.tags.keys.each do |tag|\n write_tag_index(site, File.join(dir, tag.to_url), tag)\n end\n end\n end", "def generate(site)\n Jekyll.logger.info \"Lunr:\", 'Creating search index...'\n \n @site = site\n # gather pages and posts\n data = pages_to_index(site)\n items = data[:items]\n index = []\n \n index_js = open(@lunr_path).read\n index_js << 'var idx = lunr(function() {this.pipeline.remove(lunr.stemmer);this.searchPipeline.remove(lunr.stemmer);this.pipeline.remove(lunr.stopWordFilter);this.searchPipeline.remove(lunr.stopWordFilter);this.tokenizer.separator = /[\\s,.;:/?!()]+/;'\n @lunr_config['fields'].each_pair do |name, boost|\n index_js << \"this.field('#{name}', {'boost': #{boost}});\"\n end\n items.each_with_index do |item_data, i|\n doc = {}\n flat_data = {}\n item = item_data.to_liquid\n if item['recordstatus'] != 'inactive' or ENV['JEKYLL_ENV'] != 'production'\n @config[\"fields\"].each do |field|\n field[\"jekyllfields\"].each do |jekyllfield|\n widget = field['widget']\n orig_field = item[jekyllfield]\n if widget\n if widget == 'flatten' && orig_field\n orig_field = orig_field.values.flatten()\n end\n if widget == 'relational'\n if field['secondaryfield']\n orig_field = site.collections[field['collection']].docs.collect {|collection| collection[jekyllfield] if collection.to_liquid[field['matchfield']] and collection.to_liquid[field['matchfield']].map{ |i| i[field['secondaryfield']] }.include? item['slug'] }\n else\n orig_field = site.collections[field['collection']].docs.collect {|collection| collection[jekyllfield] if collection.to_liquid[field['matchfield']] and collection.to_liquid[field['matchfield']].include? item['slug'] }\n end\n end\n if widget == 'nested'\n if item[field[\"parentfield\"]]\n if item[field[\"parentfield\"]].class == Array\n orig_field = item[field[\"parentfield\"]].map {| parent | parent[jekyllfield]}\n else\n orig_field = item[field[\"parentfield\"]][jekyllfield]\n end\n end\n end\n if orig_field\n orig_field = orig_field.compact.uniq.flatten()\n orig_field = [].concat(orig_field)\n end\n flat_data[field[\"searchfield\"]] = flat_data[field[\"searchfield\"]] ? flat_data[field[\"searchfield\"]].concat(orig_field) : orig_field\n end\n format_field = orig_field.class == Array ? orig_field.compact.uniq.join(\" \") : orig_field\n if format_field != nil\n if doc[field[\"searchfield\"]] == nil\n doc[field[\"searchfield\"]] = format_field.strip()\n else\n doc[field[\"searchfield\"]] += \" \" + format_field.strip()\n end\n end\n end\n end\n doc['id'] = item['slug']\n index_js << 'this.add(' << ::JSON.generate(doc, quirks_mode: true) << ');'\n final_dict = item.to_hash\n final_dict['content'] = Nokogiri::HTML(Kramdown::Document.new(item.content).to_html).text.tr(\"\\n\",\" \")\n @docs[item[\"slug\"]] = final_dict.merge(flat_data)\n Jekyll.logger.debug \"Lunr:\", (item['title'] ? \"#{item['title']} (#{item['url']})\" : item['url'])\n end\n end\n index_js << '});'\n FileUtils.mkdir_p(File.join(site.dest, @js_dir))\n FileUtils.mkdir_p(File.join(site.dest, @css_dir))\n filename = File.join(@js_dir, 'index.js')\n \n ctx = ExecJS.compile(index_js)\n \n index = ctx.eval('JSON.stringify(idx)')\n total = \"var docs = #{@docs.to_json}\\nvar index = #{index.to_json}\\nvar baseurl = #{@jekyllconfig['baseurl'].to_json}\\nvar lunr_settings = #{@config.to_json}\"\n filepath = File.join(site.dest, filename)\n File.open(filepath, \"w\") { |f| f.write(total) }\n Jekyll.logger.info \"Lunr:\", \"Index ready (lunr.js v#{@lunr_version})\"\n added_files = [filename]\n \n site_js = File.join(site.dest, @js_dir)\n site_css = File.join(site.dest, @css_dir)\n \n # If we're using the gem, add the lunr and search JS files to the _site\n if File.expand_path(site_js) != File.dirname(@lunr_path)\n extras = Dir.glob(File.join(File.dirname(@lunr_path), \"*.js\"))\n if extras.length > 0\n FileUtils.cp(extras, site_js)\n extras.map! { |min| File.join(@js_dir, File.basename(min)) }\n Jekyll.logger.debug \"Lunr:\", \"Added JavaScript to #{@js_dir}\"\n added_files.push(*extras)\n end\n extrascss = Dir.glob(File.join(File.dirname(@lunr_path), \"*.css\"))\n if extrascss.length > 0\n FileUtils.cp(extrascss, site_css)\n extrascss.map! { |min| File.join(@css_dir, File.basename(min)) }\n Jekyll.logger.debug \"Lunr:\", \"Added CSS to #{@css_dir}\"\n added_files.push(*extrascss)\n end\n end\n \n # Keep the written files from being cleaned by Jekyll\n added_files.each do |filename|\n site.static_files << SearchIndexFile.new(site, site.dest, \"/\", filename)\n end\n end", "def generate(site)\n @site = site\n\n @mode = site.config['environment']\n @template = site.config['theme']\n\n @project_path = File.join(File.dirname(__FILE__)).sub('_plugins/seo', '')\n @module_data_path = File.join(File.join(@project_path, '_data'))\n @module_config_path = File.join(File.join(@module_data_path, 'plugins'))\n @module_template_path = File.join(File.join(@module_data_path, 'templates'))\n @module_config_default = YAML::load(File.open(File.join(@module_config_path, 'defaults', 'seo-tags.yml')))\n @module_config_user = YAML::load(File.open(File.join(@module_config_path, 'seo-tags.yml')))\n\n @module_config_default_settings = @module_config_default['defaults']\n @module_config_user_settings = @module_config_user['settings']\n @module_config = @module_config_default_settings.merge!(@module_config_user_settings)\n\n if plugin_disabled?\n Jekyll.logger.info \"J1 SEO Tags:\", \"disabled\"\n return\n else\n Jekyll.logger.info \"J1 SEO Tags:\", \"enabled\"\n Jekyll.logger.info \"J1 SEO Tags:\", \"generate seo tags\"\n end\n\n end", "def generate_Song_Pages\n template_doc = File.open(\"lib/templates/song.html.erb\")\n template = ERB.new(template_doc.read)\n Song.all.each do |song|\n File.write(\"_site/song/#{song.url}\", template.result(binding))\n end\n end", "def generate(site)\n paths = site.config['paginate_paths']\n if Pager.pagination_enabled?(site) && !paths.nil?\n paths.each do |path|\n site.config['paginate_path'] = path\n if template = template_page(site)\n paginate(site, template)\n else\n Jekyll.logger.warn \"Pagination:\", \"Pagination is enabled, but I couldn't find \" +\n \"an index.html page to use as the pagination template. Skipping pagination.\"\n end\n end\n end\n end", "def generate(site)\n return unless site.config['mini_magick'] && site.config['mini_magick_enabled']\n versions = site.config['mini_magick']['versions']\n\n site.config['mini_magick']['galleries'].each do |gallery|\n path = \"/Users/adam/code/blogs/adamfortuna.com-images/images/galleries/#{gallery}\"\n\n # Loop through all images in this gallery\n Dir.glob(File.join(path, \"*.{png,jpg,jpeg,gif,JPG}\")) do |source|\n versions.each_pair do |version, options|\n settings = options.clone\n settings['source'] = path\n settings['destination'] = File.join(path, version)\n\n if site.config['mini_magick_regererate'] || !File.exists?(File.join(path, version, File.basename(source)))\n site.static_files << GeneratedImageFile.new(site, path, settings['destination'], File.basename(source), settings)\n end\n end\n end\n end\n end", "def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end", "def package_docs(package_site)\n site_map.sites.each do |site|\n next if not package_site == '' and not package_site == site.id\n site.distros.each do |distro_id,branches|\n branches.each do |branch|\n src_dir = File.join(preview_dir,distro_id,branch.dir)\n tgt_tdir = branch.dir.split('/')\n tgt_tdir.pop\n tgt_dir = ''\n if tgt_tdir.length > 0\n tgt_dir = File.join(package_dir,site.id,tgt_tdir.join('/'))\n else\n tgt_dir = File.join(package_dir,site.id)\n end\n next if not File.directory?(src_dir)\n FileUtils.mkdir_p(tgt_dir)\n FileUtils.cp_r(src_dir,tgt_dir)\n end\n site_dir = File.join(package_dir,site.id)\n if File.directory?(site_dir)\n log_unknown(\"Packaging #{distro_id} for #{site.id} site.\")\n\n # Any files in the root of the docs repo with names ending in:\n # *-#{site}.html\n # will get copied into the root dir of the packaged site with\n # the site name stripped out.\n #\n # Example: for site name 'commercial', the files:\n # * index-commercial.html would end up as #{site_root}/index.html\n # * search-commercial.html would end up as #{site_root}/search.html\n # * index-community.html would be ignored\n site_files = Dir.glob(File.join(docs_root_dir, '*-' + site.id + '.html'))\n unless site_files.empty?\n site_files.each do |fpath|\n target_basename = File.basename(fpath).gsub(/-#{site.id}\\.html$/, '.html')\n FileUtils.cp(fpath,File.join(package_dir,site.id,target_basename))\n end\n else\n FileUtils.cp(File.join(preview_dir,distro_id,'index.html'),File.join(package_dir,site.id,'index.html'))\n end\n ['_images','_stylesheets'].each do |support_dir|\n FileUtils.cp_r(File.join(docs_root_dir,support_dir),File.join(package_dir,site.id,support_dir))\n end\n\n # Now build a sitemap\n site_dir_path = Pathname.new(site_dir)\n SitemapGenerator::Sitemap.create(\n :default_host => site.url,\n :public_path => site_dir_path,\n :compress => false,\n :filename => File.join(site_dir,'sitemap')\n ) do\n file_list = Find.find(site_dir).select{ |path| not path.nil? and path =~ /.*\\.html$/ }.map{ |path| '/' + Pathname.new(path).relative_path_from(site_dir_path).to_s }\n file_list.each do |file|\n add(file, :changefreq => 'daily')\n end\n end\n end\n end\n end\n end", "def generate(site)\n @gcallendar_config = site.config['gcalendar']\n raise 'Missing Google Calendar configuration in _config.yml' unless @gcallendar_config\n service = setup_calendar()\n site.data[\"calendars\"] = Hash.new\n @gcallendar_config['calendars'].each do |calendar|\n process_calendar(site, service, calendar['id'], calendar['look_ahead'], calendar['directory'], calendar['date_format'], calendar['layout'])\n end\n\n unless @gcallendar_config[\"event_list_name\"].nil?\n events = []\n unless site.data[\"calendars\"].nil?\n site.data[\"calendars\"].each do |calendar|\n events = events.concat(calendar[1])\n end\n events = get_google_calendar_events_by_date_offset(events,0,-1,1000)\n\n page_size = @gcallendar_config['event_list_per_page']\n pages = (events.length / page_size).ceil\n for i in 0..(pages-1)\n create_event_list_page(site, events.slice(i*page_size, page_size), @gcallendar_config['event_list_page_layout'], i+1, pages, events.length)\n end\n end\n end\n end", "def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.less$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << LessCssFile.new(site, site.source, destination, name)\n end\n end\n end", "def execute site\n if site.cache.nil?\n site.send('cache=', Aweplug::Cache::YamlFileCache.new)\n end\n searchisko = Aweplug::Helpers::Searchisko.new({:base_url => site.dcp_base_url, \n :authenticate => true, \n :searchisko_username => ENV['dcp_user'], \n :searchisko_password => ENV['dcp_password'], \n :cache => site.cache,\n :logger => site.log_faraday,\n :searchisko_warnings => site.searchisko_warnings})\n Find.find @directory do |path|\n Find.prune if File.directory?(path) && !@recurse_subdirectories\n\n next if File.directory?(path) # If it's a directory, start recursing\n\n Find.prune if File.extname(path) !~ /\\.a(scii)?doc/ || @additional_excludes.include?(File.basename path)\n\n # TODO: Skip adding the page to the site if it's already there\n\n page = site.engine.load_site_page path\n page.layout = @layout\n # TODO: Set the imagedir attribute for the page\n page.output_dir = File.join(@output_dir, File.basename(page.output_path, File.extname(page.output_path))).downcase\n page.output_path = File.join(page.output_dir, 'index.html')\n\n doc = Asciidoctor.load_file path\n metadata = {:author => doc.author, \n :commits => commit_info(@repo, path), \n :current_tag => current_tag(@repo, path),\n :current_branch => current_branch(@repo, path),\n :title => doc.doctitle, \n :tags => doc.attributes['tags'],\n :toc => doc.sections.inject([]) {|result, elm| result << {:id => elm.id, :text => elm.title}; result},\n :github_repo_url => repository_url(@repo),\n # Will need to strip html tags for summary\n :summary => doc.sections.first.blocks.first.content,\n :searchisko_type => 'jbossdeveloper_example',\n :searchisko_id => Digest::SHA1.hexdigest(doc.doctitle)[0..7],\n }\n\n site.pages << page\n\n searchisko_hash = {\n :sys_title => metadata[:title], \n :sys_description => metadata[:summary],\n :sys_content => doc.render, \n :sys_url_view => \"#{site.base_url}#{site.ctx_root.nil? ? '/' : '/' + site.ctx_root + '/'}#{page.output_dir}\",\n :contributors => metadata[:commits].collect { |c| c[:author_email] }.unshift(metadata[:author]).uniq,\n :sys_created => metadata[:commits].collect { |c| DateTime.parse c[:date] }.last,\n :sys_activity_dates => metadata[:commits].collect { |c| DateTime.parse c[:date] },\n } \n\n @additional_metadata_keys.inject(searchisko_hash) do |hash, key|\n hash[key.to_sym] = doc.attributes[key]\n hash\n end\n\n # unless !@push_to_searchisko || site.profile =~ /development/\n # searchisko.push_content(metadata[:searchisko_type],\n # metadata[:searchisko_id],\n # searchisko_hash.to_json)\n # end\n page.send('metadata=', metadata)\n end\n end", "def make_pages\n Dir.glob(concepts_glob).each do |concept_file_path|\n Jekyll.logger.debug(\"Geolexica:\",\n \"processing concept data #{concept_file_path}\")\n concept_hash = read_concept_file(concept_file_path)\n preprocess_concept_hash(concept_hash)\n add_page ConceptPage::HTML.new(site, concept_hash)\n add_page ConceptPage::JSON.new(site, concept_hash)\n add_page ConceptPage::JSONLD.new(site, concept_hash)\n add_page ConceptPage::Turtle.new(site, concept_hash)\n end\n end", "def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.coffee$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << CoffeeScriptFile.new(site, site.source, destination, name)\n end\n end\n end", "def site_populate\n # Get site\n site = Nanoc3::Site.new('.')\n data_source = site.data_sources[0]\n\n # Create home page\n data_source.create_item(\n DEFAULT_ITEM,\n { :title => \"Home\" },\n '/'\n )\n\n # Create stylesheet\n data_source.create_item(\n DEFAULT_STYLESHEET,\n {},\n '/stylesheet/'\n )\n\n # Create layout\n data_source.create_layout(\n DEFAULT_LAYOUT,\n {},\n '/default/'\n )\n\n # Create code\n FileUtils.mkdir_p('lib')\n File.open('lib/default.rb', 'w') do |io|\n io.write \"\\# All files in the 'lib' directory will be loaded\\n\"\n io.write \"\\# before nanoc starts compiling.\\n\"\n end\n end", "def generate(site)\n\n if site.data.has_key?('site_config')\n hash_to_hash(site.data['site_config'], site.config)\n end\n\n production = false\n if Jekyll.env == 'production'\n production = true\n end\n if site.config.has_key?('environment') && site.config['environment'] == 'production'\n production = true\n end\n\n if production && site.data.has_key?('site_config_prod')\n hash_to_hash(site.data['site_config_prod'], site.config)\n end\n\n # Look for environment variables for some settings.\n env_settings = [\n 'REPOSITORY_URL_SITE',\n ]\n env_settings.each do |setting|\n if ENV.has_key?(setting)\n site.config[setting.downcase] = ENV[setting]\n end\n end\n\n # Abort early if some required settings are not there.\n unless site.config.has_key?('languages') && site.config['languages'].length > 0\n opensdg_error('The \"languages\" site configuration must have at least one language. See the documentation here: https://open-sdg.readthedocs.io/en/latest/configuration/#languages')\n end\n\n # Hardcode some variables.\n site.config['disaggregation_status'] = {}\n site.config['disaggregation_status']['status_types'] = [\n {\n 'value' => 'complete',\n 'label' => 'status.disaggregation_status_complete',\n },\n {\n 'value' => 'inprogress',\n 'label' => 'status.disaggregation_status_inprogress',\n },\n {\n 'value' => 'notstarted',\n 'label' => 'status.disaggregation_status_notstarted',\n },\n {\n 'value' => 'notapplicable',\n 'label' => 'status.disaggregation_status_notapplicable',\n },\n ]\n\n # Provide some defaults.\n if !site.config.has_key?('time_series_attributes') or site.config['time_series_attributes'].length == 0\n site.config['time_series_attributes'] = [\n {\n 'field' => 'COMMENT_TS',\n 'label' => 'indicator.footnote',\n },\n {\n 'field' => 'DATA_LAST_UPDATE',\n 'label' => 'metadata_fields.national_data_update_url'\n },\n ]\n end\n end", "def generate(site)\r\n # Configuration\r\n prefixbox_config = site.config['prefixbox'] || {}\r\n @config = {}\r\n @config['filename'] = prefixbox_config['filename'] || PREFIXBOX_FILE_NAME\r\n @config['exclude'] = prefixbox_config['exclude'] || EXCLUDE\r\n @config['include_posts'] = prefixbox_config['include_posts'] || INCLUDE_POSTS\r\n\r\n # Create destination directory if it doesn't exist yet. Otherwise, we cannot write our file there.\r\n Dir::mkdir(site.dest) if !File.directory? site.dest\r\n \r\n # Create the file name and paths\r\n filename = @config['filename']\r\n \r\n # Write all the data to the file and close it\r\n CSV.open(File.join(site.dest, filename), \"wb\") do |csv|\r\n fill_posts(site, csv)\r\n #fill_pages(site, csv)\r\n end\r\n \r\n # Keep the prefixbox.csv file from being cleaned by Jekyll\r\n site.static_files << Jekyll::PrefixboxFile.new(site, site.dest, \"/\", filename)\r\n end", "def render_pages(static_path)\n puts \" Rendering pages\"\n Page.all.each do |p|\n if p.published? && (body = p.render)\n dir, filename = p.url, \"index.html\"\n dir, filename = p.parent.url, p.slug if p.slug =~ /\\.[^.]+$/i # File with extension (e.g. styles.css)\n FileUtils.mkdir_p(File.join(static_path, dir))\n File.open(File.join(static_path, dir, filename), 'w') { |io| io.print(body) }\n else\n puts \" ! Not rendering #{p.id} - #{p.status.name} - #{p.url}\"\n end\n end\nend", "def generate(site)\n puts \"Generating sitemap...\"\n @site = site\n @site.config[\"time\"] = Time.new\n @site.config[\"html_files\"] = html_files.map(&:to_liquid)\n unless sitemap_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << \"sitemap.xml\"\n end\n end", "def execute site\n if site.cache.nil?\n site.send('cache=', Aweplug::Cache::YamlFileCache.new)\n end\n Parallel.each(Dir[\"#{@repo}/*/README.md\"], in_threads: 40) do |file|\n next if @excludes.include?(File.dirname(file))\n\n # Skip if the site already has this page\n output_path = File.join @output_dir, Pathname.new(file).relative_path_from(Pathname.new @repo).dirname, 'index.html' \n next if site.pages.find {|p| p.output_path == output_path}\n\n page = add_to_site site, file\n\n metadata = extract_metadata(file)\n converted_html = metadata.delete :converted\n\n if metadata[:author]\n metadata[:author].split(',').each_with_index do |author, i|\n metadata[:author] = author if i == 0\n metadata[:contributors] << author unless i == 0\n end\n end\n\n unless metadata[:images].empty?\n metadata[:images].each do |img|\n image_path = Pathname.new(@repo).join(img) \n add_image_to_site(site, image_path) if File.exist? image_path\n end\n end \n page.send 'metadata=', metadata\n\n # unless site.profile =~ /development/ || !@push_to_searchisko\n # puts \"::DEBUG:: #{@push_to_searchisko} ::DEBUG::\"\n # send_to_searchisko(metadata, page, site, converted_html)\n # end\n\n if site.dev_mat_techs.nil?\n site.send('dev_mat_techs=', []);\n end\n site.dev_mat_techs << metadata[:technologies].flatten\n end\n\n add_main_readme(site) \n add_contributing(site)\n end", "def generate!\n controllers = (Rails.application.routes.routes.map do |route|\n controller_name = \"#{route.requirements[:controller].camelize}Controller\"\n ActiveSupport::Dependencies.ref(controller_name).get\n end).insert(0, ApplicationController).uniq\n\n valid_controllers = valid_controllers()\n valid_locales = valid_locales()\n\n controllers.each do |controller|\n controller_path = controller.controller_path\n if controller.respond_to?(:managable_content_for) && valid_controllers.include?(controller_path)\n Page.transaction do\n valid_locales.each do |locale|\n # Create Page if it does not exist yet\n page = Page.where(:controller_path => controller_path, :locale => locale).first || Page.new()\n if page.new_record?\n page.controller_path = controller_path\n page.locale = locale\n page.save!\n end\n\n # Create PageContent if it does not exist yet\n contents = (controller == ApplicationController) ? controller.managable_layout_content_for : controller.managable_content_for\n contents.each do |key|\n if page.page_contents.where(:key => key).first.nil?\n page_content = page.page_contents.build\n page_content.key = key\n page_content.save!\n end\n end\n end\n end\n end\n end\n end", "def generate(site)\n json = {}\n blog = generate_blog(site)\n json.merge!(blog)\n json[:static_files] = generate_static_files(site)\n json[:projects] = generate_projects(site)\n json[:games] = generate_games(site)\n write_file(json)\n end", "def generate(site)\n\n # Abort if some configurations from 1.x are still being used.\n if (site.config.has_key?('metadata_tabs') && site.config['metadata_tabs'].is_a?(Hash))\n opensdg_error('The metadata_tabs setting is not in the correct format. Please consult the latest documentation: https://open-sdg.readthedocs.io/en/latest/configuration/#metadata_tabs')\n end\n\n # Handle legacy treatment of reporting status types.\n unless (site.config.has_key?('reporting_status') &&\n site.config['reporting_status'].has_key?('status_types') &&\n site.config['reporting_status']['status_types'].count > 0)\n reporting_status = site.data['schema'].detect {|f| f['name'] == 'reporting_status' }\n reporting_status_types = reporting_status['field']['options']\n unless site.config.has_key?('reporting_status')\n site.config['reporting_status'] = {}\n end\n site.config['reporting_status']['status_types'] = reporting_status_types.map do |status_type|\n {\n 'value' => status_type['value'],\n 'label' => status_type['translation_key'],\n }\n end\n end\n\n # Also fill in the \"reporting\" data with things needed by older templates.\n add_translation_keys(site.data['reporting']['statuses'], site)\n add_translation_keys(site.data['reporting']['overall']['statuses'], site)\n\n if site.data['reporting'].has_key?('extra_fields')\n site.data['reporting']['extra_fields'].each do |key, extra_field|\n extra_field.each do |extra_field_value|\n add_translation_keys(extra_field_value['statuses'], site)\n end\n end\n end\n\n if site.data['reporting'].has_key?('goals')\n site.data['reporting']['goals'].each do |goal|\n add_translation_keys(goal['statuses'], site)\n end\n end\n end", "def prepare_site(user, site=nil)\n\n children = Array.new\n site_prefix = site ? site.name + '/' : ''\n\n # Pages\n\n Page.current_site = site if site\n children << Radiant::RadiantPageResource.new(\"#{site_prefix}Pages\", Page.find_by_url('/'))\n\n # Snippets\n\n children << RadiantDirectoryResource.new(\"#{site_prefix}Snippets\") do\n Snippet.find(:all).map {|snippet| Radiant::RadiantSnippetResource.new(site_prefix, snippet) }\n end if user.developer? || user.admin?\n\n # Layouts\n\n children << RadiantDirectoryResource.new(\"#{site_prefix}Layouts\") do\n Layout.find(:all).map {|layout| Radiant::RadiantLayoutResource.new(site_prefix, layout) }\n end if user.developer? || user.admin?\n\n # SnS Extension\n\n if Object.const_defined?(:SnsExtension)\n\n # JavaScripts\n\n children << RadiantDirectoryResource.new(\"#{site_prefix}Javascripts\") do\n Javascript.find(:all).map {|javascript| Sns::RadiantJavascriptResource.new(site_prefix, javascript) }\n end if user.developer? || user.admin?\n\n # Stylesheets\n\n children << RadiantDirectoryResource.new(\"#{site_prefix}Stylesheets\") do\n Stylesheet.find(:all).map {|stylesheet| Sns::RadiantStylesheetResource.new(site_prefix, stylesheet) }\n end if user.developer? || user.admin?\n\n end\n\n # Paperclipped Extension\n\n if Object.const_defined?(:PaperclippedExtension)\n children << RadiantDirectoryResource.new(\"#{site_prefix}Assets\") do\n Asset.find(:all).map {|asset| Paperclipped::RadiantAssetResource.new(site_prefix, asset) }\n end\n end\n\n # Gallery Extension from local file system only\n\n if Object.const_defined?(:GalleryExtension) && !Radiant::Config[\"gallery.storage\"].eql?(\"s3\")\n children << RadiantDirectoryResource.new(\"#{site_prefix}Galleries\") do\n Gallery.find_all_by_parent_id(nil).map {|gallery| Gallery::RadiantGalleryResource.new(\"#{site_prefix}Galleries\", gallery) }\n end\n end\n\n children\n end", "def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end", "def pages\n plantuml_files.map { |static_file| page_from_static_file(static_file) }\n end", "def sample_page\n\n end", "def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end" ]
[ "0.65836114", "0.65413934", "0.6440137", "0.6429966", "0.63806367", "0.6363609", "0.62894857", "0.62356853", "0.62140375", "0.61636025", "0.6128852", "0.60038644", "0.595365", "0.5952468", "0.5946774", "0.59301496", "0.5863687", "0.58497137", "0.5801128", "0.5790571", "0.574698", "0.5743237", "0.5665288", "0.5625338", "0.55779946", "0.5535422", "0.5534483", "0.5468326", "0.54586667", "0.54586667", "0.54550874", "0.5451946", "0.54487693", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.54357564", "0.5418094", "0.54179114", "0.54108584", "0.54074913", "0.5393099", "0.5391963", "0.5385948", "0.5331663", "0.532387", "0.5318716", "0.5308557", "0.5294733", "0.52930725", "0.52773947", "0.5275818", "0.52674824", "0.5256519", "0.5236293", "0.5236192", "0.5223396", "0.52215517", "0.52021575", "0.5193237", "0.51873964", "0.5184676", "0.5164467", "0.51634127", "0.5163088", "0.5136536", "0.512755", "0.5117246", "0.5116696", "0.5116696", "0.5116696", "0.5116696", "0.5116696", "0.5116696", "0.5116696", "0.5116696", "0.5116696" ]
0.80189425
0
Read all files in // and create a new object of the given class with each one site The current Site instance. dir The String path to the parent directory after the site.source. name The String filename. klass The Class used to represent files in the directory Returns an Array of the given class objects
def read_content(site, dir, magic_dir, klass) site.get_entries(dir, magic_dir).map do |entry| klass.new(site, site.source, dir, entry) if klass.valid?(entry) end.reject do |entry| entry.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_objects(dir_name, kind, klass)\n files(dir_name).map do |filename|\n # Read and parse data\n meta, content = *parse_file(filename, kind)\n\n # Get attributes\n attributes = {\n :filename => filename,\n :extension => File.extname(filename)[1..-1],\n :file => Nanoc3::Extra::FileProxy.new(filename)\n }.merge(meta)\n\n # Get actual identifier\n identifier = filename_to_identifier(filename, dir_name)\n\n # Get mtime\n mtime = File.stat(filename).mtime\n\n # Build item\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def load_objects(dir_name, klass)\n all_base_filenames_in(dir_name).map do |base_filename|\n load_object(dir_name, base_filename, klass)\n end\n end", "def generate_all_classes(site)\n puts \"222222222222222222222222222222222222222222222222222222222222\"\n if Dir.exists?('src/_classes')\n puts \"3333333333\"\n Dir.chdir('src/_classes')\n\n Dir[\"*.yml\"].each do |path|\n puts \"444444444 \" + path\n name = File.basename(path, '.yml')\n self.generate_class_index(site, site.source, \"/pages/classes/\" + name, name, 'el')\n self.generate_class_index(site, site.source, \"/en/pages/classes/\" + name, name, 'en')\n end\n\n Dir.chdir(site.source)\n self.generate_all_classes_index(site)\n end\n end", "def files_for(klass); end", "def create_from_files_in(base, klass)\n all_files_in(base).map do |base_filename, (meta_ext, content_ext)|\n # Get filenames\n meta_filename = meta_ext ? base_filename + '.' + meta_ext : nil\n content_filename = content_ext ? base_filename + '.' + content_ext : nil\n\n # Get meta and content\n meta = (meta_filename ? YAML.load_file(meta_filename) : nil) || {}\n content = (content_filename ? File.read(content_filename) : nil) || ''\n\n # Get attributes\n attributes = {}\n attributes[:file] = Nanoc3::Extra::FileProxy.new(content_filename) if content_filename\n attributes[:extension] = File.extname(content_filename)[1..-1] if content_filename\n attributes.merge!(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(base.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(base.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def load_data folder, klass\n\tDir.entries(\"data/#{folder}\").each do |e|\n\t\tnext unless e =~ /^(\\w[\\w\\d]+)\\.rb$/i\n\n\t\tname = $1\n\t\tname[0] = name[0].upcase\n\n\t\tObject.__send__(:eval,\n\t\t\t\t\"class #{name} < #{klass}\\r\\n\" + \n\t\t\t\t\tFile.read(\"data/#{folder}/#{e}\") +\n\t\t\t\t\"\\r\\nend\"\n\t\t)\n\tend\nend", "def load_objects(dir_name, kind, klass)\n all_split_files_in(dir_name).map do |base_filename, (meta_ext, content_ext, locales)|\n I18n.locale = I18n.default_locale # Set current locale to default\n\n # Get filenames\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # is binary content?\n is_binary = !!(content_filename && [email protected][:text_extensions].include?(File.extname(content_filename)[1..-1]))\n\n # Read content and metadata\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # Is locale content?\n # - excluded content with locale meta IS a locale content\n # - excluded content without locale meta IS NOT locale content\n # - included content with or without locale meta IS locale content\n # - included content with locale meta set to `false` IS NOT locale\n # content\n is_locale = !!(meta['locale'] || (meta['locale'] != false && locale_content?(content_filename || meta_filename, kind)))\n\n # Create one item by locale, if content don't need a localized version,\n # use default locale\n (is_locale ? I18n.available_locales : [I18n.default_locale]).map do |locale|\n I18n.locale = locale # Set current locale\n\n # Process for localized files\n if is_locale\n # Get filenames for localized content\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # Read content and metadata for localized content\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # merge meta for current locale, default locale meta used by\n # default is meta don't have key\n meta_locale = meta.delete('locale') {|el| Hash.new }\n meta = (meta_locale[I18n.default_locale] || Hash.new).merge(meta)\n meta.merge!(meta_locale[locale.to_s] || Hash.new)\n end\n\n # Get attributes\n attributes = {\n :filename => content_filename,\n :content_filename => content_filename,\n :meta_filename => meta_filename,\n :extension => content_filename ? ext_of(content_filename)[1..-1] : nil,\n :locale => locale,\n # WARNING :file is deprecated; please create a File object manually\n # using the :content_filename or :meta_filename attributes.\n # TODO [in nanoc 4.0] remove me\n :file => content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil\n }.merge(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(dir_name.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(dir_name.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n # Prepend locale code to identifier if content is localized\n identifier = \"/#{locale}#{identifier}\" if is_locale\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(\n content_or_filename, attributes, identifier,\n :binary => is_binary, :mtime => mtime\n )\n end\n end.flatten # elements is an array with all locale item, flatten in to one items list\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 generate_class_files\n debug_msg \"Generating class documentation in #@outputdir\"\n templatefile = Pathname.new(File.dirname(__FILE__) + '/template/railsfish/classpage.rhtml')\n \n @classes.each do |klass|\n debug_msg \" working on %s (%s)\" % [ klass.full_name, klass.path ]\n outfile = @outputdir + klass.path\n rel_prefix = @outputdir.relative_path_from( outfile.dirname )\n svninfo = self.get_svninfo( klass )\n \n debug_msg \" rendering #{outfile}\"\n self.render_template( templatefile, binding(), outfile )\n end\n end", "def classes()\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 |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend", "def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end", "def generate_class_index(site, base, dir, path, lang)\n # puts \"666666666666666666666666666666666666666666666666 base \" + base\n # puts \"666666666666666666666666666666666666666666666666 dir \" + dir\n # puts \"666666666666666666666666666666666666666666666666 path \" + path\n cLaSs = ClassIndex.new(site, base, dir, path, lang)\n if cLaSs.data['active']\n # puts \"77777777777777777777777777777777777777777777777777777777\"\n cLaSs.render(site.layouts, site.site_payload)\n cLaSs.write(site.dest)\n\n site.pages << cLaSs\n site.static_files << cLaSs\n end\n\n end", "def load_class(paths)\n\n @src_dirs.each do |d|\n\n paths.each do |path|\n\n uri = d.chomp + \"/\" + path.chomp\n as_uri = \"#{uri}.as\"\n\n if @loaded_documents.include?(as_uri)\n log_append(\"Already added #{as_uri}\")\n return nil\n end\n\n #FIX: The assumption that we'll only find one match.\n if File.exists?(as_uri)\n\n @loaded_documents << as_uri\n f = File.open(as_uri,\"r\" ).read.strip\n f = load_includes(f,as_uri)\n return strip_comments(f)\n\n #where we find a mxml file exit and tell the user why.\n elsif File.exists?(\"#{uri}.mxml\")\n\n mxml_file = File.basename(\"#{uri}.mxml\")\n log_append(\"Failing with '#{mxml_file}' as we need an mxml parser first - anyone?\")\n @exit_message = \"WARNING: #{mxml_file} couldn't be loaded (mxml files are not yet supported).\"\n return nil\n\n end\n\n end\n\n end\n\n as_file = File.basename(paths[0])\n\n @exit_message = \"WARNING: Completions incomplete.\\nThe class #{as_file} was not found.\"\n\n log_append(\"Unable to load '#{as_file}'\")\n\n nil\n end", "def load_dir(dir)\n logger.debug { \"Loading the class definitions in #{dir}...\" }\n # Import the classes.\n srcs = sources(dir)\n # Introspect and load the classes in reverse class order, i.e. superclass before subclass.\n klasses = srcs.keys.transitive_closure { |k| [k.superclass] }.select { |k| srcs[k] }.reverse\n # Introspect the classes as necessary.\n klasses.each { |klass| add_metadata(klass) unless introspected?(klass) }\n # Load the classes.\n klasses.each do |klass|\n file = srcs[klass]\n load_definition(klass, file)\n end\n logger.debug { \"Loaded the class definitions in #{dir}.\" }\n end", "def parse_file(file_class)\n lines = []\n while line = @file_desc.gets\n lines << file_class.parse_line(line)\n end\n lines\n end", "def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n dot_dirs = []\n dot_pages = []\n dot_static_files = []\n\n dot = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n dot.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n dot_dirs << entry\n elsif Utils.has_yaml_header?(file_path)\n dot_pages << entry\n else\n dot_static_files << entry\n end\n end\n\n retrieve_posts(dir)\n retrieve_dirs(base, dir, dot_dirs)\n retrieve_pages(dir, dot_pages)\n retrieve_static_files(dir, dot_static_files)\n end", "def match_classes(fullpath)\n Dir.foreach(fullpath) do |patternfile|\n filepath = \"#{fullpath}/#{patternfile}\"\n next unless File.file?(filepath) and\n File.readable?(filepath)\n next if patternfile =~ /^\\./\n log(\"Attempting to match [#{@hostname}] in [#{filepath}]\")\n if matched_in_patternfile?(filepath,@hostname)\n @classes << patternfile.to_s\n log(\"Appended #{patternfile} to classes instance variable\")\n end\n end\n end", "def find_all\n Dir[\"#{pages_dir}**/*.yml\"].map {|f| new f }\n end", "def read_directories(dir = \"\")\n base = site.in_source_dir(dir)\n\n return unless File.directory?(base)\n\n entries_dirs = []\n entries_pages = []\n entries_static_files = []\n\n entries = Dir.chdir(base) { filter_entries(Dir.entries(\".\"), base) }\n entries.each do |entry|\n file_path = @site.in_source_dir(base, entry)\n if File.directory?(file_path)\n entries_dirs << entry\n elsif Utils.has_yaml_header?(file_path) || Utils.has_rbfm_header?(file_path)\n entries_pages << entry\n else\n entries_static_files << entry\n end\n end\n\n retrieve_dirs(dir, entries_dirs)\n retrieve_pages(dir, entries_pages)\n retrieve_static_files(dir, entries_static_files)\n end", "def split() File.split(@path).map {|f| self.class.new(f) } end", "def files; entries.find_all {|e| e.is_a? SiteFile} end", "def generate_class_files\n setup\n\n template_file = @template_dir + 'class.rhtml'\n template_file = @template_dir + 'classpage.rhtml' unless\n template_file.exist?\n return unless template_file.exist?\n debug_msg \"Generating class documentation in #{@outputdir}\"\n\n current = nil\n\n @classes.each do |klass|\n current = klass\n\n generate_class klass, template_file\n end\n rescue => e\n error = RDoc::Error.new \\\n \"error generating #{current.path}: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end", "def create_dirs(klass)\n class << klass\n Array(yield).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir,dir)\n end\n module_eval(%Q(def #{dir}_require(&block); lib_require('#{dir}', &block); end))\n end\n end\n end", "def build_cls_list(file_name, arr)\n file = File.open(file_name, \"r\")\n while !file.eof?\n line = file.readline.chomp\n arr.push(line)\n end\n file.close\nend", "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 initialize(site, base, dir, name)\n @config = Tenji::Config\n @gallery_name = pathify(dir).name\n\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = File.join(base, dir, name)\n\n process_dir config.dir(:thumbs),\n config.dir(:galleries, :out), \n gallery_name,\n File.join(output_gallery_name, config.dir(:thumbs, :out))\n\n @relative_path = File.join(@dir, output_name)\n @extname = File.extname(@name)\n @data = @site.frontmatter_defaults.all(relative_path, type)\n end", "def read_posts(dir); end", "def all\n Dir.chdir(content_dir) do\n files = Dir.glob(File.join(\"**\", \"*#{SOURCE_FILE_EXT}\")).delete_if {|p| p =~ Regexp.new(\"\\\\.[0-9]+\\\\#{SOURCE_FILE_EXT}$\")}\n files.collect {|f| Page.new(uri_from_path(f), File.open(f, 'r') {|b| b.read})}\n end\n end", "def retrieve_posts(dir); end", "def initialize(filepath)\n @path = filepath\n @@files_array << self\n self.files\n end", "def read_data\n @files.each do |file|\n @source.location = file[:location]\n instance_variable_set('@' + file[:var].to_s,\n @source.send(file[:method], file[:klass]))\n end\n end", "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 get_students_loop(class_filepath)\n\n students = Dir.entries(class_filepath)\n students = students[2..students.length - 1]\n\n return students\n\nend", "def extract_class(f)\n pat = Regexp.new('^\\s*classdef\\s+([^\\s]*)\\s*<\\s*([^\\s]*)')\n File.open(f) do |file|\n file.each_line do |l|\n if l =~ pat \n c = $1\n b = $2\n add_to_tree(c, b)\n break\n end\n end\n end\nend", "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n EarLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "def read_collection\n @@book_class = []\n lines = File.readlines('collection.txt')\n lines.each do| line |\n line_parts = line.split('/')\n @id = id+1\n title = line_parts[0].chomp\n author = line_parts[1].chomp\n @due_date = due_date = nil.to_i\n @@book_class << Book.new(id, title, author, due_date) #class implementation\n end\n end", "def initialize(dir)\n\t\t@dir = dir\n\tend", "def initialize(dir)\n\t\t@dir = dir\n\tend", "def analyze(dir)\n parser = RubyParser.new\n paths = ProjectScanner.scan(dir)\n paths.each do |path|\n @current_path = path\n ast = parser.process(File.binread(path), path)\n process ast\n @current_class = Class.new(:none)\n end\n\n @classes.each {|klass| klass.lines = count_lines_in_class(klass)}\n prune_dependencies\n\n return @classes, @methods, @smells\n end", "def read_posts(dir)\n base = File.join(self.source, dir, '_posts')\n entries = []\n Dir.chdir(base) { entries = filter_entries(Dir['**/*']) }\n\n # first pass processes, but does not yet render post content\n entries.each do |f|\n if Post.valid?(f)\n post = Post.new(self.source, dir, f)\n\n if post.published\n self.posts << post\n post.categories.each { |c| self.categories[c] << post }\n end\n end\n end\n\n self.posts.sort!\n \n # second pass renders each post now that full site payload is available\n self.posts.each_with_index do |post, idx|\n post.numericid = idx+1\n\tpost.previous = posts[idx - 1] unless idx - 1 < 0\n post.next = posts[idx + 1] unless idx + 1 >= posts.size\n post.render(self.layouts, site_payload)\n end\n \n self.categories.values.map { |cats| cats.sort! { |a, b| b <=> a} }\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def generate_class_files( options, files, classes )\n\t\tdebug_msg \"Generating class documentation in #@outputdir\"\n\t\ttemplatefile = @template_dir + 'classpage.rhtml'\n\t\toutputdir = @outputdir\n\n\t\tmodsort = self.get_sorted_module_list( classes )\n\n\t\tclasses.sort_by {|k,v| k }.each do |classname, classinfo|\n\t\t\tdebug_msg \" working on %s (%s)\" % [ classname, classinfo[:outfile] ]\n\t\t\toutfile = outputdir + classinfo[:outfile]\n\t\t\trel_prefix = outputdir.relative_path_from( outfile.dirname )\n\t\t\tsvninfo = self.get_svninfo( classinfo )\n\n\t\t\tdebug_msg \" rendering #{outfile}\"\n\t\t\tself.render_template( templatefile, binding(), outfile )\n\t\tend\n\tend", "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n TapirLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "def retrieve_static_files(dir, files)\n site.static_files.concat(\n files.map do |file|\n StaticFile.new(site, site.source, dir, file)\n end\n )\n end", "def parse_class(klass, path)\n methods = find_class_methods(klass)\n elements = parse_methods(methods, path)\n end", "def initialize(dir)\n @dir = dir\n end", "def process( *args )\n if args.count == 0\n $stderr.puts \"ClassList V#{VERSION} - crudely find all the Ruby classes defined in a set of files or directories\"\n $stderr.puts \n $stderr.puts \" Usage: classlist file1.rb file2.rb dir1 dir2 ...\"\n exit 1\n end\n args.each do |arg|\n if Dir.exist?(arg)\n process_dir(arg)\n elsif File.exist?(arg)\n process_file(arg)\n else\n $stderr.puts \"Path #{arg} does not found\"\n exit 1\n end\n end\n self\n end", "def path_list(doc, reference, word)\n reset\n #Where the word and ref don't match and it\n #looks like a Class name switch to it.\n if reference != word\n if word =~ /^[A-Z]/\n reference = word\n end\n end\n\n type = find_type(doc, reference)\n\n return [] unless type\n\n paths = imported_class_to_file_path(doc, type)\n\n #If we searched any superclasses their paths have been stored\n @loaded_documents.each { |path|\n f = File.open(path,\"r\" ).read.strip\n paths << imported_class_to_file_path(strip_comments(f), type)\n }\n\n create_src_list()\n existing_paths = []\n\n @src_dirs.each do |d|\n\n paths.flatten.uniq.each do |path|\n\n uri = d.chomp + \"/\" + path.chomp\n as = \"#{uri}.as\"\n mx = \"#{uri}.mxml\"\n\n if File.exists?(as)\n existing_paths << as\n elsif File.exists?(mx)\n existing_paths << mx\n end\n\n end\n\n end\n\n return { :paths => existing_paths.uniq, :type => type }\n\n end", "def initialize(*sources)\n @sources = sources\n\n @list = []\n\n sources.each do |source|\n if File.file?(source)\n parse(source)\n else\n # ignore directories\n end\n end\n end", "def generate_class_files( options, files, classes )\n\t\tdebug_msg \"Generating class documentation in #@outputdir\"\n\t\ttemplatefile = @template_dir + 'classpage.rhtml'\n\t\toutputdir = @outputdir\n\n\t\tmodsort = self.get_sorted_module_list( classes )\n\n\t\tclasses.sort_by {|k,v| k }.each do |classname, classinfo|\n\t\t\tdebug_msg \" working on %s (%s)\" % [ classname, classinfo[:outfile] ]\n\t\t\toutfile = outputdir + classinfo[:outfile]\n\t\t\trel_prefix = outputdir.relative_path_from( outfile.dirname )\n\t\t\tsvninfo = self.get_svninfo( classinfo )\n\n\t\t\tself.render_template( templatefile, binding(), outfile )\n\t\tend\n\tend", "def read_posts(dir)\n base = File.join(self.source, dir, '_posts')\n \n entries = []\n Dir.chdir(base) { entries = Dir['**/*'] }\n entries = entries.reject { |e| e[-1..-1] == '~' }\n entries = entries.reject { |e| File.directory?(File.join(base, e)) }\n\n # first pass processes, but does not yet render post content\n entries.each do |f|\n if Post.valid?(f)\n post = Post.new(self.source, dir, f)\n self.posts << post\n end\n end\n \n # second pass renders each post now that full site payload is available\n self.posts.each do |post|\n post.render(self.layouts, site_payload)\n end\n \n self.posts.sort!\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n 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 classes_and_includes_and_extends_for name\n klasses = []\n extends = []\n includes = []\n\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n extends << [klass.extends, store] if klass.extends\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue RDoc::Store::MissingFileError\n end\n end.compact\n\n extends.reject! do |modules,| modules.empty? end\n includes.reject! do |modules,| modules.empty? end\n\n [found, klasses, includes, extends]\n end", "def initialize(site, base, dir, name); end", "def process_dir( dir )\n #puts \"Scanning #{dir}\"\n Dir.foreach( dir ) do |entry|\n if entry.start_with?('.')\n next\n end\n path = \"#{dir}/#{entry}\"\n if Dir.exist?(path)\n process_dir(path)\n elsif entry.end_with?( '.rb' )\n process_file( path )\n end\n end\n end", "def initialize(dir)\n # Create a new patterns hash\n @patterns = Hash.new\n\n # Get the pattern files in the directory\n dir += '/' if(!dir.end_with?('/'))\n files = Dir.glob(dir + \"*.pattern\")\n\n # Create a DesignPattern for each file\n files.each do |f|\n pattern = DesignPattern.new(f)\n @patterns[pattern.name] = pattern\n end\n end", "def get_files(dir)\r\n\t\r\n\t\t\tfiles = Dir.glob(dir)\r\n\t\t\tdir_path = dir.chomp(\"*\")\r\n\r\n\t\t\tfor file in files\r\n\t\t\t\tunless File.directory?(file)\r\n\t\t\t\t\tif @ext.include?(File.extname(file))\r\n\t\t\t\t\t\tread_lines file\r\n\t\t\t\t\t\t@num_files = @num_files+1\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\telse\r\n\t\t\t\t\tget_files file+\"/*\"\r\n\t\t\t\tend\r\n\r\n\t\t\tend\r\n\t\tend", "def initialize(site, base, dir, name)\n @config = Tenji::Config\n\n @site = site\n @base = base\n @dir = dir\n @name = name ? name : 'index.html'\n @path = name ? File.join(base, dir, name) : ''\n\n read_file base, dir, name\n\n process_dir config.dir(:galleries), config.dir(:galleries, :out)\n process_name \n \n paginate config.items_per_page\n \n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(File.join(dir, @name), type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self \n end", "def analyzer(logs_folder='log/bdsp_logs/all')\n @classes = { \"models\" => { 'mtds' => {} }, \"controllers\" => { 'mtds' => {} }, \"other\" => { 'mtds' => {} } }\n @methods = { \"models\" => {}, \"controllers\" => {}, \"other\" => {} }\n @features = {}\n logfiles = Dir[logs_folder+\"/*\"]\n logfiles.each do |logfile|\n logfile_name = logfile.split('/')[-1]\n puts \"Starting on #{logfile_name}\"\n @story_classes = { \"models\" => { 'mtds' => {} }, \"controllers\" => { 'mtds' => {} }, \"other\" => { 'mtds' => {} } }\n @story_methods = { \"models\" => {}, \"controllers\" => {}, \"other\" => {} }\n File.open(logfile, 'r') do |tp_log|\n tp_log.each_line do |logline|\n log_entry = logline.split(',').each {|l| l.strip! }\n kinds = ['models','controllers'] ; kind = 'other'\n kinds.each { |k| kind = log_entry[0].include?(k) ? k : kind} \n klasses = log_entry[1].split(':').reject(&:empty?)\n if kind == 'models'\n eval_klass = \"@classes['#{kind}']\"\n eval_story_klass = \"@story_classes['#{kind}']\"\n klasses.each.with_index(1) do |klass, idx|\n if idx == klasses.length\n eval(\"#{eval_klass}['mtds']['#{klass}'] = #{eval_klass}['mtds'][#{'klass'}].try(:next) || 1\")\n eval(\"#{eval_story_klass}['mtds']['#{klass}'] = #{eval_story_klass}['mtds']['#{klass}'].try(:next) || 1\")\n @methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"] ||= Set.new\n @story_methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"] ||= Set.new\n @methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"].add(log_entry[3])\n @story_methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"].add(log_entry[3])\n elsif idx == 1\n eval(eval_klass+\"['#{klass}'] ||= {'mtds' => {}, 'bdt_scenarios' => Set.new}\")\n eval(eval_klass+\"['#{klass}']['bdt_scenarios'].add(log_entry[3])\")\n eval(eval_story_klass+\"['#{klass}'] ||= {'mtds' => {}, 'bdt_scenarios' => Set.new}\")\n eval(eval_story_klass+\"['#{klass}']['bdt_scenarios'].add(log_entry[3])\")\n else\n eval(eval_klass+\"['#{klass}'] ||= {'mtds' => {} }\")\n eval(eval_story_klass+\"['#{klass}'] ||= {'mtds' => {} }\")\n end\n eval_klass += \"['#{klass}']\"\n eval_story_klass += \"['#{klass}']\"\n end\n end\n end\n end\n @features[logfile_name] = {\"classes\" => @story_classes, \"methods\" => @story_methods}\n end\n return @classes, @methods, @features\n # return [@classes, @user_stories, @scenarios, @steps]\n end", "def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n \n entries.each do |f|\n if File.directory?(File.join(base, f))\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end", "def create_cache_for(klassname, path)\n klass = class_cache[klassname]\n return nil unless klass\n\n method_files = klass[\"sources\"]\n cache = OpenStructHash.new\n\n method_files.each do |f|\n system_file = f.index(@sys_dir) == 0\n Dir[File.join(File.dirname(f), \"*\")].each do |yaml|\n next unless yaml =~ /yaml$/\n next if yaml =~ /cdesc-[^\\/]+yaml$/\n\n method = read_yaml yaml\n\n if system_file then\n method[\"source_path\"] = \"Ruby #{RDoc::RI::Paths::VERSION}\"\n else\n gem = Gem.path.any? do |path|\n pattern = File.join Regexp.escape(path), 'doc', '(.*?)', ''\n\n f =~ /^#{pattern}/\n end\n\n method[\"source_path\"] = if gem then\n \"gem #{$1}\"\n else\n f\n end\n end\n\n name = method[\"full_name\"]\n cache[name] = method\n end\n end\n\n write_cache cache, path\n end", "def terminus_classes(indirection_name)\n setup_instance_loading indirection_name\n instance_loader(indirection_name).files_to_load.map do |file|\n File.basename(file).chomp(\".rb\").intern\n end\n end", "def initialize(path) # Initializes with a given path name of the folder with files\n self.path = path\n @files = []\n end", "def load(directory) # :nodoc:\n Dir[directory + \"/**/*.rb\"].each do |file|\n object_filename = File.basename(file, \".rb\")\n factory_filepath = \"#{object_filename}_factory.rb\"\n unless custom_factory_exists?(factory_filepath)\n load_object_factory object_filename.classify\n end\n end \n end", "def import_files(dir)\n Dir.glob(dir.to_s).map {|file| import_file(file)}\nend", "def collection_dir(*files); end", "def import\n files.each{|filename| Song.new_by_filename(filename) } #Song.new_by_filename(filename) is calling the method in class Song\n end", "def load_models_from(dir, prefix='')\n # Appends a file system directory separator to the directory if needed.\n dir = File.join(dir, '')\n Dir[File.join(dir, '**', '*.rb')].each do |f| \n # For every rb file we try to gues and instantiate the contained class.\n model_name = f.gsub(/#{dir}|\\.rb/, '')\n begin\n (prefix + model_name).camelize.constantize\n rescue Exception => e\n # Errors at this point could be ignored, as there may be files that do not contain classes.\n TaliaCore.logger.warn \"Could not load class #{(prefix + model_name).camelize}: #{e.message}\"\n end\n end\n end", "def generate_class_and_module_files\n template_file = @template_dir + 'class-page.html.erb'\n debug_msg \"Generating class documentation\"\n @unique_classes_and_modules.each do |klass|\n debug_msg \" %s %s\" % [klass.type, klass.full_name]\n outfile = @output_dir + klass.path\n @class = klass\n self.render_template(template_file, binding(), outfile)\n end\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 defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend", "def file_list\n list = []\n\n list.concat(Array.new(4, \"class0/file0.html\"))\n list << \"class0/file1.html\"\n list.concat(Array.new(2, \"class0/file2.html\"))\n list.concat(Array.new(3, \"class0/file3.html\"))\n list.concat(Array.new(4, \"class0/file4.html\"))\n\n list.concat(Array.new(7, \"class1/file0.html\"))\n list.concat(Array.new(2, \"class1/file1.html\"))\n list.concat(Array.new(3, \"class1/file2.html\"))\n\n list.concat(Array.new(8, \"class2/file0.html\"))\n list.concat(Array.new(5, \"class2/file1.html\"))\n list.concat(Array.new(5, \"class2/file2.html\"))\n list.concat(Array.new(10, \"class2/file3.html\"))\n\n list.concat(Array.new(15, \"class3/file0.html\"))\n list.concat(Array.new(7, \"class3/file1.html\"))\n\n list.concat(Array.new(12, \"class4/file0.html\"))\n\n list.concat(Array.new(11, \"class5/file0.html\"))\n\n return list.shuffle\nend", "def create_dirs(klass)\n class << klass\n Array(LIBRARY_DIRS).each do |dir|\n define_method(\"#{dir}_dir\") do\n File.join(lib_dir, dir)\n end\n module_eval(%(def #{dir}_require(&block); lib_require('#{dir}', &block); end), __FILE__, __LINE__)\n end\n end\n end", "def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end", "def create_uploads(dirs)\n u = UploadImage.new\n dirs.map do |dir|\n UploadInspection.new(\"./inspections/\"+dir, u)\n end\n end", "def initialize\n @files = []\n end", "def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @dirty = true\n\n self.process(name)\n self.read_yaml(File.join(base, dir), name)\n end", "def initialize root_dir\n find_files root_dir\n end", "def load_class_data klass_name\n file = class_file klass_name\n\n File.open file, 'rb' do |io|\n Marshal.load io.read\n end\n rescue Errno::ENOENT => e\n error = MissingFileError.new(self, file, klass_name)\n error.set_backtrace e.backtrace\n raise error\n end", "def find_assembly_files\n start_dir = self.location\n #logger.debug(\"self is #{self.inspect}\")\n #logger.debug(\"checking in location #{start_dir}\")\n files = Hash.new\n if ! File.directory? start_dir then\n errors.add(:location, \"Directory #{start_dir} does not exist on the system.\")\n #abort(\"Directory #{start_dir} does not exist on the system for #{self.inspect}\")\n return []\n end\n #logger.error(\"start dir is #{start_dir}\")\n Find.find(start_dir) do |path|\n filename = File.basename(path).split(\"/\").last\n skip_flag = 0\n FILE_SKIPS.each { |filepart, filehash| \n type = filehash[\"type\"]\n category = filehash[\"category\"]\n if category == 'suffix' then\n if (filename.match(\"#{filepart}$\")) then\n skip_flag = 1\n end\n else \n if (filename.match(\"#{filepart}\")) then\n skip_flag = 1\n end\n end\n\n }\n if (skip_flag == 1) then\n logger.error(\"Skipping file #{filename} because it matches a file skip\")\n next\n end\n FILE_TYPES.each { |filepart, filehash| \n\t type = filehash[\"type\"]\n\t vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.error(\"filename is #{filename}\")\n files[type] = Hash.new\n\t files[type][\"path\"] = path\n\t files[type][\"vendor\"] = vendor\n end\n }\n end\n return files\n end", "def initialize(dir=nil, expression=\".*\")\r\n @sleepTime = 5\r\n @priority = 0\r\n @stopWhen = nil\r\n\r\n @directories = Array.new()\r\n @files = Array.new()\r\n\r\n @foundFiles = nil\r\n @firstLoad = true\r\n @watchThread = nil\r\n \r\n initializeState()\r\n\r\n if dir then\r\n addDirectory(dir, expression)\r\n end\r\n end", "def initialize(site, base, dir, name, collection = T.unsafe(nil)); end", "def parse_directory(dir)\n search = File.join(\"**\", \"*.pp\")\n Dir.chdir dir\n ppfiles = Dir.glob(search)\n ppfiles.each { |f| PuppetFile.new(File.expand_path(f)) }\nend", "def get_files\n Dir.foreach(@path) do |file|\n if File.extname(file) == \".mp3\"\n thisfile = SongFile.new(\"#{@path}/#{File.path(file)}\")\n @files << thisfile\n end\n end\n end", "def new_files\n @new_files ||= Set.new.tap do |files|\n site.each_site_file { |item| files << item.destination(site.dest) }\n end\n end", "def initialize(site, base, dir, name, from_plugin: false)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @ext = File.extname(name)\n @basename = File.basename(name, \".*\")\n @path = if from_plugin\n File.join(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process\n\n self.data ||= HashWithDotAccess::Hash.new\n\n Bridgetown::Hooks.trigger :generated_pages, :post_init, self\n end", "def parse_file(filename)\n klass = class_name(filename)\n read_file(filename) do |data|\n data = JSON.parse(data, :object_class => Types::Base, :max_nesting => 100)\n store_schema(data) do\n if data.resources # discovery format\n parse_resource(data)\n else\n data_types[klass] = {}\n data_types[klass] = parse_object(data)\n end\n end\n end\n klass\n end", "def load_classes class_path_list\n class_path_list.each do |path|\n add_class path\n end\n end", "def read_content(dir, magic_dir, matcher)\n @site.reader.get_entries(dir, magic_dir).map do |entry|\n next unless matcher.match?(entry)\n\n path = @site.in_source_dir(File.join(dir, magic_dir, entry))\n Document.new(path,\n :site => @site,\n :collection => @site.posts)\n end.tap(&:compact!)\n end", "def read_posts\n self.posts = []\n posts_dir = File.join(source_path, \"posts\")\n entries = Dir.entries(posts_dir).reject{|f| File.directory?(f)}\n entries.each do |name|\n self.posts << Post.create(posts_dir, name)\n end\n posts.sort! \n end", "def traverse(pattern, arr, dir)\n Dir.glob(dir + '/**/*') do |file|\n next if file == '.' || file == '..' || file.include?('html~')\n harvest(pattern, file, arr) if file =~ /(.*).html/\n end\n end", "def initialize(*dirs)\n @dirs = dirs.flatten.map{|dir| dir.to_s}\n @known_files = []\n @last_mtime = {}\n end", "def files\n entries.map{ |f| FileObject[path, f] }\n end", "def initialize dir\n @ilog = logger\n @controllers = {} # fqname=> instance \n @load_dir = dir\n load_controllers dir if @load_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 build_indices\n template_cache = RDoc::Cache.instance\n\n @info.each do |toplevel|\n @files << RDoc::Generator::File.new(template_cache, toplevel, @options,\n RDoc::Generator::FILE_DIR)\n end\n\n RDoc::TopLevel.all_classes_and_modules.each do |cls|\n build_class_list(template_cache, cls, @files[0], RDoc::Generator::CLASS_DIR)\n end\n end", "def read\n filtered_entries.each do |file_path|\n full_path = collection_dir(file_path)\n next if File.directory?(full_path)\n\n if Utils.has_yaml_header? full_path\n read_document(full_path)\n else\n read_static_file(file_path, full_path)\n end\n end\n site.static_files.concat(files) unless files.empty?\n sort_docs!\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&amp;\"\n # agent.get(uri)\n\n files\n end", "def to_a\n ::Dir.glob(path + '/*').collect {|pth| UFS::FS::File.new(pth)}\n # Uncomment the following to return File & Dir objects instead of Strings.\n # ::Dir.glob(path + '/*').collect {|pth| UFS::FS.new pth}\n end", "def genFileContent(cls, bld)\n bld.separate\n\n for inc in cls.includes\n bld.add(\"require '\" << inc.path << inc.name << \".\" << Utils.instance.getExtension(\"body\"))\n end\n\n bld.separate\n\n render_namespace_starts(cls, bld)\n\n inheritFrom = \"\"\n\n if cls.baseClasses.length > 0\n inheritFrom = \" < \" + Utils.instance.getClassTypeName(cls.baseClasses[0])\n end\n\n if cls.baseClasses.length > 1\n Log.error(\"Ruby doesn't support multiple inheritance\")\n end\n\n bld.startClass(\"class \" + getClassName(cls) + inheritFrom)\n\n accessors = Accessors.new\n # Do automatic static array size declairations at top of class\n process_var_accessors(accessors, cls, bld, cls.model.varGroup)\n\n add_accessors(\"attr_accessor\", accessors.both, bld)\n add_accessors(\"attr_attr_reader\", accessors.readers, bld)\n add_accessors(\"attr_attr_writer\", accessors.writers, bld)\n\n bld.separate\n\n # Do automatic static array size declairations at top of class\n process_var_group(cls, bld, cls.model.varGroup)\n\n bld.separate\n # Generate code for functions\n for fun in cls.functions\n process_function(cls, bld, fun)\n end\n\n bld.endClass\n render_namespace_ends(cls, bld)\n end", "def initialize(file_path) \n @path = file_path\n @files_array = []\n self.files\n end" ]
[ "0.71646094", "0.675514", "0.6575856", "0.6516473", "0.63850534", "0.63810027", "0.6378814", "0.60002357", "0.5986362", "0.59554523", "0.59429735", "0.5856373", "0.58408505", "0.57834756", "0.57754534", "0.57743114", "0.5752556", "0.5749027", "0.5711285", "0.5691513", "0.5649467", "0.56178313", "0.55914956", "0.55904657", "0.55755836", "0.5507727", "0.54838026", "0.5482577", "0.5449415", "0.5421016", "0.5414209", "0.5411227", "0.54046375", "0.53649837", "0.53353065", "0.53294104", "0.53240657", "0.53240657", "0.52790034", "0.52674514", "0.52658737", "0.5265806", "0.5265181", "0.5264805", "0.52638125", "0.52623194", "0.5261895", "0.5259569", "0.52537644", "0.52425826", "0.523901", "0.5238954", "0.5236204", "0.5232108", "0.5228608", "0.52129114", "0.5205896", "0.5195401", "0.51912874", "0.51758134", "0.5173009", "0.51700544", "0.51618224", "0.51588815", "0.5153564", "0.5148491", "0.5147467", "0.5142529", "0.51421803", "0.51402676", "0.5139983", "0.5125529", "0.5118903", "0.51173824", "0.51122874", "0.509653", "0.50961643", "0.5091846", "0.5089049", "0.50867826", "0.50867623", "0.5086007", "0.5085641", "0.5082412", "0.50798833", "0.50707966", "0.5066559", "0.5052419", "0.50520974", "0.50422907", "0.5033564", "0.5032442", "0.5031225", "0.5030064", "0.50274485", "0.50273585", "0.50271964", "0.50268054", "0.5019673", "0.50132793" ]
0.6546445
3
Statuses dont change a log, so keep them cached to make ticket listing faster.
def status_translations @status_translations ||= Assembla.statuses['ticket_statuses'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses; end", "def status(memoize = true)\n if @status[:updated].nil? or not memoize or (memoize and not @status[:updated].nil? and \n ((Time.now - @status[:updated]) >= self.class.status_update_threshold))\n response = Crocodoc.connection.get 'document/status', :uuids => @uuid\n response = response.body.first\n @status[:updated] = Time.now\n @status[:status] = STATUSES[response['status']]\n @status[:viewable] = response['viewable']\n @status[:error] = response['error'] if response.member?('error')\n end\n return @status\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def ticket_status(ticket)\n I18n.t(\"tickets.status.#{ticket.status_name}\")\n end", "def initialize\n @statuses = {}\n @status_mutex = Mutex.new # guards access to @statuses\n end", "def initialize\n @statuses = {}\n @status_mutex = Mutex.new # guards access to @statuses\n end", "def statuses\n @repo ||= pr_json.base.repo.full_name\n @sha ||= head_commit\n statuses = {}\n api.statuses(@repo, @sha).each do |status|\n statuses[status.context] ||= []\n statuses[status.context].push(context: status.context,\n state: status.state,\n date: status.updated_at)\n end\n statuses.map do |_, val|\n val.sort { |a, b| b[:date] <=> a[:date] }[0]\n end\n end", "def clear_all\n @status_mutex.synchronize { @statuses = {} }\n end", "def clear_all\n @status_mutex.synchronize { @statuses = {} }\n end", "def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end", "def added; status[:added] || []; end", "def added; status[:added]; end", "def change_status(status)\n unless @status == status\n @status = status\n @start_time = Time.now\n end\n end", "def last_status; end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def set_status\n if @cooked_for <= @cook_time / 3\n @status = @statuses[0]\n return\n end\n if @cooked_for <= @cook_time / 2\n @status = @statuses[1]\n return\n end\n if @cooked_for == @cook_time\n @status = @statuses[2]\n return\n end\n if @cooked_for > @cook_time\n @status = @statuses[3]\n return\n end\n end", "def modified; status[:modified] || []; end", "def status=(status); end", "def status\n statuses.find(:first, :order => \"updated_at DESC\")\n end", "def item_statuses\n # The previous mapping wasn't always in order\n # I18n.t(:history_actions).map { |key, value| [ value ] } \n # Retrieve translations and sort\n items = I18n.t(:item_status)\n items.map { |key, value| [ value, key ] } \n end", "def list_bug_status(results)\n bug_ids = []\n bug_ids_with_results = {}\n \n # Build a list of bug ids to query the ticket system\n results.each do |result|\n # first make sure not nil\n if result.bugs != nil\n # then split bugs as they are split by commas\n bugs = result.bugs.split(',')\n # it is possible that hte list was blank, so we check array isn't empty\n unless bugs == []\n bugs.each do |bug|\n # add all values to list\n bug_ids << bug\n \n # We make a separate dictionary of all bugs. the dictionary is a list of bug ids with the reslated results\n # Ex. { :bug_id_1 => [result_id_1, result_id3], :bug_id_2 => [result_id_1, result_id_2] }\n if bug_ids_with_results[bug] == nil\n bug_ids_with_results[bug] = [result.id]\n else\n bug_ids_with_results[bug] << result.id\n end\n end \n end\n end\n end \n # Remove duplicate values from IDs\n bug_ids = bug_ids.uniq\n\n # If a ticketing system is used, find status of all bugs\n if Setting.value('Ticket System') != 'none'\n # If ticket system is set, check that all bugs exist\n # need to send bug status an array of IDs so we split the comma separated list\n bug_results = Ticket.bug_status( bug_ids )\n else\n bug_results = {}\n bug_ids.each do |bug|\n bug_results[bug] = { :name => 'Not Found', :status => 'Not Found' }\n end\n end\n\n # Now that we have the list of bugs with the status and names\n # We add the array of associated result IDs to the bugs. We use the dictionary\n # created earlier in this function. \n bug_results.each_key do |key|\n # Error key won't exist\n bug_results[key][:result_ids] = bug_ids_with_results[key]\n end\n\n return bug_results\n end", "def recalculate_report_status\n self.status = 'pending' if resource_statuses.any? {|rs| rs.status == 'pending' } &&\n resource_statuses.none? {|rs| rs.status == 'failed'}\n self.status = 'failed' if self.logs.any? {|l| l.level == 'err' }\n end", "def action_for_status status\n load_cloudflare_cookbook_gems\n ip = new_resource.ip\n\n if trust_cache? && status_from_cache(ip) == status\n Chef::Log.info \"[CF] Cache says that #{ip} is already in status #{status}, nothing to do\"\n else\n # we need to make the actual call to the API\n new_resource.set_status status\n Chef::Log.info \"[CF] #{ip}'s threat control was succesfully set to #{status}\"\n\n # no harm in caching even if the cache isn't used\n set_cache ip, status\n\n # as noted in the README, we can't know whether the status\n # really was updated with Cloudflare, so...\n new_resource.updated_by_last_action true\n end\nend", "def update_status(msg)\n status_file_path = File.join(RAILS_ROOT, \"files\", \"activity_results\", \"status_#{id.to_s}.log\")\n File.open(status_file_path, 'w') {|f| f << msg }\n end", "def show\n @ticketlogs = TicketLog.where(ticket: @ticket).order(updated_at: :desc)\n end", "def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end", "def update_account_status_cached\n update(account_status_cached: calculate_account_status)\n account_status_cached\n end", "def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def retun_time_entry_msg(slatime)\n new_status = slatime.issue_sla_status.issue_status.name\n pre_status = slatime.old_status.issue_status.name #unless slatime.count == 1\n pre_status = pre_status == new_status ? 'New' : pre_status\n \"Status was changed from #{pre_status} to #{new_status}\"\n end", "def status\n { history: @history.recent(5),\n uploading: @uploader.status,\n host: @uploader.host,\n pending: pending_status_to_hash,\n upload_at: 'See Cron' }\n end", "def index\n statistic_types = StatisticType.all\n @stat_type_map=Hash.new\n statistic_types.each do |x|\n @stat_type_map[x.id]=x.code\n end\n @stats_log_entries = Rails.cache.fetch(\"user_stats_log\"){Array.new}\n @tweet_log = TweetCollector.get_tweet_log\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def status\n # If the data is over 10 seconds old, refresh it\n @mutex.synchronize do\n if !@last_update or (Time.now.to_i - @last_update.to_i > 10)\n update_status\n @last_update = Time.now\n end\n end\n @status\n end", "def set_common_data\n @statuses = Status.all\n end", "def update_all_statuses\n updated_users = []\n\n @statuses.keys.each do |user|\n updated_users << user if update_status_for user\n end\n\n updated_users\n end", "def statuses\n calculated = Array(read_attribute(:statuses))\n calculated.delete(Contact::OK)\n calculated.delete(Contact::LINKED)\n calculated << Contact::OK if calculated.empty?# && valid?\n calculated << Contact::LINKED if linked?\n\n calculated.uniq\n end", "def ticket_status_updated(ticket)\n\t@ticket = ticket\n\n mail to: @ticket.customer_email, subject: \"You ticket updated\"\n end", "def collect_statuses\n ret = []\n versions.each do |v|\n s = v.statuses\n if s.exist?\n v.statuses.each do |status|\n ret << [status[\"key\"], status[\"value\"]]\n end\n end\n end\n ret\n end", "def status(env)\n cache_key = CacheKey.new(env)\n {\n url: env.url.to_s,\n status: cache.status(cache_key).to_s,\n key: cache_key.key,\n digest: cache_key.digest,\n path: cache.diskpath(cache_key),\n }\n end", "def statuses\n return ['canceled', 'completed'] if self.status == 'paid'\n return ['canceled', 'paid'] if self.status == 'ordered'\n end", "def log_status(state = nil)\n I18n.with_locale(:cn) do\n I18n.t \"models.order.status.#{ORDER_STATUS.key((state||self.status).to_i).downcase}\"\n end\n end", "def status_enum\n status_list\n end", "def getStatus id\n\t\tstatus = @tickets.read ['status'], ['id', id]\n\t\tstatus = status[0]['status']\n\tend", "def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end", "def marketing_statuses\n sources = []\n changed_sources = []\n\n \n # collect l2l source source\n @resident.sources.where(:property_id => params[:prop_id]).each_with_index do |s, i|\n pp \"#{s.status}, #{s.status_date}, #{s.created_at}\"\n if s.status\n sources << {\n :status => s.status,\n :status_date => s.created_at,\n :move_in => s.move_in,\n :move_out => s.move_out\n }\n end\n end\n\n #collect only changed source (status & status_date changed)\n # must order by status_date asc, status_date always exists\n sorted_sources = sources.sort{|a, b| a[:status_date] <=> b[:status_date] }\n sorted_sources.each_with_index do |s, i|\n if i == 0\n changed_sources << s\n\n elsif s[:status] != sorted_sources[i-1][:status]\n changed_sources << s\n\n end\n end\n\n\n @statuses = changed_sources.sort{|a, b| b[:status_date] <=> a[:status_date] }\n \n render :json => @statuses.collect{|n| \n {\n :status => n[:status],\n :status_date => n[:status_date].to_s(:utc_date),\n :move_in => pretty_move_in(n[:move_in]),\n :move_out => pretty_move_in(n[:move_out])\n }\n }\n end", "def getStatus\n @@statuses[@status]\n end", "def statusesReceived_forRequest(statuses,identifier)\n\t\tputs \"statusesReceived_forRequest\"\n\t\tself.statuses = statuses\n\tend", "def index\n @status = Status.last || Status.new(available: \"unavailable\", created_at: DateTime.now)\n end", "def availability_summary_obj #This should be changed to availability_summary\n unavailable = []\n available = []\n awaiting = []\n\n self.cached_teamsheet_entries.each do |tse|\n if tse.response_status == 0\n unavailable << tse.user\n elsif tse.response_status == 1\n available << tse.user\n elsif tse.response_status == 2\n awaiting << tse.user\n end\n end\n { unavailable: unavailable, available: available, awaiting: awaiting }\n end", "def with_statuses(issue_statuses)\n if name == 'status_id'\n format 'Status: %s => %s',\n find_issue_status(issue_statuses, old_value),\n find_issue_status(issue_statuses, new_value)\n else\n to_s\n end\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def status\n Twitter::Status.new(@status.merge(:user => self.to_hash.delete(:status))) if @status\n end", "def get_livestatus_from_bts(bts)\n live_status=Hash.new\n\n #copy from bts,do we really need?\n live_status[:bts_id]=bts.id\n live_status[:s1_ip]=bts.s1_ip\n live_status[:department]=bts.department\n live_status[:team]=bts.team\n live_status[:subteam]=bts.subteam\n live_status[:email]=bts.email\n\n return live_status\nend", "def modified; status[:modified]; end", "def removed; status[:removed]; end", "def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end", "def statuslist(path)\n\t\ts = Hash.new(0)\n\t\tcount = 0.0\n\t\tf=File.open('test_log')\n f.readlines.each do |line|\n part = line.split(' ')\n status = part[8]\n s[status] = s[status] + 1\n count +=1\n end\n\n\t\tprint \"\\nHTTP Status Codes Summary: \\n\\n\"\n\t\ts.sort.each do |k, v|\n\t\t\tprint \"#{k}: #{((v/count)*100).round}%\\n\"\n\t\tend\t\n\tend", "def updateStatus id, status\n\t\[email protected] Hash['status' => status], ['id', id]\n\tend", "def member_status(outfile)\n log_hashes = []\n\n user_id = \"super_member\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true)\n log_hashes = log_hashes + become_member(user_id, current_time + 100)\n current_time += 1000 + 900 + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000)\n current_time += 1000 + 900 + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000)\n log_hashes = log_hashes + become_member(user_id, current_time + 100, 'super_member')\n current_time += 1000 + 900 + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000)\n\n user_id = \"regular member\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true)\n log_hashes = log_hashes + become_member(user_id, current_time + 100)\n log_hashes = log_hashes + create_member(user_id, current_time + 100, 'Regular Joe', '[email protected]')\n current_time += 1000 + 905\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000)\n\n user_id = \"non-member\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true, \"share_by_effective_sharer\")\n\n write_logs(outfile, log_hashes)\n end", "def status\n STATUSES[self.status_id]\n end", "def update_status\n @servers.each do |type|\n begin\n @server_status.send(\"#{type}_reinitialize\") # re-ping the server\n @status[type] = @server_status.send(\"#{type}_all_info\")\n\n # All sorts of invalid input can potentially cause an error. Whatever it is, just make sure we return a valid object.\n rescue Exception => e\n warn \"[#{Time.now}] #{e.inspect}\"\n e.backtrace.each do |msg|\n warn \"[#{Time.now}] #{msg}\"\n end\n @status[type] = {}\n end\n end\n end", "def cache_status(country, status)\n dump = PGconn.escape_bytea(Marshal.dump(status))\n @conn.query(\"DELETE FROM report_statuses WHERE country = '#{country}' AND road_ref = '#{status.road.ref_prefix}#{status.road.ref_number}'\")\n @conn.query(\"INSERT INTO report_statuses (road_ref, country, cached_date, status) VALUES\n ('#{status.road.ref_prefix}#{status.road.ref_number}', '#{country}', NOW(), '#{dump}')\")\n end", "def log_current_status(status)\n message = \"#{task_details_for_log}, status: #{status}\"\n if (UNDEFINED_STATUSES + STOPED_STATUSES).include?(status)\n Astute.logger.error message\n else\n Astute.logger.debug message\n end\n end", "def index\n @o_all = @ticket.ticket_logs\n end", "def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end", "def do_status\n return pretty_status(current_status)\n end", "def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end", "def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end", "def statuses\n api.get('status')\n end", "def log(project, project_params, action, status = nil)\n status_change = 0\n if status\n old_status = Status.find(status)\n new_status = Status.find(project.status_id)\n\n status_change = new_status.sorting - old_status.sorting\n end\n\n ProjectLog.create(project_id: project.id, params: project_params.to_json, action: action, status_change: status_change)\n end", "def status\n @status ||= status_line.split(/: /)\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def update_member_status_caches!\n if response_reset_date_changed?\n members.find_in_batches do |member_group|\n member_group.each {|member| member.update_status_cache! }\n end\n end\n end", "def retrieve_status\n \n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def entry_status=(value)\n case value\n when \"有效的\", \"käytössä\", \"действующий\", \"válido\"\n value = \"valid\"\n when \"korvattu\", \"reemplazado\"\n value = \"superseded\"\n when \"информация отсутствует\" # \"information absent\"!?\n value = \"retired\"\n when %w(notValid valid superseded retired)\n # do nothing\n end\n @entry_status = value\n end", "def ticket_status_count\n @ticket_status_count ||= begin\n counts = { \"a\" => 0, \"t\" => 0, \"f\" => 0 }\n counts.merge! assigned_tickets.joins(:status).sum(1, group: 'ticket_statuses.open')\n counts.each{ |k,v| counts[k] = v.to_i; counts[\"a\"] += counts[k] }\n end\n end", "def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end", "def status_update(_event)\n @submitted = false\n @filed = false\n end", "def index\n # @open_tickets are tickets not assgined to any agent\n # @ip_tickets are in progress tickets\n # @closed_tickets are closed tickets to show in history\n @ip_tickets, @closed_tickets, @open_tickets = current_user.get_tickets\n end", "def status_hook\n # We're not interested in PR statuses or branches other than deploy\n unless params[:branches].index { |b| b[:name] == 'deploy' }\n render(plain: 'Not a commit on deploy. Uninterested.') && return\n end\n\n # Create a new CommitStatus\n\n if CommitStatus.find_by(commit_sha: params[:sha])\n render plain: 'Already recorded status for commit', status: 200\n return\n end\n\n if params[:state] == 'pending'\n render plain: \"We don't record pending statuses\", status: 200\n return\n end\n\n commit_sha = params[:sha]\n status = params[:state]\n commit_message = params[:commit][:commit][:message]\n ci_url = params[:target_url]\n\n ActionCable.server.broadcast 'smokedetector_messages', commit_status: {\n status: status,\n ci_url: ci_url,\n commit_sha: commit_sha,\n commit_message: commit_message\n }\n CommitStatus.create(commit_sha: commit_sha, status: status)\n\n render plain: 'OK', status: 200\n end", "def github_combined_status\n expires_in = ->(reply) { cache_duration(reply) }\n Samson::DynamicTtlCache.cache_fetch_if true, cache_key(@commit), expires_in: expires_in do\n results = Samson::Parallelizer.map(\n [\n -> { octokit_error_as_status('checks') { github_check_status } },\n -> { octokit_error_as_status('status') { github_commit_status } }\n ],\n &:call\n ).compact.select { |result| result[:statuses].any? }\n\n results.empty? ? NO_STATUSES_REPORTED_RESULT.dup : merge_statuses(results)\n end\n end", "def get_status_name(code)\n status_name = $redis.get(\"caniuse:statuses:#{code}\")\n if status_name.nil?\n caniuse_data = get_caniuse_data\n status_name = caniuse_data[\"statuses\"][code]\n $redis.setex(\"caniuse:statuses:#{code}\", 60*60*24, status_name)\n end\n status_name\nend", "def custom_status\n {}\n end" ]
[ "0.63542956", "0.61060333", "0.60173917", "0.5962851", "0.594984", "0.594984", "0.58934087", "0.58904743", "0.58904743", "0.5755886", "0.57496524", "0.5710642", "0.5637914", "0.55909044", "0.5580965", "0.5563831", "0.5544308", "0.55247486", "0.5512276", "0.5504211", "0.5494521", "0.5488198", "0.5485307", "0.5474956", "0.54682696", "0.5467034", "0.54544836", "0.54528755", "0.5442894", "0.5442447", "0.5440526", "0.5413507", "0.5408316", "0.54027146", "0.5375978", "0.5369249", "0.5368869", "0.53681475", "0.5361", "0.5340131", "0.533436", "0.53183436", "0.5316983", "0.53147817", "0.5299858", "0.5281621", "0.52786064", "0.52661186", "0.52637786", "0.5259903", "0.52545744", "0.5244068", "0.5243991", "0.5242986", "0.5237728", "0.523664", "0.5234914", "0.5229496", "0.5227295", "0.52248406", "0.5220692", "0.52164036", "0.52143204", "0.52141625", "0.5212134", "0.52076435", "0.5207151", "0.5207151", "0.52066034", "0.52058", "0.5202619", "0.52011716", "0.52011716", "0.5198874", "0.5198874", "0.5198874", "0.5198874", "0.51945406", "0.5194122", "0.51936036", "0.51936036", "0.5180118", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5172357", "0.5171868", "0.51712537", "0.5167823", "0.5162599", "0.51618004", "0.51592064", "0.5156532", "0.51548815", "0.51516473" ]
0.5505275
19
Translates a statusid into its statusname equivalent.
def status_string number status_translations.each do |hash| if hash['list_order'] == number return hash['name'] end end 'Unknown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatusName(status_id)\n \tbegin\n statusname = Capstatus.find(status_id).status\n rescue ActiveRecord::RecordNotFound => e\n statusname = ''\n end \n return statusname\n end", "def status_name\n STATUS[self.status_id][0]\n end", "def status_name\n STATUSES[status]\n end", "def normalize_status(status)\n case status\n when 'Sisäänkirjaus', 'Sisäänkirjautuminen'\n return 'Vapaa'\n when 'Puhelu (Ulos)', 'Puhelu (Sisään)', 'Ulossoitto'\n return 'Puhelu'\n when /^Varattu \\((.*)\\)$/\n return Regexp.last_match[1]\n else\n return status\n end\n end", "def get_status_name\n case self.status\n when STATUS_NOT_APPLIED\n return I18n.t('workflow.status.not_applied')\n when STATUS_NOT_ISSUED\n return I18n.t('workflow.status.not_issued')\n when STATUS_ACTIVE\n return I18n.t('workflow.status.active')\n when STATUS_ACCEPTED\n return I18n.t('workflow.status.accepted')\n when STATUS_DENIED\n return I18n.t('workflow.status.denied')\n end\n end", "def get_status_name\n\n return Team.status_name(self.status)\n end", "def status_name\n STATUSE.key(@status)\n end", "def name(id)\n @id_to_name[id]\n end", "def convert_status(status)\n case status\n when '-1'\n return :failure\n when '0'\n return :unknown\n when '1'\n return :working\n when '2'\n return :complete\n else\n return :error\n end\n end", "def status_id(status)\r\n case status\r\n when \"Active\"\r\n \"Y\"\r\n when \"Inactive\"\r\n \"N\"\r\n when \"Draft\"\r\n \"D\"\r\n else\r\n \"N\"\r\n end\r\n end", "def with_statuses(issue_statuses)\n if name == 'status_id'\n format 'Status: %s => %s',\n find_issue_status(issue_statuses, old_value),\n find_issue_status(issue_statuses, new_value)\n else\n to_s\n end\n end", "def convert_status(status)\n case status\n when :added\n 'create'\n when :deleted\n 'delete'\n when :modified\n 'update'\n when :renamed\n 'move'\n else\n raise ArgumentError\n end\n end", "def pretty_status\r\n status.titleize\r\n end", "def convert_user_status_to_words (status_num)\n #status_num = \"#{status_num}\"\n if status_num == 1\n status_text = \"Currently Enrolled\"\n elsif status_num == 0\n status_text = \"Alumni\"\n end\n end", "def translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]\n end", "def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end", "def status_text_from_code(status_code)\n MoabRecord.statuses.key(status_code)\n end", "def status(result)\n result = result.upcase\n if result == \"PASS\"\n id_value = \"statuspass\"\n else\n id_value = \"statusfail\"\n end\n id_value\n end", "def translate_status_from_internal_to_external(status)\n status.downcase == \"voided\" ? \"refunded\" : status\n end", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def enrollment_status_name\n ENROLLMENT_STATUS_NAMES[enrollment_status.to_s.strip]\n end", "def stringify_status(status_code)\n case status_code\n when 0\n 'paused'\n when 1\n 'not_checked_yet'\n when 2\n 'up'\n when 8\n 'seems_down'\n when 9\n 'down'\n else\n 'unknown'\n end\nend", "def convert_user_status_to_words (status_num)\n\n if status_num == 0\n status_text = \"Student\"\n elsif status_num == 1\n status_text = \"Alumni\"\n end\n end", "def convert_status(old_status)\n old_status.nil? ? \"active\" : old_status\n end", "def status\n Status.find(self.status_id).name\n end", "def status_to_s\n \tSTATUSES[self.status].humanize\n end", "def transform_status(status); end", "def convert_vapp_status(status_code)\n case status_code.to_i\n when 0\n 'suspended'\n when 3\n 'paused'\n when 4\n 'running'\n when 8\n 'stopped'\n when 10\n 'mixed'\n else\n \"Unknown #{status_code}\"\n end\n end", "def convert_vapp_status(status_code)\n case status_code.to_i\n when 0\n 'suspended'\n when 3\n 'paused'\n when 4\n 'running'\n when 8\n 'stopped'\n when 10\n 'mixed'\n else\n \"Unknown #{status_code}\"\n end\n end", "def status=(status)\n if status && (status.is_a?(String) || status.is_a?(Symbol))\n @status = status.upcase.to_sym\n end\n end", "def get_status_string(status)\n case status\n when :started, :scheduled then \"#{Tty.green}#{status}#{Tty.reset}\"\n when :stopped, :none then \"#{Tty.default}#{status}#{Tty.reset}\"\n when :error then \"#{Tty.red}error #{Tty.reset}\"\n when :unknown then \"#{Tty.yellow}unknown#{Tty.reset}\"\n end\n end", "def translate_status_code(code)\n {\n '00' => :success,\n '40' => :neutral,\n '59' => :waiting_bank,\n '60' => :rejected_bank,\n '64' => :waiting_risk,\n '65' => :rejected_risk,\n '70' => :rejected_validation,\n '80' => :waiting,\n '90' => :new\n }[code]\n end", "def name_id\n status_label = active ? \"\" : \"[INACTIVE] \"\n [\"#{status_label}#{name + school_code}\", id]\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def order_status(order_status)\n stat_name = ''\n if order_status == 'deliver'\n stat_name = 'Entregada'\n elsif order_status == 'in_route'\n stat_name = 'Reparto'\n elsif order_status == 'rejected'\n stat_name = 'Rechazada'\n elsif order_status == 'pending'\n stat_name = 'Pendiente'\n elsif order_status.nil?\n stat_name = 'No tiene estado'\n end\n stat_name\n end", "def get_status_text(status)\n return \"Failed\" if status.upcase == 'DOWN'\n return \"Passed\" if status.upcase == 'UP'\n\n return \"Unknown\"\nend", "def status(status_id)\n response = @client.get(\"/api/v1/statuses/#{status_id}\")\n return JSON.parse(response.body)\n end", "def id2name(id)\n if Puppet::Util::Windows::Security.valid_sid?(id)\n Puppet::Util::Windows::Security.sid_to_name(id)\n else\n id\n end\n end", "def status\n case status_id\n when ReferenceData::PO_ITEM_PREPARING\n \"<em style='color:red'>Ordering</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_CENTRAL\n \"<em style='color:brown'>Sent to Central</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_SUPPLIER\n \"<em style='color:green'>Sent to PO</em>\"\n when ReferenceData::PO_ITEM_UNCATEGORIZED\n \"<em style='color:red'>Uncategorized</em>\"\n end\n \n end", "def status_label label\n if label == \"assigned\"\n raw \"<span class='label'>Assigned</span>\"\n elsif label == \"progress\"\n raw \"<span class='label label-info'>In Progress</span>\"\n elsif label == \"submit\"\n raw \"<span class='label label-warning'>Submitted</span>\"\n elsif label == \"reopen\"\n raw \"<span class='label label-info'>Reopened and Now In Progress</span>\"\n elsif label == \"approve\"\n raw \"<span class='label label-success'>Approved</span>\"\n else\n \"\"\n end\n end", "def id_to_name!\n @id_to_name = make_id_to_name\n self\n end", "def format_status(status)\n value = \"completed\".colorize(:green) if status == true\n value = \"pending\".colorize(:red) if status == false\n \"#{value}\".ljust(10)\n end", "def status_map(status)\n case status\n when nil then 'pass'\n when :passed then 'pass'\n when :failed then 'fail'\n when :undefined then 'error'\n when :skipped then 'ignore'\n when :comment then 'ignore'\n else 'pass'\n end\n end", "def status(status_id)\n attrset Curses::A_REVERSE\n setpos 0, 0\n addstr ' ' * maxx\n text = Status.text(status_id)\n setpos 0, (maxx - text.length) / 2\n addstr text\n attrset(Curses::A_NORMAL)\n refresh\n end", "def status_name\n invoice_status.name unless invoice_status.nil?\n end", "def status_tag(status)\n \"<span class='label label-#{status.to_s}'>#{t(\"status.#{status.to_s}\").humanize.upcase}</span>\".html_safe\n end", "def display_status(item_status_code)\n case item_status_code\n when 'I' # Initiated (Assigned)\n 'incomplete'\n when 'A', 'R' # Active (Processing) / Received\n 'beingProcessed'\n when 'C', 'W' # Completed / Waived\n 'completed'\n when 'Z' # Incomplete\n 'furtherActionNeeded'\n else\n 'incomplete'\n end\n end", "def status_str\n case self.status\n when ACTIVE\n \"Active\"\n when INACTIVE\n \"Inactive\"\n when CLOSED\n \"Closed\"\n when NO_STRIPE\n \"No Stripe Account\"\n when UNKNOWN\n \"Unknown\"\n else\n \"Invalid\"\n end\n end", "def symbol\n STATUS_CODE_TO_SYMBOL[status]\n end", "def status_sym\n return nil if status.nil?\n Bike.what_status_is[status]\n end", "def display_name\n status\n end", "def status\n if status_code.present?\n if status_code['HL7 ActStatus']\n status_code['HL7 ActStatus'].first()\n elsif status_code['SNOMED-CT']\n case status_code['SNOMED-CT'].first()\n when '55561003'\n 'active'\n when '73425007'\n 'inactive'\n when '413322009' \n 'resolved'\n end\n end\n end\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def ticket_status(ticket)\n I18n.t(\"tickets.status.#{ticket.status_name}\")\n end", "def human_current_state_name\n self.class.human_attribute_name(\"status_#{self.current_state}\")\n end", "def human_current_state_name\n self.class.human_attribute_name(\"status_#{self.current_state}\")\n end", "def human_current_state_name\n self.class.human_attribute_name(\"status_#{self.current_state}\")\n end", "def human_current_state_name\n self.class.human_attribute_name(\"status_#{self.current_state}\")\n end", "def booking_state_name(state)\n case state\n when :pending\n s_(\"BookingStateName|Pending\")\n when :accepted\n s_(\"BookingStateName|Accepted\")\n when :rejected\n s_(\"BookingStateName|Rejected\")\n when :canceled\n s_(\"BookingStateName|Canceled\")\n else\n s_(\"BookingStateName|Undefined\")\n end\n end", "def color_status(status)\n\ttd = \"<td style='cursor: pointer; color: #\"\n\n\tcase status[0..1]\n\twhen \"Go\"\n\t\ttd += \"060'>\"\n\twhen \"Sa\"\n\t\ttd += \"5d0dff' class='service'>\"\n\twhen \"Pl\", \"Se\"\n\t\ttd += \"996600' class='service'>\"\n\twhen \"De\"\n\t\ttd += \"990033' class='service'>\"\n\tend\n\n\ttd + status + \"</td>\"\nend", "def conservation_status_name\n return nil if global_conservation_status.blank?\n\n IUCN_STATUSES[global_conservation_status.iucn]\n end", "def name_of(state)\n state = state.to_i\n return case state\n when -2 then \"DISCARDED\"\n when -1 then \"INIT\"\n when 0 then \"SUCCEEDED\"\n when 1 then \"WAIT\"\n when 2 then \"RUNNING\"\n when 3 then \"SUSPEND\"\n when 4 then \"FAILED\"\n else raise \"unknown state #{state}\"\n end\n end", "def charset_id2name(charset_id)\n #This is a stub, used for indexing\n end", "def id2name() end", "def id2name() end", "def status_text\n\t s = Enrollment::STATUS_NAMES[self.enrollment_status]\n\t \n\t if [Enrollment::STATUS_CLOSED,Enrollment::STATUS_FINALIZED].include? self.enrollment_status\n\t s += \"-#{Enrollment::COMPLETION_NAMES[self.completion_status]}\"\n\t end\n\t s\n\tend", "def update_translation_status(project_id, status_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params\n end", "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "def task_status_to_task_link_text(task_status)\n status_description = { 'passing' => 'view',\n 'failing' => 'retry',\n 'testing' => 'testing...',\n 'incomplete' => 'start' }\n status_description[task_status]\nend", "def status_symbol(status_code = 200)\n Rack::Utils::SYMBOL_TO_STATUS_CODE.invert[status_code]\n end", "def status=(status_string)\n return if status_string.nil? or status_string == ''\n \n status_name, status_time = status_string.split\n self.status_name = status_name.capitalize\n\n unless status_time.nil?\n self.status_time = DateTime.parse(\"#{self.date} #{status_time[0,2]}:#{status_time[2,2]}:00\")\n end\n end", "def status(id)\n http.get(\"/nfse/#{id}/status\") do |response|\n respond_with_entity(response, Entities::NfseStatus)\n end\n end", "def make_id_to_name\n build_hash('id', 'name')\n end", "def normalize_process_status(body)\n return if body['processingStatus'].nil?\n\n processing_status = body['processingStatus']['id']\n TopdeskAPI::Resources::TicketStatus.name(processing_status)\n end", "def to_unified_status\n status = nil\n statues = []\n\n units.each{|u| statues << u.status }\n\n if statues.any? {|s| s == \"Current\"}\n status = \"resident_current\"\n\n elsif statues.any? {|s| s == \"Future\"}\n status = \"resident_future\"\n\n elsif statues.any? {|s| s == \"Past\"}\n status = \"resident_past\"\n\n elsif statues.any? {|s| s == \"Notice\"}\n status = \"resident_notice\"\n\n end\n \n status\n end", "def status_string\n case self.entry_status\n when 1: 'Draft'\n when 2: 'Publish'\n when 4: 'Scheduled'\n end\n end", "def normalize_account_id(id)\n return id if id.to_s.start_with?('act_')\n \"act_#{id}\"\n end", "def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end", "def scode(thing)\n\t\treturn StatusCodes[thing] || ''\n\tend", "def humanize_status\n case role_filling_status\n when 'ccm'\n 'CCM'\n when 'non_ccm'\n 'Nicht-CCM'\n when 'substitute'\n 'Vertretung'\n else\n 'Error: enum symbol is invalid'\n end\n end", "def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end", "def humanize(lower_case_and_underscored_word)\n lower_case_and_underscored_word.to_s.gsub(/_id$/, '').tr('_', ' ').capitalize\n end", "def status=(v)\n @status = alma_string v\n end", "def show_status_label_method\n \"#{self.status}\"\n end", "def status(id)\n get(\"mailers/status/#{id.to_i}\")\n end", "def getStatus id\n\t\tstatus = @tickets.read ['status'], ['id', id]\n\t\tstatus = status[0]['status']\n\tend", "def determine_status_color( status )\n case status\n when 'pending' then return '#cea61b'\n when 'error' then return '#bd2c00'\n when 'success' then return '#6cc644'\n end\nend", "def destroy_translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]\n end", "def status\n if self.status_id && !self.status_id.empty?\n self.status_id\n else\n \"new\"\n end\n end", "def mission_id_to_locale_id(id)\n \"m_#{id}\"\nend", "def generate_name(id)\n return GameData::Item[id].exact_name\n end", "def check_status(status)\n return 'Alive' if status.eql?('200')\n 'Dead'\n end", "def status(status)\n return if status.nil? || status.empty?\n [:id, :created_at, :text, :truncated, :in_reply_to_status_id, :in_reply_to_user_id, :favorited, :in_reply_to_screen_name].each do |key|\n @xml.send(\"#{key}_\", status[key]) if status.key?(key)\n end\n if status.key?(:user)\n node :user do\n user(status[:user])\n end\n end\n if status.key?(:source)\n if status.key?(:source_href)\n node :source do\n @xml.a(status[:source], :href => status[:source_href])\n end\n else\n @xml.source status[:source]\n end\n end\n end", "def find_and_replace_status(key)\n\t\tstatus = sites[:findreplacestatus]\n\t\tstatus[:params][:id] = key\n\t\tget(status)\n\tend", "def translate_lang_code(val)\n t(val.upcase)\n end", "def submission_status_label(status)\n case status\n when 'Queued'\n label_class = 'secondary'\n when 'Submitted'\n label_class = 'info'\n when 'Running'\n label_class = 'primary'\n when 'Done'\n label_class = 'success'\n when 'Aborting'\n label_class = 'warning'\n when 'Aborted'\n label_class = 'danger'\n else\n label_class = 'dark'\n end\n \"<span class='badge badge-#{label_class}'>#{status}</span>\".html_safe\n end", "def oid2name(oid)\n\t\tname = @manager.mib.name(oid)\n\t\tt = [['OID', 'Symbolic Name'], [\"#{oid}\", \"#{name}\"]]\n\t\ttable = t.to_table(:first_row_is_head => true)\n\t\tputs table.to_s\n\tend", "def humanize(lower_case_and_underscored_word)\n lower_case_and_underscored_word.to_s.gsub(/_id$/, \"\").gsub(/_/, \" \").capitalize\n end", "def status_text\n t(IMPORTING_STATUS[status])\n end" ]
[ "0.71683586", "0.69419134", "0.6776753", "0.6695358", "0.6592659", "0.6433393", "0.6316047", "0.6299464", "0.6212713", "0.61991763", "0.6151669", "0.6131283", "0.6121865", "0.60478914", "0.6042841", "0.60187316", "0.6017905", "0.59993637", "0.59964067", "0.59769756", "0.5959333", "0.5899795", "0.5885478", "0.5874468", "0.5866656", "0.585745", "0.58106095", "0.57943225", "0.57943225", "0.5730093", "0.5717873", "0.57035834", "0.57009774", "0.5680578", "0.5666036", "0.5647596", "0.56044006", "0.5602955", "0.5574414", "0.5560055", "0.5553707", "0.5534199", "0.55231255", "0.5513348", "0.54948425", "0.54877084", "0.5474443", "0.5467855", "0.54618216", "0.5452381", "0.54480696", "0.5442838", "0.5431376", "0.5427064", "0.5410891", "0.5410891", "0.5410891", "0.5410891", "0.53826666", "0.5372398", "0.5344", "0.5332612", "0.5318695", "0.5296465", "0.5296465", "0.5282581", "0.52568346", "0.5249687", "0.5249687", "0.5242732", "0.5237676", "0.52303255", "0.5221622", "0.52064043", "0.5205735", "0.52040756", "0.52033126", "0.5191321", "0.5178121", "0.51771206", "0.5175349", "0.51721346", "0.5170836", "0.5161199", "0.5127207", "0.51241386", "0.5120934", "0.5100868", "0.5069027", "0.50685114", "0.5068019", "0.50668657", "0.5064411", "0.5063638", "0.50616074", "0.5053749", "0.5048108", "0.5042352", "0.50330496", "0.5031711" ]
0.5483702
46
Translates a milestoneid into its milestonename equivalent.
def milestone_string number milestone_translation.each do |hash| if hash['id'] == number return hash['title'] end end 'Unknown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestone_name\n milestone ? milestone.name : 'None'\n end", "def milestone(project, id)\n get(\"/projects/#{url_encode project}/milestones/#{id}\")\n end", "def mission_id_to_locale_id(id)\n \"m_#{id}\"\nend", "def group_milestone(id, milestone_id)\n get(\"/groups/#{url_encode id}/milestones/#{milestone_id}\")\n end", "def milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n _normalize_params_keys(params)\n\n get(\"/repos/#{user}/#{repo}/milestones/#{milestone_id}\", params)\n end", "def milestone\n @client.milestone(project_id , milestone_id)\n end", "def milestones(project_id, find = 'all')\n records \"milestone\", \"/projects/#{project_id}/milestones/list\", :find => find\n end", "def milestones(project_id, find=\"all\")\n records \"milestone\", \"/projects/#{project_id}/milestones/list\", :find => find\n end", "def create_milestone(project_id, data)\n create_milestones(project_id, [data]).first\n end", "def create_milestone(project_id, data)\n create_milestones(project_id, [data]).first\n end", "def set_project_phase_milestone\n @project_phase_milestone = Project::Phase::Milestone.find(params[:id])\n end", "def set_milestone\r\n @milestone = Milestone.find(params[:id])\r\n end", "def uncomplete_milestone(id)\n record \"/milestones/uncomplete/#{id}\"\n end", "def uncomplete_milestone(id)\n record \"/milestones/uncomplete/#{id}\"\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def name(id)\n @id_to_name[id]\n end", "def set_milestone\n @milestone = @appointment.milestones.find(params[:id])\n end", "def complete_milestone(id)\n record \"/milestones/complete/#{id}\"\n end", "def complete_milestone(id)\n record \"/milestones/complete/#{id}\"\n end", "def get_milestones(id, opts = {})\n data, status_code, headers = get_milestones_with_http_info(id, opts)\n return data\n end", "def convert_project_lifecycle_text_to_id\n end", "def convert_project_lifecycle_text_to_id\n end", "def getMilestone(response)\r\n\t\t\t\tmilestones_json = JSON.parse response\r\n\t\t\t\tmilestones_array = milestones_json[\"milestones\"]\r\n\t\t\t\treturn jsonToMilestone(milestones_array[0])\r\n\t\t\tend", "def delete_milestone(project, id)\n delete(\"/projects/#{url_encode project}/milestones/#{id}\")\n end", "def get_map_name(id=\"map\")\n return \"lh_#{id}\"\n end", "def claim_iid\n # The milestone has to be a group milestone, as it's the only case where\n # we set the IID as the maximum. The rest of them are fixed.\n milestone = @project.milestones.find_by(iid: @attributes['iid'])\n\n return unless milestone\n\n milestone.iid = nil\n milestone.ensure_project_iid!\n milestone.save!\n end", "def create_group_milestone(id, title, options = {})\n body = { title: title }.merge(options)\n post(\"/groups/#{url_encode id}/milestones\", body: body)\n end", "def id2name() end", "def id2name() end", "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def delete_milestone(id)\n record \"/milestones/delete/#{id}\"\n end", "def delete_milestone(id)\n record \"/milestones/delete/#{id}\"\n end", "def map_name(id)\n (load_data(\"Data/MapInfos.rvdata2\").find { |map| map[1].parent_id = id })[1].name\n end", "def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end", "def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end", "def get_milestone\n blocks = self.blocks_get_milestone\n if blocks[\"success\"]\n return blocks[\"milestone\"]\n else\n return nil\n end\n end", "def platform_id_remap(id)\n # this catches the centos guest shell in the nexus switch which identifies itself as centos\n return \"nexus_centos\" if id == \"centos\" && os_release_file_is_cisco?\n\n PLATFORM_ID_MAP[id.downcase] || id.downcase\n end", "def ensure_milestone(repository, milestone)\n mappings = milestone.delete(\"mappings\") { [] }\n all = github.milestones(repository)\n\n current = all.select { |cur| cur[:title] == milestone[\"name\"] }.first\n new = current\n\n if current.nil?\n new = github.create_milestone(repository, milestone[\"name\"], description: milestone[\"description\"])\n puts \" Successfully added milestone\"\n else\n unless current[:title] == milestone[\"name\"] && current[:description] == milestone[\"description\"]\n github.update_milestone(repository, current[:number], title: milestone[\"name\"], description: milestone[\"description\"])\n puts \"Updated milestone\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:title] == previous }\n previous_number = all.select { |l| l[:title] == previous }.first[:number]\n\n count = 0\n issues_with(repository, \"milestone\", previous) do |issue|\n puts \" Setting milestone on issue #{issue}\"\n github.update_issue(repository, issue, milestone: new[:number])\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"milestone\", previous)\n if remaining.empty? || remaining.length == count\n puts \" Deleting milestone '#{previous}' from #{repository}\"\n github.delete_milestone(repository, previous_number)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' milestone has no tickets assigned (or rerun this command in a few minutes time)\"\n end\n end\nend", "def getMilestone\r\n\t\t\t\t\treturn @milestone\r\n\t\t\t\tend", "def get_library_member_name_by_id(target_id)\n\t\tif target_id.to_i< 0 then\n\t\t\treturn \"--\"\n\t\tend\n\t\[email protected] do |member|\n\t\t\tif member.mem_id == target_id.to_i then\n\t\t\t\treturn member.mem_name\n\t\t\t\t\n\t\t\tend\n\t\tend\n\tend", "def group_milestone_issues(id, milestone_id, options = {})\n get(\"/groups/#{url_encode id}/milestones/#{milestone_id}/issues\", query: options)\n end", "def ensure_milestone(repository, milestone)\n mappings = milestone.delete(\"mappings\") { [] }\n all = github.milestones(repository)\n\n current = all.select { |cur| cur[:title] == milestone[\"name\"]}.first\n new = current\n\n if current.nil?\n new = github.create_milestone(repository, milestone[\"name\"], description: milestone[\"description\"])\n puts \"Successfully added milestone\"\n else\n unless current[:title] == milestone[\"name\"] && current[:description] == milestone[\"description\"]\n github.update_milestone(repository, current[:number], title: milestone[\"name\"], description: milestone[\"description\"])\n puts \"Updated milestone\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:title] == previous }\n previous_number = all.select { |l| l[:title] == previous }.first[:number]\n\n count = 0\n issues_with(repository, \"milestone\", previous) do |issue|\n puts \"Setting milestone on issue #{issue}\"\n github.update_issue(repository, issue, milestone: new[:number])\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"milestone\", previous)\n if remaining.empty? || remaining.length == count\n puts \"Deleting milestone '#{previous}' from #{repository}\"\n github.delete_milestone(repository, previous_number)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' milestone has no tickets assigned (or rerun this script in a few minutes time)\"\n end\n end\nend", "def update_milestone(id, data, move = false, move_off_weekends = false)\n record \"/milestones/update/#{id}\", :milestone => data,\n :move_upcoming_milestones => move,\n :move_upcoming_milestones_off_weekends => move_off_weekends\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def update_milestone(id, data, move=false, move_off_weekends=false)\n record \"/milestones/update/#{id}\", :milestone => data,\n :move_upcoming_milestones => move,\n :move_upcoming_milestones_off_weekends => move_off_weekends\n end", "def as_milestone(xml)\n xml.milestone(lifecycle,\n date: milestone_date,\n version:)\n end", "def get_milestones_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_milestones ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_milestones\" if id.nil?\n \n # resource path\n path = \"/Projects/{id}/Milestones\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APIMilestone>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_milestones\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def normalise_defined_name(name) # :nodoc:\n name.sub(/^_xlnm./, '').downcase\n end", "def labels_for_milestone(repo, number, options = {})\n paginate \"#{Repository.path repo}/milestones/#{number}/labels\", options\n end", "def rename_chr(chr)\n chr_id = { \"gi|366157031\" => 4,\n \"gi|366157028\" => 2,\n \"gi|366157039\" => 12,\n \"gi|366157038\" => 11,\n \"gi|366157037\" => 10,\n \"gi|366157036\" => 9,\n \"gi|366157035\" => 8,\n \"gi|366157034\" => 7,\n \"gi|366157033\" => 6,\n \"gi|366157032\" => 5,\n \"gi|366157030\" => 3,\n \"gi|366157029\" => 1 }\n id = /^(?<name>gi\\|\\d{9})/.match(chr)[:name]\n new_chr = chr_id[id]\n new_chr\nend", "def target_name(id)\n case id\n when -2; Vocab::LastTarget\n when -1; Vocab::RandomTarget;\n else; sprintf(Vocab::Target, id+1); end\n end", "def month_name(number); end", "def update_milestone_with_http_info(id, api_milestone, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#update_milestone ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling update_milestone\" if id.nil?\n \n # verify the required parameter 'api_milestone' is set\n fail \"Missing the required parameter 'api_milestone' when calling update_milestone\" if api_milestone.nil?\n \n # resource path\n path = \"/Projects/{id}/Milestones\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_milestone)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'APIMilestone')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#update_milestone\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_milestone_with_http_info(id, api_milestone, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#add_milestone ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling add_milestone\" if id.nil?\n \n # verify the required parameter 'api_milestone' is set\n fail \"Missing the required parameter 'api_milestone' when calling add_milestone\" if api_milestone.nil?\n \n # resource path\n path = \"/Projects/{id}/Milestones\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_milestone)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'APIMilestone')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#add_milestone\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def jsonToMilestone(jsonObject)\r\n\t\t\t\tmilestone = Milestone.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tmilestone.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tmilestone.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date\")\r\n\t\t\t\t\tmilestone.setStartDate(jsonObject[\"start_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_format\")\r\n\t\t\t\t\tmilestone.setStartDateFormat(jsonObject[\"start_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_long\")\r\n\t\t\t\t\tmilestone.setStartDateLong(jsonObject[\"start_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date\")\r\n\t\t\t\t\tmilestone.setEndDate(jsonObject[\"end_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_format\")\r\n\t\t\t\t\tmilestone.setEndDateFormat(jsonObject[\"end_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_long\")\r\n\t\t\t\t\tmilestone.setEndDateLong(jsonObject[\"end_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"status\")\r\n\t\t\t\t\tmilestone.setStatus(jsonObject[\"status\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"flag\")\r\n\t\t\t\t\tmilestone.setFlag(jsonObject[\"flag\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_id\")\r\n\t\t\t\t\tmilestone.setOwnerId(jsonObject[\"owner_id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_name\")\r\n\t\t\t\t\tmilestone.setOwnerName(jsonObject[\"owner_name\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tmilestone.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif link.has_key?(\"status\")\r\n\t\t\t\t\t\tmilestone.setStatusURL(link[\"status\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn milestone\r\n\t\t\tend", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def update_milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_MILESTONE_INPUTS, params)\n _validate_inputs(%w[ title ], params)\n\n patch(\"/repos/#{user}/#{repo}/milestones/#{milestone_id}\", params)\n end", "def create\n @milestone = @project.milestones.build(milestone_params)\n\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to @project,\n notice: 'Milestone was successfully created.' }\n format.json { render :show, status: :created, location: @milestone }\n else\n format.html { render :new }\n format.json { render json: @milestone.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def milestone_params\n params.require(:milestone).permit(:project_id, :milestone,\n :release_date, :name)\n end", "def normalize_friendly_id(string)\n name\n end", "def number_to_short_month_name(number)\n sliced_month_name = number_to_full_month_name(number).slice(0,3)\n return sliced_month_name\nend", "def delete_milestone_with_http_info(id, milestone_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#delete_milestone ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling delete_milestone\" if id.nil?\n \n # verify the required parameter 'milestone_id' is set\n fail \"Missing the required parameter 'milestone_id' when calling delete_milestone\" if milestone_id.nil?\n \n # resource path\n path = \"/Projects/{id}/Milestones/{milestoneId}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s).sub('{' + 'milestoneId' + '}', milestone_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#delete_milestone\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n project = @milestone.project\n milestone_owner = User.find_by(id: project.user_id)\n\n #Alerts leader if a milestone is reached. Needs testing or way to \"complete\" milestone.\n if !params[:milestone][:success_id].nil?\n milestone_owner.notify(\"alert\", \"Milestone #{view_context.link_to @milestone.name, @milestone} was \n completed in #{view_context.link_to @milestone.project.title, @project}\")\n end\n\n respond_to do |format|\n if @milestone.update_attributes(milestone_params)\n format.html { redirect_to @milestone.project, notice: 'Milestone was successfully created.' }\n format.json { respond_with_bip(@milestone) }\n else\n format.html { redirect_to @milestone.project, alert: @milestone.errors.full_messages.to_sentence }\n format.json {respond_with_bip(@milestone) }\n end\n end\n end", "def update(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n\n normalize! params\n filter! VALID_MILESTONE_INPUTS, params\n assert_required_keys(%w[ name ], params)\n\n put_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}\", params)\n end", "def revert_to_milestone(n)\n verify_milestone_exists n\n self.revert_to self.milestones[n.to_i-1].version\n end", "def get(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n normalize! params\n\n get_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}\", params)\n end", "def setMilestone(milestone)\r\n\t\t\t\t\t@milestone = milestone\r\n\t\t\t\tend", "def inject_milestone_id_into_params\n if (task = params[:task]) and task[:milestone_id]\n params[:milestone_id] ||= task[:milestone_id]\n end\n end", "def foe_name(id, event)\n return Vocab::AllEnemies if id == -1\n sprintf(Vocab::Enemy, id + 1, event.troop.empty? ? \"\" : enemy_name(event.troop[id].enemy_id, false))\n end", "def number_to_short_month_name(month_number)\n result = number_to_full_month_name(month_number)\n return result[0,3]\nend", "def milestones\n Sifter.\n get(api_milestones_url).\n fetch(\"milestones\", []).\n map { |m| Sifter::Milestone.new(m) }\n end", "def milestones\n Sifter.\n get(api_milestones_url).\n fetch(\"milestones\", []).\n map { |m| Sifter::Milestone.new(m) }\n end", "def milestone entries: entries\n entries.reverse.each do |en|\n desc = en['description']\n if desc.match( DYNAMIC_FINISH_LINE ) or\n desc.match( NUMBER_APPEARS )\n return $1.to_i\n end\n end\n nil\n end", "def id_to_name!\n @id_to_name = make_id_to_name\n self\n end", "def set_project_phase_milestone_note\n @project_phase_milestone_note = Project::Phase::Milestone::Note.find(params[:id])\n end", "def location_name(id)\n @acpl_cache.fetch(id) { |id| fetch_new_acpl(id) || id }\n end", "def number_to_short_month_name(month_number)\n short_month = number_to_full_month_name(month_number)\n return short_month[0..2]\nend", "def number_to_full_month_name(number)\n month_name = case number\n when 1\n \"January\"\n when 2\n \"February\"\n when 3\n \"March\"\n when 11\n \"November\"\n end\n return month_name\nend", "def milestone_part(project_id)\n throw_content :sidebar, part(MilestonePart => :index, :project_id => project_id)\n end", "def month_name(num)\n\tmonths = {\n\t\t1 => 'January',\n\t\t2 => 'February',\n\t\t3 => 'March',\n\t\t4 => 'April',\n\t\t5 => 'May',\n\t\t6 => 'June',\n\t\t7 => 'July',\n\t\t8 => 'August',\n\t\t9 => 'September',\n\t\t10 => 'October',\n\t\t11 => 'November',\n\t\t12 => 'December',\n\t}\n\treturn months[num]\nend", "def get_milestones_by_system_id_and_poam_id_andf_milestone_id(system_id, poam_id, milestone_id, opts = {})\n data, _status_code, _headers = get_milestones_by_system_id_and_poam_id_andf_milestone_id_with_http_info(system_id, poam_id, milestone_id, opts)\n data\n end", "def find_object(project, id)\n find_milestone_with_finder(project, id: id)\n end", "def find_team_marker(piece_team)\n if piece_team == :none\n \"0\"\n else\n piece_team.to_s[0].upcase\n end\n end", "def delete_milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n _normalize_params_keys(params)\n\n delete(\"/repos/#{user}/#{repo}/milestones/#{milestone_id}\", params)\n end", "def normalize_locality(locality)\n return locality.gsub!(/[^0-9A-Za-z.\\-]/, '_')\n end", "def human_to_name; end", "def milestone_params\r\n params.require(:milestone).permit(\r\n :name,\r\n :description,\r\n :project_id,\r\n :gitlab_id,\r\n :is_existing_on_gitlab,\r\n )\r\n end", "def masculine_name; end", "def get_topic_name(id)\n @topic_map[id]\n end", "def number_to_full_month_name(month_number)\n return Date::MONTHNAMES[month_number]\nend", "def project_identifier(p, length=26)\n truncate([p.shortname, p.description].join(\" - \"), :length => length)\n end", "def milestone_params\n params.require(:milestone).permit(:name, :description, :date_begin, :date_end, :user_id, :asociative_user_id)\n end", "def number_to_short_month_name(num)\n month = number_to_full_month_name(num)\n return month [0..2]\nend", "def number_to_short_month_name(month)\n short_name = number_to_full_month_name(month)\n return short_name.slice(0,3)\nend", "def project_labels(tracker_project_id)\n tracker_project = PivotalTracker::Project.find tracker_project_id\n tracker_project.stories.all.select{|s| !s.labels.nil?}.collect{|s| Unicode.downcase(s.labels) }.join(',').split(',').uniq # ugly code but works fine\n end", "def number_to_full_month_name(month)\n case month\n when 1\n month = \"January\"\n when 2\n month = \"February\"\n when 3\n month = \"March\"\n when 4\n month = \"April\"\n when 5\n month = \"May\"\n when 6\n month = \"June\"\n when 7\n month = \"July\"\n when 8\n month = \"August\"\n when 9\n month = \"September\"\n when 10\n month = \"October\"\n when 11\n month = \"November\"\n when 12\n month = \"December\"\n end\nreturn month\nend", "def number_to_short_month_name(n)\n short_month_string = number_to_full_month_name(n)[0..2]\nend" ]
[ "0.6928679", "0.6254726", "0.6254099", "0.61892503", "0.5767911", "0.5595989", "0.55171436", "0.5505468", "0.5481009", "0.5481009", "0.54305774", "0.53850824", "0.53814155", "0.53814155", "0.53612965", "0.53612965", "0.53612965", "0.53075343", "0.5302446", "0.52898306", "0.52898306", "0.5218645", "0.52026135", "0.52026135", "0.51627517", "0.51512444", "0.51210237", "0.5102975", "0.50917536", "0.5084777", "0.5084777", "0.50664365", "0.50663215", "0.50663215", "0.5065383", "0.5061517", "0.5061517", "0.5020043", "0.498055", "0.49673113", "0.49520174", "0.4944125", "0.49436444", "0.49366486", "0.49157318", "0.4913065", "0.49109927", "0.4905426", "0.48799855", "0.48764053", "0.48627424", "0.4857377", "0.48544058", "0.4853386", "0.48509192", "0.48506048", "0.48370048", "0.48314095", "0.48044538", "0.48002034", "0.4797413", "0.47820976", "0.4768413", "0.47655684", "0.47653612", "0.47532386", "0.47532102", "0.47509578", "0.47467986", "0.47452566", "0.47422647", "0.47375387", "0.47355634", "0.47340637", "0.47340637", "0.47297332", "0.4728848", "0.47136107", "0.4710381", "0.4706713", "0.4702992", "0.47021666", "0.4693028", "0.46927464", "0.46812215", "0.46772537", "0.4662047", "0.46519333", "0.4647318", "0.4643192", "0.4638436", "0.4626373", "0.46225575", "0.46176687", "0.4608952", "0.46084562", "0.46047157", "0.46009713", "0.45940623", "0.45862037" ]
0.69942707
0
You may (and should) use the substrings method you wrote in the previous exercise. For the purposes of this exercise, you should consider all characters and pay attention to case; that is, "AbcbA" is a palindrome, but neither "Abcba" nor "AbcbA" are. In addition, assume that single characters are not palindromes. input: string output: string only palindromic substrings iterate through the array created by substrings method in previous exercise. If string == string.reverse, add to output
def substrings(string) result = [] 0.upto(string.size-1) do |index1| index1.upto(string.size-1) do |index2| result << string[index1..index2] end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromes(string)\n array = substrings(string)\n array.select { |sub| sub == sub.reverse }\nend", "def palindromes(str)\n palindromic_substrings = []\n\n substrings = substrings(str)\n puts substrings\n\n substrings.each do |substr|\n palindromic_substrings << str if str == str.reverse\n end\n\n puts palindromic_substrings\n palindromic_substrings\nend", "def palindromes(string)\n all_substrings = all_substrings(string)\n palindromes = []\n all_substrings.each do |substring|\n palindromes << substring if substring == substring.reverse && substring.length > 1\n end\n palindromes\nend", "def palindromes(string)\n result = []\n all_substrings = substrings(string)\n all_substrings.each do |item|\n result << item if item.size > 1 && item == item.reverse\n end\n result\nend", "def palindromes(string) \n test_substrings = substrings(string)\n test_substrings.select do |substring|\n substring.length > 1 && substring.downcase.gsub(/[^A-Z0-9]/i, '') == substring.downcase.gsub(/[^A-Z0-9]/i, '').reverse\n end\nend", "def palindromes(string)\n results = substrings(string)\n results.select {|substring| substring == substring.reverse && substring.length > 1}\nend", "def palindromes(str)\n result = []\n array = substrings(str)\n array.each do |char|\n result << char if char.reverse == char && char.size > 1\n end\n result\nend", "def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend", "def palindrome_substrings(string)\n\nend", "def palindrome_substrings(string)\narray = substrings(string)\npalindromes = []\n\n array.each do |ele|\n if palindrome?(ele) == true && ele.length > 1\n palindromes << ele\n end\nend\npalindromes\nend", "def palindromes(string)\n all_substrings = substrings(string)\n results = []\n all_substrings.each do |substring|\n results << substring if palindrome?(substring)\n end\n results\nend", "def palindrome(str)\n sub_arr = substrings(str)\n new_arr = []\n sub_arr.each do |word|\n new_arr << word if word == word.reverse\n end\n new_arr\nend", "def palindromes(string)\n substrings(string).select { |el| el.length > 1 && el == el.reverse && el.match(/[a-zA-Z1-9]/) }\nend", "def palindromes(str)\n substrings(str).select do |el|\n el == el.reverse && el.size > 1\n end\nend", "def palindrome_substrings(str)\n result = []\n substrings_arr = substrings(str)\n substrings_arr.each do |substring|\n result << substring if is_palindrome?(substring)\n end\n result\nend", "def palindrome_substrings(str)\r\n result = []\r\n substrings_arr = substrings(str)\r\n substrings_arr.each do |substring|\r\n result << substring if is_palindrome?(substring)\r\n end\r\n result\r\nend", "def palindromes_further_explore(str)\n new_str = str.downcase.gsub(/[^a-z0-9]/,\"\")\n substrings(new_str).select do |el|\n el == el.reverse && el.size > 1\n end\nend", "def palindrome_substrings(str)\n palSub = []\n subStr = substrings(str)\n\n subStr.each do |ele|\n if palindrome?(ele) && ele.length > 1\n palSub << ele\n end\n end\n\n return palSub\n\nend", "def str_palindromes(str)\n arr_palindromes = arr_all_possible_substrings(str).select { |substr| palindrome?(substr)}\nend", "def is_palindrome(string)\n split_string_array = string.downcase.split(\"\")\n words_array = split_string_array.select{|letter| letter[/[a-z]/]}\n\n reverse_words_array = []\n x = 0\n length = words_array.length\n until words_array[x] == nil\n reverse_words_array << words_array[length -(x+1)]\n x += 1\n end\n\n return reverse_words_array == words_array ? true : false\n\nend", "def is_palindrome(string)\n\n string.upcase!\n # this only allows alphabetic characters\n string.gsub!(/[^A-Z]/, \"\")\n\n str_array = string.chars\n\n index = str_array.length - 1\n reversed = []\n\n while index >= 0\n reversed << str_array[index]\n index -= 1\n end\n\n if reversed == str_array\n return true\n else \n return false \n end\n\nend", "def palindromes(str)\n substrings = substrings(str)\n substrings.select do |substring|\n palindrome?(substring)\n end\nend", "def palindromes(word)\n substrings(word).select { |word| word == word.reverse && word.length > 1 }\nend", "def is_palindrome(string)\n array = string.chars\n orginal_char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n \n char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n length = char_array.length\n first_index = 0\n last_index = length -1\n while first_index < last_index\n temp = char_array[first_index]\n char_array[first_index] = char_array[last_index]\n char_array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n \n if char_array.join.upcase == orginal_char_array.join.upcase\n return true\n else\n return false\n end\nend", "def palindrome_substrings(str)\n substrings(str).select {|sub| sub if sub.length > 1 && palindrome?(sub)}\nend", "def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend", "def palindrome?(string)\n newRevString = \"\"\n idx = string.length-1\n while idx >= 0\n newRevString = newRevString + string[idx]\n idx = idx - 1\n end\n return newRevString==string\nend", "def find_palindromes_right(s)\n outarray = []\n for x in (0..(s.length-1))\n outarray[x] = 1\n end\n for y in (s.length-1).downto(0)\n if matches = s.indexes(s[y])\n matches.each do |x|\n test_string = s[x..y]\n #puts \"x=#{x}, y=#{y}, substring = \\\"#{test_string}\\\"\"\n if test_string.palindrome?\n #puts \"Found palindrome: \\\"#{test_string}\\\"\"\n outarray[y] = test_string.length\n # Note that I will always find a palindrome at s[y..y] so x won't pass y\n break\n end\n end\n end\n end\n outarray\nend", "def palindromes(str)\n results = []\n 1.upto(str.length) do |idx|\n str.chars.each_cons(idx)\n .each {|subr| results << subr.join if subr.size > 1 && subr == subr.reverse}\n end\n results.sort \nend", "def palindrome(string)\n word_array = string.split(\"\")\n\n word_array.each_with_index do |letter,index|\n if letter[index] == letter[-index]\n return true\n end\n end\n end", "def palindrome_substrings(string)\n ss = substrings(string)\n results = ss.select do |ele|\n palindrome?(ele) && ele.length > 1\n end \n results \nend", "def palindrome?(string)\n chars_arr = string.chars\n new_arr = []\n chars_arr.each { |substring| new_arr.prepend(substring) }\n new_arr.join == string\nend", "def palindrome?(string)\n array = string.chars\n string.chars == array.reverse\nend", "def palindrome_string_arr(char)\n char[0..-1] == char[0..-1].reverse\nend", "def palindrome_substrings(str)\n result = []\n\n all_substrings = substrings(str)\n all_substrings.select {|substring| substring.length > 1 && palindrome?(substring)}\nend", "def palindrome?(string)\n reversed_string = ''\n i = -1\n loop do \n reversed_string << string[i]\n i -= 1\n break if i < -string.length\n end\n reversed_string == string\nend", "def palindrome (string)\n\n if string.reverse == string\n return true\n else\n return false\n end\n \nend", "def palindrome (input_string)\n input_string == input_string.reverse\nend", "def is_palindrome(string)\n\n concate_array = string.downcase.split(\"\")\n backwards = \"\"\n concate_array_no_punc = \"\"\n\n concate_array.length.times do |i|\n if [\":\",\",\",\" \"].include?(concate_array[-1-i])\n nil \n else \n backwards += concate_array[-1-i]\n end\n\n if [\":\",\",\",\" \"].include?(concate_array[i])\n nil \n else \n concate_array_no_punc += concate_array[i]\n end\n end\n\n if backwards == concate_array_no_punc\n return true\n else \n return false\n end\nend", "def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend", "def palindrome?(str)\n new_arry = []\n index = 1\n while index <= str.size\n new_arry << str[-index]\n index += 1\n end\n new_arry.join == str\nend", "def palindrome?(str)\n new_arry = []\n index = 1\n while index <= str.size\n new_arry << str[-index]\n index += 1\n end\n new_arry.join == str\nend", "def is_palindrome(string)\n array = string.gsub((/(?i)[^a-z]/),\"\").downcase.chars\n array_length = array.length - 1\n \n array.each_with_index do |letter,index|\n return false if letter != array[array_length - index]\n end\n\n return true\nend", "def palindrome_permutation(string)\n # new_string = string.gsub(/\\s+/, \"\")\n # p new_string.length\n # permutation = new_string.chars\n # p \n\n\n # if new_string.length % 2 != 0\n # puts \"True. permutation\"\n # end\n\n # pal_split = string.split\n\n # pal0_split = pal_split[0].chars\n # removed_last_letter = pal0_split.pop\n # word_one = pal0_split.join\n # if word_one == pal_split[1].reverse\n # puts \"True permutations \"\n # else\n # puts \"no\"\n # end\n\n new_string = string.gsub(/\\s+/, \"\")\n reversed_word = new_string.reverse\n if new_string == reversed_word\n puts \"true.\"\n else \n puts \"false\"\n end \nend", "def palindrome?(str)\n regex = /[a-zA-Z]/\n newString = ''\n \n str.split(\"\").each do |i|\n if i =~ regex\n newString.concat(i)\n end\n end\n \n newString = newString.downcase\n \n if newString == newString.reverse\n return true\n else\n return false\n end\nend", "def is_palindrome(string)\n joined_str = string.gsub(/[^0-9a-z]/i, '').downcase\n reverse_str = reverser(joined_str.clone)\n difference_count = 0\n joined_str.length.times do |i|\n difference_count += 1 if joined_str[i] != reverse_str[i]\n end\n\n if difference_count != 0\n return false\n else\n return true\n end\n\nend", "def palindrome?(string)\n reversed = string.reverse\n counter = 0\n while counter < string.length\n if string[counter] != reversed[counter]\n return false\n end\n counter += 1\n end\n return true\nend", "def is_palindrome(str)\n # check for and handle wonky inputs\n if !str.is_a?(String)\n puts \"Whoops: Input str must be a string.\"\n return\n end\n\n # nix case sensitivity by converting to lowercase\n # represent str as an array of letters\n str_array = str.downcase.split(//)\n\n # compare forwards and backwards\n if str_array == str_array.reverse\n return true\n end\n\n # if all else fails\n return false\n\nend", "def palindrome?(string)\n array = string.split('')\n return true if array == array.reverse\n false\nend", "def palindrome_r(string)\n return true if string.length == 1 || string.length == 0\n string = string.strip.scan(/\\w+/).join.downcase\n return false if string[0] != string[-1]\n palindrome_r(string[1..-2])\nend", "def palindrome?(string)\n \n begin_index = 0\n end_index = string.length - 1\n \n if string.length == 1\n return true\n end\n \n while begin_index < end_index || begin_index != end_index\n if string[begin_index] == string[end_index]\n begin_index += 1\n end_index -= 1\n palindrome = true\n else\n begin_index = end_index\n palindrome = false\n end\n end\n return palindrome\n \nend", "def palindrome(string)\n string.downcase.split(/\\W+/).join('') == string.downcase.split(/\\W+/).join('').reverse\nend", "def Palindrome?(string)\n if string.length < 3\n \treturn false\n end\n new_input = string.scan(/[a-zA-Z]/).join\n input_length = new_input.length\n stringA = new_input.slice!(0, input_length/2.floor).downcase\n stringB = input_length % 2 == 0? new_input.downcase.reverse : new_input.slice(1, new_input.length - 1).downcase.reverse\n return stringA == stringB\nend", "def is_palindrome(s)\n new_str = \"\"\n \n s.each_char do |char|\n new_str << char.downcase if char.downcase != char.upcase || char == char.to_i.to_s\n end\n \n front_idx = 0\n back_idx = new_str.length - 1\n \n until front_idx > back_idx\n return false if new_str[front_idx] != new_str[back_idx]\n front_idx += 1\n back_idx -= 1\n end\n true\nend", "def palindrome?(pal_str)\n char_list = pal_str.split\n reverse_list = Array.new\n char_list.length.times do\n reverse_list.push(char_list.pop) unless char_list == []\n end\n reversed_string = reverse_list.join('')\n true if pal_str == reversed_string\nend", "def is_palindrome(word) # define method with one parameter\n i = 0 # set i to zero for first index value is 0\n reversed_string = \"\" # create empty string to store concatenated string\n \n while i < word.length # run while loop as long as word length is greater than i value which increments by one\n char = word[i] # this stores each iteration of string characters\n reversed_string = char + reversed_string # this concatenates string characters in reverse order\n i +=1 # raises increment by one \n end # end loop\n return reversed_string == word # if statement that evaluates whether new string equals original\nend", "def palindrome?(string)\n string.chars.reverse.join == string\nend", "def palindrome(string)\n result = []\n new_string = string.chars\n\n loop do\n result << new_string.pop\n break if new_string.size == 0\n end\n result.join\nend", "def isPalindrome(string)\n return string.reverse == string\nend", "def is_palindrome(s)\n return true if s.empty?\n return false if s[0] != s[-1]\n return is_palindrome(s[1...-1])\n \n # To do this without creating new strings, make a helper method\n # that accepts additional parameters for left_char and right_char and increments\n # them inward each time, like I did for reverse_in_place with helper_reverse\nend", "def find_palindromes_left(s)\n outarray = []\n for x in (0..(s.length-1))\n outarray[x] = 1\n end\n for x in (0..(s.length-1))\n if matches = s.indexes(s[x])\n matches.reverse.each do |y|\n test_string = s[x..y]\n #puts \"x=#{x}, y=#{y}, substring = \\\"#{test_string}\\\"\"\n if test_string.palindrome?\n #puts \"Found palindrome: \\\"#{test_string}\\\"\"\n outarray[x] = test_string.length\n # Note that I will always find a palindrome at s[x..x] so y won't pass x\n break\n end\n end\n end\n end\n outarray\nend", "def palindrome string\n if string.downcase == string.downcase.reverse\n \"#{string} is a palindrome\"\n else\n \"#{string} is not a palindrome\"\n end\nend", "def palindrome_arr_str?(input)\n return input == input.reverse\nend", "def palindrome(string)\n if string.length == 1 || string.length == 0\n true\n elsif string[0] == string[-1]\n palindrome(string[1..-2])\n else\n false\n end\nend", "def palindrome string\n if string == string.reverse\n \"#{string} is a palindrome!\"\n else \n \"#{string} is not a palindrome\"\n end \nend", "def PalindromeTwo(str)\n backword_string = str.gsub(/[^a-zA-Z]/,\"\").downcase.reverse\n backword_string == str.gsub(/[^a-zA-Z]/,\"\").split(//).join.downcase ? puts(\"true\") : puts(\"false\")\nend", "def real_palindrome?(string)\n string.downcase!\n if string == string.reverse\n p true\n else\n p false\n end\nend", "def palindrome(str)\n if str.reverse == str\n puts true\n else\n puts 'not palindrome'\n end\nend", "def palindrome_permutation str\n str_1 = str.downcase.chars.sort.join\n str_2 = str.downcase.chars.sort.join.reverse\n length = str.length\n for i in 0..length/2\n return false if str_1[i] != str_2[length-i-1]\n end\n return true\nend", "def is_palindrome(string)\n # raise NotImplementedError, \"Not implemented yet\"\n array = convert_string_array(string)\n start_ind = 0\n end_ind = array.size - 1\n\n while start_ind < end_ind\n if array[start_ind] != array[end_ind]\n return false\n end\n\n start_ind += 1\n end_ind -= 1\n end\n\n return true\nend", "def palindrome('')\n if string == string.reverse\n return true\n else\n puts \"String is not a palindrome\"\n end\nend", "def pal_test(string)\n# Create conditional statement if string == string.reverse.capitalize, the accessors will reverse the string and then capitalize the new first index\n# Included an || to the if conditional statement because I didn't account for the capitalization initially and the method can now be used for lowercase words as well\n if string == string.reverse.capitalize || string == string.reverse\n \"#{string} is a palindrome\"\n# Use string interpolation to give the output statement\n else string != string.reverse\n \"#{string} is not a palindrome\"\n end\n# Use a bang operator to return the opposite statement for when the string is not a palindrome\nend", "def real_palindrome?(str)\n str.downcase!\n arr = [*'0'..'9', *'a'..'z']\n str = str.chars.select { |x| arr.include?(x) }\n str == str.reverse\nend", "def palindrome?( string )\n word = string.downcase.gsub(/[^a-z]/, '')\n if word == word.reverse\n return true\n else\n return false\n end\nend", "def real_palindrome?(string)\n new_string = string.downcase.chars.delete_if { |element| !/[a-zA-Z0-9]/.match?(element)}.join\n new_string == new_string.reverse\nend", "def palindrome_check(my_phrase)\r\n string_fixed = my_phrase.split.join\r\n first_position = 0\r\n last_position = string_fixed.length - 1\r\n\r\n while first_position != last_position\r\n\r\n case\r\n when string_fixed[first_position] != string_fixed[last_position]\r\n return false\r\n exit\r\n when string_fixed[first_position] == string_fixed[last_position]\r\n first_position += 1\r\n last_position -= 1\r\n end\r\n return true\r\n end\r\nend", "def palindrome?(string)\n\n clean_string = string.downcase.gsub(/[^a-z]/, '') #remove anything that is not a letter\n puts clean_string.reverse == clean_string\n\nend", "def palindrome?(string)\n result = false\n str = string.to_s.downcase\n re = /[^a-z0-9]/\n str = str.gsub(re, \"\")\n str_reverse = str.reverse\n if str_reverse == str\n result = true\n end\n return result\nend", "def palindrome(str)\n str == str.reverse\nend", "def shortest_palindrome(string)\n return string if palindrome?(string)\n\n for i in 0...string.length\n rev = string.length - i\n suffix = string[(rev - 1)...string.length]\n rev_suffix = suffix.reverse\n\n new_string = rev_suffix + string\n return new_string if palindrome?(new_string)\n end\nend", "def test(string)\n reverse_string = string.reverse\n if string == reverse_string\n puts \"#{string} is a palindrome\"\n else\n puts \"#{string} is not a palindrome\"\n end\nend", "def palindrome?(substr)\n substr == substr.reverse && substr.length > 1\nend", "def isPalindrome(string)\n string == string.reverse\nend", "def palindrome?(str)\n (str.length - 1).downto(0).map { |i| str[i] }.zip(str.chars).all? { |a, b| a == b }\nend", "def check_palindrome(s)\n\n if s == nil\n return false\n end\n\n result = \"\"\n\n (s.length-1).downto(0).each do |l|\n result << s[l]\n end\n p result\n\n return result == s\n\nend", "def palindrome?(string)\n i = 0\n while i < string.length\n if string[i] != string[(string.length - 1) - i]\n return false\n end\n\n i += 1\n end\n\n return true\nend", "def palindrome?(string)\n i = 0\n while i < string.length\n if string[i] != string[(string.length - 1) - i]\n return false\n end\n\n i += 1\n end\n\n return true\nend", "def palindrome?(string)\n i = 0\n while i < string.length\n if string[i] != string[(string.length - 1) - i]\n return false\n end\n\n i += 1\n end\n\n return true\nend", "def palindrome(string)\n return true if string.length <= 1\n\n if string[0] == string[-1]\n palindrome(string[1..-2])\n else\n false\n end\nend", "def is_palindrome str\n if str.downcase == str.downcase.reverse\n puts \"#{str} is a palindrome!\"\n else \n puts \"#{str} is not a palindrome!\"\n end\nend", "def palindrome?(string)\n if string == string.reverse\n return true\n else \n return false\n end\nend", "def palindrome?(string)\n\n idx1 = 0\n idx2 = -1\n\n while idx1 < string.length\n if string[idx1] != string[idx2] \n return false\n end\n\n idx1 += 1\n idx2 -= 1\n end\n\n return true\nend", "def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i += 1\n end\n \n if forwards == backwards\n return \"true\"\n else\n return \"false\"\n end\nend", "def palindrome\n txt = 'ssiiss'\n length = txt.length\n i = 0\n j = length - 1\n flag = true\n while flag && i<=j do\n flag = txt[i] == txt[j] ? true : false\n i = i + 1\n j = j - 1\n end\n puts \"palindrome is #{flag}\"\nend", "def palindrome?(string)\n reversed = \"\"\n string.each_char do |char|\n reversed = char + reversed\n end\n reversed == string ? true : false\nend", "def real_palindrome?(string)\n new_string = string.downcase.delete('^a-Z0-9')\n new_string == new_string.reverse\nend", "def palindrome?(str)\n matches = []\n str.size.times { |index| matches << (str[index] == str[-(index+1)]) }\n matches.all?(true) && matches.size > 1\nend", "def palindrome?(str)\n puts str\n return str.downcase.gsub(/[^a-z]/, '') == str.downcase.gsub(/[^a-z]/, '').reverse\nend", "def palindrome?(string)\n first = 0\n last = string.length - 1\n \n while first < last do\n return false if string[first] != string[last]\n first += 1\n last -= 1\n end\n true\nend", "def palindrome?(string)\n\treverse_str = ''\n\tidx = 0\n\twhile idx < string.length\n\t\treverse_str = string[idx] + reverse_str\n\t\tidx += 1\n\tend\n\t\n\tif reverse_str == string\n\t\treturn true\n\telse\n\t\treturn false\n\tend\n\t\nend", "def palinodrome?(string)\n string == my_reverse(string)\nend" ]
[ "0.87072676", "0.8559117", "0.8478173", "0.84776634", "0.84263945", "0.83970183", "0.8390052", "0.8365389", "0.83221525", "0.8313065", "0.8312266", "0.83117115", "0.82449204", "0.8191274", "0.8168176", "0.81566864", "0.8103453", "0.79505295", "0.791351", "0.78644335", "0.7851078", "0.7839279", "0.7803867", "0.77707624", "0.7761184", "0.77542293", "0.77484226", "0.7746534", "0.77339387", "0.7727616", "0.771619", "0.7692474", "0.76778114", "0.76597226", "0.7658627", "0.7629832", "0.76269567", "0.7617797", "0.7599352", "0.75893795", "0.7577907", "0.7577907", "0.7575625", "0.7570838", "0.7560483", "0.755408", "0.7550773", "0.7548903", "0.75468147", "0.7544462", "0.7533777", "0.7525834", "0.75205296", "0.7513738", "0.75049347", "0.746749", "0.7461389", "0.744467", "0.7440367", "0.7439257", "0.74345684", "0.74301076", "0.74239904", "0.7416025", "0.7414683", "0.7408817", "0.7408303", "0.7393772", "0.73765576", "0.73682", "0.73635477", "0.7363479", "0.7363217", "0.7362541", "0.7362503", "0.73611134", "0.7358363", "0.7346352", "0.7341037", "0.7340161", "0.7331385", "0.7330869", "0.731971", "0.7316708", "0.73037183", "0.7301125", "0.7301125", "0.7301125", "0.72962993", "0.72909534", "0.7282053", "0.72817034", "0.727766", "0.7270696", "0.72650826", "0.725876", "0.72550213", "0.7254447", "0.72542185", "0.7252996", "0.7248953" ]
0.0
-1
number original number Examples is_odd(3) => 'true' Returns if number is odd.
def is_odd(number) return true if number % 2 != 0 return false if number % 2 == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd?(number)\n number.to_i.odd?\nend", "def is_odd(number)\n if number % 2== 1\n return true\n else \n return false\n end \nend", "def is_odd?(number)\n\n\t#WHY WASN\"T MODULO WORKING?\n\t# if (number%2) != 0\n\t# \tputs \"true\"\n\t# \treturn true\n\tnumber = number.to_i\n\tif number.odd?\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd(number)\n output = false\n if (number % 2) != 0\n output = true\n end\n return output\nend", "def is_odd(number)\n\tif(number%2 != 0)\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd(number)\n if number%2 > 0\n return true\n end\n return false\nend", "def is_odd? number\n number % 2 == 1\nend", "def is_odd?(num)\n return num.abs % 2 == 1 ? true : false\nend", "def is_odd(number)\n if number % 2 == 0\n return false\n end\n return true\nend", "def is_odd?(number)\n number % 2 == 1\nend", "def is_odd(num)\n return num % 2 == 1\nend", "def is_odd?(number)\n number.remainder(2) != 0\nend", "def is_odd?(number)\n number % 2 != 0\nend", "def is_odd(num)\n return ((num % 2) != 0)\nend", "def is_odd?(num)\n num.abs.to_i % 2 != 0 && num.to_i == num\nend", "def odd_number?(number)\n number % 2 == 1\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n puts \"Is number #{number} an odd number?:\"\n number % 2 == 0 ? false : true\n\nend", "def is_odd(num)\n output = false\n if num % 2 != 0\n output = true\n end\n return output\nend", "def is_odd?(number)\n number.remainder(2).abs > 0\nend", "def is_odd?(num)\n num.odd?\nend", "def is_odd?(num)\n num.odd?\nend", "def is_odd(n)\n n % 1 == 0 && n.to_i.odd?\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(number)\n number.abs.remainder(2) == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd(num)\n if num % 2 == 0\n return false\n else\n return true\n end\nend", "def is_odd?(number)\n number.abs % 2 != 0 && number != 0\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend", "def is_odd?(num)\r\n num % 2 == 1\r\nend", "def is_odd?(num)\n num.abs % 2 != 0\nend", "def is_odd(num)\n return true if num % 2 != 0\n return false\nend", "def is_odd?(num)\n num = num * -1 if num < 0 # get absolute value\n num.remainder(2) == 1 ? true: false\nend", "def is_odd?(num)\n num.remainder(2).abs == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(num)\n if num == 0 ||num.remainder(2) == 0\n false\n else\n true\n end\nend", "def is_odd?(int)\n int % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 != 0\nend", "def is_odd?(num)\n num.remainder(2) == 1 || num.remainder(2) == -1\nend", "def is_odd?(int)\n int.abs % 2 == 1\nend", "def is_odd?(n)\n n % 2 == 1\nend", "def is_odd?(num)\n # return false if num.zero?\n # num *= -1 if num < 0\n !(num % 2).zero?\n # !(num.remainder(2).zero?)\nend", "def is_odd(x)\n x % 2 == 0 ? false : true\nend", "def is_odd?(integer)\n\tinteger.abs % 2 == 1\n\t\nend", "def is_odd?(int)\n int.odd?\nend", "def is_odd?(num)\n # could use the built-in Integer#odd? method but building my own for practice\n num.abs % 2 == 1\nend", "def still_odd?(num)\n num.remainder(2).abs == 1\nend", "def is_odd?(int)\n (int % 2).abs != 0\nend", "def is_odd?(int) \n if int % 2 == 0\n return false\n else return true\n end\nend", "def is_it_odd?(int)\n int.abs % 2 != 0\nend", "def is_odd?(input)\n input % 2 != 0 # => true\nend", "def is_odd?(n)\n n.abs % 2 != 0\nend", "def is_odd?(num)\n absolute_num = num.abs\n if absolute_num % 2 == 0 || num.to_i != num\n return false\n else\n return true\n end\nend", "def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend", "def is_odd2?(num)\n num.remainder(2) != 0\nend", "def is_odd?(int)\n int.abs.remainder(2) == 1\nend", "def is_odd2?(num)\n num.abs % 2 == 1\nend", "def odd_or_even(number)\n if number.odd?\n 'That number is odd'\n else\n 'that number is even'\n end\nend", "def is_odd?(input)\n\n if input % 2 == 1\n true\n else\n false\n end\n\nend", "def odd?(number)\n if number % 2 == 0\n false\n else \n true\n end\nend", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"That number is even\"\n end\nend", "def is_odd?(integer)\r\n !(integer.abs.remainder(2) == 0)\r\nend", "def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend", "def ood_or_even(number)\n if number.odd?\n 'the number is odd'\n else\n 'the number is even'\n end\nend", "def is_odd?(number)\n number.remainder(2).abs == 1 # I originally wrote this w/o the .abs method call; -17 returned false as a result due to the remainder being\nend", "def this_is_also_odd?(param_integer)\n param_integer.remainder(2) != 0\nend", "def is_odd_no_modulo?(number)\n float = number / 2.0\n if float == float.to_i.to_f\n puts \"#{number} is even.\"\n else\n puts \"#{number} is odd.\"\n end\nend", "def is_even_or_odd(num)\n\treturn num.odd? ? 'odd' : 'even'\nend", "def is_odd?(num)\n # num.abs % 2 != 0 \n num % 2 == 1\n # ruby modulus operator always return non-negative result if num on right is positive\n # ie, % is a modulus operator and \"not a remainder operator as in some languages\"\n # my first line was correct, but more properly per the proposed problem\n # check if odd, do not check if not even\nend", "def odd(int)\n int % 2 == 1\nend", "def is_odd1?(integer)\n integer.remainder(2) != 0\nend", "def odd_or_even(number)\n if number.odd?\n \"odd\"\n else\n \"even\"\n end\nend", "def odd_or_even_test(number)\n\n is_even = (number % 2 == 0)\n\n if is_even\n result = \"even\"\n else\n result = \"odd\"\n end\n\n puts \"#{number} is an #{result} number.\"\n\nend", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"Even\"\n end\nend", "def is_odd(tal)\n if tal % 2 != 0\n return true\n else\n return false\n end\nend", "def even_odd(number)\n unless number.is_a? Numeric\n return \"A number was not entered.\"\n end\n\n if number % 2 == 0\n \"That is an even number.\"\n else\n \"That is an odd number.\"\n end\nend", "def is_odd?(integer)\n# integer.abs % 2 == 1 the #abs method is unnecessary here, because of how modulus works :)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer.abs.remainder\nend", "def is_odd?(value)\n return false unless value == value.to_i # check float = integer\n value.abs % 2 == 1 ? true : false # check if odd\nend", "def is_odd?(number)\n number % 2 == 1 # returned due to being last line in method + returns boolean due to operator\nend", "def even_odd(number)\n if number % 2 == 0\n \"That is an even number.\"\n else\n \"That is an odd number.\"\n end\nend", "def is_odd2?(int) \n if int < 0\n int = int * -1\n end\n int % 2 == 1\nend", "def is_odd3?(int)\n if int.remainder(2) == 0\n return false\n else\n return true\n end\nend", "def is_even(number)\n number.to_i\n if number%2 == 1\n return true\n else\n return false\n end\nend", "def only_odd_digits?(number)\n digits = number.to_s.split(//)\n return true if number == 2\n digits.each do |digit|\n return false if digit.to_i%2==0\n end\n return true\nend", "def is_other_odd?(n)\n n.abs.remainder(2) == 1\nend", "def even_odd(num)\n if num % 2 == 0\n \"#{num} is even\"\n else num % 2 != 0\n \"#{num} is odd\"\n # create a conditional statement that if num % 2 = 0 it will return the number as even. Use a bang operator in the else statement for odd numbers.\n end\nend", "def odd (numb)\n return true if numb % 2 == 1\n return false\nend", "def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend" ]
[ "0.8559289", "0.849433", "0.8478733", "0.8477539", "0.8471775", "0.84578466", "0.84378946", "0.8386037", "0.8365827", "0.83539623", "0.8351008", "0.8346245", "0.8344417", "0.83180285", "0.8313873", "0.8311684", "0.830552", "0.830552", "0.8301595", "0.82871574", "0.8277806", "0.8274532", "0.8274532", "0.8273636", "0.8273163", "0.8273163", "0.8273163", "0.82675886", "0.8252863", "0.8252863", "0.8252863", "0.8252863", "0.8252863", "0.8252369", "0.82476264", "0.8244284", "0.8244284", "0.8231958", "0.82266074", "0.8226181", "0.8219231", "0.821472", "0.8203279", "0.8202129", "0.8202129", "0.8202129", "0.82020354", "0.82002693", "0.81837773", "0.8159507", "0.8138198", "0.8135114", "0.8125626", "0.81131154", "0.8109543", "0.8104744", "0.80997735", "0.8099468", "0.80984664", "0.80815357", "0.8079384", "0.80674", "0.80487084", "0.8039446", "0.8026434", "0.8017558", "0.80138004", "0.799802", "0.7997346", "0.7993628", "0.7988279", "0.7975158", "0.79646164", "0.79617834", "0.79364485", "0.7931995", "0.79284954", "0.79195046", "0.7910522", "0.79035723", "0.7899678", "0.78965604", "0.78811204", "0.7875417", "0.78734076", "0.78727764", "0.78601694", "0.7837324", "0.78352475", "0.7830223", "0.78256685", "0.78066885", "0.78018916", "0.774981", "0.77293277", "0.77007395", "0.7684461", "0.76649904", "0.76545745", "0.7652377" ]
0.83059853
16
The NTP log file timestamp epoch begins at 18581117 00:00:00 UTC See: Modified Julian Date
def ntp_epoch_start @ntp_epoch_start ||= Time.parse("1858-11-17 00:00:00 UTC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp\n time = Time.now.getutc\n\n secs = time.to_i\n millis = time.nsec/1000000\n\n return @last if @millis == millis && @secs == secs\n\n unless secs == @secs\n @secs = secs\n @date = time.strftime('%Y-%m-%d %H:%M:%S.')\n end\n\n @millis = millis\n @last = @date + \"00#{millis}\"[-3..-1]\n end", "def last_epoch_time; end", "def epoch_now()\n Time.now.to_i\n end", "def epoch_time\n return time + epoch\n end", "def epochday\n @line1[20...32].to_f\n end", "def timestamp\n @timestamp ||= Time.parse(@origdate)\n end", "def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def jd_from_epoch(t)\n\t(t / 86400.0) + 2440587.5\nend", "def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def read_epoch_time(microseconds_since_epoch)\n Time.at(microseconds_since_epoch.to_i/1000)\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def unixtime\n Time.now.to_i.to_s\n end", "def master_last_seen_unix_timestamp()\n @master_last_seen_unix_timestamp ||= 0\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def epoch_from_jd(jd)\n\t86400.0*(jd - 2440587.5)\nend", "def timestamp\n Time.now.utc.to_i\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def timestamps\n @timestamps ||= bytes[T_BYTES].each_slice(4).map do |t_bytes|\n ByteArray.to_i(t_bytes)\n end.reject{ |t| t == 0 }\n end", "def epoch_time(epoch)\n Time.at(epoch)\n end", "def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | @time_low\n end", "def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def timestamp\n (Time.now.to_f * 1000).ceil.to_s[-5..-1]\nend", "def revolutionnumberepoch\n (@line2[63...68]).to_i\n end", "def timestamp\n _timestamp.as_time\n end", "def timestamp\n _timestamp.as_time\n end", "def last_timestamp\n lines.last.first\n rescue\n 0\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 creation_epoch\n saved_at.try(:to_i)\n end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def to_time\n Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)\n end", "def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def get_timestamp(time)\r\n srandom_r time\r\n t0 = random_r\r\n t1 = 0x17dc65df;\r\n hi = (t0 * t1) >> 32;\r\n t2 = t0 >> 31;\r\n t3 = hi >> 23;\r\n t3 = t3 - t2;\r\n t4 = t3 * 0x55d4a80;\r\n t0 = t0 - t4;\r\n t0 = t0 + 0x989680;\r\n\r\n ieee754_round(t0)\r\n end", "def compute_timestamp(logline)\n timestamp = logline.hour * 3600 + logline.minute * 60 + logline.second\n # assume we just advanced to the next day in case we got a lower timestamp than last one\n timestamp += LogLine::Resolution * offset\n if timestamp < last_timestamp\n self.offset = offset + 1\n timestamp += LogLine::Resolution\n end\n timestamp\n end", "def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end", "def convert_timestamp(ts)\n return ts.to_i - @@seconds_1900_1970\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def timestamp\n #data[\"timestamp\"] as? TimeInterval ?? 0\n timestamp = data[\"timestamp\"]\n timestamp.to_i || 0\n end", "def usec_epoch(ts=Time.now)\n case ts\n when nil, \"\"\n (Time.now.to_f * 1_000_000).to_i\n when Time\n (ts.to_f * 1_000_000).to_i\n when SECS_1971..SECS_2100\n ts * 1_000_000\n when MILLI_SECS_1971..MILLI_SECS_2100\n ts * 1_000\n when MICRO_SECS_1971..MICRO_SECS_2100\n ts\n when NANO_SECS_1971..NANO_SECS_2100\n ts / 1_000\n else\n raise \"Unable to convert timestamp: #{ts} (class: #{ts.class})\"\n end\n end", "def get_epoch\n blocks = self.blocks_get_status\n if blocks[\"success\"]\n epoch = Time.parse blocks[\"epoch\"]\n return epoch\n else\n return nil\n end\n end", "def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def epoch_from_date(date)\n\tdate.to_time.to_i\nend", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def now_stamp(now = nil)\n now ||= Time.now\n now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def timestamp\n @timestamp ||= Time.now.xs_datetime\n end", "def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end", "def sent_at_seconds_since_epoch\n Time.current.utc.to_i\n end", "def timestamp\n return nil if grpc.nil?\n Convert.timestamp_to_time grpc.read_timestamp\n end", "def to_i\n\t\tseconds_since_unix_epoch.to_i\n\tend", "def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend", "def current_timestamp\n @c_tstamp ||= current_time.to_f\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def last_update\n Time.parse(@record.SystemModstamp)\n end", "def epoch(t)\n if t.nil? then epoch(now)\n elsif ( t.is_a?(::Time) || t.is_a?(::Numeric) ) then t.to_i\n elsif t.is_a?(::DateTime) then epoch(to_time(t))\n elsif t.is_a?(::String) then epoch(from_string(t))\n else nil end\n end", "def current_timestamp\n @c_tstmp ||= current_time.to_i\n end", "def to_i\n seconds_since_unix_epoch.to_i\n end", "def epochyear\n 2000 + @line1[18...20].to_i\n end", "def milis_from_1970\n self.day.to_time.to_i * 1000\n end", "def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end", "def process_stamp(stamp_string)\n # Server gives us miliseconds, which we drop before converting.\n stamp_val = stamp_string.to_i() / 1000\n utc_time = Time.at(stamp_val).utc().to_datetime()\n return utc_time\n end", "def timestamp\n @java.getTimestamp\n end", "def date1904() @@date1904; end", "def timestamp\n\t\tTime.now.to_i\n\tend", "def timestamp2date(t)\n Time.at(t.to_i).utc\nend", "def to_f\n\t\tseconds_since_unix_epoch.to_f\n\tend", "def timestamp\n datetime.localtime.strftime \"%Y %d/%m %X\"\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def to_millis( timestamp )\n (timestamp.sec * 10**3) + (timestamp.nsec / 10**6)\n end", "def timestamp_with_usec\n time = Time.now\n time.strftime('%Y-%m-%dT%H:%M:%S.') + format('%06d ', time.usec)\n end", "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def last_written\n wtime = (@cred_struct[:last_written][:dw_high_date_time] << 32) +\n (@cred_struct[:last_written][:dw_low_date_time])\n Time.at((wtime - 116444736000000000) / 10000000)\n end", "def timestamp_to_time(timestamp)\n Time.at(timestamp.nanos * 10**-9 + timestamp.seconds)\n end", "def srs_tt(t=Time.now.utc)\n Base64.encode64((t.to_i / (60*60*24) % 210).to_s)[0,2]\n end", "def ndvi_file_to_date (s) \n\t#MT3RG_2007_50-56_250m_composite_ndvi.rgb.jpg\n\t bits = s.split(\"_\")\n\t start_day = bits[2].split(\"-\").first\n\treturn(Time.gm(bits[1].to_i, 1,1,0,0,0) + start_day.to_i * 24*60*60)\nend", "def get_timestamp(output)\n output.split(\"\\n\").first.match(/^\\[([^\\]]*)\\]/)[1].gsub(/\\/| |:/,'.')\n end", "def getutc() end", "def timestamp(unit = :float_second)\n Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)\n end", "def date\n @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)\n end", "def get_iso_timestamp( data_import_session )\n data_import_session.created_at.strftime(\"%Y%m%d%H%M\")\n end", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def create_timestamp(line)\n\t\tTime.strptime(line[1], '%Q')\n\tend", "def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def time_stamp(event)\n file_local_write(@logfile,\"\\nKeylog Recorder #{event} at #{Time.now.to_s}\\n\\n\")\n end", "def ship_timestamp\n Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').tap{|str| str[-2,0] = ':' }\n end", "def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end" ]
[ "0.6870663", "0.67468315", "0.6588951", "0.65676695", "0.6539978", "0.64663494", "0.64577335", "0.64212644", "0.6386592", "0.6355795", "0.6292023", "0.62746805", "0.62677926", "0.62464166", "0.6234186", "0.6216995", "0.6212133", "0.6208646", "0.61051697", "0.61007607", "0.6080986", "0.6069697", "0.60663515", "0.6053692", "0.60511255", "0.6050427", "0.60336983", "0.6021187", "0.59943664", "0.5976001", "0.59742624", "0.5940207", "0.5922611", "0.5906586", "0.5906192", "0.59034646", "0.59023386", "0.5899794", "0.5898884", "0.5897438", "0.58966345", "0.58872676", "0.58838713", "0.5881529", "0.5881529", "0.58653796", "0.58644485", "0.5855004", "0.5849971", "0.58479404", "0.58466554", "0.58384275", "0.58378243", "0.58325714", "0.58196825", "0.58016413", "0.5799887", "0.577795", "0.5776159", "0.57750964", "0.5769236", "0.576472", "0.57582843", "0.5755532", "0.5745347", "0.57402486", "0.5733013", "0.57320154", "0.57152504", "0.5699864", "0.5698277", "0.5694023", "0.5662921", "0.56605566", "0.5658655", "0.56334174", "0.5623178", "0.562134", "0.5617261", "0.5617261", "0.5617261", "0.5617261", "0.5617261", "0.5617261", "0.56080866", "0.55998355", "0.55987597", "0.55881333", "0.5586594", "0.55736053", "0.55682665", "0.5566794", "0.5545836", "0.55370414", "0.55331874", "0.5520917", "0.5517804", "0.54910046", "0.548614", "0.5468337" ]
0.6817118
1
File::foreach gives us individual lines as strings to play with Try to figure out what kind of logfile we're dealing with, and convert appropriately
def convert_line(line, filename) if filename.include?('loops') || filename.include?('peers') convert_ntp_line(line) elsif filename.include?('message') convert_message_line(line) elsif filename.include?('nagios') convert_nagios_line(line) else convert_ntp_line(line) # give up, fall back on original behavior end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call\n @logs = []\n @logs_unique = nil\n File.foreach(@filename) do |line|\n if m = line.match(@log_format)\n @logs.push Log.new(*m.captures)\n else\n raise Error, \"Unmatched lines: #{line}\"\n end\n end\n end", "def each_log_line\n File.readlines('/var/log/syslog').each do |line|\n line.chomp!\n \n timestamp, rest = Time.parse(line), line[16..-1]\n yield [timestamp, rest]\n end\n end", "def parse_logfile\n File.open(\"DietLog.txt\", \"r\") do |f|\n f.each_line do |line|\n line.chomp!\n command = line.split(\",\")\n date = command[0]\n food = command[1]\n addLog(food, date)\n end\n end\n end", "def parse_logfile(logfile)\n uploaded_files = { }\n uploaded_files_log = open(logfile).read\n uploaded_files_log.split(/\\s/).each do |line|\n type,local_filename, server_filename = line.split(':')\n uploaded_files[local_filename] = [type, server_filename.sub(@vortex_path,'')]\n end\n return uploaded_files\n end", "def translate_log_file map, log_file\n state = :rs\n file_id = nil\n file = nil\n line = nil\n lineno = nil\n parameters_length = nil\n parameter_bytes = nil\n\n log_file.each_byte do |b|\n case state\n when :rs\n parameter_bytes = []\n state = :file_id_lo\n when :file_id_lo\n file_id = b\n state = :file_id_hi\n when :file_id_hi\n file_id += b * 256\n file = map[file_id]\n if file\n state = :lineno_lo\n else\n $stderr.puts \"File ID #{file_id} not found in map\"\n state = :lingering\n end\n when :lineno_lo\n lineno = b\n state = :lineno_hi\n when :lineno_hi\n lineno += b * 256\n line = file[:lines][lineno]\n state = :parameters_length\n when :parameters_length\n parameters_length = b % 128\n if parameters_length > 0\n state = :parameters\n else\n state = :checksum\n end\n when :parameters\n parameter_bytes << b\n parameters_length -= 1\n if parameters_length == 0\n state = :checksum\n end\n when :checksum\n if line\n parameters = split_parameter_bytes file, line, parameter_bytes\n message = format_log_message(file, lineno, line, parameters)\n puts message\n else\n $stderr.puts \"#{file[:file_name]}@#{lineno}: Line not found in map\"\n end\n state = :rs\n end\n end\nend", "def find_broken_src_from_log( file )\n broken_src = []\n IO.foreach(file) do |line|\n if is_src?(line)\n src = extract_src(line)\n broken_src << src\n elsif is_time?(line)\n broken_src.pop\n end\n end\n broken_src\nend", "def process_logfile\n # Read each line from the logfile and process it.\n IO.foreach(@logfile) { |line|\n @endpoints.add(LineTokenizer.new(line))\n @loglines += 1\n }\n end", "def parse_log_file0(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = handling do\n handle MalformedLogEntryError do\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def task_2(log)\n result = []\n unless log.nil? || log == 0\n errors = log.scan(/(?i).*error.*/) #If finds error or ERROR returns whole string\n if !errors[0].nil?\n log.sub!(errors[0] + \"\\n\", '') # Removes errors from log\n end\n begin\n log.each_line do |line|\n datetime = line.match(/\\[(.*?)\\]/)[1] # Returns dates\n ip_addres = line.match(/^\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b/) # Retruns IPs\n endpoint_path = line.match(/\"POST \\/.*\"/)[0].split[1].upcase\n result << \"#{datetime} FROM: #{ip_addres} TO: #{endpoint_path}\"\n end\n result\n rescue NoMethodError # No the best way, but works.\n ''\n end\n end\nend", "def converter(logfilename)\n #logfilename = first_argument\n\n unless logfilename?(logfilename) then\n puts 'Error : Logfile does not exists.'\n exit(0)\n end\n\n return hashes( read(logfilename) )\n end", "def parse_line_to_format(line,file,path_item)\r\n tmp_hash = { message: line, filebot: { format_from: path_item['format'], path_from: file.path, size_from: file.size } }.merge(path_item['fields'] || {})\r\n case path_item['format']\r\n when 'log' then tmp_hash\r\n when 'csv' then\r\n csv_arr = CSV.parse_line(line,path_item['options'].reject { |k,_| k == :headers }) rescue []\r\n if csv_arr.size == 0\r\n tags = [tmp_hash['tags'].to_a]\r\n tags.push('_csvparsefailure')\r\n tmp_hash['tags'] = tags\r\n else\r\n res = []\r\n path_item['options'][:headers].each_with_index { |field_name,i| res << [field_name,csv_arr[i]] }\r\n if res.size < csv_arr.size\r\n res << [ 'tail_csv', csv_arr[res.size..csv_arr.size-1].join(\"\\t\") ]\r\n end\r\n tmp_hash = tmp_hash.merge(res.to_h)\r\n end\r\n tmp_hash\r\n else tmp_hash\r\n end\r\n end", "def log_lines\n\n self.each do |line|\n clean_line = line.to_s.chomp.gsub(\"\\\\n\",\"\")\n log.info(x) { line } if clean_line.length > 0\n end\n\n end", "def convert_line_to_event(line, es)\n begin\n line.chomp! # remove \\n\n @parser.parse(line) { |time, record|\n if time && record\n es.add(time, record)\n identifier = record[@identifier].gsub(/\\s+/, '')\n if identifier && identifier.length > 4\n @identifier_array.push(\"#{identifier}\")\n if @identifier_array.size >= chunk_size\n batchArray = @identifier_array.join(\",\").split(\",\")\n resp = get_from_solr\n if @mongo_merge_enabled\n coll = get_from_mongo(batchArray)\n mresp = merge_mongo_and_solr(coll,resp)\n log_from_response(mresp)\n else\n log_from_response(resp)\n end\n end\n end\n else\n log.warn \"pattern not match: #{line.inspect}\"\n end\n }\n rescue => e\n log.warn line.dump, :error => e.to_s\n log.debug_backtrace(e.backtrace)\n end\n end", "def log_msgs\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") || # Forward translator and geometry translator\n msg.logMessage.include?(\"UseWeatherFile\") # 'UseWeatherFile' is not yet a supported option for YearDescription\n \n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage)\n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && @debug\n @runner.registerInfo(\"DEBUG - #{msg.logMessage}\")\n end\n end\n end\n @runner.registerInfo(\"Total Time = #{(Time.new - @start_time).round}sec.\")\n end", "def read_a_log ifstream, ret_type\n\t\t\ttimestamp = nil\n\t\t\tdata = nil\n\t\t\tunless ifstream.eof?\n\t\t\t\ts_size = ifstream.read(2)\n\t\t\t\tsize = s_size.unpack('S')[0]\n\t\t\t\tsize_time = 4\n\t\t\t\tif ret_type & ID_TIME\n\t\t\t\t\ts_timestamp = ifstream.read(4)\n\t\t\t\t\ttimestamp = Time.at(s_timestamp.unpack('I')[0])\n\t\t\t\telse\n\t\t\t\t\tifstream.pos += size_time\n\t\t\t\tend\n\t\t\t\tsize_data = size - 6\n\t\t\t\tif ret_type & ID_DATA\n\t\t\t\t\ts_data = ifstream.read(size_data)\n\t\t\t\t\tis_dumped = (s_data[0] & 0x01) == 0 ? false : true\n\t\t\t\t\tdata = is_dumped ? Marshal.load(s_data[1..-1]) : s_data[1..-1]\n\t\t\t\telse\n\t\t\t\t\tifstream.pos += size_data\n\t\t\t\tend\n\t\t\tend\n\t\t\t[timestamp, data]\n\t\trescue\n\t\t\twarn \"reading log failed\"\n\t\tend", "def parseLog log_name\n\tlog_file = File.open(log_name, \"r\")\n\tcount = 1\n\tfor line in log_file\n\t\tfields = (line.scan LOG_REGEX)[0]\n\t\tsource_addr = fields[0]\n\t\tpayload = fields[4]\n\t\thttp_code = fields[5].to_i\n\t\t# Check if nmap is named\n\t\tif line =~ /\\bnmap\\b/i\n\t\t\tputs \"#{count}. ALERT: NMAP scan is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\t\t# Check whether code was in error range (400s)\n\t\tif http_code / 100 == 4\n\t\t\tputs \"#{count}. ALERT: HTTP error is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\t\t# Check both that a shellcode pattern is found, and that a command is attempted\n\t\tif payload =~ SHELL_REGEX and payload =~ REMOTE_REGEX\n\t\t\tputs \"#{count}. ALERT: Shellcode attack is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\tend\n\tlog_file.close\nend", "def log_series_parse(*log_regexes)\n\t\t\n\t\t\n\t\t#First we initialize a temporary array\n\t\ttemparr = []\n\t\t\n\t\t#And we open the output file\n\t\t#!! Throw--Catch this...\n\t\t\n\t\tparseout = CSV.open(\"#{self.to_path}.csv\",'wb')\n\t\t#parseout = CSV.open(\"parseout.csv\",'wb')\n\t\n\t\t#For each line in the IO stream\n\t\tself.each_line do |line|\n\t\t\n\t\t\t#Compare it to each regular expression\n\t\t\tlog_regexes.each do |lr|\n\t\t\t\t\n\t\t\t\t# If it matches,\n\t\t\t\tif m = line.match(lr)\n\t\t\t\t\t\n\t\t\t\t\t#Find out if it's a set, subsection, or none\n\t\t\t\t\tcase lr.type\n\t\t\t\t\t\n\t\t\t\t\t#When it's a set delimiter, \n\t\t\t\t\twhen MatchType::SET\n\t\t\t\t\t\n\t\t\t\t\t\t#If it has a replacement string\n\t\t\t\t\t\tif !lr.replacement_string.empty?\n\t\t\t\t\t\t\t#send the temporary array to the csv\n\t\t\t\t\t\t\tparseout << temparr\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t#reset the temporary array to the replacement str\n\t\t\t\t\t\t\ttemparr = [m[lr.replacement_string.to_sym]]\n\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#send the temporary array to the csv\n\t\t\t\t\t\t\tparseout << temparr\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t#reset the temporary array\n\t\t\t\t\t\t\ttemparr = []\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t#When it's a SUBSECTION delimiter, \n\t\t\t\t\twhen MatchType::SUBSECTION\n\t\t\t\t\t\n\t\t\t\t\t\t#If it has a replacement string\n\t\t\t\t\t\tif !lr.replacement_string.empty?\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t#add a spacer and the replacement string to temparr\n\t\t\t\t\t\t\ttemparr.concat([\"\",m[lr.replacement_string.to_sym]])\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#add a spacer\n\t\t\t\t\t\t\ttemparr << \"\"\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t#When it's just a match, \n\t\t\t\t\twhen MatchType::NONE\n\t\t\t\t\t\t\n\t\t\t\t\t\t#Add the contents of the match to the temporary array\n\t\t\t\t\t\ttemparr.concat(m.captures)\n\t\t\t\t\t\n\t\t\t\t\t#When the type is not set, or is none of the above\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"LogRegexp has an invalid type\"\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t#no constraint on not matching\n\t\t\t\t\n\t\t\tend\n\t\t\n\t\t\n\t\tend\n\t\t\n\t\t#Then we close out the new csv\n\t\tparseout.close\n\t\t\n\tend", "def parse_log_file(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = restartable do\n restart :skip_log_entry do\n leave\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def parse_logfile\n each_successful_run do |timestamp, host|\n last[host] = LastRun.new(host, timestamp)\n end\n end", "def parse_log_file(file_name)\n\n raise ArgumentError, \"Log file does not exist.\" unless File.file?(file_name)\n\n records = []\n\n CSV.foreach(file_name, col_sep: \" \", quote_char: \"'\") do |row|\n # Omit any paths that do not begin with path=/api/users\n if row[4].start_with?(\"path=/api/users/\")\n records.push(LogRecord.new(row))\n end\n end\n\n return records\nend", "def parse_multifile(filename: \"\", type: \"old\")\r\n !filename.empty? ? file = File.binread(filename) : return\r\n case type\r\n when \"old\"\r\n file.split(\"\\n\").map(&:strip).reject(&:empty?).map{ |m|\r\n title = m.split('#')[0][1..-1] rescue \"\"\r\n author = \"Metanet Software\"\r\n map = parse_map(data: m.split(\"#\")[1], type: \"old\") rescue {tiles: [], objects: []}\r\n {title: title, author: author, tiles: map[:tiles], objects: map[:objects]}\r\n }\r\n else\r\n print(\"ERROR: Incorrect type (old).\")\r\n return 0\r\n end\r\nend", "def convert_nagios_line(line)\n line_array = line.split(' ')\n epoch_timestamp = line_array[0].gsub(/\\D/, '')\n human_timestamp = Time.at(epoch_timestamp)\n format(human_timestamp, line_array, 1)\nend", "def parse(collector)\n @stream.each_line do |line|\n if match = FORMAT.match(line)\n\n key, value, timestamp = match[:data].split(\"|\")\n\n case match[:type]\n when \"counts\"\n collector.increment(key, value, timestamp)\n when \"gauges\"\n collector.gauge(key, value, timestamp)\n when \"sets\", \"timers\"\n collector.gauge_absolute(key, value, timestamp)\n end\n else\n @errors << \"Unable to process: #{line}\"\n end\n end\n end", "def data; file_log.read(file_node); end", "def parse_message_from_log_entry\r\n\r\n unique_messages = { }\r\n\r\n id = \"\"\r\n\r\n ARGF.each do |line|\r\n\r\n block_id = line.match(/Loaded suite (.*)/)\r\n failure_msg = line.match(/[1-9]+ failures/)\r\n err_msg = line.match(/[1-9]+ errors/)\r\n\r\n if ! block_id.nil?\r\n\r\n id = block_id[1]\r\n\r\n elsif ! failure_msg.nil?\r\n\r\n unique_messages[\"FAIL: #{id}\"] = \"\"\r\n\r\n elsif ! err_msg.nil?\r\n\r\n unique_messages[\"ERROR: #{id}\"] = \"\"\r\n\r\n end\r\n\r\n\r\n end\r\n\r\n puts unique_messages.keys.join(\"\\n\")\r\n\r\n\r\nend", "def process_file(src)\n media = \"\"\n # files first\n get_files(src).each do |file|\n next if file =~ /\\/\\._/\n \n # first we check if the file is a tv series\n episode_status, episode_name, episode_season, episode_episode = tv_file(file) if $config[\"series\"][\"process\"] == true\n if episode_status == true\n episode = Episode.new file\n if episode.is_ep?\n episode.status = handle_series episode \n media = episode.class.to_s\n end\n end\n \n # second we check if the file is music\n music_status = music_file(file) if $config[\"music_file\"][\"process\"] == true\n if music_status == true\n music = Music.new file\n if music.is_music?\n music.status = handle_music music \n media = music.class.to_s\n end\n end\n \n # finally we can handle rar's\n handle_rar(file) if file =~ /\\.rar$/ and file !~ /part\\d+\\.rar$/\n handle_rar(file) if file =~ /part01\\.rar$/\n end # get_files\n media\nend", "def convertTitlepage(podfiletype, podtitlepagearc, podtitlepagetmp, logkey='')\n if podfiletype == \"jpg\"\n FileUtils.cp(podtitlepagearc, podtitlepagetmp)\n logstring = 'already a jpg, just moved file'\n else\n `convert \"#{podtitlepagearc}\" \"#{podtitlepagetmp}\"`\n logstring = \"moved and converted (file was #{podfiletype})\"\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def format_io input\n input.each_line do |line|\n output.write format_log_line(line)\n end\n end", "def parse_logline(line) \n line.strip!\n split_line = line.split(/\\|/)\n addr = split_line[0].split(',').last.strip\n\n unless (addr =~ /[\\s|\\-]+/) \n @dns_map.synchronize do\n addr = @dns_map[addr] if @dns_map.include? addr\n end\n details = {}\n details[:upstream_response_time] = split_line[1].split(',').last.strip.to_f\n details[:time_local] = DateTime.strptime(split_line[2], '%d/%b/%Y:%H:%M:%S %Z')\n details[:status] = split_line[3].to_i\n details[:request_length] = split_line[4].to_i\n details[:body_bytes_sent] = split_line[5].to_i\n\n\n @log_entries.synchronize do\n @log_entries[addr] << details\n end\n end \n end", "def process_files(log)\n each_exercise_file do |root, position, original_id, title|\n\n description = markdown(root, 'description') || (log.no_description title; next)\n\n hint = markdown(root, 'hint')\n\n meta = meta(root) || (log.no_meta(title); next)\n\n test_code, test_extension = test_code(root) || (log.no_test title; next)\n\n extra_code, _extra_extension = extra_code(root)\n\n language = language(test_extension) || (log.no_lang(title); next)\n\n expectations = (expectations(root).try { |it| it['expectations'] } || []).map do |e|\n Expectation.new(binding: e['binding'], inspection: e['inspection'])\n end\n\n yield original_id,\n {title: title,\n description: description,\n hint: hint,\n tag_list: meta['tags'],\n locale: meta['locale'],\n language: language,\n expectations: expectations,\n author: @author,\n test: test_code,\n extra_code: extra_code,\n position: position}\n end\n end", "def parse_article_from_file article_file_name\n article_values = {}\n article_values[:content] = ''\n article_values[:introduction] = ''\n article_values[:tags] = []\n article_values[:authors] = []\n article_values[:title] = ''\n article_values[:date] = nil\n article_values[:updated_at] = nil\n next_is = ''\n\n puts \"Parsing: #{article_file_name}\"\n File.open(File.join(ARTICLE_PATH, article_file_name), 'r') do |article_file|\n article_file.each_line do |line|\n next if line.blank?\n ##### Checking what next line will be\n # Detect date\n if line.include?(DATE_DELIMITER)\n next_is = 'date'\n # Detect updated_at date\n elsif line.include?(UPDATED_AT_DELIMITER)\n next_is = 'updated_at'\n # Detect introduction\n elsif line.include?(INTRODUCTION_DELIMITER)\n next_is = 'introduction'\n # Detect content\n elsif line.include?(CONTENT_DELIMITER)\n next_is = 'content'\n elsif line.include?(TAGS_DELIMITER)\n next_is = 'tags'\n elsif line.include?(TITLE_DELIMITER)\n next_is = 'title'\n elsif line.include?(AUTHORS_DELIMITER)\n next_is = 'authors'\n else\n case(next_is)\n when 'date' then article_values[:date] = Time.zone.parse(line.strip)\n when 'updated_at' then article_values[:updated_at] = Time.zone.parse(line.strip)\n when 'introduction' then article_values[:introduction] << line.strip\n when 'content' then article_values[:content] << line\n when 'title' then article_values[:title] << line.strip\n when 'authors' then\n line.strip.split(',').each do |author|\n author.strip! # Removing eventual spaces at the begining or at the end\n article_values[:authors] << Author.where(:name => author).first unless Author.where(:name => author).empty?\n end\n when 'tags' then\n line.strip.split(',').each do |tag_name|\n tag_name.strip! # Removing eventual spaces at the begining or at the end\n # If the tag exists, add it to the list of tags\n if Tag.where(:name => tag_name).empty?\n article_values[:tags] << Tag.create(:name => tag_name)\n else\n article_values[:tags] << Tag.where(:name => tag_name).first\n end\n end\n end\n end\n end\n end\n return article_values\nend", "def msg_info_to_csv(base_file_name,x)\n # first parm is base file name then \n # expect single hash where key is msgid and value is \n # instance of log_msg_info class\n if !$msg_info_open then \n $msg_info_out = File.new($diag_dir + $directory_separator + $base_file_name + \"_msg_info.csv\",\"w\")\n $msg_info_open = true\n _title_line = \"server guid,server host,msg id,startup,processing status,create time,msg size,processing duration,\" +\n \"delivery begin time,in-queue wait duration,ident id,task id,\" +\n \"timeout value,method name,msg data store,data msg cmd,class name, instance number,error text,msg role,msg zone, create pid, process pid,priority,Args,worker id\"\n $msg_info_out.puts(_title_line)\n # don't make any assumptions about msg id begin or end values,\n # just process what you have....\n end\n x.each { |key, instance|\n# if key == 2 || key == '2' then\n# puts \"\"\n# end\n if instance.msg_queued_time == nil || instance.msg_queued_time == \"\" then\n if instance.deliver_begin_time.class != instance.create_time.class then\n# puts \"#{File.basename(__FILE__)}:#{__LINE__}\"\n instance.msg_queued_time = -1\n else\n instance.msg_queued_time = instance.deliver_begin_time - instance.create_time\n end\n end\n instance.data_msg_cmd = instance.data_msg_cmd.tr('[]',' ').strip if instance.data_msg_cmd != nil\n if instance.msg_class_name == nil then # if the message has no class name\n\n if instance.data_msg_cmd == nil then \n# puts \"#{__FILE__}:#{__LINE__}- #{instance.inspect}\"\n instance.msg_class_name = instance.msg_role\n else \n\n _work_array = instance.data_msg_cmd.split(\".\") # lets try to build one from the msg cmd\n if _work_array.size > 1 then # if the msg cmd has a '.' then assume that to be the class\n instance.msg_class_name = _work_array[0].tr('[',' ').strip # and inject it into the msg_class_name value\n end\n end \n end\n if $Startups[$startup_cnt][\"server_guid\"] != nil then\n if !$msg_server_guid.has_key?($Startups[$startup_cnt][\"server_guid\"]) || $msg_server_guid.empty? then\n $msg_server_guid[$Startups[$startup_cnt][\"server_guid\"]] = 1\n else\n $msg_server_guid[$Startups[$startup_cnt][\"server_guid\"]]+= 1\n end\n end\n\n if $Startups[$startup_cnt][\"hostname\"] != nil then\n if !$msg_server_host.has_key?($Startups[$startup_cnt][\"hostname\"]) || $msg_server_host.empty? then\n $msg_server_host[$Startups[$startup_cnt][\"hostname\"]] = 1\n else\n $msg_server_host[$Startups[$startup_cnt][\"hostname\"]] += 1\n end\n end\n if instance.msg_delivery_complete_status != nil then\n if !$msg_processing_status.has_key?(instance.msg_delivery_complete_status) || $msg_processing_status.empty? then\n $msg_processing_status[instance.msg_delivery_complete_status] = 1\n else\n $msg_processing_status[instance.msg_delivery_complete_status] += 1\n end\n end\n if instance.ident_id != nil then\n if !$msg_ident_id.has_key?(instance.ident_id) || $msg_ident_id.empty? then\n $msg_ident_id[instance.ident_id] = 1\n else\n $msg_ident_id[instance.ident_id] += 1\n end\n end\n if instance.task_id != nil then\n if !$msg_task_id.has_key?(instance.task_id) || $msg_task_id.empty? then\n $msg_task_id[instance.task_id] = 1\n else\n $msg_task_id[instance.task_id] += 1\n end\n end\n if instance.msg_method_name != nil then\n if !$msg_method_name.has_key?(instance.msg_method_name) || $msg_method_name.empty? then\n $msg_method_name[instance.msg_method_name] = 1\n else\n $msg_method_name[instance.msg_method_name] += 1\n end\n end\n if instance.msg_data_store != nil then\n if !$msg_data_store.has_key?(instance.msg_data_store) || $msg_data_store.empty? then\n $msg_data_store[instance.msg_data_store] = 1\n else\n $msg_data_store[instance.msg_data_store] += 1\n end\n end\n if instance.data_msg_cmd != nil then\n if !$msg_data_msg_cmd.has_key?(instance.data_msg_cmd) || $msg_data_msg_cmd.empty? then\n $msg_data_msg_cmd[instance.data_msg_cmd] = 1\n else\n $msg_data_msg_cmd[instance.data_msg_cmd] += 1\n end\n end\n if instance.msg_class_name != nil then\n if !$msg_class_name.has_key?(instance.msg_class_name) || $msg_class_name.empty? then\n $msg_class_name[instance.msg_class_name] = 1\n else\n $msg_class_name[instance.msg_class_name] += 1\n end\n end\n if instance.error_text != nil then\n if !$msg_error_text.has_key?(instance.error_text) || $msg_error_text.empty? then\n $msg_error_text[instance.error_text] = 1\n else\n $msg_error_text[instance.error_text] += 1\n end\n end\n if instance.msg_role != nil then\n if !$msg_role.has_key?(instance.msg_role) || $msg_role.empty? then\n $msg_role[instance.msg_role] = 1\n else\n $msg_role[instance.msg_role] += 1\n end\n end\n if instance.msg_zone != nil then\n if !$msg_zone.has_key?(instance.msg_zone) || $msg_zone.empty? then\n $msg_zone[instance.msg_zone] = 1\n else\n $msg_zone[instance.msg_zone] += 1\n end\n end\n# if instance.msg_args != nil then\n if !$msg_args.has_key?(instance.msg_args) || $msg_args.empty? then\n $msg_args[instance.msg_args] = 1\n else\n $msg_args[instance.msg_args] += 1\n end\n# end\n $msg_info_out.puts(\"#{$Startups[$startup_cnt][\"server_guid\"]},#{$Startups[$startup_cnt][\"hostname\"]},\" +\n \"#{key},#{instance.msg_startup_cnt},#{force_empty_string(instance.msg_delivery_complete_status)},#{instance.create_time},\" +\n \"#{instance.msg_size},#{instance.msg_process_duration},#{instance.deliver_begin_time},#{instance.msg_queued_time},\" +\n \"#{instance.ident_id},#{instance.task_id},#{instance.timeout_duration},#{force_empty_string(instance.msg_method_name)},\" +\n \"#{force_empty_string(instance.msg_data_store)},#{force_empty_string(instance.data_msg_cmd)},#{force_empty_string(instance.msg_class_name)},#{instance.msg_instance_id},\" +\n \"#{force_empty_string(instance.error_text)},\" +\n \"#{force_empty_string(instance.msg_role)},#{force_empty_string(instance.msg_zone)},\" +\n \"#{instance.put_pid},#{instance.process_pid},#{instance.msg_priority},#{force_empty_string(instance.msg_args)},#{instance.worker_id}\")\n \n }\n if x.size > 1 then # if only a single element in hash then leave open as updates are dribbling ine\n #otherwise expect it is final cleanup with many instances\n # and close up at that point\n $msg_info_out.close\n $msg_info_open = nil\n end\n end", "def process_one_dir(dir)\n Dir.glob(dir + '/*.txt') do |log_file|\n\n File.open(log_file, \"r\") do |infile|\n size = \"UNKNOWN\"\n jobid = \"UNKNOWN\"\n error = \"NO\"\n while (line = infile.gets)\n if (line.strip == \"------------------------------------------\")\n jobid, nnodes, ntasks, query, dbsize, run, nsplits, nrecords = parse_log_header(infile)\n next\n end\n if (line.include? \"VP:partitioningTime\")\n partitioningTime = line.split(\"VP:partitioningTime:\")[1].strip\n partitioningTime.sub!(\"ms\",\"\").strip!\n end\n if (line.include? \"Running job:\")\n hadoopjob = line.split(\"Running job:\")[1].strip\n end\n if (line.include? \"COMPOSING_TIME_LOAD_PARTIALS=\")\n loadpartials = line.split(\"COMPOSING_TIME_LOAD_PARTIALS=\")[1].strip\n end \n if (line.include? \"COMPOSING_TIME_COMBINE_PARTIALS=\")\n combinepartials = line.split(\"COMPOSING_TIME_COMBINE_PARTIALS=\")[1].strip\n end \n if (line.include? \"Copy result time:\")\n transferResult = line.split(\"Copy result time:\")[1].strip\n transferResult.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Total execution time:\")\n totaltime = line.split(\"Total execution time:\")[1].strip\n totaltime.sub!(\"ms.\",\"\").strip!\n end \n if (line.include? \"Size of output\")\n size = line.split(\":\")[1]\n size = size.split(\" \")[0].strip\n end\n if (line.include? \"Error\")\n error = \"YES\"\n end\n if (line.include? \"Failed reduce tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n if (line.include? \"Failed map tasks\")\n if line.split(\"=\")[1].strip.to_i > 0\n error = \"YES\"\n end\n end\n end\n nfragments = nsplits.to_i * nrecords.to_i\n puts \"#{jobid};#{hadoopjob};#{nnodes};#{nnodes.to_i * ntasks.to_i};#{query};#{run};#{dbsize};#{ntasks};#{nfragments};#{nsplits};#{nrecords};#{partitioningTime};#{loadpartials};#{combinepartials};#{transferResult};#{totaltime};#{size};#{error}\"\n end\n end\nend", "def parse\n logs = File.open(log_file).read\n raise InvalidFile if (logs.empty?)\n logs.each_line do |line|\n api_path, ip_address = line.split\n raise InvalidFile if (api_path.nil? || ip_address.nil?)\n parsed_results[api_path] << ip_address\n end\n parsed_results\n end", "def parse_multifile(filename: \"\", type: \"old\")\n !filename.empty? ? file = File.binread(filename) : return\n case type\n when \"old\"\n file.split(\"\\n\").map(&:strip).reject(&:empty?).map{ |m|\n title = m.split('#')[0][1..-1] rescue \"\"\n author = \"Metanet Software\"\n map = parse_map(data: m.split(\"#\")[1], type: \"old\") rescue {tiles: [], objects: []}\n {title: title, author: author, tiles: map[:tiles], objects: map[:objects]}\n }\n else\n print(\"ERROR: Incorrect type (old).\")\n return 0\n end\nend", "def flog(*files_or_dirs)\n files = Flog.expand_dirs_to_files(*files_or_dirs)\n\n files.each do |file|\n begin\n # TODO: replace File.open to deal with \"-\"\n ruby = file == '-' ? $stdin.read : File.read(file)\n warn \"** flogging #{file}\" if option[:verbose]\n\n ast = @parser.process(ruby, file)\n next unless ast\n mass[file] = ast.mass\n process ast\n rescue RegexpError, SyntaxError, Racc::ParseError => e\n if e.inspect =~ /<%|%>/ or ruby =~ /<%|%>/ then\n warn \"#{e.inspect} at #{e.backtrace.first(5).join(', ')}\"\n warn \"\\n...stupid lemmings and their bad erb templates... skipping\"\n else\n unless option[:continue] then\n warn \"ERROR! Aborting. You may want to run with --continue.\"\n raise e\n end\n warn file\n warn \"#{e.inspect} at #{e.backtrace.first(5).join(', ')}\"\n end\n end\n end\n end", "def extract_lines\n reg = Regexp.new('^\\[' + @date + ':\\d\\d:\\d\\d:\\d\\d\\].*\\n', Regexp::MULTILINE)\n if File.exists?(@@gzlogfile)\n require 'zlib'\n gzfile = open(@@gzlogfile)\n @gz = Zlib::GzipReader.new(gzfile)\n @gz.read.match(reg).to_s.split(\"\\n\")\n end\n @file.read.match(reg).to_s.split(\"\\n\")\n end", "def getLogsSingleFileByDate(path,start_file_name,from_date,asc_by_fname,persist_from_date)\n require 'date'\n logs_date = Date.new\n valid_items = nil\n if(from_date != nil)\n begin\n from_date = Date.parse(from_date)\n rescue Exception => ex\n puts \"[Logstat] : Incorrect 'from_date' parameter: #{from_date}\"\n return\n end\n end\n date_regex = /\\A((\\d{1,2}[-\\/]\\d{1,2}[-\\/]\\d{4})|(\\d{4}[-\\/]\\d{1,2}[-\\/]\\d{1,2}))/\n list_logs = Array.new\n check_log_start = false\n log_items = \"\"\n\n File.foreach(path+\"/\"+start_file_name) do |line|\n #check first line start with a date string\n if((line.strip != \"\") && (line =~ date_regex))\n str_date = line[date_regex,1]\n #check if date is validate\n begin\n logs_date = Date.parse(str_date)\n #if monitor type is date\n if(from_date != nil)\n #if monitor only 1 file or multi file with sort by ASC file name\n if(asc_by_fname == nil || asc_by_fname) \n if(from_date <= logs_date)\n check_log_start = true\n valid_items = true\n else\n if(valid_items)\n list_logs << log_items\n end\n valid_items = false\n end\n else\n #if monitor multi file with sort by DESC file name\n if(from_date >= logs_date)\n check_log_start = true\n valid_items = true\n else\n if(valid_items)\n list_logs << log_items\n end\n valid_items = false\n end\n end\n else\n check_log_start = true\n end\n persist_from_date[\"persist_from_date\"] = str_date\n rescue Exception => e\n check_log_start = false\n puts \"[Logstat] : #{e}\"\n end\n else\n check_log_start = false\n end\n #Add log_items to list_logs\n if(valid_items.nil?)\n if(check_log_start )\n if(log_items.strip != \"\")\n list_logs << log_items\n end\n #New logs items\n log_items = line\n else\n if(log_items.strip != \"\")\n log_items += line\n end\n end\n else\n #if a new logs start,and previous items is valid then add it to list log\n if(check_log_start && valid_items)\n if(log_items.strip != \"\")\n list_logs << log_items\n end\n #New logs items\n log_items = line\n else\n if(log_items.strip != \"\")\n log_items += line\n end\n end\n end\n end\n\n #Last items\n if(valid_items == true )\n list_logs << log_items\n end\n return list_logs\nend", "def process_file(offset = 0)\n batch = Array.new\n idx = 0\n IO.readlines(@logfile).each do |line|\n if (idx += 1) <= offset\n next\n end\n\n m = line.match(@regex)\n if !m\n $stderr.puts \"Dropping logline '#{line}' because it does not match the parsing regex: #{@regex}\"\n next\n end\n\n if batch.size >= @batch_size\n enqueue_batch(batch.dup)\n batch.clear()\n end\n\n batch.push(m)\n end\n\n if batch.size > 0\n enqueue_batch(batch)\n end\n\n return idx\n end", "def convert_log_file_time(string)\n\tarray=Array.new(2)\t\n\tarray=string.gsub(/:/,\".\").split(\"/\")\n\t#if (array[1]!=nil or array[1]==\"\") then array[1]=string.split(\"/\")[1].gsub(/:/,\".\") end\n\treturn array\nend", "def parse_file\n IO.binread(@auth_log.file).split(\"\\n\").each { |line| build_block(line) }\n end", "def parse( logger = nil )\n result = nil\n line_count = 0\n detector_fin1_res = ContextDetector.new( FIN1_RESULT_TYPEDEF, logger )\n detector_fin2_res = ContextDetector.new( FIN2_RESULT_TYPEDEF, logger )\n detector_fin3_res = ContextDetector.new( FIN3_RESULT_TYPEDEF, logger )\n detector_uisp_res = ContextDetector.new( UISP_RESULT_TYPEDEF, logger )\n detector_fin1_sta = ContextDetector.new( FIN1_STARTLIST_TYPEDEF, logger )\n\n File.open( @full_pathname ) do |f|\n f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:\n curr_line = EncodingTools.force_valid_encoding( curr_line )\n line_count += 1\n # While reading the file line by line, detect the type:\n if detector_fin3_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN3 RESULT-type file detected!\" ) if logger\n result = Fin3ResultDefs.new( logger )\n break\n\n elsif detector_fin1_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN1 RESULT-type file detected!\" ) if logger\n result = FinResultDefs.new( logger )\n break # Break as soon as we have a match (FIFO wins)\n\n elsif detector_fin2_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN2 RESULT-type file detected!\" ) if logger\n result = Fin2ResultDefs.new( logger )\n break\n\n elsif detector_uisp_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"UISP RESULT-type file detected!\" ) if logger\n result = UispResultDefs.new( logger )\n break\n\n elsif detector_fin1_sta.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN1 STARTLIST-type file detected!\" ) if logger\n result = FinStartListDefs.new( logger )\n break\n\n else\n nil\n end\n end\n end\n result\n end", "def replaceFormats(arr, html, logkey='')\n filecontents = html\n if arr.any?\n arr.each do |r|\n imgfilename = r.split(\".\").shift\n filecontents = filecontents.gsub(/#{r}/,\"#{imgfilename}.jpg\\\"\")\n end\n else\n 'n-a'\n end\n return filecontents\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def log_source\n if is_info?\n file, line = words[1].split(':')\n return [file, line.to_i]\n else\n nil\n end\n end", "def test_format\n\n\t data = analyse_log(@filename,@keywords, @start, Time.parse(\"31.12.3000\"), @output_file)\n \tdata_hist = prepare_data(data, @keywords, @start, 3600)\n\n \tassert_equal(true, data_hist.keys[0].class == String)\n \tassert_equal(true, data_hist[@keywords[0]].keys[0].class == Time)\n \tassert_equal(true, data_hist[@keywords[0]][0].class == Fixnum)\n\tend", "def log_entry(line)\n raw = line.split(@@break)\n map = Hash.new\n raw.each do |keys|\n parts = keys.split(@@value)\n map.store(parts[0],parts[1])\n end\n #unless USEMEMCACHE != true\n # if Staticentry.get_cache(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s)).nil?\n # static = Logtype.find(map['logtype_id']).staticentries.new\n # static.data = map['data']\n # static.save\n # end\n #else\n static = Logtype.find(map['logtype_id']).staticentries.new\n static.data = map['data']\n static.save\n #end\n unless USEMEMCACHE != true\n static = Staticentry.get_cache(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s))\n else\n static = Staticentry.find(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s))\n end\n event = static.events.new\n event.etime = map['etime'].to_i\n event.loglevel_id = map['loglevel_id'].to_i\n event.payload = map['payload']\n event.logtype_id = map['logtype_id'].to_i\n event.agent_id = map['agent_id'].to_i\n begin\n a = Agent.find(map['agent_id'])\n l = Logtype.find(map['logtype_id'])\n if a.logtypes.member?(l)\n if check_key(a, map['authkey']) \n event.save\n else\n ActiveRecord::Base.logger.error \"Event dropped -- invalid agent authkey sent for #{a.name}\"\n send_data \"1\"\n end\n else\n ActiveRecord::Base.logger.error \"Event dropped -- Agent #{a.name} is not a member of logtype #{l.name}\"\n send_data \"2\"\n end\n rescue ActiveRecord::RecordNotFound\n ActiveRecord::Base.logger.error \"Event dropped -- invalid agent_id or logtype_id specified\"\n send_data \"3\"\n end\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.debug \"New event logged from #{host} \\n -- Log data: #{line}\"\n end", "def parse\n\tloop do\n\t\tif await =~ /(\\S+) (\\S+) (\\S+) \\[(.*?)\\] \"(\\S+) (\\S+) (\\S+)\" (\\S+) (\\S+)/\n\t\t\tlog_entry = $~.captures.zip(COLNAMES, COLTYPES).\n\t\t\t\tmap{|val, name, type| [name, val.send(type)] }.\n\t\t\t\tout_connect(Hash.new)\n\t\t\tyield log_entry\n\t\tend\n\tend\nend", "def convert_message_line(line)\n line_array = line.split(' ')\n human_timestamp = Time.parse(line_array[0..2].join(' '))\n format(human_timestamp, line_array, 3)\nend", "def convert_line_to_event(line, es)\n\t\t\tbegin\n\t\t\t\tline.chomp! # remove \\n\n\t\t\t\[email protected](line) { |time, record|\n\t\t\t\t\tif time && record\n\t\t\t\t\t\tes.add(time, record)\n identifier = record[@identifier].gsub(/\\s+/, '')\n if [email protected] identifier\n @redis.set identifier, true\n @redis.expire identifier, 60*60*24*45\n get_additional_data(identifier)\n end\n else\n\t\t\t\t\t\tlog.warn \"pattern not match\"\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue => e\n\t\t\t\tlog.warn line.dump, :error => e.to_s\n\t\t\t\tlog.debug_backtrace(e.backtrace)\n\t\t\tend\n\t\tend", "def read_failing_log()\n failed_files = []\n\n # Read in the file\n file = File.readlines(@failing_log)\n\n # Get lines which begin with rspec\n file.each do |line|\n if line =~ /rspec \\.\\//\n # Get the file name only\n failed_files << get_error_info(line)\n end\n end\n\n return failed_files\n end", "def processa_arquivo(caminho_logs = nil, caminho_ips_ignorados = nil)\n if caminho_logs.nil?\n imprime_banner\n else\n begin\n obtem_ips_ignorados caminho_ips_ignorados\n arquivo = File.open caminho_logs, 'r'\n puts \"Processando arquivo #{caminho_logs}...\"\n arquivo.each_line do |linha|\n if linha_valida? linha\n ip_match = linha.match IP_REGEX\n if !ip_match.nil? && !@lista_ignorados.include?(ip_match.to_s)\n data_match = linha.match DATA_REGEX\n insere_localizacao ip_match.to_s, Date.parse(data_match.to_s)\n end\n end\n end\n arquivo.close\n ordena_infos_por_longitude\n exporta_infos\n exporta_longitudes\n puts \"OK.\"\n rescue Errno::ENOENT\n puts \"Arquivo não encontrado.\"\n end\n end\nend", "def assign_csv_values_to_genericfile(row, generic_file)\n field_mappings = @import.import_field_mappings.where('import_field_mappings.key != ?', 'image_filename')\n field_mappings.each do |field_mapping|\n\n key_column_number_arr = @import.import_field_mappings.where(key: field_mapping.key).first.value.reject!{|a| a.blank? } \n key_column_value_arr = []\n\n # For certain fields the values in the csv are comma delimeted and need to be parsed\n if field_mapping.key == 'subject'\n key_column_number_arr.each do |num|\n key_column_value_arr = key_column_value_arr + (row[num.to_i].try(:split, ',') || [])\n end\n elsif field_mapping.key == 'collection_identifier'\n # it's not a multivalue field so let's just get the first mapping\n key_column_number_arr.each do |num|\n generic_file.collection_identifier = row[num.to_i]\n break\n end\n\n elsif field_mapping.key == 'measurements'\n key_column_number_arr.each do |num|\n measurement_hash = measurement_format_for(row[num.to_i].try(:strip))\n unless measurement_hash.nil?\n #insert field as a measurement object\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:width], measurement_unit: measurement_hash[:unit], measurement_type: \"width\") \n \n generic_file.measurements << measurement\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:height], measurement_unit: measurement_hash[:unit], measurement_type: \"height\") \n generic_file.measurements << measurement\n end\n end\n\n elsif field_mapping.key == 'materials'\n key_column_number_arr.each do |num|\n material_hash = material_format_for(row[num.to_i].try(:strip))\n unless material_hash.nil?\n material = Osul::VRA::Material.create(material_hash)\n generic_file.materials << material\n end\n end\n\n else\n key_column_number_arr.each do |num|\n key_column_value_arr << row[num.to_i]\n end\n end\n\n # materials and measurements are associations so they are updated differently \n unless field_mapping.key == 'materials' or field_mapping.key == 'measurements' or field_mapping.key == 'collection_identifier'\n key_column_value_arr = key_column_value_arr.map.reject{|a| a.blank?}\n generic_file.send(\"#{field_mapping.key}=\".to_sym, key_column_value_arr)\n end\n end\n end", "def getSyslog(syslog_config_file_path, log_type, from_time)\n # Time start monitor\n fromTime = 0\n if from_time != nil && from_time != ''\n begin\n fromTime = DateTime.parse(from_time).strftime(\"%s\").to_i\n rescue Exception => e\n puts \"[Logstat]: Invalid date : #{from_time}\"\n return\n end\n end\n if(log_type.nil?)\n puts \"[Logstat]: Log type is required !\"\n return\n end\n if(syslog_config_file_path.nil?)\n puts \"[Logstat]: Path to syslog is required !\"\n return\n elsif(!File.exist?(syslog_config_file_path))\n puts \"[Logstat]: Path to syslog is not avaiable !\"\n return\n end\n persist_from_time = from_time\n # PROCESS SYSLOG CONFIGURATION\n mapSyslogConfig = Hash.new\n listSyslog = Array.new\n exitsLogType = false\n File.foreach(syslog_config_file_path) { |lineDir|\n unless lineDir.chomp.empty?\n unless lineDir.include? '#'\n if lineDir.include? log_type\n exitsLogType = true\n correspondingFile = lineDir.split(\" \")[1]\n # GET DATA INPUT\n File.foreach(correspondingFile) { |line|\n regxDate = \"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{2} \\\\d{2}:\\\\d{2}:\\\\d{2}\"\n logTime = DateTime.parse(line.match(regxDate).to_s).strftime(\"%s\").to_i\n if (logTime >= fromTime)\n persist_from_time = line.match(regxDate).to_s\n listSyslog << line\n end\n }\n end\n end\n end\n }\n if exitsLogType == false\n File.foreach(syslog_config_file_path) { |lineDir|\n if lineDir.include? \"logdir\"\n lstLogDir = lineDir.split(\" = \")\n correspondingFile = \"#{lstLogDir[1]}/#{log_type}.log\"\n # GET DATA INPUT\n File.foreach(correspondingFile) { |line|\n regxDate = /\\A((\\d{1,2}[-\\/]\\d{1,2}[-\\/]\\d{4})|(\\d{4}[-\\/]\\d{1,2}[-\\/]\\d{1,2}))/\n logTime = DateTime.parse(line.match(regxDate).to_s).strftime(\"%s\").to_i\n if (logTime >= fromTime)\n persist_from_time = line.match(regxDate).to_s\n listSyslog << line\n end\n }\n end\n }\n end\n finalData = Hash.new\n persist_data = Hash.new\n persist_data[\"from_time\"] = persist_from_time\n finalData[\"list_logs\"] = listSyslog\n finalData[\"persistent_data\"] = persist_data\n return finalData\nend", "def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\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 =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end", "def handle_text_line(line, record)\n line =~ record.match ? {:record_type => record.name, :line => line} : nil\n end", "def convert_files\n\n AppLogger.log.info(\"Starting JSON to CSV conversion.\")\n start_time = Time.now\n\n #Load keys from the Tweet Template.\n activity_template_file = @config.tweet_template\n contents = File.read(activity_template_file)\n activity_template = JSON.parse(contents)\n keys_template = Array.new\n keys_template = get_keys(activity_template)\n #Initialize @keys\n @keys = Array.new\n\n #Build header based on these keys.\n header = build_header(keys_template)\n\n #TODO - if we are handling compressed files, unzip, convert, then rezip?\n\n #tour output folder with current UUID and convert files\n\n Dir.glob(\"#{@config.inbox}/*.json\") do |file|\n\n AppLogger.log.debug(\"DEBUG, convert_files: Converting #{File.basename(file)} file...\")\n\n\n csv_filename = \"#{@config.outbox}/#{File.basename(file, \".*\")}.csv\"\n csv_file = File.open(csv_filename, \"w\")\n csv_file.puts header\n\n #This file has one or more activities in it, with a \"info\" footer.\n contents = File.read(file)\n\n activities = []\n\n #Inspect contents and determine the source of the data... Search API, HPT?\n #Markers:\n # Search API: file starts with '{\"results\":[' or '{\"next\":['.\n # HPT: last line is a \"info\" footer.\n # Realtime: contents start with '{\"id\":'. ##Not handling this yet....\n\n if (contents.start_with?('{\"results\":[') or contents.start_with?('{\"next\":'))\n\n json_contents = JSON.parse(contents)\n\n json_contents[\"results\"].each do |activity|\n activities << activity.to_json\n end\n\n elsif contents.include?('\"info\":{\"message\":\"Replay Request Completed\"')\n\n contents.split(\"\\r\")[0..-2].each { |line| #drop last \"info\" member.\n #Dev TODO: just added the \"id\": match, untested\n if line.include?('created_at') or line.include?('postedTime')\n activities << line\n end\n }\n\t\t \n\t else\n\n\t\t contents.split(\"\\n\").each { |line| #drop last \"info\" member.\n\t\t\t#Dev TODO: just added the \"id\": match, untested\n\t\t\tif line.include?('retweetCount') or line.include?('retweet_count')\n\t\t\t activities << line\n\t\t\tend\n\t\t }\n\n end\n\n activities.each { |activity|\n\n begin\n activity_hash = JSON.parse(activity)\n rescue Exception => e\n AppLogger.log.error(\"ERROR in convert_files: could not parse activity's JSON: #{e.message}\")\n end\n\n keys_activity = Array.new\n keys_activity = get_keys(activity_hash)\n\n #Initialize @keys\n @keys = Array.new\n\n #OK, time to compare this activity's payload with the template and grab only the matching keys.\n csv_array = []\n\n keys_template.each { |key_template|\n\n if keys_activity.include?(key_template)\n\n #p \"matched on #{key_template}\"\n\n if @config.arrays_to_collapse.split(',').any? { |item| key_template.include?(item) }\n #p \"NEED TO HANDLE SPECIAL CASE: #{key_template}\"\n data = get_collapsed_array_data(activity_hash, key_template)\n else\n #Go get this data and add it to csv_array\n data = get_data(activity_hash, key_template)\n end\n\n csv_array << data\n else\n csv_array << nil\n end\n }\n\n #Write csv array to CSV.\n csv_activity = CSV.generate do |csv|\n csv << csv_array\n end\n\n csv_file.puts csv_activity.to_s\n }\n\n csv_file.close #Close new CSV file.\n\n\n if ([email protected]_json)\n File.delete(file) #Delete json version.\n else #Move it to 'processed' folder.\n FileUtils.mv(file, \"#{@config.processed_box}/#{file.split('/')[-1]}\")\n end\n end\n\n AppLogger.log.info(\"Finished JSON to CSV conversion. Conversion required #{Time.now - start_time} seconds.\")\n\n end", "def proccess_lines(input)\n CSV.foreach(input, headers: true, header_converters: :symbol) do |row|\n line_parser = LineParser.new(row)\n\n if line_parser.valid?\n output_file << line_parser.to_csv\n elsif !line_parser.empty?\n error_file << line_parser.to_csv\n end\n end\n end", "def slurp(f, contents)\n pat = /.*0x\\h{8}.*:(.*)$/\n pat2 = /\\s+(0x\\h{8})/\n # read in a logfile.\n # format is:\n # addr: N dwords up to 4\n f.each_line do |l|\n # strip the address\n m = l.match(pat)\n if m && m.size == 2\n # if good, m[1] is 'the rest'\n a = m[1].scan(pat2) # scan for ea val. usually 4 till the last one\n a.each do |x|\n contents << x[0].to_i(16) # convert hex strs to the array.\n end\n end\n end\nend", "def update\n# read the first 2 lines - it should be enough\n# lsvob starts with \"Tag: \\BARABOOM\"\n# both lsreplica and lsepoch start with \"For VOB replica \"\\BARABOOM\":\"\n# the second line in lsreplica is \"replica \"name\"\"\n# the second line in lsepoch is \"Oplog IDs for row...\" or \"Actual oplog IDs for...\"\n# sometimes lsepcoh has multiple lines in the beginning with \"For VOB replica...\"\n parsed_line = Hash[ :vob => \"Tag: \",\n :lsepoch => \"For VOB replica \",\n :replica => \"replica \",\n :epoch => \"Oplog IDs for row \",\n :epoch_actual => \"Actual oplog IDs for \"]\n\n if params[:lslog].size > 0\n _line1 = params[:lslog].gets\n _line2 = params[:lslog].gets\n params[:lslog].rewind\n if !(_line1.nil? || _line2.nil?)\n if _line1.match(parsed_line[:vob].to_s)\n Site.lsvob_scan(params)\n elsif _line2.match(parsed_line[:epoch].to_s) || \n _line2.match(parsed_line[:epoch_actual].to_s) || \n _line2.match(parsed_line[:lsepoch].to_s)\n Site.lsepoch_scan(params)\n elsif _line2.match(parsed_line[:replica].to_s)\n Site.lsreplica_scan(params)\n else\n # error message\n flash[:notice] = \"INVALID FORMAT! - check the input file!\"\n end\n else\n # error message\n flash[:notice] = \"INVALID FORMAT! - check the input file!\"\n end\n end\n super\n end", "def collectFileInformation(tracks, flavor, startTimes, real_start_time)\n startTimes.each do |file|\n pathToFile = File.join(file[\"filepath\"], file[\"filename\"])\n\n BigBlueButton.logger.info( \"PathToFile: #{pathToFile}\")\n\n if (File.exists?(pathToFile))\n # File Integrity check\n if (!FFMPEG::Movie.new(pathToFile).valid?)\n BigBlueButton.logger.info( \"The file #{pathToFile} is ffmpeg-invalid and won't be ingested\")\n next\n end\n\n tracks.push( { \"flavor\": flavor,\n \"startTime\": file[\"timestamp\"] - real_start_time,\n \"path\": pathToFile\n } )\n end\n end\n\n return tracks\nend", "def types(file, line, col); end", "def types(file, line, col); end", "def collect()\n\n filename = ARGV[0]\n puts \"[-] opening #{filename}\"\n puts\n f = File.open(filename, \"r\") # user input\n\n\n f.each_with_index do |line, index|\n\t # don't do any of this if the line is nil\n\t if line != nil then\n vuln = line.split('|')\n\t\t # Time Stamps had a array length of 4 and we dont really \n\t\t # care to see timestamps\n\t\t # We want only results\n\t\t # In some cases the results provided no information and the\n\t\t # second line was blank so we got rid of them\n\t\t if vuln.size > 4 && vuln[0] == 'results' && vuln[1] != '' then\n\n type = vuln[TYPE]\n port = vuln[PORT]\n descriptions = vuln[DESCRIPTION].split(\"\\\\n\")\n number = vuln[NUMBER]\n ip = vuln[IP]\n \n # Check if the user wants this result logged\n if log_result?(type) \n\n\t\t\t # Add the ip address to the findings hash and use\n\t\t\t # the result number as the key\n if !$findings[number][port].include?(ip) \n if $onlyip.length > 1\n if $onlyip == ip then\n\t\t\t $findings[number][port].push(ip)\n end\n else\n\t\t\t $findings[number][port].push(ip)\n end\n end\n \n\t \t\t # Store descriptions once in a seperate hash\n descriptions.each do | line |\n line.gsub!(\"\\\\r\", \" \")\n end\n\n # Log what type of vulnerability this is for display\n # later\n log_type(type)\n \n\t \t\t\tinfo = [type, descriptions]\n if !$descriptions[number][info][port].include?(ip)\n\t\t \t\t $descriptions[number][info][port].push(ip)\n end\n end\n\t\t end\n\t end\n end \nend", "def log_line_parse(line, options={})\n options={\n :link_to_url => nil, #url /browse/server/#chatroom/00000000\n }.update options\n if line =~ /^---/\n \"\" #strip log open/close stuff. \n else\n date = line[0..7] #ignore 00:00:00\n hx = Digest::MD5.hexdigest(date)\n line = line[8..-1]\n type = case line\n when /^ * [^ ]+ /\n :action_line\n when /^<.[^>]+>/\n :message_line\n when /^-!-/\n case line\n when /now known as/\n :nick_change_line\n when /has (joined|left|quit)/\n :join_part_quit_line\n when /^-!- mode\\//\n :mode_change_line\n end\n end\n type = :unknown_line unless type\n date_line = '<span class=\"line-date\">'\n date_line << \"<a href=\\\"#{options[:link_to_url]}##{hx}\\\">\" if options[:link_to_url]\n date_line << date\n date_line << '</a>' if options[:link_to_url]\n date_line << '</span>'\n%s{<span class=\"line-date\">#{date}</span>}\n<<-END\n <div class=\"#{type}\"><a name=\"#{hx}\">\n #{date_line}\n <span class=\"line-body\">\n #{send(type, line)}\n </span>\n </a></div>\nEND\n end\nend", "def read_full_log_entry\n if @reached_eof\n return nil\n end\n\n lines = []\n log_entry = nil\n begin\n loop do\n line = @rfr.readline\n if line.match(MATCHER)\n log_entry = LogLine.new(line, $1 || @log_alias, $2, $3, $4)\n break\n end\n lines.unshift line\n end\n rescue EOFError\n @reached_eof = true\n # Disguard any lines built up as the line starting the log message has not been found\n return nil\n end\n log_entry.append(lines.join(\"\"))\n log_entry\n end", "def parse_event_stream(str, collection)\n count = 0\n\n str.each_line do |line|\n\n # See if it's sane\n next unless(m = line.match(DATA_LINE_RX))\n event = m[:event]\n\n begin\n record = JSON.parse(event)\n next unless record.is_a?(Hash)\n # insert\n collection.save(record)\n count += 1\n rescue JSON::ParserError\n # We don't care.\n end\n end\n\n @log.info \"Read #{count} events into collection '#{collection.name}'\"\n rescue StandardError => se\n @log.error \"Failed to parse event stream. Dropping collection '#{collection.name}' to ensure consistency.\"\n @db.drop_collection(collection.name)\n end", "def logCheckUsable(logfileTail)\n\n lastFrame = -1\n currentFrame = -1\n fileStatus = Hash[\"finishedRestartVel\" => false,\n \"wroteRestartVel\" => false,\n \"wroteRestartXsc\" => false,\n \"finishedRestartCoor\" => false,\n \"wroteRestartCoor\" => false,\n \"wroteDcd\" => false]\n \n # Use tail to get last lines of logfile \n #print \"logfileTail: #{logfileTail}\\n\"\n tailList = logfileTail.split(\"\\n\").reverse\n\n # Grab the last set of written restart files\n tailList.each do |i|\n if i =~ /FINISHED WRITING RESTART VELOCITIES/ then\n #print \" finishedRestartVel\\n\"\n fileStatus[\"finishedRestartVel\"] = true\n elsif i =~ /WRITING VELOCITIES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartVel\\n\"\n fileStatus[\"wroteRestartVel\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartXsc\\n\"\n fileStatus[\"wroteRestartXsc\"] = true\n currentFrame = $1.to_i\n elsif i =~ /FINISHED WRITING RESTART COORDINATES/ then\n #print \" finishedRestartCoor\\n\"\n fileStatus[\"finishedRestartCoor\"] = true\n elsif i =~ /WRITING COORDINATES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartCoor\\n\"\n fileStatus[\"wroteRestartCoor\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING COORDINATES TO DCD FILE AT STEP (\\d+)/ then\n #print \" wroteDcd\\n\"\n fileStatus[\"wroteDcd\"] = true\n currentFrame = $1.to_i\n end\n \n if (lastFrame < 0) & (currentFrame > 0) then\n lastFrame = currentFrame\n elsif lastFrame != currentFrame then\n print \" missing\\n\"\n fileStatus.each_pair do |key,val|\n if !val then\n print \" #{key}\\n\"\n end\n end\n print \" currentFrame: #{currentFrame}\\n\"\n print \" lastFrame: #{lastFrame}\\n\"\n return \"broken\"\n end\n\n fileStatusCount = 0\n fileStatus.each_value do |i|\n if i then\n fileStatusCount += 1\n end\n end\n\n if fileStatusCount == 6 then\n print \" last frame: #{lastFrame}\\n\"\n return \"usable\"\n end\n end\n \n return \"unknown\"\nend", "def parse\n @parsed_values = {}\n @buffer = {}\n @last_key_type = \"\"\n @errors = []\n File.foreach(@path_to_po) do |line|\n line = line.chomp\n case line\n # Empty lines means we have parsed one full message\n # so far and need to flush the buffer\n when /^$/ then flush_buffer\n\n # These are the po file comments\n # The second '#' in the following regex is in square brackets\n # b/c it messed up my syntax highlighter, no other reason.\n when /^(#[^~]|[#]$)/ then next\n\n when /^(?:#~ )?msgctxt\\s+(.*)/ then add_to_buffer($1, :msgctxt)\n\n when /^(?:#~ )?msgid\\s+(.*)/ then add_to_buffer($1, :msgid)\n\n when /^(?:#~ )?msgid_plural\\s+(.*)/ then add_to_buffer($1, :msgid_plural)\n\n when /^(?:#~ )?msgstr\\s+(.*)/ then add_to_buffer($1, :msgstr_0)\n\n when /^(?:#~ )?msgstr\\[0\\]\\s+(.*)/ then add_to_buffer($1, :msgstr_0)\n\n when /^(?:#~ )?msgstr\\[(\\d+)\\]\\s+(.*)/ then add_to_buffer($2, \"msgstr_#{$1}\".to_sym)\n\n when /^(?:#~ )?\"/ then add_to_buffer(line)\n\n else\n @errors << [\"Strange line #{line}\"]\n end\n end\n\n # In case the file did not end with a newline, we want to flush the buffer\n # one more time to write the last message too.\n flush_buffer\n\n # This will turn the header values into a friendlier json structure too.\n parse_header_lines\n\n return @parsed_values\n end", "def make_info_mano_onlogs\r\n @log.debug \"make_info_mano_onlogs\"\r\n @mano_coll = []\r\n curr_ix = 0\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n @data_logs.each do |line|\r\n #p line\r\n if line =~ /new_mano/\r\n @mano_coll << curr_mano_info if curr_mano_info.size > 0\r\n curr_ix += 1\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n else\r\n curr_mano_info[:data] << line \r\n end\r\n end\r\n end", "def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end", "def getFilesinDir(path, logkey='')\n files = Mcmlln::Tools.dirListFiles(path)\n return files\nrescue => logstring\n return []\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def scanIndivLogFile(file)\n @csvColumnLabelList = nil ;\n CSV.foreach(file) {|row|\n if(@csvColumnLabelList.nil?) then\n scanFirstRowOfIndividualLogFile(row)\n else\n scanCsvRow(row) ;\n end\n }\n end", "def to_bmet_csv_replace_type\n @langs_in_db = Set.new\n @csv_info = {}\n have_found_error = false\n\n @items_from_db.each{|item_id,db_hash|\n fields_in_db = Set.new\n fields_in_saf = Set.new\n field_values = {}\t\t# Field values for both DB & SAF\n\n db_hash[:fields].each{|f|\n fields_in_db << f[:value]\n @langs_in_db << f[:lang]\n }\n\n @items_from_saf[item_id][:fields].each{|f|\n fields_in_saf << f[:value]\n }\n if fields_in_db.size == 0\n STDERR.puts \"WARNING: item_id #{item_id} (RMID #{db_hash[:rmid]}; handle #{db_hash[:handle]}) has no dc.type field in DB; adding from SAF\"\n end\n\n if fields_in_db.size > 1\n STDERR.puts \"ERROR: item_id #{item_id} (RMID #{db_hash[:rmid]}; handle #{db_hash[:handle]}) has #{fields_in_db.size}x dc.type fields in DB\"\n have_found_error = true\n end\n\n unless fields_in_saf.size == 1\n STDERR.puts \"ERROR: item_id #{item_id} (RMID #{db_hash[:rmid]}; handle #{db_hash[:handle]}) has #{fields_in_saf.size}x dc.type fields in SAF\"\n have_found_error = true\n end\n\n next if have_found_error\t\t\t# Skip processing this item_id if errors\n STDERR.printf(\"item_id=%s; item-hdl=%s; SAF-fields=%s; DB-fields=%s\", item_id, db_hash[:handle], fields_in_saf.inspect, fields_in_db.inspect) if DEBUG\n\n # No update needed if dc.type already same for DB & SAF\n unless fields_in_db == fields_in_saf\n @csv_info[item_id] = {\n #:collection_handle => db_hash[:collection_handle],\n :new_field_values => fields_in_saf.inject(Set.new){|s,type| s << type},\n :handle => db_hash[:handle],\n }\n STDERR.puts \"; DB-replace-with #{@csv_info[item_id][:new_field_values].inspect}\" if DEBUG\n else\n STDERR.puts \"; No updates\" if DEBUG\n end\n\n }\n exit 3 if have_found_error\n build_csv\n end", "def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end", "def error_line(logs)\n logs.select { |line| line.downcase =~ /.*error.*/ }\nend", "def closeLog_old()\n @logStreamList.each{|strm|\n strm.close() if(strm.is_a?(File)) ;\n }\n end", "def processa_arquivo(caminho_logs = nil, caminho_ips_ignorados = nil)\n if caminho_logs.nil?\n imprime_banner\n else\n begin\n lista_requisicoes = []\n lista_ips_ignorados = obtem_ips_ignorados caminho_ips_ignorados\n arquivo = File.open caminho_logs, 'r'\n puts \"Processando arquivo #{caminho_logs}...\"\n arquivo.each_line do |linha|\n\t requisicao = processa_linha linha, lista_ips_ignorados\n\t unless requisicao.nil?\n\t lista_requisicoes << requisicao\n\t end\n end\n arquivo.close\n exporta lista_requisicoes\n exporta_coordenadas lista_requisicoes\n puts \"OK.\"\n rescue Errno::ENOENT\n puts 'Arquivo de logs não encontrado.'\n end\n end\nend", "def compass_convert\n file = File.open('data_imu.txt', 'r')\n file.readlines.each do |line|\n next unless line =~ /compass:/\n array = line.split(', ')\n capture_raw(array)\n end # end of loop\n file.close\nend", "def each_log\n unless block_given?\n return enum_for(:each_log)\n end\n\n @logs.each do |log|\n yield log\n end\n end", "def process_feed(fname, channel, offset, etype)\r\n p \"Channel: #{channel} | URL: #{fname}\"\r\n schedule = ICS::Event.file(open(fname)) rescue nil\r\n schedule.map {|cal| process_event(cal, channel, offset, etype) } if schedule\r\n end", "def store_logger_data_from_file\n require 'chronic' #for robust timestamp parsing\n begin #begin rescue\n data_stream =\"\"\n timestamp_col =\"\"\n sample_id_col = \"\"\n vertical_offset_col = \"\"\n starting_vertical_offset_col = \"\"\n ending_vertical_offset_col = \"\"\n site = parent.managed_repository{Voeis::Site.first(:id => params[:site])}\n redirect_path =Hash.new\n @source = Voeis::Source.get(params[:source])\n @project_source = nil\n parent.managed_repository do\n if Voeis::Source.first(:organization => @source.organization, \n :source_description => @source.source_description,\n :source_link => @source.source_link, \n :contact_name => @source.contact_name, \n :phone => @source.phone, \n :email =>@source.email, \n :address => @source.address, \n :city => @source.city, \n :state => @source.state, \n :zip_code => @source.zip_code, \n :citation => @source.citation, \n :metadata_id =>@source.metadata_id).nil? \n @project_source = Voeis::Source.create(@source.attributes)\n else\n @project_source = Voeis::Source.first(:organization => @source.organization, \n :source_description => @source.source_description,\n :source_link => @source.source_link, \n :contact_name => @source.contact_name, \n :phone => @source.phone, \n :email =>@source.email, \n :address => @source.address, \n :city => @source.city, \n :state => @source.state, \n :zip_code => @source.zip_code, \n :citation => @source.citation, \n :metadata_id =>@source.metadata_id)\n end\n end\n #put this back in later\n #if params[:no_save] != \"no\"\n\n #create a parsing template\n #create and save new DataStream\n columns_array = Array.new\n ignore_array = Array.new\n meta_tag_array = Array.new\n min_array = Array.new\n max_array = Array.new\n difference_array = Array.new\n (1..params[:row_size].to_i).each do |i|\n columns_array[i-1] = params[\"column\"+i.to_s]\n ignore_array[i-1] = params[\"ignore\"+i.to_s]\n meta_tag_array[i-1] = params[\"tag_column\"+i.to_s]\n min_array = params[\"min\"+i.to_s]\n max_array = params[\"max\"+i.to_s]\n difference_array = params[\"difference\"+i.to_s]\n if params[\"column\"+i.to_s] == \"timestamp\"\n timestamp_col = i-1\n # elsif params[\"column\"+i.to_s] == \"sample_id\"\n # sample_id_col = i-1\n elsif params[\"column\"+i.to_s] == \"vertical_offset\"\n vertical_offset_col = i-1\n elsif params[\"column\"+i.to_s] == \"starting_vertical_offset\"\n vertical_offset_col = i-1\n elsif params[\"column\"+i.to_s] == \"ending_vertical_offset\"\n ending_vertical_offset_col = i-1\n end\n end\n if !params[:DST].nil?\n utc_offset = params[:utc_offset].to_i + 1\n dst = true\n else\n utc_offset = params[:utc_offset].to_i\n dst = false\n end\n #if the timestamp is in UTC then don't apply the calculate utc_offset just use 0\n if params[:time_support] == \"UTC\"\n dstream_utc_offset = 0\n else\n dstream_utc_offset = utc_offset\n end\n #use this when we decide to save templates and reuse them\n if params[:save_template] == \"true\"\n data_stream_id = create_sample_and_data_parsing_template(params[:template_name], timestamp_col, sample_id_col, columns_array, ignore_array, site, params[:datafile], params[:start_line], params[:row_size], vertical_offset_col, ending_vertical_offset_col, meta_tag_array, dstream_utc_offset, dst, @project_source, min_array, max_array, difference_array) \n data_stream = parent.managed_repository{Voeis::DataStream.get(data_stream_id[:data_template_id])}\n else\n data_stream = parent.managed_repository{Voeis::DataStream.get(params[:data_stream_id])}\n\n end\n if !data_stream.data_stream_columns.first(:name => \"Timestamp\").nil?\n @timestamp_col = data_stream.data_stream_columns.first(:name => \"Timestamp\").column_number\n else\n @timestamp_col = -1\n end\n #@sample_col = data_stream.data_stream_columns.first(:name => \"SampleID\").column_number\n\n\n range = params[:row_size].to_i - 1\n #store all the Variables in the managed repository\n @col_vars = Array.new\n @variables = Array.new\n (0..range).each do |i|\n if columns_array[i] != nil && columns_array[i] != \"ignore\" && ignore_array[i] != i && i != timestamp_col && i != sample_id_col && i != vertical_offset_col && ending_vertical_offset_col != i && meta_tag_array[i].to_i == -1\n @var = Voeis::Variable.get(columns_array[i].to_i)\n parent.managed_repository do \n # variable = Voeis::Variable.first_or_create(\n # :variable_code => @var.variable_code,\n # :variable_name => @var.variable_name,\n # :speciation => @var.speciation,\n # :variable_units_id => @var.variable_units_id,\n # :sample_medium => @var.sample_medium,\n # :value_type => @var.value_type,\n # :is_regular => @var.is_regular,\n # :time_support => @var.time_support,\n # :time_units_id => @var.time_units_id,\n # :data_type => @var.data_type,\n # :general_category => @var.general_category,\n # :no_data_value => @var.no_data_value)\n if Voeis::Variable.get(@var.id).nil?\n variable = Voeis::Variable.new\n variable.attributes = @var.attributes\n variable.save!\n else\n variable = Voeis::Variable.get(@var.id)\n end\n @col_vars[i] = variable\n @variables << variable\n end#managed repo\n end #end if\n end #end i loop\n #site.save\n #create csv_row array\n @results=\"\"\n flash_error={}\n parent.managed_repository do \n debugger\n if File.open(params[:datafile]).size > 10000\n puts \"***********ADDING DELAYED JOB******************\"\n dj = nil\n req = Hash.new\n req[:url]= request.url\n req[:ip_address] = request.remote_ip\n req [:parameters] = request.filtered_parameters.as_json\n job = Voeis::Job.create(:job_type=>\"File Upload\", :job_parameters=>req.to_json, :status => \"queued\", :submitted_at=>Time.now, :user_id => current_user.id)\n repository(\"default\") do\n # dj = Delayed::Job.enqueue(ProcessAFile.new(parent, params[:datafile], data_stream.id, site.id, params[:start_line],nil,nil,current_user, job.id))\n #resque way\n dj = Resque.enqueue(ProcessAFile, parent.id, params[:datafile], data_stream.id, site.id, params[:start_line],nil,nil,current_user.id, job.id)\n end\n flash[:notice] = \"File has been successfully queued. Check the job queue for job id:\"+job.id.to_s+\" status and you will recieve and email when the file parsing completes.\"\n else\n @results = Voeis::DataValue.parse_logger_csv(params[:datafile], data_stream.id, site.id, params[:start_line].to_i, nil, nil,current_user.id)\n puts \"updating the site catalog\" \n Voeis::Site.get(site.id).update_site_data_catalog_variables(@variables)\n if @results[:errors].empty?\n flash[:notice] = \"File parsed and stored successfully for #{site.name}. #{@results[:total_records_saved]} data values saved and #{@results[:total_rows_parsed]} rows where parsed. \"\n else\n flash[:notice] = \"File parsed for #{site.name}. #{@results[:total_records_saved]} data values saved and #{@results[:total_rows_parsed]} rows where parsed.\"\n flash[:error] = \"There were the following errors: <br/>\"\n current_user.last_error = @results[:errors]\n current_user.save\n end\n end\n end\n # parent.publish_his\n redirect_to project_path(params[:project_id]) and return\n rescue Exception => e \n email_exception(e,request.env)\n parent.managed_repository{Voeis::Site.get(site.id).update_site_data_catalog}\n flash[:error] = \"Problem Parsing Logger File: \"+ e.message\n redirect_to(:controller =>\"voeis/logger_imports\", :action => \"pre_process_logger_file_upload\", :params => {:id => params[:project_id]})\n end\n end", "def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)\r\n @logger.add( Log4r::FileOutputter.new('ToDo', \r\n :filename => filename,\r\n :level => level,\r\n :formatter => FixmeFormatter \r\n ))\r\n \r\n end", "def matches_logfile?(path); end", "def parse_events(logfile=nil)\n \tunless logfile\n \t\tlogfile = get_log\n \tend\n \t\n \tplayers = {}\n \tlogfile.each do |line|\n \t\tlogger.debug(\"*********Parsing line: #{line.strip}\")\n \t\tpieces = line.scan(/(?:\"(?:\\\\.|[^\"])*\"|[^\" ])+/)\n\t\tparams = parse_params(pieces[1..-1]) if pieces.size>=1\n\t\tev = self.events.build\n\t\tev.match_number = self.match_number\n\t\tcase pieces[0] \n\t\twhen \"PLAYER_CONNECT\"\n\t\t\tplayers[params[:player]] = {nickname: params[:name], id: params[:id], psr: params[:psr]}\n\t\twhen \"PLAYER_TEAM_CHANGE\"\n\t\t\tplayers[params[:player]][:team] = params[:team]\n\t\twhen \"PLAYER_SELECT\", \"PLAYER_RANDOM\"\n\t\t\tev.build_event(\"player\", params, players)\n\t\twhen \"PLAYER_CHAT\"\n\t\t\tev.build_event(\"chat\", params, players)\n\t\twhen \"GOLD_EARNED\"\n\t\t\tev.build_event(\"gold_earned\", params, players)\n\t\twhen \"EXP_EARNED\"\n\t\t\tev.build_event(\"exp_earned\", params, players)\n\t\twhen \"HERO_DEATH\", \"HERO_ASSIST\"\n\t\t\tself.parse_death(pieces, params, players, logfile)\n\t\twhen \"GAME_CONCEDE\", \"GAME_END\"\n\t\t\t#need to remove this logic once I get API access again\n\t\t\tself.winner = params[:winner].to_i\n\t\t\tself.duration_seconds = params[:time].to_i/1000\n\t\t\tev.build_event(\"game_end\", params, players)\n\t\tend\t\n \tend\n end", "def log_msgs(debug = true)\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") # Forward translator and geometry translator\n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage) \n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && debug\n @runner.registerInfo(\"DEBUG - [#{msg.logChannel}] #{msg.logMessage}\")\n end\n end\n end\n end", "def log_msgs(debug = true)\n @msg_log.logMessages.each do |msg|\n # DLM: you can filter on log channel here for now\n if /openstudio.*/.match(msg.logChannel) #/openstudio\\.model\\..*/\n # Skip certain messages that are irrelevant/misleading\n next if msg.logMessage.include?(\"Skipping layer\") || # Annoying/bogus \"Skipping layer\" warnings\n msg.logChannel.include?(\"runmanager\") || # RunManager messages\n msg.logChannel.include?(\"setFileExtension\") || # .ddy extension unexpected\n msg.logChannel.include?(\"Translator\") # Forward translator and geometry translator\n # Report the message in the correct way\n if msg.logLevel == OpenStudio::Info\n @runner.registerInfo(msg.logMessage) \n elsif msg.logLevel == OpenStudio::Warn\n @runner.registerWarning(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Error\n @runner.registerError(\"[#{msg.logChannel}] #{msg.logMessage}\")\n elsif msg.logLevel == OpenStudio::Debug && debug\n @runner.registerInfo(\"DEBUG - [#{msg.logChannel}] #{msg.logMessage}\")\n end\n end\n end\n end", "def initialize(filename)\r\n @log = {}\r\n @size = 0\r\n\r\n @logFile = File.new(filename) # Open the log file\r\n\r\n # Read in the Log file\r\n @logFile.each do |line|\r\n values = line.split(',') # Split the line at the commas\r\n dateParts = values[0].split('/') # Split the date field up at the slashes\r\n\r\n date = Date.parse(\"#{dateParts[2]}-#{dateParts[0]}-#{dateParts[1]}\") # Parse the date string into a valid Date object\r\n\r\n add_logItem(values[1].chomp!, date)\r\n end\r\n end", "def each_successful_run\n each_log_line do |(timestamp, rest)|\n if host=parse_last_run(rest)\n yield [timestamp, host]\n end\n end\n end", "def parse_lines(lines)\n result = {}\n for l in lines\n fname, desc, time = l.split(/\\t/)\n result[desc] = time.to_f\n end\n return result\n end", "def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end", "def read(io)\n game_text = ''\n io.each { | line |\n line.chomp!\n case line\n when /\\[(.*)\\]/ # New games starting (if multi-game file)\n when /^\\s*$/\n else\n game_text << ' '\n game_text << line\n end\n }\n game_text\n end", "def logCheckPerfect(logfileTail)\n\n lastFrame = -1\n currentFrame = -1\n fileStatus = Hash[\"wroteVel\" => false,\n \"closedCoor\" => false,\n \"wroteCoor\" => false,\n \"closedXsc\" => false,\n \"wroteXsc\" => false,\n \"finishedRestartVel\" => false,\n \"wroteRestartVel\" => false,\n \"wroteRestartXsc\" => false,\n \"finishedRestartCoor\" => false,\n \"wroteRestartCoor\" => false,\n \"wroteDcd\" => false]\n\n # Use tail to get last lines of logfile\n #print \"logfileTail: #{logfileTail}\\n\"\n tailList = logfileTail.split(\"\\n\").reverse\n\n # Check for completed case\n tailList.each do |i|\n #print \"#{i}\\n\"\n if i =~ /WRITING VELOCITIES TO OUTPUT FILE AT STEP (\\d+)/ then\n #print \" wroteVel\\n\"\n fileStatus[\"wroteVel\"] = true\n currentFrame = $1.to_i\n elsif i =~ /CLOSING COORDINATE DCD FILE/ then\n #print \" closedCoor\\n\"\n fileStatus[\"closedCoor\"] = true\n elsif i =~ /WRITING COORDINATES TO OUTPUT FILE AT STEP (\\d+)/ then\n #print \" wroteCoor\\n\"\n fileStatus[\"wroteCoor\"] = true\n currentFrame = $1.to_i\n elsif i =~ /CLOSING EXTENDED SYSTEM TRAJECTORY FILE/ then\n #print \" closedXsc\\n\"\n fileStatus[\"closedXsc\"] = true\n elsif i =~ /WRITING EXTENDED SYSTEM TO OUTPUT FILE AT STEP (\\d+)/ then\n #print \" wroteXsc\\n\"\n fileStatus[\"wroteXsc\"] = true\n currentFrame = $1.to_i\n elsif i =~ /FINISHED WRITING RESTART VELOCITIES/ then\n #print \" finishedRestartVel\\n\"\n fileStatus[\"finishedRestartVel\"] = true\n elsif i =~ /WRITING VELOCITIES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartVel\\n\"\n fileStatus[\"wroteRestartVel\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartXsc\\n\"\n fileStatus[\"wroteRestartXsc\"] = true\n currentFrame = $1.to_i\n elsif i =~ /FINISHED WRITING RESTART COORDINATES/ then\n #print \" finishedRestartCoor\\n\"\n fileStatus[\"finishedRestartCoor\"] = true\n elsif i =~ /WRITING COORDINATES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartCoor\\n\"\n fileStatus[\"wroteRestartCoor\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING COORDINATES TO DCD FILE AT STEP (\\d+)/ then\n #print \" wroteDcd\\n\"\n fileStatus[\"wroteDcd\"] = true\n currentFrame = $1.to_i\n end\n\n if (lastFrame < 0) & (currentFrame > 0) then\n lastFrame = currentFrame\n elsif lastFrame != currentFrame then\n print \" lastFrame: #{lastFrame}\\n\"\n print \" currentFrame: #{currentFrame}\\n\"\n return \"broken\"\n end\n\n fileStatusCount = 0\n fileStatus.each_value do |i|\n if i then\n fileStatusCount += 1\n end\n end\n\n if fileStatusCount == 11 then\n print \" last frame: #{lastFrame}\\n\"\n return \"perfect\"\n end\n end\n\n return \"unknown\"\nend", "def date_invalid(name, arr)\n File.open(name, 'w') do |file|\n arr.each do |a|\n file.puts a\n end\n end\nrescue Exception => e\n puts \"ERROR, #{e.message}\"\nend", "def test_load_stream_with_malformed_lines\n @stream.write(\"This isn't a valid activity line\\n\")\n @stream.rewind\n timelog = Timelog.load_stream(@stream)\n assert_equal([], timelog.activities)\n end", "def parse_entries\n entries = []\n entry_name = nil\n entry_body = []\n\n @content.each_line do |line|\n case line\n when /^\\s*$/ then\n next\n when /^\\w.*/ then\n entries << [entry_name, entry_body] if entry_name\n\n entry_name = $&\n\n begin\n time = Time.parse entry_name\n # HACK Ruby 1.8 does not raise ArgumentError for Time.parse \"Other\"\n entry_name = nil unless entry_name =~ /#{time.year}/\n rescue NoMethodError\n # HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent\n entry_name.split ' ', 2\n rescue ArgumentError\n if /out of range/ =~ $!.message\n Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil\n else\n entry_name = nil\n end\n end\n\n entry_body = []\n when /^(\\t| {8})?\\*\\s*(.*)/ then # \"\\t* file.c (func): ...\"\n entry_body << $2\n when /^(\\t| {8})?\\s*(\\(.*)/ then # \"\\t(func): ...\"\n entry = $2\n\n if entry_body.last =~ /:/ then\n entry_body << entry\n else\n continue_entry_body entry_body, entry\n end\n when /^(\\t| {8})?\\s*(.*)/ then\n continue_entry_body entry_body, $2\n end\n end\n\n entries << [entry_name, entry_body] if entry_name\n\n entries.reject! do |(entry,_)|\n entry == nil\n end\n\n entries\n end", "def convert_binary_traceroutes(data, print=false)\n offset=0\n traceroutes=[]\n while not offset>=data.length\n header=data[offset,16].unpack(\"L4\")\n offset += 16\n if header.nil? or header.include?(nil) \n raise TruncatedTraceFileException.new(traceroutes), \"Error reading header\", caller\n end\n client_id=header.at(0)\n uid=header.at(1)\n num_tr=header.at(2)\n record_length=header.at(3)\n (0...num_tr).each{|traceroute_index|\n tr_header=data[offset,8].unpack(\"NL\")\n offset += 8\n if tr_header.nil? or tr_header.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading TR header\", caller\n end\n dst=Inet::ntoa(tr_header.at(0))\n numhops=tr_header.at(1)\n hops = []\n rtts = []\n ttls = []\n last_nonzero=-1\n (0...numhops).each{|j|\n hop_info=data[offset,12].unpack(\"NfL\")\n offset += 12\n if hop_info.nil? or hop_info.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading hop\", caller\n end\n ip = Inet::ntoa(hop_info.at(0))\n rtt = hop_info.at(1)\n ttl = hop_info.at(2)\n if (ttl > 512)\n raise TruncatedTraceFileException.new(traceroutes), \"TTL>512, may be corrupted\", caller\n end\n if ip!=\"0.0.0.0\"\n last_nonzero=j\n end\n hops << ip\n rtts << rtt\n ttls << ttl\n\n }\n if last_nonzero>-1\n traceroutes << [dst,hops,rtts,ttls]\n if print\n tr_s=\"#{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n if block_given?\n yield(tr_s)\n else \n $stdout.puts \"tr_s\"\n end \n #puts \"#{ARGV[1..-1].join(\" \")} #{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n end\n end\n\n }\n end\n return traceroutes\nend", "def process_local_log(queue, filename, s3_file_info)\n @logger.info(\"Processing downloaded file - Started at #{Time.now}\" , :filename => filename)\n\n metadata = {}\n # Currently codecs operates on bytes instead of stream.\n # So all IO stuff: decompression, reading need to be done in the actual\n # input and send as bytes to the codecs.\n read_file(filename) do |line|\n if stop?\n @logger.warn(\"Logstash S3 input, stop reading in the middle of the file, we will read it again when logstash is started\")\n return false\n end\n\n @codec.decode(line) do |event|\n # We are making an assumption concerning cloudfront\n # log format, the user will use the plain or the line codec\n # and the message key will represent the actual line content.\n # If the event is only metadata the event will be drop.\n # This was the behavior of the pre 1.5 plugin.\n #\n # The line need to go through the codecs to replace\n # unknown bytes in the log stream before doing a regexp match or\n # you will get a `Error: invalid byte sequence in UTF-8'\n if event_is_metadata?(event)\n @logger.debug('Event is metadata, updating the current cloudfront metadata', :event => event)\n update_metadata(metadata, event)\n else\n event['path'] = filename\n event['s3_bucket'] = s3_file_info[:bucket]\n event['s3_key'] = s3_file_info[:key]\n event[\"cloudfront_version\"] = metadata[:cloudfront_version] unless metadata[:cloudfront_version].nil?\n event[\"cloudfront_fields\"] = metadata[:cloudfront_fields] unless metadata[:cloudfront_fields].nil?\n decorate(event)\n\n queue << event\n end\n end #codec\n end #read_file\n @logger.info(\"Processing downloaded file - Finished at #{Time.now}\" , :filename => filename)\n return true\n end", "def getFilesinDir(path, logkey='')\n\tfiles = Mcmlln::Tools.dirListFiles(path)\n\treturn files\nrescue => logstring\n\treturn []\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def log\n last_line = logfile.lines.to_a.last || \"\"\n last_entry = last_line.split(/\\s/)\n new_entry = \"#{date}\\t#{count}\\n\"\n if last_entry.first != date\n logfile.write new_entry\n logfile.flush\n end\n puts new_entry\n end", "def each\n res = Hash.new {|h, k| h[k] = ''}\n @file.each do |line|\n if line.chomp.empty?\n yield(res)\n res = Hash.new {|h, k| h[k] = ''}\n else\n if m = @line_regexp.match(line)\n res[m[1].downcase] = m[2]\n else \n res[\"body\"] += line.gsub(/\\A\\./, '').gsub(/\\A /, '')\n end\n end\n end\n ensure\n @file.close\n end" ]
[ "0.6180719", "0.5969064", "0.5791305", "0.56926274", "0.558846", "0.55353624", "0.5491865", "0.54766387", "0.53825486", "0.53684986", "0.53387076", "0.53376573", "0.52244097", "0.5204976", "0.5184397", "0.5157974", "0.5156808", "0.5110752", "0.5104826", "0.509945", "0.5036424", "0.5033564", "0.5009994", "0.49803346", "0.49782807", "0.49441463", "0.49436742", "0.49410003", "0.49325207", "0.4929349", "0.49121127", "0.48990664", "0.4894687", "0.48646012", "0.48584113", "0.48296168", "0.48190537", "0.48185593", "0.48154175", "0.48087242", "0.47736868", "0.47733933", "0.47724453", "0.47583288", "0.47272798", "0.47272125", "0.47269416", "0.47259003", "0.4724685", "0.47069797", "0.46989244", "0.46959078", "0.4689567", "0.4684464", "0.46780676", "0.4663127", "0.4660479", "0.46480867", "0.46466205", "0.4644806", "0.46374348", "0.46374348", "0.46239927", "0.46166587", "0.46060044", "0.46009198", "0.45968223", "0.45967397", "0.4588764", "0.45731947", "0.45691925", "0.45618927", "0.45533702", "0.45517483", "0.45499083", "0.4542167", "0.45420802", "0.45328972", "0.45280245", "0.45225915", "0.45218208", "0.45153663", "0.45132023", "0.45131084", "0.4506098", "0.4506098", "0.44985682", "0.44934794", "0.44922915", "0.44867733", "0.4484518", "0.44842848", "0.44507766", "0.44407758", "0.44399834", "0.44350538", "0.44336656", "0.4432906", "0.4429806", "0.44254163" ]
0.6560255
0
57844 27156.724 127.0.0.1 9014 0.005995526 0.032311653 3.937740536 0.002301804
def convert_ntp_line(line) line_array = line.split(' ') days = line_array[0] secs = line_array[1] human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs) format(human_timestamp, line_array, 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latency; end", "def on_getaddr\n #addrs = @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n #p \"<< addr (#{addrs.size})\"\n #send_data P::Addr.pkt(*addrs)\n end", "def server_timing; end", "def extract_data(server_num, source_file, max_samples)\n\traw_data = Array.new(server_num){[]}\n\t$x = Array.new(server_num){[]}\n\t$y = Array.new(server_num){[]}\n\tx_temp = 0\n\ty_temp = 0\n\n\t#eg: server#0: 1464345445.500000030\n\tregex = Regexp.new(/server#(?<server>\\d{1}): (?<data>\\d(.+))/)\n\n\t#remove 'nil' created when initialize raw_data\n\tserver_num.times {|i| raw_data[i - 1].drop(0)}\n\n\t#puts \"Analyzing file #{source_file}...\"\n\tFile.foreach(source_file).with_index do |line|\n\t\tif read = line.match(regex)\n\t\t\tserver, data = read.captures\n\t\t\tserver = server.to_i\n\t\t\tif (server < server_num)\n\t\t\t\tdata = data.chomp\n\t\t\t\traw_data[server] << data\n\t\t\telse\n\t\t\t\tputs \"Mismatch : MAX_SERVER & data collected\"\n\t\t\t\tshut_down\n\t\t\tend\n\t\tend\n\tend\n\n\t# check if any of the server is not connected\n\t# and causes array to be empty\n\tfor i in 0..(server_num - 1)\n\t\tif raw_data[i][0] == nil\n\t\t\tputs \"Server#{i} not connected\"\n\t\tend\n\tend\n\n\t# write Time error in file\n\tFile.open(\"plot_time_error.dat\", 'a+') { |f|\n\n\t\tif $last_plot_index == 0\n\t\t\t$last_plot_index = raw_data[0].length - 1\n\t\tend\n\n\t\tif (raw_data[0].length == raw_data[1].length)\n\t\t\t$cur = raw_data[0].length - 1\n\t\telsif (raw_data[0].length > raw_data[1].length)\n\t\t\t$cur = raw_data[1].length - 1\n\t\telse\n\t\t\t$cur = raw_data[0].length - 1\n\t\tend\n\n\t\tfor i in $last_plot_index..$cur\n\n\t\t\tdiff = ((raw_data[1][i].to_d * 1000000000).to_i - (raw_data[0][i].to_d * 1000000000).to_i).to_i\n\t\t\tif diff < 300000\n\t\t\t\tif diff > -300000\n\t\t\t\t\tf.puts(\"#{i}\\t#{diff}\")\n\t\t\t\tend\n\t\t\tend\n\t\t\t$xmax = i\n\t\t\t$xmin = $xmax - 100\n\t\tend\n\t\t$last_plot_index = $cur\n\t}\nend", "def server_timing=(_arg0); end", "def tv_usec() end", "def peer_ip; end", "def latency_simple(host)\n bytes = 68\n count = 6\n interval = 1000\n %x[fping -b #{bytes} -c #{count} -q -p #{interval} #{host}]\n end", "def handle_addrs count = 32\n @node.addrs.weighted_sample(count.to_i) do |addr|\n Time.now.tv_sec + 7200 - addr.time\n end.map do |addr|\n [addr.ip, addr.port, Time.now.tv_sec - addr.time] rescue nil\n end.compact\n end", "def latency_conversion\n _undefined\n end", "def edgeu(cmd)\n time = nil\n $lock.synchronize{\n time = $clock.to_i\n $network.update_cost($hostname, cmd[0], cmd[1].to_i, time)\n\n if $rt.has_key? cmd[0]\n $rt[cmd[0]][:cost] = cmd[1].to_i\n end\n } \n\n client = TCPSocket.open($local_ip, $nodesFile[cmd[0]][\"PORT\"])\n client.puts(\"EDGEU2 #{$hostname} #{cmd[1]} #{time}\") \n \nend", "def port\n 20000 + ($$ % 40000)\n end", "def actual_port; end", "def actual_port; end", "def peerip=(_arg0); end", "def ip; end", "def ip; end", "def live_gps_dump\n\t\tputs \"Reading...\\n\"\n\t\tbuffer = \"\"\n\t\tdata = {}\n\t\trows = 1\n\t\terrors = 0\n\n\t\twhile true do\n\t\t\tbegin\n\t\t\t\tread\n\n\t\t\t\t# Clear previous data\n\t\t\t\tif rows > 0\n\t\t\t\t\t$stdout.print \"\\e[#{rows}A\\e[E\\e[J\"\n\t\t\t\t\trows = 0\n\t\t\t\tend\n\t\t\t\terrors = 0\n\t\t\t\t\n\t\t\t\t# Get date\n\t\t\t\tdate = self.date_time \n\t\t\t\tunless date.nil?\n\t\t\t\t\tdate = date.strftime(\"%b %d %I:%M %p\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tnum_sat = @data[:num_sat] || 0\n\t\t\t\t$stdout.print \"Time: #{date}\t\tSatellites: #{num_sat}\t\tQuality:#{@data[:quality]}\\n\"\n\t\t\t\t$stdout.print \"Latitude: #{@data[:latitude]}#{@data[:lat_ref]}\"\n\t\t\t\t$stdout.print \"\\tLongitude: #{@data[:longitude]}#{@data[:long_ref]}\"\n\t\t\t\t$stdout.print \"\\tElevation: #{@data[:altitude]}#{@data[:alt_unit]}\\n\"\n\t\t\t\trows += 3\n\t\t\t\t\n\t\t\t\t# Satellites\n\t\t\t\tif @data.key?(:num_sat)\n\t\t\t\t\t$stdout.print \"-- Satellites --\\n\"\n\t\t\t\t\t\n\t\t\t\t\t@data[:num_sat].times do | i | \n\t\t\t\t\t\t\n\t\t\t\t\t\tif @data.key?(:satellites) && @data[:satellites].size > i\n\t\t\t\t\t\t\tsat = @data[:satellites][i]\n\t\t\t\t\t\t\trows += 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$stdout.print \"#{sat[:id]}: \"\n\t\t\t\t\t\t\t$stdout.print \"Elevation: #{sat[:elevation]}\"\n\t\t\t\t\t\t\t$stdout.print \"\\t\\tAzimuth: #{sat[:azimuth]}\\n\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\trows += 1\n\t\t\t\tend\n\t\t\t\n\t\t\trescue Exception => e\n\t\t\t\t# Clear previous error\n\t\t\t\tif errors > 0\n\t\t\t\t\t$stdout.print \"\\e[1A\\e[E\\e[J\"\n\t\t\t\t\terrors = 0\n\t\t\t\tend\n\n\t\t\t\t$stdout.print \"\\nERROR: #{e.message}\\n\"\n\t\t\t\tbreak\n\t\t\tend\n\t\t\t\n\t\t\t$stdout.flush\n\t\tend\n\tend", "def get_crypto_stats(port)\r\n r = 0 # Received\r\n g = 0 # Generated\r\n m = 0 # Mined\r\n $blockchain.length.times do |i|\r\n block = $blockchain[i]\r\n r +=1 if (block.payee == port)\r\n g +=1 if (block.payer == port)\r\n m +=1 if (block.miner == port)\r\n end\r\n return [r, g, m]\r\nend", "def packets; end", "def latency_of(dist)\n len=(dist == 0) ? OVERHEAD_INNER : OVERHEAD_OUTER + dist\n if len <= 300 # [cm]\n #Copper cable\n len*4.4E-9 #HP BladeSystem c-Class 40G QSFP+ to QSFP+ Direct Attach Copper Cable\n else\n # Optical cable \n len*5.2E-9 #Speed of light in glass= 190000km/sec\n end\nend", "def revolutionnumberepoch\n (@line2[63...68]).to_i\n end", "def device_ipaddress; end", "def device_ipaddress; end", "def g3\n [0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,\n 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,\n 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,\n 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,\n 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,\n 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,\n 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,\n 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,\n 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,\n 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,\n 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,\n 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,\n 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,\n 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,\n 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,\n 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a][self]\n end", "def stats(socket)\n stats = Time.now.to_i + \"\\n\" + \n @data.flatten + \"\\n\" + \n @expire.flatten + \"\\n\"\n socket.print(stats, \"\\n\\r\")\n end", "def tenth_frame; end", "def edgeb_stdin(cmd)\n $record_ip[$hostname] = cmd[0]\n $record_ip[cmd[2]] = cmd[1]\n node = $node_info.new \n time = nil\n $lock.synchronize{ \n node.src = $hostname\n node.dst = cmd[2]\n node.cost = 1\n node.nexthop = cmd[2]\n time = $clock.to_i\n $rt[cmd[2]] = node\n if $local_ip == nil then $local_ip = cmd[0] end\n\n $network.undir_connection($hostname, cmd[2], time, 1)\n }\n\n client = TCPSocket.open(cmd[1], $nodesFile[cmd[2]][\"PORT\"])\n client.puts(\"EDGEB2 #{cmd[2]} #{$hostname} #{cmd[1]} #{time}\") \n \nend", "def tv_usec\n return @tv_usec\n end", "def ndata; end", "def remote_ip; end", "def native_eva\n 5\n end", "def printpacketdata\n puts \"@@packetdata =>\" + @@packetdata.bytes.to_s\nend", "def to_source; \"* = $#{@addr.to_s(16)}\"; end", "def socket_port; end", "def fw\n return 2 * rhl\n end", "def network_link_speed_in_bytes\n return @network_link_speed_in_bytes\n end", "def ip; get_data_in_file :ip end", "def getd()\n resp = cmd(\"GETD\").chars.to_a\n v = resp[0..3].join.to_f * 0.01\n a = resp[4..7].join.to_f * 0.01\n a = '%.2f' % a\n v = '%.2f' % v\n status = ((resp[8].to_i == 0) ? \"CV\" : \"CC\")\n return [v.to_f, a.to_f, status]\n end", "def low_toms\n [43]\n end", "def logs_response\n \"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35272 ttl=52 time=36.9 ms\\n\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35273 ttl=52 time=35.3 ms\\n\"\n end", "def get_vtk_time(file)\n # read the first 256 chars and split into lines\n a = IO.read(file, 256)\n a.split\n\n # parse out time= using a regex\n a = a.map{|l| l.sub!(/.*time= ([0-9e+\\-\\.]+).*/, '\\1')}\n\n # return first non-empty line\n a = a.delete_if{|l| l==nil}\n a.first.to_f\nend", "def trump_detector_ms_x(ts)\n v = ts.scan(/a+|e+|i+|o+|u+/i) ; (v.sum {|s| s.size > 1 ? s.size - 1 : 0}.to_r / v.size.to_r).round(2)\nend", "def pcornet_wt\n pcornet_get_response(16, 548)\n end", "def getlx ( addr )\n \"40000000\"\nend", "def status()\n\tneighbors = []\n $neighbors.each do |node, distance|\n neighbors << node\n end\n neighbors.sort\n msg = \"Name: \" + $hostname + \"\\n\"\n msg += \"Port: \" + $port + \"\\n\"\n msg += \"Neighbors: \" \n neighbors.each do |node|\n msg += node + \",\"\n end\n if msg[-1] == \",\"\n msg = msg.chop\n end\n STDOUT.puts msg\nend", "def hz_to_ghz i\n (i / 10000.0).round / 100.0\nend", "def op; (@memblock[@ip]||0)/16; end", "def static_ip_score; end", "def max_packets; end", "def h000000000000000000000000000000000000000000010111000110111101eader_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end", "def nanoseconds; end", "def summary_ping\n full_ping\n .split(\"\\n\")\n .last(3)\n .join(\"\\n\")\n end", "def convert_binary_traceroutes(data, print=false)\n offset=0\n traceroutes=[]\n while not offset>=data.length\n header=data[offset,16].unpack(\"L4\")\n offset += 16\n if header.nil? or header.include?(nil) \n raise TruncatedTraceFileException.new(traceroutes), \"Error reading header\", caller\n end\n client_id=header.at(0)\n uid=header.at(1)\n num_tr=header.at(2)\n record_length=header.at(3)\n (0...num_tr).each{|traceroute_index|\n tr_header=data[offset,8].unpack(\"NL\")\n offset += 8\n if tr_header.nil? or tr_header.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading TR header\", caller\n end\n dst=Inet::ntoa(tr_header.at(0))\n numhops=tr_header.at(1)\n hops = []\n rtts = []\n ttls = []\n last_nonzero=-1\n (0...numhops).each{|j|\n hop_info=data[offset,12].unpack(\"NfL\")\n offset += 12\n if hop_info.nil? or hop_info.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading hop\", caller\n end\n ip = Inet::ntoa(hop_info.at(0))\n rtt = hop_info.at(1)\n ttl = hop_info.at(2)\n if (ttl > 512)\n raise TruncatedTraceFileException.new(traceroutes), \"TTL>512, may be corrupted\", caller\n end\n if ip!=\"0.0.0.0\"\n last_nonzero=j\n end\n hops << ip\n rtts << rtt\n ttls << ttl\n\n }\n if last_nonzero>-1\n traceroutes << [dst,hops,rtts,ttls]\n if print\n tr_s=\"#{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n if block_given?\n yield(tr_s)\n else \n $stdout.puts \"tr_s\"\n end \n #puts \"#{ARGV[1..-1].join(\" \")} #{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n end\n end\n\n }\n end\n return traceroutes\nend", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def snag_ip\n java.net.NetworkInterface.network_interfaces.each do |networkInterface|\n networkInterface.inet_addresses.each do |inet|\n addr = inet.address\n if addr[0] == 10 && addr.length == 4 && addr[1] < 100 && addr[2] < 100 # TODO: will fail for alt 10.4.151.x\n teamn = addr[1] * 100 + addr[2]\n return teamn\n end\n end\n end\n end", "def y_coord(num)\n (num/65536).to_i\nend", "def on_getaddr\n addrs = @node.config[:announce] ? [@node.addr] : []\n addrs += @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n log.debug { \"<< addr (#{addrs.size})\" }\n send_data P::Addr.pkt(*addrs)\n end", "def satellitenumber\n @line1[02...07].to_i\n end", "def default_latency\n 1.0\n end", "def get_time_pos \n send_cmd(\"get_time_pos\")\n end", "def frames\n _nudge[3]\n end", "def latency\n runopts(:latency)\n end", "def rtprice\n end", "def get_sync_speed\n\tv = -9 # not exposed\nend", "def get_data\n white_x = Shared::interpret_bytes_4(@data[0..3].unpack(\"C*\"))/100000.0\n white_y = Shared::interpret_bytes_4(@data[4..7].unpack(\"C*\"))/100000.0\n red_x = Shared::interpret_bytes_4(@data[8..11].unpack(\"C*\"))/100000.0\n red_y = Shared::interpret_bytes_4(@data[12..15].unpack(\"C*\"))/100000.0\n green_x = Shared::interpret_bytes_4(@data[16..19].unpack(\"C*\"))/100000.0\n green_y = Shared::interpret_bytes_4(@data[20..23].unpack(\"C*\"))/100000.0\n blue_x = Shared::interpret_bytes_4(@data[24..27].unpack(\"C*\"))/100000.0\n blue_y = Shared::interpret_bytes_4(@data[28..31].unpack(\"C*\"))/100000.0\n return [white_x, white_y,\n red_x, red_y,\n green_x, green_y,\n blue_x, blue_y]\n end", "def calculate_power\n start = 1\n finish = 10 ** 8\n finish = 10 ** 11 if USE_GPU\n finish = (10 ** 8) / 4 if IS_WINDOWS\n\n \n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n test_pass = 'aaaasdabbbbb'\n\n ntlm_hash = pass_to_ntml_hash(test_pass)\n length = test_pass.size\n session_name = 'calculatin_power'\n\n ans,pass_per_sec,process_time = crack_interval start,finish,length,alphabet,ntlm_hash,session_name\n\t\n\n puts '########### POWER ##############'\n puts pass_per_sec\n puts '########### POWER ##############'\n\n open(PROCESS_POWER_FILE,'w') do |f|\n f.printf(pass_per_sec.to_s)\n end\nend", "def port_string; end", "def from_pcap_db(pcapfile)\n t, n, s, v, x, z = 0, 0, 0, 0, 0, 0\n ipcount, tcpcount, udpcount = 0, 0, 0\n inp = Pcap::Capture.open_offline(pcapfile)\n inp.each_packet do |pkt|\n guid = Tools::guid # IP / TCP / UDP relationship\n dtime = Time.now\n # IP Packet\n if pkt.ip?\n ip_packet = \"INSERT INTO #{@tblname_ippacket} \"\n ip_packet << \"(guid, recv_date, ip_df, ip_dst, ip_hlen, ip_id, ip_len, ip_mf, ip_off, ip_proto, ip_src, ip_sum, ip_tos, ip_ttl, ip_ver) \"\n ip_packet << \"VALUES (\"\n ip_packet << \"'#{guid}',\"\n ip_packet << \"'#{dtime}',\"\n if pkt.ip_df? == true \n ip_packet << \"'Y',\"\n else\n ip_packet << \"'N',\"\n end\n ip_packet << \"'#{pkt.ip_dst}',\"\n ip_packet << \"'#{pkt.ip_hlen}',\"\n ip_packet << \"'#{pkt.ip_id}',\"\n ip_packet << \"'#{pkt.ip_len}',\"\n if pkt.ip_mf? == true\n ip_packet << \"'Y',\"\n else\n ip_packet << \"'N',\"\n end\n ip_packet << \"'#{pkt.ip_off}',\"\n ip_packet << \"'#{pkt.ip_proto}',\"\n ip_packet << \"'#{pkt.ip_src}',\"\n ip_packet << \"'#{pkt.ip_sum}',\"\n ip_packet << \"'#{pkt.ip_tos}',\"\n ip_packet << \"'#{pkt.ip_ttl}',\"\n ip_packet << \"'#{pkt.ip_ver}');\"\n if t == 50\n puts \"\\e[1;32m\\ MSGID:\\e[0m\\ [#{n}] \\e[1;32m\\Generated SQL:\\e[0m\\ #{ip_packet}\"\n t = 0\n end\n t = t + 1 unless t == 50\n res = @conn.query(\"#{ip_packet}\")\n @conn.save\n n = n + 1\n end\n # TCP Packet\n if pkt.tcp?\n tcp_packet = \"INSERT INTO #{@tblname_tcppacket} \"\n tcp_packet << \"(guid, recv_date, tcp_data_len, tcp_dport, tcp_ack, tcp_fin, tcp_syn, tcp_rst, tcp_psh, tcp_urg, tcp_off, tcp_hlen, tcp_seq, tcp_sum, tcp_sport, tcp_urp, \"\n tcp_packet << \"tcp_win) \"\n tcp_packet << \"VALUES (\"\n tcp_packet << \"'#{guid}',\"\n tcp_packet << \"'#{dtime}', \"\n tcp_packet << \"#{pkt.tcp_data_len},\"\n tcp_packet << \"#{pkt.tcp_dport},\"\n if pkt.tcp_ack? == true \n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n if pkt.tcp_fin? == true\n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n if pkt.tcp_syn? == true \n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n if pkt.tcp_rst? == true \n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n if pkt.tcp_psh? == true \n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n if pkt.tcp_urg? == true\n tcp_packet << \"'Y',\"\n else\n tcp_packet << \"'N',\"\n end\n tcp_packet << \"#{pkt.tcp_off}, #{pkt.tcp_hlen}, #{pkt.tcp_seq}, #{pkt.tcp_sum}, #{pkt.tcp_sport}, #{pkt.tcp_urp}, #{pkt.tcp_win});\"\n if s == 50\n puts \"\\e[1;32m\\ MSGID:\\e[0m\\ [#{v}] \\e[1;32m\\Generated SQL:\\e[0m\\ #{tcp_packet}\"\n s = 0\n end\n s = s + 1 unless s == 50\n res = @conn.query(\"#{tcp_packet}\")\n @conn.save\n v = v + 1 \n end\n # UDP Packet\n if pkt.udp?\n udp_packet = \"INSERT INTO #{@tblname_udppacket} \"\n udp_packet << \"(guid,\"\n udp_packet << \"recv_date,\"\n udp_packet << \"udp_dport,\"\n udp_packet << \"udp_len,\"\n udp_packet << \"udp_sum,\"\n udp_packet << \"udp_sport) \"\n udp_packet << \"VALUES (\"\n udp_packet << \"'#{guid}',\"\n udp_packet << \"'#{dtime}',\"\n udp_packet << \"'#{pkt.udp_dport}',\"\n udp_packet << \"'#{pkt.udp_len}',\"\n udp_packet << \"'#{pkt.udp_sum}',\"\n udp_packet << \"'#{pkt.udp_sport}');\"\n if x == 50\n puts \"\\e[1;32m\\ MSGID:\\e[0m\\ [#{z}] \\e[1;32m\\Generated SQL:\\e[0m\\ #{udp_packet}\"\n x = 0\n end\n x = x + 1 unless x == 50\n res = @conn.query(\"#{udp_packet}\")\n @conn.save\n z = z + 1 \n end\n ipcount = n\n tcpcount = v\n udpcount = z\n end\n @conn.release\n @conn.commit\n totals = \"\\e[1;31m=======================================================================\\e[0m\\ \\n\"\n totals << \"\\e[1;31mPackets Total | IP: #{ipcount} | TCP: #{tcpcount} | UDP: #{udpcount}\\e[0m\\ \\n\"\n totals << \"\\e[1;31m======================================================================\\e[0m\\ \\n\"\n puts totals\n end", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def ip\n @vps.ip \n end", "def edgeuUpdate(msg)\n msg = msg.split(' ')\n dst = msg[0]\n cost = msg[1].to_i\n $dist[dst] = cost\n $neighbors[dst] = cost\nend", "def test_ping\n\[email protected](@ping, 0)\n=begin\n\t\tpong = @tt.ping_reply\n\t\tassert_equal(42, pong.length)\n\t\tassert_equal(pong[0, 6], @tt.tap_mac)\n\t\tassert_equal(pong[30, 4], @ping[26, 4])\n\t\tassert_equal(pong[26, 4], @ping[30, 4])\n=end\n\tend", "def test_ping\n\[email protected](@ping, 0)\n=begin\n\t\tpong = @tt.ping_reply\n\t\tassert_equal(42, pong.length)\n\t\tassert_equal(pong[0, 6], @tt.tap_mac)\n\t\tassert_equal(pong[30, 4], @ping[26, 4])\n\t\tassert_equal(pong[26, 4], @ping[30, 4])\n=end\n\tend", "def remote_addr_header; end", "def test_decode_new_float()\n input = [131, 70, 1, 1, 1, 1, 1, 1, 1, 1]\n expected = 7.74860418548935e-304\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_in_delta(expected, actual, 0.00000000000001)\n end", "def nginx\n file = File.new(NGINX_LOG_PATH, \"r\")\n #~ linesArray = Array.new\n dataHash = Hash.new\n #~ dataHash={\"nginx\"=>{server_ip=>{port=>{\"url_path\"=>\"\",\"click\"=>0}}}}\n #~ csvstr = FasterCSV.generate do |csv|\n #~ csv << [\"Server Ip\", \"Port\", \"Request From\", \"Client Id\", \"Ad Id\", \"Impressions\", \"Clicks\", \"Request URL\"]\n while (line = file.gets)\n begin\n url = ((line.split(\"upstream:\")[1]).split(\", host:\")[0]).gsub('\"','').strip\n server_ip = ((url.split(\"http://\")[1]).split(\"/\")[0]).split(\":\")[0]\n port = ((url.split(\"http://\")[1]).split(\"/\")[0]).split(\":\")[1]\n url_path = ((url.split(\"http://\")[1]).split(\"/\")[1]).split(\"?\")[0]\n clicks = impressions = 0\n if (url_path==\"waplanding\") \n clicks=1\n url_param = url.split(\"lm=\")[1]\n cid = url_param.split(\"%7C\")[0]\n ad_id = (url_param.split(\"-\")[1]).split(\"~\")[0]\n elsif (url_path==\"static_ad\")\n impressions=5\n url_param = (url.split(\"id=\")[1]).split(\"&\")[0]\n cid = url_param\n else\n impressions=1\n url_param = (url.split(\"cid=\")[1]).split(\"&\")[0]\n cid = url_param\n ad_id = 0\n end\n \n #~ value = {\"server_ip\"=>server_ip,\"port\"=>port,\"url_path\"=>url_path,\"click\"=>click,\"impression\"=>impression,\"cid\"=>cid,\"ad_id\"=>ad_id}\n if dataHash[server_ip.to_s+port.to_s]!=nil\n #~ p dataHash[server_ip.to_s+port.to_s][\"nginx\"][server_ip][port.to_s][\"clicks\"]+=clicks\n #~ dataHash[server_ip.to_s+port.to_s][\"nginx\"][server_ip][port.to_s][\"impressions\"]+=impressions\n dataHash[server_ip.to_s+port.to_s]={\"nginx\"=>{server_ip=>{port.to_s=>{\"cid\"=>cid,\"url_path\"=>url_path,\"clicks\"=>dataHash[server_ip.to_s+port.to_s][\"nginx\"][server_ip][port.to_s][\"clicks\"]+=clicks,\"impressions\"=>dataHash[server_ip.to_s+port.to_s][\"nginx\"][server_ip][port.to_s][\"impressions\"]+=impressions}}}}\n #~ dataHash[server_ip.to_s+port.to_s]\n else\n dataHash[server_ip.to_s+port.to_s]={\"nginx\"=>{server_ip=>{port.to_s=>{\"cid\"=>cid,\"url_path\"=>url_path,\"clicks\"=>clicks,\"impressions\"=>impressions}}}}\n end\n \n #~ dataHash.store(\"nginx\",{server_ip=>{}})\n #~ csv << [server_ip, port, url_path, cid, ad_id, impression, click, url]\n server_ip = port = url_path = cid = ad_id = impression = click = url = url_param = nil\n rescue Exception => e\n puts e\n ensure\n dataHash.each_value{|k,v| p k}\n end\n end\n end", "def test_IP_FALHA_2\r\n msg_out = \"IP \"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def twemproxy_data\n stats = TCPSocket.open(host, port)\n JSON.parse(stats.gets)\n end", "def test_receive_ua_cpu_header\n lines = [\n \"GET /index.html HTTP/1.1\\r\\n\",\n \"Host: google.de\\r\\n\",\n \"UA-CPU: AMD64\\r\\n\",\n \"Connection: close\\r\\n\",\n \"\\r\\n\" ]\n \n require 'socket' \n socket = TCPSocket.new @@HOST, @@PORT \n begin\n lines.each do | line |\n socket.write line\n end\n sleep 1 # give the server some time to hand the request to the handler\n ensure\n socket.close\n end \n\n assert_equal 'AMD64', @app.environment[ 'HTTP_UA_CPU' ]\n end", "def port\n nodes[0][1].to_i\n end", "def geoip_dat \n @geoip_dat\n end", "def fh\n return hex_side_length + 2 * th\n end", "def load_stats\n\t\t stats_info = []\n\t\t c = @sock.cmd(\"String\" => \"load-stats\", \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n\t\t stats_info = c.split(',')\n\t\t # Number of clients\n\t\t stats_info[0] = stats_info[0].gsub(\"SUCCESS: nclients=\", \"\").to_i\n\t\t # Bytes Input\n\t\t stats_info[1] = stats_info[1].gsub(\"bytesin=\", \"\").to_i\n\t\t # Bytes Output\n\t\t stats_info[2] = stats_info[2].chop!.gsub(\"bytesout=\", \"\").to_i\n\t\t return stats_info\n end", "def to_h\n {\n # 0 = static 1\n # 1 = R_INPUT\n # 2..12 = serial\n # 13/14 = length\n\n e_pv_all: (Utils.int(@data[15, 4]) +\n Utils.int(@data[19, 4]) +\n Utils.int(@data[23, 4])) / 10.0, # kWh\n e_pv_1_all: Utils.int(@data[15, 4]) / 10.0, # kWh\n e_pv_2_all: Utils.int(@data[19, 4]) / 10.0, # kWh\n e_pv_3_all: Utils.int(@data[23, 4]) / 10.0, # kWh\n e_inv_all: Utils.int(@data[27, 4]) / 10.0, # kWh\n e_rec_all: Utils.int(@data[31, 4]) / 10.0, # kWh\n e_chg_all: Utils.int(@data[35, 4]) / 10.0, # kWh\n e_dischg_all: Utils.int(@data[39, 4]) / 10.0, # kWh\n e_eps_all: Utils.int(@data[43, 4]) / 10.0, # kWh\n e_to_grid_all: Utils.int(@data[47, 4]) / 10.0, # kWh\n e_to_user_all: Utils.int(@data[51, 4]) / 10.0, # kWh\n\n # 55 .. 62?\n # fault code? 4 bytes?\n # warning code? 4 bytes?\n\n t_inner: Utils.int(@data[63, 2]),\n t_rad_1: Utils.int(@data[65, 2]),\n t_rad_2: Utils.int(@data[67, 2]),\n t_bat: Utils.int(@data[69, 2]),\n\n # 71..72 ?\n\n # this actually seems to be cumulative runtime.\n # not found an uptime since reboot yet.\n uptime: Utils.int(@data[73, 4]) # seconds\n }\n end", "def max_packets=(_arg0); end", "def parseWebServerLine(raw_line)\n\ttokens = /^(\\S+) (\\S+) (\\S+) \\[(\\S+ \\+\\d{4})\\] \"(\\S+ \\S+ [^\"]+)\" (\\d{3}) (\\d+|-) \"(.*?)\" \"([^\"]+)\"$/.match(raw_line).to_a\n\treturn tokens\nend", "def test_IP_FALHA_1\r\n msg_out = \"IPacari\"\r\n msg_esperada = \"FALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def nodeIP(num)\n return \"10.17.4.#{num+200}\"\nend", "def get_bandwidth()\n return(get_cmd('BW;',0.1,0.5,3).gsub(/^BW/,'').gsub(/;$/,'').to_i*10)\nend", "def test_IP_IPFALHA\r\n msg_out = \"IP oslo\"\r\n msg_esperada = \"IPFALHA\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def raw_host_with_port; end", "def position\n Native::Encoder[@port] / 2\n end" ]
[ "0.5859646", "0.5540546", "0.5472723", "0.54419523", "0.53723776", "0.53193414", "0.53186256", "0.53156435", "0.53057015", "0.5301863", "0.5288774", "0.52624035", "0.5213883", "0.5213883", "0.5139019", "0.5133436", "0.5133436", "0.5116206", "0.5084869", "0.5046279", "0.5045139", "0.5042765", "0.49995747", "0.49995747", "0.49853003", "0.49624106", "0.49476346", "0.4916463", "0.49115312", "0.49048248", "0.48975992", "0.4895237", "0.48944294", "0.48929095", "0.48829526", "0.48674992", "0.48646286", "0.4863332", "0.48543304", "0.48540142", "0.4842635", "0.48403236", "0.48288444", "0.4815669", "0.48137292", "0.48111635", "0.4802648", "0.47856426", "0.47854787", "0.47802782", "0.4774064", "0.47739366", "0.47706342", "0.47635224", "0.4756097", "0.4756097", "0.4756097", "0.4756097", "0.4756097", "0.4756097", "0.4756097", "0.4756097", "0.47534555", "0.4747107", "0.4746047", "0.47331613", "0.47233063", "0.47168645", "0.4712723", "0.47000143", "0.4698592", "0.4698046", "0.46933118", "0.46896142", "0.46878046", "0.4680435", "0.46750712", "0.46750712", "0.46654877", "0.4661532", "0.4657688", "0.4657688", "0.4657538", "0.46567315", "0.46531472", "0.4650334", "0.4650231", "0.4641359", "0.46385327", "0.46382135", "0.46364042", "0.46326184", "0.46310824", "0.46300343", "0.46298552", "0.4625441", "0.46253765", "0.4624918", "0.46239933", "0.46233103", "0.4620191" ]
0.0
-1
Jan 1 00:00:00 rest of the log message goes here
def convert_message_line(line) line_array = line.split(' ') human_timestamp = Time.parse(line_array[0..2].join(' ')) format(human_timestamp, line_array, 3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(message)\n puts Time.now.strftime('[%d-%b-%Y %H:%M:%S] ') + message\n end", "def daily\n logger.info \" daily\"\n end", "def time_stamp(event)\n file_local_write(@logfile,\"\\nKeylog Recorder #{event} at #{Time.now.to_s}\\n\\n\")\n end", "def success\n @log[Date.today.iso8601] = 0\n\n puts \"Well done, #{@username}! You haven't smoked for #{@log.count { |value| value = 0 }} days! \"\n end", "def log\n last_line = logfile.lines.to_a.last || \"\"\n last_entry = last_line.split(/\\s/)\n new_entry = \"#{date}\\t#{count}\\n\"\n if last_entry.first != date\n logfile.write new_entry\n logfile.flush\n end\n puts new_entry\n end", "def format_log(sev, _time, _prog, msg); end", "def log_date\n self.well_info.date_logged\n end", "def log(m)\n puts \"#{Time.now.strftime(\"%F %T\")}> #{m}\"\n end", "def log(msg)\n puts(\"#{Time.now}> #{msg}\")\n end", "def logged\n @from_time = Time.now\n end", "def log(msg)\n @script = File.basename $0 \n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}.log\"\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |file|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n file.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend", "def print_prefix\n\t\tif(\n\t\t\tdatastore['TimestampOutput'] =~ /^(t|y|1)/i or\n\t\t\tframework.datastore['TimestampOutput'] =~ /^(t|y|1)/i\n\t\t)\n\t\t\treturn \"[#{Time.now.strftime(\"%Y.%m.%d-%H:%M:%S\")}] \"\n\t\tend\n\t\t\"\"\n\tend", "def logs message\n puts \"#{Time.now}: #{message}\"\n end", "def my_debug_time(msg)\n MorLog.my_debug(msg, true, \"%Y-%m-%d %H:%M:%S\")\n end", "def log(msg)\n Serv::Log.info(Time.now.to_s+': '+msg+\"\\n\")\n end", "def first_data_log severity, message\n end", "def log_new(msg)\n @script = File.basename($0).split(/\\./)[0] \n logfile = $script_dir + \"/var/log/#{@script}_new.log\"\n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}_new.log\" if $config[\"settings\"].has_key? 'log_directory'\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |f|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n f.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend", "def getLogDate()\n return self.getDateStr()\n end", "def log_info_with_timestamp(message)\n Rails.logger.info (\"#{get_timestamp} #{message}\")\nend", "def status_notice\n today = Date.current\n status_notice = \"#{self.name}\"\n case\n when today > start_on && today < finished_on\n status_notice << \" is RUNNING NOW.\"\n when today == start_on\n status_notice << \" starts TODAY.\"\n when today < start_on\n status_notice << \" starts on #{start_on.strftime(\"%A, %d %B, %Y\")}.\"\n when today > finished_on\n status_notice << \" is completed.\"\n when start_on.nil?\n status_notice << \" has no start date.\"\n else\n status_notice << '.'\n end\n end", "def logToday(foodName)\n\t\tdate = Date.today\n\t\tfoodName.upcase!\n\t\tlogSpecificDate(foodName, date)\n\tend", "def getFullLogDate()\n return self.getDateStr.to_FullLogDate()\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def event_log(msg)\n time = Time.now.strftime(\"%h %d %H:%M:%S\")\n$stdout.puts \"LOG: #{msg}\"\n# _open_sefile('server.log', 'a') { |f| f.puts \"(#{time}) #{msg}\" } rescue nil\nend", "def log(severity, message, progname)\n return @logger.log(severity, \"[Walltime: #{::Time.now.to_f}] \" + message, progname)\n end", "def mlog(*t)\n mess=\"#{Time.now.strftime('%H:%M:%S')} | AMQP #{t.join(' ')}\" \n puts mess\nend", "def log(msg)\n if $settings[:log]\n $settings[:log].write(Time.now.inspect + \" \" + msg + \"\\n\")\n $settings[:log].flush\n end\nend", "def history_date_if_needed(log)\n date = tz.utc_to_local(log.updated_at).strftime(\"%A, %d %B %Y\") \n if date != @last_date\n res = content_tag(:div, date, :class => \"log_header\")\n @last_date = date\n end\n\n return res\n end", "def log(output)\n the_time = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n puts \"#{the_time}: #{output}\"\nend", "def logSpecificDate(foodName, date)\n\t\t# Checks for invalid date format\n\t\tif !date.is_a?Date\n\t\t\treturn sysout(\"The date you entered [\" + date.to_s + \"] is not valid date format. \\nUse 'YYYY-MM-DD' or use 'help' command\") if (date =~ /(^\\d{4}-\\d{2}-\\d{2}$)/)== nil\n\t\t\tbegin \n\t\t\t\tdate = Date.strptime(date, \"%Y-%m-%d\") \n\t\t\trescue\n\t\t\t\treturn sysout(\"The date entered is not a valid date\")\n\t\t\tend\n\t\tend\n\n\t\tsysout(\"Note: the food your logging is in the future\") if date > Date.today\n\t\tfoodName.upcase!\n\t\tlogitem = LogItem.new(foodName, date, 1)\n\n\t\tif @log[date] == nil\n\t\t\tdateArray = (Array.new).push(logitem)\n\t\t\t@log[date] = dateArray\n\n\t\telsif @log[date].is_a?Array\n\t\t\tcontains = false\n\t\t\t@log[date].each { |x|\n\t\t\t \tif x.foodName == logitem.foodName\n\t\t\t \t\tx.count += 1\n\t\t\t \t\tcontains = true\n\t\t\t \tend\n\t\t\t}\n\t\t\t@log[date].push(logitem) if !contains\t\t\t\n\n\n\t\telse\n\t\t\tputs \"Error in logSpecificDate: Array never initialized\"\n\t\tend\n\t\t\n\n\n\tend", "def initialize(log, time_format=\"%Y-%m-%d %H:%M:%S\")\n @log = log\n @time_format = time_format\n end", "def log_info_time(msg)\n @logger.info(\"#{Time.now} #{msg}\")\n end", "def rezm_sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end", "def history_date_if_needed(log)\n date = tz.utc_to_local(log.updated_at).strftime(\"%A, %d %B %Y\")\n if date != @last_date\n res = content_tag(:div, date, :class => \"log_header\")\n @last_date = date\n end\n\n return res\n end", "def messages\n @archive.series.each do |series|\n series.webpage = @agent.get series.path\n series.title = series.webpage.parser.xpath(\"//div[@id='series']/h2\").children.text\n\n dates = series.webpage.parser.xpath(\"//div[@id='series_date']/ul/li\")\n dates = dates.map {|d| d.children.text }\n\n sermon = nil\n dates.each do |date|\n next if date == 'Date'\n # create a new sermon if we're at a new date. this is an awkward webpage.\n if date != ''\n sermon = series.a_sermon\n sermon.date = date\n end\n sermon.a_message\n end\n end\n end", "def log(str); puts \"[#{Time.now}] #{str}\"; end", "def print_date\n\t$report_file.puts \"Today's Date: #{DateTime.now.strftime('%m/%d/%Y')}\"\nend", "def format_log(sev, _time, _prog, msg)\n \"[#{sev.downcase}]: #{msg}\\n\"\n end", "def log(str)\n puts \"#{Time.now.strftime(\"%Y/%m/%d %H:%M:%S\")}> #{str}\"\n end", "def showDate(date)\n puts \"#{date}\"\n items = @logHash[date]\n items.each do |item|\n puts \" #{item.name}\"\n end\n end", "def sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end", "def get_log_time(line)\n data_string = line.match(/[\\w]*[\\s]*[\\w]*[\\s]*[^\\s]*/)[0]\n # the year is not included, so this will fail if the current year is different\n # for now we'll hack it to be the current year\n date = DateTime.parse(\"#{data_string} #{REPORT_YEAR}\")\nend", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def log(msg, feeds = nil)\n open(\"#{RAILS_ROOT}/log/updatr.log\", \"a\") { |io|\n io.puts \"#{Time.now.strftime(\"%d-%m-%y %H:%M\")} — #{msg}\"\n }\n\nend", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def log(msg)\n SystemLog.fact(title: 'live-scheduler-controller', payload: msg)\n end", "def log(msg, level = :info)\n puts(\"ZapUpdater: \" + msg)\n RAILS_DEFAULT_LOGGER.info(\"ZapUpdater: \" + msg)\n @mail_log << msg + \"<br/>\\r\\n\" if level == :info\n end", "def logs\n end", "def log(log)\n post(formatter.call(log, self), log.time.strftime(@logging_path))\n end", "def showToday( foodLog )\n today = Date.today.to_s\n puts \"\\n\" + foodLog.showDate( today ) \nend", "def log_line(line)\n puts \"cron_task:continuous:#{@process_name} : #{line}\"\n end", "def add_log_header(file)\n file.write(\n \"# Logfile created on %s by %s\\n\" % [Time.now.to_s, Logger::ProgName]\n ) if file.size == 0\n end", "def reopen_logs; end", "def start_logger\n @appium_logger = ::Logger.new(Maze.config.appium_logfile)\n @appium_logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n end", "def autoflush_log; end", "def autoflush_log; end", "def setup_log\r\n logfile = File.open(\"/home/englandk/rails_apps/reminders/log/auto_enquiry.log\", 'a')\r\n \r\n @log = AuditLogger.new(logfile)\r\n @log.level = Logger::INFO\r\n @log.debug \"Started auto response email run\"\r\n end", "def printDate(date)\n\t\tif !date.is_a?Date\n\t\t\treturn sysout(\"The date you entered [\" + date.to_s + \"] is not valid date format. \\nUse 'YYYY-MM-DD' or use 'help' command\") if (date=~(/(^\\d{4}-\\d{2}-\\d{2}$)/)) == nil\n\t\t\tbegin \n\t\t\t\tdate = Date.strptime(date, \"%Y-%m-%d\") \n\t\t\trescue\n\t\t\t\treturn sysout(\"The date entered is not a valid date\")\n\t\t\tend\n\t\tend\n\n\t\t## AT this pint date should be a DATE object\n\t\tif @log[date] == nil || !(@log[date].is_a?Array)\n\t\t\tsysout(\"Notice, there is no log items for the date: \" + date.to_s)\n\t\telse\n\t\t\tputs \"========================================\" #40\n\t\t\tputs \"\\t\\t\" + date.to_s + \"\\t\\t\"\n\t\t\t@log[date].each{ |x| puts x.to_s }\n\t\t\tputs \"========================================\"\n\t\tend\n\tend", "def log(msg)\n lines = msg.split(/\\n/)\n\n STDERR.puts \"** #{lines.first}\"\n lines[1..-1].each do |line|\n STDERR.puts\" #{line}\"\n end\n end", "def log\n minutes = parse_time(ARGV.shift)\n if minutes.nil?\n @p.error \"Time must be provided.\"\n end\n opts = Trollop::options do\n banner \"tickspot log [time] [-m \\\"message\\\"]\"\n opt :message, \"Note\", :short => \"-m\", :type => String, :default => \"\"\n opt :code, \"Client/Project/Task code\", :short => \"-c\", :type => String\n end\n\n task_id = get_task_id(opts[:code])\n @p.puts \"\"\n if @tickspot.create_entry(task_id, minutes/60, opts[:message])\n if opts[:code]\n @p.puts \"Created entry.\"\n else\n @p.puts \"Created entry. In the future you can use '--code #{task_id}' for this task.\"\n end\n end\n end", "def date; end", "def date; end", "def date; end", "def date; end", "def autolog_created\n autolog_event(:created)\n end", "def addLog(name, date = Date.today.strftime(\"%m/%d/%Y\"))\n logItem = LogItem.new(name, date)\t\t\t#Creating a new log item object\n if @logHash.has_key? logItem.date\n #puts \"Same Date comes here!\"\n @logHash[logItem.date].push logItem\n else\n @logHash[logItem.date] = [logItem]\n end\n end", "def ezm_sent_at(message)\r\n message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase\r\n end", "def log_input\n File.open('./log/ultimo_registro.txt', 'w+') do |f| \n f.puts Time.now.strftime(\"%Y%m%d-%H:%M\").to_s\n end \n end", "def default_run\n self.level = :full\n self.day = \"first sun\"\n self.time = '04:00'\n end", "def log\n end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def log(message)\n @ticket.log(message) unless message.blank?\n # always save the last log message\n @last_log_message = message\n end", "def log(severity, message)\n timestamp = Time.now.strftime('%m-%d %H:%M:%S')\n formatted = \"[%s] %s | %s\" % [timestamp, self.class.name, message]\n RDFMapper::Logger::Configuration.target.add(severity, formatted)\n end", "def get_time_message()\n\t\tt = Time.now\n\t\t#string_date = t.strftime(\"%A %B %d, %Y\")\n\n\t\tif t.hour < 12\n\t\t\ttime_message =\t\"Good Morning\"\n\t\telsif t.hour > 12 && t.hour < 17 \n\t\t\ttime_message =\t\"Good Afternoon\"\n\t\telse\n\t\t\ttime_message =\t\"Good Evening\"\n\t\tend\n \tend", "def logputs(str)\n\tstr == \"\" if(str.nil?)\n\n\tdstr = Time.now.strftime(\"[%d/%b/%Y %H:%M:%S] \")\n\tputs dstr + str\nend", "def log_file; end", "def log(msg, cls=nil)\n time_stamp = Time.now.strftime(\"%H:%M:%S\")\n if cls.nil?\n print \" [#{time_stamp}] #{msg}\\n\"\n else\n print \" [#{time_stamp}] #{cls.class.name}: #{msg}\\n\"\n end\nend", "def out(msg)\n puts \"#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")} #{msg}\" if DEBUG_OUTPUT\nend", "def info(msg) log(6, msg); end", "def activity_log_create\n write_activity_log(:create)\n end", "def date() updated; end", "def format_log_message(msg)\n \"[Cloudtasker/Server][#{id}] #{msg}\"\n end", "def usage_reset_day\n self.upload_limit_resets_at.strftime(\"%A, %B %e, %Y\")\n end", "def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end", "def log_error_with_timestamp(message)\n Rails.logger.error (\"#{get_timestamp} #{message}\")\nend" ]
[ "0.6615549", "0.64032143", "0.6076639", "0.6061115", "0.6035361", "0.6035348", "0.6031951", "0.6005669", "0.59837145", "0.58933556", "0.5823868", "0.58227754", "0.5806736", "0.58067167", "0.57982236", "0.5785717", "0.57604456", "0.5743552", "0.5736973", "0.571662", "0.5713966", "0.5709802", "0.5703439", "0.5703439", "0.5703439", "0.5703439", "0.5703439", "0.5703439", "0.56666154", "0.5640639", "0.56364715", "0.56356096", "0.5631302", "0.5617932", "0.56177336", "0.56030375", "0.55977696", "0.55965817", "0.55922085", "0.5592078", "0.5584232", "0.55823237", "0.5551483", "0.55477035", "0.5544191", "0.5534658", "0.55320644", "0.5529543", "0.5529543", "0.5529543", "0.5529543", "0.5529543", "0.5529543", "0.5529543", "0.5529543", "0.55273783", "0.55208933", "0.5497319", "0.5497319", "0.5497319", "0.5497319", "0.5490973", "0.5479673", "0.54656714", "0.5454961", "0.5453771", "0.54456097", "0.54451233", "0.54348785", "0.5433743", "0.5418491", "0.5418491", "0.54172665", "0.54040104", "0.5399483", "0.5397609", "0.5394126", "0.5394126", "0.5394126", "0.5394126", "0.53846055", "0.53793144", "0.53712815", "0.5365852", "0.53652626", "0.53616494", "0.53612864", "0.533318", "0.5331895", "0.533013", "0.5329719", "0.5325923", "0.53258574", "0.5325781", "0.53192717", "0.53103614", "0.53076506", "0.53058773", "0.5303046", "0.5301584", "0.52960473" ]
0.0
-1
[1490289098] SERVICE ALERT: hostname and other message stuff here where the bit in brackets is an epoch timestamp :(
def convert_nagios_line(line) line_array = line.split(' ') epoch_timestamp = line_array[0].gsub(/\D/, '') human_timestamp = Time.at(epoch_timestamp) format(human_timestamp, line_array, 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_metadata(msg)\n return {:timestamp=>Time.now.utc.strftime('%FT%T.%3NZ'),\n :msg=>msg,\n :ip=>@ip,\n :pid=>@pid}\n end", "def format_log_message(msg)\n \"[Cloudtasker/Server][#{id}] #{msg}\"\n end", "def fmt(data)\n pkt = \"<190>1 \"\n pkt += \"#{data[:t].strftime(\"%Y-%m-%dT%H:%M:%S+00:00\")} \"\n pkt += \"#{@hostname} \"\n pkt += \"#{data[:token]} \"\n pkt += \"#{@procid} \"\n pkt += \"#{@msgid} \"\n pkt += \"#{@structured_data} \"\n pkt += data[:msg]\n \"#{pkt.size} #{pkt}\"\n end", "def build_hb_message(host,port,asg_name,domain,account,instance_id)\n timestamp=(Time.now.to_f * 1000.0).to_i # ts should be in ms\n metrics={:account=>account,:appId=>asg_name, :instanceID=>instance_id,:timestamp=>timestamp,:entryList=>[{:name=>\"METRIC_CPU\",:value=>0},{:name=>\"METRIC_CPU_DEMAND\",:value=>0},{:name=>\"METRIC_CPU_NUM\",:value=>1},{:name=>\"METRIC_MEM\",:value=>0},{:name=>\"METRIC_MEM_FREE\",:value=>0}]}\n hb={:host=>host,:port=>port.to_i,:uris=>[\"#{asg_name}.#{domain}\"],:tags=>{:metrics=>metrics}}\n hb.to_json\n end", "def default_service_msg_number\n 1002\n end", "def convert_message_line(line)\n line_array = line.split(' ')\n human_timestamp = Time.parse(line_array[0..2].join(' '))\n format(human_timestamp, line_array, 3)\nend", "def log_info_with_timestamp(message)\n Rails.logger.info (\"#{get_timestamp} #{message}\")\nend", "def format_message(severity, timestamp, progname, msg)\n \"#{AUTHORIZATION_SYSTEM_LOG_MSG_PREFIX} #{timestamp.to_formatted_s(:db)} #{severity} #{msg}\\n\" \n end", "def format_message(severity, timestamp, progname, msg)\n # $stderr.puts \"format_message: #{msg}\"\n sprintf \"%s,%03d %7s: %s%s\\n\",\n timestamp.strftime(\"%Y-%m-%d %H:%M:%S\"),\n (timestamp.usec / 1000).to_s,\n severity,\n prefix.nil? ? \"\" : \"#{prefix} \",\n msg\n end", "def heartbeat_entry\n \"#{name} #{ip} #{Application.managed_services}\"\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def logs_response\n \"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35272 ttl=52 time=36.9 ms\\n\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35273 ttl=52 time=35.3 ms\\n\"\n end", "def get_message_formatted(message, timestamp)\r\n {\r\n data: message,\r\n timestamp: timestamp\r\n }\r\n end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def do_something_with_BHS(msg)\n # puts \"My \" << msg[0].e0 << \" looks like this: \" << msg.to_s\nend", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def ip_timestamp(timestamp, ip_address)\n [ip2long(ip_address), timestamp].pack(\"NN\")\n end", "def local_timestamp(body)\n @var[:timestamp] = body\n _save_env\n _notice \"Timestamp format changed\"\nend", "def received_at\n params['TIMESTAMP']\n end", "def format(tag, time, record)\n return [tag, record].to_msgpack\n end", "def format(tag, time, record)\n return [tag, record].to_msgpack\n end", "def format(tag, time, record)\n [tag, time, record].to_msgpack\n end", "def timestamp\n @timestamp ||= Time.now.strftime Savon::SOAP::DateTimeFormat\n end", "def log_error_with_timestamp(message)\n Rails.logger.error (\"#{get_timestamp} #{message}\")\nend", "def [](id)\n msgid = sprintf(\"%.6f\",Time.now.to_f).to_s.sub('.','-')\n msgid = @host + '-' + msgid + '-' + id.to_s\n end", "def format_log(sev, _time, _prog, msg); end", "def timestamp\n return nil if grpc.nil?\n Convert.timestamp_to_time grpc.read_timestamp\n end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def time_stamp(event)\n file_local_write(@logfile,\"\\nKeylog Recorder #{event} at #{Time.now.to_s}\\n\\n\")\n end", "def default_service_msg_number\n \"0002\"\n end", "def event_display_line(msg, room)\n msg.replace(\"#{Time.now.strftime(@var[:timestamp])}#{msg}\") if msg\nend", "def format_message(severity, ts, progname, msg)\n \"#{ts.strftime '%Y-%m-%d %H:%M:%S'} #{severity.chars.first} #{msg}\\n\"\n end", "def get_timestamp(output)\n output.split(\"\\n\").first.match(/^\\[([^\\]]*)\\]/)[1].gsub(/\\/| |:/,'.')\n end", "def format_message(severity, timestamp, progname, msg)\n # remove the function name from the caller location\n location = caller(3).first.gsub(/:in `.*'$/, \"\")\n \"#{timestamp.strftime(datetime_format)} #{severity} #{Socket.gethostname}(#{Process.pid}) #{progname} #{location} #{msg}\\n\"\n end", "def format(tag, time, record)\n [tag, time, record].to_msgpack\n end", "def debug_msg(msg)\n \"[#{timestamp_with_usec}] #{msg}\"\n end", "def rezm_sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end", "def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end", "def event_log(msg)\n time = Time.now.strftime(\"%h %d %H:%M:%S\")\n$stdout.puts \"LOG: #{msg}\"\n# _open_sefile('server.log', 'a') { |f| f.puts \"(#{time}) #{msg}\" } rescue nil\nend", "def format(tag, time, record)\n\t\t[time, record].to_msgpack\n end", "def call(severity, timestamp, progname, msg)\n if msg.is_a? Hash\n msg.reverse_merge!('at' => timestamp) unless msg.key?('at')\n elsif msg.is_a? String\n if string_formatter\n msg = \"#{tags_text}#{msg}\" if current_tags.any?\n return string_formatter.call(severity, timestamp, progname, msg)\n else\n msg = {'at' => timestamp, 'message' => msg}\n end\n else\n msg = {'at' => timestamp, 'object' => msg.inspect}\n end\n msg['at'] = msg['at'].utc\n \"#{msg.to_json}\\n\"\n end", "def ezm_sent_at(message)\r\n message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase\r\n end", "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "def sent_at_seconds_since_epoch\n Time.current.utc.to_i\n end", "def get_message_formatted(raw, time)\n {\n :data => raw,\n :timestamp => timestamp(time)\n }\n end", "def log msg\n puts \"U:Service: #{msg}\"\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def mlog(*t)\n mess=\"#{Time.now.strftime('%H:%M:%S')} | AMQP #{t.join(' ')}\" \n puts mess\nend", "def format(tag, time, record)\n [tag, time, record].to_msgpack\n end", "def event_data\n message = @event['check']['output']\n \"#{message.split[1]} RPS\"\n end", "def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend", "def formatted_message(message)\n \"#{timestamp}#{message}\\n\".freeze if message\n end", "def sent_at(message)\n h(message.created_at.to_date.strftime('%m/%d/%Y') + \" \" + message.created_at.strftime('%I:%M %p').downcase)\n end", "def format(tag, time, record)\n newrecord = {}\n\n begin\n if record['severity']\n newrecord['severity'] = Integer(record['severity'])\n else\n newrecord['severity'] = @severity\n end\n rescue\n newrecord['severity'] = @severity\n end\n\n newrecord['type'] = tag.to_s\n newrecord['agent_time'] = time.to_s\n newrecord['manager'] = @manager\n newrecord['class'] = @source\n newrecord['source'] = @hostname\n newrecord['description'] = record['message']\n newrecord['custom_info'] = record\n\n newrecord.to_msgpack\n end", "def should_print_message(timestamp, message)\n \n end", "def add_dynamic_timestamp(text)\nend", "def message_get(env, status, headers, began_at)\n now = Time.now\n\n format(CFORMAT,\n env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-',\n env['REMOTE_USER'] || '-',\n format_datetime(now),\n env[REQUEST_METHOD],\n env[PATH_INFO],\n env[QUERY_STRING].to_s.empty? ? '' : \"?#{env[QUERY_STRING]}\",\n env[HTTP_VERSION],\n status.to_s[0..3],\n extract_content_length(headers),\n now - began_at)\n end", "def get_envelope_time(byte)\n byte\n end", "def make_id(msg)\n msg_hash = JSON.parse(msg)\n hostname = msg_hash['server']['hostname']\n package = msg_hash['package']['name']\n arch = msg_hash['package']['arch']\n Base64.encode64(hostname + package + arch)\n end", "def twitter_publish_message\n \"#NoAgenda show ##{number} attack vectors now at http://noagendadashboard.com\"\n end", "def send_message(sock,msg)\n msg.ftime = DateTime.now\n body = msg.to_yaml + CRLF\n sock.write(body)\n end", "def format_log(sev, _time, _prog, msg)\n \"[#{sev.downcase}]: #{msg}\\n\"\n end", "def received_at\n params['']\n end", "def rfc2822\n strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z'))\n end", "def received_at\n params['']\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 message_id; @message_impl.getMessageId; end", "def hex_trace_id\n trace_id.unpack1('H*')\n end", "def expired_msg\n return unless expired?\n\n delta = reference_time - time - validity\n \"Expired timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds past expiration.\"\n end", "def test_email_quoted_with_0d0a\n mail = TMail::Mail.parse(IO.read(\"#{File.dirname(__FILE__)}/fixtures/raw_email_quoted_with_0d0a\"))\n assert_match %r{Elapsed time}, mail.body\n end", "def test_email_quoted_with_0d0a\n mail = TMail::Mail.parse(IO.read(\"#{File.dirname(__FILE__)}/fixtures/raw_email_quoted_with_0d0a\"))\n assert_match %r{Elapsed time}, mail.body\n end", "def format(tag, time, record)\n @log.trace \"Buffering #{tag}\"\n [tag, record].to_msgpack\n end", "def request_timestamp\n auth_info[\"date\"] || \"\"\n end", "def acknowledgement_reference_id\r\n\t\tacknowledgement_message.split(\":\")[1].gsub(/\\s/,\"\")\r\n\tend", "def date_time\n @message[:date_time]\n end", "def timestamp\n Time.now.to_s\n end", "def save_heartbeat\n timestamp = Time.now.to_i\n store.zadd(\"hb:#{@client.uid}\", timestamp, [Time.now.to_s(:db), @payload].to_json)\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def gateway_message(data)\n {\n data: data,\n timestamp: Time.now.to_i,\n proto_version: 1,\n }\n end", "def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end", "def format(human_timestamp, line_array, offset)\n human_timestamp.getlocal.strftime('%Y-%m-%d %H:%M:%S%z') + ' ' + line_array[offset..-1].join(' ')\nend", "def received_at\n params[:json]['message_time']\n end", "def init_buffer(buffer, hash)\n buffer['message'] = hash['message'].gsub(\"\\n\", ' ')\n buffer['source'] = hash['source']\n buffer['timestamp'] = hash['timestamp']\n buffer['offset'] = hash['offset']\n buffer['system'] = hash['system']\n timestamp = buffer['timestamp'].to_i\n buffer['date'] = Time.at(timestamp/1000).to_s[0..9]\n end", "def beacon_host\n @vic.vim.serviceContent.about.instanceUuid\n Time.now.to_s\n end", "def initialize(host, ssl_port, timestamp)\n\n @addr = host.addr\n @hostname = host.hostname\n @num = ssl_port.num.to_i\n @proto = ssl_port.proto\n @tunnel = ssl_port.service.tunnel\n @svcname = ssl_port.service.name\n @svcproduct = ssl_port.service.product\n @svcversion = ssl_port.service.version\n @timestamp = timestamp\n\n if ssl_port.script('ssl-cert') && ssl_port.script('ssl-cert').output\n expire_regex = /Not valid after: (\\d{4}-\\d{2}-\\d{2}T\\d\\d:\\d\\d:\\d\\d)/\n match = expire_regex.match(ssl_port.script('ssl-cert').output)\n @expire = Date.parse(match[1]) if match\n\n created_regex = /Not valid before: (\\d{4}-\\d{2}-\\d{2}T\\d\\d:\\d\\d:\\d\\d)/\n match = created_regex.match(ssl_port.script('ssl-cert').output)\n @created = Date.parse(match[1]) if match\n\n type_regex = /Public Key type: (\\w{1,5})/\n match = type_regex.match(ssl_port.script('ssl-cert').output)\n @type = match[1].upcase if match\n\n bits_regex = /Public Key bits: (\\w{1,5})/\n match = bits_regex.match(ssl_port.script('ssl-cert').output)\n @bits = match[1].to_i if match\n\n issuer_regex = /Issuer: commonName=([^\\/\\n]*)/\n match = issuer_regex.match(ssl_port.script('ssl-cert').output)\n @issuer = match[1] if match\n\n subject_regex = /Subject: commonName=([^\\/\\n]*)/\n match = subject_regex.match(ssl_port.script('ssl-cert').output)\n @subject = match[1] if match\n\n sigalgo_regex = /Signature Algorithm: ([^\\n]*)/\n match = sigalgo_regex.match(ssl_port.script('ssl-cert').output)\n @sigalgo = match[1] if match\n\n thumbprint_regex = /SHA-1:([^\\n]*)/\n match = thumbprint_regex.match(ssl_port.script('ssl-cert').output)\n @thumbprint = match[1] if match\n\n end\n\n end", "def notification_document_name\n \"notification-report_#{external_id}_#{Time.now.utc.strftime('%Y%m%d%k%M%S')}\"\n end", "def log(msg)\n Serv::Log.info(Time.now.to_s+': '+msg+\"\\n\")\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def datasetid_to_timestamp(datasetid)\n timestamped = datasetid.id\n @timestamped = timestamp.id.generation_time.strftime('%d-%m-%Y %H:%M')\nend", "def timestamp_name(timestamp)\n [\"ts\", timestamp.to_f].join(\":\")\n end", "def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend", "def timestamp\n Time.now.to_i.to_s\n end" ]
[ "0.59727615", "0.59495276", "0.5854783", "0.5762841", "0.5628444", "0.55867153", "0.5551732", "0.55501735", "0.5542433", "0.55044085", "0.5467815", "0.54640925", "0.54603654", "0.54250056", "0.54139346", "0.5406667", "0.5406667", "0.5406667", "0.5406667", "0.5406667", "0.5406667", "0.54024076", "0.53575635", "0.53492475", "0.5348845", "0.5348845", "0.5329837", "0.5321837", "0.5306513", "0.52890766", "0.5288081", "0.52852285", "0.5279163", "0.5279163", "0.5279163", "0.5279163", "0.52426726", "0.5220281", "0.5202888", "0.52000713", "0.51986396", "0.5193465", "0.5192108", "0.51851267", "0.5164499", "0.51530004", "0.51467717", "0.51463926", "0.5145244", "0.5117144", "0.51044935", "0.50986624", "0.5095589", "0.5087381", "0.5077974", "0.5068649", "0.50665677", "0.5061756", "0.5033297", "0.5024365", "0.50077045", "0.4998611", "0.49967805", "0.49925518", "0.4991922", "0.49904296", "0.49864924", "0.4975304", "0.49734548", "0.49727458", "0.4963487", "0.49585548", "0.4950066", "0.4948554", "0.49443412", "0.49425977", "0.49423522", "0.49412596", "0.49412596", "0.49369395", "0.49313566", "0.49312198", "0.49212328", "0.49163386", "0.491576", "0.49106073", "0.49106073", "0.4909205", "0.49078152", "0.4907245", "0.49041224", "0.49002817", "0.48848766", "0.48787045", "0.48766688", "0.48729116", "0.48703206", "0.4863243", "0.48614612", "0.48571387" ]
0.54702663
10
Format the timestamp consistently and smash everything back into a string
def format(human_timestamp, line_array, offset) human_timestamp.getlocal.strftime('%Y-%m-%d %H:%M:%S%z') + ' ' + line_array[offset..-1].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_timestamp(t)\n t.strftime('%s%9N')\n end", "def format_timestamp(raw_timestamp)\n Time.at(raw_timestamp).getutc.strftime(\"%Y%m%d%H%M%S\")\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def format_timestamp(timestamp)\n Time.parse(timestamp).strftime(\"%T (%z)\")\n end", "def timestamp\n time.strftime formatter\n end", "def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end", "def format_long_timestamp(timestamp)\n Time.at(timestamp/1000).utc.iso8601\n end", "def log_fmt_timestamp(time)\n [(time/3600).to_i, (time/60 % 60).to_i, (time % 60).to_i].map{|t| t.to_s.rjust(2,'0')}.join(':')\n end", "def format_stamp( stamp )\n ( stamp.user.nil? ? 'anon' : stamp.user.login ) + \" (\" + stamp.created_at.strftime(\"%m/%d/%y - %I:%M %p\") + \")\"\n end", "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "def get_timestamp(time)\n time.to_i.to_s.ljust 13, '0'\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def format_timestamp(datetime)\n datetime.getlocal.to_formatted_s(:long_ordinal)\n end", "def stamp(format = nil)\n unless String === format\n format = FORMAT[format]\n end\n strftime(format).strip\n end", "def nice_time\n Time.at(time).utc.strftime('%-M:%Ss')\n end", "def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end", "def format_stamp_for( object )\n stamp = object.last_stamp\n if stamp\n format_stamp( stamp )\n else\n \"system import (\" + object.created_at.strftime(\"%m/%d/%y - %I:%M %p\") + \")\"\n end\n end", "def display_time(timestamp)\n return nil if timestamp.blank?\n timestamp.to_s(:date_time_long)\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def timekey_to_timeformat(timekey)\n case timekey\n when nil then ''\n when 0...60 then '%Y%m%d%H%M%S' # 60 exclusive\n when 60...3600 then '%Y%m%d%H%M'\n when 3600...86400 then '%Y%m%d%H'\n else '%Y%m%d'\n end\n end", "def to_s\n return \"#{\"%04d\" % @t_year}-#{\"%02d\" % @t_month}-#{\"%02d\" % @t_day} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec}\"\n end", "def fast_export_timestamp(time)\n time.strftime('%s %z')\nend", "def format_time(time)\n strftime_preset = '%Y-%m-%dT%l:%M:%S%z'\n time.strftime(strftime_preset)\n end", "def to_timestamp(string)\n Time.parse(string).strftime(\"%s\")\nend", "def format_time(time)\n time = Time.at(time / 1e6, time % 1e6)\n return time.strftime(\"%FT%TZ\")\n end", "def timestamp\n datetime.localtime.strftime \"%Y %d/%m %X\"\n end", "def time_str\n Time.at(time[0..-4].to_f + time[-3..-1].to_f / 1000)\n .strftime(\"%M:%S.%L\")\n end", "def ship_timestamp\n Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').tap{|str| str[-2,0] = ':' }\n end", "def format_date(raw_timestamp)\n timestamp = Date.parse(raw_timestamp)\n timestamp.strftime(DATE_FORMAT)\n end", "def localtime_str\n return \"#{\"%04d\" % @t_year}-#{\"%02d\" % @t_month}-#{\"%02d\" % @t_day} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} #{self.offset_str}\"\n end", "def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end", "def time_s\n time_to_s(time)\n end", "def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end", "def strf_standard(datetime, length)\n\t\tif length == 'short'\n\t\t\treturn datetime.strftime('%a %k:%M%P - %b %-d')\n\t\tend\n\tend", "def tt(time, format=:short); '13:37'; end", "def formattimeanddate(unformattedtime)\n unformattedtime.strftime('%I:%M:%S %p - %d %m %Y')\n end", "def formatted_timestamp(date)\n Date.parse(date).strftime('%d/%m/%Y')\n end", "def get_yyyymmdd_hhnnss(s)\n return s.gsub('T', ' ').gsub('Z', '')\n end", "def ts_to_str(ts)\n return '' if ts == nil\n gm_to_local(ts).strftime('%a %b %d, %Y') + ' at ' +\n gm_to_local(ts).strftime('%I:%M%p').downcase + ' ' + (session[:time_zone_abbr] || '')\n end", "def to_s(pretty=true)\n d, h, m, s, ms = elapsed\n e_t = (d > 0) ? \"#{d.to_s}d \" : ''\n if pretty\n e_t += ('%02u:' % [h]) if (d + h) > 0\n e_t += ('%02u:' % [m]) if (d + h + m) > 0\n e_t += '%02u.%03u' % [s, ms]\n else\n e_t << '%02u:%02u:%02u.%03u' % [h,m,s, ms]\n end\n end", "def to_s\n \"#{time.strftime(\"%Y-%m-%d %H:%M:%S\")} #{formatted_offset(false, 'UTC')}\" # mimicking Ruby Time#to_s format\n end", "def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash['p']\n time = ''\n time += hours[0] + minutes[0] + ' ' + ampm[0] + \"\\n\"\n time += hours[1] + minutes[1] + ' ' + ampm[1] + \"\\n\"\n time += hours[2] + minutes[2] + ' ' + ampm[2] + \"\\n\"\n time\n end", "def ts_to_time_str(ts)\n return '' if ts == nil\n gm_to_local(ts).strftime('%I:%M:%S%p').downcase\n end", "def timestamp_name(timestamp)\n [\"ts\", timestamp.to_f].join(\":\")\n end", "def fmt_time(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(ApplicationHelper.gen_time_fmt)\n end\n end", "def time_format(seconds)\nend", "def time_format(seconds)\nend", "def timeformat_change(time)\n from_format = time.to_s.split(\" \")\n from_format = \"#{from_format[0]} #{from_format[1]}\"\n return from_format\n end", "def format_time(time)\n return time.strftime(\"%l:%M%p\")\n end", "def timestamp\n current_time = DateTime.now\n \"#{current_time.strftime(\"%d/%m/%y %H:%M:%S\")} -\"\n end", "def proper_time(time)\n\tTime.at(time).gmtime.strftime('%R:%S')\nend", "def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend", "def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end", "def to_s\n if year == 0 and mon == 0 and day == 0\n h = neg ? hour * -1 : hour\n sprintf \"%02d:%02d:%02d\", h, min, sec\n else\n sprintf \"%04d-%02d-%02d %02d:%02d:%02d\", year, mon, day, hour, min, sec\n end\n end", "def timestamp\n @now = Vedeu.clock_time\n @time ||= 0.0\n @last ||= @now\n\n unless @last == @time\n @time += (@now - @last).round(4)\n @last = @now\n end\n\n \"[#{format('%7.4f', @time.to_s)}] \".rjust(7)\n end", "def formattime2(unformattedtime)\n unformattedtime.strftime('%H:%M:%S')\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def now_stamp(now = nil)\n now ||= Time.now\n now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def canonical_time\n Time.parse(timestamp).utc.iso8601\n end", "def to_s\n\t\ts, m = @sec % 60, @sec / 60\n\t\th = m / 60\n\t\tm = m % 60\n\t\treturn (\"%02d:%02d:%02d\" % [h, m, s])\n\tend", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\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 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 formatted_current_timestamp\n Time.now.strftime('%Y-%m-%d')\nend", "def to_s\n second_format = (second % 1).zero? ? '%02d' : '%04.1f'\n\n format(\"%04d-%02d-%02dT%02d:%02d:#{second_format}%s\", *atoms)\n end", "def display_date_and_time(timestamp)\n local_time(timestamp).strftime('%B %d, %Y at %l:%M %p')\n end", "def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\nend", "def format_datetime(date, format = :long)\n date.to_formatted_s(format)\n end", "def nice_time(time)\n time = time.to_i\n return \"\" if time == 0\n t = \"\"\n h = time / 3600\n m = (time - (3600 * h)) / 60\n s = time - (3600 * h) - (60 * m)\n t = good_date(h) + \":\" + good_date(m) + \":\" + good_date(s)\n end", "def format(precise: false)\n return '-' if @ms.nil?\n\n return Kernel.format('%02d:%02d:%02d.%03d', hours, minutes, seconds, milliseconds) if precise\n Kernel.format('%02d:%02d:%02d', hours, minutes, seconds)\n end", "def timestring(time)\n time.strftime(\"%Y/%m/%d %H:%M:%S\") + \".#{time.usec}\"[0..3]\n end", "def reference_timestamp\n reference_time.strftime formatter\n end", "def pretty_time\n\thour = created_at.strftime(\"%l\").to_i - 5\n\tcreated_at.strftime(\"%A, %b %d, %Y\")\nend", "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_time(seconds)\n if seconds < 60\n sprintf \"%ds\", seconds\n elsif seconds < 60 * 60\n sprintf \"%dm:%02ds\", seconds / 60, seconds % 60\n else\n sprintf \"%dh:%02dm\", seconds / (60 * 60), seconds % (60 * 60) / 60\n end\nend", "def time_string\n\n\t\thours = @seconds/3600 #if not an hour will be stored as 0\n\t\tremainder = @seconds%3600 #modulo gives the amount that remains\n\t\tsprintf(\"%02d:%02d:%02d\", hours, remainder/60, remainder%60) #string formatting\n\t\t\n\tend", "def nice_time(time)\n time = time.to_i\n return \"\" if time == 0\n h = time / 3600\n m = (time - (3600 * h)) / 60\n s = time - (3600 * h) - (60 * m)\n good_date(h) + \":\" + good_date(m) + \":\" + good_date(s)\n end", "def formatted_value\n formatter = @format.downcase.split(' ').map do |part|\n if (parsed_format = parse_date_or_time_format(part))\n parsed_format\n else\n warn 'Unable to parse custom format. Using \"YYYY-mm-dd HH:MM:SS\" format.'\n return @value.strftime('%F %T')\n end\n end.join(' ')\n\n @value.strftime(formatter)\n end", "def pretty_time\n t = self.start_time\n t.strftime(\"%a, %b %e, %l:%M %p\")\n end", "def to_s\n s = @display.strftime(time_format)\n case @display_granularity\n when :ten_minute\n s.chop!\n s << \"~\"\n when :one_hour\n s.chop!\n s.chop!\n s << \"~~\"\n end\n return s\n end", "def format_time(time)\n first_colon = time.index(':')\n if first_colon.nil? \n #if it's not a time\n return time\n end\n second_colon = time.index(':', first_colon + 1)\n result = time[0, first_colon]\n if result.length < 2\n result = \"0#{result}\"\n end\n if second_colon.nil?\n second_colon = time.length\n end\n result += time[first_colon, second_colon - first_colon]\n return result\nend", "def convert_timestamp(value, capture_definition)\n DateTime.parse(value).strftime('%Y%m%d%H%M%S').to_i unless value.nil?\n end", "def time_string()\n #Get numerical representations for each value\n @hours = seconds / 60 / 60\n @minutes = (seconds / 60) % 60\n @seconds = seconds % 60\n\n #Convert the values to properly formatted strings\n @hours = padded(@hours)\n @minutes = padded(@minutes)\n @seconds = padded(@seconds)\n \n #return the string\n @hours + ':' + @minutes + ':' + @seconds\n end", "def timestampFormat(value)\n _timestampFormat(value) or fail ArgumentError, \"Unknown value for timestampFormat: #{value}\"\n end", "def convert_message_line(line)\n line_array = line.split(' ')\n human_timestamp = Time.parse(line_array[0..2].join(' '))\n format(human_timestamp, line_array, 3)\nend", "def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end", "def time_transformer(time)\n if time < 10\n \"0\" + time.to_s\n else\n time.to_s\n end\nend", "def short_time\n \ttime.strftime \"%b %-d\"\n end", "def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend", "def format_datetime( datetime ) \n return nil if datetime.nil? \n \n a = datetime.in_time_zone(\"Jakarta\")\n day = a.day\n month = a.month\n year = a.year\n hour = a.hour\n minute = a.min\n second = a.sec \n \n if day.to_s.length == 1 \n day = \"0#{day}\"\n end\n \n if month.to_s.length == 1 \n month = \"0#{month}\"\n end\n \n if hour.to_s.length == 1\n hour = \"0#{hour}\"\n end\n \n if minute.to_s.length == 1 \n minute = \"0#{minute}\"\n end\n \n if second.to_s.length == 1 \n second = \"0#{second}\"\n end\n \n return \"#{day}/#{month}/#{year}\" + \" \" + \n \"#{hour}:#{minute}:#{second}\"\n end", "def normalize_time\n if time.present?\n Time::DATE_FORMATS[:ms] = \"%M:%S\"\n self.time = \"0:#{time.to_formatted_s(:ms)}\".to_time\n end\n end", "def get_timestamp\n \"[#{(Time.now.in_time_zone(TIME_ZONE_PACIFIC)).strftime('%m/%d/%y %l:%M%p')}]\"\nend", "def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend", "def literal_time(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end", "def to_s\n hours = @hours.to_s\n minutes = @minutes.to_s\n seconds = @seconds.to_s\n millis = @millis.to_s\n if @hours < 10\n hours = '0' + hours\n end\n if @minutes < 10\n minutes = '0' + minutes\n end\n if @seconds < 10\n seconds = '0' + seconds\n end\n if @millis < 10\n millis = '00' + millis\n else\n if @millis < 100\n millis = '0' + millis\n end\n end\n hours + ':' + minutes + ':' + seconds + ',' + millis\n end", "def date_format tim\n # tim.strftime '%Y/%m/%d %H:%M:%S'\n tim.strftime '%Y/%m/%d %H:%M'\nend", "def sbv_time(t)\r\n i = t.to_i\r\n \"%d:%02d:%02d.%03d\" % [i/3600, i/60%60, i%60, (t*1000).to_i%1000]\r\nend", "def formatwrittendate(unformattedtime)\n unformattedtime.strftime('%A, %d %B, %Y')\n end", "def time_string\n hours = @seconds / 3600\n minutes = (@seconds % 3600) / 60\n secs = (@seconds % 3600) % 60\n \n sprintf(\"%02d:%02d:%02d\", hours, minutes, secs)\n end" ]
[ "0.79133564", "0.78061295", "0.7656879", "0.75102085", "0.73122746", "0.72326493", "0.7106478", "0.7095668", "0.70630807", "0.70280087", "0.6971394", "0.6960248", "0.69185454", "0.684056", "0.68128824", "0.6770847", "0.6754066", "0.67479277", "0.66478497", "0.66321516", "0.6627606", "0.66268444", "0.6583473", "0.6580493", "0.6570039", "0.65667045", "0.6556086", "0.65282875", "0.6527153", "0.6501083", "0.6499118", "0.64889264", "0.6482636", "0.6480866", "0.64720106", "0.6458403", "0.64542246", "0.6450585", "0.64503026", "0.64476675", "0.64419526", "0.64361644", "0.64164925", "0.64082795", "0.64059985", "0.6404859", "0.63925415", "0.63925415", "0.63836914", "0.6378975", "0.6373413", "0.63601995", "0.63598055", "0.633613", "0.6330408", "0.6323869", "0.6314663", "0.63135505", "0.6313435", "0.6310896", "0.6295717", "0.6291818", "0.6272817", "0.62673366", "0.62664324", "0.626557", "0.62617004", "0.62567776", "0.6252574", "0.6245788", "0.624404", "0.62364006", "0.62359565", "0.62275964", "0.6227231", "0.6221761", "0.6219668", "0.62160814", "0.62144476", "0.61933994", "0.6165545", "0.61638683", "0.61630446", "0.61531705", "0.61485475", "0.61246794", "0.6113339", "0.61107206", "0.6109344", "0.61082315", "0.6106822", "0.6100359", "0.6097345", "0.60948795", "0.60935515", "0.6087051", "0.60792583", "0.60763854", "0.60691017", "0.6060531" ]
0.6505959
29
GET /advance_payments/1 GET /advance_payments/1.xml
def show @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @advance_payment = AdvancePayment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @advance_payment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @payments = Payment.top\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end", "def index\n @payments = Payment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end", "def show\n @payments_ach = PaymentsAch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payments_ach }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def index\n @payments_aches = PaymentsAch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments_aches }\n end\n end", "def paid\n @orders = Order.paginate(:page => params[:page], :conditions => [\"status = 'Paid'\"], :order => :expiration_date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @orders }\n end\n end", "def new\n @payments_ach = PaymentsAch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payments_ach }\n end\n end", "def show\n @pay_period = PayPeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pay_period }\n end\n end", "def show\n @shopping_payment = Shopping::Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shopping_payment }\n end\n end", "def show\n @payment_gateway = PaymentGateway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_gateway }\n end\n end", "def index\n @payment_informations = PaymentInformation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payment_informations }\n end\n end", "def index\n #@payments = Payment.all\n @payment = Payment.find(params[:id])\n end", "def show\n @payment_receipt = PaymentReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_receipt }\n end\n end", "def index\n @payment_receipts = PaymentReceipt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payment_receipts }\n end\n end", "def show\n @customer_payment = CustomerPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer_payment }\n end\n end", "def get_payment(payment_id, options = {})\n request_params = {}\n response_xml = http_get(client, \"#{@xero_url}/Payments/#{payment_id}\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/payments'})\n end", "def ws_url\n \"#{self.endpoint}/merchant/xmlpayment\"\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def show\n @payment_history = PaymentHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_history }\n end\n end", "def new\n @advance_payment = AdvancePayment.new\n\t#Get the org_code and org_location in people table based on user id.\n\t@session_id=session[:id]\n\t@session = Session.find(session[:id])\n\t@person = Person.find(@session.person_id)\n\t@admission=Admission.find(:all,:conditions => \"org_code='#{@person.org_code}' and admn_status='Admitted'\", :order =>\"id DESC\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advance_payment }\n end\n end", "def show\n @payment_option = PaymentOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_option }\n end\n end", "def show\n @payment_information = PaymentInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_information }\n end\n end", "def new\n @shopping_payment = Shopping::Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping_payment }\n end\n end", "def show\n @renewal = Renewal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @renewal }\n end\n end", "def show\n @pay_type = PayType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pay_type }\n end\n end", "def index\n @api_payments = Api::Payment.all\n end", "def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end", "def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @savings }\n end\n end", "def new\n @pay_period = PayPeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pay_period }\n end\n end", "def show\n @pay_typem = PayTypem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pay_typem }\n end\n end", "def show\n @merchant = Merchant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @merchant }\n end\n end", "def show\n @payable_action = PayableAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payable_action }\n end\n end", "def show\n @adjustment_account = AdjustmentAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adjustment_account }\n end\n end", "def show\n @adjustment_account = AdjustmentAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adjustment_account }\n end\n end", "def new\n @payment_gateway = PaymentGateway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_gateway }\n end\n end", "def show\n @amount = Amount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @amount }\n end\n end", "def show\n @advance = Advance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advance }\n end\n end", "def index\n @merchant ||= Merchant.find(params[:merchant_id])\n @loyalty_benefits = @merchant.loyalty_benefits.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @loyalty_benefits }\n end\n end", "def payment_get(path, query = {})\n add_auth_token(query)\n HTTParty.get(GAME_SERVER_CONFIG['payment_provider_base_url'] + path, :query => query, :headers => header)\n end", "def index\n @rent_payments = RentPayment.all\n end", "def index\n @rent_payments = RentPayment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @approvals = Approval.all.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @approvals }\n end\n end", "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end", "def index\n @help = \"Recurring Transaction List\"\n @recurrings = @account.recurrings\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recurrings }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n index\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "def new\n @payment_receipt = PaymentReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_receipt }\n end\n end", "def get_payment_detail(attributes = {})\n ::Nokogiri::XML::Builder.new(:encoding => \"utf-8\") do |xml|\n xml.send(\"soapenv:Envelope\", \"xmlns:soapenv\" => \"http://schemas.xmlsoap.org/soap/envelope/\", \"xmlns:v1\" => \"http://gpe.cz/pay/pay-ws/proc/v1\", \"xmlns:type\" => \"http://gpe.cz/pay/pay-ws/proc/v1/type\") {\n xml.send(\"soapenv:Header\")\n xml.send(\"soapenv:Body\") {\n xml.send(\"v1:getPaymentDetail\") {\n xml.send(\"v1:paymentDetailRequest\") {\n xml.send(\"type:messageId\", attributes[:message_id])\n xml.send(\"type:provider\", \"0100\")\n xml.send(\"type:merchantNumber\", attributes[:merchant_number])\n xml.send(\"type:paymentNumber\", attributes[:order_number])\n xml.send(\"type:signature\", attributes[:digest])\n }\n }\n }\n }\n end.to_xml\n end", "def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend", "def new\n @merchant = Merchant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @merchant }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n end", "def show\n @supplier_payment = SupplierPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier_payment }\n end\n end", "def get_payments(options = {})\n request_params = {}\n request_params[:PaymentID] = options[:payment_id] if options[:payment_id]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:order] = options[:order] if options[:order]\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Payments\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/payments'})\n end", "def new\n @approximate_service = ApproximateService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approximate_service }\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 index\n delocalize_dates([:created_at_greater_than_or_equal_to, :created_at_less_than_or_equal_to]) if params[:search]\n @payments = do_index(Payment, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end", "def show\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay }\n end\n end", "def show\n @warranty = Warranty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warranty }\n end\n end", "def destroy\n @advance_payment = AdvancePayment.find(params[:id])\n @advance_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(advance_payments_url) }\n format.xml { head :ok }\n end\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def pay\n #@CallerTokenId = params['CallerTokenId']\n #@RecipientTokenId = params['RecipientTokenId']\n #@SenderTokenId = params['SenderTokenId']\n #@Amount = params['Amount']\n\n call = { 'Action' => 'Pay',\n \t\t# tokens\n \t\t'CallerTokenId' => @CallerTokenId,\n \t\t'SenderTokenId' => @SenderTokenId,\n \t\t'RecipientTokenId' => @RecipientTokenId,\n\t\t\n \t\t# transactions details ### NOTE: Complex types are sent like this. #####\n \t\t'TransactionAmount.Amount' => @Amount, \n \t\t'TransactionAmount.CurrencyCode' => 'USD', \n \t\t'TransactionDate' => Time.now.gmtime.iso8601, # example result: 2007-05-10T13:08:02\n \t\t'ChargeFeeTo' => 'Recipient', #this must match the true/false value from the recipient token\n\t\t\n \t\t# references - unique transaction values\n \t\t'CallerReference' => 'Order-' + Time.now.to_i.to_s, # required unique value for each pay call\n \t\t'SenderReference' => 'Test Sender reference string', # optional unique reference for the sender\n \t\t'RecipientReference' => 'Test Recipient reference string' # optional unique reference for the recipient\n }\n # make the REST call \n\t\t@fps_response = AWS::FPS::Query.do(call)\n\t\trexml_doc = REXML::Document.new(@fps_response)\n\t\telements = rexml_doc.root.elements\n @xml_out = pretty_xml(rexml_doc)\n\t\t@status = elements[\"Status\"].text\n\t\t@request_id = elements[\"RequestId\"].text\n\t\t@success = false\n\t\tif @status == \"Success\"\n\t\t @success = true\n\t\t @TransactionId = elements[\"TransactionResponse\"].elements['TransactionId'].text\n\t\tend\n end", "def index\n @payment_requests = PaymentRequest.all\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment }\n end\n end", "def index\n\n @soaps = Soap.find(:all)\n @user = User.find(:first)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @purchase }\n end\n end", "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def index\n @customer = Customer.find(params[:cust_id])\n @payments = @customer.payments\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end", "def index\n @paytm_details = PaytmDetail.all\n end", "def show\n @betpayee = Betpayee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @betpayee }\n end\n end", "def show\n @admin_payment_method = Admin::AccountsPaymentMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_payment_method }\n end\n end", "def index\n @erip_transactions = EripTransaction.all.order(paid_at: :desc).paginate(page: params[:page], per_page: 30)\n end" ]
[ "0.66702145", "0.6517796", "0.64454174", "0.6330063", "0.632101", "0.632101", "0.62914217", "0.61728317", "0.61453664", "0.6119832", "0.60544133", "0.60145193", "0.6006985", "0.6003804", "0.59896874", "0.5969986", "0.5966092", "0.59079444", "0.5901139", "0.5896285", "0.58855397", "0.58846176", "0.58837414", "0.5869811", "0.5842027", "0.58414286", "0.58313984", "0.5830543", "0.58275807", "0.58185923", "0.5812672", "0.5804056", "0.58008605", "0.5791181", "0.57742476", "0.57742476", "0.5773038", "0.576617", "0.5763372", "0.5747987", "0.5743014", "0.57398957", "0.57398957", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57238066", "0.57226694", "0.57139456", "0.57138073", "0.57051367", "0.57032955", "0.56867427", "0.5683405", "0.56816", "0.566041", "0.56533575", "0.5621972", "0.5619724", "0.561347", "0.5612146", "0.5606642", "0.5606302", "0.56058776", "0.5605285", "0.5598271", "0.5598271", "0.5579602", "0.5579602", "0.5575307", "0.55737597", "0.5572936", "0.55658007", "0.5565729", "0.5565489", "0.55611295", "0.55611295", "0.55611295", "0.55611295", "0.55611295", "0.55611295", "0.55611295", "0.55611295", "0.5558684", "0.5555893", "0.55538684", "0.55492765" ]
0.61688644
8
GET /advance_payments/new GET /advance_payments/new.xml
def new @advance_payment = AdvancePayment.new #Get the org_code and org_location in people table based on user id. @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @admission=Admission.find(:all,:conditions => "org_code='#{@person.org_code}' and admn_status='Admitted'", :order =>"id DESC") respond_to do |format| format.html # new.html.erb format.xml { render :xml => @advance_payment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def new\n @pay_period = PayPeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pay_period }\n end\n end", "def new\n @pay_type = PayType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pay_type }\n end\n end", "def new\n @payments_ach = PaymentsAch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payments_ach }\n end\n end", "def new\n @payment_gateway = PaymentGateway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_gateway }\n end\n end", "def new\n @payable_action = PayableAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payable_action }\n end\n end", "def new\n @shopping_payment = Shopping::Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping_payment }\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 @payment_receipt = PaymentReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_receipt }\n end\n end", "def new\n @pay_typem = PayTypem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pay_typem }\n end\n end", "def new\n @payment_information = PaymentInformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_information }\n end\n end", "def new\n @amount = Amount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @amount }\n end\n end", "def new\n @payment_history = PaymentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_history }\n end\n end", "def new\n @payment_application = PaymentApplication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_application }\n end\n end", "def new\n @payment_option = PaymentOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_option }\n end\n end", "def new\n @pay = Pay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pay }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @merchant = Merchant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @merchant }\n end\n end", "def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "def new\n @proceeding = Proceeding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceeding }\n end\n end", "def new\n @provision = Provision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provision }\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 fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @payment }\n end\n end", "def new\n @advance = Advance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advance }\n end\n end", "def new\n @invest = Invest.new\n @invest.seq = get_next_seq(Invest)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invest }\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 @approximate_service = ApproximateService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approximate_service }\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 @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end", "def new\n @payment_form = PaymentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_form }\n end\n end", "def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end", "def new\n @help = \"New Recurring Transaction\"\n @recurring = @account.recurrings.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurring }\n end\n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approval }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposal }\n end\n end", "def new\n @pledge = Pledge.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pledge }\n end\n end", "def new\n @depositocaucion = Depositocaucion.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @depositocaucion }\n end\n end", "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def new\n @payable = Payable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payable }\n end\n end", "def new\n @prize = Prize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prize }\n end\n end", "def new\n @betpayee = Betpayee.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @betpayee }\n end\n end", "def new\n @account_transaction = AccountTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @payment = Payment.new\n prepFormVariables(@payment)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @currency = Currency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @currency }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n @receipt = Receipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receipt }\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n flash[:notice] = 'Payment was successfully created.'\n format.html { redirect_to(@payment) }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expense }\n end\n end", "def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to(@payment, :notice => 'Payment was successfully created.') }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @spend = Spend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spend }\n end\n end", "def new\n @admin_payment_method = Admin::AccountsPaymentMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_payment_method }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n \n @donation = Donation.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @donation }\n end\n end", "def new\n @az_balance_transaction = AzBalanceTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_balance_transaction }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @purchase_order = PurchaseOrder.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @purchase_order }\n end\n end", "def new\n @payment_plan = PaymentPlans.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_plan }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def new\n \t@account = Account.new\n\t@navkey = \"account_new\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\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 @periode = Periode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periode }\n end\n end", "def new\n @om_account = OmAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @om_account }\n end\n end", "def new\n @incentive = Incentive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incentive }\n end\n end", "def new\n @dbs_deposit = DbsDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end", "def new\n @settlement = @transaction.settlements.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @settlement }\n end\n end", "def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end", "def new\n @provincia = Provincia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provincia }\n end\n end", "def new\n @deposit_threshold = DepositThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def new\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lead }\n end\n end", "def new\n @round_expense = RoundExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @round_expense }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rate }\n end\n end", "def new\n @payment_received = PaymentReceived.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_received }\n end\n end", "def new\n @pricing_plan = PricingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pricing_plan }\n end\n end", "def new\n @paise = Paise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paise }\n end\n end", "def new\n @referral_charge = ReferralCharge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral_charge }\n end\n end", "def new\n @payment2 = Payment2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment2 }\n end\n end", "def new\n @fixed_expense = FixedExpense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_expense }\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 @order = Order.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promotion }\n end\n end", "def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promotion }\n end\n end" ]
[ "0.7532973", "0.72531605", "0.7230576", "0.7155683", "0.7142538", "0.71053815", "0.70748746", "0.70538926", "0.7030893", "0.7028818", "0.7026227", "0.7015864", "0.70145726", "0.7003628", "0.69574434", "0.6943745", "0.69333065", "0.69333065", "0.69333065", "0.6913001", "0.69086146", "0.68793213", "0.68679214", "0.6864947", "0.68580353", "0.6845476", "0.6834212", "0.6802011", "0.67880315", "0.6741477", "0.67244583", "0.67145705", "0.6711748", "0.6710001", "0.67066723", "0.67048526", "0.6704426", "0.66900134", "0.66900134", "0.6689545", "0.6684311", "0.6675572", "0.66746384", "0.66716504", "0.66693604", "0.6663852", "0.6660692", "0.66596377", "0.66596377", "0.665833", "0.66551656", "0.6653484", "0.6650049", "0.66471684", "0.66443574", "0.66443574", "0.66402894", "0.66325784", "0.66302437", "0.66281193", "0.6615066", "0.66137785", "0.6602608", "0.6599141", "0.65958947", "0.6588319", "0.6588319", "0.6588319", "0.658827", "0.6585936", "0.6578282", "0.6575219", "0.65739083", "0.65724534", "0.6568591", "0.6565857", "0.6561837", "0.65599203", "0.6559105", "0.6549188", "0.6547971", "0.65475893", "0.65475893", "0.65463674", "0.6545938", "0.6545938", "0.65455955", "0.65448135", "0.65442324", "0.6542858", "0.65415204", "0.65326107", "0.6531641", "0.6531206", "0.65280807", "0.6527801", "0.65250456", "0.6523284", "0.6521996", "0.6521996" ]
0.70472574
8
POST /advance_payments POST /advance_payments.xml
def create @advance_payment = AdvancePayment.new(params[:advance_payment]) @session_id=session[:id] @session = Session.find(session[:id]) @person = Person.find(@session.person_id) @advance_payment.already_paid_amount=@advance_payment.gross_amount.to_f+@advance_payment.already_paid_amount.to_f respond_to do |format| if @advance_payment.save # format.html { redirect_to(@advance_payment, :notice => 'advance payments was successfully created.') } format.html { redirect_to("/advance_payments/report_bill/#{@advance_payment.id}?print_type=original&format=pdf", :notice => 'AdvancePayment was successfully created.') } format.xml { render :xml => @advance_payment, :status => :created, :location => @advance_payment } else @adm=Admission.find_by_admn_no(@advance_payment.admn_no) if(@adm) @[email protected]_name @[email protected] @[email protected] @[email protected] @[email protected] end format.html { render :action => "new" } format.xml { render :xml => @advance_payment.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "def create\n @profile = current_user.profile\n @payment = Payment.new(payment_params)\n @payment.profile = current_user.profile\n if @payment.save\n uri = URI('http://acm.ut.ac.ir/epayment/payments')\n parameters = {\n 'merchant' => \"4452A141\",\n 'amount' => @payment.amount,\n 'redirect' => \"http://acm.ut.ac.ir/events/payments/approve\"}\n response = transact(uri, parameters)\n puts response.body\n @payment.response = response.body\n parsed_response = JSON.parse(response.body)\n if parsed_response[\"status\"] != 1\n redirect_to payments_path, notice: \"در ارتباط با بانک خطایی رخ داده‌است.\"\n return\n end\n @payment.reference_key = parsed_response[\"reference\"]\n if @payment.save\n redirect_to parsed_response[\"bank\"]\n return\n else\n render :new\n end\n else\n render :new\n end\n\n end", "def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n # @transaction = AuthorizeNet::AIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], :gateway=>:sandbox)\n # credit_card = AuthorizeNet::CreditCard.new('4111111111111111', '1120')\n # @response = @transaction.purchase('10.00', credit_card)\n\n # if @response.success?\n # puts \"Successfully made a purchase (authorization code: #{response.authorization_code})\"\n # else\n # raise \"Failed to make purchase.\"\n # end\n end", "def create_payment(payment)\n b = Builder::XmlMarkup.new\n\n request_xml = b.Payments do\n payment.to_xml(b)\n end\n\n response_xml = http_put(@client, \"#{xero_url}/Payments\", request_xml)\n parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/payments'})\n end", "def create\n #PaypalCallback object sends the raw post request to paypal and expects to get VERIFIED back\n response = PaypalCallback.new(params, request.raw_post, ENV[\"PAYPAL_POST_URL\"])\n\n #check that the payment says completed & paypal verifies post content\n if response.completed? && response.valid?\n @transaction = Transaction.find(params[:invoice]) #invoice is a pass through variable that gets embedded in the encrpyted paypal form and we get it back here\n Payment.create(:params => params.to_unsafe_h, :transaction_id => @transaction.id, :amount => params['payment_gross'], :confirmed => true)\n else\n #TODO maybe send out some type of alert to an admin\n end\n head :ok\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def pay\n #@CallerTokenId = params['CallerTokenId']\n #@RecipientTokenId = params['RecipientTokenId']\n #@SenderTokenId = params['SenderTokenId']\n #@Amount = params['Amount']\n\n call = { 'Action' => 'Pay',\n \t\t# tokens\n \t\t'CallerTokenId' => @CallerTokenId,\n \t\t'SenderTokenId' => @SenderTokenId,\n \t\t'RecipientTokenId' => @RecipientTokenId,\n\t\t\n \t\t# transactions details ### NOTE: Complex types are sent like this. #####\n \t\t'TransactionAmount.Amount' => @Amount, \n \t\t'TransactionAmount.CurrencyCode' => 'USD', \n \t\t'TransactionDate' => Time.now.gmtime.iso8601, # example result: 2007-05-10T13:08:02\n \t\t'ChargeFeeTo' => 'Recipient', #this must match the true/false value from the recipient token\n\t\t\n \t\t# references - unique transaction values\n \t\t'CallerReference' => 'Order-' + Time.now.to_i.to_s, # required unique value for each pay call\n \t\t'SenderReference' => 'Test Sender reference string', # optional unique reference for the sender\n \t\t'RecipientReference' => 'Test Recipient reference string' # optional unique reference for the recipient\n }\n # make the REST call \n\t\t@fps_response = AWS::FPS::Query.do(call)\n\t\trexml_doc = REXML::Document.new(@fps_response)\n\t\telements = rexml_doc.root.elements\n @xml_out = pretty_xml(rexml_doc)\n\t\t@status = elements[\"Status\"].text\n\t\t@request_id = elements[\"RequestId\"].text\n\t\t@success = false\n\t\tif @status == \"Success\"\n\t\t @success = true\n\t\t @TransactionId = elements[\"TransactionResponse\"].elements['TransactionId'].text\n\t\tend\n end", "def set_paid\n begin\n connection.post(element_path.gsub('?', '/paid?'))\n rescue => error\n Rails.logger.info \"\\e[31mException in Tocat. #{error.message}, #{error.backtrace.first}\\e[0m\"\n return false, error\n end\n return true, nil\n end", "def pay\n @bill = Bill.find_by(id: params[:bill_id].to_i, home_id: params[:home_id].to_i)\n @payment = Payment.new(description: @bill.name, amount: @bill.amount,\n recipient_paypal_email: @bill.user.paypal)\n @recipient = @payment.recipient_paypal_email\n @payment.sender_paypal_email = current_user.paypal\n @payment.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @amount = @payment.amount\n request = HTTParty.post(\"https://svcs.sandbox.paypal.com/AdaptivePayments/Pay\",\n headers: {\"X-PAYPAL-SECURITY-USERID\" => \"maria.cassino-facilitator_api1.gmail.com\",\n \"X-PAYPAL-SECURITY-PASSWORD\" => \"U9FL2MK962DKPXMR\",\n \"X-PAYPAL-SECURITY-SIGNATURE\" => \"AFcWxV21C7fd0v3bYYYRCpSSRl31A2tjSJXfuAz3het2TLAiz2uCt1eN\",\n \"X-PAYPAL-REQUEST-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-RESPONSE-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-APPLICATION-ID\" => \"APP-80W284485P519543T\"\n },\n body: {actionType: \"PAY\",\n currencyCode: \"USD\",\n receiverList: {\n receiver:[\n {amount: @amount,\n email: @recipient}\n ]\n },\n returnUrl: \"http://www.example.com/success.html\",\n cancelUrl: \"http://www.example.com/failure.html\",\n requestEnvelope:{\n errorLanguage: \"en_US\",\n detailLevel: \"ReturnAll\"\n }}.to_json\n )\n @payment.save\n @bill.paid_by = current_user.id\n @bill.paid = true\n @bill.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @bill.save\n render :payment\n end", "def create\n @payment = Payment.new(payment_params)\n @order = Order.find(params[:order_id])\n @payment.order_id = @order.id\n @payment.total = @order.total\n @payment.state = \"Completed\"\n @payment.token = \"tkn\" #ONLY DURING TESTS\n @payment.payment_method_id = params[:payment][:payment_method_id]\n @order.state = \"Completed\"\n @order.save\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: \"Payment was successfully created.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n #definitin de l'url de base\n base_payment_url = 'http://197.159.2.146:7086/sprintpayapi/payment/orangemoney/request'\n #definition des headers\n\n headers: {\n 'Postman-Token': '9669f6e7-402b-4dc9-a370-472194583c32',\n 'cache-control': 'no-cache',\n 'Authorization': 'SP:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n 'DateTime': 'YYYYYYYYYYYYYYYYYYYY',\n 'Content-Type': 'application/json'\n }\n\n #defintion du bodies/main content\n setBody: {\n \"amount\": 1,\n \"currency\": \"EUR\",\n \"firstName\": \"AMADOU\",\n \"lastName\": \"BAKARI\",\n \"address1\": \"Yaounde\",\n \"address2\": \"Nkolfoulou\",\n \"city\": \"Yaounde\",\n \"state\": \"Centre\",\n \"country\": \"FR\",\n \"postal\": \"0332\",\n \"mobileNumber\": \"237690000999\",\n \"emailId\": \"[email protected]\",\n \"spMerchandUrl\": \"http://sprint-pay.com/\"\n }\n\n #envoi du paiement\n response = httparty.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n\n self.class.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n #puts response\n\n end", "def payment_post(path, query = {})\n add_auth_token(query)\n HTTParty.post(GAME_SERVER_CONFIG['payment_provider_base_url'] + path, :body => query, :headers => header)\n end", "def pay!\n #soap_server = VendorPayment.generate_soap_server\n #token = VendorPayment.generate_usa_epay_security_token\n #custNum = observed.vendor_payment_period.store.id\n #paymentMethodID = nil\n #parameters = generate_transaction_request\n #response = soap_server.runCustomerTransaction(token, custNum, paymentMethodID, parameters)\n #\n if self.vendor_payment_period.store.usa_epay_customer_number.blank?\n self.errors['usa_epay_customer_number'] = \"The USA ePay custNum must be set before a payment can be made.\"\n return\n end\n gateway = VendorPayment.gateway\n payment_methods_response = gateway.get_customer_payment_methods(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number)\n monthly_transfer_method = nil\n items = if payment_methods_response.params['get_customer_payment_methods_return']\n payment_methods_response.params['get_customer_payment_methods_return']['item']\n else\n []\n end\n \n if items.is_a?(Hash)\n items = [items]\n end\n \n items.each do |payment_method|\n if payment_method['method_name'].strip == 'Monthly ACH Transfer'\n monthly_transfer_method = payment_method\n end\n end\n \n if monthly_transfer_method\n response = gateway.run_customer_transaction(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number,\n :command => 'CheckCredit',\n # USA ePay does pennies for the amount, so it needs to be\n # multiplied by 100\n :payment_method_id => monthly_transfer_method['method_id'],\n :amount => self.amount * 100)\n \n \n self.state = if response.message['result_code'].strip == 'A'\n VendorPayment.status_codes[response.message['status_code']]\n else\n VendorPayment.status_codes[\"E\"]\n end\n self.response_data = YAML::dump(response)\n if !response.message['ref_num'].blank?\n self.response_code = response.message['ref_num']\n save\n else\n save\n self.errors['transaction'] = \"State: #{self.state}. There was an error with code #{response.message['error_code']}, while trying to make the payment. Check USA ePay for reference number #{response.message['ref_num']} if necessary.\\n\\nFull Message: #{response.message.inspect}\"\n end\n self.vendor_payment_period.update_payment_total!\n self.vendor_payment_period.update_state!\n else\n self.errors['payment_method'] = \"There is no payment method on the vendor called 'Monthly ACH Transfer'\"\n end\n end", "def add_payment(xml, action, money, options)\n code = tanslate_payment_code(action)\n\n xml.Payment(:code => code) do\n xml.Presentation do\n xml.Amount amount(money)\n xml.Currency options[:currency] || currency(money)\n xml.Usage options[:description] || options[:order_id]\n end unless money.nil?\n end\n end", "def do_post_pre_auth_http(txn,merchant_id, merchant_key)\n # after a pre_auth you have to post the payment.\n sage_host = \"www.sagepayments.net\"\n sage_webservice_access_point = \"/cgi-bin/eftBankcard.dll?retail_transaction\"\n\n payload = {\n\n :M_id => merchant_id,\n :M_key => merchant_key,\n :T_amt => txn[:amount].to_i / 100.0 + txn[:tax].to_i / 100.0,\n :T_tax => txn[:tax].to_i / 100.0,\n :T_shipping => \"\",\n #:T_auth => txn[:auth_code],\n :T_reference => txn[:reference],\n :T_uti => txn[:ton],\n :T_device_id => @t_device_id,\n :T_application_id => @t_application_id,\n :T_code => '11'\n }\n resp = \"\"\n resp = do_webservice(sage_host, sage_webservice_access_point, payload)\n txn = create_credit_response_hash(resp)\n txn[:state] = case txn[:approval_indicator]\n when 'A' then :approved\n else :declined # TODO: Need some error checking here.\n end\n\n return txn\n end", "def create\n @payment = Payment.new(payment_params)\n @payment.order_id = params[:order_id]\n respond_to do |format|\n if @payment.save\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount, _links: { next: {profile: \"http://#{my_address}:3000/order\", href: \"http://#{my_address}:3000/orders/#{@payment.order_id}\", enctype: 'application/json'}}}\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: response_json, status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to(@payment, :notice => 'Payment was successfully created.') }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n flash[:notice] = 'Payment was successfully created.'\n format.html { redirect_to(@payment) }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def pay(payment)\n retval\n end", "def save_payments_data\n @parsed[\"payments\"].each do |i|\n pag = Payment.find_or_create_by(typ: i['payment_type'])\n pag.order_id = @order.id \n pag.typ = i['payment_type']\n pag.value = i['installment_amount']\n pag.save\n end\n end", "def make_preapproved_payments(preapproval_key)\n api.execute :Pay, payment_options(preapproval_key)\nend", "def create\n @payment = @contract.payments.new(payment_params)\n\n if @payment.save\n render :show, status: :created, location: url_for([@contract, @payment])\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def postTransactionComplete( transaction_id, paypal_doexpresscheckoutpayment, user_id, entity_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_doexpresscheckoutpayment'] = paypal_doexpresscheckoutpayment\n params['user_id'] = user_id\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/transaction/complete\",params)\n end", "def payment_params\n params.require(:payment).permit(:amount, :responseCode, :responseMessage)\n end", "def create\n payment.attributes = payment_params\n\n respond_to do |format|\n if payment.save\n format.html { redirect_to admin_payments_path, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: payment }\n else\n format.html { render :new }\n format.json { render json: payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n @group = Group.find(params[:group_id])\n @gexpense = Gexpense.find(params[:gexpense_id])\n @member_expense = MemberExpense.find(params[:id])\n\n @member_expense.update_attribute(:paid, true)\n \n redirect_to request.referer\n end", "def create\n\t\t# @payment = Payment.new({\n\t\t# :intent => \"sale\",\n\t\t# :payer => {\n\t\t# :payment_method => \"credit_card\",\n\t\t# :funding_instruments => [{\n\t\t# :credit_card => {\n\t\t# \t:type => params[:payment][:card_type], #\"visa\",\n\t\t# :number => params[:payment][:card_number], #\"4242424242424242\",\n\t\t# :expire_month => params[:payment][\"card_expires_on(2i)\"], #\"1\",\n\t\t# :expire_year => params[:payment][\"card_expires_on(1i)\"], #\"2018\",\n\t\t# :cvv2 => params[:payment][:cvv2], #\"874\",\n\t\t# :first_name => params[:payment][:first_name], #\"Joe\",\n\t\t# :last_name => params[:payment][:last_name], #\"Shopper\",\n\t\t# :billing_address => {\n\t\t# :line1 => params[:payment][:address], #\"52 N Main ST\",\n\t\t# :city => params[:payment][:city], #\"Johnstown\",\n\t\t# :state => params[:payment][:state], #\"OH\",\n\t\t# :postal_code => params[:payment][:postal_code], #\"43210\",\n\t\t# :country_code => params[:payment][:country_code] #\"US\" \n\t\t# }}}]},\n\t\t# :transactions => [{\n\t\t# :amount => {\n\t\t# :total => \"10.00\",\n\t\t# :currency => \"USD\" },\n\t\t# :description => \"This is the payment transaction description.\" }]})\n\n\t\t# @payment.create\n\t\t# if @payment.id.nil?\n\t\t# \terror = @payment.error\n\t\t# \tredirect_to payment_index_url, :alert => error.name+\"\\n\"+error.details.to_s\n\t\t# else\n\t\t# \tparams[:payment][:transaction_id] = @payment.id\n\t\t# \tparams[:payment][:amount] = 10\n\t\t# \t@data = current_user.build_payment(payment_params)\n\t\t# \tif @data.save\n\t\t# \t\tredirect_to payment_index_url, :notice => \"Payment Done with payment id #{@payment.id}\"\n\t\t# \telse\n\t\t# \t\tredirect_to payment_index_url, :alert => \"Something went wrong.\"\n\t\t# \tend\n\t\t# end\n\tend", "def pay_dp\n raise t('checkout.common.failed_msg') unless request.put?\n order = Order.not_checked_out.by_state(\"assigned\").by_user(@user).\n find(:first, :conditions => [ \"id = ?\", session[:order_id] ])\n if order.can_pay? and order.total > 0.0\n order.update_attributes( {:recipient => @user.full_description })\n order.reset_token!\n notifyURL=\"#{get_server_path}/ppservice/ipn\"\n options = { \"method\" => 'DoDirectPayment',\n \"ip_address\" => request.remote_ip,\n \"paymentaction\" => 'Sale',\n \"notifyurl\" => notifyURL,\n \"email\" => @user.email,\n \"firstname\" => @user.fullname,\n \"lastname\" => '(' + @user.email + ')',\n # \"cardowner\" => params[\"cardowner\"],\n \"creditcardtype\" => params[\"creditcardtype\"],\n \"acct\" => params[\"acct\"],\n \"expdate\" => params[\"date\"][\"month\"] + params[\"date\"][\"year\"],\n \"cvv2\" => params[\"cvv2\"] }\n options.merge!(order.basic_options)\n# options.merge!(order.ship_options)\n dump_options(options) if DEBUG\n order.payments.create({ \"token\" => \"#{order.token}\", \"state\" => \"pending\",\n \"method_type\" => \"Card\"})\n payment = order.current_payment\n payment.update_attributes({\"do_dp_request_params\" => options.merge({\"acct\"=>\"XXXXXX\",\n \"expdate\"=>\"XXXXXX\",\n \"cvv2\"=>\"XXXXXX\",\n \"creditcardtype\"=>\"XXXXXX\"\n })\n })\n @caller = PayPalSDK::Caller.new(false)\n @transaction = @caller.call( options )\n payment.update_attributes({\"do_dp_response_params\" => @transaction.response})\n dump_response(@transaction.response, \"DoDirectPayment\") if DEBUG\n if @transaction.success?\n session[:pp_errors] = nil\n puts \"+++++++++[\" + @transaction.response[\"AVSCODE\"].to_s + \"]++++++++++\" if DEBUG\n case @transaction.response[\"AVSCODE\"].to_s\n when 'X'\n order.transaction do\n # payment must be updated after order, otherwise payment params will be lost\n order.update_attributes( {:note => t('checkout.common.payment_accept_msg') })\n order.pay!\n order.ship!\n payment.update_attributes({\"txn_id\" => @transaction.response[\"TRANSACTIONID\"][0]})\n payment.accept!\n end\n flash[:notice] = t('checkout.common.payment_accept_msg')\n else\n order.transaction do\n order.update_attributes( {:note => t('checkout.common.payment_need_investigation_msg') })\n order.checkout!\n payment.accept!\n end\n raise t('checkout.common.payment_need_investigation_msg')\n end\n redirect_to order_path(order.order_num)\n else\n session[:pp_errors] = @transaction.response\n flash[:notice] = \"DoDirectPayment Failed: \" + session[:pp_errors][\"L_LONGMESSAGE0\"].to_s\n redirect_to payment_url\n end\n else\n raise t('checkout.common.failed_msg')\n end\n rescue Exception => e\n flash[:notice] = e\n redirect_to payment_url\n end", "def make_payment\n payment_id = params[:payment_id]\n user_id = params[:user_id]\n offer_id = params[:offer_id]\n response = Subscription.make_payment(payment_id, user_id, offer_id)\n render json: response\n end", "def create\n @rent_payment = RentPayment.new(rent_payment_params)\n\n respond_to do |format|\n if @rent_payment.save\n format.html { redirect_to @rent_payment, notice: 'Rent payment was successfully created.' }\n format.json { render :show, status: :created, location: @rent_payment }\n else\n format.html { render :new }\n format.json { render json: @rent_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment_increase = PaymentIncrease.new(payment_increase_params)\n\n respond_to do |format|\n if @payment_increase.save\n format.html { redirect_to @payment_increase, notice: 'Payment increase was successfully created.' }\n format.json { render :show, status: :created, location: @payment_increase }\n else\n format.html { render :new }\n format.json { render json: @payment_increase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @order = WebOrder.new(order_params)\n respond_to do |format|\n if @order.save\n @order.payments.create(total_paid: params[:initial], kind: :initial, date: @order.date) if params[:initial] && params[:initial].to_i != 0\n format.html { redirect_to order_path(@order.id), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { redirect_to new_order_path }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n unless self.payment_id\n payment = create_payment\n self.payment_id = payment.id\n self.status = 'paid'\n self.pay_date = Time.now\n self.save\n add_to_balance\n end\n end", "def create_payment(recipient_id, reference, amount)\n post_with_auth 'payment_initiation/payment/create',\n PaymentCreateResponse,\n recipient_id: recipient_id,\n reference: reference,\n amount: amount\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to([:admin,@payment], :notice => 'Payment was successfully created.') }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_payment(options={})\n create_request(\"nonpci\", ADD_PAYMENT_ACTION) do |xml|\n xml['px'].AddPayment do\n xml['px'].DigitalKey DirectDebit::Ezidebit::api_digital_key\n options.each { |key,value| xml['px'].send(key, value)}\n end\n end\n response = request_it!\n parse(response, \"add_payment_response\")\n end", "def create_checkout(redirect_uri)\n # calculate app_fee as 10% of produce price\n app_fee = self.donate_amount * 0.1\n params = {\n :account_id => self.wepay_account_id,\n :short_description => \"Donate from #{self.name}\",\n :type => 'donation',\n :currency => 'USD',\n :amount => self.donate_amount, \n :fee => { \n :app_fee => app_fee,\n :fee_payer => 'payee'\n },\n :hosted_checkout => {\n :mode => 'iframe',\n :redirect_uri => redirect_uri\n } \n \n }\n response = WEPAY.call('/checkout/create', self.wepay_access_token, params)\n puts response\n if !response\n raise \"Error - no response from WePay\"\n elsif response['error']\n raise \"Error - \" + response[\"error_description\"]\n end\n\n return response\nend", "def create\n Rails.logger.warn \"payment:\"\n Rails.logger.warn @payment.inspect\n respond_to do |format|\n if @payment.save\n format.html { redirect_to payments_url, :notice => 'Payment was successfully created.' }\n format.json { render :json => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def payment_params\n #params.require(:payment).permit(:amount, :profile_id, :reference_key, :status, :succeed_time)\n params.require(:payment).permit(:amount)\n end", "def make_payment! amount, due_at = Time.now\n rack_payment = Rack::Payment.instance.payment\n rack_payment.amount = amount\n rack_payment.credit_card = credit_card # use the encrypted credit card\n rack_payment.purchase :ip => '127.0.0.1'\n\n # TODO add amount_paid (?)\n completed = completed_payments.create :amount => amount, \n :due_at => due_at,\n :success => rack_payment.success?,\n :response => rack_payment.response\n completed\n end", "def payment_params\n params.require(:payment).permit(:amount, :currency, :ref_payment_id, :recipient_id, :status)\n end", "def payment_params\n params.require(:payment).permit(:doc_number, :description, :due_date, :payment_date, :installments, :value_doc, :supplier_id, :type_doc, :status, :form_payment, :categ_payment_id)\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n update_params = payment_params.merge(ref_payment_id: ref_payment_id, status: payment_status)\n @payment = Payment.new(update_params)\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n else\n flash.now[:alert] = \"Error transaction declined\"\n format.html { render :new }\n end\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def submit_details(details)\n response = adyen_client.checkout.payments_api.payments_details(details)\n puts response.to_json\n response\n end", "def new\n @advance_payment = AdvancePayment.new\n\t#Get the org_code and org_location in people table based on user id.\n\t@session_id=session[:id]\n\t@session = Session.find(session[:id])\n\t@person = Person.find(@session.person_id)\n\t@admission=Admission.find(:all,:conditions => \"org_code='#{@person.org_code}' and admn_status='Admitted'\", :order =>\"id DESC\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advance_payment }\n end\n end", "def create\n @debt_payment = DebtPayment.new(debt_payment_params)\n\n respond_to do |format|\n if @debt_payment.save\n format.html { redirect_to @debt_payment, notice: 'Debt payment was successfully created.' }\n format.json { render :show, status: :created, location: @debt_payment }\n else\n format.html { render :new }\n format.json { render json: @debt_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_payment(params)\n # Validation\n params = validate_input(params, @exception_array += %w[currency value])\n # The Request Body Parameters\n k2_request_pay_amount = {\n currency: params['currency'],\n value: params['value']\n }\n k2_request_pay_metadata = {\n customerId: 8_675_309,\n notes: 'Salary payment for May 2018'\n }\n create_payment_body = {\n destination: 'c7f300c0-f1ef-4151-9bbe-005005aa3747',\n amount: k2_request_pay_amount,\n metadata: k2_request_pay_metadata,\n callback_url: 'https://your-call-bak.yourapplication.com/payment_result'\n }\n create_payment_hash = K2Pay.make_hash('payments', 'POST', @access_token, 'PAY', create_payment_body)\n @threads << Thread.new do\n sleep 0.25\n @location_url = K2Connect.to_connect(create_payment_hash)\n end\n @threads.each(&:join)\n end", "def wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end", "def payment_params\n params.require(:payment).permit(:webtransaction, :amount, :subscription_id, :type_id, :user_id)\n end", "def add_payments\n @proposal.payments.each do |bank_account, amount|\n run_task \"add_payments_#{bank_account}\" do\n transfer = add_bank_transfer(@export.receivables_account, bank_account, amount)\n current_state[:transfer_id] = transfer['BankTransferID']\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n $payment = @payment\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: 'Pago realizado con exito.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def adyen_payment\n load_object\n opts = all_opts(@order,params[:payment_method_id], 'payment')\n opts.merge!(address_options(@order))\n gateway = adyen_gateway\n\n #if Spree::Config[:auto_capture]\n # response = gateway.setup_purchase(opts[:money], opts)\n #else\n # response = gateway.setup_authorization(opts[:money], opts)\n #end\n\n unless response.success?\n gateway_error(response)\n redirect_to edit_order_checkout_url(@order, :step => \"payment\")\n return\n end\n\n redirect_to (gateway.redirect_url_for response.token, :review => payment_method.preferred_review)\n rescue ActiveMerchant::ConnectionError => e\n gateway_error I18n.t(:unable_to_connect_to_gateway)\n redirect_to :back\n end", "def payment_params\n params.require(:payment).permit(:sum, :status)\n end", "def postTransactionInprogress( transaction_id, paypal_setexpresscheckout)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_setexpresscheckout'] = paypal_setexpresscheckout\n return doCurl(\"post\",\"/transaction/inprogress\",params)\n end", "def paid_params\n params.require(:paid).permit(:pay)\n end", "def payment_params\n params.require(:payment).permit(:mpesa_code, :user_id, :transacted, :timed_out)\n end", "def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment(method, data = {})\n call_endpoint(Endpoint::Payment, method, data)\n end", "def create\n unread\n\n @cart = current_cart\n if @cart.line_items.empty?\n redirect_to :controller=>'main', :action=>'index', :notice => \"Your cart is empty\"\n return\n end\n\n\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n\n @line_item = LineItem.find_by_cart_id(@cart)\n #getting branches\n supermarket = @line_item.product.seller.id\n @branches = Branch.find_all_by_seller_id(supermarket)\n\n # ******* sending request to PegPay server ******************\n # call the http post method\n @date = \"#{Time.now}\"\n url = URI.parse('https://41.190.131.222/pegpaytelecomsapi/PegPayTelecomsApi.asmx?WSDL')\n \n post_xml ='<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soap:Body>\n <PostTransaction xmlns=\"http://PegPayTelecomsApi/\">\n <trans>\n <DigitalSignature>'+ \"#{digital_signature}\" +'</DigitalSignature>\n <FromTelecom>'+ \"#{@order.pay_type}\" +'</FromTelecom>\n <ToTelecom>'+ \"#{@order.pay_type}\" +'</ToTelecom>\n <PaymentCode>1</PaymentCode>\n <VendorCode>MABIRA</VendorCode>\n <Password>81W30DI846</Password>\n <PaymentDate>'+ Date.today.strftime(\"%m/%d/%Y\") +'</PaymentDate>\n <Telecom></Telecom>\n <CustomerRef>'+\"#{@order.phone_no}\"+'</CustomerRef>\n <CustomerName>'+\"#{@order.name}\"+'</CustomerName>\n <TranAmount>'+\"#{@cart.total_price}\"+'</TranAmount>\n <TranCharge>0</TranCharge>\n <VendorTranId>1</VendorTranId>\n <ToAccount></ToAccount>\n <FromAccount>'+\"#{@order.phone_no}\"+'</FromAccount>\n <TranType>PULL</TranType>\n </trans>\n </PostTransaction>\n </soap:Body>\n </soap:Envelope>'\n\n peg_pay_status_code = make_http_request(url, post_xml)\n puts \"status code============================================\" \n puts peg_pay_status_code\n puts \"status code============================================\"\n # ******* end of sending request to yo! payments server ******************\n message=getTransactionStatus(peg_pay_status_code )\n message\n\n respond_to do |format|\n if peg_pay_status_code == 0\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n Notifier.order_received(@order).deliver\n flash[:notice] = 'Thank you for your order.' \n format.html { redirect_to(:controller=>'main', :action=>'index') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n else\n flash[:notice]= message\n\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_params\n params.require(:payment).permit(:user_transaction_id, :programmed_date, :done_date, :amount, :confirm_payer, :confirm_payee)\n end", "def create\n @payment_txn = PaymentTxn.new(payment_txn_params)\n\n respond_to do |format|\n if @payment_txn.save\n format.html { redirect_to edit_payment_txn_path(@payment_txn), notice: 'Payment txn was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment_txn }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment_txn.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @payments_ach = PaymentsAch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payments_ach }\n end\n end", "def post(path, type, options)\n response = HTTParty.post(\n root_url(type) + path,\n headers: {\n 'X-Api-Key' => api_key.to_s,\n 'Content-Type' => 'application/json'\n },\n body: options.to_json\n )\n\n return response unless response.code >= 500\n\n raise BadGatewayError.new(\n gateway: AccesstypeAdyen::PAYMENT_GATEWAY,\n path: path,\n response_code: response.code,\n response_body: response.parsed_response\n )\n end", "def create\n @invoice = Invoice.find(params[:invoice_id])\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if @invoice.payments << @payment\n total = @invoice.payments.sum(\"price\")\n if total == @invoice.total || total > @invoice.total\n res = total - @invoice.total if total > @invoice.total\n @invoice.member.update_attributes(payment_add: res)\n @invoice.update_attributes(status: 2)\n end\n format.html { redirect_to @invoice, notice: 'Payment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_first_payment\n make_payment\n end", "def create\n @video_adv = current_user.video_advs.create(video_adv_params)\n @video_adv.transactions.create(user_id: @video_adv.user_id, amount: params[:amount], currency: \"USD\", status: \"pending\")\n # base_url = (Rails.env == \"development\") ? 'http://localhost:3000' : 'http://www.etcty.com'\n\n # @response = EXPRESS_GATEWAY.setup_purchase((params[:amount].to_i*100),\n # return_url: base_url+complete_order_video_adv_path(@video_adv, locale: I18n.locale) ,\n # cancel_return_url: base_url,\n # currency: \"USD\"\n # )\n\n # redirect_to EXPRESS_GATEWAY.redirect_url_for(@response.token)\n\n redirect_to complete_order_video_adv_path(@video_adv, locale: I18n.locale)\n\n end", "def payments\n if params['form_payment']\n results = CsApi::Member.update(current_access_token, @current_user.username, params['form_payment'])\n #check for errors!!\n if results['success'].eql?('false')\n flash.now[:error] = results['message']\n else\n flash.now[:notice] = 'Your payment information has been updated.'\n get_account\n end\n end\n # set the member's id for docusign\n @memberId = @account['id']\n @payments = CsApi::Member.payments(current_access_token, @current_user.username)\n @payments.each do |record| \n if record['status'].eql?('Paid')\n @show_paid_section = true\n else \n @show_outstanding_section = true\n end\n end\n @page_title = 'Your Payments and Payment Info'\n respond_to do |format|\n format.html\n format.json { render :json => @payments }\n end\n end", "def postContractPaymentSuccess( contract_id, payment_date, amount, currency, response)\n params = Hash.new\n params['contract_id'] = contract_id\n params['payment_date'] = payment_date\n params['amount'] = amount\n params['currency'] = currency\n params['response'] = response\n return doCurl(\"post\",\"/contract/payment/success\",params)\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_params\n params.require(:payment).permit(:ref, :company_id, :user_id, :paymethod_id, :companyaccount_id, :price, :vat, :total, :date, :inc_type, :notes, :state)\n end", "def valitation\n # Create a payment and send ID\n end", "def create\n @payment = Payment.new(params.require(:payment).permit(:amount, :comment, :contract_id, :customer_id,\n :date_time, :finance_agreement_id, :invoice_id,\n :merchant_services_status, :payment_method_id, :status))\n ok = validatePayment?(@payment)\n\n respond_to do |format|\n if ok and @payment.save\n format.html { redirect_to payments_url,\n notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created,\n location: @payment }\n else\n prepFormVariables(@payment)\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, \n status: :unprocessable_entity }\n end\n end\n end", "def recieve_payment_params\n params.require(:recieve_payment).permit(:client_id, :invoice_id, :email, :payment_date, :payment_method, :reference_no, :amount_recieved, :deposited_to)\n end", "def payment_params\n params.require(:payment).permit(:address, :city, :state, :paid)\n end", "def payment_params\n params.require(:payment).permit(:amount, :refund_amount, :description, :method, :card_id, :scheduled_for)\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to payments_path, notice: 'Parcela criada.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay_on_demand(money, options = {})\n requires!(options, :order_id, :subscription_id)\n @raw_xml = build_request(build_pay_on_demand_request(money, options), options) \n commit(build_pay_on_demand_request(money, options), options)\n end", "def pay\n raise \"Only ajax request.\" if !request.xhr?\n begin\n @order = Order.find(params[:id])\n @order.status = 'Paid'\n if @order.save\n head :ok\n else\n head :unprocessable_entity\n end\n rescue\n head :unprocessable_entity\n end\n end", "def create\n @payments_ach = PaymentsAch.new(params[:payments_ach])\n\n respond_to do |format|\n if @payments_ach.save\n flash[:notice] = 'PaymentsAch was successfully created.'\n format.html { redirect_to(@payments_ach) }\n format.xml { render :xml => @payments_ach, :status => :created, :location => @payments_ach }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payments_ach.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n campaign_id = params[:campaign_id]\n credit_card_id = params[:credit_card_id]\n amount = params[:amount]\n\n #testing\n campaign = Campaign.find_by_id(campaign_id)\n user_id = campaign.user_id\n wepay_payment_type = \"credit_card\"\n if(amount>1)\n if(campaign!=nil)\n #create the payment object\n payment = Payment.new({\n campaign_id: campaign_id,\n payer_id: user_id,\n wepay_payment_id: credit_card_id,\n wepay_payment_type: wepay_payment_type,\n amount: amount\n })\n if !payment.valid?\n render json: error(payment.errors.full_messages)\n end\n if payment.valid? && payment.create_checkout && payment.save\n campaign.update_amount_donated\n render json: {\"checkout_id\" => payment[\"wepay_checkout_id\"]}\n else\n render json: payment_invalid_error\n end\n end\n end\n end", "def pay\n @cash_out = CashOut.find(params[:id])\n\n @transaction = Transaction.new\n @transaction.user = @cash_out.user\n @transaction.transaction_type = 'payment'\n @transaction.amount = @cash_out.amount * -1\n @transaction.attachable = @cash_out\n @transaction.transaction_at = Time.now\n\n if @transaction.save\n @cash_out.status = 'paid'\n @cash_out.paid_at = @transaction.transaction_at\n @cash_out.save\n\n flash[:notice] = \"Se ha realizado el pago\"\n redirect_to [:admin, @cash_out]\n else\n flash[:error] = \"No se pudo realizar el pago\"\n redirect_to [:admin, @cash_out]\n end\n end", "def paid\r\n #if @notification.acknowledge # check if it’s genuine Robokassa request\r\n #@user.approve! # project-specific code\r\n render :text => @notification.success_response\r\n @payment.approve!\r\n #else\r\n #head :bad_request\r\n #end\r\n end", "def create\n @api_payment = Api::Payment.new(api_payment_params)\n\n respond_to do |format|\n if @api_payment.save\n format.html { redirect_to @api_payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @api_payment }\n else\n format.html { render :new }\n format.json { render json: @api_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(attach_owner_user_id(payment_params))\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_params\n params.require(:payment).permit(:description, :payment_date, :payment_type_id)\n end", "def process_payment!\n @payment_type.pay\n end", "def postTransactionAuthorised( transaction_id, paypal_getexpresscheckoutdetails)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_getexpresscheckoutdetails'] = paypal_getexpresscheckoutdetails\n return doCurl(\"post\",\"/transaction/authorised\",params)\n end", "def make_payment(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/make_payment\", options).body)\n @attributes = response['items']\n true\n end", "def make_payment(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/make_payment\", options).body)\n @attributes = response['items']\n true\n end", "def payment_params\n params.require(:payment).permit(:numcard, :name_owner, :expiry_date, :code, :dues_number)\n end", "def postContractPaymentSetup( contract_id, payment_provider_id, payment_provider_profile, user_name, user_surname, user_billing_address, user_email_address)\n params = Hash.new\n params['contract_id'] = contract_id\n params['payment_provider_id'] = payment_provider_id\n params['payment_provider_profile'] = payment_provider_profile\n params['user_name'] = user_name\n params['user_surname'] = user_surname\n params['user_billing_address'] = user_billing_address\n params['user_email_address'] = user_email_address\n return doCurl(\"post\",\"/contract/payment/setup\",params)\n end" ]
[ "0.66339236", "0.6558264", "0.651462", "0.64256984", "0.6331028", "0.6290555", "0.6245464", "0.6245464", "0.6118071", "0.60402244", "0.60211474", "0.6014517", "0.6008838", "0.59904593", "0.5929309", "0.59058696", "0.5878829", "0.5877097", "0.5873628", "0.58607525", "0.58476055", "0.5836766", "0.5831895", "0.58143055", "0.5785762", "0.5783337", "0.57794553", "0.57652783", "0.5753843", "0.575323", "0.57474774", "0.5740512", "0.57365435", "0.5718025", "0.56949747", "0.5682936", "0.5679614", "0.56772166", "0.5675733", "0.5659655", "0.56541187", "0.5653789", "0.56527144", "0.5652427", "0.56473684", "0.5646327", "0.5627534", "0.5621597", "0.5616792", "0.56165606", "0.56014025", "0.55965996", "0.55963886", "0.5591215", "0.5581227", "0.55790555", "0.55742496", "0.5572552", "0.55722356", "0.55687904", "0.5568456", "0.55651355", "0.55651355", "0.55651355", "0.55651355", "0.5564779", "0.5558267", "0.5546533", "0.5544441", "0.5539024", "0.5537644", "0.55368906", "0.55368656", "0.55340636", "0.55283815", "0.5527562", "0.55263555", "0.55263555", "0.55248785", "0.55207354", "0.551185", "0.5506709", "0.5505564", "0.5500723", "0.5493783", "0.5490735", "0.5487138", "0.5487091", "0.5481799", "0.5480615", "0.54786485", "0.54772764", "0.5475437", "0.5474321", "0.54719156", "0.5470155", "0.5459917", "0.5459917", "0.54583395", "0.5453106" ]
0.56741595
39
PUT /advance_payments/1 PUT /advance_payments/1.xml
def update @advance_payment = AdvancePayment.find(params[:id]) respond_to do |format| if @advance_payment.update_attributes(params[:advance_payment]) format.html { redirect_to("/advance_payments/report_bill/#{@advance_payment.id}?print_type=original&format=pdf", :notice => 'Admission was successfully updated.') } #format.html { redirect_to("/advance_payments/?user_id=#{params[:user_id]}", :notice => 'AdvancePayment was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @advance_payment.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n flash[:notice] = 'Payment was successfully updated.'\n format.html { redirect_to(@payment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to(@payment, :notice => 'Payment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment.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 @payment = Payment.find(params[:id])\n @payment.delayed = params[:delayed]\n @payment.repayment = params[:repayment]\n @payment.paid = true\n @payment.save\n\n redirect_to company_root_path\n end", "def update\n respond_to do |format|\n if @payment_increase.update(payment_increase_params)\n format.html { redirect_to @payment_increase, notice: 'Payment increase was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_increase }\n else\n format.html { render :edit }\n format.json { render json: @payment_increase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n mollie_payment_method = PaymentMethod.where(type: \"Spree::PaymentMethod::MolliePayment\").first\n return unless mollie_payment_method\n\n if mollie_payment_method && params['id']\n begin\n mollie = Mollie::Client.new(mollie_payment_method.preferred_api_key)\n mollie_payment = Mollie::Payment.get(params['id'])\n\n if mollie_payment\n # retrieve order via metadata mollie payment\n order = Order.find_by(number: mollie_payment.metadata.order)\n if order\n # retrieve pending payment for the order\n payment = order.payments.valid.where(payment_method_id: mollie_payment_method.id).first\n process_payment_for_order(payment, mollie_payment, order) if payment && order\n else\n logger.error \"Order with reference #{mollie_payment.metadata.order} not found. Payment update not possible.\"\n end\n end\n rescue Mollie::Exception => e\n Rails.logger.warn \"Mollie API call failed: #{e.message}\"\n end\n end\n render plain: 'ok'\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to([:admin,@payment], :notice => 'Payment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @payment.update(payment_params)\n render :show, status: :ok, location: contract_payment_path(@payment)\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment].has_key?(a)\n params[:payment][a].gsub!(/[$,]/, \"\")\n params[:payment][a] = (params[:payment][a].to_f * 100).to_i\n end\n\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to :payments, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n @editable = true\n format.html { render :show }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @chain, notice: 'Chain AND PAYMENT was successfully updated.' }\n format.json { render :show, status: :ok, location: @chain }\n else\n format.html { render :edit }\n format.json { render json: @chain.errors, status: :unprocessable_entity }\n end\n end\n # @payment.save\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @next_route, notice: \"Le payment a bien été mis à jour.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n if @pay.update_attributes(params[:pay])\n format.html { redirect_to @pay, notice: 'Pay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @advance_payment = AdvancePayment.find(params[:id])\n @advance_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(advance_payments_url) }\n format.xml { head :ok }\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.timestamp = Time.now\n @invoice.update_totals\n\n\n# #if the invoice is paid, let's add them to the email marketing list\n# if @invoice.paid = true then\n# @cust = Customer.find_by_id(@invoice.customer_id)\n# url = \"http://allinnetworks.com/index.php?option=com_acymailing&gtask=sub&task=optin&hiddenlists=1,8&user[email]=\" + @cust.email + \"&user[name]=\" + @cust.firstname + \" \" + @cust.lastname\n# @doc = Nokogiri::XML(open(url))\n# end\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_payment_increase\n @payment_increase = PaymentIncrease.find(params[:id])\n end", "def update\n @advancement = Advancement.find(params[:id])\n\n respond_to do |format|\n if @advancement.update_attributes(params[:advancement])\n format.html { redirect_to @advancement, notice: 'Advancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_payment_method = Admin::AccountsPaymentMethod.find(params[:id])\n\n respond_to do |format|\n if @admin_payment_method.update_attributes(params[:admin_accounts_payment_method])\n format.html { redirect_to admin_accounts_payment_methods_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n respond_to do |format|\n @payment.assign_attributes(params.require(:payment).permit(:amount, :comment, :contract_id, :customer_id,\n :date_time, :finance_agreement_id, :invoice_id,\n :merchant_services_status, :payment_method_id, :status))\n parok = validatePayment?(@payment)\n saveok = false\n if parok\n saveok = @payment.save\n end\n if parok and saveok\n format.html { redirect_to payments_url,\n notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables(@payment)\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @shopping_payment = Shopping::Payment.find(params[:id])\n\n respond_to do |format|\n if @shopping_payment.update_attributes(params[:shopping_payment])\n format.html { redirect_to(@shopping_payment, :notice => 'Payment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shopping_payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to payments_url, :notice => 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n#TODO\n if !current_user.has_role?(:admin)\n redirect_to events_path\n return\n end\n\n respond_to do |format|\n if @payment.update(manual_payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n @group = Group.find(params[:group_id])\n @gexpense = Gexpense.find(params[:gexpense_id])\n @member_expense = MemberExpense.find(params[:id])\n\n @member_expense.update_attribute(:paid, true)\n \n redirect_to request.referer\n end", "def update\n respond_to do |format|\n if @payment_txn.update(payment_txn_params)\n format.html { redirect_to @payment_txn, notice: 'Payment txn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment_txn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer_payment = CustomerPayment.find(params[:id])\n\n respond_to do |format|\n if @customer_payment.update_attributes(params[:customer_payment])\n format.html { redirect_to(@customer_payment, :notice => 'Customer payment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer_payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to(@payment, :notice => 'Payment was successfully updated.') }\n format.xml { head :ok }\n format.js {render :layout => false}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end", "def set_paid\n begin\n connection.post(element_path.gsub('?', '/paid?'))\n rescue => error\n Rails.logger.info \"\\e[31mException in Tocat. #{error.message}, #{error.backtrace.first}\\e[0m\"\n return false, error\n end\n return true, nil\n end", "def update\n @amount = Amount.find(params[:id])\n\n respond_to do |format|\n if @amount.update_attributes(params[:amount])\n format.html { redirect_to(@amount, :notice => 'Amount was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @amount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paid.update(paid_params)\n format.html { redirect_to @paid, notice: 'Paid was successfully updated.' }\n format.json { render :show, status: :ok, location: @paid }\n else\n format.html { render :edit }\n format.json { render json: @paid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n if @approximate_service.update_attributes(params[:approximate_service])\n format.html { redirect_to(@approximate_service, :notice => 'ApproximateService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @approximate_service.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_payment.update(api_payment_params)\n format.html { redirect_to @api_payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_payment }\n else\n format.html { render :edit }\n format.json { render json: @api_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # TODO fix until strong params\n params[:merchant].delete :approved\n\n if @merchant.update(params[:merchant])\n head :no_content\n else\n render json: @merchant.errors, status: :unprocessable_entity\n end\n end", "def update\n @payments_ach = PaymentsAch.find(params[:id])\n\n respond_to do |format|\n if @payments_ach.update_attributes(params[:payments_ach])\n flash[:notice] = 'PaymentsAch was successfully updated.'\n format.html { redirect_to(@payments_ach) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payments_ach.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_complete_mile_payment(body)\r\n # Prepare query url.\r\n _path_url = '/v2/ecommerce/payments'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.put(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end", "def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @payment.update(payment_params)\n render :show, status: :ok, location: @payment\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def update\n @payment_receipt = PaymentReceipt.find(params[:id])\n\n respond_to do |format|\n if @payment_receipt.update_attributes(params[:payment_receipt])\n flash[:notice] = 'PaymentReceipt was successfully updated.'\n format.html { redirect_to(@payment_receipt) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment_receipt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment2 = Payment2.find(params[:id])\n\n respond_to do |format|\n if @payment2.update_attributes(params[:payment2])\n format.html { redirect_to @payment2, notice: 'Payment2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @advance = Advance.find(params[:id])\n\n respond_to do |format|\n if @advance.update_attributes(params[:advance])\n format.html { \n unless params[:employee_page].nil?\n redirect_to employee_path(@advance.user.employee), notice: 'Advance was successfully updated.' \n else\n redirect_to advances_url, notice: 'Advance was successfully updated.' \n end\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", employee_page: params[:employee_page] }\n format.json { render json: @advance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment_option = PaymentOption.find(params[:id])\n\n respond_to do |format|\n if @payment_option.update_attributes(params[:payment_option])\n format.html { redirect_to([:admin, @payment_option], :notice => 'PaymentOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @partner_payment.update(partner_payment_params)\n format.html { redirect_to partner_path(@partner_payment.partner), notice: 'Partner payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @partner_payment }\n else\n format.html { render :edit }\n format.json { render json: @partner_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #puts \"params coming to update are:\"\n #puts params.to_s\n check_for_update(@auth_shopping_payment)\n \n @auth_shopping_payment.assign_attributes(@auth_shopping_payment_params)\n \n @auth_shopping_payment = add_owner_and_signed_in_resource(@auth_shopping_payment)\n \n ##note that params and not permitted_params is called, here because the gateway sends back all the params as a naked hash, and that is used directly to verify the authenticity, in the gateway functions.\n #puts \"these are the attributes assigned in the update action.\"\n #puts @auth_shopping_payment.attributes.to_s\n @auth_shopping_payment.payment_params = params\n #puts \"assigned params.\"\n save_response = @auth_shopping_payment.save\n \n ## if save successfull then otherwise, respond_with edit.\n respond_with @auth_shopping_payment, location: (save_response == true ? payment_path(@auth_shopping_payment) : edit_payment_path(@auth_shopping_payment))\n \n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pay_type = PayType.find(params[:id])\n\n respond_to do |format|\n if @pay_type.update_attributes(params[:pay_type])\n format.html { redirect_to(@pay_type, :notice => 'Pay type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pay_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def pay\n raise \"Only ajax request.\" if !request.xhr?\n begin\n @order = Order.find(params[:id])\n @order.status = 'Paid'\n if @order.save\n head :ok\n else\n head :unprocessable_entity\n end\n rescue\n head :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n store_trip_in_session(@payment.trip_id)\n\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoice_header = InvoiceHeader.find(params[:invoice_header_id])\n @payment = @invoice_header.payments.find(params[:id])\n\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n format.html { redirect_to invoice_payments_path(params[:invoice_header_id]), :notice => 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payable_billing = PayableBilling.find(params[:id])\n\n respond_to do |format|\n if @payable_billing.update_attributes(params[:payable_billing])\n flash[:notice] = 'Pagamento atualizado.'\n format.html { redirect_to(@payable_billing) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @payment_gateway = PaymentGateway.find(params[:id])\n\n respond_to do |format|\n if @payment_gateway.update_attributes(params[:payment_gateway])\n format.html { redirect_to([:admin, @payment_gateway], :notice => 'Payment gateway was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment_gateway.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pay.update(pay_params)\n format.html { redirect_to @pay, notice: 'Pay was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay }\n else\n format.html { render :edit }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to payments_path, notice: 'Parcela atualizada.' }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supplier_payment = SupplierPayment.find(params[:id])\n\n respond_to do |format|\n if @supplier_payment.update_attributes(params[:supplier_payment])\n format.html { redirect_to(@supplier_payment, :notice => 'Supplier Payment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supplier_payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n update_helper(@pay_period, 'Pay period', pay_period_params)\n end", "def update\n respond_to do |format|\n if @rent_payment.update(rent_payment_params)\n format.html { redirect_to @rent_payment, notice: 'Rent payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent_payment }\n else\n format.html { render :edit }\n format.json { render json: @rent_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay!\n update_attributes paid: true, paid_at: DateTime.now\n end", "def update\n respond_to do |format|\n if @income_payment.update(income_payment_params)\n format.html { redirect_to income_income_payments_path(@income), notice: 'Income payment was successfully updated.' }\n format.json { render :show, status: :ok, location: @income_payment }\n else\n format.html { render :edit }\n format.json { render json: @income_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_advance_fee_wallet\n if self.wallet_amount_applied == true\n AdvanceFeeDeduction.destroy_deduction_record(self.id)\n advance_fee_wallet = self.payee.advance_fee_wallet\n advance_fee_wallet.amount = advance_fee_wallet.amount.to_f + self.wallet_amount.to_f\n advance_fee_wallet.save\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.update_attributes(params[:invoice])\n @[email protected]_sum\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(@invoice, :notice => 'Facture modifiée avec succes.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def update\n @pay_typem = PayTypem.find(params[:id])\n\n respond_to do |format|\n if @pay_typem.update_attributes(params[:pay_typem])\n format.html { redirect_to(@pay_typem, :notice => 'PayTypem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pay_typem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sale_payment.update(sale_payment_params)\n format.html { redirect_to @sale_payment, notice: 'Sale payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment = Payment.find(params[:id])\n if @payment.update_attributes(payment_params)\n redirect_to user_payment_url(@user, @payment)\n else\n render :action => 'edit'\n end\n end", "def update\n respond_to do |format|\n if @additional_payment.update(additional_payment_params)\n format.html do\n redirect_to [@event, @user_event, @additional_payment], notice: 'Additional payment was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @additional_payment }\n else\n format.html { render :edit }\n format.json { render json: @additional_payment.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\n debt = Debt.find_by_id(params[:id])\n payment = BigDecimal( debt_params[:amount] )\n\n # Since the debted user is paying the indebted user,\n # we can simulate this as the indebted user \"owing\"\n # the debted user (a.k.a. the debt owner) the payed off\n # debt.\n Debt.settleDebt(debt.owner, debt.indebted, payment)\n flash[:success] = \"Debt has been paid successfully.\"\n redirect_to root_url\n end", "def update\n respond_to do |format|\n if @pay_method.update(pay_method_params)\n format.html { redirect_to @pay_method, notice: 'Pay method was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_method }\n else\n format.html { render :edit }\n format.json { render json: @pay_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "def update\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n\n respond_to do |format|\n if @transaction_goods_taxis.update_attributes(params[:transaction_goods_taxis])\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @payments = args[:payments] if args.key?(:payments)\n end", "def create_payment(payment)\n b = Builder::XmlMarkup.new\n\n request_xml = b.Payments do\n payment.to_xml(b)\n end\n\n response_xml = http_put(@client, \"#{xero_url}/Payments\", request_xml)\n parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/payments'})\n end", "def update\n @cash_invoice.update cash_invoice_params\n render 'action'\n end", "def set_payment\n @payment = @contract.payments.find(params[:id])\n end", "def pay\n unless self.payment_id\n payment = create_payment\n self.payment_id = payment.id\n self.status = 'paid'\n self.pay_date = Time.now\n self.save\n add_to_balance\n end\n end" ]
[ "0.6003731", "0.598196", "0.597565", "0.59570825", "0.5932758", "0.59015083", "0.5900349", "0.5873205", "0.58310246", "0.5761606", "0.5753884", "0.5748019", "0.57391423", "0.5705008", "0.5691757", "0.56869256", "0.5683306", "0.5683306", "0.5683306", "0.5683306", "0.5683306", "0.5683306", "0.5667591", "0.56646925", "0.56628", "0.56617475", "0.5658048", "0.5650087", "0.5645509", "0.5637128", "0.56335133", "0.5614678", "0.5611636", "0.5597291", "0.5593902", "0.5579422", "0.557879", "0.55764234", "0.5573971", "0.5570665", "0.55682135", "0.5564552", "0.55489475", "0.55476826", "0.55408686", "0.5532314", "0.55303335", "0.5521753", "0.5515704", "0.55152345", "0.55148065", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.5514712", "0.55090094", "0.55082", "0.54992723", "0.549828", "0.5491975", "0.5483543", "0.54814196", "0.5478913", "0.54748833", "0.54748833", "0.54748833", "0.54748833", "0.54748833", "0.54748833", "0.54517066", "0.54514563", "0.5451245", "0.5443279", "0.54361194", "0.5428174", "0.5426161", "0.5421454", "0.5414104", "0.5403669", "0.53974396", "0.5395274", "0.53917503", "0.53858125", "0.53855616", "0.53847784", "0.5382384", "0.53800464", "0.5378184", "0.53756577", "0.5374004", "0.5366363", "0.5363268" ]
0.61908144
0
DELETE /advance_payments/1 DELETE /advance_payments/1.xml
def destroy @advance_payment = AdvancePayment.find(params[:id]) @advance_payment.destroy respond_to do |format| format.html { redirect_to(advance_payments_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n response = WebPay.client.delete(path)\n response['deleted']\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 @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_payments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(payments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(payments_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @payments_ach = PaymentsAch.find(params[:id])\n @payments_ach.destroy\n\n respond_to do |format|\n format.html { redirect_to(payments_aches_url) }\n format.xml { head :ok }\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 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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @appointment_payment = AppointmentPayment.find(params[:id])\n @appointment_payment.destroy\n\t#appointment_payments_url\n respond_to do |format|\n format.html { redirect_to(\"/appointment_payments/appt_cancel/1\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_gateway = PaymentGateway.find(params[:id])\n @payment_gateway.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_payment_gateways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_receipt = PaymentReceipt.find(params[:id])\n @payment_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_receipts_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @payment_txn.destroy\n respond_to do |format|\n format.html { redirect_to payment_txns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment.destroy\n end", "def destroy\n @payment.destroy\n end", "def destroy\n @merchant.destroy\n head :no_content\n end", "def destroy\n @amount = Amount.find(params[:id])\n @amount.destroy\n\n respond_to do |format|\n format.html { redirect_to(amounts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @approximate_service = ApproximateService.find(params[:id])\n @approximate_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(approximate_services_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_option = PaymentOption.find(params[:id])\n @payment_option.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @payment_option]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pay_period = PayPeriod.find(params[:id])\n @pay_period.destroy\n\n respond_to do |format|\n format.html { redirect_to(pay_periods_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjustment_account = AdjustmentAccount.find(params[:id])\n @adjustment_account.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjustment_accounts_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pay = Pay.find(params[:id])\n @pay.destroy\n\n respond_to do |format|\n format.html { redirect_to pays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payable_action = PayableAction.find(params[:id])\n @payable_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_actions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shopping_payment = Shopping::Payment.find(params[:id])\n @shopping_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to(shopping_payments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\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 @pay_type = PayType.find(params[:id])\n @pay_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(pay_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @renewal = Renewal.find(params[:id])\n @renewal.destroy\n\n respond_to do |format|\n format.html { redirect_to(renewals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n @transaction_goods_taxis.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_goods_taxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reconciliation_detail = AccountingReconciliationDetail.find(params[:id])\n @reconciliation_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_reconciliation_details_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\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 destroy\n @merchant = Merchant.find(params[:id])\n @merchant.destroy\n\n respond_to do |format|\n format.html { redirect_to(merchants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recurring.destroy\n respond_to do |format|\n format.html { redirect_to(account_recurrings_path(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityPayment_type( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/payment_type\",params)\n end", "def destroy\n @fixed_deposit = FixedDeposit.find(params[:id])\n @fixed_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_deposits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pay_typem = PayTypem.find(params[:id])\n @pay_typem.destroy\n\n respond_to do |format|\n format.html { redirect_to(pay_typems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end", "def destroy\n @consultationcharge = Consultationcharge.find(params[:id])\n @consultationcharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultationcharges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @promotion = Promotion.find(params[:id])\n\n BusinessPayment.find(:all, :conditions => {:promotion_id => @promotion.id}).each do |bp|\n bp.destroy\n end\n \n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_promotions_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @warranty = Warranty.find(params[:id])\n @warranty.destroy\n\n respond_to do |format|\n format.html { redirect_to(warranties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\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 delete_payment\n @payment = PaymentFromDestination.find(params[:id])\n @payment.delete\n \n render :nothing => true\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_payment_method = Admin::AccountsPaymentMethod.find(params[:id])\n @admin_payment_method.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_accounts_payment_methods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(receipts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_rates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pharmacy_payment_child = PharmacyPaymentChild.find(params[:id])\n @pharmacy_payment_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_payment_children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_information = PaymentInformation.find(params[:id])\n @payment_information.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_informations_url) }\n format.xml { head :ok }\n end\n end", "def delete\n authorize!(:delete,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @invoice = Invoice.find(params[:id])\n if @invoice.payments.empty?\n InvoiceDetail.delete_all(:invoice_id=>params[:id])\n @invoice.delete\n flash[:notice] = \"#{t(:text_invoices)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n else\n flash[:error] = t(:flash_invoice_cannot_deleted)\n end\n respond_to do |format|\n format.html { redirect_to :action=>'index'}\n format.xml { head :ok }\n end\n end", "def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payable_billing = PayableBilling.find(params[:id])\n @payable_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_billings_url) }\n format.xml { head :ok }\n end\n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end", "def destroy\n @invoice_header = InvoiceHeader.find(params[:invoice_header_id])\n @payment = @invoice_header.payments.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\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 @atmdebitcardapp = Atmdebitcardapp.find(params[:id])\n @atmdebitcardapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(atmdebitcardapps_url) }\n format.xml { head :ok }\n end\n end", "def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end", "def destroy\n @az_balance_transaction = AzBalanceTransaction.find(params[:id])\n @az_balance_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_balance_transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n\t\t@merchant = Merchant.find(params[:id])\n\t\[email protected]\n\n\t\t# should add a flash notification to confirm deletion\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to '/admin_dashboard/main' }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n @advertise = Advertise.find(params[:id])\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to(advertises_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @settlement = @transaction.settlements.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_settlements_url(@client, @transaction)) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_increase.destroy\n respond_to do |format|\n format.html { redirect_to payment_increases_url, notice: 'Payment increase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @certificado = Certificado.find(params[:id])\n @certificado.destroy\n\n respond_to do |format|\n format.html { redirect_to(certificados_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_plan = PaymentPlans.find(params[:id])\n @payment_plans.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_plans_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def delete\n request(:delete)\n end", "def destroy\n @derivative = Derivative.find(params[:id])\n @derivative.destroy\n\n respond_to do |format|\n format.html { redirect_to(derivatives_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to(exps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @balance = Balance.find(params[:id])\n @balance.destroy\n\n respond_to do |format|\n format.html { redirect_to(balances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @retailorderdetail = Retailorderdetail.find(params[:id])\n @retailorderdetail.destroy\n\n respond_to do |format|\n format.html { redirect_to(retailorderdetails_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.70188254", "0.6736302", "0.6713614", "0.66653407", "0.66653407", "0.66278976", "0.6594388", "0.65304625", "0.64880747", "0.64765745", "0.6463586", "0.64344573", "0.6434148", "0.6396757", "0.634541", "0.6327807", "0.6327807", "0.6307478", "0.630463", "0.6293965", "0.62890446", "0.6237151", "0.6236408", "0.6233555", "0.6229473", "0.6227462", "0.6225628", "0.6219067", "0.6206506", "0.6206187", "0.6203989", "0.62015325", "0.6198467", "0.61920965", "0.6190746", "0.61765385", "0.6175949", "0.61690766", "0.6162921", "0.61521137", "0.6146982", "0.6141124", "0.6137362", "0.61332965", "0.61315864", "0.6124499", "0.61226875", "0.6117819", "0.6114286", "0.6114286", "0.6114286", "0.6114286", "0.6114286", "0.6101699", "0.6095829", "0.6092615", "0.60897267", "0.608039", "0.608039", "0.6078669", "0.6076103", "0.6074024", "0.60732365", "0.6070598", "0.6067996", "0.6065056", "0.6060449", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60602355", "0.60582", "0.60582", "0.60582", "0.60582", "0.60581654", "0.6057617", "0.6048908", "0.60460997", "0.60458755", "0.6044687", "0.60407066", "0.6040685", "0.60402185", "0.60380334", "0.60377574", "0.6034489", "0.60287577", "0.6027278", "0.60260683", "0.60202163", "0.60189223", "0.60166806", "0.6012448", "0.6010038" ]
0.7350184
0
helpers for number of tiles per level
def very_easy_level_maker(game) level = Level.find_or_create_by(difficulty: "very easy") game.level = level level.games << game game.save! level.tiles.delete_all # binding.pry 4.times do |i| level.tiles << Tile.new(game_id: game.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend", "def measure map, x, y \n if map[x][y] != 'land' || x >= 6 || y >= 6 #Ensures water, counted land, and coordinates\n return 0 #off the grid aren't counted.\n end\n \n size = 1\n map[x][y] = 'counted land' #Marks the starting tile as something bedsides Land. Every tile surrounding the starting tile becomes the \"new starting tile\" as the the recursion happens.\n \n size = size + measure(map, x-1, y-1) #Each of these lines is run again and again until\n size = size + measure(map, x, y-1) #a non-land square is encountered. \n size = size + measure(map, x+1, y-1) #That's the recursive part.\n size = size + measure(map, x-1, y)\n size = size + measure(map, x+1, y)\n size = size + measure(map, x-1, y+1)\n size = size + measure(map, x, y+1)\n size = size + measure(map, x+1, y+1)\n \n size\nend", "def count_tiles(type)\n count = 0\n @screen.each do |row|\n row.each do |tile_id|\n next if tile_id.nil?\n\n count += 1 if tile_id == type\n end\n end\n count\n end", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def width\n TILE_WIDTH\n end", "def continent_size world, x, y\nif world[y][x] != 'land' # => false, true, true, true, false, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true\n# Either it's water or we already counted it,\n# but either way, we don't want to count it now.\nreturn 0 # => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\nend\n# So first we count this tile...\nsize = 1 # => 1, 1, 1\nworld[y][x] = 'counted land' # => \"counted land\", \"counted land\", \"counted land\"\n# Each time the program his a tile marked 'land' it updates that tile\n# so it is no longer 'land' but 'counted land', meaning the next time the\n# program hits that tile it will no longer be equal to 'land' and therefore\n# is not double counted.\n\n# ...then we count all of the neighboring eight tiles\n# (and, of course, their neighbors by way of the recursion).\n#\n# The best way to think of this is that each time the program hits a land tile\n# it starts spiraling around that tile until it finds another land tile and\n# each time it finds another land tile it starts again from that second land tile\n# and so on and son on until it has counted all the land tiles and their neighbors\n# that joined the starting tile.\n#\nsize = size + continent_size(world, x-1, y-1) # => 1, 1, 1\nsize = size + continent_size(world, x , y-1) # => 1, 1, 1\nsize = size + continent_size(world, x+1, y-1) # => 1, 1, 1\nsize = size + continent_size(world, x-1, y ) # => 1, 1, 3\nsize = size + continent_size(world, x+1, y ) # => 1, 1, 3\nsize = size + continent_size(world, x-1, y+1) # => 1, 1, 3\nsize = size + continent_size(world, x , y+1) # => 1, 2, 3\nsize = size + continent_size(world, x+1, y+1) # => 1, 2, 3\nsize # => 1, 2, 3\nend", "def tiles_remaining\n # still not sure why or how this is working. TODO: may take out later\n total_num_tiles = @default_set.inject(0) { |letter, letter_quantity| letter += letter_quantity[1] }\n p \"++++TEST++++\"\n p total_num_tiles\n return total_num_tiles\n end", "def tiles_remaining\n return @tiles\n end", "def tiles_remaining\n @default_tiles.values.inject(0, :+)\n end", "def each_tile level\n\t\t\tsize = tile_size level\n\t\t\t(0...size).each do |y|\n\t\t\t\t(0...size).each do |x|\n\t\t\t\t\tyield(x, y) if block_given?\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def tiles_remaining\n return @collection.length\n end", "def count_painted_panels\n count = 0\n @hull.each do |row|\n row.each do |panel|\n next if panel.nil?\n\n count += 1\n end\n end\n count\n end", "def calculate_num_children\n for x in @lattice do\n for c in @lattice.lower_covers[x] do\n if @irreducibles.contain?(c) then\n @num_children[x] += 1\n end\n end\n end\n end", "def mine_count\n grid.flatten.count { |space| space.mine }\n end", "def each_tile_with_index level\n\t\t\tidx = 0\n\t\t\tsize = tile_size level\n\t\t\t(0...size).each do |y|\n\t\t\t\t(0...size).each do |x|\n\t\t\t\t\tyield(x, y, idx) if block_given?\n\t\t\t\t\tidx += 1\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def showPiles\n 3.times { |i| puts i.to_s + \" : \" + $piles[i].count().to_s}\nend", "def calculateAdjacent\r\n #Loops through every tile in the grid.\r\n (0..@rows-1).each do |row|\r\n (0..@columns-1).each do |col|\r\n count = getTier(col+1, row+1) + getTier(col+1, row) + getTier(col+1, row-1)\r\n count += getTier(col, row+1) + getTier(col, row-1) + getTier(col-1, row+1)\r\n count += getTier(col-1, row) + getTier(col-1, row-1)\r\n @tile[col][row].adjacent = count #Totals the tier number in the adjacent tiles.\r\n end\r\n end\r\nend", "def max_number_of_a_level(level)\n 4 * level * level + 4 * level + 1\n end", "def num_tree_levels\n level = 0\n num_nodes= all_node_values_with_nil.length # considers tree as 'complete\n num_nodes_in_full_tree = 2**level\n until num_nodes_in_full_tree >= num_nodes\n level += 1\n num_nodes_in_full_tree += 2**level\n end\n num_tree_levels = level + 1 # (started count at 0)\n num_tree_levels = 0 if @root.nil?\n return num_tree_levels\n end", "def count_black_tiles_around(in_tiles, tile_x, tile_y)\n black_tile_count = 0\n MOVE.each do |dir, deltas|\n other_tile_x = tile_x + deltas[0]\n other_tile_y = tile_y + deltas[1]\n hash_key = \"#{other_tile_x}_#{other_tile_y}\"\n black_tile_count += 1 if (in_tiles[hash_key] % 2 == 1)\n end\n black_tile_count\nend", "def test_has_proper_number_of_tiles\n\t98.times { @pd.draw_tile } \t\n \n\tassert_equal true, @pd.empty?\n end", "def test_tile_rack_with_several_tiles_should_need_some_tiles\n [:A,:B,:C].each{|x| @newTileRack.append(x)}\n assert_equal(4,@newTileRack.number_of_tiles_needed)\n end", "def test_grid\n t = TreeShape.new(8)\n count = 0\n t.grid.each_index do |xi|\n t.grid[xi].each_index do |yi|\n count += 1\n end\n end\n assert_equal(count, t.height * t.width)\n end", "def test_board_should_have_9_tiles\n assert_equal(9, @board.number_of_tiles)\n end", "def tile_number_generator(board)\n count_hash = {\n 0 => 0,\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n 6 => 0,\n 7 => 0,\n 8 => 0,\n 9 => 1\n }\n \n y_pos = 1\n self.height.times do\n x_pos = 0\n \n column1 = count_hash[board[y_pos-1][x_pos-1]] + count_hash[board[y_pos][x_pos-1]] + count_hash[board[y_pos+1][x_pos-1]]\n column2 = count_hash[board[y_pos-1][x_pos]] + count_hash[board[y_pos][x_pos]] + count_hash[board[y_pos+1][x_pos]]\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n \n self.width.times do\n x_pos += 1\n \n column1 = column2\n column2 = column3\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n if board[y_pos][x_pos] != 9\n board[y_pos][x_pos] = column1 + column2 + column3\n end\n end\n y_pos += 1\n end\n \n return board\n end", "def draw_tiles (num)\n tiles_drawn = @bag_of_tiles.sample(num)\n tiles_drawn.each do | tile |\n @bag_of_tiles.slice!(@bag_of_tiles.index(tile))\n end\n return tiles_drawn\n end", "def normalized_size\n\t\t\ttile_size(max_level) * @unit_size\n\t\tend", "def width; @width ||= GeoWeb::Map.map_extent(zoom, tile_width); end", "def number_cells\n n = 1\n for row in 0...height\n for col in 0...width\n cell = self[row, col]\n west, north, east, south = DIRS.map{|dx, dy| self[row + dx, col + dy] and self[row + dx, col + dy].empty }\n if cell.empty and ((!west and east) or (!north and south))\n cell.number = n\n n += 1\n end\n end\n end\n end", "def levels_for(max_pixel_length)\n return 0 if max_pixel_length < 192\n max_tiles = (max_pixel_length.to_f / 96)\n log2(max_tiles).floor\n end", "def tiles\n @tiles\n end", "def depth\n crumbs.size\n end", "def leaf_count\n @leaf_count\n end", "def height\n TILE_BASE_HEIGHT\n end", "def levels\n # divide total points available in to X tiers\n # set up a hash\n # Beginner - 1\n # Good start - 2\n # Moving Up - 3\n # good - 4\n # Solid - 5\n # Nice - 6\n # Great - 7\n # Amazing - 8\n # Genius - 9\n # Queen Bee - 10\n end", "def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end", "def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end", "def estimate_layer_counts(board_size, max_exponent)\n num_cells = board_size**2\n i_max = max_exponent - 2\n max_sum = num_cells * 2**i_max\n table = count_compositions(max_sum, num_cells, 0, i_max)\n table.map.with_index do |row, index|\n sum = (index + 1) * 2\n counts = row.map.with_index do |count_k, i|\n k = i + 1\n count_k * choose(num_cells, k)\n end\n [sum, counts.sum]\n end\nend", "def get_num_paths(grid_width)\n n, r = grid_width * 2, grid_width\n ((n - r + 1)..n).inject(:*) / (1..r).inject(:*)\nend", "def count_paths(grid_size)\n factorial(2*grid_size) / (factorial(grid_size) * factorial(grid_size))\nend", "def calculate_level\n # Increase level for every 10 lines cleared\n @level = @start_level + (@lines_cleared / 10).floor\n end", "def total_poss\n @nrow * @ncol * @nbox\n end", "def level\n level = 0\n while get_points >= rounded_maximum_points_for_level(level)\n level += 1\n end\n level\n end", "def width\n @map[0].size\n end", "def level_count(*args) \n\tcase args[0]\n\twhen 0\n\t\tpersonal_average.size\n\twhen 1\n\t\tlocal_average.size\n\twhen 2\n\t\tglobal_average.size\n\twhen 3\n\t\tsuper_global_average.size\n\tend\n end", "def num_nests\n my_nests.length\n end", "def draw_tiles(num)\n if num <= tiles_remaining\n our_tiles = display_all_tiles.sample(num)\n tile_removal(our_tiles)\n return our_tiles\n else\n print \"Sorry, there are only #{tiles_remaining} left.\"\n our_tiles = display_all_tiles.sample(tiles_remaining)\n tile_removal(our_tiles)\n return our_tiles\n end\n end", "def arraymap_number_of_plates(w,h,plates)\n\tmax = -1\n\teach_in_map(w,h,plates) do |x,y,plaque_index|\n\t\tmax=plaque_index if plaque_index>max\n\tend\n\tmax+1\nend", "def water_tiles\n puts @area.select { |_, v| '~|'.include?(v) }.keys.select { |_, y| y <= @max_y }.count\n puts @area.select { |_, v| v == '~' }.keys.select { |_, y| y <= @max_y }.count\n end", "def count_rooms\n room_count = 0\n rooms = Array.new(@width)\n rooms.each_index() do |index|\n rooms[index] = Array.new(@height, 0)\n end\n @map.each_index() do |x|\n @map[x].each_index() do |y|\n if(!is_solid?(x, y) && rooms[x][y] == 0)\n room_count += 1\n flood_fill(x, y, rooms, room_count)\n end\n end\n end\n return {:rooms => rooms, :room_count => room_count}\n end", "def full_tree_node_count(min_capacity)\n full_tree_leaf_count(min_capacity) * 2 - 1\n end", "def height\n @map.size\n end", "def count\n @map.count\n end", "def draw_tiles(num)\n random_tiles = @tiles.sample(num)\n random_tiles.each do |letter|\n @tiles.slice!(@tiles.index(letter))\n end\n return random_tiles\n end", "def test_empty_tile_rack_should_need_max_tiles\n assert_equal(7,@newTileRack.number_of_tiles_needed)\n end", "def bush_depth\n # タイルの場合、または最前面に表示フラグが ON の場合\n if @tile_id > 0 or @always_on_top\n return 0\n end\n # return 12 if @in_swamp #> Ajout des marais\n if @jump_count == 0 and $game_map.bush?(@x, @y)\n return 12\n else\n return 0\n end\n end", "def test_tile_rack_with_one_tile_should_need_max_minus_one_tiles\n @newTileRack.append(:A)\n assert_equal(6,@newTileRack.number_of_tiles_needed)\n end", "def load_cutters tiles\r\n i = 0\r\n height = tiles.length\r\n width = tiles[i].length\r\n cutters = Array.new()\r\n\r\n while i < height\r\n j=0\r\n while j < width\r\n if(tiles[i][j]==2)\r\n tiles[i][j]=0\r\n cutters << Cutter.new(j*20,i*20)\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\n puts \"total cutters : \" + cutters.length.to_s\r\n cutters\r\nend", "def min_number_of_a_level(level)\n max_number_of_a_level(level - 1) + 1\n end", "def test_has_proper_tile_distribution\r\n dist = {:A => 0,\r\n :B => 0,\r\n :C => 0,\r\n :D => 0,\r\n :E => 0,\r\n :F => 0,\r\n :G => 0,\r\n :H => 0,\r\n :I => 0,\r\n :J => 0,\r\n :K => 0,\r\n :L => 0,\r\n :M => 0,\r\n :N => 0,\r\n :O => 0,\r\n :P => 0,\r\n :Q => 0,\r\n :R => 0,\r\n :S => 0,\r\n :T => 0,\r\n :U => 0,\r\n :V => 0,\r\n :W => 0,\r\n :X => 0,\r\n :Y => 0,\r\n :Z => 0}\r\n\r\n bag = TileBag.new\r\n 98.times {\r\n tile = bag.draw_tile\r\n dist[tile] += 1\r\n }\r\n\r\n assert_equal 9, dist[:A]\r\n assert_equal 2, dist[:B]\r\n assert_equal 2, dist[:C]\r\n assert_equal 4, dist[:D]\r\n assert_equal 12, dist[:E]\r\n assert_equal 2, dist[:F]\r\n assert_equal 3, dist[:G]\r\n assert_equal 2, dist[:H]\r\n assert_equal 9, dist[:I]\r\n assert_equal 1, dist[:J]\r\n assert_equal 1, dist[:K]\r\n assert_equal 4, dist[:L]\r\n assert_equal 2, dist[:M]\r\n assert_equal 6, dist[:N]\r\n assert_equal 8, dist[:O]\r\n assert_equal 2, dist[:P]\r\n assert_equal 1, dist[:Q]\r\n assert_equal 6, dist[:R]\r\n assert_equal 4, dist[:S]\r\n assert_equal 6, dist[:T]\r\n assert_equal 4, dist[:U]\r\n assert_equal 2, dist[:V]\r\n assert_equal 2, dist[:W]\r\n assert_equal 1, dist[:X]\r\n assert_equal 2, dist[:Y]\r\n assert_equal 1, dist[:Z]\r\n\r\n end", "def draw_tiles(num)\n\n # puts \"Length of default_tiles: \" + @tile_bag.length.to_s\n # print @tile_bag\n #\n # puts\n if num > 7\n raise ArgumentError\n end\n\n letters_picked = @tile_bag.sample(num)\n\n letters_picked.each do |tile|\n @tile_bag.delete_at(@tile_bag.index(tile))\n end\n\n # print \"Letters picked: \" + letters_picked.to_s + \"\\n\"\n #\n # puts \"NEW Length of default_tiles: \" + @tile_bag.length.to_s\n # print @tile_bag\n #\n # puts\n\n return letters_picked\n\n end", "def initialize(width, height, tile_width, tile_height)\n @max_tile_x = width/tile_width\n @max_tile_y = height/tile_height\n @max_subgrid_x = (width/tile_width)*3\n @max_subgrid_y = (height/tile_height)*3\n @tiles = Array.new(max_tile_y) {|i| Array.new(max_tile_x)}\n end", "def count_num_trees_supp(num_keys)\n return 1 if num_keys <= 1\n sum_total = 0\n (1..num_keys).each do |val|\n sum = 0\n left_count = count_num_trees_supp(val - 1)\n right_count = count_num_trees_supp(num_keys - val)\n sum += left_count * right_count\n sum_total += sum\n end\n sum_total\n end", "def gray_boomcity_tile_potential_count\n gray_boomcity_tile_count +\n [gray_double_boomcity_tile_count, @pending_gray_boom_tile_lays[:double_boom].size].min\n end", "def get_tree_height(d,cnt = 0 )\n \n if ( d['l'] == {} && d['r'] == {} )\n @depth = cnt if @depth < cnt\n else\n cnt = cnt + 1\n get_tree_height(d['l'],cnt) if d.key?('l')\n get_tree_height(d['r'],cnt) if d.key?('r')\n end\n \n return @depth\n \nend", "def compute_child_mod_count\n target_child_count = case self.grid_type\n when FULL\n 1\n when HALVES, LEFT, RIGHT\n 2\n when THIRDS\n 3\n else\n 0\n end\n (target_child_count - self.columns.size)\n end", "def length\n grid_shape.length\n end", "def tiles\n return @tiles\n end", "def tiles\n return @tiles\n end", "def number_of_cells(size)\n size * size\n end", "def tile_dimensions(x, y, tile_size, overlap)\n overlapping_tile_size = tile_size + (2 * overlap)\n border_tile_size = tile_size + overlap\n tile_width = (x > 0) ? overlapping_tile_size : border_tile_size\n tile_height = (y > 0) ? overlapping_tile_size : border_tile_size\n return tile_width, tile_height\n end", "def initialize\n @tiles = []\n 1.upto(15) { |i| @tiles[i] = Array.new }\n end", "def num_ships \n @grid.flatten.count(:S)\n end", "def num_ships\n @grid.reduce(0) { |acc, el| acc + el.count(:S) }\n end", "def num_paths\n @num_paths ||= begin\n self[width - 1, height - 1]\n end\n end", "def depth\n @cur_level - @base_level + 1\n end", "def elems_in_level(index)\n\treturn (Math.sqrt(2*(index+1)-1)-0.5).to_i + 1\nend", "def draw_map game_map\r\n tiles = game_map.tiles # 2d array of the tiles set!\r\n wooden_plank_image = game_map.wooden_plank # image of the wooden plank \r\n i = 0\r\n j = 0\r\n unit_width = 20\r\n unit_height = 20\r\n\r\n # drawing the background image of the game map\r\n #game_map.background.draw(0,0,0) # 0: for x position, 0: for y position, 0: for ZOrder\r\n\r\n height = tiles.length\r\n width = tiles[0].length\r\n\r\n while i < height\r\n j = 0\r\n while j < width\r\n if(tiles[i][j]==1 || tiles[i][j]==3)\r\n x = j * unit_width\r\n y = i * unit_height\r\n draw_plank(x, y, wooden_plank_image)\r\n j+=4 # increment the value of the j by 4 to skip the next 4 blocks\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\nend", "def max_tile_dimensions\n lambda do |projection|\n projection.explicit_tile_dimensions(max_size(projection))\n end\n end", "def reachable_tiles\n @tiles\n end", "def layers\n pixdem = [image.width, image.height].max\n ((Math.log(pixdem) / Math.log(2)) - (Math.log(96) / Math.log(2))).ceil + 1\n end", "def top_level_section_count\n @top_level.items.size\n end", "def getTier(colIndex,rowIndex)\r\n if (colIndex > @columns-1 || colIndex < 0 || rowIndex > @rows-1 || rowIndex < 0)\r\n return 0 #Checks if the tile is in the bounds of the grid.\r\n else\r\n return @tile[colIndex][rowIndex].tier\r\n end\r\nend", "def count_children(color:)\n if color == \"no other\"\n 0\n else\n children_counts = BAG_MAP_2[color].map { |content_arry| content_arry.first }\n children = children_counts.inject(0) { |sum,x| sum + x }\n\n ary = BAG_MAP_2[color]\n\n ary.each do |arry_content|\n num = arry_content.first\n col = arry_content.last\n\n children += num * count_children(color: col)\n end\n\n children\n end\nend", "def grid_row_items_total\n grid_row_items.size\n end", "def count\n @atlas.count\n end", "def draw_tiles(num)\n player_hand = []\n # array will return tiles to player. Needs much refactoring.\n return nil if num > tiles_remaining\n #to account for test, returns nil if more tiles are drawn than tiles remain.\n while player_hand.length != num\n new_tile = rand(@default_set.size)\n starting_hand = 0\n\n @default_set.each do |letter, letter_quantity|\n #Need to continue working on, this is becoming harder to read. TODO: REFACTOR!\n # if the amount of tiles drawn(starting at 0) is the same as the amount of new tiles drawn,\n if starting_hand == new_tile && letter_quantity != 0\n #if the condition above, and the total tiles isnt 0, add the new tile (letter), to all of the tiles (player_hand array)\n # if letter_quantity != 0\n player_hand << letter\n #Then subtract the letter from the tilebag, reducing the total amount of tiles by 1, and reducing the letter by one specifically from the letters.\n @default_set[letter] = letter_quantity - 1\n else\n new_tile = rand(@default_set.size)\n \n end\n #increases the amount of tiles had by player plus one, each time a tile is drawn\n starting_hand += 1\n end\n end\n #returns array of all tiles to player\n return player_hand\n end", "def tree_checker(map,right,down)\n horz = 0\n counter = 0\n vert = down\n map.each_with_index do |val, _i|\n break if vert > map.length - 1\n\n row_size = val.length\n horz = (horz + right) % row_size\n counter += 1 if map[vert][horz] == \"#\"\n vert += down\n end\n counter\nend", "def num_tankoubon; end", "def generate_tile()\n @i = do_generate_tile(@i)\n end", "def width\n @maps[:background][0].size\n end", "def get_tiles\n tiles = []\n accuracy_pixels_config = AppConfig.gmap_accuracy\n (0...AppConfig.gmap_max_zoom).reverse_each do |zoom|\n tiles_across = 2**zoom\n # the accuracy will go down by half at each zoom level with a floor of 1 i.e. 8 => 4, 7 => 2, 6 => 1, 5 => 1, 4 => 1\n accuracy_pixels = (accuracy_pixels_config.to_f / 2**(AppConfig.gmap_max_zoom - zoom).to_f ).ceil\n tiles_at_zoom = (0...tiles_across).map { |x| (0...tiles_across).map { |y| OpenStruct.new(:x => x, :y => y, :zoom => zoom, :accuracy_pixels => accuracy_pixels) } }.flatten(1)\n tiles.concat tiles_at_zoom\n end\n tiles\n end", "def generate_tile_heights(map_size)\n # USE SUPER SIMPLIFIED VERSION FOR NOW\n return Array.new(map_size, 1)\n\n # STUFF BELOW FOR MORE COMPLEX IMPLEMENTATION IN THE FUTURE\n # I RAN OUT OF TIME :(\n tiles = [\n Array.new((map_size*0.5).floor, 1), \n Array.new((map_size*0.4).floor, 2), \n Array.new((map_size*0.1).floor, 3) \n ].flatten\n\n # Compensate for imperfect percentage rounding \n (map_size - tiles.size).times do |i|\n tiles.push([1, 2, 3].sample)\n end\n\n # Shuffle the tiles to randomly assign them\n tiles = tiles.shuffle\n\n return tiles\n end", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def cells_count\n rows_count * columns_count\n end", "def numbered_levels\n levels.each_with_index.map do |level, index|\n level.clone.tap { |l| l.level_number = index + 1 }\n end\n end", "def mapsize\r\n\t\t@array_translate[0][1].to_i\r\n\tend", "def test_that_full_tile_rack_doesnt_need_any_tiles\n 7.times{|num| @newTileRack.append(:A)}\n assert_equal(0,@newTileRack.number_of_tiles_needed)\n end", "def draw_tiles(tile_bag)\n until tiles.length == 7\n tiles.concat(tile_bag.draw_tiles(1)) #because draw_tiles returns an array\n\n end\n end", "def number_of_children\n @children.size\n end" ]
[ "0.81527114", "0.7276575", "0.70323104", "0.70270157", "0.69605625", "0.68555665", "0.68508947", "0.6842748", "0.6816328", "0.6712837", "0.670293", "0.66650015", "0.66488445", "0.6601578", "0.65897065", "0.6551793", "0.65106344", "0.65039355", "0.6437292", "0.6436011", "0.6400717", "0.6357299", "0.63505536", "0.63372195", "0.6332027", "0.63137007", "0.62845236", "0.6269892", "0.6199021", "0.6198624", "0.61836135", "0.6181577", "0.6180701", "0.6179008", "0.6135681", "0.6128198", "0.6100312", "0.6098549", "0.60975474", "0.6081197", "0.6071801", "0.60437405", "0.60403395", "0.6038017", "0.6036975", "0.60340524", "0.6029049", "0.6007022", "0.59887576", "0.5984966", "0.5981474", "0.59787136", "0.5973602", "0.5968915", "0.5965791", "0.59645826", "0.59546095", "0.59133077", "0.5912806", "0.58670855", "0.58588386", "0.58588105", "0.5856317", "0.5853431", "0.5852922", "0.5849887", "0.5848575", "0.5828878", "0.5828796", "0.5828796", "0.58268774", "0.58184344", "0.5800907", "0.579836", "0.5792712", "0.57918686", "0.57902163", "0.5789409", "0.5776168", "0.57744056", "0.57656455", "0.57598114", "0.5758676", "0.5749219", "0.57483816", "0.5746461", "0.5744353", "0.57416236", "0.573715", "0.57322323", "0.57301784", "0.5729102", "0.5728331", "0.5724377", "0.57189685", "0.5713191", "0.57044214", "0.56941307", "0.5669305", "0.56681484", "0.56642103" ]
0.0
-1
Validates each segment of a constant path in the correct scope.
def on_constant_path(node) definitions = current_scope @in_constant_path = true # The first constant check should take data from parent scopes into # account. The following segments should not. method = :has_definition? node.children.each do |segment| name = segment.name unless definitions.send(method, :constant, name) error("undefined constant #{name}", segment) break end definitions = definitions.lookup(:constant, name) method = :defines? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_constant_path?(token)\n current = scope\n\n token.name.each do |segment|\n found = current.lookup(:constant, segment)\n\n if found and token.line > found.token.line\n current = found\n else\n return false\n end\n end\n\n return true\n end", "def validate_routes\n return unless time_segment\n self.time_segment.delete_routing_set_errors\n self.time_segment.check_routing_set_percent_is_100\n end", "def validate_paths(paths)\n normalize_paths paths\n nil\nend", "def unsafe_validate(paths)\n validate_path(paths)\n end", "def check candidate_path\n # Convert dynamic segments into regexp captures\n matchable_path = candidate_path.gsub(/:\\w+/, '([^/]+)')\n\n # Don't match a partial segment. For example,\n # don't match /widget for /widgets.\n path.match(Regexp.new(\"^/?#{matchable_path}(?:/|$)\"))\n end", "def enclosing_segments\n segments = remove_namespaces_from_segments(recognized_route.segments.dup)\n while segments.size > 0\n segment = segments.pop\n return segments if segment.is_a?(::ActionController::Routing::StaticSegment) && segment.value == resource_specification.segment\n end\n ResourcesController.raise_missing_segment(self)\n end", "def valid_path? unit, path\n path.inject(@units[unit].location) do |p,c|\n return false unless adjacent?(p, c) && can_path_through(*c)\n c\n end\n true\n end", "def validate_paths!\n ensure_clean_build_path!\n ensure_existing_target_path!\n end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error \"File patterns must be relative and cannot start with a \" \\\n \"slash (#{attrb.name}).\"\n end\n end\n end\n end", "def valid_scope(valid_scopes, scope)\n\t\tend", "def validate_if_segment\n return unless owner.type.nil?\n\n dirs = component_dir_paths.map { |p| base_name(p) }\n files = component_file_paths.map { |p| base_name(p) }\n (files - dirs).each { |path| search_path.join(path).mkdir }\n (dirs - files).each { |path| FileUtils.touch(search_path.join(\"#{path}.yml\")) }\n end", "def validate_path_list(config, *keys)\n hash = retrieve_value(config, keys)\n list = hash[:value]\n\n # return early if we couldn't walk into hash and find a value\n return false if (list.nil?)\n\n path_list = []\n exist = true\n\n case list\n when String then path_list << list\n when Array then path_list = list\n end\n\n path_list.each do |path|\n base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers\n\n if (not @file_wrapper.exist?(base_path))\n # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator\n @stream_wrapper.stderr_puts(\"ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.\")\n exist = false\n end\n end\n\n return exist\n end", "def path_validator(the_board,origin_arr,destination_arr)\n\t\tif horizontal_direction(origin_arr,destination_arr)\n\t\t\tvalidity = path_validator_horizontal_vertical(the_board,origin_arr,destination_arr)\n\t\telsif diagonal_direction(origin_arr,destination_arr)\n\t\t\tvalidity = path_validator_diagonal(the_board,origin_arr,destination_arr)\n\t\tend\n\t\tvalidity\n\tend", "def path_validator(the_board,origin_arr,destination_arr)\n\t\tif horizontal_direction(origin_arr,destination_arr)\n\t\t\tvalidity = path_validator_horizontal_vertical(the_board,origin_arr,destination_arr)\n\t\telsif diagonal_direction(origin_arr,destination_arr)\n\t\t\tvalidity = path_validator_diagonal(the_board,origin_arr,destination_arr)\n\t\tend\n\t\tvalidity\n\tend", "def valid_path?(content)\n content.visibility_ancestor_ids.all? { |id| existing_ids.include?(id) }\n end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error '[File Patterns] File patterns must be relative ' \\\n \"and cannot start with a slash (#{attrb.name}).\"\n end\n end\n end\n end", "def validate_path\n site = self.try(:site) || (self.try(:tippable_type) == 'Site' ? Site.find(self.tippable_id) : nil)\n if site && path.present? && Site.where(hostname: site.hostname + self.path).any?\n errors.add(:path, 'you can\\'t use this path. Another website is defined with this hostname+path')\n end\n end", "def validate_path(path)\n path.gsub(/\\{([^}]*)\\}/){|match| \"\\{#{validate_property_name($1)}\\}\" }\n end", "def valid_path?(path)\n validations = []\n if @opts[:filter]\n validations << (path =~ @opts[:filter])\n end\n if @opts[:ignore]\n validations << (path !~ @opts[:ignore])\n end\n\n validations.all?\n end", "def check_monitoring_path_structure(name, expected_paths_size)\n structure = Params[name]\n if structure.kind_of?(Array)\n if (0 != expected_paths_size) and (expected_paths_size != structure.size)\n ContentServer.raise_monitoring_paths_error(expected_paths_size, name, structure)\n end\n structure.each { |path_hash|\n if path_hash.kind_of?(Hash)\n if 3 != path_hash.size\n ContentServer.raise_monitoring_paths_error(expected_paths_size, name, structure)\n end\n else\n ContentServer.raise_monitoring_paths_error(expected_paths_size, name, structure)\n end\n }\n else\n ContentServer.raise_monitoring_paths_error(expected_paths_size, name, structure)\n end\n end", "def route_enclosing_names\n @route_enclosing_names ||= returning(Array.new) do |req|\n enclosing_segments.each do |segment|\n unless segment.is_optional or segment.is_a?(::ActionController::Routing::DividerSegment)\n req << [segment.value, true] if segment.is_a?(::ActionController::Routing::StaticSegment)\n req.last[1] = false if segment.is_a?(::ActionController::Routing::DynamicSegment)\n end\n end\n end\n end", "def valid?\n return false unless @paths.count > 1\n @paths.each do |p|\n return false unless p.valid?\n end\n true\n end", "def _filtered_constants\n @caught_constants.select do |(obj, name)|\n next unless obj.const_defined?(name)\n\n begin\n location = obj.const_source_location(name)\n rescue ::ArgumentError\n next\n end\n\n next true if location.nil?\n\n path = location.first\n next false if $LOADED_FEATURES.include?(path)\n\n next true if constants_location_prefixes.nil?\n\n constants_location_prefixes&.any? { |prefix| path.start_with?(prefix) }\n end\n end", "def loadable_constants_for_path(path, bases = autoload_paths)\n path = path.chomp(\".rb\")\n expanded_path = File.expand_path(path)\n paths = []\n\n bases.each do |root|\n expanded_root = File.expand_path(root)\n next unless expanded_path.start_with?(expanded_root)\n\n root_size = expanded_root.size\n next if expanded_path[root_size] != ?/\n\n nesting = expanded_path[(root_size + 1)..-1]\n paths << nesting.camelize unless nesting.blank?\n end\n\n paths.uniq!\n paths\n end", "def validate(init)\n if init.has_key?('configSets')\n check_config_sets(init)\n end\n init.each do |config,config_data|\n next if config == 'configSets'\n context config do\n compare(config_data, $types)\n end\n end\nend", "def all_roots_valid?\n if acts_as_nested_set_options[:scope]\n roots.group_by{|record| scope_column_names.collect{|col| record.send(col.to_sym)}}.all? do |scope, grouped_roots|\n each_root_valid?(grouped_roots)\n end\n else\n each_root_valid?(roots)\n end\n end", "def validate_host_volume_paths\n return unless allowed = ENV['KUBERNETES_ALLOWED_VOLUME_HOST_PATHS'].presence\n allowed = allowed.split(\",\").map { |d| File.join(d, '') }\n used = map_attributes([:spec, :volumes, :hostPath, :path], elements: templates).\n flatten(1).compact.map { |d| File.join(d, '') }\n bad = used.select { |u| allowed.none? { |a| u.start_with?(a) } }\n @errors << \"Only volume host paths #{allowed.join(\", \")} are allowed, not #{bad.join(\", \")}.\" if bad.any?\n end", "def valid_path?(path)\n !!self.run_state.active_permissions.map(&:pattern).detect do |regex|\n regex.match(path)\n end\n end", "def define_paths_for(path, &block)\n path_part = root_defined_path_part[path]\n if path_part.nil?\n raise ArgumentError.new \"can not define paths for #{path} since it has not yet been defined\"\n end\n \n yield path_part\n end", "def literal_validation\n Validation::Literal.from_path(path)\n end", "def validate_paths(paths)\n paths = [paths] unless paths.is_a?(Array)\n raise 'The provided paths must all be Strings' \\\n unless paths.all? { |path| path.is_a?(String) }\n\n Wgit::Utils.process_arr(paths, encode: false)\n raise 'The provided paths cannot be empty' if paths.empty?\n\n paths\n end", "def path_validator(the_board,origin_arr,destination_arr)\n\t\tpath_validator_horizontal_vertical(the_board,origin_arr,destination_arr)\n\tend", "def qualified_segments\n @qualified_segment_mutex.synchronize { @qualified_segments.clone }\n end", "def validations_for_path\n []\n end", "def validate_scopes\n @original_scopes = @original_scopes || server.jwt['scope']\n return true unless @original_scopes\n ScopeChecker.valid?(scope_str: @original_scopes, server_scopes: configuration.scopes, app_scopes: client.try(:scopes))\n end", "def resolve_definition(path)\n current = scope\n\n path.each do |segment|\n found = current.lookup(:constant, segment)\n current = found if found\n end\n\n return current\n end", "def validate(env, remote_addr)\n @paths.each do |path|\n if concerns_path?(env[\"PATH_INFO\"]) and not concerns_ip?(remote_addr)\n return false\n end\n end\n\n true\n end", "def validate\n ensure_exclude_option_array_exists\n ensure_linter_section_exists\n ensure_linter_include_exclude_arrays_exist\n end", "def validate_tokens(_request, conditions_box)\n conditions = conditions_box.value\n conditions.each_with_index do |condition, kk|\n condition['tokens'].each_with_index do |token, ii|\n # Sync-tokens must always start with our designated prefix.\n if token['token'][0, SYNCTOKEN_PREFIX.length] != SYNCTOKEN_PREFIX\n next\n end\n\n # Checking if the token is a match.\n node = @server.tree.node_for_path(condition['uri'])\n\n if node.is_a?(ISyncCollection) && node.sync_token.to_s == token['token'][SYNCTOKEN_PREFIX.length..-1]\n conditions[kk]['tokens'][ii]['validToken'] = true\n end\n end\n end\n conditions_box.value = conditions\n end", "def literal_validation\n Validation::Literal.from_string(path)\n end", "def segmented_path?\n path.split('/').any? { |s| s[0] == ':' }\n end", "def calculate_valid_paths(tokens, doc = input)\n token, index = tokens.each_with_index.find { |t, i| t.start_with?(':') }\n\n return [{}] unless token\n\n sub_doc = tokens[0 .. index - 1].inject(doc) { |o, t| o[t] }\n\n items =\n case sub_doc\n when Array\n 0...sub_doc.size\n when Hash\n sub_doc.keys\n else\n [sub_doc]\n end\n\n items.map { |value| { token => value } }\n end", "def validate_ip_ranges\n raise ActionController::RoutingError.new('Not Found') unless ::SfDbSync::IPConstraint.new.matches?(request)\n end", "def const_candidates(segments)\n [segments] + segments.map.with_index do |segment, idx|\n candidate = segments[0...(segments.size - (idx + 1))]\n candidate + segments[(segments.size - (idx + 1))..-1].map do |sub_seg|\n \"#{sub_seg}#{suffix}\"\n end\n end\n end", "def each_path_validation\n return enum_for(__method__) unless block_given?\n\n @node.xpath('pathValidation').each do |element|\n yield PathValidation.new(element)\n end\n end", "def constant_scopes_cache; end", "def parent_valid?\n assoc_errors = errors.keys.select { |x| x.match(/\\./) }\n (errors.keys - assoc_errors).empty?\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def validate_include_clause(errors)\n return errors unless options[:include]\n\n options[:include].each_with_object(errors) do |included, errors|\n next errors if allowed_includes.include?(included)\n\n errors.push(\n source: { parameter: 'include' },\n title: 'Invalid Query Parameter',\n detail: \"#{resource_name.capitalize} does not have an `#{included}` relationship path.\"\n )\n end\n end", "def check_path(v)\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" query ]\n if v && @opaque\n raise InvalidURIError,\n \"path conflicts with opaque\"\n end\n\n # If scheme is ftp, path may be relative.\n # See RFC 1738 section 3.2.2, and RFC 2396.\n if @scheme && @scheme != \"ftp\"\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected absolute path component): #{v}\"\n end\n else\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v &&\n parser.regexp[:REL_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected relative path component): #{v}\"\n end\n end\n\n return true\n end", "def valid_path?(x,y)\n puts \"This method needs to be defined in the piece's Unique Class;\\ne.g. for the Queen piece, edit the Queen Class in queen.rb\"\n end", "def segments\n if [email protected]?\n @segments = path.split('/').select { |s| !s.empty? }\n else\n @segments\n end\n end", "def path_validator(the_board,origin_arr,destination_arr)\n\t\tpath_validator_diagonal(the_board,origin_arr,destination_arr)\n\tend", "def valid_path?(path)\n # Maximum length\n return false if path.length > 255\n # Valid characters allowed\n ch = /[A-Za-z0-9_\\-.$\\/~\"'@:+]*/\n # Require leading slash, maximum one wildcard allowed at start or end\n !!path.match(/^\\/( \\*#{ch} | #{ch}\\* | #{ch} )$/x)\nend", "def second_validate\n across_req_bound = Array.new((2 * (self.across) + 1),1)\n down_req_bound = Array.new((2 * (self.down) + 1),1)\n top_bound = self.plane[0]\n down_bound = self.plane[2 * (self.down)]\n left_bound = self.plane.map{|a| a[0]}\n right_bound = self.plane.map{|a| a[2 * (self.across)]}\n if(top_bound != across_req_bound || down_bound != across_req_bound ||left_bound != down_req_bound || right_bound != down_req_bound)\n puts \"One of the boundaries is not closed\"\n self.valid = false\n end\n cell_validate if(self.valid == true)\n end", "def validate(paths: nil, minimum: 1.0, input:)\n\tpolicy ||= context.lookup(\"covered:policy:current\").call(paths: paths)\n\t\n\t# Calculate statistics:\n\tstatistics = Covered::Statistics.new\n\t\n\tpolicy.each do |coverage|\n\t\tstatistics << coverage\n\tend\n\t\n\t# Print statistics:\n\tstatistics.print($stderr)\n\t\n\t# Validate statistics and raise an error if they are not met:\n\tstatistics.validate!(minimum)\nend", "def path_captures\n return 0 unless conditions[:path]\n Behavior.count_parens_up_to(conditions[:path], conditions[:path].size)\n end", "def completeness_check\n available = (@rules + @leaves).map(&:name).to_set\n sought = @rules.flat_map(&:seeking).uniq.to_set\n problems = sought.reject { |s| available.include? s }\n raise Error, \"the following rules or leaves remain undefined: #{problems.join(', ')}\" if problems.any?\n end", "def qualified_for?(segment)\n qualified = false\n @qualified_segment_mutex.synchronize do\n break if @qualified_segments.nil? || @qualified_segments.empty?\n\n qualified = @qualified_segments.include?(segment)\n end\n qualified\n end", "def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end", "def validation_errors\n errors = []\n ErrorCompiler.with_errors(errors) do |e|\n check_schools_consistency_in_each_round(e)\n check_legitimate_progress_through_rounds(e)\n check_wildcards(e)\n end\n errors\n end", "def validate_parts!(grid_infos, part_uids)\n validate_parts_presence!(grid_infos, part_uids)\n validate_parts_full_chunks!(grid_infos)\n end", "def check_file_patterns\n FILE_PATTERNS.each do |attr_name|\n if respond_to?(\"_validate_#{attr_name}\", true)\n send(\"_validate_#{attr_name}\")\n else\n validate_nonempty_patterns(attr_name, :error)\n end\n end\n\n _validate_header_mappings_dir\n if consumer.spec.root?\n _validate_license\n _validate_module_map\n end\n end", "def qualified_const_defined?(path)\n names = path.sub(/^::/, '').to_s.split('::')\n\n names.inject(Object) do |mod, name|\n return false unless local_const_defined?(mod, name)\n mod.const_get name\n end\n end", "def __required_parts\n required = []\n required << 'body' if (@spec['body'] && @spec['body']['required'])\n\n # Get required variables from paths:\n req_variables = __path_variables.inject(:&) # find intersection\n required << req_variables unless req_variables.empty?\n required.flatten\n end", "def path_must_be_unique_in_county\n return nil if path.blank? || !county\n\n my_path = self.path.to_s.downcase\n county.graveyards.each do |g|\n if (g.path.to_s.downcase == my_path) && (g.id != self.id)\n errors.add(:path, \"#{self.path} has already been taken\")\n end\n end\n end", "def valid_path?(path)\n !!(path =~ PATH_REGEX)\n end", "def validate_source()\n valid_sources = Plugins::Import::included_modules.collect(&:name)\n if (params.key?(:scope) && valid_sources.include?(params[:scope])) \n @source = params[:scope].constantize\n else\n redirect_to root_path\n end\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def qualified_const_defined?(path)\n Object.const_defined?(path, false)\n end", "def qualified_const_defined?(path)\n Object.const_defined?(path, false)\n end", "def load_wildcards_from(start)\n specs = specifications.slice(start..-1)\n encls = route_enclosing_names.slice(enclosing_resources.size..-1)\n \n if spec = specs.find {|s| s.is_a?(Specification)}\n spec_seg = encls.index([spec.segment, spec.singleton?]) or ResourcesController.raise_resource_mismatch(self)\n number_of_wildcards = spec_seg - (specs.index(spec) -1)\n else\n number_of_wildcards = encls.length - (specs.length - 1)\n end \n\n number_of_wildcards.times { load_wildcard }\n end", "def would_require?(path); end", "def validateDependencies\n params[:dependencies].split(\"&\").each do |dependency|\n dependency_values = dependency.split(\"=\")\n versions = Version.where(:part_name => dependency_values[0])\n\n if versions.empty?\n render :text => \"Part: #{dependency_values[0]} does not exist.\", status: 400\n return\n else\n part = versions.where(:version => dependency_values[1]).first\n if part.nil?\n render :text => \"Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist\", status: 400\n return\n end\n end\n end\n\n render :nothing => true, status: 200\n end", "def bt_scope_constraint\n if bt_scope_constraint_violation?\n if $DEBUG\n errors[:base] << \"overlaps existing valid record: #{bt_versions.vt_intersect(vtstart_at, vtend_at).tt_intersect(ttstart_at).to_a.inspect}\"\n else\n errors[:base] << \"overlaps existing valid record\"\n end\n false\n else\n true\n end\n end", "def check_for_directive(line)\n chunks = line.split(' ')\n if chunks.include? 'ORIG'\n @compile_start = chunks.last.to_i\n @compile_counter = @compile_start\n return true\n\n elsif chunks.include? 'EQU'\n sym = chunks.first\n val = chunks.last\n @symbols[sym] = val\n return true\n\n elsif chunks.include? 'CON'\n val = chunks.last\n @computer.memory.storage[@pc].from_int(val.to_i)\n @compile_counter += 1\n return true\n\n elsif chunks.include? 'ALF'\n val = chunks.last\n @computer.memory.storage[@pc].from_string(val.to_s)\n @compile_counter += 1\n return true\n\n elsif chunks.include? 'END'\n @program_start = chunks.last.to_i\n return true\n end\n\n return false\n end", "def detect_segment_errors(segment, segment_start, segment_end) #collapse_start\n segment_length = segment.length\n averaged_segment = Array.new(segment_length)\n local_maxes = Array.new\n\n # Smooth the data by taking the averages\n for i in 0...segment_length\n if i == 0\n averaged_segment[i] = segment.slice(0,3).inject(:+).to_f / 3.0\n elsif i == 1\n averaged_segment[i] = segment.slice(0,4).inject(:+).to_f / 4.0\n elsif i == segment_length-1\n averaged_segment[i] = segment.slice(segment_length-3, 3).inject(:+).to_f / 3.0\n elsif i == segment_length-2\n averaged_segment[i] = segment.slice(segment_length-4, 4).inject(:+).to_f / 4.0\n else\n averaged_segment[i] = segment.slice(i-2, 4).inject(:+).to_f / 4.0\n end\n end\n\n # Find all the local maxes in the data, that can correspond to qrs segments or smaller local maxes\n j = 0\n while j < segment_length\n current = averaged_segment[j]\n local_max = true\n\n if (current - BASELINE_VALUE) > 20\n starting = [j-10, 0].max\n ending = [j+10, segment_length].min\n for k in starting...ending\n if averaged_segment[k] > current\n local_max = false\n break\n end\n end\n\n if local_max\n if (current - 512) > 250\n local_maxes.push({ index: j, type: 'qrs' })\n else\n local_maxes.push({ index: j, type: 'small' })\n end\n j += 10\n end\n end\n j += 1\n end\n\n distances = Array.new\n flutters = Array.new\n w = 0\n\n # Find the distances between qrs segments\n # Find the number of small local maxes in between qrs segments (corresponding to atrial flutters)\n while w < local_maxes.length - 1\n current = local_maxes[w]\n if current[:type] == 'qrs'\n idx = w+1\n counter = 0\n\n while idx < local_maxes.length\n if local_maxes[idx][:type] == 'qrs'\n distances.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n if counter >= 4\n flutters.push({\n start: current[:index],\n stop: local_maxes[idx][:index],\n distance: local_maxes[idx][:index] - current[:index]\n })\n end\n break;\n end\n\n counter += 1\n idx += 1\n end\n\n w = idx\n else\n w += 1\n end\n end\n\n max_distance = distances.present? ? distances.max_by { |obj| obj[:distance] }[:distance] : 0\n min_distance = distances.present? ? distances.min_by { |obj| obj[:distance] }[:distance] : 0\n long_distances = Array.new\n if max_distance - min_distance > 75\n long_distances = distances.select { |obj| obj[:distance] > max_distance-25 }\n long_distances = long_distances.reduce([]) do |memo, val|\n last = memo.last\n if last\n if last[:stop] == val[:start]\n last[:stop] = val[:stop]\n last[:distance] = last[:distance] + val[:distance]\n memo[-1] = last\n\n memo\n else\n memo.push(val)\n end\n else\n [val]\n end\n end\n end\n\n long_distances.each do |dist_obj|\n signal = segment.slice(dist_obj[:start], dist_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + dist_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + dist_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Sinus Arrythmia',\n ecg_stream_id: self.id\n })\n end\n\n flutters.each do |flutter_obj|\n signal = segment.slice(flutter_obj[:start], flutter_obj[:distance])\n\n StreamAlert.create({\n signal: signal,\n start_time: Time.at(segment_start.to_f + flutter_obj[:start]*MS_PER_SAMPLE/1000.0),\n end_time: Time.at(segment_start.to_f + flutter_obj[:stop]*MS_PER_SAMPLE/1000.0),\n alert: 'Atrial Flutter',\n ecg_stream_id: self.id\n })\n end\n end", "def valid_path_exists?(word)\n if (word.length < MIN_WORD_LENGTH)\n puts \"Words must be greater than three letters long\"\n return nil\n end\n\n tail = word[1, word.length]\n (0..15).each do |i|\n if (@b[i].die.getLetter.casecmp(word[0,1]) == 0) # if the letter matches the first in word\n @b[i].used = true\n return true if dfs(@b[i], tail) # need to check all instances of that letter\n @b[i].used = nil\n end\n unmark_used_nodes \n end\n return nil\n end", "def validate!\n bind_vars = operand(0).map(&:first).map(&:name)\n query_vars = operand(1).variables.keys\n \n unless (bind_vars.compact & query_vars.compact).empty?\n raise ArgumentError,\n \"bound variable used in query: #{(bind_vars.compact & query_vars.compact).to_sse}\"\n end\n\n # Special case for group variables\n if operands.last.is_a?(Group)\n bind_expr_vars = operand(0).map(&:last).variables.keys\n group_vars = operands.last.variables.keys\n group_internal_vars = operands.last.internal_variables.keys\n\n bind_expr_vars.each do |v|\n raise ArgumentError,\n \"extension expression uses variable not in scope: #{v}\" if\n group_internal_vars.include?(v) &&\n !group_vars.include?(v)\n end\n end\n\n super\n end", "def validate\n assert(\"Configuration must be a hash, but a #{@config.class} was provided\", @config.class == Hash)\n assert(\"Configuration must contain a root '#{AF::LOCATIONS}' key\", @config.key?(AF::LOCATIONS))\n locations = @config[AF::LOCATIONS]\n assert(\"'#{AF::LOCATIONS}' must be a hash of locations\", locations.class == Hash)\n\n locations.each do |name, properties|\n register_on_failure do\n assert(\"Name of storage location must be a string, but was of type #{name.class}\", name.instance_of?(String))\n assert(\"Storage location '#{name}' must be a hash, but a #{properties.class} was provided\", properties.is_a?(Hash))\n\n register_on_failure { assert_path_property_valid(name, AF::LOCATION_PATH, properties, 'location') }\n\n assert(\"Metadata location must be present for location '#{name}'\", properties.key?(AF::METADATA_CONFIG))\n assert_path_property_valid(name, AF::LOCATION_PATH, properties[AF::METADATA_CONFIG], 'metadata')\n end\n end\n\n @result\n end", "def validate\n raise ArgumentError.new('No vuln_id.') unless @vuln_id\n raise ArgumentError.new('No scope.') unless @scope\n raise ArgumentError.new('No reason.') unless @reason\n\n case @scope\n when Scope::ALL_INSTANCES\n @asset_id = @port = @vuln_key = nil\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n raise ArgumentError.new('No asset_id.') unless @asset_id\n @port = @vuln_key = nil\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n raise ArgumentError.new('No asset_id.') unless @asset_id\n raise ArgumentError.new('Port or vuln_key is required.') unless @port || @vuln_key\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n raise ArgumentError.new('No site_id.') unless @site_id\n else\n raise ArgumentError.new(\"Invalid scope: #{@scope}\")\n end\n end", "def validate\n raise ArgumentError.new('No vuln_id.') unless @vuln_id\n raise ArgumentError.new('No scope.') unless @scope\n raise ArgumentError.new('No reason.') unless @reason\n\n case @scope\n when Scope::ALL_INSTANCES\n @asset_id = @port = @vuln_key = nil\n when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET\n raise ArgumentError.new('No asset_id.') unless @asset_id\n @port = @vuln_key = nil\n when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET\n raise ArgumentError.new('No asset_id.') unless @asset_id\n raise ArgumentError.new('Port or vuln_key is required.') unless @port || @vuln_key\n when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE\n raise ArgumentError.new('No site_id.') unless @site_id\n else\n raise ArgumentError.new(\"Invalid scope: #{@scope}\")\n end\n end", "def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] unless match.pre_match.empty?\n segments << match[2].intern\n path = strip[match.post_match]\n end\n segments << strip[path] unless path.empty?\n segments\n end", "def validate\n validate_root\n validate_associated\n valid?\n end", "def authorize_changes(changed_paths)\n \n ret=nil\n bad_paths=[/\\/target\\//, /\\/lib\\//] # move this to config file\n @logger.debug(\"InvalidFileChecker authorize_changes \" << changed_paths.to_s)\n changed_paths.each do |path|\n if /A|U/=~path[0,1] or /A|U/=~path[1,2]\n bad_paths.each do |bad_path|\n if (bad_path=~path) and not (/buildtools\\/lib/=~path) and not (/ant\\/lib/=~path)\n ret=\"Such directories or files under are not allowed to be checked in. \" << path\n break\n end\n end\n end\n break if ret\n end\n ret\n end", "def run_check\n check_for_default_routes\n check_for_action_globs\n check_for_cve_2014_0130\n end", "def all_roots_valid?\n # TODO: scope\n# if self.nested_set_options[:scope]\n# roots.group(:group => scope_column_names).group_by{|record| scope_column_names.collect{|col| record.send(col.to_sym)}}.all? do |scope, grouped_roots|\n# each_root_valid?(grouped_roots)\n# end\n# else\n each_root_valid?(roots.all)\n# end\n end", "def check_parameter_constraints\n check_constraints_for_a if (@repository.parameters[:all])\n check_constraints_for_c if (@repository.parameters[:coord])\n check_constraints_for_d if (@repository.parameters[:delta])\n check_constraints_for_r if (@repository.parameters[:range])\n\n # check mandatory parameter combination\n check_parameter_occurrence\n \n # check mandatory file parameter\n check_mandatory_parameter(:file)\n end", "def qualified_segments=(segments)\n @qualified_segment_mutex.synchronize { @qualified_segments = segments.clone }\n end", "def check_condition \n\t\tnumber_rule = 0\n\t\tnew_path = Array.new(6) {elem = 0}\n\t\ti = 0\n\t\tj = 0\n\t\tn = 1\n\t\t\n\t\twhile i < 6\n\t\t\tif @path[@last_position[0]][@last_position[1]][i] == 'nil'\n\t\t\t\t@path[@last_position[0]][@last_position[1]][i] = 0\n\t\t\tend\n\t\t\t\n\t\t\tif @path[@last_position[0]][@last_position[1]][i] == 1\n\t\t\t\tn = i - @direction \n\t\t\t\tnew_path[(n.abs % 6 )] = 1 \n\t\t\tend\n\t\t\t\n\n\t\t\ti += 1\n\t\tend\n\t\ti = 0\n\t\t\n\t\twhile i < @count_rule\n\t\t\t#puts \"count_rule: #{@count_real_rule}\"\n\t\t\n\t\t\tif new_path == @rule_status[i]\n\t\t\t\treturn i\n\t\t\tend\n\t\t\t\n\t\t\ti += 1\n \t\tend\n \t\tif (@count_real_rule == @count_rule)\n \t\t\treturn 8\n \t\telse\n\t\t\t@rule_status[@count_real_rule] = new_path \n\t\t\t@count_real_rule += 1\n\t\t\tcheck_condition\n\t\tend\n\tend", "def check_locations\n loc=0\n @compiled_definitions.each do |d|\n puts \"double-checking compiled location of #{d.definition.name}\" if Rake.verbose == true\n if d.definition.primitive?\n puts \"skipping primitive\" if Rake.verbose == true\n next\n end\n if loc != d.location\n raise \"unmatched location for '#{d.definition.name}': counted #{loc}, expected #{d.location}!\"\n end\n loc += d.code.length\n end\n end", "def validate_refspec\n begin\n valid_git_refspec_path?(explicit_refspec)\n rescue => e\n errors.add(:explicit_refspec, e.message)\n end\n end", "def validate_name_parts\n name_part_types.each do |type|\n next if send \"valid_#{type}?\"\n errors.add type, \"valid #{type} required\"\n end\nend", "def outside_path?(param)\n outside_addresses = [\n \"/login\",\n \"/signup\",\n \"/\" # equivalent to /login\n ]\n outside_addresses.any?{ |path| path == param }\n end", "def valid_for_part?(part)\n sym = part.to_sym\n raise ArgumentError, \"Invalid application part given: #{sym} isn't one of #{PARTS.keys}\" unless PARTS.keys.include?(sym)\n valid?\n self.errors.keys.none?{|k| PARTS[sym].include?(k)}\n end", "def external_constant?(const)\n sources = object_sources(const)\n # consider methodless constants not external\n return false if sources.empty?\n !sources.any?{ |source| source.start_with?(Padrino.root) }\n end", "def cltn_path?( path )\n path.split( \"|\" ).size == 4\n end", "def check_path(param)\n return param # unless Nanotek::UriFilter.new(param).has_path?\n end", "def bt_scope_constraint_violation?\n bt_history(*bt_coerce_slice(vtstart_at, vtend_at, ttstart_at)).exists?\n end", "def validate params\n validate_params(params)\n validate_dimension\n end" ]
[ "0.65460366", "0.58346784", "0.5795345", "0.5731851", "0.5427144", "0.51436055", "0.5097625", "0.50944304", "0.5082766", "0.50675106", "0.5052496", "0.5017125", "0.5006043", "0.5006043", "0.500037", "0.49975845", "0.49315766", "0.49291685", "0.4901817", "0.48924834", "0.4865511", "0.48568314", "0.47854286", "0.4784802", "0.47812927", "0.47756684", "0.4766851", "0.47636494", "0.47487238", "0.47459614", "0.47455972", "0.47406694", "0.4729702", "0.4712221", "0.46989673", "0.46794653", "0.46790108", "0.46774393", "0.46737388", "0.46689224", "0.46538988", "0.4651927", "0.4648157", "0.4641772", "0.463386", "0.46336517", "0.46299767", "0.46260992", "0.46058682", "0.4597663", "0.4594826", "0.45876426", "0.45848495", "0.45794716", "0.45736828", "0.45662528", "0.45617256", "0.45535105", "0.45490798", "0.45487478", "0.4535557", "0.45320734", "0.45269763", "0.45265788", "0.45072496", "0.4504577", "0.44973245", "0.4496925", "0.4485388", "0.44816282", "0.44816282", "0.44729918", "0.44703823", "0.446861", "0.44633344", "0.44619924", "0.44560996", "0.44532415", "0.44478503", "0.44335952", "0.44315332", "0.44315332", "0.440645", "0.43984735", "0.43980917", "0.4392812", "0.43874443", "0.4382768", "0.43827087", "0.43719885", "0.43715572", "0.43710297", "0.43659747", "0.43570417", "0.43523374", "0.4349689", "0.43488544", "0.4348074", "0.4345432", "0.43427122" ]
0.6109865
1
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/attachments/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n 'uploads'\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end", "def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n path = \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n if Rails.env.staging? or Rails.env.production?\n \"#{APP_CONFIG['deploy_path']}#{APP_CONFIG['seed_storage']}/#{path}\"\n else\n path\n end\n end", "def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end", "def store_dir\n \"uploads/photos\"\n end", "def store_dir\n \"uploads/imports/\"\n end", "def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/\"\n end", "def store_dir\n \"#{Rails.root}/public/uploads/\"\n end", "def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n #{}\"/home/bjarzab/www/pola2019_storage/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n # \"/mnt/cloud_test/files/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n \"#{Rails.application.secrets[:carrierwave_store_dir]}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend", "def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def storage_dir\n File.join(thirdpartydir,\"storage\")\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}_#{mounted_as.to_s.pluralize}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end" ]
[ "0.7506556", "0.7366542", "0.73328435", "0.73327684", "0.73038065", "0.7298899", "0.7278492", "0.7278492", "0.7278492", "0.72696203", "0.7245164", "0.72298074", "0.7226038", "0.7202023", "0.718703", "0.7179372", "0.7165151", "0.7150369", "0.7150369", "0.7150369", "0.7150369", "0.7150369", "0.71381253", "0.7133993", "0.7132227", "0.7128524", "0.71165615", "0.71165615", "0.71164846", "0.7115366", "0.711136", "0.7107186", "0.7102013", "0.7101324", "0.7101324", "0.70730436", "0.7072272", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917", "0.7071917" ]
0.0
-1
Return the character as a String object
def char self.class.codepoint2char(@codepoint) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getChar(c)\n c.chr\nend", "def getChar(c)\n c.chr\nend", "def char\n\t\t\t\t@char\n\t\t\tend", "def encode_character(char)\n if @@has_ord ||= char.respond_to?(:ord)\n char.ord.to_s\n else\n char[0]\n end\n end", "def to_s\n st = @char\n node = self\n while node != nil\n node = node.up\n break if node==nil\n st = node.char+st\n end\n st\n end", "def character=(value)\n @character = value.to_s\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 to_s\n if SUIT_UNICODE_OK \n return self.unicode\n else\n return self.symbol\n end \n end", "def chr(character)\n character.chr unless character.nil?\n end", "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 to_s\n \"Node: character=#{@character}\"\n end", "def char\n self[@char]\n end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def utf8_character\n character.chr(Encoding::UTF_8)\n end", "def char\n code ? [code].pack('U') : ' '\n end", "def chr() 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 to_s\n @chars.join\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 to_s\n \"#{codepoint} (#{name})\"\n end", "def char\n if failure?\n FAILURE_CHAR\n else\n ERROR_CHAR\n end\n end", "def current_char\n @current_char\n end", "def to_char(c)\n x = c / 100\n y = c % 100\n c = valid?(x, y) ? (0xA0 + x) * 0x100 + (0xA0 + y) : nil\n c.chr(@encoding).encode(Encoding::UTF_8) rescue (return nil)\n end", "def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end", "def get_char(attr); end", "def to_char(c)\n CHARSET.at(to_integer(c))\n end", "def text_repr\n return char if lexeme.nil?\n\n lexeme.dup\n end", "def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @value.slice(@[email protected])\n end\n \n temp_val\n end", "def get_character(input = T.unsafe(nil)); end", "def to_s\n letters\n end", "def to_char cp, action = :code_point\n elem = hash[__to_code_point(cp)]\n __to_char(elem[action].vacant? ? elem[:code_point] : elem[action])\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def encode_char char\n node = @root\n coding = \"\"\n\n # encode to 0 if only one character\n if [email protected]?\n return \"0\"\n end\n\n # we do a binary search, building the representation\n # of the character based on which branch we follow\n while node.val != char\n if node.right.val.include? char\n node = node.right\n coding += \"1\"\n else\n node = node.left\n coding += \"0\"\n end\n end\n coding\n end", "def letter\n case @letter\n when \"q\"\n return \"qu\"\n else\n return @letter\n end\n end", "def get_codepoint(character)\n \"%04x\" % character.unpack(\"U\")[0]\n end", "def bat\n return @character\n end", "def character\n fetch('dumb_and_dumber.characters')\n end", "def numToChar(number)\n return (number+65).chr\nend", "def to_s \n self.symbol\n end", "def to_s\n return self.symbol\n end", "def colored_char\n color(char)\n end", "def square_character(square_val)\n case square_val\n when :x, :o\n square_val.to_s.upcase\n else\n \" \"\n end\n end", "def getASCII(c)\n c.ord\nend", "def character(code_point_or_name)\n if code_point_or_name.is_a?(Symbol)\n found = Erector::CHARACTERS[code_point_or_name]\n if found.nil?\n raise \"Unrecognized character #{code_point_or_name}\"\n end\n raw(\"&#x#{sprintf '%x', found};\")\n elsif code_point_or_name.is_a?(Integer)\n raw(\"&#x#{sprintf '%x', code_point_or_name};\")\n else\n raise \"Unrecognized argument to character: #{code_point_or_name}\"\n end\n end", "def explain\n \"the character '#{to_str}'\"\n end", "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 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 parse_char(char)\n RUBY_VERSION > '1.9' ? char : char.chr\n end", "def initial\n chr\n end", "def unicode_chr(val)\n\t\t[val].inject('') {|s, cp| s << cp }\n\tend", "def colour_for(char)\n return '' if char.colour == @colour\n\n @colour = char.colour\n @colour.to_s\n end", "def rb2scm_char(char)\n ScmChar.new(char)\n end", "def get_char\n c = Curses.getch\n c if (0..255) === c.ord\n end", "def process_character( node )\n result = nil\n \n case node.type.name\n when \"general_character\"\n result = node.text.codepoints[0]\n \n when \"escape_sequence\"\n if @@escape_sequences.member?(node.text) then\n result = @@escape_sequences[node.text].codepoints[0]\n else\n result = node.text.codepoints[1]\n end\n \n when \"unicode_sequence\"\n result = node.text.slice(2..-1).to_i(16)\n\n else\n nyi( \"support for node type [#{node.type}]\", node )\n end\n \n return result\n end", "def name\n UnicodeUtils.char_name(@int)\n end", "def character\n fetch('ghostbusters.characters')\n end", "def mysqlchar\n foo='CHAR('\n foo += self.asciime + ')'\n return foo\n end", "def nextchar\n c = self.more?() ? @source[@index,1] : \"\\0\"\n @index += 1\n return(c)\n end", "def to_char(x, y)\n \"#{char_mapping.key(x).upcase}#{y}\"\n end", "def to_s\n to_symbol.to_s\n end", "def get_unicode_of(character)\n character.unpack('U*').first.to_s(16).rjust(4, '0').upcase\nend", "def to_s\n \"#{symbol}\"\n end", "def to_char(color = false)\n if success?\n color ? \"\\e[32m.\\e[0m\" : '.'\n else\n color ? \"\\e[33mI\\e[0m\" : 'I'\n end\n end", "def to_s\n @int.chr(Encoding::UTF_8)\n end", "def rchar\n\t\t\tcase status\n\t\t\twhen :new\n\t\t\t\t'N'\n\t\t\twhen :old\n\t\t\t\t'O'\n\t\t\twhen :range\n\t\t\t\t'@'\n\t\t\twhen :ins\n\t\t\t\t'i'\n\t\t\twhen :del\n\t\t\t\t'd'\n\t\t\twhen :other\n\t\t\t\t'_'\n\t\t\tend\n\t\tend", "def string\n @string ||= input.to_str[offset, length]\n end", "def to_s\n format_chars.join\n end", "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 output_letter\r\n a = @deck.first\r\n a = 53 if a.instance_of? String\r\n output = @deck[a]\r\n if output.instance_of? String\r\n nil\r\n else\r\n output -= 26 if output > 26\r\n (output + 64).chr\r\n end\r\n end", "def string() end", "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 band_char\n (@band+65).chr\n end", "def String(p0) end", "def char_at(off)\n if off.abs >= @length\n return \"\"\n end\n off = (off + @length) % @length\n if isleaf(self)\n return str.slice(off,1)\n elsif off < left.length\n return @left.char_at(off)\n else \n return @right.char_at([email protected])\n end\n end", "def string\n chars.map {|x| \"%0.2x\" % x }.join(':')\n end", "def oraclechar\n foo=[]\n self.asciime.split(',').each {|chr| foo << \"CHR(#{chr})\" }\n foo.join('||')\n end", "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 encode_char(char, safe_chars = {})\n return char if safe_chars[char]\n\n code = char.ord\n hex = hex_for_non_alphanumeric_code(code)\n return char if hex.nil?\n\n hex = REPLACEMENT_HEX if NON_PRINTABLE_CHARS[code]\n\n if entity = HTML_ENTITIES[code] # rubocop:disable Lint/AssignmentInCondition\n \"&#{entity};\"\n else\n \"&#x#{hex};\"\n end\n end" ]
[ "0.75101787", "0.75101787", "0.7181099", "0.7163236", "0.71493226", "0.7035988", "0.70131576", "0.6958647", "0.693191", "0.6887989", "0.6882716", "0.6833814", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.683135", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.6831304", "0.68020505", "0.67589", "0.6725512", "0.67184764", "0.663569", "0.66014856", "0.65901345", "0.65105516", "0.6507503", "0.6489257", "0.6473104", "0.6465589", "0.6437216", "0.6400441", "0.63859904", "0.6361984", "0.63492435", "0.6338563", "0.6336556", "0.6336556", "0.6336556", "0.6336556", "0.6334698", "0.6331373", "0.63279504", "0.6313487", "0.63040847", "0.62852407", "0.62758493", "0.6275446", "0.62578315", "0.62476015", "0.6246131", "0.62460625", "0.62358814", "0.62153673", "0.62008005", "0.6196057", "0.61878324", "0.61821455", "0.6178227", "0.6178026", "0.61714846", "0.6150196", "0.61466664", "0.60891616", "0.60779685", "0.60721344", "0.6062971", "0.60503805", "0.60436445", "0.6032725", "0.6017772", "0.6012351", "0.60122305", "0.6010609", "0.59963936", "0.5980987", "0.5974708", "0.5956639", "0.59541667", "0.59541667", "0.5949865", "0.5940444", "0.5939114", "0.59376854", "0.592804", "0.59270287", "0.59182286" ]
0.7117789
5
Returns true iff this Character and parameter 'another' represent the same character. [another] any Object. The way the equality is tested depends on the another's class Example: newOne = Character.new(?\u03a3) newOne == newOne true. Identity newOne == Character.new(?\u03a3) true. Both have same codepoint newOne == ?\u03a3 true. The single character String match exactly the char attribute. newOne == 0x03a3 true. The Integer is compared to the codepoint value. Will test equality with any Object that knows the to_s method
def ==(other) case other when Character to_str == other.to_str when Integer codepoint == other when String other.size > 1 ? false : to_str == other else # Unknown type: try with a convertion self == other.to_s # Recursive call end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n @chars == other.chars\n end", "def == other\n return false if other.class != self.class\n return false if other.length != self.length\n len = self.length\n while(len > 0)\n return false if self.get_char(len) != other.get_char(len)\n len = len - 1\n end\n return true\n end", "def ==(other)\n String.new(self) == other or super\n end", "def ==(other)\n case other\n when String then other == to_s\n when Symbol then other == symbol\n else super\n end\n end", "def is_equal_to_utf8cstring(a,b)\n JavaScriptCore::Lib.JSStringIsEqualToUTF8CString(a,b)\n end", "def ==(other)\n if other.class == String\n self.decoded == other\n else\n super\n end\n end", "def ==(other)\n self.canonicalize.to_s == other.canonicalize.to_s\n end", "def ===(other)\n return to_str === other.to_str if other.respond_to?(:to_str)\n super\n end", "def ==(other)\n self.to_s == other.to_s\n end", "def ==(other)\n to_hex == other.to_hex\n end", "def==(other)\r\n to_s==other.to_s\r\n end", "def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::Time\n return super unless other.valid?\n # Compare as strings, as time includes a date portion, and adjusting for UTC\n # can create a mismatch in the date portion.\n self.object.new_offset.strftime('%H%M%S.%L') == other.object.new_offset.strftime('%H%M%S.%L')\n when Literal::DateTime, Literal::Date\n false\n else\n super\n end\n end", "def ==(other)\n case other\n when Literal\n self.value.eql?(other.value) &&\n self.language.eql?(other.language) &&\n self.datatype.eql?(other.datatype)\n when String\n self.plain? && self.value.eql?(other)\n else false\n end\n end", "def eql?(other)\n self.to_cdfa <=> other.to_cdfa\n end", "def ==(other)\n other.is_a?(Symbol) && to_s == other.to_s\n end", "def ===(other)\n case other\n when Regexp then other === to_s\n else self == other\n end\n end", "def ==(other)\n @tc_string == other.tc_string\n end", "def eql?(another)\n self.to_hash == another.to_hash\n end", "def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::Date\n return super unless other.valid?\n self.object == other.object\n when Literal::Time, Literal::DateTime\n false\n else\n super\n end\n end", "def ==(other)\n to_s == other.to_s\n end", "def ==(other)\n to_s == other.to_s\n end", "def ==(other)\n to_s == other.to_s\n end", "def ==(other)\n to_s == other.to_s\n end", "def ==(other)\n to_s == other.to_s\n end", "def === other\n self.to_sym === other.to_sym || super(other)\n end", "def eql?(c)\n self == c\n end", "def ==(other)\n # If lexically invalid, use regular literal testing\n return super unless self.valid?\n\n case other\n when Literal::DateTime\n return super unless other.valid?\n self.object == other.object\n when Literal::Time, Literal::Date\n false\n else\n super\n end\n end", "def eql?(other)\n other.is_a?(String) ? text == other : super\n end", "def ==(other)\n if other.respond_to? :raw\n return self.raw.chomp == other.raw.chomp\n elsif other.respond_to? :to_str\n self.trail == other.to_str\n else\n raise TypeError, \"no implicit conversion of #{other.class} into String\"\n end\n end", "def ==(other)\n code_name == other.code_name && display_name == other.display_name && database_encoding == other.database_encoding\n end", "def ==(other)\n @glyph == other.glyph &&\n @fore_color == other.fore_color &&\n @back_color == other.back_color\n rescue NoMethodError\n false\n end", "def ==(other)\n str == other\n end", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n text == other.text &&\n font_name == other.font_name &&\n font_size == other.font_size &&\n bold == other.bold &&\n italic == other.italic &&\n color == other.color &&\n width == other.width &&\n height == other.height &&\n top == other.top &&\n left == other.left &&\n rotation_angle == other.rotation_angle &&\n transparency == other.transparency &&\n background == other.background &&\n image == other.image &&\n auto_align == other.auto_align\n end", "def ==(other)\n case other\n when Symbol\n self.to_sym == convert_to_snake_case_symbol(other)\n when String\n self.to_sym == convert_to_snake_case_symbol(other)\n when Numeric\n self.to_i == other.to_i\n else\n if other.kind_of?(Ably::Modules::Enum::Base)\n self.to_sym == other.to_sym\n end\n end\n end", "def==(other)\n to_s==other.to_s\n end", "def ==(another)\n self.to_hash == another.to_hash\n end", "def eql?(ct)\n self == ct\n end", "def ==(other)\n return false unless other.respond_to?(:encoded)\n\n if self.message_id && other.message_id\n self.encoded == other.encoded\n else\n self_message_id, other_message_id = self.message_id, other.message_id\n begin\n self.message_id, other.message_id = '<temp@test>', '<temp@test>'\n self.encoded == other.encoded\n ensure\n self.message_id, other.message_id = self_message_id, other_message_id\n end\n end\n end", "def ==(other)\n self.symbol == other.symbol \n end", "def ==( other )\n\t\tto_s == other.to_s\n\tend", "def eql?(other)\n self == (other)\n end", "def eql?(other)\n to_s == other.to_s\n end", "def ==(other)\n self.to_s == other.to_s\n end", "def =~(other)\n String.new(self) =~ other\n end", "def ==(other)\n (other.equal?(self)) ||\n # This option should be deprecated\n (other.is_a?(String) && other == self.to_s) ||\n (other.is_a?(Answer) && other.to_s == self.to_s)\n end", "def ===(other)\n Module.nesting[1].key_of_type?(other, :align, String)\n end", "def == other\n to_s == other.to_s\n end", "def ==(other)\n case other\n when Literal\n # If other is a Literal, reverse test to consolodate complex type checking logic\n other == self\n when String then to_s == other\n when URI then hash == other.hash && to_s == other.to_s\n else other.respond_to?(:to_uri) && to_s == other.to_uri.to_s\n end\n end", "def ==(other) #:nodoc:\n # another column\n if other.respond_to?(:name) && other.class == self.class\n name == other.name.to_sym\n elsif other.is_a? Symbol\n name == other\n elsif other.is_a? String\n name.to_s == other # avoid creating new symbols\n else # unknown\n eql? other\n end\n end", "def ==(other)\n if other.is_a?(Cue)\n self.data = other.data\n else\n false\n end\n end", "def ==(other)\n if other.is_a?(Code)\n other_lines = other.instance_variable_get(:@lines)\n @lines.each_with_index.all? { |loc, i| loc == other_lines[i] }\n else\n to_s.chomp == other.to_s.chomp\n end\n end", "def == other\n return false if other == nil\n if other.is_a?(Universa::HashId)\n super\n else\n if other.size == 96\n bytes == other\n else\n to_s == other\n end\n end\n end", "def _rl_compare_chars(buf1, pos1, buf2, pos2)\r\n return false if buf1[pos1].nil? || buf2[pos2].nil?\r\n case @encoding\r\n when 'E'\r\n buf1[pos1..-1].scan(/./me)[0] == buf2[pos2..-1].scan(/./me)[0]\r\n when 'S'\r\n buf1[pos1..-1].scan(/./ms)[0] == buf2[pos2..-1].scan(/./ms)[0]\r\n when 'U'\r\n buf1[pos1..-1].scan(/./mu)[0] == buf2[pos2..-1].scan(/./mu)[0]\r\n when 'X'\r\n buf1[pos1..-1].force_encoding(@encoding_name)[0] == buf2[pos2..-1].force_encoding(@encoding_name)[0]\r\n else\r\n buf1[pos1] == buf2[pos2]\r\n end\r\n end", "def eql?(anOther)\n\t\tself == anOther\n\tend", "def ==(other)\n if other.is_a?(Numeric)\n id == other\n elsif other.is_a?(String)\n send( self.class.unique_string_field ).to_s.downcase == other.downcase\n elsif other.is_a?(Symbol)\n [\n other.to_s.downcase,\n other.to_s.humanize.downcase\n ].include?(send( self.class.unique_string_field ).to_s.downcase)\n elsif other.is_a?(self.class)\n id == other.id\n else\n other = self.class.get(other)\n other && id == other.id\n end\n end", "def testing(char)\n p \"Character: #{char} (char.ord == #{char.ord}) (char.ord.chr == #{char.ord.chr}\"\n char.ord.chr == char\nend", "def == other\n if other.is_a?(Symbol) \n self.name == other\n else\n super other\n end\n end", "def ==(other)\n return false unless other.instance_of?(self.class)\n clxn == other.send(:clxn)\n end", "def ==(other)\n case other\n when Osgb::Point\n other = other.transform_to(self.datum) unless other.datum == self.datum\n self.lat == other.lat && self.lng == other.lng && self.datum == other.datum\n when Array\n self.to_a == other\n when String\n self == other.to_latlng(:datum => self.datum) # serves to normalise string representation\n end\n end", "def ==(other)\n @hashed == other.hash && @downcase_key == other.downcase_key\n end", "def == other\n\t\tstring == other.string\n\tend", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n link == other.link &&\n font == other.font &&\n built_in == other.built_in &&\n next_paragraph_style_name == other.next_paragraph_style_name &&\n base_style_name == other.base_style_name &&\n is_quick_style == other.is_quick_style &&\n linked_style_name == other.linked_style_name &&\n type == other.type &&\n is_heading == other.is_heading &&\n aliases == other.aliases &&\n style_identifier == other.style_identifier &&\n name == other.name\n end", "def ==(another_code)\n self.length == another_code.length && self.num_exact_matches(another_code) == self.length\n end", "def eql_with_coercion(other)\n # if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do eql? comparison\n other = other.comparable_time if other.respond_to?(:comparable_time)\n eql_without_coercion(other)\n end", "def == other\n other.is_a?( Column ) &&\n name == other.name &&\n canonic_type == other.canonic_type &&\n canonic_opts == other.canonic_opts\n end", "def eql?(other)\n self.class == other.class && self == other\n end", "def ==(other)\n if other.is_a?(Code)\n @other_lines = other.instance_variable_get(:@lines)\n @lines.each_with_index.all? do |(l, ln), i|\n l == @other_lines[i].first && ln == @other_lines[i].last\n end\n else\n to_s.chomp == other.to_s.chomp\n end\n end", "def ==(other)\n # Must have an id to compare\n return false if id.nil?\n\n if other.is_a? SportsDataApi::Ncaamb::Team\n other.id && id === other.id\n elsif other.is_a? Symbol\n id.to_sym === other\n else\n super(other)\n end\n end", "def eql?(other)\n self.class == other.class and self == other\n end", "def ==(other)\n `#@native === #{other.to_n}`\n end", "def eql?(other)\n if equal?(other)\n return true\n end\n\n unless other.instance_of?(self.class)\n return false\n end\n\n cmp?(other, :eql?)\n end", "def ==(other)\n return true if self.equal?(other)\n self.class == other.class &&\n file_info == other.file_info &&\n output_path == other.output_path &&\n encoding == other.encoding &&\n recognize_lists == other.recognize_lists &&\n leading_spaces == other.leading_spaces &&\n trailing_spaces == other.trailing_spaces &&\n enable_pagination == other.enable_pagination\n end", "def ===(other)\n Module.nesting[1].key_of_type?(other, :font, Hash)\n end", "def eql?(other)\n if equal?(other)\n return true\n end\n\n unless other.kind_of?(self.class)\n return false\n end\n\n cmp?(other, :eql?)\n end", "def eql?(other)\n self.class == other.class && self == other\n end", "def eql?(other)\n self.class == other.class && self == other\n end", "def eql?(other)\n self.class == other.class && self == other\n end", "def eql?(other)\n self.class == other.class && self == other\n end", "def ==(something)\n something.class == self.class &&\n something.to_str == self.to_str\n end", "def ==(other)\n val = Color.parse(other)\n return false if val.nil?\n r == val.r && g == val.g && b == val.b && a == val.a\n end", "def ==(other)\n (@jiak.object == other.jiak.object) rescue false\n end", "def ==(other)\n return false unless other.is_a?(Annotation)\n entry.eql?(other.entry) && description.eql?(other.description)\n end", "def ==(ali)\n return true if self.to_s == ali.to_s\n false\n end", "def eql?(other)\n return true if equal?(other)\n instance_of?(other.class) && cmp?(other, :eql?)\n end", "def ===(other)\n other.is_a?(self)\n end", "def eql?(other)\n other.class == self.class && self == other\n end", "def ==(other)\n contents == other.contents && pos == other.pos && allowed == other.allowed\n end", "def eql?(other)\n other.is_a?(self.class) && self == other\n end", "def eql?(other)\n other.is_a?(self.class) && self == other\n end", "def ==(other)\n # Must have an id to compare\n return false if self.id.nil?\n\n if other.is_a? SportsDataApi::Nfl::Team\n return false if other.id.nil?\n self.id === other.id\n elsif other.is_a? Symbol\n self.id.to_sym === other\n else\n super(other)\n end\n end", "def equal?(c2)\n @color == c2.color && @fillType == c2.fillType && @shapeType == c2.shapeType && @numberOfSymbols == c2.numberOfSymbols\n end", "def == other\n string == other.string\n end", "def ==(something)\n something.class == self.class &&\n something.to_s == self.to_s\n end", "def ==(other)\n return false unless other.class == self.class\n\n return identity == other.identity\n end", "def ==(other)\n (other.class == self.class) && (other.to_der == self.to_der)\n end", "def ==(other)\n (other.class == self.class) && (other.to_der == self.to_der)\n end", "def __prim_equal_failed(other)\n # invoked from Smalltalk code in _rubyEqual<env>:\n if other.respond_to? :to_str\n other == self # per specs\n else\n false\n end\n end", "def ===(other)\n false\n end", "def eql?(other)\n if equal?(other)\n return true\n end\n\n unless instance_of?(other.class)\n return false\n end\n\n cmp?(other, :eql?)\n end", "def eql?(other)\n other.class == self.class\n end" ]
[ "0.6943716", "0.6668627", "0.6442764", "0.6422109", "0.62311393", "0.62067527", "0.61262053", "0.6059121", "0.60309345", "0.60091704", "0.5991544", "0.5970458", "0.5949894", "0.594892", "0.5912954", "0.59071624", "0.59060216", "0.5905413", "0.59013915", "0.5895077", "0.5895077", "0.5895077", "0.5895077", "0.5895077", "0.5893457", "0.58856636", "0.5884219", "0.5875633", "0.58664197", "0.5851331", "0.58505", "0.58498913", "0.5822028", "0.58215314", "0.5819602", "0.57815933", "0.5779799", "0.5778095", "0.57421184", "0.57417625", "0.57249045", "0.57238287", "0.57166696", "0.5716609", "0.57156855", "0.5714031", "0.57103586", "0.5706543", "0.5688054", "0.5666413", "0.566036", "0.56548536", "0.5651306", "0.5648207", "0.56386435", "0.56279993", "0.5623751", "0.56202275", "0.56075984", "0.5602625", "0.56025153", "0.559673", "0.5593513", "0.5589073", "0.5585715", "0.5570153", "0.5559003", "0.5546371", "0.5540926", "0.553951", "0.5531592", "0.5529386", "0.55278957", "0.5524516", "0.5513951", "0.5513951", "0.5513951", "0.5513951", "0.55119383", "0.55100584", "0.5503548", "0.5502896", "0.54989904", "0.5498884", "0.54943633", "0.5494081", "0.54926854", "0.5492066", "0.5492066", "0.5490998", "0.5483859", "0.5483095", "0.5477564", "0.54774576", "0.54703504", "0.54703504", "0.5470324", "0.5458223", "0.5454554", "0.5453735" ]
0.72048455
0
Return a plain English description of the character
def explain "the character '#{to_str}'" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_character_blah\n \n puts \"Name: #{name}\"\n puts \"Bio: #{description}\"\n end", "def heading\n\t\t\"Character Descriptors\"\n\tend", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def single_character_display\n SINGLE_CHARACTER\n end", "def description; @text; end", "def description\n if powered?\n separator = @description.include?('|') ? ' ' : '|'\n @description + separator + '\\c[14]' + @power_description\n else\n @description\n end\n end", "def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end", "def full_description\n\t\t\t\"#{@name}\\n\\nYou are in #{@description}\"\n\t\tend", "def char_description(character)\n\thtml = open(\"https://awoiaf.westeros.org/index.php/#{character}\")\n\tdoc = Nokogiri::HTML(html)\n\tif doc.css(\"div.hatnote:first-child\").empty? #|| doc.css(\".mw-parser-output .hatnote:nth-child(2)\").empty?\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(2)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\telse \n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Walder_Frey\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Viserys_Targaryen\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(3)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\n\tif character == \"Tywin_Lannister\"\n\t\tdescription = doc.css(\".mw-parser-output > p:nth-child(2)\").text.gsub!(/[^A-Za-z ,.]/,'')\n\tend\n\tdescription\nend", "def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end", "def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\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 display_char_info(char_hash)\n puts \"NAME: #{get_char_name(char_hash)}\"\n puts \"DESCRIPTION: \"\n puts \"#{get_char_desc(char_hash)}\"\n puts \"COMICS: \"\n get_char_comics(char_hash).each {|comic| puts comic}\n end", "def text_repr\n return char if lexeme.nil?\n\n lexeme.dup\n end", "def descr\n return text_get(2, id)\n end", "def short_description\n description\n end", "def output_word\n puts @displayed_character.join('')\n end", "def display_description\n @name.capitalize + \" stands here\" + ((item_for :weapon) ? (\", wielding \" + item_for(:weapon).short_display_string) : \"\") + \".\"\n end", "def description\n text_get(7, @id)\n end", "def description\n return $BlizzABS.util.add_weapon_text(@description, @id, 2)\n end", "def to_s\n descr\n end", "def character_details(character)\n puts \"\"\n puts \" Name: #{character.name}\"\n puts \" Nickname: #{character.nickname}\"\n puts \"Occupation: #{character.occupation}\"\n puts \" Status: #{character.status}\"\n puts \" Portrayed: #{character.portrayed}\"\n puts \" Image URL: #{character.img}\"\n puts \"\"\n end", "def title( text, char )\n print( ( char * 76 ) + \"\\n#{text}\\n\" + ( char * 76 ) + \"\\n\" )\n end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def description\n description = \"\"\n if @monster\n puts \"An evil #{@monster.monster} is here.\"\n else\n puts \"The room is eerily quite.\"\n end\n end", "def display\n encoded_asterisks, encoded_text = cmd('?FL', /^FL([0-9A-F]{2})([0-9A-F]{28})$/)\n return nil unless encoded_asterisks && encoded_text\n\n str = case encoded_asterisks\n when '00' then ' '\n when '01' then ' *'\n when '02' then '* '\n when '03' then '**'\n else; ''\n end\n\n return str + encoded_text.unpack('a2' * 14).map { |c| c.to_i(16).chr }.join\n end", "def description\n return @description\n end", "def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end", "def to_s; description end", "def description\n \"#{@number}, #{@symbol}, #{@color}, #{@shading}\"\n end", "def two_lines_description charity, style_class = :charity_details\n charity.name.length < 24 ? desc_chars = 90 : desc_chars = 72\n short_description(charity, desc_chars, style_class)\n end", "def description\n\n return @description\n\n end", "def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def text\n \"STRAT\"\n end", "def creation_title\n\t\t\"Create Character\"\n\tend", "def to_s\n \"The #{@name} Treasure is #{@description}\"\n end", "def character\n system(\"clear\")\n a = Artii::Base.new :font => 'slant'\n puts a.asciify('Fantasy Final')\n sleep(5)\n end", "def to_s\n\t\tdescription\n\tend", "def to_s\n\t\tdescription\n\tend", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def text_name\n put_together_name(:full).t.html_to_ascii\n end", "def description\n return $BlizzABS.util.add_skill_text(@description, @id, 2)\n end", "def çς\n \"Magnitude\"\n end", "def to_s\n \"#{codepoint} (#{name})\"\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def to_s\n \"The #{@name} Treasure is #{@description}\\n\"\n end", "def description\n @description = \"House Blend Coffee\"\n end", "def to_s\n \"The #{@name} Treasure is #{@description}\"\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end" ]
[ "0.7390016", "0.7165024", "0.6835023", "0.6835023", "0.6835023", "0.6835023", "0.68033504", "0.67663", "0.67331815", "0.65869164", "0.6559376", "0.648551", "0.64745843", "0.64554137", "0.6436214", "0.6385673", "0.6367864", "0.6365251", "0.6361676", "0.6352502", "0.63290614", "0.63193333", "0.63130844", "0.63106465", "0.6309659", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.6303078", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.63029027", "0.6290349", "0.6288066", "0.628525", "0.628469", "0.6283714", "0.6279994", "0.62518746", "0.6248164", "0.62186426", "0.6202597", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.6190948", "0.61868507", "0.61655533", "0.6162371", "0.6162317", "0.6157789", "0.6157789", "0.61523634", "0.61498845", "0.613289", "0.6130712", "0.6119157", "0.61151356", "0.61151356", "0.61151356", "0.61151356", "0.6111899", "0.61085415", "0.6102901", "0.6081131" ]
0.6760304
8
Conversion method redefinition. Purpose: Return the String representation of the expression. If the Character was initially from a text (the lexeme), then the lexeme is returned back. Otherwise the character corresponding to the codepoint is returned.
def text_repr return char if lexeme.nil? lexeme.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"#{codepoint} (#{name})\"\n end", "def char\n self.class.codepoint2char(@codepoint)\n end", "def to_s\n st = @char\n node = self\n while node != nil\n node = node.up\n break if node==nil\n st = node.char+st\n end\n st\n end", "def processChar(c)\n if @target == 'utf8'\n return LATEX_TO_UTF8[c]\n end\n if @target == 'html'\n return LATEX_TO_HTML_ENTITIES[c]\n end\n if @target == \"mc\"\n return LATEX_TO_MACRONS_CHARACTERS[c]\n end\n end", "def to_s\n if SUIT_UNICODE_OK \n return self.unicode\n else\n return self.symbol\n end \n end", "def lex_en_character=(_arg0); end", "def to_s\n @expression.to_s\n end", "def get_target_char_literal_from_antlrchar_literal(codegen, literal)\n c = Grammar.get_char_value_from_grammar_char_literal(literal)\n prefix = \"'\"\n if (codegen.attr_grammar.get_max_char_value > 255)\n prefix = \"L'\"\n else\n if (!((c & 0x80)).equal?(0))\n # if in char mode prevent sign extensions\n return \"\" + RJava.cast_to_string(c)\n end\n end\n return prefix + RJava.cast_to_string(escape_char(c)) + \"'\"\n end", "def process_character( node )\n result = nil\n \n case node.type.name\n when \"general_character\"\n result = node.text.codepoints[0]\n \n when \"escape_sequence\"\n if @@escape_sequences.member?(node.text) then\n result = @@escape_sequences[node.text].codepoints[0]\n else\n result = node.text.codepoints[1]\n end\n \n when \"unicode_sequence\"\n result = node.text.slice(2..-1).to_i(16)\n\n else\n nyi( \"support for node type [#{node.type}]\", node )\n end\n \n return result\n end", "def to_char cp, action = :code_point\n elem = hash[__to_code_point(cp)]\n __to_char(elem[action].vacant? ? elem[:code_point] : elem[action])\n end", "def character(code_point_or_name)\n if code_point_or_name.is_a?(Symbol)\n found = Erector::CHARACTERS[code_point_or_name]\n if found.nil?\n raise \"Unrecognized character #{code_point_or_name}\"\n end\n raw(\"&#x#{sprintf '%x', found};\")\n elsif code_point_or_name.is_a?(Integer)\n raw(\"&#x#{sprintf '%x', code_point_or_name};\")\n else\n raise \"Unrecognized argument to character: #{code_point_or_name}\"\n end\n end", "def to_s\n return super + \": '#{token.lexeme}'\"\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 explain\n \"the character '#{to_str}'\"\n end", "def on_call_string(context, expression = nil)\n if expression\n convert = process(expression, context)\n\n if convert.is_a?(XML::NodeSet)\n convert = convert[0]\n end\n else\n convert = context.first\n end\n\n if convert.respond_to?(:text)\n return convert.text\n else\n return to_string(convert)\n end\n end", "def get_codepoint(character)\n \"%04x\" % character.unpack(\"U\")[0]\n end", "def to_s\n \"√(#{@x})\"\n end", "def process_lit(exp)\n # TODO what about floats and big numbers?\n\n value = exp.shift\n c_type = exp.c_type\n case c_type\n when CType.long, CType.float then\n return value.to_s\n when CType.symbol then\n return value.to_s.inspect # HACK wrong! write test!\n else\n raise \"Bug! no: Unknown literal #{value}:#{value.class}\"\n end\n end", "def expr_eval_to_s\n if @last_eval_state.nil?\n return \"<unevaluated>\"\n end\n \n str = ''\n if @offset\n str << \"#{@offset < 0 ? '-' : ''}0x#{@offset.abs.to_s(16)}\"\n end\n \n if @last_eval_state[:special] || @last_eval_state[:register]\n if @offset\n str << '+'\n end\n if @last_eval_state[:special]\n str << @last_eval_state[:special_tok]\n elsif @last_eval_state[:register]\n str << @last_eval_state[:reg_tok]\n end \n end\n \n str\n end", "def to_s\n return @exp\n end", "def get_char\n @look = @expression[@number]\n @number +=1\nend", "def çς\n \"Magnitude\"\n end", "def to_s\n \"(#{@x})^(#{@y})\"\n end", "def format_ebnf_char(c)\n case c.ord\n when (0x21) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n when 0x22 then (@options[:html] ? %('<code class=\"grammar-literal\">&quot;</code>') : %{'\"'})\n when (0x23..0x7e) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n when (0x80..0xFFFD) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n else escape_ebnf_hex(c)\n end\n end", "def çς\n \"±Magnitude\"\n end", "def getChar(c)\n c.chr\nend", "def getChar(c)\n c.chr\nend", "def to_string(indentation)\n return super + \": '#{token.lexeme}'\"\n end", "def encode_character(char)\n if @@has_ord ||= char.respond_to?(:ord)\n char.ord.to_s\n else\n char[0]\n end\n end", "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 encode_char char\n node = @root\n coding = \"\"\n\n # encode to 0 if only one character\n if [email protected]?\n return \"0\"\n end\n\n # we do a binary search, building the representation\n # of the character based on which branch we follow\n while node.val != char\n if node.right.val.include? char\n node = node.right\n coding += \"1\"\n else\n node = node.left\n coding += \"0\"\n end\n end\n coding\n end", "def char\n code ? [code].pack('U') : ' '\n end", "def text_repr\n result_children = children.inject(+'') do |sub_result, child|\n if child.kind_of?(Regex::Character) && Metachars.include?(child.codepoint)\n sub_result << '\\\\' # Escape meta-character...\n end\n sub_result << child.to_str\n end\n \"[#{negated ? '^' : ''}#{result_children}]\"\n end", "def yy_unicode_s(char_code)\n \"U+#{\"%04X\" % char_code}\"\n end", "def exp_text\n @exp.to_s\n end", "def get_target_string_literal_from_antlrstring_literal(generator, literal)\n literal = RJava.cast_to_string(Utils.replace(literal, \"\\\"\", \"\\\\\\\"\"))\n buf = StringBuffer.new(literal)\n buf.set_char_at(0, Character.new(?\".ord))\n buf.set_char_at(literal.length - 1, Character.new(?\".ord))\n buf.insert(0, Character.new([email protected]))\n return buf.to_s\n end", "def to_s\n \"Node: character=#{@character}\"\n end", "def to_code\n \"(-#{@x.to_code})\"\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 to_s()\n result = \"@#{@text}\"\n if [email protected]?\n result << \".\"\n end\n @flags.each do |f|\n char = Token::FLAG_CHARACTER[f]\n if char == nil\n result << \"?\"\n else\n result << char\n end\n end\n result\n end", "def lex_en_interp_string; end", "def lex_en_interp_string; end", "def lex_en_interp_string; end", "def yy_displayed(string)\n if string.length == 1 then\n char = string[0]\n char_code = char.ord\n case char_code\n when 0x00...0x20, 0x2028, 0x2029 then %(#{yy_unicode_s char_code})\n when 0x20...0x80 then %(\"#{char}\")\n when 0x80...Float::INFINITY then %(\"#{char} (#{yy_unicode_s char_code})\")\n end\n else\n %(\"#{string}\")\n end\n end", "def format_abnf_char(c)\n if /[\\x20-\\x21\\x23-\\x7E]/.match?(c)\n @options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : c.inspect\n else\n escape_abnf_hex(c)\n end\n end", "def convert_escape_characters(text)\n result = rm_extender_convert_escape_characters(text).to_s.clone\n result.gsub!(/\\eL\\[\\:(\\w+)\\]/i) { L[$1.to_sym] }\n result.gsub!(/\\eSL\\[\\:(\\w+)\\]/i) { SL[$game_message.call_event, $1.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_i, $3.to_sym] }\n result.gsub!(/\\eSV\\[([^\\]]+)\\]/i) do\n numbers = $1.extract_numbers\n array = [*numbers]\n if numbers.length == 1\n array = [$game_message.call_event] + array\n end\n SV[*array]\n end\n return result\n end", "def expr_to_s\n buf = ''\n each_term do |term|\n if term[:operator]\n buf << term[:operator]\n end\n buf << term[:token]\n end\n buf\n end", "def unichr(code_point)\n [code_point].pack(\"U\")\n end", "def to_s\n return \"exp(#{self.arg.to_s})\"\n end", "def literal_char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 43)\n\n \n # - - - - main rule block - - - -\n # at line 491:2: ( ESC | ~ ( '\\\\'' | '\\\\\\\\' ) )\n alt_6 = 2\n look_6_0 = @input.peek(1)\n\n if (look_6_0 == ?\\\\) \n alt_6 = 1\n elsif (look_6_0.between?(0x0000, ?&) || look_6_0.between?(?(, ?[) || look_6_0.between?(?], 0xFFFF)) \n alt_6 = 2\n else\n nvae = NoViableAlternative(\"\", 6, 0)\n raise nvae\n end\n case alt_6\n when 1\n # at line 491:4: ESC\n esc!\n\n when 2\n # at line 492:4: ~ ( '\\\\'' | '\\\\\\\\' )\n if @input.peek(1).between?(0x0000, ?&) || @input.peek(1).between?(?(, ?[) || @input.peek(1).between?(?], 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 43)\n\n end", "def dif_x_c(c)\n if c.nil? || c == \"*1\" || c == \"/1\" || c == ''\n c = \"\"\n c_char = \"\"\n else\n c_char = c[0]\n c = eval(c[1,c.length-1]).to_s\n end\n [c, c_char]\n end", "def token_to_str(t); end", "def token_to_str(t); end", "def to_s\n\t\t\"()\"\n\tend", "def to_s\n @chars.join\n end", "def operand_to_plain_english(operand) \n \n if operand == \"+\"\n return \"plus\"\n elsif operand == \"-\"\n return \"minus\"\n elsif operand ==\"*\"\n return \"times\"\n else operand == \"/\"\n return \"divided by\"\n end\n end", "def to_s \n self.symbol\n end", "def lisp_string\n e = self\n result = \"(\" \n while e\n if e.class != Cons\n result << \". \" << e.lisp_string\n e = nil\n else\n result << car(e).lisp_string\n e = cdr(e)\n result << \" \" if e\n end\n end\n result << \")\" \n result\n end", "def char_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 41)\n\n type = CHAR_LITERAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 482:4: '\\\\'' LITERAL_CHAR '\\\\''\n match(?\\')\n literal_char!\n match(?\\')\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 41)\n\n end", "def to_code\n \"(#{@x.to_code}).abs\"\n end", "def to_s\n operator_string + \" \" + @expression.to_s\n end", "def String(p0) end", "def char_to_codepoint(c)\n codepoint = charset.index c\n if codepoint.nil?\n fail NotInCharset, \"Char \\\"#{c}\\\" not part of the supported charset\"\n end\n codepoint\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 to_text(single_pos)\t\n\t\t\t\t\tcase single_pos\n\t\t\t\t\t\twhen 0\n\t \t\tsingle_pos =\"A\"\n\t \t\twhen 1\n\t \t\tsingle_pos =\"B\"\n\t \t\twhen 2\n\t \t\t\tsingle_pos =\"C\"\n\t \t\twhen 3\n\t \t\tsingle_pos =\"D\"\n\t \t\twhen 4\n\t \t\tsingle_pos =\"E\"\n\t \t\twhen 5\n\t \t\tsingle_pos =\"F\"\n\t \t\twhen 6\n\t \t\tsingle_pos =\"G\"\n\t \t\twhen 7\n\t \t\tsingle_pos =\"H\"\n\t \tend\n\t \t\t\treturn single_pos\n\tend", "def char\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n\n return_value = CharReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __COMILLA321__ = nil\n set322 = nil\n __COMILLA323__ = nil\n\n\n tree_for_COMILLA321 = nil\n tree_for_set322 = nil\n tree_for_COMILLA323 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 569:10: COMILLA ( EscapeSequence |~ ( '\\\\'' | '\\\\\\\\' ) ) COMILLA\n __COMILLA321__ = match( COMILLA, TOKENS_FOLLOWING_COMILLA_IN_char_2781 )\n if @state.backtracking == 0\n tree_for_COMILLA321 = @adaptor.create_with_payload( __COMILLA321__ )\n @adaptor.add_child( root_0, tree_for_COMILLA321 )\n\n end\n\n\n set322 = @input.look\n\n if @input.peek( 1 ).between?( ASIGNACION, COMA ) || @input.peek( 1 ).between?( CORDER, WS ) || @input.peek( 1 ).between?( T__81, T__82 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set322 ) )\n end\n\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n __COMILLA323__ = match( COMILLA, TOKENS_FOLLOWING_COMILLA_IN_char_2798 )\n if @state.backtracking == 0\n tree_for_COMILLA323 = @adaptor.create_with_payload( __COMILLA323__ )\n @adaptor.add_child( root_0, tree_for_COMILLA323 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n\n end\n\n return return_value\n end", "def rb2scm_char(char)\n ScmChar.new(char)\n end", "def letter\n case @letter\n when \"q\"\n return \"qu\"\n else\n return @letter\n end\n end", "def to_code\n \"(#{@x.map(&:to_code).join(\" * \")})\"\n end", "def char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n\n\n type = CHAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 203:5: '\\\\'' . '\\\\''\n match( 0x27 )\n match_any\n match( 0x27 )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n\n end", "def encode_char(immune,input)\n return input if immune.include?(input)\n return input if hex(input).nil?\n return \"#{@escape_char}#{input}\"\n end", "def to_text(element, default)\n begin\n return @iconv.iconv(element.content + ' ')[0..-2]\n rescue\n Rails.logger.debug \"return #{default}\"\n return default\n end\n end", "def to_s; \"<Operand: #{to_source}>\"; end", "def to_s\n return self.symbol\n end", "def string\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n return_value = StringReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 190:11: ( ESC | ~ ( '\\\\\\\\' | QUOTE | '\\\\'' ) | '\\\\'' )*\n # at line 190:11: ( ESC | ~ ( '\\\\\\\\' | QUOTE | '\\\\'' ) | '\\\\'' )*\n while true # decision 45\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0.between?( CATEGORY_KEY, EQUALS ) || look_45_0.between?( CLASS, UNDERSCORE ) || look_45_0.between?( PLUS, T__52 ) )\n alt_45 = 1\n\n end\n case alt_45\n when 1\n # at line \n if @input.peek( 1 ).between?( CATEGORY_KEY, EQUALS ) || @input.peek( 1 ).between?( CLASS, UNDERSCORE ) || @input.peek( 1 ).between?( PLUS, T__52 )\n @input.consume\n @state.error_recovery = false\n else\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 45\n end\n end # loop for decision 45\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end\n \n return return_value\n end", "def expression_from(node)\n case node\n when Parser::AST::Node\n children_expression = node.children.map(&method(:expression_from)).join(' ')\n \"(#{node.type}#{' ' + children_expression if node.children.any?})\"\n when nil, 'nil'\n 'nil'\n when Symbol, String, Numeric\n '_'\n end\n end", "def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @value.slice(@[email protected])\n end\n \n temp_val\n end", "def to_s\r\n @code.to_s.upcase\r\n end", "def current_char\n @current_char\n end", "def to_s\n word.to_s\n end", "def to_code\n \"(#{@x.map(&:to_code).join(\" + \")})\"\n end", "def char_at(off)\n if off.abs >= @length\n return \"\"\n end\n off = (off + @length) % @length\n if isleaf(self)\n return str.slice(off,1)\n elsif off < left.length\n return @left.char_at(off)\n else \n return @right.char_at([email protected])\n end\n end", "def to_s\n @literal\n end", "def to_code\n \"#{@x}\"\n end", "def square_character(square_val)\n case square_val\n when :x, :o\n square_val.to_s.upcase\n else\n \" \"\n end\n end", "def chr() end", "def char\n if failure?\n FAILURE_CHAR\n else\n ERROR_CHAR\n end\n end", "def to_s\n text.to_s\n end", "def to_char(c)\n CHARSET.at(to_integer(c))\n end", "def colour_for(char)\n return '' if char.colour == @colour\n\n @colour = char.colour\n @colour.to_s\n end", "def decode_char(input)\n # check first *char*\n input.mark\n first = input.next\n if first.nil?\n input.reset\n return nil\n end\n # if it isnt an encoded string return nil\n unless first == \"\\'\"\n input.reset\n return nil\n end\n # if second isnt an encoded marker return nil\n second = input.next\n unless second == \"\\'\"\n input.reset\n return nil\n end\n return \"\\'\"\n end", "def get_text\n text = ''\n sep = ''\n @lexemes.each { |lexeme|\n if lexeme == '.'\n text << lexeme\n sep = ''\n else\n text << sep\n text << lexeme\n sep = ' '\n end\n }\n\t@lexemes = []\n text\n end", "def to_code\n \"(#{@x.to_code} ** #{@y.to_code})\"\n end", "def to_code\n \"(#{@x.to_code} - #{@y.to_code})\"\n end", "def xp(s)\n begin\n puts s+\" #=>\"\n p eval(s)\n rescue\n puts $!\n end\n puts\nend", "def to_s\n if Prefix===prefix\n s = symbol ? \"#{prefix.symbol}#{symbol}\" : \"#{prefix.name}#{term})\"\n else\n s = symbol ? \"#{symbol}\" : \"#{term}\"\n end\n if power != 1\n s = s + (power > 0 ? \"^#{power}\" : \"#{power}\")\n end\n s\n end", "def oraclechar\n foo=[]\n self.asciime.split(',').each {|chr| foo << \"CHR(#{chr})\" }\n foo.join('||')\n end", "def character; end", "def character; end", "def character; end" ]
[ "0.6309289", "0.61352676", "0.6098375", "0.6049587", "0.59985626", "0.59505546", "0.5932142", "0.5926827", "0.58122015", "0.580636", "0.57612324", "0.573509", "0.5618381", "0.5583484", "0.55728465", "0.5539008", "0.5532029", "0.5504268", "0.55022615", "0.549673", "0.54804665", "0.5443367", "0.5429069", "0.54072684", "0.5390489", "0.53849125", "0.53849125", "0.5370567", "0.53697836", "0.5368346", "0.53444004", "0.5339651", "0.5338496", "0.5293612", "0.5285173", "0.52829385", "0.5266642", "0.522985", "0.52115154", "0.5203148", "0.52024585", "0.52024585", "0.52024585", "0.5190464", "0.51858324", "0.51720065", "0.51559275", "0.5153463", "0.5150922", "0.51493907", "0.5147928", "0.514658", "0.514658", "0.51414424", "0.5133278", "0.5126312", "0.511928", "0.5117572", "0.51172346", "0.51114404", "0.5095305", "0.50735813", "0.50692135", "0.50668275", "0.50646186", "0.5063889", "0.5059791", "0.5057457", "0.50487465", "0.50365824", "0.5035686", "0.50323796", "0.5030134", "0.50279737", "0.5027012", "0.5012834", "0.5010882", "0.50063735", "0.50034016", "0.50032026", "0.50017995", "0.50005573", "0.49994364", "0.49902883", "0.4980962", "0.49794737", "0.49710536", "0.49706748", "0.49654597", "0.49583068", "0.49549296", "0.4954691", "0.4950109", "0.49491766", "0.49385762", "0.4937882", "0.4936682", "0.4933721", "0.4933721", "0.4933721" ]
0.74494576
0
GET /dealers GET /dealers.json
def index if current_user.admin? @dealers = Dealer.all else redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dealers = Dealer.all\n end", "def index\n @dealers = Dealer.all\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def show\n # @deal = Deal.find(params[:id], :include => [:retailer, :advertiser, {:retailer => :account}] )\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end", "def show\n @rateddeal = Rateddeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rateddeal }\n end\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @redeemed_deal = RedeemedDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @redeemed_deal }\n end\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def show\n @insider_deal = InsiderDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @insider_deal }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show_deal(id)\n get(\"deals/#{id}\")\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def show\n @caterer = Caterer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caterer }\n end\n end", "def index\n render json: Seller.all\n end", "def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def index\n @dealerships = Dealership.all\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def show\n @deed = Deed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deed }\n end\n end", "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end", "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end", "def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end", "def show\n render json: @adopter\n end", "def index\n @advertisements = Advertisement.where(merchant_id: params[:merchant_id])\n\n render json: @advertisements\n end", "def index\n @offerers = Offerer.all\n end", "def index\n @debaters = Debater.all\n end", "def deals\n if params[:range] == \"10000000\"\n ts_deals = Deal.filtered_url_search(\n :category => params[:category] == \"all\" ? nil : params[:category],\n :query => params[:q],\n :lat => params[:lat],\n :lon => params[:long],\n :range => params[:range] || Deal::MAX_RANGE,\n :age => Deal::MAX_AGE.days,\n :page => params[:page])\n else\n ts_deals = Deal.filtered_search(\n :category => params[:category] == \"all\" ? nil : params[:category],\n :query => params[:q],\n :lat => params[:lat],\n :lon => params[:long],\n :range => params[:range] || Deal::MAX_RANGE,\n :age => Deal::MAX_AGE.days,\n :page => params[:page])\n end\n \n @deals = Array.new\n ts_deals.map do |deal|\n if deal.hidden == false\n @deals.push deal\n end\n end\n \n puts \"SEARCH DEAL COUNT:#{@deals.count}\"\n options = { :minimal => true }\n options[:current_user] = current_user if current_user\n render :json => @deals.compact.as_json(options)\n end", "def index\n @advertises = Advertise.all\n render 'index', formats: 'json', handlers: 'jbuilder'\n end", "def show\n # @retailer = Retailer.find(params[:id], :include => [:deals, :advertisements, :account] )\n respond_to do |format|\n format.html # show.html.erb\n format.json # show.json.rabl\n end\n end", "def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end", "def show\n @farmer = Farmer.find(params[:id])\n\t\t@dispensals = @farmer.dispensals.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n\t\t@donations = @farmer.donations.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farmer }\n end\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def render_json\n {\n items: buyers.map { |a| BuyerPresenter.new(a).new_application_data.as_json }.to_json,\n count: total_entries\n }\n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end", "def show\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rater }\n end\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end", "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end", "def show\n @buyer = Buyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @buyer }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def index\n @merchants = Merchant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @merchants }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def show\n @seller = Seller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seller }\n end\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def show\n @seller = Seller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @seller }\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url }\n format.json { head :no_content }\n end\n end", "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end", "def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end", "def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @advertisers = Advertiser.all\n end", "def get_deal\n @deal = Deal.find(params[:deal_id])\n end", "def index\n @desks = Desk.all\n\n render json: @desks\n end", "def index\n @talleres = Taller.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talleres }\n end\n end", "def index\n json_response(Restaurant.all)\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def index\n @githubers = Githuber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @githubers }\n end\n end", "def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end", "def show\n render json: @dept\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def index\n @departments = Department.all\n respond_to do |format|\n format.json{ render json: @departments}\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def show\n render json: @endorsement\n end", "def index\n @personnels = Personnel.all\n @departments = Department.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@personnels.select([:id, :first_name, :last_name, :email, :gender])) }\n\t\tend\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @passengers = Passenger.all\n respond_to do |format|\n format.html\n format.json { render :json => @passengers}\n end\n end", "def index\n @leads = Lead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end", "def index\n begin\n # Beers of current user\n beers = @current_user.beers\n\n #Filter by name\n if params[:name].present?\n beers = beers.where(name: params[:name])\n end\n\n #Filter by abv\n if params[:abv].present?\n beers = beers.where(abv: params[:abv])\n end\n render json: BeerSerializer.new(beers).collection_attr_array\n rescue StandardError => e\n message = e.message\n end\n end", "def show\n @brand = Brand.find(params[:id])\n @makers = @brand.makers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand }\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ledger_entry }\n end\n end", "def new\n @rateddeal = Rateddeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rateddeal }\n end\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end", "def show\n @transporter = Transporter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transporter }\n end\n end", "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def index\n @title = \"Deals\"\n if is_company?\n @company = Company.find_by_user_id(current_user.id)\n @deals = @company.deals\n else\n @deals = Deal.all.sort{|a,b| b.popularity <=> a.popularity} #most popular first\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @deals }\n end\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end", "def index\n if params[:user_id]\n @rents = find_user.rents\n render json: @rents\n elsif params[:book_id]\n @rents = find_book.rents\n render json: @rents\n else\n @rents = Rent.all\n render json: @rents\n end\n end", "def new\n @insider_deal = InsiderDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insider_deal }\n end\n end", "def show\n respond_with(deal)\n end", "def new\n @redeemed_deal = RedeemedDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @redeemed_deal }\n end\n end" ]
[ "0.7322215", "0.7322215", "0.69774485", "0.6861183", "0.65171885", "0.6498694", "0.6493155", "0.64340043", "0.64057803", "0.64057803", "0.64057803", "0.6380698", "0.6342994", "0.6251009", "0.62445396", "0.6209363", "0.6202483", "0.6194472", "0.61182994", "0.6109453", "0.61025935", "0.6050733", "0.6019959", "0.6009972", "0.59762025", "0.59434026", "0.59358114", "0.59255433", "0.592014", "0.590808", "0.5899777", "0.5893835", "0.58918786", "0.5886775", "0.58859", "0.58838654", "0.5876277", "0.58755124", "0.5867265", "0.5854216", "0.5843177", "0.5838521", "0.5834038", "0.5804365", "0.5802408", "0.5798692", "0.5790574", "0.57883376", "0.57854044", "0.57812864", "0.5780619", "0.5763367", "0.5761062", "0.57608324", "0.57574666", "0.57571596", "0.5754308", "0.5748742", "0.5747211", "0.57469976", "0.5743958", "0.57348865", "0.5724658", "0.57162654", "0.5702828", "0.567824", "0.5677517", "0.56712717", "0.56675184", "0.56547284", "0.5653911", "0.56491166", "0.56485784", "0.56483006", "0.5644126", "0.564076", "0.5640755", "0.5635723", "0.5632046", "0.5632046", "0.56315136", "0.56297404", "0.5629677", "0.5625013", "0.5624738", "0.5619414", "0.5618747", "0.5609128", "0.56087184", "0.5604758", "0.5597537", "0.5595406", "0.55942184", "0.55914783", "0.55882627", "0.55844176", "0.5581574", "0.55797064", "0.5578214", "0.55772996" ]
0.60830104
21
GET /dealers/1 GET /dealers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dealers = Dealer.all\n end", "def index\n @dealers = Dealer.all\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def show_deal(id)\n get(\"deals/#{id}\")\n end", "def show\n # @deal = Deal.find(params[:id], :include => [:retailer, :advertiser, {:retailer => :account}] )\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @rateddeal = Rateddeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rateddeal }\n end\n end", "def show\n @redeemed_deal = RedeemedDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @redeemed_deal }\n end\n end", "def show\n @insider_deal = InsiderDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @insider_deal }\n end\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @caterer = Caterer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caterer }\n end\n end", "def get_deal\n @deal = Deal.find(params[:deal_id])\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end", "def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end", "def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def new\n @deal = Deal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deal }\n end\n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def show\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end", "def show\n @buyer = Buyer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @buyer }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end", "def index\n @dealerships = Dealership.all\n end", "def show\n # @retailer = Retailer.find(params[:id], :include => [:deals, :advertisements, :account] )\n respond_to do |format|\n format.html # show.html.erb\n format.json # show.json.rabl\n end\n end", "def new\n @insider_deal = InsiderDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insider_deal }\n end\n end", "def show\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rater }\n end\n end", "def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end", "def new\n @rateddeal = Rateddeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rateddeal }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def show\n @deed = Deed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deed }\n end\n end", "def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end", "def show\n render json: @adopter\n end", "def show\n @seller = Seller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seller }\n end\n end", "def show\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ledger_entry }\n end\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def show\n @seller = Seller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @seller }\n end\n end", "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end", "def new\n @redeemed_deal = RedeemedDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @redeemed_deal }\n end\n end", "def show\n @transporter = Transporter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transporter }\n end\n end", "def show\n @training_deal = TrainingDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_deal }\n end\n end", "def show\n respond_with(deal)\n end", "def index\n render json: Seller.all\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def show\n @yahoo_deal = YahooDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yahoo_deal }\n end\n end", "def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end", "def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url }\n format.json { head :no_content }\n end\n end", "def show\n # @passenger = Passenger.find(:name => params[:id])\n # render :json => @passenger\n end", "def show\n @farmer = Farmer.find(params[:id])\n\t\t@dispensals = @farmer.dispensals.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n\t\t@donations = @farmer.donations.all.paginate(:page => params[:page], :order => 'updated_at DESC', :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farmer }\n end\n end", "def show\n @rent = Rent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rent }\n end\n end", "def index\n\n if current_user.admin?\n @dealers = Dealer.all\n else\n redirect_to root_path\n end\n\n end", "def show\n @brand = Brand.find(params[:id])\n @makers = @brand.makers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand }\n end\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n @antler = Antler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: AntlerPresenter.new(@antler) }\n end\n end", "def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end", "def show\n @redeem = Redeem.find(params[:id])\n p @redeem.deal_id\n @deal = Deal.find(@redeem.deal_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @redeem }\n end\n end", "def index\n @advertisements = Advertisement.where(merchant_id: params[:merchant_id])\n\n render json: @advertisements\n end", "def show\n render json: @advert\n end", "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end", "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def show\n @advertisment = Advertisment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisment }\n end\n end", "def show\n @deals_wizard = DealsWizard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deals_wizard }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n @rating = Rating.new\n @rating.beer = @beer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def show\n render json: @rentable_item\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def show\n render json: @dept\n end", "def show\n render json: @endorsement\n end", "def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end", "def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end", "def show\n @revenue = Revenue.find(params[:id])\n\n render json: @revenue\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n merchant = Merchant.find(params[\"id\"])\n if params[\"date\"].nil?\n render json: RevenueSerializer.new(merchant.revenue_on_id)\n else\n render json: RevenueSerializer.new(merchant.revenue_by_date(params[\"date\"]))\n end\n end", "def show\n begin\n @response = Booking.get_booking(params[:id])\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n end", "def show\n @seller_info = SellerInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seller_info }\n end\n end", "def index\n @advertises = Advertise.all\n render 'index', formats: 'json', handlers: 'jbuilder'\n end", "def show\n @departure = Departure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @departure }\n end\n end", "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end", "def deal_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}\", params)\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end", "def show\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer }\n end\n end", "def show\n @rental = Rental.get_by_id(params[:id])\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def show\n render json: @booking\n end", "def show\n render json: @booking\n end", "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end" ]
[ "0.7104187", "0.7104187", "0.69208705", "0.69208705", "0.69208705", "0.6889136", "0.6817105", "0.6794931", "0.6793058", "0.66745275", "0.666655", "0.65569013", "0.65128535", "0.6451594", "0.6445409", "0.6441197", "0.6432699", "0.6367675", "0.6365314", "0.63580155", "0.6258022", "0.6206784", "0.61962986", "0.6175233", "0.6166567", "0.6163569", "0.6158779", "0.6145526", "0.61142415", "0.6060451", "0.6058619", "0.60513085", "0.60499984", "0.6048151", "0.6038946", "0.6023856", "0.6004325", "0.5967041", "0.59656173", "0.5962186", "0.5958966", "0.5949892", "0.5943672", "0.5942701", "0.5934198", "0.5928942", "0.59234834", "0.5915167", "0.5911407", "0.59090763", "0.58993393", "0.58984166", "0.5888444", "0.5888444", "0.5881832", "0.58654624", "0.58607435", "0.5849385", "0.58256483", "0.58239025", "0.5818527", "0.58150464", "0.58100957", "0.5800872", "0.5795343", "0.57899815", "0.5786047", "0.57704145", "0.576642", "0.576642", "0.57562923", "0.575521", "0.57548183", "0.5750592", "0.57505393", "0.5748798", "0.57401943", "0.57390386", "0.5731688", "0.573107", "0.5727232", "0.57269436", "0.5721269", "0.57176965", "0.5717332", "0.57135016", "0.57135016", "0.57022333", "0.5699461", "0.56992275", "0.56958926", "0.56931275", "0.5692836", "0.5687617", "0.56858164", "0.5682241", "0.5681379", "0.56801945", "0.5679272", "0.5679272", "0.56780344" ]
0.0
-1
POST /dealers POST /dealers.json
def create @dealer = Dealer.new(dealer_params) respond_to do |format| if @dealer.save format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' } format.json { render :show, status: :created, location: @dealer } else format.html { render :new } format.json { render json: @dealer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def create\n @dealer = Dealer.new(dealer_params)\n respond_to do |format|\n if @dealer.save\n format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' }\n format.json { render :show, status: :created, location: @dealer }\n else\n format.html { render :new }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dealer = Dealer.new(dealer_params)\n\n respond_to do |format|\n if @dealer.save\n format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dealer }\n else\n format.html { render action: 'new' }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rateddeal = Rateddeal.new(params[:rateddeal])\n\n respond_to do |format|\n if @rateddeal.save\n format.html { redirect_to @rateddeal, notice: 'Rateddeal was successfully created.' }\n format.json { render json: @rateddeal, status: :created, location: @rateddeal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rateddeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def dealer_params\n params.require(:dealer).permit(:dealer_name, :address, :email, :contact)\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def create\n @debater = Debater.new(debater_params)\n\n respond_to do |format|\n if @debater.save\n format.html { redirect_to @debater, notice: 'Debater was successfully created.' }\n format.json { render :show, status: :created, location: @debater }\n else\n format.html { render :new }\n format.json { render json: @debater.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dealers = Dealer.all\n end", "def index\n @dealers = Dealer.all\n end", "def create_deal(**args)\n params = parameters(args) do\n required_params :title\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :add_time, :visible_to\n end\n request(:post, 'deals', params)\n end", "def create\n\n\n @deal = Deal.new(params[:deal])\n #code to save contacts associated with the deal\n\n\n respond_to do |format|\n if @deal.save\n DealRelation.all.each do |dr|\n if !params[dr.name.to_s].nil?\n\n params[dr.name.to_s].each do |deal_contact|\n DealContact.create!(:deal_id => @deal.id, :contact_id => deal_contact.to_i, :deal_relation_id => dr.id)\n end\n end\n end\n format.html { redirect_to deals_path, notice: 'Deal was successfully created.' }\n format.json { render json: @deal, status: :created, location: @deal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dealership = Dealership.new(dealership_params)\n\n respond_to do |format|\n if @dealership.save\n format.html { redirect_to dealerships_url, notice: 'Dealership was successfully created.' }\n format.json { render :show, status: :created, location: @dealership }\n else\n format.html { render :new }\n format.json { render json: @dealership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deal = Deal.new(deal_params)\n @deal.account_id = current_user.account_id\n\n respond_to do |format|\n if @deal.save\n format.html { redirect_to account_deals_path(current_user.account_id), notice: 'Deal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @deal }\n else\n format.html { render action: 'new' }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deal = Deal.new(deal_params)\n @deal.user_id = current_user.id\n\n respond_to do |format|\n if @deal.save\n format.html { redirect_to @deal, notice: 'Deal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @deal }\n else\n format.html { render action: 'new' }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url }\n format.json { head :no_content }\n end\n end", "def new\n @rateddeal = Rateddeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rateddeal }\n end\n end", "def create\n rental = sporting_goods.rentals.new(rental_params)\n rental.user_id = current_user.id\n if rental.save\n render json: rental, status: 200\n else\n render json: rental, status: 400\n end\n end", "def create\n @deal = Deal.new(deal_params)\n\n respond_to do |format|\n if @deal.save(validate: false)\n format.html { redirect_to @deal, notice: 'Deal was successfully created.' }\n format.json { render :show, status: :created, location: @deal }\n else\n format.html { render :new }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'The deal was successfully created.' if deal.save\n respond_with(deal)\n end", "def new\n @insider_deal = InsiderDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insider_deal }\n end\n end", "def create\n @alerte = Alerte.new(alerte_params)\n\n respond_to do |format|\n if @alerte.save\n format.html { redirect_to @alerte, notice: 'Alerte was successfully created.' }\n format.json { render :show, status: :created, location: @alerte }\n else\n format.html { render :new }\n format.json { render json: @alerte.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed, status: :created, location: @deed\n else\n render json: @deed.errors, status: :unprocessable_entity\n end\n end", "def new\n @redeemed_deal = RedeemedDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @redeemed_deal }\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n \n @redeemed_deal = RedeemedDeal.new(params[:redeemed_deal])\n\n respond_to do |format|\n if @redeemed_deal.save\n format.html { render json: {:success => true, :status_code => 200, :message => \"You have redeemed the coupon successfully\"}}\n format.json { render json: {:success => true, :status_code => 200, :message => \"You have redeemed the coupon successfully\"}}\n format.xml { render xml: {:success => true, :status_code => 200, :message => \"You have redeemed the coupon successfully\"}}\n else\n format.html { render json: {:success => false, :status_code => 400, :message => \"Error in redeeming coupon\"}}\n format.json { render json: {:success => false, :status_code => 400, :message => \"Error in redeeming coupon\"}}\n format.xml { render xml: {:success => false, :status_code => 400, :message => \"Error in redeeming coupon\"}}\n end\n end\n end", "def dealer_params\n params.require(:dealer).permit(:email, :password)\n end", "def new\n @deal = Deal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deal }\n end\n end", "def create\n @item = @deal.items.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to deal_items_url(@deal), notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url, notice: 'Dealer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url, notice: 'Dealer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end", "def create\n @dealer = Dealer.create(dealer_params)\n\n #this will break unless dealer has user_id\n # assigning the current_user's id to the dealer they're making\n @dealer.user_id = current_user.id\n # saving the dealer instance that has just been created\n @dealer.save\n\n # this corresponds to users that have just signed up\n # [:onboarding] tag is in the dealer_build.html.erb ONLY for new users\n # once user creates their first dealer, they're redirected to dealer_contact\n if params[:onboarding].present?\n redirect_to after_signup_path(:dealer_contact)\n else\n # if [:onboarding] hidden field tag isn't present\n # then the user gets redirected to summary page\n # (users signing in for the 2nd time + )\n redirect_to summary_page_path\n end\n end", "def create\n @dept = Dept.new(dept_params)\n\n if @dept.save\n render json: @dept, status: :created, location: @dept\n else\n render json: @dept.errors, status: :unprocessable_entity\n end\n end", "def new\n respond_with(deal)\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def create\n\n @deal = Deal.new(params[:deal])\n\n respond_to do |format|\n if @deal.save\n format.html { redirect_to @deal, notice: 'Deal was successfully created.' }\n format.json { render json: @deal, status: :created, location: @deal }\n else\n @pn = protocol_number\n format.html { render action: \"new\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caterer = Caterer.new(params[:caterer])\n\n respond_to do |format|\n if @caterer.save\n format.html { redirect_to @caterer, notice: 'Caterer was successfully created.' }\n format.json { render json: @caterer, status: :created, location: @caterer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caterer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create_voted_beer\n render json: BreweryDb::CreateVotedbeer.new(params[:beerId]).create\n end", "def create\n @training_deal = TrainingDeal.new(params[:training_deal])\n\n respond_to do |format|\n if @training_deal.save\n format.html { redirect_to @training_deal, notice: 'Training deal was successfully created.' }\n format.json { render json: @training_deal, status: :created, location: @training_deal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @training_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_rental(options = {})\n post(:rentals, rentals: [options]).pop\n end", "def create\n @porter = Porter.new(params[:porter])\n\n respond_to do |format|\n if @porter.save\n format.html { redirect_to @porter, notice: 'Porter was successfully created.' }\n format.json { render json: @porter, status: :created, location: @porter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @porter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dater = Dater.new(dater_params)\n\n respond_to do |format|\n if @dater.save\n format.html { redirect_to @dater, notice: 'Dater was successfully created.' }\n format.json { render :show, status: :created, location: @dater }\n else\n format.html { render :new }\n format.json { render json: @dater.errors, status: :unprocessable_entity }\n end\n end\n end", "def deal_params\n params.require(:deal).permit(:restaurant, :category, :content)\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to admin_dealer_dealers_path, notice: 'Dealer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def create\n @derp = Derp.new(derp_params)\n\n respond_to do |format|\n if @derp.save\n format.html { redirect_to @derp, notice: 'Derp was successfully created.' }\n format.json { render :show, status: :created, location: @derp }\n else\n format.html { render :new }\n format.json { render json: @derp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deals_wizard = DealsWizard.new(params[:deals_wizard])\n \n respond_to do |format|\n if @deals_wizard.save\n format.html { redirect_to edit_deal_path(:id => params[:deals_wizard][:deal_id]) , notice: 'Deal was successfully created.' }\n# format.html { redirect_to @deals_wizard, notice: 'Deals wizard was successfully created.' }\n format.json { render json: @deals_wizard, status: :created, location: @deals_wizard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deals_wizard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rater = Rater.new(params[:rater])\n\n respond_to do |format|\n if @rater.save\n format.html { redirect_to @rater, notice: 'Rater was successfully created.' }\n format.json { render json: @rater, status: :created, location: @rater }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rater.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caterer = current_merchant.caterers.new(caterer_params)\n\n respond_to do |format|\n if @caterer.save\n format.html { redirect_to @caterer, notice: 'Caterer was successfully created.' }\n format.json { render :show, status: :created, location: @caterer }\n else\n format.html { render :new }\n format.json { render json: @caterer.errors, status: :unprocessable_entity }\n end\n end\n @caterer.caterer_type_ids = params[:caterer][:caterer_type_ids]\n @caterer.cuisine_type_ids = params[:caterer][:cuisine_type_ids]\n end", "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def create\n \n \n @dept = current_user.depts.new(params[:dept])\n \n respond_to do |format|\n if @dept.save\n format.html { redirect_to @dept, :notice => 'Dept was successfully created.' }\n format.json { render :json => @dept, :status => :created, :location => @dept }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @dept.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @deed = Deed.new(params[:deed])\n\n respond_to do |format|\n if @deed.save\n format.html { redirect_to @deed, notice: 'Deed was successfully created.' }\n format.json { render json: @deed, status: :created, location: @deed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deed.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @deal = Deal.new(deal_params)\n \n respond_to do |format|\n if @deal.save\n finish_profile and return unless current_user.completed_profile? \n request_deal(@deal)\n format.html { redirect_to @deal, notice: 'Deal was successfully created.' }\n format.json { render :show, status: :created, location: @deal }\n else\n format.html { render :new }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @marketer = Marketer.new(marketer_params)\n\n respond_to do |format|\n if @marketer.save\n format.html { redirect_to @marketer, notice: 'Marketer was successfully created.' }\n format.json { render :show, status: :created, location: @marketer }\n else\n format.html { render :new }\n format.json { render json: @marketer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def create\n @auction = Auction.new(auction_params)\n @auction.seller = @user\n\n if @auction.save\n render json: @auction, status: :created, location: seller_auction_url(@auction)\n else\n render json: @auction.errors, status: :unprocessable_entity\n end\n end", "def create\n @deal = Deal.new(params[:deal])\n @company = Company.find_by_user_id(current_user.id)\n @deal.company_id = @company.id\n respond_to do |format|\n if @deal.save\n format.html { redirect_to(@deal, :flash => {:success => 'Deal successfully created.'}) }\n format.xml { render :xml => @deal, :status => :created, :location => @deal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end", "def daily_deal_params\n params.require(:daily_deal).permit(:DealerID, :DealerName, :DealerCategory, :IsDealerFavorite?, :DealerTargetUrl, :logo)\n end", "def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "def create\n #params[:deal_id] is placed in the url of POST action see routes.rb why\n @redeem = Redeem.new(params[:redeem].merge(:deal_id => params[:deal_id]))\n #alternatively by using association's build method deal_id will be assigned automatically\n #@redeem = Deal.find(params[:deal_id]).redeem.build(params[:redeem])\n \n if @redeem.save\n if @redeem.deal.decrement_price\n redirect_to(@redeem, :notice => 'You got it!')\n end\n else\n render :action => \"new\"\n end\n end", "def create\n @requester = Requester.new(requester_params)\n\n respond_to do |format|\n if @requester.save\n format.html { redirect_to @requester, notice: 'Requester was successfully created.' }\n format.json { render :show, status: :created, location: @requester }\n else\n format.html { render :new }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @debater.destroy\n respond_to do |format|\n format.html { redirect_to debaters_url, notice: 'Debater was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @book_deal = BookDeal.new(book_deal_params)\n @book_deal.user_id = current_user.id if current_user\n respond_to do |format|\n if @book_deal.save\n format.html { redirect_to @book_deal, notice: 'Book deal was successfully created.' }\n format.json { render :show, status: :created, location: @book_deal }\n else\n format.html { render :new }\n format.json { render json: @book_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advetiser = Advetiser.new(advetiser_params)\n\n respond_to do |format|\n if @advetiser.save\n format.html { redirect_to @advetiser, notice: 'Advetiser was successfully created.' }\n format.json { render :show, status: :created, location: @advetiser }\n else\n format.html { render :new }\n format.json { render json: @advetiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def dealer_params\n params.require(:dealer).permit(:page, :name, :mobile_number, :city, :gallery_name, :phone_number, :gallery_location, :street_name, :building_number, user_attributes: [ :id, :email, :password, :password_confirmation ])\n end", "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end", "def create\n @ped = Ped.new(params[:ped])\n\n respond_to do |format|\n if @ped.save\n format.html { redirect_to @ped, notice: 'Ped was successfully created.' }\n format.json { render json: @ped, status: :created, location: @ped }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ped.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @docter = Docter.new(docter_params)\n\n respond_to do |format|\n if @docter.save\n format.html { redirect_to @docter, notice: \"Docter was successfully created.\" }\n format.json { render :show, status: :created, location: @docter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @docter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @desk = Desk.new(desk_params)\n\n if @desk.save\n render json: @desk, status: :created, location: @desk\n else\n render json: @desk.errors, status: :unprocessable_entity\n end\n end", "def create\n current_dealer\n @dealerpersonalinfo = current_dealer().build_dealerpersonalinfo(dealerpersonalinfo_params)\n\n respond_to do |format|\n if @dealerpersonalinfo.save\n format.html { redirect_to @dealerpersonalinfo, notice: 'Dealerpersonalinfo was successfully created.' }\n format.json { render :show, status: :created, location: @dealerpersonalinfo }\n else\n format.html { render :new }\n format.json { render json: @dealerpersonalinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @insider_deal = InsiderDeal.find(params[:id])\n @insider_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to insider_deals_url }\n format.json { head :no_content }\n end\n end", "def add_follower_to_deal(id:, **args)\n params = parameters(args) do\n required_params :user_id\n optional_params :user_id\n end\n request(:post, \"deals/#{id}/followers\", params)\n end", "def set_dealer\n @dealer = Dealer.find(params[:id])\n end", "def set_dealer\n @dealer = Dealer.find(params[:id])\n end", "def set_dealer\n @dealer = Dealer.find(params[:id])\n end", "def set_dealer\n @dealer = Dealer.find(params[:id])\n end", "def create\n @daily_deal = DailyDeal.new(daily_deal_params)\n\n respond_to do |format|\n if @daily_deal.save\n format.html { redirect_to @daily_deal, notice: 'Daily deal was successfully created.' }\n format.json { render :show, status: :created, location: @daily_deal }\n else\n format.html { render :new }\n format.json { render json: @daily_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Individual.find_by(id: current_user.meta_id)\n Rails.logger.info \">>>>>>>>>>>>>>>>>>> #{@person.id} <<<<<<<<<<<<<<<<<<\"\n @deck = @person.decks.new(deck_params)\n @deck.individual = Individual.find_by(id: current_user.meta_id)\n @decks = @person.decks.all\n respond_to do |format|\n if @deck.save\n format.js\n else\n Rails.logger.info \"FAILEDFAILEDFAILEDFAILEDFAILEDFAILEDFAILEDFAILED\"\n end\n end\n end", "def deal_params\n params.require(:deal).permit(:name, :status, :budget, :responsible, :notes, :task, :account_id)\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n @recruiter = current_user\n @posting = @recruiter.recruiter_postings.build(posting_params)\n puts \"posting #{@posting.inspect}\"\n # fail\n respond_to do |format|\n if @posting.save \n format.html { redirect_to @posting, notice: 'Posting was successfully created.' }\n format.json { render :show, status: :created, location: @posting }\n else\n format.html { render :new }\n format.json { render json: @posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @duer = Duer.new(duer_params)\n\n respond_to do |format|\n if @duer.save\n format.html { redirect_to @duer, notice: 'Duer was successfully created.' }\n format.json { render :show, status: :created, location: @duer }\n else\n format.html { render :new }\n format.json { render json: @duer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end", "def create\n @deal = @pic.deals.new(deal_params)\n respond_to do |format|\n if @deal.save\n send_notification(@deal, self)\n format.html { redirect_to @pic.belongable.organization, notice: 'Deal was successfully created.' }\n format.json { render :show, status: :created, location: @deal }\n else\n format.html { render :new }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @casedeal = Casedeal.new(casedeal_params)\n\n respond_to do |format|\n if @casedeal.save\n format.html { redirect_to casedeals_url, notice: 'Casedeal was successfully created.' }\n format.json { render :show, status: :created, location: @casedeal }\n else\n format.html { render :new }\n format.json { render json: @casedeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # @deal = Deal.new\n @deal.skeleton_flag = 1 # set up as a skeleton record\n @deal.preview_flag = 1 # set up as a preview\n @deal.featured_flag = 2 # start out as non-valid value as a placeholder\n @deal.name = \"New_Preview_Deal_#{Time.now.to_f}\"\n @deal.num_offered = 0\n # @deal.name = \"New_Preview_Deal_#{Time.now.strftime(\"%m/%d/%Y - %I:%M:%S%P\")}\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deal }\n end\n end", "def create\n @uder = Uder.new(uder_params)\n\n respond_to do |format|\n if @uder.save\n format.html { redirect_to @uder, notice: 'Uder was successfully created.' }\n format.json { render action: 'show', status: :created, location: @uder }\n else\n format.html { render action: 'new' }\n format.json { render json: @uder.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @caterer = Caterer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caterer }\n end\n end", "def create\n apartment = Apartment.create(apartment_params)\n render json: apartment\n end", "def create\n @endorsement = Endorsement.new(endorsement_params)\n\n if @endorsement.save\n render json: @endorsement, status: :created, location: @endorsement\n else\n render json: @endorsement.errors, status: :unprocessable_entity\n end\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @daughter = Daughter.new(daughter_params)\n\n respond_to do |format|\n if @daughter.save\n format.html { redirect_to @daughter, notice: 'Daughter was successfully created.' }\n format.json { render action: 'show', status: :created, location: @daughter }\n else\n format.html { render action: 'new' }\n format.json { render json: @daughter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @office_deal = OfficeDeal.new(office_deal_params)\n\n respond_to do |format|\n if @office_deal.save\n format.html { redirect_to @office_deal, notice: 'Office deal was successfully created.' }\n format.json { render :show, status: :created, location: @office_deal }\n else\n format.html { render :new }\n format.json { render json: @office_deal.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6642244", "0.6585507", "0.6513535", "0.63085556", "0.623345", "0.6164315", "0.613293", "0.61196357", "0.61196357", "0.60608", "0.6041987", "0.6030359", "0.60156286", "0.59745723", "0.5908797", "0.58654207", "0.58530694", "0.5837852", "0.58323896", "0.58273077", "0.58198833", "0.58166695", "0.58150846", "0.5750182", "0.57315445", "0.5661463", "0.56609875", "0.56575876", "0.56277287", "0.56277287", "0.56263", "0.5618643", "0.5614198", "0.5606031", "0.559638", "0.55936486", "0.55907637", "0.5585491", "0.55750656", "0.5572858", "0.5548678", "0.55247504", "0.55244005", "0.55238605", "0.5522973", "0.5509385", "0.5498765", "0.5494537", "0.5482491", "0.5481805", "0.5476307", "0.5474732", "0.547253", "0.5457758", "0.5453281", "0.54524916", "0.54420197", "0.5433597", "0.54100627", "0.5406635", "0.5395427", "0.53941756", "0.5394046", "0.5391846", "0.538613", "0.5381968", "0.5374901", "0.5363958", "0.53625923", "0.53574365", "0.535719", "0.53568494", "0.53449833", "0.53424627", "0.533947", "0.5333532", "0.53319883", "0.5327878", "0.5326579", "0.5326579", "0.5326579", "0.5326579", "0.5324381", "0.5319474", "0.5319303", "0.531324", "0.53074217", "0.5300102", "0.5295611", "0.52949244", "0.52910435", "0.52871716", "0.52807516", "0.52790666", "0.5277514", "0.52660275", "0.52638125", "0.5262673", "0.5258021", "0.52536064" ]
0.6581162
2
PATCH/PUT /dealers/1 PATCH/PUT /dealers/1.json
def update respond_to do |format| if @dealer.update(dealer_params) format.html { redirect_to @dealer, notice: 'Dealer was successfully updated.' } format.json { render :show, status: :ok, location: @dealer } else format.html { render :edit } format.json { render json: @dealer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @adopter = Adopter.find(params[:id])\n\n if @adopter.update(adopter_params)\n head :no_content\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end", "def update\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n if @deal.update_attributes(params[:deal])\n DealRelation.all.each do |dr|\n if !params[dr.name.to_s].nil?\n\n params[dr.name.to_s].each do |deal_contact|\n DealContact.create!(:deal_id => @deal.id, :contact_id => deal_contact.to_i, :deal_relation_id => dr.id)\n end\n end\n end\n format.html { redirect_to deals_path, notice: 'Deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deal = Deal.find(params[:id])\n \n respond_to do |format|\n if @deal.update_attributes(params[:deal])\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dealer.update(dealer_params)\n format.html { redirect_to @dealer, notice: 'Dealer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n if @deal.update_attributes(params[:deal])\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @deal.update(deal_params)\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deal.update(deal_params)\n format.html { redirect_to account_deals_path(current_user.account_id), notice: 'Deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @insider_deal = InsiderDeal.find(params[:id])\n\n respond_to do |format|\n if @insider_deal.update_attributes(params[:insider_deal])\n format.html { redirect_to @insider_deal, notice: 'Insider deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @insider_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rateddeal = Rateddeal.find(params[:id])\n\n respond_to do |format|\n if @rateddeal.update_attributes(params[:rateddeal])\n format.html { redirect_to @rateddeal, notice: 'Rateddeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rateddeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dealership.update(dealership_params)\n format.html { redirect_to dealerships_url, notice: 'Your Dealership was successfully updated.' }\n format.json { render :show, status: :ok, location: @dealership }\n else\n format.html { render :edit }\n format.json { render json: @dealership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deal.update(deal_params)\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n format.json { render :show, status: :ok, location: @deal }\n else\n format.html { render :edit }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_deal(id:, **args)\n params = parameters(args) do\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :visible_to\n end\n request(:put, \"deals/#{id}\", params)\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dealer.update(dealer_params)\n format.html { redirect_to @dealer, notice: 'Dealer was successfully updated.' }\n format.json { render :show, status: :ok, location: @dealer }\n else\n byebug\n format.html { render :edit }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deal = Deal.find(params[:id])\n\n respond_to do |format|\n if @deal.update_attributes(params[:deal])\n format.html { redirect_to(@deal, :notice => 'Deal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_dealership(req)\n identity = Lynr::Model::Identity.new(dealership(req).identity.email, posted['password'])\n customer = create_customer(identity)\n dealer_dao.save(dealership(req).set(\n 'identity' => identity,\n 'customer_id' => customer.id,\n 'subscription' => Lynr::Model::Subscription.new(\n plan: Lynr.config('app').stripe.plan, status: 'trialing'\n ),\n ))\n end", "def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @redeemed_deal = RedeemedDeal.find(params[:id])\n\n respond_to do |format|\n if @redeemed_deal.update_attributes(params[:redeemed_deal])\n format.html { redirect_to @redeemed_deal, notice: 'Redeemed deal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @redeemed_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @deal.update(deal_params)\n if @deal.stylist_agree == true && @deal.scrub_agree != true\n @buyer = @deal.user\n # Sends email to buyer\n AcceptedNotifierMailer.send_accepted_email(@deal, @buyer).deliver\n end\n format.html { redirect_to @deal, notice: 'Deal was successfully updated.' }\n format.json { render :show, status: :ok, location: @deal }\n else\n format.html { render :edit }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_deal.update(book_deal_params)\n format.html { redirect_to @book_deal, notice: 'Book deal was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_deal }\n else\n format.html { render :edit }\n format.json { render json: @book_deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @alerte.update(alerte_params)\n format.html { redirect_to @alerte, notice: 'Alerte was successfully updated.' }\n format.json { render :show, status: :ok, location: @alerte }\n else\n format.html { render :edit }\n format.json { render json: @alerte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to_update({thing: @author})\n end", "def update\n @rental = Rental.find_by_id params[:rental][:id]\n store = Store.find_by_location params[:rental].delete(:location)\n time = parse_time params[:rental].delete(:date), params[:rental].delete(:time)\n params[:rental][:time] = time if time\n params[:rental][:store_id] = store.try(:id)\n if @rental.nil?\n customer_id = params[:customer][:id]\n render json: { errors: [\"Customer with id #{customer_id} could not be found\"] }, status: 403\n elsif @rental.update_attributes params[:rental]\n render json: @rental\n else\n render json: { errors: @rental.errors.full_messages }, status: 422\n end\n # @new_quantities = params[:rental].delete(:quantities)\n # if @new_quantities && @rental\n # @rental.rental_bikes.destroy_all\n # build_rental_bikes(@new_quantities) if @rental\n # end\n # render json: @rental.to_json if @rental.try(:save)\n end", "def update\n # @deal = Deal.find(params[:id])\n respond_to do |format|\n # make_badge( params[:deal]['badge_text'].strip, @deal ) if params[:deal]['badge_text'].strip != @deal.badge_text.strip\n if @deal.update_attributes(params[:deal])\n @deal.update_attribute( :preview_flag, 0 ) if params[:commit] == \"Save\"# mark as no longer a \"preview\"\n @deal.update_attribute( :preview_flag, 1 ) if params[:commit] == \"Preview\"# mark as a \"preview\"\n if @deal.preview_flag == 0\n format.html { redirect_to @deal, notice: \"Deal was successfully updated.\" }\n format.json { head :ok }\n else # in \"preview\" state, redirect to \"edit\"\n format.html { redirect_to edit_deal_path(@deal), notice: \"Deal Preview successfully updated.\" }\n format.json { head :ok }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = 'The deal was successfully updated.' if deal.update_attributes(params[:deal])\n respond_with(deal)\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\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 @rental = Rental.find_by_id params[:rental][:id]\n store = Store.find_by_location params[:rental].delete(:location)\n params[:rental][:time] = parse_time(params[:rental].delete(:date), params[:rental].delete(:time))\n params[:rental][:store_id] = store.try(:id)\n if @rental.nil?\n render json: { errors: [\"Customer with id #{params[:customer][:id]} could not be found\"] }, status: 403\n elsif @rental.update_attributes params[:rental]\n render json: @rental\n else\n render json: { errors: @rental.errors.full_messages }, status: 422\n end\n # @new_quantities = params[:rental].delete(:quantities)\n # if @new_quantities && @rental\n # @rental.rental_bikes.destroy_all\n # build_rental_bikes(@new_quantities) if @rental\n # end\n # render json: @rental.to_json if @rental.try(:save)\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n @offer = Offer.find(params[:id])\n\n if @offer.update(offer_params)\n head :no_content\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def update\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to deal_items_url(@deal), notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n @caterer = Caterer.find(params[:id])\n\n respond_to do |format|\n if @caterer.update_attributes(params[:caterer])\n format.html { redirect_to @caterer, notice: 'Caterer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caterer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n respond_to do |format|\n if @offerer.update(offerer_params)\n format.html { redirect_to @offerer, notice: 'Offerer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offerer }\n else\n format.html { render :edit }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @buyer = Buyer.find(params[:id])\n\n respond_to do |format|\n if @buyer.update_attributes(params[:buyer])\n format.html { redirect_to @buyer, :notice => 'Buyer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @buyer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n if @repairer.update_attributes(params[:repairer])\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n if @beer.update_attributes(beer_params)\n format.html { redirect_to @beer, notice: 'Beer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n if @beer.update_attributes(beer_params)\n format.html { redirect_to @beer, notice: 'Beer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n if @drip.update_attributes(params[:drip])\n format.html { redirect_to @drip, notice: 'Drip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @allergy.update(allergy_params)\n format.html { redirect_to @allergy, notice: t('allergies.update_success') }\n format.json { render :show, status: :ok, location: @allergy }\n else\n format.html { render :edit }\n format.json { render json: @allergy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend", "def update\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n if @rater.update_attributes(params[:rater])\n format.html { redirect_to @rater, notice: 'Rater was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rater.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n if @employer.update_attributes(params[:employer])\n format.html { redirect_to @employer, :flash => {notice: 'Employer was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n format.html { redirect_to @offering, notice: 'Oferta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @doctor = Doctor.find(params[:id])\n if @doctor.update!(update_params)\n render json: {doctor: @doctor}, status: 200\n else\n render json: { errors: @doctor.errors }, status: 422\n end\n end", "def update\n # @retailer = Retailer.find(params[:id])\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, :notice => 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end", "def update\n @rental = Rental.friendly.find(params[:rental_id])\n \n\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to rental_path(@rental), notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taller.update(taller_params)\n format.html { redirect_to @taller, notice: 'Taller was successfully updated.' }\n format.json { render :show, status: :ok, location: @taller }\n else\n format.html { render :edit }\n format.json { render json: @taller.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n if @borrower.update_attributes(params[:borrower])\n format.html { redirect_to @borrower, notice: 'Borrower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n if @borrower.update_attributes(params[:borrower])\n format.html { redirect_to @borrower, notice: 'Borrower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rental.update(rental_params)\n format.html { redirect_to @rental, notice: \"Rental was successfully updated.\" }\n format.json { render :show, status: :ok, location: @rental }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n if @responder.update_attributes(params[:responder])\n format.html { redirect_to @responder, :notice => 'Responder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n if @rider.update_attributes(params[:rider])\n format.html { redirect_to @rider, notice: 'Rider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dept = Dept.find(params[:id])\n\n if @dept.update(dept_params)\n head :no_content\n else\n render json: @dept.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transporter = Transporter.find(params[:id])\n\n respond_to do |format|\n if @transporter.update_attributes(params[:transporter])\n format.html { redirect_to @transporter, notice: 'Transporter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transporter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @rent.update(rent_params)\n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def update\n respond_to do |format|\n if @marketer.update(marketer_params)\n format.html { redirect_to @marketer, notice: 'Marketer was successfully updated.' }\n format.json { render :show, status: :ok, location: @marketer }\n else\n format.html { render :edit }\n format.json { render json: @marketer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n apartment = Apartment.find(params[:id])\n apartment.update_attributes(apartment_params)\n render json: apartment\n end", "def update\n attributes = fulfillment_bill_params.clone\n puts attributes\n @store = Store.find(attributes[\"store_id\"])\n puts \"Found Store = #{@store.StoreName}\" if [email protected]?\n attributes = attributes.merge(\"store_name\" => @store.StoreName)\n puts attributes\n respond_to do |format|\n if @fulfillment_bill.update(attributes)\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @fulfillment_bill }\n else\n format.html { render :edit }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: \"Retailer was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: \"unprocessable_entry\" }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66010934", "0.65861094", "0.64825433", "0.64666694", "0.64482784", "0.6445248", "0.6370103", "0.6367641", "0.62841403", "0.6253599", "0.62247694", "0.620776", "0.6189243", "0.6177333", "0.616616", "0.6160951", "0.61027473", "0.60569257", "0.60489565", "0.6048126", "0.60238343", "0.60161537", "0.6011978", "0.5987965", "0.5963253", "0.59620494", "0.59590805", "0.59481496", "0.5930621", "0.59299296", "0.5928587", "0.5922053", "0.5910298", "0.5907134", "0.58985656", "0.588803", "0.5887448", "0.5875766", "0.5872637", "0.5865958", "0.5857922", "0.58501077", "0.5847751", "0.5843167", "0.5836244", "0.5833112", "0.5831253", "0.58151466", "0.58045906", "0.579645", "0.5792458", "0.5792458", "0.5789671", "0.57875144", "0.57855994", "0.57855994", "0.5782113", "0.5775979", "0.5764772", "0.57631606", "0.576162", "0.576127", "0.5752854", "0.57528", "0.5751244", "0.5751151", "0.57341534", "0.5730207", "0.5729344", "0.57291883", "0.5726434", "0.5725229", "0.5724607", "0.5724254", "0.5722333", "0.572233", "0.5721884", "0.57204926", "0.5719916", "0.5719916", "0.5719216", "0.5718591", "0.57184404", "0.5714445", "0.5714161", "0.5708946", "0.5708912", "0.57088894", "0.57074565", "0.57064563", "0.57061726", "0.5698726", "0.5696455", "0.56954056", "0.56954056", "0.56954056", "0.5693018", "0.5685723", "0.56852853" ]
0.6213936
12
DELETE /dealers/1 DELETE /dealers/1.json
def destroy @dealer.destroy respond_to do |format| format.html { redirect_to dealers_url, notice: 'Dealer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @deal = Deal.find(params[:id])\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end", "def delete_deal(id)\n delete(\"deals/#{id}\")\n end", "def destroy\n @insider_deal = InsiderDeal.find(params[:id])\n @insider_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to insider_deals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to admin_dealer_dealers_path, notice: 'Dealer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @redeemed_deal = RedeemedDeal.find(params[:id])\n @redeemed_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to redeemed_deals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dealership.destroy\n respond_to do |format|\n format.html { redirect_to dealerships_url, notice: 'Dealership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rateddeal = Rateddeal.find(params[:id])\n @rateddeal.destroy\n\n respond_to do |format|\n format.html { redirect_to rateddeals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_deal(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"deals/#{id}\", params)\n end", "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to(deals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @retailer = Retailer.find(params[:id], :include => [:deals] )\n if [email protected]\n @retailer.destroy\n else\n flash[:notice] = \"That Retailer cannot be deleted because it has #{@retailer.deals.size} deals\"\n end\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n authorize! :destroy, @deal\n \n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @caterer = Caterer.find(params[:id])\n @caterer.destroy\n\n respond_to do |format|\n format.html { redirect_to caterers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @buyer = Buyer.find(params[:id])\n @buyer.destroy\n\n respond_to do |format|\n format.html { redirect_to buyers_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @item = @deal.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to (deal_items_path(@deal)) }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @rental = Rental.find(params[:id])\n @rental.destroy\n\n respond_to do |format|\n format.html { redirect_to rentals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { render nothing: true }\n format.js\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end", "def destroy\n @rider = Rider.find(params[:id])\n @rider.destroy\n\n respond_to do |format|\n format.html { redirect_to riders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debater.destroy\n respond_to do |format|\n format.html { redirect_to debaters_url, notice: 'Debater was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advertiser.destroy\n respond_to do |format|\n format.html { redirect_to advertisers_url, notice: 'Advertiser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientsOffers = ClientsOffers.find(params[:id])\n @clientsOffers.destroy\n\n respond_to do |format|\n format.html { redirect_to clientsOffers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_deal.destroy\n respond_to do |format|\n format.html { redirect_to daily_deals_url, notice: 'Daily deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dental = Dental.find(params[:id])\n @dental.destroy\n\n respond_to do |format|\n format.html { redirect_to dentals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n format.html { redirect_to borrowers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n format.html { redirect_to borrowers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @advertisment = Advertisment.find(params[:id])\n @advertisment.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @karyalay_caterer.destroy\n respond_to do |format|\n format.html { redirect_to karyalay_caterers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rent.destroy\n respond_to do |format|\n format.html { redirect_to rents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uder.destroy\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daughter.destroy\n respond_to do |format|\n format.html { redirect_to daughters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @antler = Antler.find(params[:id])\n @antler.destroy\n\n respond_to do |format|\n format.html { redirect_to antlers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert1.destroy\n respond_to do |format|\n format.html { redirect_to advert1s_url, notice: 'Advert1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rent = Rent.find(params[:id])\n @rent.destroy\n\n respond_to do |format|\n format.html { redirect_to rents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dealer_location = DealerLocation.find(params[:id])\n dealer = @dealer_location.dealer_id\n @dealer_location.destroy\n \n respond_to do |format|\n format.html { redirect_to( root_uri + \"dealers/\" + dealer.to_s + \"/edit\" ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @d_dungeoneer.destroy\n respond_to do |format|\n format.html { redirect_to d_dungeoneers_url, notice: 'D dungeoneer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rater = Rater.find(params[:id])\n @rater.destroy\n\n respond_to do |format|\n format.html { redirect_to raters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dteor = Dteor.find(params[:id])\n @dteor.destroy\n\n respond_to do |format|\n format.html { redirect_to dteors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @buyer.destroy\n respond_to do |format|\n format.html { redirect_to buyers_url, notice: 'Покупатель был удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_deal.destroy\n respond_to do |format|\n format.html { redirect_to book_deals_url, notice: 'Book deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rentable.destroy\n respond_to do |format|\n format.html { redirect_to rentables_url, notice: 'Rentable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @advertisement = Advertisement.find(params[:id])\n @advertisement.destroy\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: \"Rental was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @traveler.destroy\n respond_to do |format|\n format.html { redirect_to travelers_url, notice: 'Traveler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @caterer.destroy\n respond_to do |format|\n format.html { redirect_to caterers_url, notice: 'Caterer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @dutydeal.destroy\n respond_to do |format|\n format.html { redirect_to dutydeals_url, notice: 'Dutydeal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @advetiser.destroy\n respond_to do |format|\n format.html { redirect_to advetisers_url, notice: 'Advetiser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_deals(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'deals', params)\n end", "def destroy\n #add admin check here!\n @diner.destroy\n respond_to do |format|\n format.html { redirect_to diners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def destroy\n @deed = Deed.find(params[:id])\n @deed.destroy\n\n respond_to do |format|\n format.html { redirect_to deeds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duer = Duer.find(params[:id])\n @duer.destroy\n respond_to do |format|\n format.html { redirect_to duers_url, notice: 'Duer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @advertisement = Advertisement.find(params[:id])\n @advertisement.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advertiser = Advertiser.find(params[:id])\n @advertiser.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisers_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @allergy.destroy\n respond_to do |format|\n format.html { redirect_to allergies_url, notice: t('allergies.destroy_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repairer = Repairer.find(params[:id])\n @repairer.destroy\n\n respond_to do |format|\n format.html { redirect_to repairers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n not_authorised and return unless current_user.has_role?(:admin)\n\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enfermedade.destroy\n respond_to do |format|\n format.html { redirect_to enfermedades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reel = Reel.find(params[:id])\n @reel.destroy\n\n respond_to do |format|\n format.html { redirect_to reels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auto_offer.destroy\n respond_to do |format|\n format.html { redirect_to auto_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rent.destroy\n respond_to do |format|\n format.html { redirect_to rents_url, notice: 'Rent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.74891484", "0.73073703", "0.7296887", "0.72910523", "0.72776484", "0.7268725", "0.72608894", "0.72608894", "0.72116965", "0.71185106", "0.7116985", "0.7101055", "0.7064265", "0.7039374", "0.7038716", "0.6981854", "0.69624543", "0.693712", "0.69312644", "0.6910744", "0.68910277", "0.6886789", "0.6881913", "0.6863707", "0.6821717", "0.68165076", "0.6802134", "0.68004966", "0.6784939", "0.6773561", "0.67686635", "0.6763172", "0.6762084", "0.6757578", "0.674397", "0.67431617", "0.67431617", "0.67339027", "0.6730595", "0.67294675", "0.6725676", "0.6716826", "0.6712481", "0.67120725", "0.6704368", "0.6685406", "0.6679254", "0.66762114", "0.6676114", "0.66694194", "0.66694194", "0.66591716", "0.6655812", "0.66503465", "0.6646985", "0.6643724", "0.6642847", "0.6640825", "0.66399026", "0.66398966", "0.66398966", "0.66380686", "0.6637719", "0.6636384", "0.6634524", "0.6634382", "0.6632462", "0.6631424", "0.6614103", "0.66126186", "0.66112584", "0.66112506", "0.66110563", "0.660788", "0.6606818", "0.6604671", "0.6604671", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65885764", "0.65869135", "0.6585953", "0.65841496", "0.65827006", "0.65827006", "0.65789974", "0.6574728", "0.6572382", "0.6570877", "0.6566337", "0.65643334", "0.65635836", "0.6562047" ]
0.7246097
9
Use callbacks to share common setup or constraints between actions.
def set_dealer @dealer = Dealer.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def dealer_params params.require(:dealer).permit(:dealer_name, :address, :email, :contact) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
=begin Typical block of reference node change looks like: Before: ..\packages\MassTransit.3.0.14\lib\net45\MassTransit.dll True After: (file version removed, hint path version number updated) ..\packages\MassTransit.3.0.15\lib\net45\MassTransit.dll True =end
def replace_project_versions proj_files begin # iterate each package file, replace version numbers and save proj_files.each{ |file| puts "Updating references in: #{file}..." doc = Nokogiri::XML File.read file nodes = doc.search 'Reference' nodes.each { |node| ref_val = node['Include'] # grab the identifier id = ref_val.split(',')[0] # clean out file version node['Include'] = id # replace version in hint path hint_path = node.search 'HintPath' if hint_path && hint_path[0] != nil hint_path_value = hint_path[0].children.to_s # this identifier is not the same as the node['Include'] one. # For ex., Runtime, Core and Storage assemblies will be referred to from within other packages like Management, Test etc hint_path_id = id_from_hint_path hint_path_value if @versions.has_key? hint_path_id hint_path_parts = hint_path_value.split '\\' hint_path_parts[2] = hint_path_id + GlobalConstants::DOT + @versions[hint_path_id] hint_path[0].children = hint_path_parts.join '\\' end end } File.write file, doc.to_xml } rescue puts $! return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_reference; end", "def require_reference(path); end", "def references; end", "def references; end", "def test_node_change_log1\r\n @mymodel = Model.new(1, \"rubylicious\") \r\n node_list = @mymodel.node_list\r\n\r\n node1 = node_list.add_node('autonum', 'node one', NODE);\r\n perfind2 = node_list.add_node('autonum', 'pi two', PERFIND); \r\n process3 = node_list.add_node('autonum', 'process three', PROCESS);\r\n process4 = node_list.add_node('autonum', 'process four', PROCESS); \r\n\r\n process3.evidence = [0.2, 0.3]\r\n process4.evidence = [0.54, 0.777]\r\n \r\n assert(@mymodel.consume_next_node_change.nil?)\r\n end", "def refs_at; end", "def reference\n @refs ||= strip(:reference)\n end", "def resolved_ref\n \"resolved-#{ref}\"\n end", "def node(name, ref, *args, &block); end", "def ref; end", "def increment_reference_amount(node)\n definition = definition_for_node(node)\n\n if definition and !definition.frozen?\n definition.reference_amount += 1\n end\n end", "def component_reference\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n begin\n # at line 38:5: '-' IDENT NL\n match( T__41, TOKENS_FOLLOWING_T__41_IN_component_reference_237 )\n match( IDENT, TOKENS_FOLLOWING_IDENT_IN_component_reference_239 )\n match( NL, TOKENS_FOLLOWING_NL_IN_component_reference_241 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n\n end\n\n return \n end", "def no_circular_reference\n\n end", "def referenced; end", "def change_rel_link line, org_dir, new_dir\n p_new_dir = Pathname.new new_dir\n left = \"\"\n right = line\n while right =~ /(!?\\[[^\\]]*\\])\\(([^\\)]*)\\)/\n left += $`\n right = $'\n name = $1\n link = $2\n if name =~ /\\[(S|s)ection (\\d+)\\]/\n link = \"sec#{$2}.md\"\n elsif ! (link =~ /^(http|\\/)/)\n p_link = Pathname.new \"#{org_dir}/#{link}\"\n link = p_link.relative_path_from(p_new_dir).to_s\n end\n left += \"#{name}(#{link})\"\n end\n left + right\nend", "def link(ref)\n if ref.kind_of? Range\n \"@see - \" + \"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}\".blue\n elsif ref.kind_of? Fixnum\n \"@see - \" + \"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}\".blue\n else\n \"@see - \" + \"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb\".blue\n end\n end", "def nlink() end", "def ref\n @ref ||= self.node.attributes.to_h[\"ref\"]\n end", "def create_ref_node(node, index)\n ref_node = node.document.create_element('sup', :class => 'reference', :id => \"#{REF}-#{index}\")\n ref_node.inner_html = create_ref_link(index)\n ref_node\n end", "def ref_node_for_class\n Neo4j.ref_node\n end", "def refutal()\n end", "def replace_self_version_dependencies(links, link_type)\n if %w{conflicts provides replaces}.include? link_type\n new_links = []\n links.each do |link|\n # link is self.version, but must be replacing also the replaced version\n if 'self.version' === link.pretty_constraint\n new_links = ::Composer.Package.Link.new(\n link.source,\n link.target,\n ::Composer::Semver::Constraint::Constraint.new('=', @version),\n type,\n pretty_version\n )\n end\n end\n links = links.zip(new_links).flatten.compact\n else\n links.each do |index, link|\n # link is self.version, but must be replacing also the replaced version\n if 'self.version' === link.pretty_constraint\n links[index] = ::Composer::Package::Link.new(\n link.source,\n link.target,\n ::Composer::Semver::Constraint::Constraint.new('=', @version),\n type,\n pretty_version\n )\n end\n end\n end\n links\n end", "def referenced?; end", "def dot_formatted_node_header\n \"#{'\\\\<\\\\< module \\\\>\\\\>\\\\l' if constant_is_module?}#{detached_constant_name}\"\nend", "def test_node_change_log3\r\n Model.node_changes_to_log([:evidence, :doesnotexist])\r\n @mymodel = Model.new(1, \"rubylicious\") \r\n node_list = @mymodel.node_list \r\n\r\n node1 = node_list.add_node('autonum', 'node one', NODE);\r\n perfind2 = node_list.add_node('autonum', 'pi two', PERFIND); \r\n process3 = node_list.add_node('autonum', 'process three', PROCESS);\r\n process4 = node_list.add_node('autonum', 'process four', PROCESS); \r\n \r\n perfind2.evidence = 0.12\r\n process3.evidence = 0.34 \r\n process4.evidence = 0.56 \r\n \r\n i = 0\r\n while(ar = @mymodel.consume_next_node_change)\r\n assert_equal([0.12,0.12], ar[0].send(ar[1][0])) if ar[0] == perfind2\r\n assert_equal([0.34,0.34], ar[0].send(ar[1][0])) if ar[0] == process3 \r\n assert_equal([0.56,0.56], ar[0].send(ar[1][0])) if ar[0] == process4\r\n i += 1\r\n end\r\n \r\n assert_equal(3, i, 'Incorrect number of node changes were logged')\r\n end", "def node; changeset.node; end", "def pre_change_sha\n DeliveryGolang::Helpers.pre_change_sha(node)\n end", "def change_sha(node)\n node['delivery']['change']['sha']\n end", "def proposed_law_node\n @proposed_law_node ||= git_flow_repo.working_file( 'proposed-law.adoc' ).node\n end", "def ant_references\n ant.project.references\n end", "def replace_relative_references2(ts_path, source, context)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.start_with?('///') && !(m = %r{^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*}.match(l)).nil?\n matched_path = m.captures.compact[0]\n if matched_path.start_with? '.'\n abs_path = File.join(escaped_dir, matched_path)\n else\n abs_path = File.expand_path(URI.parse(context.resolve(matched_path)).path)\n end\n\n l = l.sub(matched_path, abs_path)\n end\n next l\n end).join\n end", "def test_node_change_log2\r\n Model.node_changes_to_log([:evidence])\r\n @mymodel = Model.new(1, \"rubylicious\") \r\n node_list = @mymodel.node_list \r\n\r\n node1 = node_list.add_node('autonum', 'node one', NODE);\r\n perfind2 = node_list.add_node('autonum', 'pi two', PERFIND); \r\n process3 = node_list.add_node('autonum', 'process three', PROCESS);\r\n process4 = node_list.add_node('autonum', 'process four', PROCESS); \r\n \r\n perfind2.evidence = 0.12\r\n process3.evidence = 0.34 \r\n process4.evidence = 0.56 \r\n \r\n i = 0\r\n while(ar = @mymodel.consume_next_node_change)\r\n assert_equal([0.12,0.12], ar[0].send(ar[1][0])) if ar[0] == perfind2\r\n assert_equal([0.34,0.34], ar[0].send(ar[1][0])) if ar[0] == process3 \r\n assert_equal([0.56,0.56], ar[0].send(ar[1][0])) if ar[0] == process4\r\n i += 1\r\n end\r\n \r\n assert_equal(3, i, 'Incorrect number of node changes were logged')\r\n \r\n end", "def change_reference(new_reference)\n\n # In datamapper it's not possible to update the key value, so we use adapter\n # https://stackoverflow.com/questions/32302407/updating-a-property-set-as-the-key-in-datamapper\n BookingItem.change_item_reference(new_reference, reference)\n # Update the item references assigned\n BookingDataSystem::BookingLineResource.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n # Update stock locking references\n BookingDataSystem::BookingPrereservationLine.all(booking_item_reference: reference).update(booking_item_reference: new_reference)\n\n end", "def is_change_loaded?(node)\n if node['delivery']['change']\n true\n else\n message = <<-EOM\nThe value of\n node['delivery']['change']\nhas not been set yet!\nI apologize profusely for this.\nEOM\n raise \"MissingChangeInformation #{message}\"\n end\n end", "def create_target_refs_and_links?\n tr_create = [] #node/node-groups that need target ref created\n tr_link = {} #node/node-groups that need to be linked to existing target refs\n tr_link_candidates = []\n\n # ndx_needs_sc is used to find nodes that need a state change object\n # meaning model is annoatted so these when a task is run will cause a node to be created\n # initiallly set ndx_needs_state_change to have all nodes and then in loop below remove ones\n # that are linked to existing nodes\n ndx_needs_sc = {}\n @nodes.each do |node|\n if node.is_node_group?() && !node[:target_refs_exist]\n tr_create << node\n else\n tr_link_candidates << node\n end\n # initiallly set ndx_needs_state_change to have all nodes\n ndx_needs_sc.merge!(node[:id] => node)\n end\n\n Input::BaseNodes.create_linked_target_refs?(@target, @assembly, tr_create)\n\n to_link_array = existing_target_refs_to_link(tr_link_candidates, ndx_needs_sc)\n link_to_target_refs(to_link_array)\n\n # needed target_ref state changes\n ndx_needs_sc.reject { |_node, needs_sc| !needs_sc }.values\n end", "def info_fixups\n\t\t# Each reference should be an array consisting of two elements\n\t\trefs = module_info['References']\n\t\tif(refs and not refs.empty?)\n\t\t\trefs.each_index do |i|\n\t\t\t\tif !(refs[i].respond_to?('[]') and refs[i].length == 2)\n\t\t\t\t\trefs[i] = nil\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Purge invalid references\n\t\t\trefs.delete(nil)\n\t\tend\n\tend", "def update(node); end", "def reference(name, type)\n \n end", "def blame_reference\n to_reference\n end", "def dependency(start, vertex, nested = T.unsafe(nil)); end", "def test_current_version\n check_current_version(current_nodes(:visible_node))\n check_current_version(current_nodes(:used_node_1))\n check_current_version(current_nodes(:used_node_2))\n check_current_version(current_nodes(:node_used_by_relationship))\n check_current_version(current_nodes(:node_with_versions))\n end", "def new_ref!(viewmodel)\n vm_ref = viewmodel.to_reference\n if vm_ref.model_id\n vm_ref.stable_reference\n else\n format('ref:i:%06<count>d', count: (@last_ref += 1))\n end\n end", "def test_change_ModuleName\n printf \"\\n@T:#{__method__}\\n\"\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n org = XMLParse::get_ModuleList(@root)\n @root_mod = XMLParse::change_ModuleName(@root,\"test\",\"EVA_TOP\")\n mod = XMLParse::get_ModuleList(@root_mod)\n assert_equal(mod - org,[\"EVA_TOP\"])\n assert_equal(org - mod,[\"test\"])\n end", "def direct_dependencies; end", "def replace_refs\n doc.xpath('.//ref').each_with_index.map do |node, index|\n text = node.inner_html\n\n ref_node = create_ref_node(node, index + 1)\n node.replace(ref_node)\n\n text\n end\n end", "def update_sub_parent_resolution(blocks, parts)\n blocks.uniq { |hash| hash.values_at(:prev, :key, :patch) }\n group_appends = blocks.group_by { |h| [h[:prev], h[:key]] }\n group_appends.each do |pair, patch|\n source = pair.first\n target = pair.last.reverse.split('@', 2).collect(&:reverse).reverse.first\n vulnerable_package_info = get_package_info(target)\n list_of_versions_available = vulnerable_package_info[\"data\"][\"versions\"]\n version_to_update_to = Salus::SemanticVersion.select_upgrade_version(\n patch.first[:patch], list_of_versions_available\n )\n if !version_to_update_to.nil?\n parts.each_with_index do |part, index|\n match = part.match(/(\"|)(!:|#{target})(\"| ).*/)\n if part.include?(source) && !match.nil? && !is_major_bump(\n match.to_s.split(\" \").last, version_to_update_to\n )\n replace = target + ' \"^' + version_to_update_to + '\"'\n part.sub!(/(\"|)(!:|#{target})(\"| ).*/, replace)\n parts[index] = part\n end\n end\n end\n end\n parts\n end", "def parseReferencePath(output)\n if(output.match(/BUILD_PATH=\\s+[Ss]equence/) ||\n output.match(/BUILD_PATH=[Ss]equence/))\n @refPath = \"sequence\"\n\n elsif(output.match(/BUILD_PATH=\\s+\\/data/) ||\n output.match(/BUILD_PATH=\\/data/))\n @refPath = output.slice(/\\/data\\/slx\\/references\\/\\S+/)\n \n # Since reference paths starting with /data/slx/references represent\n # format of reference paths in alkek, change the prefix of these paths\n # to match the file-system structure in ardmore.\n @refPath.gsub!(/\\/data\\/slx\\/references/,\n \"/stornext/snfs5/next-gen/Illumina/genomes\")\n\n elsif(output.match(/BUILD_PATH=\\s+\\/stornext/) ||\n output.match(/BUILD_PATH=\\/stornext/))\n # If LIMS already has correct path corresponding to the file\n # system structure in ardmore, return that path without any\n # modifications.\n @refPath = output.slice(/\\/stornext\\/\\S+/)\n end\n end", "def test_ticket1579\n\n $TOP_MODULE = \"TOP_1579\"\n $VERBOSE = true\n printf \"\\n@T:#{__method__}\\n\"\n @root = XMLParse.read(\"./tp/1579.xml\")\n \n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_b3\",\"adr\",true) # Input signal\n# p connect_list\n# revised = get_path(connect_list)\n# p revised\n# assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_a\", \"a3\"], [\"Asub_b3\", \"data\"]], \n [[\"Asub_a\", \"a3\"], [\"Asub_b3\", \"data\"], [\"Asub_b3.Asub_b3\", \"A0\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579\",\"Asub_a\",[\"a3\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_a\", \"a0\"], [\"Asub_b3\", \"data\"]], \n [[\"Asub_a\", \"a0\"], [\"Asub_b3\", \"data\"], [\"Asub_b3.Asub_b3\", \"A3\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579\",\"Asub_a\",[\"a0\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A0\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A0\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a3\"]]\n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A0\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a1\"]] \n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A1\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a0\"]]\n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A3\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a1\",true) # Input signal\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a2\",true) # Input signal\n # connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a0\",true) # Input signal\n #\n end", "def replace_relative_references(ts_path, source)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.start_with?('///') && !(m = %r{^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*}.match(l)).nil?\n matched_path = m.captures.compact[0]\n l = l.sub(matched_path, File.join(escaped_dir, matched_path))\n end\n next l\n end).join\n end", "def replace_references(refs)\n set = doc.xpath('.//references')\n\n if set\n inner_html = create_references_list_items(refs)\n replace_references_node(set, inner_html)\n end\n\n nil\n end", "def massage_version(tags,dependency)\n case dependency\n when :node\n tags.map {|tag| tag.gsub(/v/,\"\")}\n else\n tags\n end\n end", "def comment\n @references.map do |ref|\n ref.verbalised_path\n end.compact * \" and \"\n end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def reference\n @reference\n end", "def reference=(ref)\n @reference = ref\n end", "def rel; end", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def patch_version; end", "def on_reference(name)\n end", "def parts_of_reference (docset, ref_str)\n\tref = ref_str.split\n\tif ref.length != 2\n\t\tTextMate.exit_show_tool_tip \"Cannot parse reference: #{str}\"\n\tend\n\n\tlanguage, type, klass, thing = ref[0].split('/')\n\tRef.new(docset, language, type, klass, thing, ref[1])\nend", "def changegroup_info(nodes, source)\n # print info\n if source == :bundle\n UI.status(\"#{nodes.size} changesets found\")\n end\n # debug stuff\n end", "def add_ref_dependency(package, ref)\n @git_resolver.repository(package).checkout(ref)\n pkg_version = elm_package(package)['version']\n version = \"#{pkg_version}+#{ref}\"\n @cache.ensure_version(package, version)\n add_package_dependencies(package, version)\n [[package, \"= #{version}\"]]\n end", "def check_tp_ref_count\n update_tp_ref_count\n check('link reference count of terminal-point') do |messages|\n all_termination_points do |tp, node, nw|\n next if tp.regular_ref_count?\n\n path = [nw.name, node.name, tp.name].join('__')\n msg = \"irregular ref_count:#{tp.ref_count}\"\n messages.push(message(:warn, path, msg))\n end\n end\n end", "def test_decode_new_reference()\n input = [\n 131, 114, 0, 3, 100, 0, 13, 110, 111, 110, 111, 100, 101, 64, 110,\n 111, 104, 111, 115, 116, 0, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 0]\n expected = Erlang::NewReference.new(\n Erlang::Atom.new('nonode@nohost'), 0, [0, 0, 94])\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end", "def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end", "def connect_modify_to_xml(con_db,con,base_sig,base_module,base_instance,base_port,target_module,target_instance,target_port,port_already=false)\n printf(\"connect_modify_to_xml Base:%s , Target:%s\\n\",base_module,target_module) if $VERBOSE\n=begin\n p \"base_sig:#{base_sig.Name}\"\n p \"base_module:#{base_module}\"\n p \"base_instance:#{base_instance}\"\n p \"base_port:#{base_port}\"\n p \"target_module:#{target_module}\"\n p \"target_instance:#{target_instance}\"\n p \"target_port:#{target_port}\"\n=end\n # resolve Hierarchy ( Module/Instance, Base/Target)\n base_current_module, base_upper_module, base_higher_module_name, base_upper_module_size = analyze_BaseTarget_path(base_module,\"module\") if base_module != nil\n base_current_instance, base_upper_instance, base_higher_instance_name, base_upper_instance_size = analyze_BaseTarget_path(base_instance,\"instance\") if base_instance != nil\n target_current_module, target_upper_module, target_higher_module_name, target_upper_module_size = analyze_BaseTarget_path(target_module,\"module\") if target_module != nil\n target_current_instance, target_upper_instance, target_higher_instance_name, target_upper_instance_size = analyze_BaseTarget_path(target_instance,\"instance\") if target_instance != nil\n\n force_upper = false\n if base_upper_instance != nil && target_upper_instance != nil\n base_path = base_upper_instance.split(\".\") \n target_path = target_upper_instance.split(\".\") \n if ( target_path - base_path == target_path ) && ( base_path != [] )\n force_upper = true\n end\n end\n \n if base_upper_instance == nil # Connct from Terminal To Port ( module port and wire are already added in XML )\n \n if base_module == target_higher_module_name # Connect to Instance\n printf(\"@I:Modify XML from Terminal( module : %s, port : %s) to Instance-Port ( instance : %s ).\\n\",base_module,base_port,target_current_instance )\n \n # make wire data\n signal = FICE_DB::SignalInf.new( \n :name => base_port, \n :type => \"wire\", \n )\n # Change Connection to base_instance\n printf(\"XML Modify. Change Connection for %s.%s\\n\",target_current_instance,target_port) if $VERBOSE\n XMLParse::change_Connection(@root,base_module,target_current_instance,{\"#{target_port}\" => [signal]},con_db)\n\n else # Next Lower Instance\n\n printf(\"@I:Modify XML from Terminal( module : %s, port : %s) to Instance-Port ( instance : %s ).\\n\",base_module,base_port,target_instance )\n # Next Lower module\n# FMakeMessage::PrintInternalError( :category => \"ALL\", :no => 0, :file_name => __FILE__, :lineno => __LINE__)\n \n end\n\n elsif target_upper_instance == nil # Connect Port to Terminal\n\n # Maybe same as Connect Upper Hierarchy. So no-need to implement\n printf(\"@I:Modify XML from Instance-Port to Terminal\\n\") if $VERBOSE\n FMakeMessage::PrintInternalError( :category => \"ALL\", :no => 0, :file_name => __FILE__, :lineno => __LINE__)\n\n elsif base_upper_instance == target_upper_instance # Same Hierarchy. Connect from Instance to Instance\n hier = \"Same\"\n printf(\"@I:Modify XML for Same Hierarchy.\\n\") if $VERBOSE\n\n # get wire name connecting Target Port\n case base_sig.Type\n when \"output\"\n # If Base Port have connection originally, Use Original Wire. But dont have it, make new\n if XMLParse::get_ConnectList(@root,\"#{base_higher_module_name}\",\"#{base_current_instance}\") != nil\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,false,port_already)\n else\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,true,port_already)\n end\n else\n # When input port, Base Instanc name was used in net name\n# net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,con)\n if XMLParse::get_ConnectList(@root,\"#{target_higher_module_name}\",\"#{target_current_instance}\")[target_port] == nil\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,target_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,false,port_already)\n else\n net_name = XMLParse::get_ConnectList(@root,\"#{target_higher_module_name}\",\"#{target_current_instance}\")[target_port][0].Name\n if net_name != nil\n net = FICE_DB::SignalInf.new( :name => net_name , :type => \"wire\", :msb => base_sig.MSB, :lsb => base_sig.LSB )\n printf(\"XML Modify. Add Wire to %s module ( wire name : %s )\\n\",target_higher_module_name,net.Name) if $VERBOSE\n XMLParse::add_Wire(@root,target_higher_module_name,net) \n else\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,target_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,false,port_already)\n end\n end\n end\n\n \n @connect_log.printf(\"[%s],%s,%s,%s,%s,%s\\n\",base_sig.Type,base_instance,base_port,net.Name,target_instance,target_port) if base_sig != nil\n \n case base_sig.Type\n when \"input\"\n printf(\"@I:Connect [Base]%s.%s <- [Net]%s <- [Target]%s.%s\\n\",base_instance,base_port,net.Name,target_instance,target_port)\n when \"output\"\n printf(\"@I:Connect [Base]%s.%s -> [Net]%s -> [Target]%s.%s\\n\",base_instance,base_port,net.Name,target_instance,target_port)\n when \"inout\"\n printf(\"@I:Connect [Base]%s.%s <-> [Net]%s <-> [Target]%s.%s\\n\",base_instance,base_port,net.Name,target_instance,target_port)\n else\n # internal error\n FMakeMessage.PrintInternalError( :category => \"FMakeLogic\", :no => 21, :file_name => File.basename(__FILE__), :lineno => __LINE__, :param => sig.Type) \n end\n # make wire data\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n# No Use BusPortion in Base :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n )\n\n # Change Connection to base_instance\n printf(\"XML Modify. Change Connection for %s.%s\\n\",base_instance,base_port) if $VERBOSE\n XMLParse::change_Connection(@root,base_higher_module_name,base_current_instance,{\"#{base_port}\" => [signal]},con_db)\n # Change Connection to target_instance\n # make wire data\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n )\n printf(\"XML Modify. Change Connection for %s.%s\\n\",target_instance,target_port) if $VERBOSE\n XMLParse::change_Connection(@root,target_higher_module_name,target_current_instance,{\"#{target_port}\" => [signal]},con_db)\n \n elsif (( base_upper_instance_size >= target_upper_instance_size ) || force_upper == true )\n # Different Hierarchy. Connect to Terminal and continue next connection.\n hier = \"Upper\"\n printf(\"@I:Modify XML for Different Hierarchy. ( Connect to Upper Hierarchy )\\n\") if $VERBOSE\n # get wire name connecting Target Port. Always make new wire\n case base_sig.Type\n when \"output\"\n if con.Type == \"DRIVE_CHANGE\"\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,true)\n else\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con)\n end\n else\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,true)\n end\n org_net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con)\n\n @connect_log.printf(\"[%s],%s,%s,%s,%s,%s\\n\",base_sig.Type,base_instance,base_port,net.Name,target_instance,target_port) if base_sig != nil\n\n case base_sig.Type\n when \"input\"\n printf(\"@I:Connect [Base]%s.%s <- [Net]%s <- [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,base_upper_instance,net.Name)\n when \"output\"\n printf(\"@I:Connect [Base]%s.%s -> [Net]%s -> [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,base_upper_instance,net.Name)\n when \"inout\"\n printf(\"@I:Connect [Base]%s.%s <-> [Net]%s <-> [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,base_upper_instance,net.Name)\n else\n # internal error\n FMakeMessage.PrintInternalError( :category => \"FMakeLogic\", :no => 21, :file_name => File.basename(__FILE__), :lineno => __LINE__, :param => sig.Type) \n end\n printf(\"XML Modify. Change Connection for %s.%s\\n\",base_instance,base_port) if $VERBOSE\n # make wire data\n if net.Comment == \"OverWrite\"\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n# :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n ) \n else\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n ) \n end\n # Change Connection to base_instance\n XMLParse::change_Connection(@root,base_higher_module_name,base_current_instance,{\"#{base_port}\" => [signal]},con_db)\n # make wire data\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => base_sig.Type, \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n )\n XMLParse::change_ConnectionToPort(@root,base_higher_module_name,base_current_instance,signal,con_db)\n\n # Care Other Connection\n if base_sig.Type == \"output\"\n printf(\"[A]Search Connection Inst:%s.%s in Module:%s\\n\",base_instance,base_port,$TOP_MODULE + \".\" + base_upper_module)\n connect_list = nil\n connect_list = XMLParse::search_Connection(true,@root,$TOP_MODULE + \".\" + base_upper_module,base_instance,[base_port,nil],true,nil,nil,0,@CONF_DB.INST.keys)\n # list = XMLParse::search_Connection(true,@root,top_module,inst_name,[sig,value],true,nil,nil,0,@CONF_DB.INST.keys) \n # connect_list = XMLParse::search_Connection(true,@root,target_upper_module,target_current_instance,[target_port,nil],false) \n if connect_list != nil && connect_list.Path.size != 1\n # In case, Wire name was Changed\n if net.Name != org_net.Name\n # Changed Net name\n printf(\"@I: Connected Wire Changed from \\\"%s\\\" to \\\"%s\\\" by FMake, So other connection net also change.\\n\",org_net.Name,net.Name)\n connect_list.Path.each do |path|\n case path.size\n when 1\n # MySelf. Do nothing\n when 2\n other_connect_inst = path[1].InstName.split(\".\").last\n # other_connect_inst = path[1].InstName.\n other_connect_port = path[1].Name\n printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",other_connect_inst,other_connect_port,base_higher_module_name,net.Name) if $VERBOSE\n XMLParse::change_Connection(@root,base_higher_module_name,other_connect_inst,{\"#{other_connect_port}\" => [signal]},con_db)\n else\n# when 3\n inst_size = path.last.InstName.split(\".\").size\n if inst_size <= path.size\n other_connect_inst = path.last.InstName\n other_connect_port = path.last.Name\n tmp = resolve_Hier_from_Instance(other_connect_inst.split(\".\"))[0][0].split(\".\")\n current_module = tmp.pop\n \n connect_change = false\n if base_instance != nil && other_connect_inst != nil\n base_path = base_instance.split(\".\") \n target_path = other_connect_inst.split(\".\") \n if (( base_path & target_path ) != [] && base_path.size > target_path.size ) || target_path.size == 1\n connect_change = true\n end\n end\n \n if tmp == []\n module_name = $TOP_MODULE\n else\n module_name = $TOP_MODULE + \".\" + tmp.join(\".\")\n end\n if path.last.PortBusPortion != nil && path.last.Type == \"input\" && @CONF_DB.INST.keys.index(path.last.InstName) != nil\n printf(\"@internal error: Not Support yet.\\n\")\n pp path\n pp path.last.PortBusPortion\n pp path.last.Type\n pp @CONF_DB.INST.keys.index(path.last.InstName)\n exit\n elsif path.last.Type == \"input\" && connect_change\n name = \"FMakeWire_\" + target_instance.gsub(\".\",\"_\") + \"_\" + base_port\n new_signal = FICE_DB::SignalInf.new( \n :name => name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n ) \n printf(\"@XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",other_connect_inst,other_connect_port,module_name,name) if $VERBOSE\n XMLParse::change_Connection(@root,module_name.split(\".\").last,other_connect_inst.split(\".\").last,{\"#{other_connect_port}\" => [new_signal]},con_db)\n end\n end\n # exit\n end\n end\n end\n end\n end\n \n # Next Connection\n# printf(\"Next Connection - 1\\n\")\n connect_modify_to_xml(con_db,con,signal,base_upper_module,base_upper_instance,signal.Name,target_module,target_instance,target_port)\n \n else # base_upper_instance_size < target_upper_instance_size\n hier = \"Lower\"\n printf(\"@I:Modify XML for Different Hierarchy. ( Connect to Lower Hierarchy )\\n\") if $VERBOSE\n\n # update each data in this case\n\n # get wire name connecting Target Port. Always make new wire\n\n # Search Original Connect ( If target has other connection )\n case base_sig.Type\n when \"output\"\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,true,false)\n else\n# net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,con)\n net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,target_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con,false,false)\n end\n\n org_net = get_WireInf(@root,hier,base_higher_module_name,base_current_module,base_current_instance,base_sig,target_higher_module_name,target_current_module,target_current_instance,target_port,con)\n\n @connect_log.printf(\"[%s],%s,%s,%s,%s,%s\\n\",base_sig.Type,base_instance,base_port,net.Name,target_instance,target_port) if base_sig != nil\n\n\n lower_direction = nil\n case base_sig.Type\n when \"input\"\n printf(\"@I:Connect [Base]%s.%s <- [Net]%s <- [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,target_upper_instance,net.Name)\n lower_direction = \"output\"\n when \"output\"\n printf(\"@I:Connect [Base]%s.%s -> [Net]%s -> [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,target_upper_instance,net.Name)\n lower_direction = \"input\"\n when \"inout\"\n printf(\"@I:Connect [Base]%s.%s <-> [Net]%s <-> [transfer point]%s.%s\\n\",base_instance,base_port,net.Name,target_upper_instance,net.Name)\n lower_direction = \"inout\"\n else\n # internal error\n FMakeMessage.PrintInternalError( :category => \"FMakeLogic\", :no => 21, :file_name => File.basename(__FILE__), :lineno => __LINE__, :param => sig.Type) \n end\n\n\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n ) \n# transfer_instance = target_upper_instance.split(\".\")[0]\n transfer_instance = target_upper_instance\n\n # Add Wire\n# printf(\"XML Modify. Add Wire to %s module ( wire name : %s )\\n\",base_higher_module_name,net.Name)\n# XMLParse::add_Wire(@root,base_higher_module_name,net)\n # Change Connection to base_instance\n printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",base_instance,base_port,base_higher_module_name,net.Name) if $VERBOSE\n XMLParse::change_Connection(@root,base_higher_module_name,base_current_instance,{\"#{base_port}\" => [signal]},con_db)\n # Change Connection to transfer point\n \n# printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",target_upper_instance,net.Name,target_higher_module_name,net.Name) \n# XMLParse::change_Connection(@root,base_higher_module_name,target_upper_instance,{\"#{net.Name}\" => [signal]},con_db)\n printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",transfer_instance,net.Name,target_higher_module_name,net.Name) if $VERBOSE\n XMLParse::change_Connection(@root,base_higher_module_name,transfer_instance,{\"#{net.Name}\" => [signal]},con_db)\n\n # Care Other Connection\n if base_sig.Type == \"input\"\n printf(\"[B]Search Connection Inst:%s.%s in Module:%s\\n\",target_instance,target_port,$TOP_MODULE + \".\" + target_upper_module)\n connect_list = nil\n connect_list = XMLParse::search_Connection(true,@root,$TOP_MODULE + \".\" + target_upper_module,target_instance,[target_port,nil],true,nil,nil,0,@CONF_DB.INST.keys) \n # list = XMLParse::search_Connection(true,@root,top_module,inst_name,[sig,value],true,nil,nil,0,@CONF_DB.INST.keys) \n # connect_list = XMLParse::search_Connection(true,@root,target_upper_module,target_current_instance,[target_port,nil],false) \n if connect_list != nil && connect_list.Path.size != 1\n # In case, Wire name was Changed\n if net.Name != org_net.Name\n # Changed Net name\n printf(\"@I: Connected Wire Changed from \\\"%s\\\" to \\\"%s\\\" by FMake, So other connection net also change.\\n\",org_net.Name,net.Name)\n connect_list.Path.each do |path|\n case path.size\n when 1\n # MySelf. Do nothing\n when 2\n other_connect_inst = path[1].InstName.split(\".\").last\n # other_connect_inst = path[1].InstName.\n other_connect_port = path[1].Name\n printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",other_connect_inst,other_connect_port,target_higher_module_name,net.Name) if $VERBOSE\n XMLParse::change_Connection(@root,target_higher_module_name,other_connect_inst,{\"#{other_connect_port}\" => [signal]},con_db) \n else\n inst_size = path.last.InstName.split(\".\").size\n if inst_size <= path.size\n other_connect_inst = path.last.InstName\n other_connect_port = path.last.Name\n tmp = resolve_Hier_from_Instance(other_connect_inst.split(\".\"))[0][0].split(\".\")\n current_module = tmp.pop\n # higher_module = tmp.pop\n \n connect_change = false\n if base_instance != nil && other_connect_inst != nil\n base_path = base_instance.split(\".\") \n target_path = other_connect_inst.split(\".\") \n if (( base_path & target_path ) != [] && base_path.size > target_path.size ) || target_path.size == 1 || base_path.size == 1\n connect_change = true\n end\n end\n \n if tmp == []\n module_name = $TOP_MODULE\n else\n module_name = $TOP_MODULE + \".\" + tmp.join(\".\")\n end\n if path.last.PortBusPortion != nil && path.last.Type == \"input\" && @CONF_DB.INST.keys.index(path.last.InstName) != nil\n printf(\"@internal error: Not Support yet.\\n\")\n pp path\n pp path.last.PortBusPortion\n pp path.last.Type\n pp @CONF_DB.INST.keys.index(path.last.InstName)\n exit\n elsif path.last.Type == \"input\" && connect_change\n if base_path.size == 1 && target_path.size != 1\n tmp = target_instance.split(\".\")\n tmp.delete_at(0)\n new_wire_Name = tmp.join(\"_\")\n name = \"FMakeWire_\" + new_wire_Name + \"_\" + base_port\n else\n name = \"FMakeWire_\" + target_instance.gsub(\".\",\"_\") + \"_\" + base_port\n end\n new_signal = FICE_DB::SignalInf.new( \n :name => name, \n :type => \"wire\", \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n ) \n # signal.Name = name\n # printf(\"XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",other_connect_inst,other_connect_port,module_name,name) \n # XMLParse::change_Connection(@root,module_name,other_connect_inst,{\"#{other_connect_port}\" => [new_signal]},con_db)\n printf(\"@XML Modify. Change Connection for %s.%s ( module name : %s , wire name : %s )\\n\",other_connect_inst,other_connect_port,module_name,name) if $VERBOSE\n XMLParse::change_Connection(@root,module_name.split(\".\").last,other_connect_inst.split(\".\").last,{\"#{other_connect_port}\" => [new_signal]},con_db)\n else\n printf \"Do nothing. (#{path.last.Type}, #{connect_change})\\n\" if $VERBOSE\n end\n end\n printf \"Done\\n\"\n # exit\n end\n end\n end\n end\n end\n\n # make port data\n signal = FICE_DB::SignalInf.new( \n :name => net.Name, \n :type => lower_direction, \n :msb => net.MSB, \n :lsb => net.LSB, \n :portion => net.BusPortion, \n :word_top => net.WordTop, \n :word_buttom => net.WordButtom,\n :new_flag => true\n )\n # Add Wire\n printf(\"XML Modify. Add Wire to %s module ( wire name : %s )\\n\",target_higher_module_name,signal.Name) if $VERBOSE\n XMLParse::add_Wire(@root,target_higher_module_name,signal)\n # Add Port\n printf(\"XML Modify. Add Port to %s module ( port name : %s ,direction : %s)\\n\",target_higher_module_name,signal.Name,lower_direction) if $VERBOSE \n XMLParse::add_Port(@root,target_higher_module_name,signal)\n # Add Terminal\n printf(\"XML Modify. Add Terminal to %s module ( terminal name : %s )\\n\",target_higher_module_name,signal.Name) if $VERBOSE \n ret = XMLParse::add_Terminal(@root,target_higher_module_name,signal,con_db)\n port_already = true if ret == 7\n # modify target_module\n# printf(\"Next Connection - 2\\n\")\n connect_modify_to_xml(con_db,con,signal,target_higher_module_name,nil,signal.Name,target_module,target_instance,target_port,port_already)\n# connect_modify_to_xml(con_db,con,signal,target_upper_module,nil,signal.Name,target_module,target_instance,target_port,port_already)\n\n # Make Next\n target_module = base_module\n target_instance = base_instance\n base_port = signal.Name\n base_current_module, base_upper_module, base_higher_module_name, base_upper_module_size = analyze_BaseTarget_path(target_upper_module,\"module\") if target_upper_module != nil\n base_current_instance, base_upper_instance, base_higher_instance_name, base_upper_instance_size = analyze_BaseTarget_path(target_upper_instance,\"instance\") if target_upper_instance != nil\n\n if base_upper_module != \"\"\n base_upper_module = base_upper_module + \".\" + base_current_module\n else\n base_upper_module = base_current_module\n end\n if base_upper_instance != \"\"\n base_upper_instance = base_upper_instance + \".\" + base_current_instance\n else\n base_upper_instance = base_current_instance\n end\n\n # Next Connection\n# printf(\"Next Connection - 3\\n\")\n connect_modify_to_xml(con_db,con,signal,base_upper_module,base_upper_instance,signal.Name,target_module,target_instance,base_sig.Name,port_already)\n port_already = false\n end\n\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def transfer(node, ins) ; ins ; end", "def node_type\n \"TeamNode\"\n end", "def ref=(new_ref)\n @ref = new_ref\n end", "def renamed?(node)\n return false if parents_for_node(node).first != NULL_ID\n \n m = read_meta node\n if m[\"copy\"]\n [m[\"copy\"], m[\"copyrev\"].unhexlify]\n else\n false\n end\n end" ]
[ "0.5471084", "0.5447363", "0.5312989", "0.5312989", "0.52841234", "0.5225092", "0.52004206", "0.5186044", "0.51643944", "0.5112983", "0.5042304", "0.50404096", "0.5009668", "0.5009532", "0.4975258", "0.49608403", "0.49426162", "0.4938916", "0.48863694", "0.486473", "0.48546124", "0.48519495", "0.48518223", "0.48228836", "0.48207927", "0.48147982", "0.48143664", "0.4804592", "0.4799403", "0.4788522", "0.47798765", "0.47791728", "0.47731686", "0.47548378", "0.47331175", "0.4731439", "0.47288167", "0.4722747", "0.47197938", "0.46935803", "0.46872064", "0.46826842", "0.46806562", "0.4676992", "0.4673049", "0.46657515", "0.46598747", "0.46489218", "0.4648186", "0.46481523", "0.46446207", "0.46436834", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46201918", "0.46103394", "0.4600003", "0.45944327", "0.45910507", "0.4584621", "0.45845243", "0.45793277", "0.4570612", "0.45701602", "0.45633253", "0.45578083", "0.45351484", "0.45351484", "0.45313329", "0.4516848", "0.4516848", "0.4516848", "0.45136264", "0.45104483", "0.45102775", "0.45098755" ]
0.47070068
39
We support an object, if its class is Serializable and is already included in the Registry.
def supports?(another_object) another_object.class.ancestors.include?(ActivityFeed::Serializable) && instance[another_object.class.af_type_id.to_sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(object) end", "def serializable?(value)\n true\n end", "def serialize(object)\n raise_or_return(object)\n end", "def serialize(object, data); end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def object\n raise NotImplementedError\n end", "def register(object); end", "def extend_object(obj) end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def object_data\n raise NotImplementedError, 'Subclass of EVSSClaimBaseSerializer must implement object_data method'\n end", "def get_msgpack_compatible_rec(obj, check_shared = true)\n if obj.is_a?(Fixnum) ||\n obj.is_a?(Bignum) ||\n obj.is_a?(Float) ||\n obj.nil? ||\n obj == true ||\n obj == false\n return obj\n #\n # First handle objects that are not shareable\n #\n elsif obj.is_a?(Symbol)\n return {\n OBJECT_CLASSNAME_REFERENCE => CLASS_ID_SYMBOL,\n OBJECT_CONTENT_REFERENCE => obj.to_s\n }\n elsif obj.is_a?(Encoding)\n return {\n OBJECT_CLASSNAME_REFERENCE => CLASS_ID_ENCODING,\n OBJECT_CONTENT_REFERENCE => obj.name\n }\n #\n # Handle shared objects\n #\n elsif check_shared &&\n !@shared_objs[obj.object_id].nil?\n # This object is shared: store its object_id only\n return {\n OBJECT_ID_REFERENCE => obj.object_id\n }\n #\n # Handle shareable objects\n #\n elsif obj.is_a?(Array)\n # First serialize its items\n return obj.map { |item| get_msgpack_compatible_rec(item) }\n elsif obj.is_a?(Hash)\n # First serialize its items\n hash_to_store = {}\n obj.each do |key, value|\n hash_to_store[get_msgpack_compatible_rec(key)] = get_msgpack_compatible_rec(value)\n end\n return hash_to_store\n elsif obj.is_a?(String)\n return obj\n elsif obj.is_a?(Range)\n return {\n OBJECT_CLASSNAME_REFERENCE => CLASS_ID_RANGE,\n OBJECT_CONTENT_REFERENCE => [get_msgpack_compatible_rec(obj.first), get_msgpack_compatible_rec(obj.last), obj.exclude_end?]\n }\n else\n # Handle other objects\n # If there is an ondump callback, call it\n obj.rubyserial_ondump if obj.respond_to?(:rubyserial_ondump)\n serialized_instance_vars = {}\n obj.instance_vars_to_be_rubyserialized.each do |var_name, value|\n serialized_instance_vars[var_name] = get_msgpack_compatible_rec(value)\n end\n return {\n OBJECT_CLASSNAME_REFERENCE => obj.class.name,\n OBJECT_CONTENT_REFERENCE => serialized_instance_vars\n }\n end\n end", "def _pack_object( obj ) \n klass = obj.class\n if klass == String\n obj\n elsif obj.respond_to?(:to_aqua) # Types requiring initialization\n obj.to_aqua( self )\n elsif obj.aquatic? && obj != self\n if obj._embed_me == true\n obj._pack\n else\n _build_stub( obj ) \n end \n else # other object without initializations\n _pack_vanilla( obj )\n end \n end", "def readObject\n raise NotImplementedError, <<-STR\n\n \\e[91m\n I'm afraid this might not work.\n > you need access to the original class definitions (and a)\n > Java runtime to load them into) to turn the stream data back\n > something approaching the original objects.\n \\e[0m\n STR\n end", "def full_object\n fail NotImplementedError\n end", "def is_object()\n res = super(context,self)\n return res\n end", "def is_a?(ob)\n __getobj__.is_a?(ob)\n end", "def __getobj__\n __raise__ ::NotImplementedError, \"need to define `__getobj__'\"\n end", "def serialize?(argument)\n argument.is_a?(klass)\n end", "def serialize?(argument)\n argument.is_a?(klass)\n end", "def serialize_default(object); object; end", "def _register_in_memory(obj, id)\n @lock.synchronize do\n unless obj.is_a?(ObjectBase)\n PEROBS.log.fatal \"You can only register ObjectBase objects\"\n end\n if @in_memory_objects.include?(id)\n PEROBS.log.fatal \"The Store::_in_memory_objects list already \" +\n \"contains an object for ID #{id}\"\n end\n\n @in_memory_objects[id] = obj.object_id\n @stats[:created_objects] += 1\n end\n end", "def serialize(object)\n case object\n when String\n {\n type: \"string\",\n value: object,\n description: object\n }\n when Numeric\n {\n type: \"number\",\n value: object,\n description: object.to_s\n }\n when TrueClass, FalseClass\n {\n type: \"boolean\",\n value: object,\n description: object.to_s\n }\n when Symbol\n {\n type: \"symbol\",\n value: object,\n description: object.to_s\n }\n when Array\n result = {\n type: \"object\",\n className: object.class.to_s,\n description: \"Array(#{object.length})\",\n objectId: register(object),\n subtype: \"array\"\n }\n\n result.merge!(\n preview: result.merge(\n overflow: false,\n properties: get_properties(object)\n )\n )\n\n result\n when nil\n {\n type: \"object\",\n subtype: \"null\",\n value: nil\n }\n else\n {\n type: \"object\",\n className: object.class.to_s,\n description: object.to_s,\n objectId: register(object)\n }\n end\n end", "def can_be_fully_dumped?(object)\n begin\n Marshal.dump(object)\n true\n rescue TypeError, IOError\n false\n end\n end", "def store_object(object)\n\n volatile_data = object.dehydrate()\n\n open_store(\"goids\", false) do |gd|\n gd[object.goid] = object.class.to_s\n end\n\n open_store(object.class, false) do |gd|\n gd[object.goid] = Marshal.dump(object)\n end\n\n if object.respond_to? :equipment\n object.equipment.each do |o|\n store_object(o) unless o.is_a? Player #this shouldn't happen, but who knows\n end\n end\n\n @saved += 1\n\n object.rehydrate(volatile_data)\n\n log \"Stored #{object} # #{object.game_object_id}\", Logger::Ultimate\n end", "def marshal(_object, _options = {})\n raise NotImplementedError\n end", "def write_object(object)\n extend_for(super)\n end", "def is_a?(obj)\n __getobj__.is_a?(obj)\n end", "def _pack_vanilla( obj ) \n {\n 'class' => obj.class.to_s,\n 'ivars' => _pack_ivars( obj )\n }\n end", "def resolve_object obj\n case obj\n when Shark::Object\n obj\n when String\n obj.identifier? ? @storage.find(obj) : nil\n else\n nil\n end\n end", "def plain_old_ruby_object\n\t\treturn false\n\tend", "def registered?(object)\n result = lookup(object).registered?\n if result.nil?\n warn \"This method is not supported for this kind of object.\\n\" +\n \"Use Whois.lookup('#{object}') instead.\"\n end\n result\n end", "def marshal_load(serialised); end", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def serialize!(object, serializer_instance)\n serializer = serializer(object, serializer_instance)\n return unless serializer\n serializer.call(object)\n end", "def serialize(object)\n object.serializable_hash\n end", "def serialize(object)\n object = MAPPINGS[object]\n object.nil? ? nil : object\n end", "def to_obj\n @obj ||= Registry.resolve(@namespace, @name)\n end", "def instance(object_path)\n raise ErrorNotSupported\n end", "def serialize(arg)\n raise NotImplementedError\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class}#dump is not implemented\"\n end", "def marshal_object(object_to_store)\n Marshal.dump(object_to_store)\n end", "def register_dynamic(object); end", "def object\n @obj\n end", "def __getobj__\n end", "def to_obj(ref)\n if @@ids.include?(ref)\n #ObjectSpace._id2ref(ref)\n @@ids[ref]\n else\n STDERR.puts \"attempted to load an unshared object by object id\"\n raise Exception.new(\"attempted to load an unshared object by object id\")\n end\n end", "def object\n __getobj__\n end", "def object\n @obj\n end", "def with_serializer(object, serializer); end", "def object_as(name)\n define_method(name) { @object }\n end", "def exists(_obj)\n raise NotImplementedError\n end", "def encode(obj); end", "def __object_type \n @object_type \n end", "def __object_type \n @object_type \n end", "def serialize(object)\n return Rubyprot::Serializer.serialize(object)\n end", "def to_obj; end", "def __setobj__(obj)\n __raise__ ::NotImplementedError, \"need to define `__setobj__'\"\n end", "def child_class\n Objekt\n end", "def is_object_of_class(jsClass)\n res = super(context,self,jsClass)\n return res\n end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def delegate_object_reader_method; end", "def save_to_storage(obj)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Build a white list for classes if doesn't exist\n\t\t@checked_classes = [] if @checked_classes.nil?\n\n\t\t# Check the object has a sane to_json defined\n\t\tif !@checked_classes.include?(obj.class.name)\n\t\t\tbegin\n\t\t\t\tJSON::parse(obj.to_json)\n\t\t\t\t@checked_classes << obj.class.name\n\t\t\trescue\n\t\t\t\traise \"[FATAL] Object cannot be stored, to_json method not defined\"\n\t\t\tend\n\t\tend\n\t\t\t\n\n\t\twrite_raw(obj)\n\tend", "def is_a?(klass)\n klass == Origen::Registers::Reg ||\n klass == self.class\n end", "def is_in(_obj)\n raise NotImplementedError\n end", "def safe_obj_by_key(obj_key)\n obj = Outpost.obj_by_key(obj_key)\n\n if !obj || !SAFE_CLASSES.include?(obj.class.name) || !obj.published?\n return nil\n end\n\n obj\n end", "def identifies_as?( object )\n \n return ::IdentifiesAs.object_identifies_as?( self, object ) \n \n end", "def register(object)\n object_id = SecureRandom.uuid\n @objects[object_id] = object\n object_id\n end", "def make_object klass\n obj = $manager.make_object klass\n inventory << obj if self.respond_to? :inventory\n obj\n end", "def object_class\n @object_class\n end", "def can_convert?\n MagicObjects.magic?(object)\n end", "def put(object)\n type = CLASS_TYPE[object.class] or raise NotImplementedError, \"class not supported: #{object.class}\"\n\n id = put_object(type, object.dump)\n\n objects[id] = object\n\n id\n end", "def literal_Object(o) # rubocop:disable Naming/UncommunicativeMethodParamName\n # Ignore any other object types\n end", "def can_dump?(p_object)\n begin\n Marshal.dump(p_object)\n return true\n rescue TypeError\n return false\n rescue\n return false\n end\n end", "def reload(obj)\n raise NotImplementedError, 'reload'\n end", "def object_type?\n @data[:object_type]\n end", "def serialize\n raise \"No object available to serialize!\" unless @object\n\n if @object.is_a?(Enumerable)\n return @object.map { |r| r.serializable_hash(self.get_serializer_config) }\n end\n return @object.serializable_hash(self.get_serializer_config)\n end", "def object(obj)\n case obj\n when nil; null(obj)\n when Boolean; boolean(obj)\n when Number; number(obj)\n when Symbol; symbol(obj)\n when Pair; pair(obj)\n when VM::Instruction; instruction(obj)\n when VM::CodeObject; codeobject(obj)\n when Array; sequence(obj)\n when String; string(obj)\n end\n end", "def serialize!\n end", "def serialize(object, user_options)\n object = prepare(object)\n\n return object unless @binding.representable?\n\n @binding.evaluate_option(:serialize, object) do\n marshal(object, user_options)\n end\n end", "def __getobj__; end", "def serialize(object)\n object ? constraint.convert(object) : []\n end", "def has_raw_for? raw_object_class\n available_raws.include? raw_object_class\n end", "def safe_reify\n reify\n rescue ActiveRecord::SubclassNotFound\n raise unless monkey_patch_safe_reify?\n\n # https://github.com/paper-trail-gem/paper_trail/blob/1fe26c9e445b0bcb2f7c20a5791ec01003632517/lib/paper_trail/reifier.rb#L132\n def self.object_deserialized # rubocop:disable Lint/NestedMethodDefinition\n super.dup.tap do |hsh|\n hsh['type'] = item_type\n end\n end\n\n retry\n end", "def selection(object)\n return object if object.is_a?(::Hash)\n serialize(object)\n end", "def selection(object)\n return object if object.is_a?(::Hash)\n serialize(object)\n end" ]
[ "0.6717054", "0.6472253", "0.6332966", "0.61425155", "0.6073836", "0.6073836", "0.6069357", "0.6063021", "0.60439", "0.6004501", "0.6004501", "0.59892976", "0.59872144", "0.5961174", "0.59514475", "0.5889394", "0.58681715", "0.5851104", "0.5822199", "0.57979465", "0.57979465", "0.5790865", "0.5788381", "0.5747998", "0.57216126", "0.5718381", "0.5696384", "0.5680145", "0.56762004", "0.5668625", "0.5667086", "0.5662354", "0.5650578", "0.5613635", "0.5610675", "0.5608141", "0.56075865", "0.5594834", "0.5589379", "0.55728227", "0.555638", "0.5550732", "0.5538383", "0.5532399", "0.55297893", "0.5521082", "0.55200106", "0.55160487", "0.55116045", "0.5497004", "0.54921347", "0.54891396", "0.54875106", "0.5486699", "0.5486699", "0.54827523", "0.5472623", "0.54670346", "0.5459892", "0.5452978", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.5451938", "0.54482853", "0.5447361", "0.54456776", "0.5442729", "0.5414624", "0.54137427", "0.54125124", "0.5387808", "0.53875566", "0.536346", "0.53633904", "0.5358506", "0.5343397", "0.5339901", "0.5337285", "0.5337042", "0.5306447", "0.53048515", "0.52973336", "0.52956474", "0.5288861", "0.5284751", "0.5284511", "0.52826315", "0.52826315" ]
0.594241
15
this is a very naive implementation to keep the array of SCC down to 5 it was a simple requirement for a course exercise
def trim_scc_array if @scc_size.size > 0 @scc_size.sort! if @scc_size.size < 5 if @scc_size.first > @last_scc_size @scc_size.push(@last_scc_size) else @scc_size.unshift(@last_scc_size) end else if @last_scc_size > @scc_size.first @scc_size[0] = @last_scc_size end end else @scc_size.push(@last_scc_size) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strongly_connected_components\n\t\t@explored_nodes = Array.new(size, false)\n\t\t@finishing_time_arr = Array.new(size)\n\t\t@scc = Array.new\n\t\t@dfs_queue = Array.new\n\t\t@finishing_time_queue = Array.new\n\t\t@finishing_time = 0\n\t\tcalculate_finishing_time\n\t\t@leaders = scc_call_order\n\t\tcalculate_scc\n\t\tputs \"#{@scc.map(&:count).sort.reverse.take(5)}\"\n\tend", "def find_scc\n # Check that the required files for computation exist\n @c.unreciprocated do |i,unr_filename|\n raise RuntimeError, \"Run build_graph before find_scc\" unless File.exist? unr_filename\n end\n \n @c.unreciprocated do |i,unr_filename|\n scc_filename = @c.scc_of_unreciprocated(i)\n \n puts \"Now reading in graph for #{i}\"\n a = AdjGraph.new\n File.open(unr_filename,\"r\") do |f|\n while ln = f.gets\n parts = ln.split\n a.add_directed_edge(parts[0].to_i,parts[1].to_i)\n end\n end\n \n puts \"Now calculating SCC for #{i}\"\n File.open(scc_filename+\"~\",\"w\") do |f|\n f.puts a.tarjan_string_limit(1000)\n end\n File.rename(scc_filename+\"~\", scc_filename)\n end\n end", "def plot_scc_graphs\n Dir.mkdir @c.images_dir unless File.directory? @c.images_dir\n \n ybase = Processor.to_hash(@c.unreciprocated_node_count)\n \n xp,yp = [],[]\n @c.scc_of_unreciprocated do |i,f|\n xp << i.to_f\n yp << File.read(f).split(\" \",2)[0].to_f / ybase[i].to_f\n end\n Plotter.plot(\"SCC for Unreciprocated\",\"Threshold\",\"Size of Largest SCC\",xp,yp,@c.scc_of_unreciprocated_image)\n end", "def cc\n preorder, postorder, visited, cc, ccs = [], [], [], [], []\n @count = 0\n id = {}\n adj_lists.each do |v|\n if !visited.include?(v.name)\n dfs_visit(v.name, adj_lists, id, visited, preorder, postorder)\n @count += 1\n puts \"***Back in cc method***\\n\"\n end\n end\n\n puts \"id = #{id}\\n\\n\"\n\n (0..id.values.last).each do |i|\n id.each do |vertex, component|\n cc << vertex if i == component\n end\n ccs << cc.sort if cc != []\n cc = []\n end\n print \"ccs: #{ccs}\\n\\n\"\n ccs\n end", "def lcs(array)\n old = 0\n current = 0\n array.each do |num|\n current += num\n if current < 0\n current = 0\n elsif current > old\n old = current\n end\n end\n\n old\nend", "def stair_climb(n)\n end", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def lcs(array)\n current_sum = 0\n largest_subsum = array[0]\n \n array.each do |num|\n cur_sum += num\n largest_subsum = cur_sum if cur_sum > largest_subsum\n cur_sum = 0 if cur_sum < 0\n end\n\n largest_subsum\nend", "def scc\n group_num, ids = scc_ids\n groups = Array.new(group_num) { [] }\n ids.each_with_index { |id, i| groups[id] << i }\n groups\n end", "def min_cost_climbing_stairs(cost)\n cost = cost + [0]\n table = Array.new(cost.length) { nil }\n table[0] = cost[0]\n table[1] = cost[1]\n\n table.each_with_index do |_val, i|\n next if i < 2\n table[i] = [table[i-1], table[i-2]].min\n table[i] += cost[i]\n end\n\n table.last\nend", "def climbingStaircase(n, k,arr = [])\n if n.zero?\n [arr]\n else\n (1..[k,n].min).map {|i| climbingStaircase(n-i,k,arr + [i])}.flatten(1)\n end\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def flatlandSpaceStations(n,c,m)\r\n answer = 0\r\n cc = c.sort()\r\n\r\n for i in (0..cc.size-2) do\r\n answer = [answer,(cc[i+1]-cc[i])/2].max\r\n end\r\n answer = [answer, cc[0], n-1 - cc[-1]].max\r\nend", "def stair_climb(n, step_sizes = [1, 2, 3], poss_steps = { 0 => [[]] })\n (1..n).each do |current_step|\n poss_steps[current_step] = []\n\n step_sizes.each do |next_step|\n last_counts = current_step - next_step\n next if last_counts < 0\n\n poss_steps[last_counts].each do |count|\n poss_steps[current_step] += [count + [next_step]]\n end\n end\n end\n\n poss_steps[n]\n end", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def max_cycle_length\n scc_kosaraju.map{|scc| scc.size}.max\n end", "def convolution_cyclopeptide_sequencing(spectrum, n, m, integer_mass)\n convolution = spectral_convolution(spectrum)\n extended_alphabet = restrict(convolution, m)\n #puts extended_alphabet.join(' ')\n leaderboard = Set.new\n leader_peptide = []\n leaderboard << leader_peptide\n leader_score = 0\n mass_parent = spectrum.last.to_i\n puts \"mass_parent #{mass_parent}\"\n # due to consistency constraints, we can only expand by integer masses that appear\n # in the spectrum and in the extended alphabet\n expandables = extended_alphabet & integer_mass\n #puts expandables.join(' ')\n while !leaderboard.empty?\n leaderboard = expand(leaderboard, expandables)\n leaderboard.each do |peptide|\n mass_peptide = mass(peptide)\n if mass_peptide == mass_parent\n # score the peptide cyclospectrum with experimental spectrum\n pep_score = cyclopeptide_scoring(peptide, spectrum)\n if pep_score > leader_score\n leader_peptide = peptide\n leader_score = pep_score\n puts \"new leader with score #{pep_score}: #{leader_peptide.join(' ')}\"\n end \n elsif mass_peptide > mass_parent\n leaderboard.delete(peptide)\n end\n end\n leaderboard = trim(leaderboard.to_set, spectrum, n)\n end\n leader_peptide\nend", "def super_frog_hops(num_stairs, max_stairs)\n cache = [[[]], [[1]]]\n return cache[num_stairs] if num_stairs < 2\n \n (2..num_stairs).each do |stairs|\n new_comb = []\n (1..max_stairs).each do |jump|\n if stairs - jump < 0\n next\n else\n cache[stairs - jump].each do |subarr|\n next_com = subarr + [jump] \n new_comb << next_com\n end \n end \n end \n cache[stairs] = new_comb\n end \n cache[num_stairs]\n end", "def frac (k, c, s)\n #\n ans = []\n tile = ['G', 'L']\n possible_source_sequences = tile.repeated_permutation(k).to_a\n seq = possible_source_sequences.dup\n for i in (2..c)\n seq = seq.map.with_index { |e, i| e.map { |ee| ee = (ee == 'G') ? 'G'*k : possible_source_sequences[i].join('') }}\n seq = seq.map { |e| e.join('').split('') }\n end\n\n for ii in (1..s)\n ss = seq.transpose\n ssl = ss.map { |e| e.count('L') }\n\n fewest_lead = ssl.min\n index_fewest_lead = ssl.find_index(fewest_lead)\n ans.push(index_fewest_lead)\n break if fewest_lead == 1\n tmp = []\n ss[index_fewest_lead].each.with_index { |e, i| tmp.push(seq[i]) if e == 'L'}\n seq = tmp\n return ['IMPOSSIBLE'] if ii == s and fewest_lead != 1\n end\n\n return ans.collect { |e| e + 1 }\nend", "def stair_climb(n)\n @cache = [\n [[]],\n [[1]],\n [[1, 1], [2]]\n ]\n\n return @cache[n] if n < 3\n\n (3..n).each do |i|\n new_climbs = []\n\n (1..3).each do |dist|\n previous = @cache[i - dist]\n previous.each do |climbs|\n new_climb = [dist]\n climbs.each { |climb| new_climb << climb }\n new_climbs << new_climb\n end\n end\n @cache << new_climbs\n end\n\n @cache.last\n end", "def lcs_phase_two(arr)\n return arr.max if arr.max < 0 #edge case\n\n current = 0\n largest = 0\n\n arr.each do |ele|\n current += ele\n current = 0 if current < 0 #bookmark\n largest = current if largest < current\n end\n\n largest\nend", "def largest_contigious_subsum(list)\n debugger\n lcs = list[0] \n current_sum = list[0]\n puts lcs\n list.each_with_index do |num, i|\n current_sum += list[i + 1]\n if current_sum > lcs \n lcs = current_sum\n end\n end\n lcs \nend", "def getWays(n, c)\n # Write your code here\n w = n\n m = c.length\n dp = Array.new(m+1){Array.new(w+1)}\n 0.upto(m) do |i|\n dp[i][0] = 1\n end\n 0.upto(w) do |j|\n dp[0][j] = 0\n end\n 1.upto(m) do |i|\n 1.upto(w) do |j|\n x = j-c[i-1] >= 0 ? dp[i][j-c[i-1]] : 0\n y = j >= 1 ? dp[i-1][j] : 0\n dp[i][j] = x+y\n end\n end\n p dp\n dp[m][w]\nend", "def climb_stairs(n)\n table = Array.new(45) { 0 }\n table[0] = 1\n table[1] = 2\n\n table.each_with_index do |_val, i|\n next if i < 2\n table[i] = table[i - 1] + table[i - 2]\n end\n\n table[n-1]\nend", "def compute(name, ref, span, snps)\n return if span.length < 1\n\n span.sort! {|a,b| a[0] <=> b[0]}\n head = span.shift\n ss,ee = head[0],head[1]\n array = []\n \n array << ss \n span.each do |breaks|\n array << breaks[0]\n array << breaks[1]\n end\n array << ee \n\n while array.size > 0\n s = array.shift\n e = array.shift\n# $stderr.puts \"#{ref}\\t#{s}\\t#{e}\"\n (s..e).each do |i|\n @coverage[ref][i] += 1 #Compute coverage on base i\n end\n end\n\n snps.each_key do |pos|\n refbase = @seq[ref][pos-1,1].upcase\n curbase = snps[pos][:snpbase]\n if snps.key?(pos + 1) or snps.key?(pos + 2) or snps.key?(pos - 1) or snps.key?(pos - 2)\n if snps.key?(pos + 1) and refbase == snps[pos+1][:snpbase] and curbase == @seq[ref][pos,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 1) and refbase == snps[pos-1][:snpbase] and curbase == @seq[ref][pos-2,1].upcase \n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 2) and refbase == snps[pos+2][:snpbase] and curbase == @seq[ref][pos+1,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 2) and refbase == snps[pos-2][:snpbase] and curbase == @seq[ref][pos-3,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 1) or snps.key?(pos - 1) \n snps[pos][:info] << \"mnp;\"\n else\n snps[pos][:info] << \"snp;\" \n end\n else\n snps[pos][:info] << \"snp;\" \n end\n @snp[ref][pos] = '' unless @snp[ref].key?(pos)\n @snp[ref][pos] << snps[pos][:info]\n end\nend", "def print_lcs(c, x, i, j)\n return if i==0 || j==0\n current = c[i][j]\n# puts \"i: #{i}, j: #{j} current: #{c[i][j]}\"\n# puts \"Current #{current}\"\n #this is mostly the reverse of what order we used them in\n if current == c[i-1][j]\n print_lcs(c, x, i-1, j)\n elsif current == c[i][j-1]\n print_lcs(c, x, i, j-1)\n else\n # only case left is current = c[i-1, j-1]\n print_lcs(c, x, i-1, j-1)\n print x[i-1] # zero index conversion\n end\n\nend", "def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend", "def minCut(graph, size)\n cross = 0\n contraction graph, size\n #the size of the graph has decreased by 1\n #stop recursing when there is only two vertices left\n if size - 1 > 2\n # puts \"graph #{graph}\"\n cross = minCut graph, size - 1\n end\n if size == 3\n for i in graph[0][1..-1]\n if graph[1].include? i\n cross += 1\n end\n end\n end\n cross\nend", "def hcv_ns5a(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[28] = ['M',['T']]\n sdrm[30] = ['L',['H','K','R','Q','A','S','D']]\n sdrm[31] = ['L',['M','V','F']]\n sdrm[32] = ['P',['L']]\n sdrm[44] = ['K',['R']]\n sdrm[58] = ['H',['D','P','S']]\n sdrm[64] = ['T',['A','S']]\n sdrm[77] = ['P',['A','S']]\n sdrm[78] = ['R',['K']]\n sdrm[79] = ['T',['A']]\n sdrm[83] = ['T',['M']]\n sdrm[85] = ['S',['N','H','Y']]\n sdrm[92] = ['A',['P','T','K','E']]\n sdrm[93] = ['Y',['C','F','H','N']]\n sdrm[107] = ['K',['T','S']]\n sdrm[121] = ['I',['V']]\n sdrm[135] = ['T',['A']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend", "def candies(n, arr)\n cc = []\n cc[0] = 1\n 1.upto(n-1) do |i|\n if arr[i] > arr[i-1]\n cc[i] = cc[i-1] + 1\n else\n cc[i] = 1\n end\n end\n p cc\n (n-2).downto(0) do |i|\n if arr[i] > arr[i+1] && cc[i] <= cc[i+1]\n cc[i] = cc[i+1] + 1\n end\n end\n p cc\n cc.reduce(:+)\nend", "def lcs\n setup\n compute_matrix\n @matrix.last.last\n end", "def scaffolds(contig_connections)\n # It is like an (easy)\n # assembly problem because each vertex can only be connected to\n # two others - 1 intra-contig and 1 inter-contig (unless it is circular)\n likelies_edge_set = Yargraph::UndirectedGraph::EdgeSet.new\n contig_connections.each do |conn|\n likelies_edge_set.add_edge conn.probe1.to_settable, conn.probe2.to_settable\n end\n\n scaffolded_paths = []\n circular_single_contigs = Set.new\n\n # while there is more elements in the likelies set,\n # 'pop' an arbitrary edge out of the graph\n while starting_edge = likelies_edge_set.pop\n log.debug \"starting to scaffold from #{starting_edge}\" if log.debug?\n\n # Ignore likelies that are circular\n if starting_edge[0][0] == starting_edge[1][0]\n log.debug \"Not scaffolding contig #{starting_edge[0][0] } since it appears to be circular\" if log.debug?\n circular_single_contigs << starting_edge[0][0]\n next\n end\n\n circular = false\n\n # go 'left'. Connect the other side of the left.\n lefts = [Probe.new(starting_edge[0])]\n rights = [Probe.new(starting_edge[1])]\n log.debug \"rights was #{rights[0].to_s}\" if log.debug?\n # while there is another node to the left\n while next_probe = likelies_edge_set[lefts[-1].companion.to_settable].to_a[0]\n next_probe_probe = Probe.new(next_probe)\n companion = lefts[-1].companion\n\n likelies_edge_set.delete next_probe, companion.to_settable\n if next_probe_probe.companion.to_settable == rights[0].to_settable\n log.debug \"Found multi-contig circularity between #{next_probe_probe.companion} and #{rights[0] }\" if log.debug?\n circular = true\n break\n end\n\n lefts.push companion\n lefts.push next_probe_probe\n log.debug \"Adding node to the left: #{next_probe} and companion #{companion}\" if log.debug?\n end\n # and go right\n while next_probe = likelies_edge_set[rights[-1].companion.to_settable].to_a[0]\n companion = rights[-1].companion\n rights.push companion\n rights.push Probe.new(next_probe)\n log.debug \"Adding node to the right: #{next_probe} and companion #{companion}\" if log.debug?\n likelies_edge_set.delete next_probe, companion.to_settable\n end\n\n # Add the left and the right together into one path\n scaffolded_paths.push(\n PossiblyCircularArray.new(\n [lefts[-1].companion]+\n lefts.reverse+\n rights+\n [rights[-1].companion],\n circular)\n )\n end\n if log.debug?\n log.debug \"Found #{scaffolded_paths.length} multi-contig scaffold(s):\"\n scaffolded_paths.each do |path|\n log.debug \"Scaffold: #{path.collect{|e| e.to_s}.join(', ') }\"\n end\n end\n\n # for each scaffolded set, create new scaffold object\n scaffolds = []\n scaffolded_contigs = Set.new\n scaffolded_paths.each do |path|\n raise if path.length % 2 != 0\n scaffold = Scaffold.new\n scaffold.circular = path.circular\n previous_probe = nil\n path.each_with_index do |probe, i|\n if i % 2 == 1\n previous_probe = probe\n next\n end\n contig = UnscaffoldedContig.new\n contig.sequence_index = probe.sequence_index\n if probe.side == :start\n contig.direction = true\n else\n contig.direction = false\n end\n scaffold.contigs ||= []\n unless scaffold.contigs.empty?\n dummy_conn = Connection.new\n dummy_conn.probe1 = previous_probe\n dummy_conn.probe2 = probe\n original_connection = @connection_hash[dummy_conn.to_settable]\n scaffold.gap_lengths.push original_connection.distance\n end\n scaffold.contigs.push contig\n scaffolded_contigs << probe.sequence_index\n end\n scaffolds.push scaffold\n end\n\n # for each contig that is not in a contig, add as singleton\n @sequence_ids.each do |i|\n unless scaffolded_contigs.include?(i)\n scaff = Scaffold.new\n contig = UnscaffoldedContig.new\n contig.sequence_index = i\n contig.direction = true\n scaff.contigs = [contig]\n if circular_single_contigs.include?(i)\n scaff.circular = true\n else\n scaff.circular = false\n end\n scaffolds.push scaff\n end\n end\n\n return scaffolds\n end", "def min_cost_climbing_stairs(cost)\n i = cost.length - 3\n while i >= 0\n cost[i] += [cost[i+1], cost[i+2]].min\n i -= 1\n end\n\n [cost[0], cost[1]]\nend", "def cyclospectrum_linear(peptide)\n cyclospectrum = []\n for i in 0..peptide.length-1\n sub = 0\n for j in i..peptide.length-1\n sub += peptide[j]\n cyclospectrum << sub\n end\n end\n cyclospectrum\nend", "def lcs(arr)\n lcs_helper(arr)[:best_sum]\nend", "def freed_prisoners(arr)\n counter = 0\n return counter if arr[0] == 0\n arr.each do |cell|\n if cell == 1\n counter += 1\n arr.map! do |switch|\n if switch == 1\n switch = 0\n else\n swith = 1\n end\n end\n else\n next\n end\n end\n counter\nend", "def get_straights(cards)\r\n straights = power_sort_cards(cards.uniq { |c| c.strength })\r\n .each_cons(5)\r\n .to_a\r\n\r\n # Make sure all elements are immediately consecutive.\r\n straights.select do |straight|\r\n !!straight.inject do |prev, nxt|\r\n break false if prev.strength != (nxt.strength + 1)\r\n nxt\r\n end\r\n end\r\n end", "def cavity grid\n # copy_g = grid\n\n # # size = copy_g[0].length\n\n # copy_g.delete_at(size-1)\n # copy_g.delete_at(0)\n\n # copy_g[0].delete_at(size-1)\n # copy_g[0].delete_at(0)\n\n # # p copy_g\n\n # center = []\n\n # size = grid.size -1\n\n\n # (1..size).each do |i|\n # j = size - i\n # center << [i,j]\n # center << [i,j+1]\n # end\n # p center\n\ncenter = []\ncavity = []\nsize = grid.size-1\n\ncopy_g = grid\n\ngrid.each_with_index do |x, xi|\n x.each_with_index do |y, yi|\n\n\n if xi != 0 && yi != 0 && xi != size && yi != size\n # p \"element [#{xi}, #{yi}] is #{y}\"\n center << [xi, yi]\n\n if grid[xi][yi + 1] < y && grid[xi][yi - 1] < y\n cavity << [xi, yi]\n copy_g[xi][yi] = 'X'\n end\n\n end\n end\nend\n\np center\np cavity\np copy_g\n\nend", "def lcs(string1, string2)\n # Declare a two dimensional array\n lcs_grid = Array.new(string1.length+1) {Array.new(string2.length+1) { 0 }}\n for i in 1..string1.length\n for j in 1..string2.length\n if string1[i-1] == string2[j-1]\n lcs_grid[i][j] = lcs_grid[i-1][j-1] + 1\n else\n lcs_grid[i][j] = [lcs_grid[i-1][j],lcs_grid[i][j-1]].max\n end\n end\n end \n # puts \"Length of LCS between #{string1} and #{string2} is #{lcs_grid.last.last}\"\n\n # Tracing backwards to print the LCS using recursion\n lcss = tracing_lcs(lcs_grid, string1, string2, string1.length, string2.length)\n return lcss.join(\"\"), lcs_grid.last.last\nend", "def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend", "def consecutive_collapse(nums)\n\n collapsed = false \n\n while !collapsed\n collapsed = true\n idx = 0 \n while idx < nums.length\n prev_n = nums[idx] - 1\n next_n = nums[idx] + 1\n # debugger\n if idx > 0 && (nums[idx - 1] == prev_n || nums[idx - 1] == next_n)\n collapsed = false\n nums.slice!((idx - 1)..idx)\n break\n elsif nums[idx + 1] == next_n || nums[idx + 1] == prev_n\n collapsed = false\n nums.slice!(idx..idx+1)\n break\n end\n idx += 1\n end\n end\n nums\nend", "def total_n_queens_proto(n)\n base=[]\n n.times do\n base.push Array.new(n, 0)\n end\n result=[]\n result[0]=0\n dfs(base, n, -1, 0, result)\n #[result.size, result]\n result[0]\nend", "def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend", "def lcs(array)\n return 0 if array.empty?\n current_sum = 0\n largest_sum = arr.first\n\n arr.each do |el|\n current_sum += el\n largest_sum = current_sum if largest_sum < current_sum\n current_sum = 0 if current_sum < 0\n #reset the current sum if the subsum is negative. If it's 0, it's all good.\n end\n\n largest_sum\nend", "def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end", "def min_cost_climbing_stairs(arr)\n next_one, next_two = 0, 0\n curr = 0\n\n (arr.length - 1).downto(0).each do |i|\n curr = arr[i] + min(next_one, next_two)\n next_two = next_one\n next_one = curr\n end\n\n return min(next_one, next_two)\nend", "def seating_students(arr)\n num_desks = arr.first\n full_desks = arr[1..-1]\n desks = (1..num_desks).to_a\n adjacent = []\n desks.each do |desk|\n if desk.odd?\n adjacent << [desk, desk + 1] << [desk, desk + 2]\n else\n adjacent << [desk, desk + 2]\n end\n end\n adjacent.delete_if do |desk1, desk2|\n full_desks.include?(desk1) || full_desks.include?(desk2) || desk2 > num_desks\n end\n adjacent.size\nend", "def scc_tarjan\n index = 0 # numbers nodes consecutively in the order discovered\n stack, scc, vertices = [], [], []\n\n # create new Struct, if not already defined\n if Struct::const_defined?(\"TarjanVertex\")\n Struct.const_get(\"TarjanVertex\")\n else\n Struct.new(\"TarjanVertex\", :name, :index, :lowlink)\n end\n\n adj_lists.each do |v|\n # -1 means vertex is unvisited\n vertex = Struct::TarjanVertex.new(v.name, -1, -1)\n vertices << vertex # array of all TarjanVertex objects in graph\n end\n vertices.each do |vertex|\n tarjan_dfs(vertex, scc, stack, index, vertices) if vertex.index == -1\n end\n # return nested array of all SCCs in graph\n # NOTE: all SCCs are found in REVERSE topological order.\n # If we reverse nested array, we get topological sort of the SCCs!\n scc\n end", "def feedback_arc_set_step0(graph)\n fas = []\n each_cyclic_strongly_connected_component_graph(graph) do |scc|\n scc.keys.sort.each do |n| # demand determinism\n vs = scc[n] or next\n vs.size > 0 or next\n vs.sort! # demand determinism\n fas << [n, vs.shift]\n break\n end\n end\n fas\n end", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def stair_climb(n)\n ways_collection = [[[]], [[1]], [[1, 1], [2]]]\n\n return ways_collection[n] if n < 3\n\n (3..n).each do |i|\n new_way_set = []\n (1..3).each do |first_step|\n ways_collection[i - first_step].each do |way|\n new_way = [first_step]\n way.each do |step|\n new_way << step\n end\n new_way_set << new_way\n end\n end\n ways_collection << new_way_set\n end\n\n ways_collection.last\n end", "def consecutive_collapse(arr)\nend", "def caterpillar(a, s)\n front, sum = 0, 0\n n = a.size\n n.times do |back|\n # inch front of caterpillar as many steps as possible\n while front < n && sum + a[front] <= s \n sum += a[front]\n front += 1\n end\n if sum == s\n puts \"back: #{back}, front: #{front}\"\n return true \n end\n sum -= a[back] # move back of caterpillar forward 1 step\n end\n false\nend", "def min_cost_climbing_stairs(cost)\n cost = cost + [0]\n\n last = cost[1]\n last_last = cost[0]\n\n cost[2..-1].each do |cost|\n new_cost = cost + [last, last_last].min\n last_last = last\n last = new_cost\n end\n\n last\nend", "def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end", "def lcs3(s1, s2, s3)\n table = Array.new(s1.size + 1) { Array.new(s2.size + 1) { Array.new(s3.size + 1) { 0 } } }\n 1.upto(s1.size) do |i|\n 1.upto(s2.size) do |j|\n 1.upto(s3.size) do |k|\n table[i][j][k] =\n if s1[i - 1] == s2[j - 1] && s1[i - 1] == s3[k - 1]\n table[i - 1][j - 1][k - 1] + 1\n else\n [\n table[i][j][k - 1],\n table[i][j - 1][k],\n table[i][j - 1][k - 1],\n table[i - 1][j][k],\n table[i - 1][j][k - 1],\n table[i - 1][j - 1][k]\n ].max\n end\n end\n end\n end\n table[s1.size][s2.size][s3.size]\n end", "def outsense_edist(u, v)\n\n # initialize m and n\n m = u.length\n n = v.length\n\n # create hash of arrays where \n # hash.key holds h and array index holds d\n # thus hash[h][d] = front(h, d) = i\n front = Hash.new(Array.new)\n \n # initialize d with 0 for the first front\n d = 0\n\n # calculate front(0, 0)\n front[0][d] = lcplen(u, v, m, n)\n \n # till front(n - n, d) = m\n while front[n-m][d] != m-1\n\n # increase d\n d += 1\n \n # fronts calculated according to script\n ((-d)..d).each do |h|\n front[h][d] = outsense_next_front(front, h, d, u, v, m, n)\n end\n end\n\n # length of array with hash key m - n (= h) is \n # as long as the index of its last entry (= d) + 1\n return (front[m-n].length - 1)\nend", "def solution(n, a)\n max = 0\n counters = Array.new(n, max)\n a.each do |counter|\n if counter == n + 1\n counters.fill(max)\n else\n counters[counter - 1] += 1\n max = counters[counter - 1] if counters[counter - 1] > max\n end\n end\n counters\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def all_cycles\n cycles = []\n start = adj_lists.first.name\n visited = [start] # stack\n previous = {}\n adj_lists.each {|v| previous[v.name] = nil}\n # each cycle may not be bigger than biggest SCC (strongly connected component)\n if max_cycle_length > 1\n answer = all_cycles_dfs(visited, previous, cycles)\n else\n return \"NO CYCLES EXIST\"\n end\n print \"Cycles: #{answer}\\n\\n\"\n answer\n end", "def eClosure(ss)\nvisited = []\ndiscovered = [ss]\nwhile discovered != []\nn = discovered.pop\nif !(visited.include?(n))\nvisited.push(n)\nsuccessor = get_transition(n, \"\")\nif successor != nil\nsuccessor.each{|s|\nif !(visited.include?(s))\ndiscovered.push(s)\nend\n}\nend\nend\nend\nvisited\nend", "def find_scc(person)\n\t\tperson.index = person.lowlink = @index\n\t\t@index += 1\n\t\[email protected](person)\n\t\tperson.on_stack = true\n\t\tperson.following.each do |id|\n\t\t\tw = @people[id]\n\t\t\tif w.index.nil?\n\t\t\t\t# successor not visited yet\n\t\t\t\tfind_scc(w)\n\t\t\t\tperson.lowlink = [person.lowlink, w.lowlink].min\n\t\t\telsif w.on_stack\n\t\t\t\t# successor already in scc\n\t\t\t\tperson.lowlink = [person.lowlink, w.index].min\n\t\t\tend\n\t\tend\n\t\t\n\t\tif person.lowlink == person.index # root node\n\t\t\tscc = []\n\t\t\tloop do\n\t\t\t\tw = @stack.pop\n\t\t\t\tw.on_stack = false\n\t\t\t\tscc << w.name\n\t\t\t\tbreak if w.id == person.id\n\t\t\tend\n\t\t\t@sccs << scc if scc.length >= @min_group_size\n\t\tend\n\tend", "def choleski(n, a)\n n = n - 1\n\n l = Array.new(n + 1) { Array.new(n + 1) { 0 } }\n l[0][0] = Math::sqrt(a[0][0])\n\n (1..n).each do |i|\n l[i][0] = a[i][0].fdiv(l[0][0])\n end\n\n l[1][1] = Math::sqrt(a[1][1] - l[1][0] ** 2)\n\n (2..n).each do |i|\n (1..i - 1).each do |j|\n sumatoria = (0..j - 1).inject(0) { |sum, k| sum + l[i][k] * l[j][k] }\n l[i][j] = (a[i][j] - sumatoria).fdiv(l[j][j])\n end\n\n sumatoria = (0..i - 1).inject(0) { |sum, k| sum + l[i][k] ** 2 }\n l[i][i] = Math::sqrt(a[i][i] - sumatoria)\n end\n\n puts \"Las componentes lij de la matriz L son #{l}.\"\n return l\nend", "def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend", "def make_groups(all_students)\n\n #calculate how many groups of 5, with one group of leftovers\n num_full_groups = all_students.size / 5\n leftovers = all_students.size % 5\n group_avg = all_students.size.to_f / num_full_groups\n\n #each entry in group_sizes represents one group - put 5 in each full one\n group_sizes = Array.new\n for i in 0...num_full_groups\n group_sizes[i] = 5\n end\n\n #if there's a leftover group- while its size is (1 or more) students less than average, move students into it from other groups one by one\n if leftovers != 0\n i = 0\n while ((group_avg - leftovers) >= 1)\n group_sizes[i] -= 1\n leftovers += 1\n if i.next == num_full_groups\n i = 0\n else\n i = i.next\n end\n end\n group_sizes << leftovers #add leftovers group to group_sizes list\n end\n\n #now we have an array of group sizes, ex: [4,4,5,5,4]\n #populate new groups_names array with arrays of student names of those sizes\n\n groups_names = Array.new\n groupcount=0\n group_sizes.cycle(1) do |i|\n groups_names[groupcount] = Array.new\n for j in 0...i\n groups_names[groupcount][j] = all_students.shift\n end\n groupcount += 1\n end\n\n groups_names\n\nend", "def count_cut(value)\n\t\t# cuts 'value' cards from the top of the deck and inserts them\n\t\t# right before the last element\n\t\tvalue.times do\n\t\t\tcard = @deck_of_cards.delete_at(0)\n\t\t\t@deck_of_cards.insert(-2, card)\n\t\tend\n\tend", "def lcs(array)\n current_sum = 0\n max = array[0] || 0\n\n array.each do |el|\n current_sum += el\n if current_sum > max\n max = current_sum\n end\n if current_sum < 0\n current_sum = 0\n end\n end\n\n return max\nend", "def jumpingOnClouds(c)\n\ti, counter, n = 0, 0, c.length\n\n\twhile i < n-1 do \n\t\tif c[i + 2] == 0 \n\t\t\ti = i + 2 \n\t\telsif c[i + 1] == 0 \n\t\t\ti = i + 1\n\t\tend\n\n\t\tcounter += 1\n\tend\n\n\tcounter\nend", "def consecutive_collapse(arr)\n (0...arr.size - 1).each do |i|\n j = i + 1\n next unless (arr[i] - arr[j]).abs == 1\n\n front = i.zero? ? [] : arr[0...i]\n rear = j == arr.size - 1 ? [] : arr[(j + 1)...arr.size]\n return consecutive_collapse(front + rear)\n end\n arr\nend", "def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend", "def climb_stairs(n)\n return 0 if n.zero?\n return 1 if n == 1\n\n dp = []\n dp[n] = 1\n dp[n - 1] = 1\n (n - 2).downto(0) do |idx|\n dp[idx] = dp[idx + 1] + dp[idx + 2]\n end\n dp.first\nend", "def consecutive_collapse(arr)\n collapsed = true\n while collapsed\n collapsed = false\n i = 0\n while i < arr.length - 1\n if arr[i] - arr[i + 1] == 1 || arr[i] - arr[i + 1] == -1\n arr = arr[0...i] + arr[i + 2..-1]\n collapsed = true\n end\n i += 1\n end\n end\n arr\nend", "def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend", "def consecutive_collapse(nums)\n collapsed = Array.new(nums)\n can_be_collapsed = true\n\n while can_be_collapsed\n\n can_be_collapsed = false\n iterator = 0\n while iterator < collapsed.length-1\n\n if collapsed[iterator] == collapsed[iterator+1]-1 || collapsed[iterator] == collapsed[iterator+1]+1\n can_be_collapsed = true\n collapsed.slice!(iterator..iterator+1)\n break\n end\n \n iterator += 1\n end\n end\n collapsed\nend", "def excise connected_components, gses, gsms\n excisions = 0\n connected_components.each { |c|\n print \"Connected component with #{c.length} GSEs:\\n\"\n c.each { |gse1|\n c.each { |gse2|\n next if (gse1 == gse2) or\n (gsms[gse1].length < gsms[gse2].length) or\n ! gsms[gse1].intersect?( gsms[gse2] )\n\n diff = gsms[gse1] - gsms[gse2]\n if diff.length >= @options.minimum # default: there must be at least 3 samples left\n inter = (gsms[gse1] & gsms[gse2])\n if @excisions\n if @excised[gse1] \n @excised[gse1] = (@excised[gse1] + inter)\n else\n @excised[gse1] = inter\n end\n end\n print \"gsms[#{gse1}]: #{gsms[gse1].length} -> #{diff.length}\\n\"\n if @options.verbose and @options.dictionary\n printf \"removing these GSMs from #{gse1}:\\n\"\n stringify_gsms inter\n end\n gsms[gse1] = diff\n excisions += 1\n end\n }\n }\n }\n\n print \"Number of excisions: #{excisions}\\n\"\n \n print \"\\nPairwise overlaps after excision:\\n\"\n overlapping = overlaps(gses.to_a, gsms, true)\n print \" total overlaps: #{overlapping[0]}\\n\"\n print \" nontrivial overlaps: #{overlapping[1]}\\n\"\n overlapping[1]\nend", "def min_cut(s)\n is_pali = Array.new(s.size){Array.new(s.size, false)}\n min_cuts = Array.new(s.size)\n (0...s.size).each do |i|\n min_num = Float::INFINITY # store max val\n (0..i).each do |j|\n if s[i] == s[j] && (j + 1 >= i || is_pali[j + 1][i - 1])\n is_pali[j][i] = true\n min_num = j == 0 ? 0 : [min_num, min_cuts[j - 1] + 1].min\n end\n end\n min_cuts[i] = min_num\n end\n min_cuts[s.size - 1]\nend", "def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend", "def leaderboard_cyclopeptide_sequencing(spectrum, n)\n # To be fair, a cut should include anyone who is tied with the Nth-place competitor.\n # Thus, Leaderboard should be trimmed down to the “N highest-scoring linear peptides including ties”, \n # which may include more than N peptides. Given a list of peptides Leaderboard, a spectrum Spectrum, \n # and an integer N, define Trim(Leaderboard, Spectrum, N) as the collection of the top N highest-scoring \n # linear peptides in Leaderboard (including ties) with respect to Spectrum.\n\n # Note that Score(Peptide, Spectrum) currently only scores Peptide against Spectrum if Peptide is cyclic. \n # However, to generalize this scoring function when Peptide is linear, we simply exclude those subpeptides\n # of Peptide that wrap around the end of the string, resulting in a function LinearScore(Peptide, Spectrum). \n # For example, if Spectrum is the experimental spectrum of NQEL, then you can verify that LinearScore(Peptide, Spectrum) = 8.\n\n # LEADERBOARDCYCLOPEPTIDESEQUENCING(Spectrum, N)\n # Leaderboard ← {empty peptide}\n # LeaderPeptide ← empty peptide\n # while Leaderboard is non-empty\n # Leaderboard ← Expand(Leaderboard)\n # for each Peptide in Leaderboard\n # if Mass(Peptide) = ParentMass(Spectrum)\n # if Score(Peptide, Spectrum) > Score(LeaderPeptide, Spectrum)\n # LeaderPeptide ← Peptide\n # else if Mass(Peptide) > ParentMass(Spectrum)\n # remove Peptide from Leaderboard\n # Leaderboard ← Trim(Leaderboard, Spectrum, N)\n # output LeaderPeptide \n\n leader_board = []\n leader_peptide = \"\"\n parent_mass = spectrum[-1]\n loop do\n leader_board = expand_peptides(leader_board)\n # puts leader_board.join(\" \")\n leader_board.dup.each do |peptide|\n # puts parent_mass.to_s + \" \" + peptide_mass(peptide).to_s\n if peptide_mass(peptide) == parent_mass\n if linearpeptide_score(peptide, spectrum) > linearpeptide_score(leader_peptide, spectrum)\n leader_peptide = peptide\n end\n elsif peptide_mass(peptide) > parent_mass\n leader_board.delete(peptide)\n end\n end\n # puts leader_board.join(\" \")\n leader_board = leaderboard_trim(leader_board, spectrum, n) \n break if leader_board.empty?\n end\n return peptide_to_mass(leader_peptide)\n end", "def min_cost(costs)\n n = costs.length\n return 0 if n == 0\n \n (1..n - 1).each do |i|\n costs[i][0] += [costs[i - 1][1], costs[i - 1][2]].min\n costs[i][1] += [costs[i - 1][0], costs[i - 1][2]].min\n costs[i][2] += [costs[i - 1][0], costs[i - 1][1]].min\n end\n \n [costs[n - 1][0], costs[n - 1][1], costs[n - 1][2]].min \n \nend", "def lcs(list)\n largest_sum = list[0]\n current_sum = list[0]\n\n return list.max if list.all? { |num| num < 0 }\n\n list[1..-1].each do |num|\n current_sum = 0 if current_sum < 0 \n current_sum += num\n largest_sum = current_sum if current_sum > largest_sum\n end\n\n largest_sum\nend", "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def consecutive_collapse(arr)\n \n solved = false\n\n\tuntil solved\n\t\tsolved = true\n temp_arr = []\n\n\t\t(0...arr.length - 1).each do |i|\n next if arr[i] == nil\n\n\t\t\tif arr[i] + 1 == arr[i + 1] || arr[i] - 1 == arr[i + 1]\n\n\t\t\t\tarr[i], arr[i + 1] = nil, nil\n\n\t\t\t\tsolved = false\n\t\t\tend\n\n\t\tend\n arr.delete(nil)\n\tend\n\n arr\n\nend", "def consecutive_collapse(nums)\n found_pairs = true\n collapsed = nums\n\n while(found_pairs)\n found_pairs = false\n new_iterration = []\n\n (0...collapsed.count-1).each do |i|\n if consecutive?(collapsed[i], collapsed[i+1])\n new_iterration.concat(collapsed[i+2..-1])\n found_pairs = true\n break\n else\n new_iterration << collapsed[i]\n end\n end\n collapsed = new_iterration if found_pairs\n end\n collapsed\nend", "def stair_climb(n)\n routes = [[[]], [[1]], [[1, 1], [2]]] # like fibb sequence\n\n (3).upto(n) do |dest_step|\n current_routes = []\n (1).upto(3) do |last_step|\n routes[dest_step - last_step].each do |route|\n current_routes << [last_step] + route\n end\n end\n routes << current_routes\n end\n\n routes[n]\n end", "def series_up(n)\n new_list=[] # to push into a new list\n (n + 1).times do |index| #You need the nested loop index.times to run at least once. Since Index starts at 0, you need to add 1 so that it runs at least once\n index.times do |value| # this runs the loop each time until it reaches the number needed\n new_list.push(value + 1) #Same as the loop above. Since the value starts at 0, you need to start at 1 bc that's what the challenge wants you to do. the .push pushes it into the new list \n end \n end \n return new_list # this makes the function print the newly created list\nend", "def climb_stairs(n)\n prev_count = curr_count = 1\n (n - 1).times do\n temp = curr_count\n curr_count += prev_count\n prev_count = temp\n end\n curr_count\nend", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def partition(cv, fv, bs, cp)\n # best cut point\n cp_best = nil\n \n # binary subset at the best cut point\n cv1_best, cv2_best = nil, nil\n fv1_best, fv2_best = nil, nil\n bs1_best, bs2_best = nil, nil\n \n # best information gain\n gain_best = -100.0\n ent_best = -100.0\n ent1_best = -100.0\n ent2_best = -100.0\n \n # try each potential cut point\n bs.each do |b|\n # binary split\n cv1_try, cv2_try, fv1_try, fv2_try, bs1_try, bs2_try = \n binary_split(cv, fv, bs, b)\n \n # gain for this cut point\n ent_try = get_marginal_entropy(cv)\n ent1_try = get_marginal_entropy(cv1_try)\n ent2_try = get_marginal_entropy(cv2_try)\n gain_try = ent_try - \n (cv1_try.size.to_f/cv.size) * ent1_try - \n (cv2_try.size.to_f/cv.size) * ent2_try\n \n #pp gain_try\n if gain_try > gain_best\n cp_best = b\n cv1_best, cv2_best = cv1_try, cv2_try\n fv1_best, fv2_best = fv1_try, fv2_try\n bs1_best, bs2_best = bs1_try, bs2_try\n \n gain_best = gain_try\n ent_best = ent_try\n ent1_best, ent2_best = ent1_try, ent2_try\n end\n end \n \n # to cut or not to cut?\n #\n # Gain(A,T;S) > 1/N * log2(N-1) + 1/N * delta(A,T;S)\n if cp_best\n n = cv.size.to_f\n k = cv.uniq.size.to_f\n k1 = cv1_best.uniq.size.to_f\n k2 = cv2_best.uniq.size.to_f\n delta = Math.log2(3**k-2)-(k*ent_best - k1*ent1_best - k2*ent2_best)\n \n # accept cut point\n if gain_best > (Math.log2(n-1)/n + delta/n)\n # a: record cut point\n cp << cp_best\n \n # b: recursively call on subset\n partition(cv1_best, fv1_best, bs1_best, cp)\n partition(cv2_best, fv2_best, bs2_best, cp)\n end\n end\n end", "def climb_stairs(n)\n return 1 if n == 1\n dp = [0] * (n + 1)\n dp[1] = 1\n dp[2] = 2\n for i in 3..n do \n dp[i] = dp[i - 1] + dp[i - 2]\n end\n dp[n]\nend", "def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = @length.times.collect do\n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def initialize(cards)\n raise \"Invalid hand size - #{cards.length}\" unless cards.length == 5\n @cards = cards.map {|c| Card.new(c)}.sort\n @by_value = {}\n @by_suit = {}\n @cards.each do |c|\n @by_value[c.value] ||= []\n @by_suit[c.suit] ||= []\n @by_value[c.value] << c\n @by_suit[c.suit] << c\n end\n\n if @cards[4].value+1 == @cards[3].value &&\n @cards[3].value+1 == @cards[2].value &&\n @cards[2].value+1 == @cards[1].value &&\n @cards[1].value+1 == @cards[0].value\n end\n # Is it a straight\n @straight = true\n @cards.reduce do |p,c|\n if p.value != c.value + 1\n @straight = false\n break\n end\n c\n end\n value = [0]\n if @straight # Is it a straight\n value = [500, @cards.first.value]\n end\n # Is it a flush\n if @flush = @by_suit.find {|k,v| v.length == 5}\n if @straight\n value = [900, @cards.first.value]\n else\n value = [600, @cards.first.value]\n end\n end\n if value[0] < 700\n if (a = @by_value.find {|k,v| v.length == 3 }) &&\n (b = @by_value.find {|k,v| v.length == 2 })\n value = [700, a[0], b[0]]\n elsif a = @by_value.find {|k,v| v.length == 4 }\n value = [800, a[0]] # Is it 4 of a kind\n end\n end\n if value[0] < 500 && (a = @by_value.find {|k,v| v.length == 3 })\n value = [400, a[0]] # Is it 3 of a kind\n end\n if value[0] < 400 \n if (a = @by_value.select {|k,v| v.length == 2}).length > 0\n if a.length == 2\n hi,low = a[a.keys.max], a[a.keys.min]\n high = @cards - hi - low\n value = [300,hi.first.value, low.first.value, high.first.value]\n else\n pair = a[a.keys.first]\n high = (@cards - pair).first\n value = [200,pair.first.value, high.value]\n end\n else\n value = [100, @cards.first.value]\n end\n end\n @value = value\n end", "def staircase(n)\n spaces=0\n arr = Array.new(n) { |i| Array.new(n) { |j| (i >= j) ? '#' : ' ' } }\n print_matrix(arr.map(&:reverse), spaces)\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def lcts(array)\nend", "def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend", "def cyclopeptide_sequencing(spectrum)\n # CYCLOPEPTIDESEQUENCING(Spectrum)\n # Peptides ← {empty peptide}\n # while Peptides is nonempty\n # Peptides ← Expand(Peptides)\n # for each peptide Peptide in Peptides\n # if Mass(Peptide) = ParentMass(Spectrum)\n # if Cyclospectrum(Peptide) = Spectrum\n # output Peptide\n # remove Peptide from Peptides\n # else if Peptide is not consistent with Spectrum\n # remove Peptide from Peptides\n\n # What about the branching step? Given the current collection of linear peptides Peptides, \n # define Expand(Peptides) as a new collection containing all possible extensions of peptides in \n # Peptides by a single amino acid mass\n peptides = []\n parent_mass = spectrum[-1]\n output_peptides = []\n loop do\n expanded_peptides = expand_peptides(peptides)\n # puts peptides\n delete_peptides = []\n expanded_peptides.each do |peptide|\n # puts peptide\n if peptide_mass(peptide) == parent_mass\n cyclic_spec_pep = cyclic_spectrum(peptide)\n # puts peptide\n # puts cyclic_spec_pep.join(\" \")\n if cyclic_spec_pep == spectrum \n # puts \"output: \" + peptide_to_mass(peptide)\n output_peptides << peptide_to_mass(peptide) \n end\n delete_peptides << peptide\n else\n unless peptide_consistency_with_spectrum?(peptide, spectrum)\n delete_peptides << peptide\n end\n end\n end\n delete_peptides.uniq.each {|p| expanded_peptides.delete(p) }\n\n break if expanded_peptides.empty?\n peptides = []\n expanded_peptides.each {|p| peptides << p}\n end\n\n output_peptides.uniq\n end", "def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = 10.times.collect do \n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end" ]
[ "0.6960574", "0.6130857", "0.6093842", "0.6067666", "0.59899485", "0.5948006", "0.5866916", "0.586149", "0.58539253", "0.5851496", "0.5827812", "0.5815613", "0.58018166", "0.57998675", "0.57592815", "0.5746487", "0.5718547", "0.5672691", "0.565821", "0.5658152", "0.565527", "0.5602608", "0.55932695", "0.5555089", "0.55470943", "0.55397046", "0.55308145", "0.5526658", "0.55109394", "0.5510149", "0.5509393", "0.5495462", "0.5492321", "0.548725", "0.54863065", "0.5485563", "0.5483769", "0.54812264", "0.546906", "0.5465338", "0.5462113", "0.5460139", "0.54372436", "0.5430534", "0.54105705", "0.5409092", "0.54090726", "0.53941727", "0.53908813", "0.5388507", "0.5387102", "0.5380879", "0.5378571", "0.5378496", "0.536482", "0.53617054", "0.53597724", "0.534688", "0.53462064", "0.5331702", "0.53153974", "0.52910775", "0.52892345", "0.528053", "0.52783465", "0.52778065", "0.5276092", "0.52723444", "0.5270963", "0.52705044", "0.5268917", "0.5252297", "0.5246861", "0.5246395", "0.5240486", "0.5228415", "0.52241325", "0.5221841", "0.52117395", "0.520391", "0.520275", "0.51968235", "0.519417", "0.51940674", "0.5192367", "0.51860297", "0.5184775", "0.5175895", "0.5175793", "0.5175392", "0.5167754", "0.51672244", "0.5165464", "0.5159003", "0.51586604", "0.51467", "0.51463825", "0.5145963", "0.51405567", "0.51379037" ]
0.7031612
0
rubocop: disable Metrics/MethodLength rubocop: disable Metrics/AbcSize
def transpose(string) arr = string.split(//) new_arr = '' i = 0 while i < string.length if arr[i] == 'n' && arr[i - 1] == 'g' arr[i], arr[i - 1] = arr[i - 1], arr[i] i -= 2 end i += 1 end arr.each { |n| new_arr += n } new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def strategy; end", "def offences_by; end", "def used?; end", "def custom; end", "def custom; end", "def suivre; end", "def private_method\n end", "def isolated; end", "def isolated; end", "def intensifier; end", "def initialize\n \n end", "def operations; end", "def operations; end", "def spec; end", "def spec; end", "def internal; end", "def initialize\n\n end", "def initialize\n\n end", "def initialize\n \n end", "def celebration; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super()\n end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def missing; end", "def initialize\n\t\t\n\tend", "def ignores; end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def extra; end", "def overrides; end", "def villian; end", "def initialize() end", "def initialize\r\n\r\n end", "def formation; end", "def executor; end", "def executor; end", "def executor; end", "def operation; end", "def weber; end", "def apply\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def internship_passed; end", "def anchored; end", "def init; end", "def init; end", "def init; end", "def init; end", "def who_we_are\r\n end", "def wrapper; end", "def identify; end", "def processor; end", "def same; end", "def initialize\n # nothing here for now\n end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def ignore; 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" ]
[ "0.7670641", "0.6295587", "0.6235954", "0.6235954", "0.6215023", "0.61841494", "0.61841494", "0.61841494", "0.61841494", "0.61307836", "0.5952472", "0.5919521", "0.5884458", "0.58336973", "0.58336973", "0.5815753", "0.5812282", "0.57900274", "0.57900274", "0.57390547", "0.57122153", "0.5703766", "0.5703766", "0.5701474", "0.5701474", "0.5689304", "0.56880194", "0.56880194", "0.5663094", "0.5651914", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5650604", "0.5630592", "0.5630592", "0.5630592", "0.56208", "0.5615071", "0.5615071", "0.561454", "0.5600765", "0.55880755", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.5586445", "0.55772024", "0.5575365", "0.5565329", "0.55580086", "0.55373365", "0.55370003", "0.5533943", "0.5533943", "0.5533943", "0.55088985", "0.5508871", "0.5503444", "0.5501114", "0.5501114", "0.5501114", "0.5500845", "0.5497455", "0.54938793", "0.54938793", "0.54938793", "0.54938793", "0.5493514", "0.5492357", "0.5488851", "0.54883474", "0.5486174", "0.5483883", "0.5480386", "0.5480386", "0.5480386", "0.5480386", "0.5477292", "0.547481", "0.547481", "0.547481", "0.547481", "0.547481", "0.547481", "0.547481", "0.547481", "0.547481" ]
0.0
-1
GET /longterm_goals GET /longterm_goals.json
def index @longterm_goals = LongtermGoal.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goals(*args)\n @client.get \"#{@path}/goals\", Hash[*args]\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def show\n @goal = @user.goals.find(params[:id])\n\n @tracked_activities = @goal.tracked_activities\n @untracked_activities = @goal.untracked_activities\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @long_term_goals = LongTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @long_term_goals }\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @goals = @user.goals.non_project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end", "def index\n @goals = current_user.goals\n end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @global_goal = GlobalGoal.find(params[:id])\n\n respond_to do |format|\n format.html # global_goal.html.erb\n format.json { render json: @global_goal }\n end\n end", "def index\n @goals = current_user.goals.all\n end", "def body_goals(goal_type, options = {})\n get_json(path_user_version(\"/body/log/#{goal_type}/goal\", options))\n end", "def index\n\n @goals = current_user.goals\n\n end", "def index\n @goals = Goal.select{|goal| goal.resolution.user_id == current_user.id}\n end", "def index\n if params[:tag]\n @global_goals = GlobalGoal.tagged_with(params[:tag])\n else\n @global_goals = GlobalGoal.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @global_goals }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end", "def show\n @long_term_goal = LongTermGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end", "def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end", "def index\n @goals = current_user.goals.order(created_at: :desc)\n end", "def create\n @longterm_goal = LongtermGoal.new(longterm_goal_params)\n\n respond_to do |format|\n if @longterm_goal.save\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully created.' }\n format.json { render :show, status: :created, location: @longterm_goal }\n else\n format.html { render :new }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goals\n assessment_type = params[:assessment_type]\n country_name = params[:country_name]\n technical_area_ids = params[:areas].to_s.split(\"-\")\n @disease_ids = params[:diseases]\n country = Country.find_by_name country_name\n @publication = AssessmentPublication.find_by_named_id assessment_type\n if country.present? && @publication.present?\n @assessment =\n Assessment.deep_load(country.try(:alpha3), @publication.try(:id))\n end\n if @assessment.blank?\n render \"assessment_not_found\"\n return\n end\n @plan =\n Plan.new_from_assessment(\n assessment: @assessment,\n technical_area_ids: technical_area_ids,\n is_5_year_plan: params[:plan_term]&.start_with?(\"5\")\n )\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def show\n @goals = current_user.goals\n end", "def index\n @goals = Goal.where(user_id:current_user)\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n\n @goals = @goalable.goals.order(\"deadline ASC\")\n @goal = Goal.new\n end", "def index\n @performed_goal_ints = PerformedGoalInt.all\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_goal }\n end\n end", "def get_goal\n @project = Project.find(params[:project_id])\n @goal = @project.goals.find(params[:goal_id])\n end", "def body_goals(user_id: '-', goal_type:)\n return get(\"#{API_URI}/#{BODY_API_VERSION}/user/#{user_id}/body/log/#{goal_type}/goal.json\")\n end", "def get_goal\n @goal = Goal.find(params[:goal_id])\n end", "def show\n @performed_goal_int = Performed_goal_int.all\n @projection_goal_int = Projection_goal_int.all\n @reached_goal_int = Reached_goal_int.all\n end", "def index\n @goals = Goal.where(client_id: $current_client.id)\n end", "def index\n @goals = Goal.all\n unless @group.owner == current_user || @group.users.include?(current_user) || current_user.admin\n redirect_to groups_path\n else\n @active_goals = @group.active_goals\n @finished_goals = @group.finished_goals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end\n end", "def index\n @short_term_goals = ShortTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @short_term_goals }\n format.json {\n #Format Response\n results = Array.new\n puts \"Print some tags: \"\n @short_term_goals.each do |goal|\n results << {\n 'id' => goal.id,\n 'name' => goal.name,\n 'description' => goal.description,\n 'long_term_goal_id' => goal.long_term_goal_ids, \n 'school_year' => goal.school_year,\n 'tasks' => Array.new, \n 'tag' => goal.tag.name.gsub!(/\\s*/,'').downcase,\n }\n goal.tasks.each do |task|\n results[results.length-1]['tasks'] << {\n 'id' => task.id,\n 'name' => task.name,\n 'description' => task.description\n }\n end\n end \n #send response\n render :json => results\n }\n end\n end", "def index\n @goals = Goal.where(private: false).limit(6)\n end", "def new\n @goal = @user.goals.new\n\n if params[:project_id]\n @goal.project_id = params[:project_id]\n @goal.goal_type = \"project-based\"\n end\n \n @goal.started_on = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @goal_entries = GoalEntry.all\n end", "def new\n @global_goal = GlobalGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_goal }\n end\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def index\n @financial_objects_goals = FinancialObjects::Goal.all\n end", "def index\n @goal_steps = GoalStep.all\n end", "def index\n @name = current_user.name\n\tuser = current_user.id\n\t\n\tgoalInfo = Goal.get_goals(user)\n\t@stepGoal = goalInfo[:step]\n\t@calorieGoal = goalInfo[:calorie]\n\t@distanceGoal = goalInfo[:distance]\n\t\n\ttimeInfo = Goal.get_times(user)\n\t@stepTime = timeInfo[:step]\n\t@calorieTime = timeInfo[:calorie]\n\t@distanceTime = timeInfo[:distance]\n\t\n @goal = Goal.new\n end", "def index\n @runs = current_user.runs.all(:order => 'created_at DESC')\n @goal = current_user.goals.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @runs }\n end\n end", "def set_longterm_goal\n @longterm_goal = LongtermGoal.find(params[:id])\n end", "def index\n @reading_goals = ReadingGoal.all\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goals }\n end\n end", "def add_goals\n end", "def create\n @long_term_goal = LongTermGoal.new(params[:long_term_goal])\n\n respond_to do |format|\n if @long_term_goal.save\n format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully created.') }\n format.xml { render :xml => @long_term_goal, :status => :created, :location => @long_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @long_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @goal = Goal.find(params[:id])\n end", "def index\n @goal_ints = GoalInt.all\n end", "def show\n @solutions = @achievement.solutions.paginate(page: params[:page], per_page: 10).order('created_at DESC')\n add_breadcrumb @achievement.name, achievement_path(@achievement)\n respond_with @achievement\n end", "def show\n @goal = Goal.find(params[:id])\n\n end", "def index\n redirect_to goals_url # no really good reason to show all tasks here\n end", "def show\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_goal }\n end\n end", "def show\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_state }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @level_goal = LevelGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_goal }\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @longterm_goal.update(longterm_goal_params)\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @longterm_goal }\n else\n format.html { render :edit }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @weekly_goals = WeeklyGoal.includes(:category).includes(:app).all.order(actual_time_min: :desc)\n end", "def getallpendinggoals\n\n\t\tif(params[:timespan] == \"All\")\n\n\t#\t@usersallpendinggoals = Goal.where(:userid => current_user.id).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate\", { userid: current_user.id, todaydate: Date.today }).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\n\t\telse if(params[:timespan] == \"Yesterday\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(created_at) = :date and Date(DoToday) != :todaydate\", { userid: current_user.id, date: Date.today - 1.day, todaydate: Date.today }).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last week\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 7.days, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last One Month\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 1.month, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last Three Months\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 3.months, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\telse if(params[:timespan] == \"Last Six Months\")\n\n\t\t@usersallpendinggoals = Goal.where(\"userid = :userid and Date(DoToday) != :todaydate and Date(created_at) BETWEEN :fromdate AND :todate\", { userid: current_user.id, todaydate: Date.today, fromdate: Date.today - 6.months, todate: Date.today - 1.day}).where.not(:status => \"Done\").select([:id, :goal, :status, :remarks, :created_at])\n\n\t\trender :layout => false\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t\tend\n\n\t#\trespond_to do |format|\n\t# \tformat.html\n\t# \tformat.json {render :json => @usersallpendinggoals}\n\t#\tend\n\n\t#\tredirect_to action: 'main', :id => current_user.id\n\n \tend", "def longterm_goal_params\n params.require(:longterm_goal).permit(:category_id, :target_time_min, :actual_time_min, :successful)\n end", "def index\n # @solutions = Solution.all\n @solutions = @goal.solutions\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def destroy\n @longterm_goal.destroy\n respond_to do |format|\n format.html { redirect_to longterm_goals_url, notice: 'Longterm goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def reload\n info = @user.get \"users/me/goals/#{@slug}.json\"\n _parse_info info\n end", "def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end", "def daily_goals\n goals\n end", "def index\n @goal_to_bes = GoalToBe.all\n end", "def new\n @long_term_goal = LongTermGoal.new\n\n @long_term_goal.user = @current_user if @long_term_goal.user == nil\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end", "def index\n @projection_goal_ints = ProjectionGoalInt.all\n end", "def body_goal(type)\n if type && body_goals.include?(type)\n get_call(\"1/user/#{@user_id}/body/log/#{type}/goal.json\")\n else\n raise FitgemOauth2::InvalidArgumentError, \"goal type should be one of #{body_goals}\"\n end\n end", "def show\n @short_term_goal = ShortTermGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @short_term_goal }\n end\n end", "def create\n @goal = current_user.goals.new(goal_params)\n\n if @goal.save\n flash[\"notice\"] = 'Goal was successfully created.'\n end\n\n respond_with @goal, location: [current_user, :goals]\n end", "def destroy\n @long_term_goal = LongTermGoal.find(params[:id])\n @long_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(long_term_goals_url) }\n format.xml { head :ok }\n end\n end", "def give_goals_to_user\n self.goals.create(category: \"Use my own bags at the store\", point_value: 12, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Carpool instead of use my car\", point_value: 100, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Air dry a load of laundry\", point_value: 70, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Adjust the thermostat up 1 degree in summer\", point_value: 40, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Install a compact fluorescent light bulb\", point_value: 60, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Ride a bike instead of car 1 mile\", point_value: 20, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Take a shorter shower (5 min or less)\", point_value: 4, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Turn off my engine instead of idleing\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Buy or eat local\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n\n\n end", "def index\n @seller_goals = SellerGoal.all\n end", "def create\n @goal = current_user.goals.build(params[:goal])\n if @goal.save\n flash[:success] = \"Goal saved successfully\"\n #redirect_to :action => \"index\", :id => current_user.id\n render :partial => \"goal\", :object => @goal\n else\n #redirect_to :action => \"index\", :id => current_user.id\n render :text => @goal.errors.full_messages, :status => 403\n end\n end", "def progress\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # progress.html.erb\n format.json { render json: @goal }\n end\n\n private\n\n # Use this method to whitelist the permissible parameters. Example:\n # params.require(:person).permit(:name, :age)\n # Also, you can specialize this method with per-user checking of permissible attributes.\n def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end\n \n def allowed_params\n [:date, :description, :name, :priority, :status]\n end\nend", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end" ]
[ "0.732945", "0.72592956", "0.72027224", "0.7200819", "0.694095", "0.6933644", "0.69254565", "0.6895508", "0.68438435", "0.67495525", "0.67495525", "0.67495525", "0.67495525", "0.6712588", "0.6693233", "0.6607886", "0.65974605", "0.65841395", "0.6572521", "0.6565937", "0.6523243", "0.6487771", "0.6464147", "0.64632976", "0.646162", "0.64144176", "0.6387342", "0.63771504", "0.6372251", "0.6369785", "0.63597155", "0.63594216", "0.6342346", "0.6333106", "0.62944084", "0.6285398", "0.62832934", "0.62744254", "0.62744254", "0.62744254", "0.62744254", "0.6251138", "0.62427515", "0.62357247", "0.61969274", "0.61816746", "0.61693144", "0.6152995", "0.6127172", "0.61250365", "0.6120394", "0.61190087", "0.6116732", "0.6113236", "0.60792285", "0.60494965", "0.6038143", "0.5956583", "0.59549093", "0.5943781", "0.5910156", "0.59087086", "0.59013534", "0.58974874", "0.5870361", "0.58465314", "0.5842821", "0.5821521", "0.5808051", "0.5805959", "0.57921016", "0.57921016", "0.57921016", "0.57878685", "0.5786194", "0.5784859", "0.57631254", "0.57608706", "0.57550764", "0.5743951", "0.573812", "0.5730325", "0.57282674", "0.57245445", "0.5715004", "0.56999475", "0.56773955", "0.56693083", "0.5664942", "0.56516767", "0.5650374", "0.559775", "0.55958885", "0.5586711", "0.5564653", "0.5563033", "0.5560498", "0.5560332", "0.55528945", "0.5550116" ]
0.78816295
0
GET /longterm_goals/1 GET /longterm_goals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @longterm_goals = LongtermGoal.all\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def show\n @goal = @user.goals.find(params[:id])\n\n @tracked_activities = @goal.tracked_activities\n @untracked_activities = @goal.untracked_activities\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def goals(*args)\n @client.get \"#{@path}/goals\", Hash[*args]\n end", "def show\n @global_goal = GlobalGoal.find(params[:id])\n\n respond_to do |format|\n format.html # global_goal.html.erb\n format.json { render json: @global_goal }\n end\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def index\n @goals = @user.goals.non_project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def index\n @long_term_goals = LongTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @long_term_goals }\n end\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def index\n @goals = Goal.all\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @long_term_goal = LongTermGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end", "def show\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_goal }\n end\n end", "def get_goal\n @goal = Goal.find(params[:goal_id])\n end", "def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def get_goal\n @project = Project.find(params[:project_id])\n @goal = @project.goals.find(params[:goal_id])\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def index\n @goals = current_user.goals\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def create\n @longterm_goal = LongtermGoal.new(longterm_goal_params)\n\n respond_to do |format|\n if @longterm_goal.save\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully created.' }\n format.json { render :show, status: :created, location: @longterm_goal }\n else\n format.html { render :new }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @goals = Goal.select{|goal| goal.resolution.user_id == current_user.id}\n end", "def index\n\n @goals = current_user.goals\n\n end", "def new\n @goal = @user.goals.new\n\n if params[:project_id]\n @goal.project_id = params[:project_id]\n @goal.goal_type = \"project-based\"\n end\n \n @goal.started_on = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @global_goal = GlobalGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_goal }\n end\n end", "def index\n @goals = current_user.goals.all\n end", "def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end", "def body_goals(goal_type, options = {})\n get_json(path_user_version(\"/body/log/#{goal_type}/goal\", options))\n end", "def index\n if params[:tag]\n @global_goals = GlobalGoal.tagged_with(params[:tag])\n else\n @global_goals = GlobalGoal.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @global_goals }\n end\n end", "def show\n @goals = current_user.goals\n end", "def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end", "def index\n @performed_goal_ints = PerformedGoalInt.all\n end", "def index\n @goals = Goal.where(client_id: $current_client.id)\n end", "def index\n @short_term_goals = ShortTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @short_term_goals }\n format.json {\n #Format Response\n results = Array.new\n puts \"Print some tags: \"\n @short_term_goals.each do |goal|\n results << {\n 'id' => goal.id,\n 'name' => goal.name,\n 'description' => goal.description,\n 'long_term_goal_id' => goal.long_term_goal_ids, \n 'school_year' => goal.school_year,\n 'tasks' => Array.new, \n 'tag' => goal.tag.name.gsub!(/\\s*/,'').downcase,\n }\n goal.tasks.each do |task|\n results[results.length-1]['tasks'] << {\n 'id' => task.id,\n 'name' => task.name,\n 'description' => task.description\n }\n end\n end \n #send response\n render :json => results\n }\n end\n end", "def index\n @goals = Goal.where(user_id:current_user)\n end", "def index\n\n @goals = @goalable.goals.order(\"deadline ASC\")\n @goal = Goal.new\n end", "def show\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n end", "def index\n @goals = current_user.goals.order(created_at: :desc)\n end", "def set_longterm_goal\n @longterm_goal = LongtermGoal.find(params[:id])\n end", "def goals\n assessment_type = params[:assessment_type]\n country_name = params[:country_name]\n technical_area_ids = params[:areas].to_s.split(\"-\")\n @disease_ids = params[:diseases]\n country = Country.find_by_name country_name\n @publication = AssessmentPublication.find_by_named_id assessment_type\n if country.present? && @publication.present?\n @assessment =\n Assessment.deep_load(country.try(:alpha3), @publication.try(:id))\n end\n if @assessment.blank?\n render \"assessment_not_found\"\n return\n end\n @plan =\n Plan.new_from_assessment(\n assessment: @assessment,\n technical_area_ids: technical_area_ids,\n is_5_year_plan: params[:plan_term]&.start_with?(\"5\")\n )\n end", "def show\n @goal = Goal.find(params[:id])\n\n end", "def show\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_state }\n end\n end", "def show\n @performed_goal_int = Performed_goal_int.all\n @projection_goal_int = Projection_goal_int.all\n @reached_goal_int = Reached_goal_int.all\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @runs = current_user.runs.all(:order => 'created_at DESC')\n @goal = current_user.goals.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @runs }\n end\n end", "def index\n @goal_entries = GoalEntry.all\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def index\n @name = current_user.name\n\tuser = current_user.id\n\t\n\tgoalInfo = Goal.get_goals(user)\n\t@stepGoal = goalInfo[:step]\n\t@calorieGoal = goalInfo[:calorie]\n\t@distanceGoal = goalInfo[:distance]\n\t\n\ttimeInfo = Goal.get_times(user)\n\t@stepTime = timeInfo[:step]\n\t@calorieTime = timeInfo[:calorie]\n\t@distanceTime = timeInfo[:distance]\n\t\n @goal = Goal.new\n end", "def new\n @level_goal = LevelGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_goal }\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def index\n @goals = Goal.all\n unless @group.owner == current_user || @group.users.include?(current_user) || current_user.admin\n redirect_to groups_path\n else\n @active_goals = @group.active_goals\n @finished_goals = @group.finished_goals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end\n end", "def index\n @financial_objects_goals = FinancialObjects::Goal.all\n end", "def body_goals(user_id: '-', goal_type:)\n return get(\"#{API_URI}/#{BODY_API_VERSION}/user/#{user_id}/body/log/#{goal_type}/goal.json\")\n end", "def index\n @goal_steps = GoalStep.all\n end", "def index\n @goals = Goal.where(private: false).limit(6)\n end", "def create\n @long_term_goal = LongTermGoal.new(params[:long_term_goal])\n\n respond_to do |format|\n if @long_term_goal.save\n format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully created.') }\n format.xml { render :xml => @long_term_goal, :status => :created, :location => @long_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @long_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @short_term_goal = ShortTermGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @short_term_goal }\n end\n end", "def index\n @reading_goals = ReadingGoal.all\n end", "def index\n @goal_ints = GoalInt.all\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goals }\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @solutions = @achievement.solutions.paginate(page: params[:page], per_page: 10).order('created_at DESC')\n add_breadcrumb @achievement.name, achievement_path(@achievement)\n respond_with @achievement\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def update\n respond_to do |format|\n if @longterm_goal.update(longterm_goal_params)\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @longterm_goal }\n else\n format.html { render :edit }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def reload\n info = @user.get \"users/me/goals/#{@slug}.json\"\n _parse_info info\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_goals\n end", "def show\n @objective = Objective.find(params[:id])\n render json: @objective\n end", "def progress\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # progress.html.erb\n format.json { render json: @goal }\n end\n\n private\n\n # Use this method to whitelist the permissible parameters. Example:\n # params.require(:person).permit(:name, :age)\n # Also, you can specialize this method with per-user checking of permissible attributes.\n def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end\n \n def allowed_params\n [:date, :description, :name, :priority, :status]\n end\nend", "def new\n @long_term_goal = LongTermGoal.new\n\n @long_term_goal.user = @current_user if @long_term_goal.user == nil\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end", "def new\n @v_goal = VGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @v_goal }\n end\n end", "def destroy\n @longterm_goal.destroy\n respond_to do |format|\n format.html { redirect_to longterm_goals_url, notice: 'Longterm goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end", "def set_goal\n @goal = Goal.friendly.find(params[:id])\n end", "def set_goal\n @goal = @todo.goals.find_by(id: params[:id])\n end", "def new\n @goal = @group.goals.new\n # @goal = Goal.new\n # @goal.group = @group\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal_comment = GoalComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_comment }\n end\n end", "def index\n # @solutions = Solution.all\n @solutions = @goal.solutions\n end", "def new\n @goal_state = GoalState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal_state }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n @new_goal = @product.goal.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @projection_goal_ints = ProjectionGoalInt.all\n end", "def new\n @profile = Profile.new\n @goal = @user.goals.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def create\n @goal = current_user.goals.build(params[:goal])\n if @goal.save\n flash[:success] = \"Goal saved successfully\"\n #redirect_to :action => \"index\", :id => current_user.id\n render :partial => \"goal\", :object => @goal\n else\n #redirect_to :action => \"index\", :id => current_user.id\n render :text => @goal.errors.full_messages, :status => 403\n end\n end", "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end" ]
[ "0.7745726", "0.72751945", "0.7134816", "0.7036258", "0.70007163", "0.6997096", "0.6996421", "0.6972888", "0.6970396", "0.6963692", "0.6897044", "0.6883135", "0.68740493", "0.67575157", "0.67575157", "0.67575157", "0.67575157", "0.669432", "0.669432", "0.669432", "0.669432", "0.6686153", "0.66749567", "0.66234875", "0.6601844", "0.65909946", "0.65868163", "0.6583141", "0.65775365", "0.6561209", "0.6540856", "0.65408075", "0.649393", "0.6486369", "0.6461843", "0.64400536", "0.64330024", "0.6432071", "0.6398467", "0.6395485", "0.6389698", "0.6357598", "0.63372487", "0.63286734", "0.6328183", "0.6326032", "0.63012224", "0.6296253", "0.6289702", "0.6258434", "0.62341225", "0.62101185", "0.6204399", "0.6200472", "0.6192649", "0.6172199", "0.61679214", "0.61679214", "0.61679214", "0.6163622", "0.61556065", "0.61422735", "0.60991114", "0.6089646", "0.6074986", "0.60732263", "0.60405856", "0.60312396", "0.6018413", "0.60108787", "0.6010768", "0.6000611", "0.59772694", "0.59760714", "0.5964071", "0.5961505", "0.59380895", "0.59247416", "0.59135705", "0.59035444", "0.5892912", "0.5855308", "0.5848079", "0.5819796", "0.581414", "0.58118963", "0.5803983", "0.57966065", "0.5793996", "0.5776458", "0.5775342", "0.5765437", "0.5762092", "0.572874", "0.57276577", "0.5723236", "0.57224315", "0.5721837", "0.5715174", "0.57075477", "0.5705847" ]
0.0
-1
POST /longterm_goals POST /longterm_goals.json
def create @longterm_goal = LongtermGoal.new(longterm_goal_params) respond_to do |format| if @longterm_goal.save format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully created.' } format.json { render :show, status: :created, location: @longterm_goal } else format.html { render :new } format.json { render json: @longterm_goal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @long_term_goal = LongTermGoal.new(params[:long_term_goal])\n\n respond_to do |format|\n if @long_term_goal.save\n format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully created.') }\n format.xml { render :xml => @long_term_goal, :status => :created, :location => @long_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @long_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @longterm_goals = LongtermGoal.all\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def longterm_goal_params\n params.require(:longterm_goal).permit(:category_id, :target_time_min, :actual_time_min, :successful)\n end", "def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = current_user.goals.new(goal_params)\n\n if @goal.save\n flash[\"notice\"] = 'Goal was successfully created.'\n end\n\n respond_with @goal, location: [current_user, :goals]\n end", "def new\n @goal = @user.goals.new\n\n if params[:project_id]\n @goal.project_id = params[:project_id]\n @goal.goal_type = \"project-based\"\n end\n \n @goal.started_on = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def goals\n assessment_type = params[:assessment_type]\n country_name = params[:country_name]\n technical_area_ids = params[:areas].to_s.split(\"-\")\n @disease_ids = params[:diseases]\n country = Country.find_by_name country_name\n @publication = AssessmentPublication.find_by_named_id assessment_type\n if country.present? && @publication.present?\n @assessment =\n Assessment.deep_load(country.try(:alpha3), @publication.try(:id))\n end\n if @assessment.blank?\n render \"assessment_not_found\"\n return\n end\n @plan =\n Plan.new_from_assessment(\n assessment: @assessment,\n technical_area_ids: technical_area_ids,\n is_5_year_plan: params[:plan_term]&.start_with?(\"5\")\n )\n end", "def add_goals\n end", "def create\n=begin\n params[:short_term_goal][:tasks] = Array.new\n tasks_array = Array.new\n if params[:task]\n params[:task].each do |num,task| \n tasks_array[Integer(num)] = task if task != ''\n end\n end\n tasks_array.each do |task|\n params[:short_term_goal][:tasks] << Task.create(:name => task) if task != nil\n end\n=end\n @short_term_goal = ShortTermGoal.new(params[:short_term_goal])\n respond_to do |format|\n if @short_term_goal.save\n format.html { redirect_to(myguide_path(@current_user), :notice => 'Short term goal was successfully created.') }\n format.xml { render :xml => @short_term_goal, :status => :created, :location => @short_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @short_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @global_goal = GlobalGoal.new(params[:global_goal])\n\n respond_to do |format|\n if @global_goal.save\n format.html { redirect_to @global_goal, notice: 'Goal was successfully created.' }\n format.json { render json: @global_goal, status: :created, location: @global_goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @global_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_url, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Copy this method for creating other, user specific things.\n @goal = current_user.goals.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = current_user.goals.build(params[:goal])\n if @goal.save\n flash[:success] = \"Goal saved successfully\"\n #redirect_to :action => \"index\", :id => current_user.id\n render :partial => \"goal\", :object => @goal\n else\n #redirect_to :action => \"index\", :id => current_user.id\n render :text => @goal.errors.full_messages, :status => 403\n end\n end", "def goal_params\n params.require(:goal).permit(:description, :done, :current_user, :user_id, :assigned_date, :due_date, :category_id, :category, :schedule, :recurring_rules)\n end", "def goal_params\n params.require(:goal).permit(:user_id, :goals, :status, :notes)\n end", "def goal_params\n params.require(:goal).permit(:title, :due_date, :completed)\n end", "def create\n @level_goal = LevelGoal.new(params[:level_goal])\n\n respond_to do |format|\n if @level_goal.save\n format.html { redirect_to @level_goal, notice: 'Level goal was successfully created.' }\n format.json { render json: @level_goal, status: :created, location: @level_goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to patient_path(@patient), notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: patient_goals_path(@patient)}\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = @goalable.goals.new(goal_params)\n respond_to do |format|\n if @goal.save\n format.html { redirect_to [@goalable, @goal], notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def create\n # @goal = Goal.new(params[:goal])\n @goal = @group.goals.new(params[:goal])\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to group_goal_path(@group, @goal), notice: 'Goal was successvol aangemaakt.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_longterm_goal\n @longterm_goal = LongtermGoal.find(params[:id])\n end", "def create\n @goal = Mg::Goal.new(params[:goal])\n\n if @goal.save\n flash[:notice] = 'Goal was successfully created.'\n redirect_to mg_goal_url :id => @goal.id\n else\n render :action => \"new\"\n end\n end", "def goals_add\n @goal = Goal.create(goal_params)\n goal = GoalsUser.create({user_id:@user.id,goal_id:@goal.id})\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {new_goal:goal,success: true}}\n end\n end", "def create\n @weekly_goal = WeeklyGoal.new(weekly_goal_params)\n\n respond_to do |format|\n if @weekly_goal.save\n format.html { redirect_to @weekly_goal, notice: 'Weekly goal was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_goal }\n else\n format.html { render :new }\n format.json { render json: @weekly_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def goal_params\n params.require(:goal).permit(:user_id, :startdate, :enddate, :name, :details, :complete, :completed_at)\n end", "def create_solo\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goals(*args)\n @client.get \"#{@path}/goals\", Hash[*args]\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user # associate the new goal to the current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to user_goals_path(current_user), notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @list = @goal.list\n respond_to do |format|\n if @goal.save\n format.js {render :action => 'update_goals.js.haml', :locals => {:goals => @list.goals}}\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:title, :description, :target_amount, :penalty_amount, :deadline, :user_id, :is_goal_validated, :beneficiary_id)\n end", "def update\n respond_to do |format|\n if @longterm_goal.update(longterm_goal_params)\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @longterm_goal }\n else\n format.html { render :edit }\n format.json { render json: @longterm_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.client_id = params[:client_id]\n @goal.status = 'active'\n\n if @goal.save\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n else\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user_id = current_user.id\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n\n if (current_user.has_role? :admin) \n @personalGoals = Goal.all\n elsif (current_user.has_role? :athlete)\n @personalGoals = Goal.where(:user_id => current_user.id, :active => true, :team_id => nil).order(:goalEndDate)\n @teamGoals = Goal.where(:user_id => current_user.id, :active => true).where.not(:team_id => nil).order(:goalEndDate)\n end\n\n respond_to do |format|\n if @goal.save\n ActiveTest.perform_async(@goal.id)\n format.js \n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal_step = GoalStep.new(goal_step_params)\n\n respond_to do |format|\n if @goal_step.save\n format.html { redirect_to @goal_step, notice: \"Goal step was successfully created.\" }\n format.json { render :show, status: :created, location: @goal_step }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @goal_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def goal_params\n params.require(:goal).permit(:user_id, :title, :content, :due_date, :done)\n end", "def create\n @financial_objects_goal = FinancialObjects::Goal.new(financial_objects_goal_params)\n\n respond_to do |format|\n if @financial_objects_goal.save\n format.html { redirect_to @financial_objects_goal, notice: \"Goal was successfully created.\" }\n format.json { render :show, status: :created, location: @financial_objects_goal }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:name, :deadline, :achievability,\n :measurement, :person_responsible, :achieved, :completed_at,\n :version, :slug)\n end", "def create\n @show_sales_overlay = false\n\n\n if current_user and params[:first_name]\n\t current_user.first_name = params[:first_name]\n \n ### having periods in the first name kills the attempts to email that person, so remove periods\n current_user.first_name = current_user.first_name.gsub(\".\", \"\")\n current_user.save\n end \n\n @goal = Goal.new(params[:goal])\n\n if @goal.template_owner_is_a_template\n @goal.status = \"hold\"\n end\n\n\n\n ### remove question marks because:\n ### people keep incorrectly adding their own question marks to the end of their question\n ### which messes up phrasings in the rest of the program and never is needed\n @goal.response_question = @goal.response_question.gsub(\"?\", \"\")\n\n @goal.title = @goal.response_question\n\n if [email protected]_allowed_per_day\n @goal.pushes_allowed_per_day = 1\n end \n\n\n\n\n ################################\n #Status Creation Business Rules\n ################################\n #start (create the goal starting today stopping after goal.days_to_form_a_habit days)\n #monitor (create the goal starting today stopping after goal.days_to_form_a_habit days)\n #hold (just create the goal and a default dummy date of 1/1/1900 for start and stop)\n \n respond_to do |format|\n\n tracker_data_missing_error = false\n if @goal.tracker\n\n\n\n missing = false\n if [email protected]_question or @goal.tracker_question == \"\"\n missing = true\n logger.debug(\"sgj:goals_controller:1\")\n end\n if [email protected]_units or @goal.tracker_units == \"\"\n missing = true\n logger.debug(\"sgj:goals_controller:2\")\n end\n\n\n ### these will never be null b/c they're in forced pulldowns\n ### plus these checks were not working right\n # if [email protected]_type_starts_at_zero_daily\n # missing = true\n # logger.debug(\"sgj:goals_controller:3\")\n # end\n # if [email protected]_target_higher_value_is_better\n # missing = true\n # logger.debug(\"sgj:goals_controller:4\")\n # end\n\n # if [email protected]_standard_deviation_from_last_measurement\n # missing = true\n # logger.debug(\"sgj:goals_controller:5\")\n # end\n # if [email protected]_target_threshold_bad1\n # missing = true\n # logger.debug(\"sgj:goals_controller:6\")\n # end\n # if [email protected]_target_threshold_bad2\n # missing = true\n # logger.debug(\"sgj:goals_controller:7\")\n # end\n # if [email protected]_target_threshold_bad3\n # missing = true\n # logger.debug(\"sgj:goals_controller:8\")\n # end\n # if [email protected]_target_threshold_good1\n # missing = true\n # logger.debug(\"sgj:goals_controller:9\")\n # end\n # if [email protected]_target_threshold_good2\n # missing = true\n # logger.debug(\"sgj:goals_controller:10\")\n # end\n # if [email protected]_target_threshold_good3\n # missing = true\n # logger.debug(\"sgj:goals_controller:11\")\n # end\n\n if missing\n tracker_data_missing_error = true\n @goal.errors.add(:base, \"All 'Tracker' fields are required if the 'Tracker' is enabled.\")\n end ### end if missing\n\n end ### end if @goal.tracker\n\n\n\n if !tracker_data_missing_error and @goal.save\n\n\n pmo = false\n\n if @goal.title.include? \"fapping\"\n pmo = true\n end\n\n if @goal.title.include? \"porn\"\n pmo = true\n end\n\n if @goal.title.include? \"masturb\"\n pmo = true\n end\n if @goal.title.include? \"pmo\"\n pmo = true\n end\n if @goal.title.include? \"jerking off\"\n pmo = true\n end\n if @goal.title.include? \"jerk off\"\n pmo = true\n end\n if @goal.title.include? \"touching myself\"\n pmo = true\n end\n if @goal.title.include? \"touching yourself\"\n pmo = true\n end\n if @goal.title.include? \"XXX\"\n pmo = true\n end\n if @goal.title.include? \"xxx\"\n pmo = true\n end\n\n\n if pmo\n @goal.category = \"PMO\"\n end\n\n if @goal.template_owner_is_a_template\n flash[:notice] = 'Template was successfully created.'\n\n ### if this new template was created to be part of an existing program\n if params[:program_id]\n program = Program.find(params[:program_id])\n\n program_template = ProgramTemplate.new()\n program_template.program_id = program.id\n program_template.template_goal_id = @goal.id\n\n ### you can't do this anymore now that 'next_listing_position' depends on the track\n ### because right now we don't know which track this will be in\n #program_template.listing_position = program.get_next_listing_position\n\n program_template.save\n end\n\n else\n flash[:notice] = 'Goal was successfully created.'\n\n ### show my PMO homies\n if @goal.category == \"PMO\"\n @goal.user.feed_filter_hide_pmo = false\n end\n\n ### if this is my first ever goal, record it in user for marketing\n if [email protected]_first\n @goal.user.category_first = @goal.category\n @goal.user.goal_first = @goal.title\n end\n if [email protected]_goals\n @goal.user.categories_goals = \"\"\n end\n\n if [email protected]\n @goal.category = \"Other\"\n end\n\n if [email protected]\n @goal.title = \"none\"\n end\n @goal.user.categories_goals += @goal.category + \"_:_\" + @goal.title + \"::\"\n\n\n if params[:sign_up_for_lyphted] and params[:sign_up_for_lyphted] == \"1\"\n @goal.user.lyphted_subscribe = @goal.user.dtoday\n\n\n # ####https://labs.aweber.com/snippets/subscribers\n # oauth = AWeber::OAuth.new('Ak1WLosRSScHQL6Z3X3WfV3F', 'utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR')\n\n # auth_url = oauth.request_token.authorize_url\n # logger.info(\"sgj:aweber: \" + auth_url)\n\n ### got all of the accesstoken info by following the account verifications instructions\n ### while using irb (require 'rubygems' and require 'aweber')\n ### based on: https://github.com/aweber/AWeber-API-Ruby-Library\n\n #<OAuth::AccessToken:0xb76fea70 @params={}, @consumer=#<OAuth::Consumer:0xb72e00d8 @http_method=:post, @secret=\"utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR\", @options={:access_token_path=>\"/1.0/oauth/access_token\", :oauth_version=>\"1.0\", :scheme=>:query_string, :signature_method=>\"HMAC-SHA1\", :proxy=>nil, :http_method=>:post, :request_token_path=>\"/1.0/oauth/request_token\", :authorize_path=>\"/1.0/oauth/authorize\", :site=>\"https://auth.aweber.com\"}, @key=\"Ak1WLosRSScHQL6Z3X3WfV3F\", @http=#<Net::HTTP auth.aweber.com:443 open=false>>, @secret=\"DmCMwlQWL4a2NHCrCTGaAu5u5EwaH06P5e4MLcYp\", @token=\"AgeEEz2LxKSd8zNpr602Bfyd\"> \n \n # App Name; HabitForge\n # App ID: 8765b416 \n # Consumer Key: Ak1WLosRSScHQL6Z3X3WfV3F\n # Consumer Secret: utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR\n\n ####https://labs.aweber.com/snippets/subscribers\n oauth = AWeber::OAuth.new('Ak1WLosRSScHQL6Z3X3WfV3F', 'utsxWW2PuCrWWGdUpGy1nLlFkXr1Hr2pRL7TomdR')\n oauth.authorize_with_access('AgeEEz2LxKSd8zNpr602Bfyd', 'DmCMwlQWL4a2NHCrCTGaAu5u5EwaH06P5e4MLcYp')\n aweber = AWeber::Base.new(oauth)\n new_subscriber = {}\n new_subscriber[\"email\"] = @goal.user.email\n new_subscriber[\"name\"] = @goal.user.name\n\n #### again, this one is custom and was not able to figure out how to update it\n # new_subscriber[\"YOB\"] = \"1976\"\n\n\n ##### was not able to get the updating of these custom fields to work after several different method tries\n ##### but that's OK we're now just using the built-in \"misc_notes\" \n # new_subscriber[\"custom_fields\"][\"first_category\"] = \"exercise\"\n # new_subscriber[\"custom_fields\"][\"first_goal\"] = \"run for 20 minutes\"\n # new_subscriber[\"custom_fields\"][\"categories_goals\"] = \"exercise:.:run for 20 minutes;\"\n\n begin\n new_subscriber[\"misc_notes\"] = \"first_category=\" + @goal.user.category_first\n rescue\n logger.error(\"sgj:could not add subscriber misc_note to aweber\")\n end\n\n # new_subscriber[\"misc_notes\"] = \"first_category=\" + @goal.user.category_first + \";first_goal='\" + @goal.user.goal_first + \"'\"\n\n ## The Lyphted list_id is = 3702705\n ## The Lyphted list_name is = awlist3702705\n list = aweber.account.lists.find_by_id(3702705)\n\n begin\n list.subscribers.create(new_subscriber)\n rescue\n logger.error(\"sgj:could not add subscriber to aweber (perhaps they have a role-based email address like admin@something\")\n ###https://help.aweber.com/entries/97662366\n end\n\n # aweber.account.lists.each do |list|\n # logger.info(\"sgj:aweber:\" + list.name)\n # end\n # logger.info(\"sgj:aweber:\" + aweber.account.lists.to_s)\n # logger.info(\"sgj:aweber:\" + aweber.account.lists[0].name.to_s)\n #aweber.account.lists.find_by_id(3702705).subscribers.create(new_subscriber)\n\n\n end\n\n\n\n ### update last activity date\n @goal.user.last_activity_date = @goal.user.dtoday\n @goal.user.deletion_warning = nil\n @goal.user.save\n \n ###############################################\n ###### START IF SFM_VIRGIN\n if session[:sfm_virgin] and session[:sfm_virgin] == true\n session[:sfm_virgin] = false\n @show_sales_overlay = true\n\n @user = current_user\n\n ### existing_user will be true if coming from an infusionsoft email invite\n ### in that case, do not send them another welcome email\n if !session[:existing_user]\n #### now that we have their first name, we can send the email \n the_subject = \"Confirm your HabitForge Subscription\"\n begin\n #if Rails.env.production?\n logger.error(\"sgj:goals_controller:about to send user confirmation to user \" + @user.email)\n Notifier.deliver_user_confirm(@user, the_subject) # sends the email\n #end\n rescue\n logger.error(\"sgj:email confirmation for user creation did not send\")\n end\n end\n\n\n # begin\n # #####################################################\n # #####################################################\n # #### UPDATE THE CONTACT FOR THEM IN INFUSIONSOFT ######\n # ### SANDBOX GROUP/TAG IDS\n # #112: hf new signup funnel v2 free no goal yet\n # #120: hf new signup funnel v2 free created goal\n # #\n # ### PRODUCTION GROUP/TAG IDS\n # #400: hf new signup funnel v2 free no goal yet\n # #398: hf new signup funnel v2 free created goal\n # if Rails.env.production?\n # Infusionsoft.contact_update(session[:infusionsoft_contact_id].to_i, {:FirstName => current_user.first_name, :LastName => current_user.last_name})\n # Infusionsoft.contact_add_to_group(session[:infusionsoft_contact_id].to_i, 398)\n # Infusionsoft.contact_remove_from_group(session[:infusionsoft_contact_id].to_i, 400)\n # end\n # #### END INFUSIONSOFT CONTACT ####\n # #####################################################\n # #####################################################\n # rescue\n # logger.error(\"sgj:error updating contact in infusionsoft\")\n # end\n end ### END IF SFM_VIRGIN\n ###### END IF SFM_VIRGIN\n ###############################################\n\n\n current_user.goal_temp = \"\"\n current_user.save\n end ### end if goal != a template\n\n \n if @goal.usersendhour == nil\n\t @goal.usersendhour = 20 ### 8pm\n end\n\n Time.zone = @goal.user.time_zone\n utcoffset = Time.zone.formatted_offset(false)\n offset_seconds = Time.zone.now.gmt_offset \n send_time = Time.utc(2000, \"jan\", 1, @goal.usersendhour, 0, 0) #2000-01-01 01:00:00 UTC\n central_time_offset = 21600 #add this in since we're doing UTC\n server_time = send_time - offset_seconds - central_time_offset\n puts \"User lives in #{@goal.user.time_zone} timezone, UTC offset of #{utcoffset} (#{offset_seconds} seconds).\" #Save this value in each goal, and use that to do checkpoint searches w/ cronjob\n puts \"For them to get an email at #{send_time.strftime('%k')} their time, the server would have to send it at #{server_time.strftime('%k')} Central time\"\n @goal.serversendhour = server_time.strftime('%k')\n @goal.gmtoffset = utcoffset \n #############\n \n \n\n if @goal.daym == nil \n @goal.daym = true\n end\n if @goal.dayt == nil \n @goal.dayt = true\n end\n if @goal.dayw == nil \n @goal.dayw = true\n end\n if @goal.dayr == nil \n @goal.dayr = true\n end\n if @goal.dayf == nil \n @goal.dayf = true\n end\n if @goal.days == nil \n @goal.days = true\n end\n if @goal.dayn == nil \n @goal.dayn = true\n end\n\n if [email protected]_owner_is_a_template\n if @goal.status != \"hold\" and @goal.daym and @goal.dayt and @goal.dayw and @goal.dayr and @goal.dayf and @goal.days and @goal.dayn and (@goal.goal_days_per_week == nil or @goal.goal_days_per_week == 7)\n @goal.status = \"start\"\n else\n @goal.status = \"monitor\"\n end\n end\n\n\n #########\n ### Once the goal is saved, set the start and stop dates\n\n \n dnow = get_dnow\n\n if @goal.status == \"hold\"\n @goal.start = Date.new(1900, 1, 1)\n @goal.stop = @goal.start \n end\n @goal.established_on = Date.new(1900, 1, 1)\n if (@goal.status == \"start\" or @goal.status == \"monitor\")\n start_day_offset = 1\n if params[:delay_start_for_this_many_days] \n start_day_offset = params[:delay_start_for_this_many_days].to_i\n end\n ### Set the standard dates\n @goal.start = dnow + start_day_offset\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n \t @goal.first_start_date = @goal.start \n @goal.save\n end\n\n ### save date changes\n @goal.save\n\n\n ####################################################################\n ####################################################################\n ##### ACCEPT AN INVITE\n ####################################################################\n ### if we are responding to an invitation to join a team\n if params[:invitation_id]\n begin\n attempt_to_join_team = false\n\n invite = Invite.find(params[:invitation_id].to_i)\n if invite and invite.purpose_join_team_id\n\n team = Team.find(invite.purpose_join_team_id)\n if team\n\n ### what kind of team?\n if team.goal_template_parent_id\n\n ### template based team\n if @goal.template_user_parent_goal_id and (@goal.template_user_parent_goal_id == team.goal_template_parent_id)\n attempt_to_join_team = true\n end\n\n else\n\n ### category-based team\n if team.category_name and @goal.category and (team.category_name == @goal.category)\n attempt_to_join_team = true\n end\n\n end\n\n if attempt_to_join_team\n if @goal.join_goal_to_a_team(team.id)\n logger.info(\"sgj:goals_controller.rb:success adding goal to team when responding to invitation\")\n\n\n ### we actually want to delete the invite, not save it\n ### that way if the new team member removes their goal and then\n ### changes their mind later, we can send them another invite\n #invite.accepted_on = current_user.dtoday\n #invite.save\n invite.destroy\n\n\n #### SEND INVITE ACCEPTANCE TO OWNER\n begin\n if Notifier.deliver_to_team_owner_invite_accepted(@goal, team.owner) # sends the email \n logger.info(\"sgj:goals_controller.rb:create:SUCCESS SENDING INVITE ACCEPTANCE EMAIL\") \n else\n logger.error(\"sgj:goals_controller.rb:create:FAILURE SENDING INVITE ACCEPTANCE EMAIL:goal_id = \" + @goal.id.to_s)\n end\n rescue\n logger.error(\"sgj:goals_controller.rb:create:(rescue)FAILURE SENDING INVITE ACCEPTANCE EMAIL:goal_id = \" + @goal.id.to_s)\n end\n #### END SEND INVITE ACCEPTANCE TO OWNER\n\n\n else\n logger.error(\"sgj:goals_controller.rb:failed to add goal to team when responding to invitation\")\n end\n else\n logger.error(\"sgj:goals_controller.rb:the team invite was a mis-match for either this goal category or this goal parent template .. not trying to join team\") \n end\n\n end ### if team\n\n end ### if invite and invite.purpose_join_team_id\n\n rescue\n logger.error(\"sgj:goals_controller.rb:error trying to add goal to team when responding to invitation\")\n end\n\n end ### if session[:accepting_invitation_id]\n ####################################################################\n ##### END ACCEPT AN INVITE\n ####################################################################\n ####################################################################\n\n\n\n ####################################################################\n ####################################################################\n ##### PROGRAM ENROLLMENT\n ####################################################################\n\n ### create a program enrollment record if a program is involved\n ### goal and program are linked via goal.goal_added_through_template_from_program_id\n if @goal.program\n\n ### check to see if an enrollment exists... if not, create one\n enrollment = ProgramEnrollment.find(:first, :conditions => \"program_id = '#{@goal.program.id}' and user_id = '#{@goal.user.id}'\")\n if !enrollment\n enrollment = ProgramEnrollment.new()\n # t.integer \"program_id\"\n # t.integer \"user_id\"\n # t.boolean \"active\"\n # t.boolean \"ongoing\"\n # t.integer \"program_session_id\"\n # t.date \"personal_start_date\"\n # t.date \"personal_end_date\"\n enrollment.program_id = @goal.program.id\n enrollment.user_id = @goal.user.id\n enrollment.active = true\n enrollment.ongoing = true\n\n enrollment.save\n\n end ### end if !enrollment\n end ### end if @goal.program\n\n ####################################################################\n ##### END PROGRAM ENROLLMENT\n ####################################################################\n ####################################################################\n\n\n\n ### we don't need/want these anymore\n ### destroy them so that they don't mess up a future new goal\n session[:goal_added_through_template_from_program_id] = nil\n session[:template_user_parent_goal_id] = nil\n session[:goal_template_text] = nil\n session[:category] = nil\n session[:accepting_invitation_id] = nil\n\n \n if @goal.status == \"hold\"\n ### don't send an email if it's on hold\n else\n begin \n if session[:sponsor] == \"clearworth\"\n #Notifier.deliver_goal_creation_notification_clearworth(@goal) # sends the email\n elsif session[:sponsor] == \"forittobe\"\n #Notifier.deliver_goal_creation_notification_forittobe(@goal) # sends the email\n elsif session[:sponsor] == \"marriagereminders\"\n #Notifier.deliver_goal_creation_notification_marriagereminders(@goal) # sends the email\n else\n #Notifier.deliver_goal_creation_notification(@goal) # sends the email\n end\n rescue\n puts \"Error while sending goal notification email from Goal.create action.\"\n end\n end\n\n\n\n ### if this new template was created to be part of an existing program\n if params[:program_id] or params[:return_to_program_view]\n if params[:return_to_program_view]\n format.html {redirect_to(\"/programs/#{params[:return_to_program_view]}/view\")}\n else\n\n ### if the program is a \"structured program\" you're going to want to go directly to edit mode\n p = Program.find(params[:program_id].to_i)\n if p and p.structured\n\n pt = ProgramTemplate.find(:first, :conditions => \"program_id = '#{p.id}' and template_goal_id = '#{@goal.id}'\")\n format.html {redirect_to(\"/program_templates/#{pt.id.to_s}/edit\")}\n\n else\n format.html {redirect_to(\"/programs/#{params[:program_id]}#action_items\")}\n end\n\n\n end\n\n else\n\n begin \n ### attempt to add to encourage_items\n\n\n # when a goal is created,\n # if username != unknown,\n # if the goal is public,\n # then enter it into encourage_items\n\n # --- encourage_item ---\n # encourage_type_new_checkpoint_bool (index)\n # encourage_type_new_goal_bool (index)\n # checkpoint_id\n # checkpoint_status\n # checkpoint_date (index)\n # checkpoint_updated_at_datetime\n # goal_id (index)\n # goal_name\n # goal_category\n # goal_created_at_datetime\n # goal_publish\n # goal_first_start_date (index)\n # goal_daysstraight\n # goal_days_into_it\n # goal_success_rate_percentage\n # user_id (index)\n # user_name\n # user_email\n\n logger.debug \"sgj:goals_controller.rb:consider adding to encourage_items\"\n if @goal.user.first_name != \"unknown\"\n if @goal.is_public\n logger.debug \"sgj:goals_controller.rb:candidate for encourage_items\"\n\n encourage_item = EncourageItem.new\n logger.debug \"sgj:goals_controller.rb:new encourage_items instantiated\"\n\n encourage_item.encourage_type_new_checkpoint_bool = false\n encourage_item.encourage_type_new_goal_bool = true\n\n #encourage_item.checkpoint_id = nil\n encourage_item.checkpoint_id = @goal.id ### a workaround to the validation that checkpoint_id is unique\n\n encourage_item.checkpoint_status = nil\n encourage_item.checkpoint_date = nil\n encourage_item.checkpoint_updated_at_datetime = nil\n encourage_item.goal_id = @goal.id\n encourage_item.goal_name = @goal.title\n encourage_item.goal_category = @goal.category\n encourage_item.goal_created_at_datetime = @goal.created_at\n encourage_item.goal_publish = @goal.publish\n encourage_item.goal_first_start_date = @goal.first_start_date\n encourage_item.goal_daysstraight = @goal.daysstraight\n encourage_item.goal_days_into_it = @goal.days_into_it\n encourage_item.goal_success_rate_percentage = @goal.success_rate_percentage\n encourage_item.user_id = @goal.user.id\n encourage_item.user_name = @goal.user.first_name\n encourage_item.user_email = @goal.user.email\n\n logger.debug \"sgj:goals_controller.rb:about to save encourage_items\"\n\n if encourage_item.save\n logger.info(\"sgj:goals_controller.rb:success saving encourage_item\")\n else\n logger.error(\"sgj:goals_controller.rb:error saving encourage_item\")\n end\n logger.debug \"sgj:goals_controller.rb:new encourage_item.id = \" + encourage_item.id.to_s\n\n end\n end\n\n rescue\n logger.error \"sgj:error adding to encourage_items\"\n end\n\n\n if @show_sales_overlay\n ### format.html { render :action => \"edit\" }\n\n if Rails.env.production?\n\n ### show the sales page and eventually kick back to optimize when they cancel\n #format.html {redirect_to(\"https://www.securepublications.com/habit-gse3.php?ref=#{current_user.id.to_s}&email=#{current_user.email}\")}\n\n ### do not show the sales page first, just kick to optimize\n format.html {redirect_to(\"/goals?optimize_my_first_goal=1&email=#{current_user.email}&single_login=1\")}\n\n else\n session[:dev_mode_just_returned_from_sales_page] = true\n format.html {redirect_to(\"/goals?optimize_my_first_goal=1&email=#{current_user.email}&single_login=1\")}\n end\n\n format.xml { render :xml => @goals }\n else\n\n\n ##### SUCCESSFULLY SAVED A NEW GOAL ... REDIRECT TO ???\n\n # if session[:sfm_virgin]\n # format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1&just_created_first_habit=1\")}\n # else \n # format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1\")}\n # end\n\n\n # if !current_user.is_habitforge_supporting_member\n # format.html {redirect_to(\"/goals?too_many_active_habits=1&just_created_new_habit=1\")} \n # else\n # format.html { render :action => \"index\" } # index.html.erb\n # end\n \n # if !current_user.is_habitforge_supporting_member\n # format.html { redirect_to(\"https://habitforge.com/widget/upgrade\")}\n # else\n format.html { redirect_to(\"/goals/#{@goal.id}/edit?just_created_new_habit=1\")}\n # end\n\n\n\n format.xml { render :xml => @goals }\n end\n\n end \n\n\n\n \n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:description, :private, :name, :tag_list, :completed)\n end", "def destroy\n @longterm_goal.destroy\n respond_to do |format|\n format.html { redirect_to longterm_goals_url, notice: 'Longterm goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def goal_params\n params.require(:goal).permit(:name, :description, :user_id, :fixed, :personal, :start_date, :goal, :sort_order, :priority_id)\n end", "def new\n @global_goal = GlobalGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_goal }\n end\n end", "def goal_params\n params.require(:goal).permit(:title, :description, :start_date, :moment_start, :moment_end, :duration, :user_id)\n end", "def goal_completion_params\n params.require(:goal_completion).permit(\n :complete,\n :goal_id,\n :time,\n )\n end", "def create_goal(p_name, p_matchAttribute, p_pattern, p_patternType, metrics_site_id)\n set_param(:idSite, metrics_site_id)\n set_param(:method, 'Goals.addGoal')\n set_param(:name, p_name)\n set_param(:matchAttribute, p_matchAttribute)\n set_param(:pattern, p_pattern)\n set_param(:patternType, p_patternType)\n url_string = @metrics_admin_url + @metrics_params.slice(:module, :method, :idSite, :name, :matchAttribute,\n :pattern, :patternType, :token_auth).to_query\n response_string = api_call(url_string)\n metrics_goal_id = response_string.xpath('//result/text()').map(&:text)[0]\n metrics_goal_id.to_i\n end", "def goal_params\n params.require(:goal).permit(:user_id, :type_goal_id, :frequency, :goal, :time_started, :time_finished,:automatic_goal, :progress, :complete)\n end", "def create\n @goal = Goal.new(goal_params)\n @case = @goal.case\n respond_to do |format|\n if @goal.save\n set_link_to_appointment(@goal)\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user_id=current_user.id\n \n respond_to do |format|\n if @goal.save\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:description, :complete, :current, :goal_type, :update_progress)\n end", "def goal_params\n params.require(:goal).permit(:description, :question_1, :question_2, :question_3, :question_4, :patient_id, :fitbit_steps, :fitbit_activeScore, :medical_condition_id, :start_date, :end_date, :fitbit_lightlyActiveMinutes, :fitbit_fairlyActiveMinutes, :fitbit_veryActiveMinutes, :asthma_rescueInhaler, :obesity_pounds, :diabetes_glucose)\n end", "def create\n @goal = @user.goals.new(params[:goal])\n=begin \n if params[:goal_amount].blank?\n @goal.errors[:base] << \"Select score or duration for setting goal.\"\n elsif params[:goal_amount] == \"score\"\n if @goal.goal_amount_score.blank?\n @goal.errors[:goal_amount_score] << \"should be set.\"\n end\n \n if [email protected]_amount_duration.blank?\n @goal.goal_amount_duration = nil\n end\n elsif params[:goal_amount] == \"duration\"\n if @goal.goal_amount_duration.blank?\n @goal.errors[:goal_amount_duration] << \"should be set.\"\n end\n \n if [email protected]_amount_score.blank?\n @goal.goal_amount_score = nil\n end\n end\n=end \n if @goal.goal_type == 'recurring'\n case params[:goal_frequency]\n when \"daily\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"day\"\n when \"weekly\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"week\"\n when \"bi-monthly\"\n @goal.goal_frequency = 2\n @goal.goal_frequency_unit = \"week\"\n when \"monthly\"\n @goal.goal_frequency = 1\n @goal.goal_frequency_unit = \"month\"\n when \"other\"\n @goal.goal_frequency = params[:goal_frequency].to_i\n @goal.goal_frequency_unit = params[:frequency][:other_frequency_unit]\n end\n \n end\n \n if [email protected]?\n render action: \"new\"\n else\n respond_to do |format|\n if @goal.save\n format.html { redirect_to [@user,@goal], notice: 'Goal was successfully created.' }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def new\n @level_goal = LevelGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_goal }\n end\n end", "def update\n data = {\n \"slug\" => @slug,\n \"title\" => @title,\n \"ephem\" => @ephem || false,\n \"panic\" => @panic || 86400,\n \"secret\" => @secret || false,\n \"datapublic\" => @datapublic || false,\n }\n data['roadall'] = @roadall if @roadall\n\n @user.put_document \"users/me/goals/#{@slug}.json\", data\n end", "def goal_params\n params.require(:goal).permit(:name, :sport, :goalType, :goalStartDate, :goalEndDate, :recurringEndDate, :training, :recurring, :goalInterval, :goalNumber, :trainingType, :description, :percentComplete, :trainingTimeInterval, :active, :complete, :parent_id, :user_id, :team_id, :journal_entry_ids => [])\n end", "def index\n @long_term_goals = LongTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @long_term_goals }\n end\n end", "def complete_lap\n if user_signed_in?\n current_user.completed_repetition_rounds.create!(\n repetition_round_params.merge(repetition_level_id: @level.id)\n )\n end\n render json: {}\n end", "def create\n @v_goal = VGoal.new(params[:v_goal])\n\n respond_to do |format|\n if @v_goal.save\n format.html { redirect_to @v_goal, notice: 'V goal was successfully created.' }\n format.json { render json: @v_goal, status: :created, location: @v_goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @v_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def body_goals(goal_type, options = {})\n get_json(path_user_version(\"/body/log/#{goal_type}/goal\", options))\n end", "def create\n @goal = Goal.goal_data(goal_params, current_user.id)\n\[email protected](goal_params)\n redirect_to @goal, notice: 'Goal was successfully updated.'\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @long_term_goal = LongTermGoal.new\n\n @long_term_goal.user = @current_user if @long_term_goal.user == nil\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end", "def create\n # @solution = Solution.new(solution_params)\n # @goal = Goal.find(params[:goal_id])\n @solution = @goal.solutions.new(solution_params)\n\n\n respond_to do |format|\n if @solution.save\n format.html { redirect_to project_goal_path(@project, @goal), notice: 'Solution was successfully created.' }\n format.json { render :show, status: :created, location: @solution }\n else\n format.html { render :new }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @performed_goal_int = PerformedGoalInt.new(performed_goal_int_params)\n\n respond_to do |format|\n if @performed_goal_int.save\n format.html { redirect_to @performed_goal_int, notice: 'Performed goal int was successfully created.' }\n format.json { render :show, status: :created, location: @performed_goal_int }\n else\n format.html { render :new }\n format.json { render json: @performed_goal_int.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:title, :description, :deadline, milestones_attributes: [:id, :title, :_destroy])\n end", "def goal_params\n params.require(:goal).permit(:name, :resolution_id, :state)\n end", "def permitted_params\n params.require(:goal).permit(:date, :description, :name, :priority, :status)\n end", "def goal_params\n params.require(:goal).permit(:name, :team_id, :user_id, :group_id, :parent_id, :deadline, :sdp, :start_date)\n end", "def goal_params\n params.require(:goal).permit(:title, :progress, :goal)\n end", "def index\n\n @goals = @goalable.goals.order(\"deadline ASC\")\n @goal = Goal.new\n end", "def goals_complete\n # goal = Goal.find(params[:id])\n @goals_user = GoalsUser.where(user_id:@user.id).where(goal_id: params[:id])\n @goals_user.map do |goal, index|\n goal.update_attributes(completed_today: true)\n goal.gu_update\n goal.save\n end\n # goals_user.save_all\n update_awards\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {success: true}}\n end\n\n end", "def index\n @short_term_goals = ShortTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @short_term_goals }\n format.json {\n #Format Response\n results = Array.new\n puts \"Print some tags: \"\n @short_term_goals.each do |goal|\n results << {\n 'id' => goal.id,\n 'name' => goal.name,\n 'description' => goal.description,\n 'long_term_goal_id' => goal.long_term_goal_ids, \n 'school_year' => goal.school_year,\n 'tasks' => Array.new, \n 'tag' => goal.tag.name.gsub!(/\\s*/,'').downcase,\n }\n goal.tasks.each do |task|\n results[results.length-1]['tasks'] << {\n 'id' => task.id,\n 'name' => task.name,\n 'description' => task.description\n }\n end\n end \n #send response\n render :json => results\n }\n end\n end", "def give_goals_to_user\n self.goals.create(category: \"Use my own bags at the store\", point_value: 12, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Carpool instead of use my car\", point_value: 100, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Air dry a load of laundry\", point_value: 70, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Adjust the thermostat up 1 degree in summer\", point_value: 40, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Install a compact fluorescent light bulb\", point_value: 60, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Ride a bike instead of car 1 mile\", point_value: 20, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Take a shorter shower (5 min or less)\", point_value: 4, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Turn off my engine instead of idleing\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Buy or eat local\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n\n\n end", "def create\n @goal_to_be = GoalToBe.new(goal_to_be_params)\n\n respond_to do |format|\n if @goal_to_be.save\n format.html { redirect_to @goal_to_be, notice: 'Goal to be was successfully created.' }\n format.json { render :show, status: :created, location: @goal_to_be }\n else\n format.html { render :new }\n format.json { render json: @goal_to_be.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @long_term_goal = LongTermGoal.find(params[:id])\n\n respond_to do |format|\n if @long_term_goal.update_attributes(params[:long_term_goal])\n format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @long_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def goal_params\n params[:goal].permit(:name, :description, :minimum_days, cheat_days: [])\n end", "def goals_and_next_step_params\n params.require(:goals_and_next_step).permit(:client_id, :description, :is_completed)\n end", "def create\n @completed_quest = CompletedQuest.new(params[:completed_quest])\n\n respond_to do |format|\n if @completed_quest.save\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully created.' }\n format.json { render json: @completed_quest, status: :created, location: @completed_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goal_params\n params.require(:goal).permit(:goalName, :timeFrame, :goalAmount)\n end", "def create\n objective = params[:objective]\n company_key_result_id = params[:company_key_result_id]\n team_id = params[:team_id]\n\n status = TeamObjective.new_team_objective(objective, company_key_result_id, current_user.id, team_id)\n\n respond_to do |format|\n if status == 200 \n format.json { render json: 'Team Objective is created successfully!', status: :ok }\n else\n format.json { render json: 'Fail to create team objective!', status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal_entry = GoalEntry.new(goal_entry_params)\n\n respond_to do |format|\n if @goal_entry.save\n format.html { redirect_to @goal_entry, notice: 'Goal entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @goal_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:name, :goal_type, :status, :nature, :target, :assessment_id, :for_everyone, :period, :cancel_url, :redirect_url, :for_a_single_employee, {function_ids: [], position_ids: []})\n end", "def create\n @goal = Goal.new(params[:goal])\n @goal.set_goal_user current_user\n\n # on the wizard path, steps guarantee that this goal preceeds the plan and reward. Create empty objects for next step.\n is_wizard = (params[:user_context] == 'wizard')\n\n respond_to do |format|\n if @goal.save\n if is_wizard \n @reward = @goal.plan.reward\n puts \"reward #{@reward}\"\n format.html { render action: \"wizard_prize\" }\n else\n format.html { redirect_to @goal, notice: 'Goal was successfully created.' }\n end\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def goal_params\n params.require(:goal).permit(:user_id, :name, :description, :amount, :posted, :public, :deleted)\n end", "def goal_params\n params.require(:goal).permit(:time, :game_id, :player_id, :is_our_goal)\n end", "def goal_params\n params.require(:goal).permit(:title, :type_id, :user_id, :value)\n end", "def goal_params\n params.require(:goal).permit(:description)\n end" ]
[ "0.70534927", "0.67665017", "0.6689707", "0.6636825", "0.6435989", "0.6376466", "0.63576174", "0.63191056", "0.63141716", "0.63065654", "0.6303088", "0.6261073", "0.6246727", "0.6246675", "0.62346655", "0.6221175", "0.6192996", "0.6192996", "0.6183522", "0.61772084", "0.617441", "0.61299676", "0.61257017", "0.6123035", "0.6100211", "0.6089862", "0.60878295", "0.6062482", "0.6047278", "0.6015903", "0.60042965", "0.6000618", "0.5991856", "0.59890896", "0.59869605", "0.5981769", "0.5981223", "0.59690046", "0.5967393", "0.59641856", "0.59633577", "0.59611005", "0.59571517", "0.59393114", "0.59199876", "0.5917721", "0.59155756", "0.59144723", "0.5910621", "0.58805996", "0.5879133", "0.58782834", "0.58691525", "0.5865608", "0.58464956", "0.5845729", "0.5844075", "0.5833782", "0.58307195", "0.5816515", "0.58144146", "0.5806425", "0.5802", "0.5801477", "0.5799316", "0.5786112", "0.5777995", "0.5763915", "0.5763157", "0.57527375", "0.57527375", "0.57527375", "0.5728153", "0.572255", "0.5712683", "0.57119006", "0.5706095", "0.5703657", "0.570044", "0.5677494", "0.5672231", "0.56696683", "0.566023", "0.56562215", "0.5644361", "0.5643671", "0.5642487", "0.56285", "0.562828", "0.56251055", "0.5623034", "0.56223685", "0.5615984", "0.5614026", "0.56118953", "0.5610127", "0.5608083", "0.5599689", "0.55978805", "0.5597662" ]
0.7435835
0
PATCH/PUT /longterm_goals/1 PATCH/PUT /longterm_goals/1.json
def update respond_to do |format| if @longterm_goal.update(longterm_goal_params) format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully updated.' } format.json { render :show, status: :ok, location: @longterm_goal } else format.html { render :edit } format.json { render json: @longterm_goal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @long_term_goal = LongTermGoal.find(params[:id])\n\n respond_to do |format|\n if @long_term_goal.update_attributes(params[:long_term_goal])\n format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @long_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goals = current_user.goals\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to home_index_path, notice: 'Goal was successfully updated.' }\n # format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit, notice: 'There was an error updating your goal.' }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n @needs = @goal.needs\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully updated.' }\n # format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to user_goals_path(current_user), notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n data = {\n \"slug\" => @slug,\n \"title\" => @title,\n \"ephem\" => @ephem || false,\n \"panic\" => @panic || 86400,\n \"secret\" => @secret || false,\n \"datapublic\" => @datapublic || false,\n }\n data['roadall'] = @roadall if @roadall\n\n @user.put_document \"users/me/goals/#{@slug}.json\", data\n end", "def update\n @goal = @user.goals.find(params[:id])\n \n if params[:activity]\n if params[:untrack]\n @goal.untrack_activity(params[:activity][:id])\n else\n @goal.track_activity(params[:activity][:id])\n end\n end\n \n if params[:goal_amount] == \"score\"\n if @goal.goal_amount_score.blank?\n @goal.errors[:goal_amount_score] << \"should be set.\"\n end\n \n if [email protected]_amount_duration.blank?\n @goal.goal_amount_duration = \"\"\n end\n end\n \n if params[:goal_amount] == \"duration\"\n if @goal.goal_amount_duration.blank?\n @goal.errors[:goal_amount_duration] << \"should be set.\"\n end\n \n if [email protected]_amount_score.blank?\n @goal.goal_amount_score = \"\"\n end\n end\n \n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to [@user, @goal], notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to group_goal_path(@group, @goal), notice: 'Goal was successvol geupdate.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @global_goal = GlobalGoal.find(params[:id])\n\n respond_to do |format|\n if @global_goal.update_attributes(params[:global_goal])\n format.html { redirect_to @global_goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @global_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update_attributes(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to patient_path(@patient), notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: patient_goals_path(@patient, @goal)}\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to goals_path, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal.list, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @goal.update(goal_params)\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n else\n render json: @goal.to_json\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to goals_url, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n if @level_goal.update_attributes(params[:level_goal])\n format.html { redirect_to @level_goal, notice: 'Level goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goals = @need.goals\n @goals = @need.goals\n @plans = @goals.map(&:plans).flatten.uniq\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n respond_to do |format|\n if @need.update(need_params)\n format.html { redirect_to back_index_case_url, notice: 'Need was successfully updated.' }\n # format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n if @v_goal.update_attributes(params[:v_goal])\n format.html { redirect_to @v_goal, notice: 'V goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @v_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Goal.find(params[:id])\n if (@goal.update_attributes(params[:edit_goal]))\n flash[:success] = \"Goal Updated!\"\n #redirect_to :action => \"index\", :id => current_user.id\n render :partial => \"goal\", :object => @goal\n else\n #redirect_to :action => \"index\", :id => current_user.id\n render :text => @goal.errors.full_messages, :status => 403\n end\n end", "def update\n respond_to do |format|\n if @goal_step.update(goal_step_params)\n format.html { redirect_to @goal_step, notice: \"Goal step was successfully updated.\" }\n format.json { render :show, status: :ok, location: @goal_step }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @goal_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n flash[:notice] = 'Goal was successfully updated.'\n format.html { redirect_to(@goal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n\n if @goal.user != current_user\n format.html { redirect_to goals_url, alert: \"You can't update someone else's goal!.\" }\n format.json { render json: {errors: [\"You can't update someone else's goal!.\"]}, status: :forbidden }\n elsif @goal.update_attributes(params[:goal])\n format.html { redirect_to goals_url, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n @goals = goals_for_current_user\n format.html { render action: \"index\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Mg::Goal.find(params[:id])\n\n if @goal.update_attributes(params[:goal])\n flash[:notice] = 'Goal was successfully updated.'\n redirect_to mg_goal_url :id => @goal.id\n else\n render :action => \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @goal_to_be.update(goal_to_be_params)\n format.html { redirect_to @goal_to_be, notice: 'Goal to be was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_to_be }\n else\n format.html { render :edit }\n format.json { render json: @goal_to_be.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasks = @plan.tasks\n\n @goals = @plan.goals\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully updated.' }\n # format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #set_owner unless @goal.owner\n #raise goal_params.to_s\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to :controller => :games, :action => 'show', \n :id => @goal.game.id, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal_entry.update(goal_entry_params)\n format.html { redirect_to @goal_entry, notice: 'Goal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if (current_user.has_role? :admin) \n @goals = Goal.all\n elsif (current_user.has_role? :athlete)\n @goals = Goal.where(:user_id => current_user.id, :active => true).order(:goalEndDate)\n end\n\n respond_to do |format|\n if @goal.update(goal_params)\n ActiveTest.perform_async(@goal.id)\n format.js\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @goal.update(goal_params)\n flash[\"notice\"] = 'Goal was successfully updated.'\n end\n\n respond_with @goal, location: [current_user, @goal] \n end", "def update\n respond_to do |format|\n if @goal_int.update(goal_int_params)\n format.html { redirect_to @goal_int, notice: 'Goal int was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_int }\n else\n format.html { render :edit }\n format.json { render json: @goal_int.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goalable = @goal.goalable\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to [@goalable, @goal], notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n for i in [email protected]()-1\n objective = @activity.objectives[i]\n objective.is_done = params[:objective][i.to_s()]\n objective.save!\n end\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: '¡Actividad actualizada!.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @short_term_goal = ShortTermGoal.find(params[:id])\n=begin\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n params[:short_term_goal][:tasks] = Array.new\n tasks_array = Array.new\n if params[:task]\n params[:task].each do |num,task| \n tasks_array[Integer(num)] = task if task != ''\n end\n end\n tasks_array.each do |task|\n params[:short_term_goal][:tasks] << Task.create(:name => task) if task != nil\n end\n=end\n respond_to do |format|\n if @short_term_goal.update_attributes(params[:short_term_goal])\n format.html { redirect_to(myguide_path(@current_user), :notice => 'Short term goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @short_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal_to_do.update(goal_to_do_params)\n format.html { redirect_to @goal_to_do, notice: 'Goal to do was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_to_do }\n else\n format.html { render :edit }\n format.json { render json: @goal_to_do.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @performed_goal_int.update(performed_goal_int_params)\n format.html { redirect_to @performed_goal_int, notice: 'Performed goal int was successfully updated.' }\n format.json { render :show, status: :ok, location: @performed_goal_int }\n else\n format.html { render :edit }\n format.json { render json: @performed_goal_int.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n if @goal_state.update_attributes(params[:goal_state])\n format.html { redirect_to @goal_state, notice: 'Goal state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:user_goal_id] && params[user_id]\n goals = @user.update!(user_goal_params)\n render json: goals, status: :accepted\n end\n end", "def set_longterm_goal\n @longterm_goal = LongtermGoal.find(params[:id])\n end", "def update\n @goal = Goal.find(params[:id])\n is_complete = params[:is_complete]\n\n if(is_complete != nil) # update just complete\n respond_to do |format|\n if @goal.update_attribute(\"is_complete\",is_complete)\n format.html { render :nothing => true }\n format.js { render :json => 1}\n else\n format.html { render :nothing => true }\n format.js { render :json => 2 }\n end\n end\n else # update all\n respond_to do |format|\n\n @validated = true\n @i = 0\n @num = 5\n while @i < @num do\n @sm = params[:goal]['tasks_attributes'][\"#{@i}\"]['startdue(2i)'].to_i\n @sd = params[:goal]['tasks_attributes'][\"#{@i}\"]['startdue(3i)'].to_i\n @sy = params[:goal]['tasks_attributes'][\"#{@i}\"]['startdue(1i)'].to_i\n @dm = params[:goal]['tasks_attributes'][\"#{@i}\"]['due(2i)'].to_i\n @dd = params[:goal]['tasks_attributes'][\"#{@i}\"]['due(3i)'].to_i\n @dy = params[:goal]['tasks_attributes'][\"#{@i}\"]['due(1i)'].to_i\n @i = @i + 1;\n if (@sy > @dy) or (@sm > @dm and @sy == @dy) or (@sd > @dd and @sm == @dm and @sy == @dy)\n @validated = false\n format.html { redirect_to goals_url+'?filter='[email protected], notice: 'Start date cannot be less than end date.' }\n format.json { render json: @goal, status: :created, location: @goal }\n end\n end\n\n if @validated == true\n if @goal.update_attributes(params[:goal])\n\n # destroy blank tasks\n blanktasks = Task.where('task = \\'\\' and goal_id = ?',params[:id])\n blanktasks.each do |bt|\n bt.destroy\n end\n\n @mentors = @goal.accountability.split(',');\n @users = User.find(:all,:order=>\"name\")\n @mentors.each do |onementor|\n if onementor != '' and @goal.goal != ''\n if @users\n @users.each do |user|\n if user.name == onementor.strip and user.id.to_i != @goal.user_id.to_i\n @mu = MentorUser.where('mentor_user_id = ? and student_user_id = ? ',user.id.to_i,@goal.user_id.to_i)\n if @mu.length == 0\n @mentorUser = MentorUser.new(:mentor_user_id=>user.id.to_i ,:student_user_id=>@goal.user_id.to_i)\n @mentorUser.save\n end\n end\n end\n end\n end\n end\n\n format.html { redirect_to goals_url+'?filter='[email protected], notice: 'Your goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { redirect_to goals_url }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solution.update(solution_params)\n format.html { redirect_to project_goal_path(@project, @goal), notice: 'Solution was successfully updated.' }\n format.json { render :show, status: :ok, location: @solution }\n else\n format.html { render :edit }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal = Goal.find(params[:id])\n to_update = { :name => params[:name], :position => params[:position], :archived => params[:archived] }\n\n respond_to do |format|\n if @goal.update_attributes(to_update)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @weekly_goal.update(weekly_goal_params)\n format.html { redirect_to @weekly_goal, notice: 'Weekly goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_goal }\n else\n format.html { render :edit }\n format.json { render json: @weekly_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def goals_update\n @goal = Goal.find(params[:id])\n goal = GoalsUser.find_or_create_by({user_id:@user.id,goal_id:@goal.id})\n if !goal.active\n goal.update_attribute(\"active\", true)\n end\n update_awards\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {success: true}}\n end\n end", "def update\n @product = Product.find(params[:product_id])\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @product, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @objective = Objective.find(params[:id])\n\n respond_to do |format|\n if @objective.update_attributes(params[:objective])\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @financial_objects_goal.update(financial_objects_goal_params)\n format.html { redirect_to @financial_objects_goal, notice: \"Goal was successfully updated.\" }\n format.json { render :show, status: :ok, location: @financial_objects_goal }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @financial_objects_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal_comment = GoalComment.find(params[:id])\n\n respond_to do |format|\n if @goal_comment.update_attributes(params[:goal_comment])\n format.html { redirect_to @goal_comment, notice: 'Goal comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end", "def update\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n if @completed_quest.update_attributes(params[:completed_quest])\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @goal.user != current_user\n format.html { redirect_to @goal, notice: 'That goal is not yours to edit.' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n elsif @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" } \n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ### Scoped properly\n\n @goal = Goal.find(params[:id])\n\n \n\n if [email protected]_allowed_per_day\n @goal.pushes_allowed_per_day = 1\n end\n \n \n if current_user.id != @goal.user.id\n redirect_to(server_root_url) \n else \n ################################\n #Status Change Business Rules\n ################################\n\n # Theory: keep past data that's relevant for later analysis\n\n ##start --> hold \n ##monitor --> hold\n # 1) (keep any past/non-default checkpoints for future stats)\n\n #start --> monitor \n #hold --> monitor\n #monitor --> start\n #hold --> start\n # 1) (remove all existing checkpoints (as of 20110913))\n # 2) (set goal.start to today, stopping after goal.days_to_form_a_habit days)\n\n old_status = @goal.status\n\n old_publish = @goal.publish\n \n \n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n\n\n\n ### if we just created this goal and then want to say\n ### start today instead of tomorrow\n if params[:delay_start_for_this_many_days] \n start_day_offset = params[:delay_start_for_this_many_days].to_i\n ### Set the standard dates\n @goal.start = @goal.start + start_day_offset\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n @goal.first_start_date == @goal.start\n end\n\n\n \n ### update last activity date\n @goal.user.last_activity_date = @goal.user.dtoday\n @goal.user.save\n \n @goal.title = @goal.response_question\n\n \n ##### SET THE HOUR THAT THE REMINDERS SHOULD GO OUT FOR THIS GOAL #############\n if @goal.usersendhour == nil\n\t @goal.usersendhour = 20 ### 8pm\n end\n\n Time.zone = @goal.user.time_zone\n utcoffset = Time.zone.formatted_offset(false)\n offset_seconds = Time.zone.now.gmt_offset \n send_time = Time.utc(2000, \"jan\", 1, @goal.usersendhour, 0, 0) #2000-01-01 01:00:00 UTC\n central_time_offset = 21600 #add this in since we're doing UTC\n server_time = send_time - offset_seconds - central_time_offset\n puts \"User lives in #{@goal.user.time_zone} timezone, UTC offset of #{utcoffset} (#{offset_seconds} seconds).\" #Save this value in each goal, and use that to do checkpoint searches w/ cronjob\n puts \"For them to get an email at #{send_time.strftime('%k')} their time, the server would have to send it at #{server_time.strftime('%k')} Central time\" \n @goal.serversendhour = server_time.strftime('%k')\n @goal.gmtoffset = utcoffset\n\n #############\n\n\n if @goal.daym == nil \n @goal.daym = true\n end\n if @goal.dayt == nil \n @goal.dayt = true\n end\n if @goal.dayw == nil \n @goal.dayw = true\n end\n if @goal.dayr == nil \n @goal.dayr = true\n end\n if @goal.dayf == nil \n @goal.dayf = true\n end\n if @goal.days == nil \n @goal.days = true\n end\n if @goal.dayn == nil \n @goal.dayn = true\n end\n\n if @goal.template_owner_is_a_template\n @goal.save \n flash[:notice] = 'Template was successfully updated.'\n logger.info 'SGJ Template was successfully updated.'\n else\n if @goal.status != \"hold\" and @goal.daym and @goal.dayt and @goal.dayw and @goal.dayr and @goal.dayf and @goal.days and @goal.dayn and (@goal.goal_days_per_week == nil or @goal.goal_days_per_week == 7)\n @goal.status = \"start\"\n else\n @goal.status = \"monitor\"\n end\n @goal.save \n flash[:notice] = 'Goal was successfully updated.'\n logger.info 'SGJ Goal was successfully updated.'\n end\n\n\n\n\n\n dnow = get_dnow\n \n logger.debug 'old_status =' + old_status\n logger.debug 'new status =' + @goal.status\n ##If status was changed to start or monitor, delete and re-create future checkpoints\n if old_status != @goal.status\n if (@goal.status == \"start\" or @goal.status == \"monitor\") \n #set_start_date(@goal.id, dnow)\n #set_stop_date(@goal.id, 0)\n @goal.start = dnow\n @goal.stop = @goal.start + @goal.days_to_form_a_habit\n\n ################################################################################################\n #### If someone is switching a goal from a \"monitor\" goal over to a \"start\" goal,\n #### then make sure all days-of-the week get saved as \"checked\", \n #### otherwise it won't create their checkpoints, and it will end their start date prematurely.\n if @goal.status == \"start\"\n @goal.daym = true\n @goal.dayt = true\n @goal.dayw = true\n @goal.dayr = true\n @goal.dayf = true\n @goal.days = true\n @goal.dayn = true\n end\n ################################################################################################\n ################################################################################################ \n \n ############################\n ### If someone is going from \"hold\" to \"re-activate\"\n ### delete the old checkpoints because keeping them messes up the success rate\n ### they have been warned of this happening already\n #if old_status == \"hold\"\n # ### Re-set days straight to 0\n # @goal.daysstraight = 0\n # \n # ### Destroy any associated Checkpoints\n # @checkpoints = Checkpoint.find(:all, :conditions => \"goal_id = '#{@goal.id}'\")\n # for checkpoint in @checkpoints\n # checkpoint.destroy\n # end \n #end \n ############################\n ############################\n\n end\n if @goal.status == \"hold\"\n @goal.start = Date.new(1900, 1, 1)\n @goal.stop = @goal.start \n end\n ### save date changes\n @goal.save\n\n\n #format.html { render :action => \"index\" } # index.html.erb\n #format.xml { render :xml => @goals }\n end\n\n\n ### when a goal is saved by user, if it's \"private\", remove any entries from \"encourage_items\"\n if @goal.publish == false and old_publish == true\n logger.info(\"sgj:goals_controller.rb:about to remove entries because publish status changing\")\n encourage_items = EncourageItem.find(:all, :conditions => \"goal_id = '#{@goal.id}'\")\n encourage_items.each do |e|\n e.destroy\n end\n end\n\n\n if @goal.template_owner_is_a_template\n flash[:notice] = 'Template was successfully updated.' + flash[:notice]\n else\n flash[:notice] = 'Goal was successfully updated.' + flash[:notice]\n end\n\n\n ### if this template is for a program, redirect to the program\n if @goal.template_owner_is_a_template and params[:program_id]\n format.html {redirect_to(\"/programs/#{params[:program_id]}#action_items\")}\n else\n\n if @goal.user.is_premium\n format.html { render :action => \"index\" } # index.html.erb\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity } \n else\n format.html {redirect_to(\"/widget/upgrade\")}\n end\n end\n\n\n\n\n end\n end\n end\n end", "def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @reading_goal.update(reading_goal_params)\n format.html { redirect_to @reading_goal, notice: 'Reading goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @reading_goal }\n else\n format.html { render :edit }\n format.json { render json: @reading_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n if @lunchplan.update_attributes(params[:lunchplan])\n format.html { redirect_to @lunchplan, :notice => 'Lunchplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lunchplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_goals\n User.find_by(id: session[:user_id])\n @client = current_user.fitbit\n\[email protected]_or_update_daily_goal(@opts)\n\trender 'goals'\n end", "def goals_complete\n # goal = Goal.find(params[:id])\n @goals_user = GoalsUser.where(user_id:@user.id).where(goal_id: params[:id])\n @goals_user.map do |goal, index|\n goal.update_attributes(completed_today: true)\n goal.gu_update\n goal.save\n end\n # goals_user.save_all\n update_awards\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {success: true}}\n end\n\n end", "def update\n @milestone = Milestone.find(params[:id])\n @milestone.update_attributes(params[:milestone])\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to goals_path, notice: 'Milestone was successfully created.' }\n format.json { respond_with_bip(@milestone) }\n else\n format.html { render action: \"new\" }\n format.json { respond_with_bip(@milestone) }\n end\n end\n end", "def update!(**args)\n @goal = args[:goal] if args.key?(:goal)\n @metric_id = args[:metric_id] if args.key?(:metric_id)\n end", "def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to allies_url, notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @planner = Planner.find(params[:id])\n\n respond_to do |format|\n if @planner.update_attributes(params[:planner])\n format.html { redirect_to @planner, notice: 'Planner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tally = Tally.find(params[:id])\n respond_to do |format|\n if @tally.update(tally_params)\n format.html { redirect_to @tally, notice: 'Tally was successfully updated.' }\n format.json { render :show, status: :ok, location: @tally }\n else\n format.html { render :edit }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @medium_trial = MediumTrial.find(params[:id])\n\n respond_to do |format|\n if @medium_trial.update_attributes(params[:medium_trial])\n format.html { redirect_to @medium_trial, notice: 'Medium trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goal_comment = GoalComment.find(params[:id])\n respond_to do |format|\n if @goal_comment.update(goal_comment_params)\n format.html { redirect_to @goal_comment, notice: 'Goal comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_comment }\n else\n format.html { render :edit }\n format.json { render json: @goal_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params.require(:task).permit(:complete))\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @desired_skill.update(desired_skill_params)\n format.html { redirect_to @desired_skill, notice: 'Desired skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @desired_skill }\n else\n format.html { render :edit }\n format.json { render json: @desired_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @medium_mission_strategy = MediumMissionStrategy.find(params[:id])\n\n respond_to do |format|\n if @medium_mission_strategy.update_attributes(params[:medium_mission_strategy])\n format.html { redirect_to @medium_mission_strategy, notice: 'Medium mission strategy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_mission_strategy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to edit_ally_path(@ally), notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n @task_completion = TaskCompletion.find(params[:id])\n\n respond_to do |format|\n if @task_completion.update_attributes(params[:task_completion])\n format.html { redirect_to @task_completion, notice: 'Task completion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_completion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @objective_result = ObjectiveResult.find(params[:id])\n\n respond_to do |format|\n if @objective_result.update_attributes(params[:objective_result])\n format.html { redirect_to :back}\n format.json { head :no_content }\n else\n format.html { redirect_to :back }\n format.json { render json: @objective_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opt10080.update(opt10080_params)\n format.html { redirect_to @opt10080, notice: 'Opt10080 was successfully updated.' }\n format.json { render :show, status: :ok, location: @opt10080 }\n else\n format.html { render :edit }\n format.json { render json: @opt10080.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @goal = args[:goal] if args.key?(:goal)\n @metric_id = args[:metric_id] if args.key?(:metric_id)\n @safety_config = args[:safety_config] if args.key?(:safety_config)\n end", "def update\n @team_challenge = TeamChallenge.find(params[:id])\n\n respond_to do |format|\n if @team_challenge.update_attributes(params[:team_challenge])\n format.html { redirect_to @team_challenge, :notice => 'Team challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team_challenge.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agency.update(agency_params)\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @team_objective.update(team_objective_params)\n update_okr_modules(@team_objective.id,@team_objective.progress)\n format.html { redirect_to @team_objective, notice: 'Team objective was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_objective }\n else\n format.html { render :edit }\n format.json { render json: @team_objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend" ]
[ "0.73148376", "0.71607697", "0.69180954", "0.6841149", "0.6807351", "0.6791067", "0.678307", "0.6769511", "0.67477274", "0.67466885", "0.6742971", "0.67197686", "0.67132807", "0.6711081", "0.67098045", "0.67092973", "0.67092973", "0.67092973", "0.67092973", "0.67092973", "0.6706917", "0.6608094", "0.6571747", "0.6571501", "0.64920694", "0.64809334", "0.6477121", "0.64724535", "0.6450425", "0.64212644", "0.6417184", "0.6391707", "0.6389053", "0.6355896", "0.63519377", "0.63418037", "0.6326945", "0.6324716", "0.63135695", "0.6300399", "0.6287768", "0.62865597", "0.62862813", "0.62780267", "0.62462217", "0.61803395", "0.6173014", "0.61671513", "0.61593926", "0.615749", "0.6154575", "0.6152976", "0.6148125", "0.61476725", "0.6134753", "0.6113765", "0.6111836", "0.61053747", "0.6076817", "0.6062128", "0.6053175", "0.60212374", "0.59762776", "0.5970372", "0.5962239", "0.5953793", "0.5952931", "0.5920778", "0.5910502", "0.5909222", "0.59065044", "0.5896702", "0.5894308", "0.5887367", "0.5882757", "0.5881286", "0.58801985", "0.58744544", "0.5873301", "0.5867113", "0.5865622", "0.58618134", "0.5849299", "0.58430827", "0.5840707", "0.5839427", "0.5839427", "0.5839427", "0.58156455", "0.5814033", "0.58108854", "0.5808796", "0.5794573", "0.57938313", "0.57879186", "0.57873744", "0.5776811", "0.5768396", "0.57634777", "0.5760768" ]
0.7377008
0
DELETE /longterm_goals/1 DELETE /longterm_goals/1.json
def destroy @longterm_goal.destroy respond_to do |format| format.html { redirect_to longterm_goals_url, notice: 'Longterm goal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @long_term_goal = LongTermGoal.find(params[:id])\n @long_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(long_term_goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @global_goal = GlobalGoal.find(params[:id])\n @global_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to global_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = @user.goals.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to user_goals_url(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @level_goal = LevelGoal.find(params[:id])\n @level_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to level_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @v_goal = VGoal.find(params[:id])\n @v_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to v_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @short_term_goal = ShortTermGoal.find(params[:id])\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n @short_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(short_term_goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @goal = Mg::Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to mg_goals_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to home_index_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to user_goals_path(current_user), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to user_goals_path(current_user.id), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_entry.destroy\n respond_to do |format|\n format.html { redirect_to goal_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @goal.destroy\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy!\n redirect_to goals_url\n end", "def destroy\n @goal_step.destroy\n respond_to do |format|\n format.html { redirect_to goal_steps_url, notice: \"Goal step was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n game = @goal.game\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to game_path(game) }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_state = GoalState.find(params[:id])\n @goal_state.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to patient_path(@patient), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @financial_objects_goal.destroy\n respond_to do |format|\n format.html { redirect_to financial_objects_goals_url, notice: \"Goal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end", "def destroy\n @goal_int.destroy\n respond_to do |format|\n format.html { redirect_to goal_ints_url, notice: 'Goal int was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @performed_goal_int.destroy\n respond_to do |format|\n format.html { redirect_to performed_goal_ints_url, notice: 'Performed goal int was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_goal.destroy\n respond_to do |format|\n format.html { redirect_to weekly_goals_url, notice: 'Weekly goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @goal = Goal.find(params[:goal_id])\n # @solution = @goal.solutions.find(params[:id])\n @project = Project.find(params[:project_id])\n @goal = @project.goals.find(params[:goal_id])\n @solution = @goal.solutions.find(params[:id])\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to project_goal_path(@project, @goal), notice: 'Solution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_reward = GoalReward.find(params[:id])\n @goal_reward.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_rewards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @goal.plans.exists?\n flash[:error] = \"Cannot delete goal because it has plans attached\"\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n else\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n end", "def destroy\n @milestone = Milestone.find(params[:id])\n @milestone.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_to_be.destroy\n respond_to do |format|\n format.html { redirect_to goal_to_bes_url, notice: 'Goal to be was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_to_do.destroy\n respond_to do |format|\n format.html { redirect_to goal_to_dos_url, notice: 'Goal to do was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end", "def destroy\n @list = @goal.list\n @goal.destroy\n respond_to do |format|\n format.js {render :action => 'refresh_goals_list.js.haml', :object => @list, :locals => {:goals => @list.goals}}\n# format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def delete datapoints\n datapoints = [*datapoints]\n datapoints.each do |dp|\n @user.delete \"/users/me/goals/#{@slug}/datapoints/#{dp.id}.json\"\n end\n end", "def destroy\n @goal_removed = GoalRemoved.find(params[:id])\n @goal_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(goal_removeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_logs_url(@goal) }\n format.json { head :no_content }\n end\n end", "def destroy\n @projection_goal_int.destroy\n respond_to do |format|\n format.html { redirect_to projection_goal_ints_url, notice: 'Projection goal int was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_trial = MediumTrial.find(params[:id])\n @medium_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @achievement.destroy\n\n respond_to do |format|\n format.html { redirect_to achievements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Goal.find(params[:id]).destroy\n flash[:success] = \"Goal Removed\"\n redirect_to :action => \"index\", :id => current_user.id\n end", "def destroy\n @goal = Goal.find(params[:id])\n respond_to do |format|\n if @goal.user != current_user\n format.html { redirect_to goals_url, alert: \"You can't delete someone else's goal!.\" }\n format.json { render json: {errors: [\"You can't delete someone else's goal!.\"]}, status: :forbidden }\n elsif @goal.destroy\n format.html { redirect_to goals_url, notice: 'Goal was successfully deleted.' }\n format.json { head :no_content }\n else\n @goals = goals_for_current_user\n format.html { render action: \"index\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reading_goal.destroy\n respond_to do |format|\n format.html { redirect_to reading_goals_url, notice: 'Reading goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n @ways_of_admission.destroy\n\n respond_to do |format|\n format.html { redirect_to ways_of_admissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_mission_strategy = MediumMissionStrategy.find(params[:id])\n @medium_mission_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_mission_strategies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal_comment = GoalComment.find(params[:id])\n @goal_comment.destroy\n\n respond_to do |format|\n #format.html { redirect_to about_profile_path }\n #format.json { head :no_content }\n @goal = current_user.goals.order('created_at desc')\n format.js\n end\n end", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n @goal_categories = GoalCategory.all\n \n unless @visit.errors.any?\n @visit = @visit.client.visits.last\n end\n \n @client = Client.find(params[:client_id])\n @client.goals.each do |goal|\n if goal.goal_states.empty?\n goal.destroy()\n end\n end\n \n prepareShow()\n\n respond_to do |format|\n format.html { render :show }\n format.json { head :no_content }\n end\n end", "def destroy\n @quant = Quant.find(params[:id])\n goal_id = @quant.goal.id\n @quant.destroy\n\n respond_to do |format|\n format.html { redirect_to('/goals#tab_1_5_' + goal_id.to_s) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @filter = @goal.category\n \n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url+'?filter='+@filter }\n format.json { head :ok }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @complete.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path, notice: 'Complete was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal.destroy\n\n if (current_user.has_role? :admin) \n @goals = Goal.all\n elsif (current_user.has_role? :athlete)\n @goals = Goal.where(:user_id => current_user.id, :active => true).order(:goalEndDate)\n end\n\n respond_to do |format|\n format.js\n format.html { redirect_to goals_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_item.destroy\n\n respond_to do |format|\n format.html { redirect_to goal_log_items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lead_step = LeadStep.find(params[:id])\n @lead_step.destroy\n\n respond_to do |format|\n format.html { redirect_to lead_steps_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @reached_goal_float.destroy\n respond_to do |format|\n format.html { redirect_to reached_goal_floats_url, notice: 'Reached goal float was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @mosttinytrial = Mosttinytrial.find(params[:id])\n @mosttinytrial.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinytrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goalable = @goal.goalable\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@goalable, Goal]), notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n format.js { }\n end\n end", "def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to quest_steps_url(@quest) }\n format.json { head :ok }\n end\n end", "def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_city_hall_story.destroy\n respond_to do |format|\n format.html { redirect_to admin_city_hall_stories_url, notice: 'Dati Comune cancellata con successo!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end", "def destroy\n @barangay_bridge_project_completion.destroy\n respond_to do |format|\n format.html { redirect_to barangay_bridge_project_completions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tally.destroy\n respond_to do |format|\n format.html { redirect_to tallies_url, notice: 'Tally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\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 delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end" ]
[ "0.7716748", "0.7485457", "0.7369754", "0.73418015", "0.73412883", "0.73133284", "0.73133284", "0.7311161", "0.7256254", "0.72462916", "0.72044355", "0.7078552", "0.70718396", "0.7068877", "0.70644784", "0.70447594", "0.70447594", "0.70447594", "0.70447594", "0.70447594", "0.70447594", "0.70447594", "0.70432776", "0.7034299", "0.68768024", "0.68733984", "0.6872723", "0.686647", "0.6846259", "0.68345165", "0.68218607", "0.6814858", "0.6782057", "0.6762192", "0.6747911", "0.6728764", "0.67118233", "0.66846764", "0.66659343", "0.66588813", "0.6624085", "0.6609123", "0.66014683", "0.6594571", "0.6550545", "0.65350163", "0.6514115", "0.65065104", "0.6504836", "0.6499553", "0.64875054", "0.6486788", "0.6481487", "0.6474792", "0.64726335", "0.64658195", "0.64657146", "0.6464053", "0.6451826", "0.6449936", "0.64484966", "0.64468384", "0.64356923", "0.64356923", "0.64353204", "0.6434344", "0.6432488", "0.64271355", "0.6426962", "0.64082134", "0.64071506", "0.6401706", "0.6397766", "0.63907397", "0.63765615", "0.6375227", "0.63733435", "0.6348865", "0.6344505", "0.6344494", "0.6344345", "0.63440573", "0.6342517", "0.6340327", "0.6336976", "0.63363814", "0.6335058", "0.63336205", "0.6332397", "0.6323237", "0.6316631", "0.6316262", "0.6316225", "0.63152885", "0.6307866", "0.63061893", "0.628739", "0.6277568", "0.62765384", "0.62754333" ]
0.7674615
1
Use callbacks to share common setup or constraints between actions.
def set_longterm_goal @longterm_goal = LongtermGoal.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def longterm_goal_params params.require(:longterm_goal).permit(:category_id, :target_time_min, :actual_time_min, :successful) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Test for updating form field
def test_post_form_field filename = 'FormFilled.docx' remote_name = 'TestPostFormField.docx' dest_name = remote_test_out + remote_name index = 0 body = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => ''}) st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, "r").read @storage_api.put_create st_request request = PostFormFieldRequest.new remote_name, body, index, remote_test_folder + test_folder, :dest_file_name => dest_name, :node_path => 'sections/0' result = @words_api.post_form_field request assert_equal 200, result.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_form_field\n remote_file_name = 'TestUpdateFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => 'No name'})\n request = UpdateFormFieldRequest.new(name: remote_file_name, index: 0, form_field: request_form_field, node_path: 'sections/0', folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n result = @words_api.update_form_field(request)\n assert_equal false, result.nil?\n end", "def update\n set_field\n # byebug\n if @field.update(fields_params)\n render :json => {}\n else\n render :json => @subject.errors, status: :unprocessable_entity\n end\n end", "def test_update_form_field_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => 'No name'})\n request = UpdateFormFieldOnlineRequest.new(document: request_document, form_field: request_form_field, index: 0, node_path: 'sections/0')\n\n result = @words_api.update_form_field_online(request)\n assert_equal false, result.nil?\n end", "def update_field(change_field, change_value)\n if valid?\n run_sql(\"UPDATE #{table} SET #{change_field} = #{self.class.add_quotes_if_string(change_value)} WHERE id = #{@id};\")\n else\n false\n end\n end", "def update\n @field = Field.find(params[:id])\n @field.update_attributes(params[:field])\n respond_with :admin, @field\n end", "def update\n validate_save_and_respond(update_change_set, :edit)\n end", "def update\n @field = Field.find(params[:id])\n\n respond_to do |format|\n if @field.update_attributes(params[:field])\n format.html { redirect_to @field, notice: 'Field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form_field.update(form_field_params)\n format.html { redirect_to @form_field, notice: 'Form field was successfully updated.' }\n format.json { render :show, status: :ok, location: @form_field }\n else\n format.html { render :edit }\n format.json { render json: @form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update\r\n assert_equal \"review0\", @response.additional_comment\r\n @response.additional_comment = \"abcd\"\r\n @response.save\r\n @response.reload\r\n # verifying whether the update is done properly or not\r\n assert_equal @response.additional_comment, \"abcd\"\r\n end", "def update\n puts field_params\n respond_to do |format|\n if @field.update(field_params)\n format.html { redirect_to fields_path, notice: 'Field was successfully updated.' }\n format.json { render :show, status: :ok, location: @field }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def assert_valid_update_page(model, **opt)\n action = opt[:id] ? :edit : :edit_select\n assert_valid_action_page(model, action, **opt)\n end", "def update\n @question_field = QuestionField.find(params[:id])\n\n respond_to do |format|\n if @question_field.update_attributes(params[:question_field])\n format.html { redirect_to @question_field, notice: 'Question field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_field\n res = {\n :success => false,\n :msg => '',\n :data => {}\n }\n\n if (params[\"model\"] == nil)\n res[:msg] = 'order/update_field -- no model specified'\n else\n peer = nil\n case params[\"model\"]\n when \"entity\"\n peer = OrderEntity\n when \"company\"\n peer = Company\n when \"order\"\n peer = Order\n when \"order_revenu\"\n peer = OrderRevenu\n else\n res[:msg] = 'Could not locate that model'\n end\n if (peer != nil)\n obj = peer.new # <-- create a dummy instance of peer to check if method exists.\n if (!obj.respond_to?(params[\"field\"].to_a[0][0])) #<-- check the first key of hash only.\n res[:msg] = 'Error: Invalid field'\n else\n model = peer.update(params[:id], params[\"field\"])\n if (!model.errors.empty?)\n res = self.process_error(model.errors, res)\n else\n field = params[\"field\"].to_a\n res[:msg] = 'Updated field'\n res[:data][:field] = field[0][0]\n res[:data][:value] = field[0][1]\n res[:success] = true\n end\n end\n end\n end\n render :json => res, :layout => false\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update\n\t\t# Left empty intentionally.\n\tend", "def update\n respond_to do |format|\n if @filed.update(field_params)\n format.html { redirect_to @field, notice: 'Successfully updated.' }\n format.json { render :show, status: :ok, location: @field }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @field = Field.find(params[:id])\n\n respond_to do |format|\n if @field.update_attributes(params[:field])\n format.html { redirect_to([@kind, @field], :notice => t(:field_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_update_empty_string_with_form()\n # Parameters for the API call\n value = ''\n\n # Perform the API call through the SDK function\n result = @controller.update_string_with_form(value)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_update_valid\n #TODO: reenable this once we can figure out how to remove any_instance\n # Recipe.any_instance.stubs(:valid?).returns(true)\n put :update, :id => Factory.create(:recipe)\n assert_redirected_to recipe_url(assigns(:recipe))\n end", "def test_edited\n user = User.find(980190962);\n user.update({\"user_name\" => 'abasd',\"user_password\" => '456789', \"user_email\"=>'[email protected]'})\n if assert_not_nil('user_name', nil)\n arrert false\n elsif assert_not_nil('user_password', nil)\n assert false\n elsif assert_not_nil('user_email', nil)\n arrert false\n else\n assert true\n end\n end", "def test_update\n\n subsection_01_1_2 = subsections(:subsection_01_1_2)\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n subsect = Subsection.find(subsection_01_1_2.id)\n assert_equal(subsection_01_1_1.url, subsect.url)\n\n subsect.url = 'www.yahoo.com'\n post(:update, { :subsection => subsect.attributes }, cathy_admin_session)\n assert_equal('Subsection was successfully updated.', flash['notice'])\n assert_redirected_to(:controller => 'checklist',\n\t\t\t :action => 'edit',\n :id => subsection_01_1_1.checklist.id)\n\n end", "def test_update\n\n doc_one = document_types(:doc_one)\n document_type = DocumentType.find(doc_one.id)\n document_type.name = 'Test'\n\n get(:update, { :document_type => document_type.attributes }, cathy_admin_session)\n assert_equal('Update recorded', flash['notice'])\n assert_equal('Test', document_type.name)\n assert_redirected_to(:action => 'edit', :id => document_type.id)\n \n end", "def test_update\n put :update, :id => User.first.id,\n\t\t\t :user =>{:name => 'farid',:email => '[email protected]',:pasword => '12345', :address => 'semarang'}\n assert_not_nil assigns(:user)\n assert_equal assigns(:user).name, 'updated name' \n assert_response :redirect\n assert_equal flash[:notice] = 'User was succesful Update' \n end", "def update\n\t\tfalse\n\tend", "def test_update_string_with_form()\n # Parameters for the API call\n value = 'TestString'\n\n # Perform the API call through the SDK function\n result = @controller.update_string_with_form(value)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_update\n\n design_directory = DesignDirectory.find(design_directories(:hw_design_bos).id)\n design_directory.name = 'Yugo'\n\n get(:update,\n { :design_directory => design_directory.attributes }, \n cathy_admin_session)\n assert_equal('Design Directory was successfully updated.', flash['notice'])\n assert_redirected_to(:action => 'edit', :id => design_directory.id)\n \n design_directory.reload\n assert_equal('Yugo', design_directory.name)\n end", "def update_attribute\n end", "def update\n @field = FormulaField.find(params[:id])\n\n respond_to do |format|\n if can_edit?(@field) && @field.update_attributes(field_params)\n format.html { redirect_to @field.project, notice: 'Field was successfully updated.' }\n format.json { render json: {}, status: :ok }\n else\n @field.errors[:base] << ('Permission denied') unless can_edit?(@field)\n logger.error \"Errors: #{@field.errors.inspect}\"\n format.html { redirect_to FormulaField.find(params[:id]), alert: 'Field was not updated.' }\n format.json { render json: @field.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def field_update\n\n @artist = Artist.find_by_url_slug(params[:url_slug])\n\n authorize! :admin, @artist\n\n\n @artist.update_attribute('quick_start_popup_toggle',params[:field][:value])\n\n\n respond_to do |format|\n\n\n format.json {\n render :json => {\n :success => true}\n }\n\n end\n end", "def update_field(current_value, new_partial_value)\n # TODO: manage :other option\n new_partial_value\n end", "def update\n @field = Field.find(params[:id])\n\n respond_to do |format|\n if @field.update_attributes(field_params)\n format.html { redirect_to location_fields_location_path(session[:location_id]), notice: 'Field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @field.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 update\n respond_to do |format|\n if @tbl_form_field.update(tbl_form_field_params)\n format.html { redirect_to @tbl_form_field, notice: 'Tbl form field was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbl_form_field }\n else\n format.html { render :edit }\n format.json { render json: @tbl_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_edit_name_get\n name = names(:coprinus_comatus)\n params = { id: name.id.to_s }\n requires_login(:edit, params)\n assert_form_action(action: :update, id: name.id.to_s)\n assert_select(\"form #name_icn_id\", { count: 1 },\n \"Form is missing field for icn_id\")\n end", "def test_update_field\n local_file_name = 'GetField.docx'\n remote_file_name = 'TestUpdateField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/' + local_file_name), remote_data_folder + '/' + remote_file_name\n\n request_field = FieldUpdate.new({:FieldCode => '{ NUMPAGES }'})\n request = UpdateFieldRequest.new(name: remote_file_name, index: 0, field: request_field, node_path: 'sections/0/paragraphs/0', folder: remote_data_folder)\n\n result = @words_api.update_field(request)\n assert_equal false, result.nil?\n end", "def update\n respond_to do |format|\n if @field.update(form_field_params)\n format.html { redirect_to [@company, @form, @group, @field], notice: 'Form field was successfully updated.' }\n format.json { render :show, status: :ok, location: [@company, @form, @group, @field] }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def fbo_updated_form\n end", "def update\n #\n end", "def update!(**args)\n @is_valid = args[:is_valid] if args.key?(:is_valid)\n @value = args[:value] if args.key?(:value)\n end", "def test_field(field, value, error = false)\n field.set value\n field.trigger 'blur'\n\n no_php_js_errors\n\n if error\n @page.wait_for_error_message_count(1)\n should_have_form_errors(@page)\n should_have_error_text(field, error)\n else\n @page.wait_for_error_message_count(0)\n should_have_no_form_errors(@page)\n should_have_no_error_text(field)\n end\n end", "def test_update_valid\n ingredient = Factory.create(:ingredient)\n #TODO: reenable this once we can figure out how to remove any_instance\n # Ingredient.any_instance.stubs(:valid?).returns(true)\n put :update, :id => ingredient\n assert_redirected_to ingredient_url(assigns(:ingredient))\n end", "def update\n # Not generally used\n end", "def update\n # Not generally used\n end", "def update\n respond_to do |format|\n if @template_form_field.update(template_form_field_params)\n format.html { redirect_to @template_form_field, notice: 'Template form field was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_form_field }\n else\n format.html { render :edit }\n format.json { render json: @template_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @field.update(field_params)\n format.html { redirect_to [@magazine,@issue, @field], notice: 'Field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_field.update(user_field_params)\n format.html { redirect_to @user_field, notice: 'User field was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_field }\n else\n format.html { render :edit }\n format.json { render json: @user_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n end", "def update\n \n end", "def test_update\n\n platform = Platform.find(platforms(:flex).id)\n platform.name = 'Yugo'\n\n get(:update, { :platform => platform.attributes }, cathy_admin_session)\n assert_equal('Platform was successfully updated.', flash['notice'])\n assert_redirected_to(:action => 'edit', :id => platform.id)\n assert_equal('Yugo', platform.name)\n end", "def update\n\n\tend", "def update\n\n\tend", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def validate_update(comment)\n true\n end", "def update\n respond_to do |format|\n if @user_field.update(user_field_params)\n format.html { redirect_to @user_field, notice: \"User field was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_field }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_form_field_without_node_path\n remote_file_name = 'TestUpdateFormFieldWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => 'No name'})\n request = UpdateFormFieldRequest.new(name: remote_file_name, index: 0, form_field: request_form_field, folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n result = @words_api.update_form_field(request)\n assert_equal false, result.nil?\n end", "def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n\tend", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end" ]
[ "0.6913447", "0.67746073", "0.6734589", "0.65769064", "0.6576172", "0.6536535", "0.6474004", "0.6466598", "0.64606446", "0.64342064", "0.64210725", "0.6354972", "0.6327273", "0.6284299", "0.6267089", "0.626404", "0.62495244", "0.6247602", "0.6222578", "0.6215646", "0.6205688", "0.6204106", "0.6203923", "0.619338", "0.6192953", "0.61902624", "0.61898124", "0.61720103", "0.61675566", "0.61667854", "0.61603016", "0.61568856", "0.6153487", "0.61446095", "0.61445934", "0.6133955", "0.61258894", "0.61246115", "0.6117136", "0.6113425", "0.61052126", "0.60867435", "0.60867435", "0.6085622", "0.6080206", "0.60777664", "0.6061594", "0.6061594", "0.6040139", "0.60390383", "0.60390383", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60351926", "0.60345167", "0.60301954", "0.6020161", "0.60193545", "0.6016714", "0.6016714", "0.6016714", "0.6016714", "0.6016714", "0.6009186", "0.6009186", "0.6009186", "0.6009186", "0.6009186", "0.6009186", "0.6009186" ]
0.0
-1
Test for creating form field
def test_put_form_field filename = 'test_multi_pages.docx' remote_name = 'TestPutFormField.docx' dest_name = remote_test_out + remote_name body = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => '123', :TextInputFormat => 'UPPERCASE'}) st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, "r").read @storage_api.put_create st_request request = PutFormFieldRequest.new remote_name, body, remote_test_folder + test_folder, :dest_file_name => dest_name, :node_path => 'sections/0/paragraphs/0' result = @words_api.put_form_field request assert_equal 200, result.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @form_field = FormField.new(form_field_params)\n\n respond_to do |format|\n if @form_field.save\n format.html { redirect_to @form_field, notice: 'Form field was successfully created.' }\n format.json { render :show, status: :created, location: @form_field }\n else\n format.html { render :new }\n format.json { render json: @form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_field(field, value, error = false)\n field.set value\n field.trigger 'blur'\n\n no_php_js_errors\n\n if error\n @page.wait_for_error_message_count(1)\n should_have_form_errors(@page)\n should_have_error_text(field, error)\n else\n @page.wait_for_error_message_count(0)\n should_have_no_form_errors(@page)\n should_have_no_error_text(field)\n end\n end", "def test_insert_form_field_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => '123', :TextInputFormat => 'UPPERCASE'})\n request = InsertFormFieldOnlineRequest.new(document: request_document, form_field: request_form_field, node_path: 'sections/0/paragraphs/0')\n\n result = @words_api.insert_form_field_online(request)\n assert_equal false, result.nil?\n end", "def test_create_failure\n post :new, :appellation => { :name => \"\",\n :apptype_id => 1 }\n assert_response :success #success of HTTP, not success of create process\n assert_template \"new\"\n #test display of error messages\n assert_tag \"div\", :attributes => { :id => \"errorExplanation\",\n :class => \"errorExplanation\"}\n #test that each form field has at least one error diplayed\n assert_tag \"li\", :content => /Name/\n \n #test to see that the input fields are being wrapped with the correct div\n error_div = { :tag => \"div\", :attributes => { :class => \"fieldWithErrors\"}}\n \n assert_tag \"input\",\n :attributes => { :name => \"appellation[name]\",\n :value => \"\"},\n :parent => error_div\n end", "def test_insert_form_field\n remote_file_name = 'TestInsertFormField.docx'\n\n upload_file File.join(local_test_folder, 'Common/test_multi_pages.docx'), remote_data_folder + '/' + remote_file_name\n\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => '123', :TextInputFormat => 'UPPERCASE'})\n request = InsertFormFieldRequest.new(name: remote_file_name, form_field: request_form_field, node_path: 'sections/0/paragraphs/0', folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n result = @words_api.insert_form_field(request)\n assert_equal false, result.nil?\n end", "def test_create_failure\n post :new, :grape => { :name => \"\", }\n assert_response :success #success of HTTP, not success of registration process\n assert_template \"new\"\n #test display of error messages\n assert_tag \"div\", :attributes => { :id => \"errorExplanation\",\n :class => \"errorExplanation\"}\n #test that each form field has at least one error diplayed\n assert_tag \"li\", :content => /Name/\n \n #test to see that the input fields are being wrapped with the correct div\n error_div = { :tag => \"div\", :attributes => { :class => \"fieldWithErrors\"}}\n \n assert_tag \"input\",\n :attributes => { :name => \"grape[name]\",\n :value => \"\"},\n :parent => error_div\n end", "def create\n @field = Field.new(params[:field])\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to @field, notice: 'Field was successfully created.' }\n format.json { render json: @field, status: :created, location: @field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @field = Field.new(field_params)\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to @field, notice: 'Field was successfully created.' }\n format.json { render json: @field, status: :created, location: @field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template_form_field = TemplateFormField.new(template_form_field_params)\n\n respond_to do |format|\n if @template_form_field.save\n format.html { redirect_to @template_form_field, notice: 'Template form field was successfully created.' }\n format.json { render :show, status: :created, location: @template_form_field }\n else\n format.html { render :new }\n format.json { render json: @template_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_field = UserField.new(user_field_params)\n\n respond_to do |format|\n if @user_field.save\n format.html { redirect_to @user_field, notice: 'User field was successfully created.' }\n format.json { render :show, status: :created, location: @user_field }\n else\n format.html { render :new }\n format.json { render json: @user_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_allow_dynamic_form_fields()\n # Parameters for the API call\n name = 'farhan'\n\n # dictionary for optional form parameters\n optional_form_parameters = {}\n optional_form_parameters['field'] = 'QA'\n\n # Perform the API call through the SDK function\n result = @controller.allow_dynamic_form_fields(name, _field_parameters: optional_form_parameters)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_text_field\n _erbout = ''\n \n uni_form_for(:user, @user) do |f|\n f.fieldset do\n _erbout.concat f.text_field(:first_name)\n end\n end\n \n expected = <<-html\n <form action=\"http://www.example.com\" method=\"post\" class=\"uniForm\">\n <fieldset class=\"blockLabels\">\n <div class=\"ctrlHolder\">\n <label for=\"user_first_name\">First name</label>\n <input name=\"user[first_name]\" size=\"30\" type=\"text\" class=\"textInput\" id=\"user_first_name\" value=\"Marcus\"/>\n </div>\n </fieldset>\n </form>\n html\n \n assert_dom_equal expected, _erbout\n end", "def text_field?(field_name); end", "def test_get_form_field\n filename = 'FormFilled.docx'\n remote_name = 'TestGetFormField.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFormFieldRequest.new remote_name, index, remote_test_folder + test_folder, :node_path => 'sections/0'\n result = @words_api.get_form_field request\n assert_equal 200, result.code\n end", "def html_for_non_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'text' \n name = create_form[#{field}]\n placeholder = 'Type in the #{field}'\n value = '#{object.send(field)}'>\n </input>\n </p>\"\n end", "def test_post_form_field\n filename = 'FormFilled.docx'\n remote_name = 'TestPostFormField.docx'\n dest_name = remote_test_out + remote_name\n index = 0\n body = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true,\n :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => ''})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = PostFormFieldRequest.new remote_name, body, index, remote_test_folder + test_folder, :dest_file_name => dest_name, :node_path => 'sections/0'\n result = @words_api.post_form_field request\n assert_equal 200, result.code\n end", "def create_webform(title, fields, browser = @browser)\n browser.navigate.to($config['sut_url'] + create_webform_url)\n Log.logger.debug(\"Entering new webform title '#{title}'\")\n fields.each{|fieldname|\n self.add_webform_component(fieldname)\n }\n self.add_webform_title(title)\n message = self.save_webform(browser)\n return message\n end", "def CreateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @user_field = UserField.new(user_field_params)\n\n respond_to do |format|\n if @user_field.save\n format.html { redirect_to @user_field, notice: \"User field was successfully created.\" }\n format.json { render :show, status: :created, location: @user_field }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n as = field_params[:as]\n @field =\n if as =~ /pair/\n CustomFieldPair.create_pair(params).first\n elsif as.present?\n klass = Field.lookup_class(as).classify.constantize\n klass.create(field_params)\n else\n Field.new(field_params).tap(&:valid?)\n end\n\n respond_with(@field)\n end", "def create\n @question_field = QuestionField.new(params[:question_field])\n\n respond_to do |format|\n if @question_field.save\n format.html { redirect_to @question_field, notice: 'Question field was successfully created.' }\n format.json { render json: @question_field, status: :created, location: @question_field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tbl_form_field = TblFormField.new(tbl_form_field_params)\n\n respond_to do |format|\n if @tbl_form_field.save\n format.html { redirect_to @tbl_form_field, notice: 'Tbl form field was successfully created.' }\n format.json { render :show, status: :created, location: @tbl_form_field }\n else\n format.html { render :new }\n format.json { render json: @tbl_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def configure_field\n end", "def create_person_field(**args)\n params = parameters(args) do\n required_params :name, :field_type\n optional_params :name, :field_type, :options\n end\n request(:post, 'personFields', params)\n end", "def new\n @field = Field.new\n respond_with(@field)\n end", "def valid_attributes\n FactoryBot.attributes_for(:create_type)\n end", "def test_new\n login\n get(:new)\n\n assert_response(:success)\n assert_head_title(:create_glossary_term_title.l)\n\n ESSENTIAL_ATTRIBUTES.each do |attr|\n assert_select(\"form [name='glossary_term[#{attr}]']\", { count: 1 },\n \"Form should have one field for #{attr}\")\n end\n assert_select(\"input#upload_image\", { count: 1 },\n \"Form should include upload image field\")\n end", "def setup_form\n build_form\n super\n end", "def test_create_valid\n post :create, :recipe => Factory.attributes_for(:recipe)\n assert_not_nil assigns(:recipe).id\n end", "def create\n @custom_field = CustomField.new(custom_field_params)\n\n respond_to do |format|\n if @custom_field.save\n format.html { redirect_to @custom_field, notice: 'Custom field was successfully created.' }\n format.json { render :show, status: :created, location: @custom_field }\n else\n format.html { render :new }\n format.json { render json: @custom_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @field = Field.create(params[:field])\n respond_with :admin, @field\n end", "def add_field(name, value, type, required, validation, label_text, options = nil, size = nil )\n f = active_form\n f << { :name => name, :value => value, :type => type, :required => required, :validation => validation, :label_text => label_text, :options => options, :size => size }\n return f\n end", "def create\n @custom_field = CustomField.new(params[:custom_field])\n authorize! :create, @custom_field\n \n respond_to do |format|\n if @custom_field.save\n format.html { redirect_to(@custom_field, :notice => 'Custom field was successfully created.') }\n format.xml { render :xml => @custom_field, :status => :created, :location => @custom_field }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @custom_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def fill_form\n fill_in i18n_field('name'), with: Faker::Team.name\n fill_in i18n_field('description'), with: Faker::Lorem.paragraph\n end", "def form_setup\n\tend", "def verify_component_before_saving(fieldname)\n if(fieldname == \"Formatted content\")\n @browser.find_elements(:xpath => \"//strong[contains(text(), 'New HTML Markup')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n elsif(fieldname == \"Page break\" || fieldname == \"Hidden field\")\n @browser.find_elements(:xpath => \"//div[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n elsif(fieldname == \"Fieldset\")\n @browser.find_elements(:xpath => \"//span[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n else\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n end\n end", "def assert_input_field(name, value, field_type, size, maxlength, options = {})\n attributes = { :name => name,\n :type => field_type,\n :size => size,\n :maxlength => maxlength }\n # Surprisingly, attributes[:value] == nil is different from attributes\n # not having a :value key at all.\n attributes[:value] = value unless value.nil?\n tag = { :tag => \"input\", :attributes => attributes }\n # Merge tag hash with options, especially to handle :parent => error_div\n # option in error tests.\n tag.merge!(options)\n assert_tag tag\nend", "def verify_field_properties_settings(new_fieldname, fieldname_display, def_value, desc_text)\n fieldname_labels = @browser.find_elements(:xpath => \"//label[contains(text(), '#{new_fieldname}')]\")\n if fieldname_display.downcase.include? \"hidden\"\n fieldname_labels.should be_empty\n else\n fieldname_labels.should have_at_least(1).items\n end\n @browser.find_elements(:xpath => \"//input[@value='#{def_value}']\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//div[text()='#{desc_text}']\").should have_at_least(1).items\n end", "def create\n @field = @group.fields.build(field_params)\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to [@company, @form, @group, @field], notice: 'Form field was successfully created.' }\n format.json { render :show, status: :created, location: [@company, @form, @group, @field] }\n else\n format.html { render :new }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def createit(xclass,params,field)\n cloned = xclass.new(params)\n cloned.instance_eval do\n @errors = nil\n end\n cloned.member_id = nil\n assert(cloned.valid?, \"Creatit not valid at start\")\n cloned.send(\"#{field}=\", 9995)\n cloned.member_id = nil\n assert(!cloned.valid?, \"Createit not valid when nil\") \n end", "def should_be_required(options)\n @new_post.class.should_receive(:reflect_on_validations_for).with(:body).and_return([\n mock('MacroReflection', :macro => :validates_presence_of, :name => :body, :options => options[:options])\n ])\n \n semantic_form_for(@new_post) do |builder|\n concat(builder.input(:body))\n end\n \n if options[:required]\n output_buffer.should_not have_tag('form li.optional')\n output_buffer.should have_tag('form li.required')\n else\n output_buffer.should have_tag('form li.optional')\n output_buffer.should_not have_tag('form li.required')\n end\n end", "def create\n @screen_self = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n @save_as_new_copy = params[:save_as_new_copy]\n\n @field = params['field']['type'].constantize.new(params[:field])\n @field.display_seq = @field.screen.fields.count + 1\n\n @field.save\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @field }\n end\n end", "def create\n @company_dei_field = CompanyDeiField.new(company_dei_field_params)\n\n respond_to do |format|\n if @company_dei_field.save\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully created.\" }\n format.json { render :show, status: :created, location: @company_dei_field }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(field, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:field] = field\n\n response = @client.post \"/api/topics/#{@topic_id}/fields\", body, options\n\n return response\n end", "def create\n @company_field = CompanyField.new(company_field_params)\n\n respond_to do |format|\n if @company_field.save\n format.html { redirect_to @company_field, notice: 'Company field was successfully created.' }\n format.json { render :show, status: :created, location: @company_field }\n else\n format.html { render :new }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_field(field)\n\t\tend", "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 test_get_form_field\n remote_file_name = 'TestGetFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_form_field(request)\n assert_equal false, result.nil?\n end", "def assert_valid_create_page(model, **opt)\n assert_valid_action_page(model, :new, **opt)\n end", "def should_see_new_song_fields\n expect(page).to have_field(\"artist\")\n expect(page).to have_field(\"title\")\n expect(page).to have_selector(\"#add_song_button\")\n end", "def create\n @field = Field.new(field_params)\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to [@magazine,@issue, @field], notice: 'Field was successfully created.' }\n format.json { render action: 'show', status: :created, location: @field }\n else\n format.html { render action: 'new' }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_deal_field(**args)\n params = parameters(args) do\n required_params :name, :field_type\n optional_params :name, :field_type, :options\n end\n request(:post, 'dealFields', params)\n end", "def test_insert_form_field_without_node_path\n remote_file_name = 'TestInsertFormFieldWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, 'Common/test_multi_pages.docx'), remote_data_folder + '/' + remote_file_name\n\n request_form_field = FormFieldTextInput.new({:Name => 'FullName', :Enabled => true, :CalculateOnExit => true, :StatusText => '', :TextInputType => 'Regular', :TextInputDefault => '123', :TextInputFormat => 'UPPERCASE'})\n request = InsertFormFieldRequest.new(name: remote_file_name, form_field: request_form_field, folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n result = @words_api.insert_form_field(request)\n assert_equal false, result.nil?\n end", "def build_field(value, index)\n options = build_field_options(value, index)\n cp_service = AuthorityService::CurrentPersonService.new\n options[:value] = cp_service.find_value_string(value)\n if options.delete(:type) == 'textarea'.freeze\n @builder.text_area(attribute_name, options)\n else\n @builder.text_field(attribute_name, options)\n end\n end", "def new\n @custom_field = CustomField.new\n authorize! :create, @custom_field\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @custom_field }\n end\n end", "def create\n @dynabute_field = Dynabute::Field.new(dynabute_params)\n\n respond_to do |format|\n if @dynabute_field.save\n format.html { redirect_to dynabute_fields_path(@dynabute_field.target_model), notice: 'Dynabute was successfully created.' }\n format.json { render :show, status: :created, location: @dynabute_field}\n else\n format.html { render :new }\n format.json { render json: @dynabute_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def configure_field\n end", "def text_field; end", "def test_should_get_new\n get :new\n assert_response :success\n assert_template \"new\"\n assert_select \"h1\", \"New post\"\n assert_select \"form\" do\n assert_select(\"input[type=text][id=post_title]\")\n assert_select(\"textarea[id=post_body]\")\n assert_select(\"input[type=checkbox][id=post_published]\")\n assert_select(\"input[type=submit][id=post_submit][value=Create]\")\n end\n end", "def test_should_require_telephone\n intitution = create(:telephone => nil)\n assert intitution.errors.invalid?(:telephone), \":telephone should be required\"\n assert_invalid intitution, \"intitution shouldn't be created\"\n end", "def test_new\n login(\"rolf\")\n get(:new)\n assert_select(\n \"form[action='#{herbaria_path}'][method='post']\", { count: 1 },\n \"'new' action should render a form that posts to #{herbaria_path}\"\n )\n end", "def set_form_field\n @form_field = FormField.find(params[:id])\n end", "def test_mandatory_field(field, fieldname)\n if field.nil?\n show_usage\n ui.fatal(\"You must specify a #{fieldname}\")\n exit 1\n end\n end", "def test_field_named_field\n ActiveRecord::Base.connection.create_table :testings do |t|\n t.string :field\n end\n assert_nothing_raised do\n Testings.new.attributes\n end\n ensure\n ActiveRecord::Base.connection.drop_table :testings rescue nil\n ActiveRecord::Base.clear_cache!\n end", "def test_get_form_fields\n filename = 'FormFilled.docx'\n remote_name = 'TestGetFormFields.docx'\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFormFieldsRequest.new remote_name, remote_test_folder + test_folder, :node_path => 'sections/0'\n result = @words_api.get_form_fields request\n assert_equal 200, result.code\n end", "def verify_field_required(new_fieldname, should_be_required = true)\n Log.logger.info(\"Checking if #{new_fieldname} has a required box that says: #{should_be_required}\")\n on_page_required = @browser.find_elements(:xpath => \"//label[contains(text(), '#{new_fieldname}')]/span[text()='*']\").size > 0\n on_page_required.should == should_be_required #, \"Should #{new_fieldname} be required: #{should_be_required}. What we got: #{on_page_required}.\")\n end", "def create\n @fieldtype = Fieldtype.new(params[:fieldtype])\n\n respond_to do |format|\n if @fieldtype.save\n format.html { redirect_to @fieldtype, notice: 'Fieldtype was successfully created.' }\n format.json { render json: @fieldtype, status: :created, location: @fieldtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fieldtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_user_create_view\n get :new\n assert_response :success\n \n assert_select \"html:root\", :count => 1 do\n assert_select \"head\", :count => 1 do\n assert_select \"title\", :text => /Create account/, :count => 1\n end\n assert_select \"body\", :count => 1 do\n assert_select \"div#content\", :count => 1 do\n assert_select \"form[action='/user/save'][method=post]\", :count => 1 do\n assert_select \"input[id=user_email]\", :count => 1\n assert_select \"input[id=user_email_confirmation]\", :count => 1\n assert_select \"input[id=user_display_name]\", :count => 1\n assert_select \"input[id=user_pass_crypt][type=password]\", :count => 1\n assert_select \"input[id=user_pass_crypt_confirmation][type=password]\", :count => 1\n assert_select \"input[type=submit][value=Signup]\", :count => 1\n end\n end\n end\n end\n end", "def configure_form(var_oid, use_format, form_field_name, form_field_oid, form_field_label)\n wait_for_add_new\n add_new.click\n wait_for_variable_oid\n variable_oid.set var_oid\n format.set use_format\n field_name.set form_field_name\n field_oid.set form_field_oid\n label.set form_field_label\n save_form.first.click\n end", "def create\n @application_form_field = ApplicationFormField.new(params[:application_form_field])\n\n respond_to do |format|\n if @application_form_field.save\n format.html { redirect_to @application_form_field, notice: 'Application form field was successfully created.' }\n format.json { render json: @application_form_field, status: :created, location: @application_form_field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @extra_field = ExtraField.new(extra_field_params)\n\n respond_to do |format|\n if @extra_field.save\n format.html { redirect_to @extra_field, notice: 'Extra field was successfully created.' }\n format.json { render :show, status: :created, location: @extra_field }\n else\n format.html { render :new }\n format.json { render json: @extra_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def form_data?; end", "def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend", "def create\n @api_v1_select_field = Api::V1::SelectField.new(api_v1_select_field_params)\n\n respond_to do |format|\n if @api_v1_select_field.save\n format.html { redirect_to @api_v1_select_field, notice: 'Select field was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_select_field }\n else\n format.html { render :new }\n format.json { render json: @api_v1_select_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def form; end", "def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submit\"\n submit modelname, fieldname\n end\n end", "def create\n @api_v1_text_field = Api::V1::TextField.new(api_v1_text_field_params)\n\n respond_to do |format|\n if @api_v1_text_field.save\n format.html { redirect_to @api_v1_text_field, notice: 'Text field was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_text_field }\n else\n format.html { render :new }\n format.json { render json: @api_v1_text_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_password_field()\n\t\t# unit_test_no_generate: new_password_field, input.className(create_ats_regex_string(\"ats-newpwdfield\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(create_ats_regex_string(\"ats-newpwdfield\")), __method__)\n\tend", "def add_text_field(form, model, field, not_null=check_null?(model, field))\n html = <<-HTML\n <div class=\"form-group\">\n #{form.label field, class: 'col-sm-3 control-label no-padding-right'}\n <div class=\"col-sm-9\">\n #{form.text_field field, class: 'form-control'}\n #{not_null_field if not_null}\n </div>\n </div>\n HTML\n html.html_safe\n end", "def create\n errors = []\n begin\n @dynamo_model = Kernel.const_get(params[:model_name])\n model = @dynamo_model.add_dynamo_field( params[:field_name], params[:field_type] )\n errors << model.errors.full_messages() unless model.errors.blank?\n rescue Exception => e\n errors << e \n end\n \n flash[:error]=errors.collect{|err_msg| \"<li>\" << err_msg << \"</li>\"}.to_s unless errors.empty?\n respond_to do |format|\n format.html { render :html=>@dynamo_model, :controller => \"admin/fields\", :action=>\"edit\"}\n end\n \n end", "def process_field(builder, field)\n builder.send(field.field_type.to_sym,\n field.field_name.to_sym,\n\n # Homespree Project Type Optional params\n {\n label: field.label,\n data: field.field_data,\n default: field.default,\n required: field.required,\n position: field.position,\n size: field.size,\n toggleable: field.toggleable\n }\n )\n end", "def assert_text_field(model, *attributes)\n attributes.each do |attribute|\n assert_select \"input[type=text][name=?]\",\n \"#{model.to_s}[#{attribute.to_s}]\"\n end\n end", "def assert_text_field(*args)\n options = args.extract_options!\n assert_select \"input[type=text][name=?]\", extract_name(args)\n end", "def validate_fields\n expect(@browser.textfield(:id => 'lbl_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_3').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_ttl_val').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_6').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_ttl_val').present?).to eq(true)\n end", "def create\n @valuefield = Valuefield.new(params[:valuefield])\n @valuefield.property = Property.find(Integer(params[:property_id]))\n @valuefield.path = params[:path]\n\n respond_to do |format|\n if @valuefield.save\n format.html { redirect_to @valuefield, notice: 'Valuefield was successfully created.' }\n format.json { render json: @valuefield, status: :created, location: @valuefield }\n else\n format.html { render action: \"new\" }\n format.json { render json: @valuefield.errors, status: :unprocessable_entity }\n end\n end\n end", "def method_missing(method_name, *args)\n field = args.first\n \n define_method(\"#{field}_form_field\") do |form, object|\n if form.respond_to? method_name\n form.send(method_name, *args)\n else\n raise NoMethodError, \"this form builder doesn't respond to #{method_name}\" \n end \n end\n end", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def create\n @tbl_form_field_helper = TblFormFieldHelper.new(tbl_form_field_helper_params)\n\n respond_to do |format|\n if @tbl_form_field_helper.save\n format.html { redirect_to @tbl_form_field_helper, notice: 'Tbl form field helper was successfully created.' }\n format.json { render :show, status: :created, location: @tbl_form_field_helper }\n else\n format.html { render :new }\n format.json { render json: @tbl_form_field_helper.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate_create_params!(params); end", "def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end", "def create_checkbox_field(form, value, name, label, field_id, validation: nil, readonly: false)\n render partial: 'dynamic_form/fields/checkbox_field',\n locals: {\n f: form,\n field_value: value,\n field_name: name,\n field_label: label,\n field_id:,\n readonly:,\n validation:\n }\n end", "def create\n @field = Field.new(params[:field])\n @field.kind = @kind\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to([@kind, @field], :notice => t(:field_created)) }\n format.xml { render :xml => @field, :status => :created, :location => @field }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_good\n first_name = params[:first_name]\n set_name(first_name)\n end", "def create\n @equipment_field = EquipmentField.new(equipment_field_params)\n\n respond_to do |format|\n if @equipment_field.save\n format.html { redirect_to @equipment_field, notice: 'Equipment field was successfully created.' }\n format.json { render :show, status: :created, location: @equipment_field }\n else\n format.html { render :new }\n format.json { render json: @equipment_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def expect_have_field_text(rendered_or_page, field_name, field_id, value, disabled, visible, pre_selector = '')\n expect(rendered_or_page).to have_field(field_name, disabled: disabled, count: 1, id: field_id, visible: visible)\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=text][id=#{field_id}][value='#{value}']\") if visible\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=text][id=#{field_id}]\") unless visible\n end", "def test_valid\n italian = RecipeType.new\n\n assert_equal(false, italian.valid?)\n\n italian.name = \"\"\n assert_equal(false, italian.valid?)\n\n italian.name = \"Italian\"\n assert_equal(true, italian.valid?)\n end", "def create\n @message_field = MessageField.new(params[:message_field])\n\n respond_to do |format|\n if @message_field.save\n format.html { redirect_to @message_field, notice: 'Message field was successfully created.' }\n format.json { render json: @message_field, status: :created, location: @message_field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def fill_autocomplete_select_or_create_entity(field, options = {})\n value = options[:with]\n\n fill_autocomplete(field, options) do\n found_value = nil\n all(\"ul.ui-autocomplete li.ui-menu-item\", visible: true).each do |li|\n if li.text == value || li.text == value + \" (unreviewed)\"\n found_value = li.text\n end\n end\n if found_value.present?\n value_escaped = found_value.gsub(\"'\", \"\\\\\\\\'\")\n selector = %Q{ul.ui-autocomplete:visible li.ui-menu-item:contains(\"#{value_escaped}\")}\n else\n # select the 1st option, which should pop up the modal to create an entity\n selector = %Q{ul.ui-autocomplete:visible li.ui-menu-item:eq(0)}\n end\n page.execute_script %Q{ $('#{selector}').click() }\n\n if !found_value.present?\n expect(find(\".modal-title\", visible: true).text.include?(\"Create\")).to be_truthy\n click_button('Create')\n sleep(0.75)\n # this next line should be used instead of a sleep, but doesn't work for some reason\n # expect(page).to have_no_selector(\".modal-title\", visible: true)\n end\n end\n #page.save_screenshot(\"screenshot_#{field}.png\")\n end", "def set_template_form_field\n @template_form_field = TemplateFormField.find(params[:id])\n end", "def new\n @field = Field.new\n respond_with :admin, @field\n end" ]
[ "0.65837556", "0.646171", "0.6320718", "0.6319424", "0.6302154", "0.6299457", "0.6296442", "0.6265436", "0.62363726", "0.6210737", "0.6208984", "0.61927074", "0.61748654", "0.6173392", "0.6171729", "0.6170146", "0.61695623", "0.6159038", "0.61277664", "0.6087086", "0.6069969", "0.6065976", "0.60475755", "0.6036916", "0.6032883", "0.60115564", "0.60006416", "0.5985091", "0.59842455", "0.59754074", "0.5971336", "0.5951023", "0.5947429", "0.59307086", "0.59277004", "0.5921359", "0.59111255", "0.5905105", "0.5900277", "0.5882287", "0.5877653", "0.5876906", "0.5875235", "0.58669674", "0.5865455", "0.5861457", "0.5816261", "0.5814478", "0.5808913", "0.58050793", "0.58044195", "0.5799323", "0.57804215", "0.57752204", "0.57717913", "0.5760622", "0.5758202", "0.575589", "0.57555926", "0.5748006", "0.57415354", "0.5738094", "0.5721612", "0.57197046", "0.5713825", "0.5703575", "0.56948334", "0.569138", "0.56792396", "0.5677538", "0.56761754", "0.566387", "0.56559366", "0.56473196", "0.5645445", "0.5642484", "0.5639136", "0.56390464", "0.5635927", "0.5620329", "0.5618417", "0.561379", "0.5610193", "0.5608588", "0.560621", "0.5592881", "0.55890197", "0.55878747", "0.55867136", "0.5581132", "0.5581114", "0.5577333", "0.5574574", "0.5571529", "0.5570143", "0.55623263", "0.55559427", "0.55435115", "0.55402714", "0.55330116" ]
0.61010027
19
Test for removing form field
def test_delete_form_field filename = 'FormFilled.docx' remote_name = 'TestDeleteFormField.docx' index = 0 st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, "r").read @storage_api.put_create st_request request = DeleteFormFieldRequest.new remote_name, index, remote_test_folder + test_folder, :node_path => 'sections/0' result = @words_api.delete_form_field request assert_equal 200, result.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_field(key)\n @pdf_form.removeField(key.to_s)\n end", "def delete_field!(field_name); end", "def single_item_action_remove_form_fields(form, document)\n single_item_action_form_fields(form, document, 'remove')\n end", "def clear_field(field_name)\n\t\tend", "def link_to_remove_field(name, f)\n f.hidden_field(:_destroy) + link_to_function( name, \"remove_field(this)\" )\n end", "def remove_field_handler(name); end", "def check_remove(field_name)\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(field_name)}/).checkbox.set\n end", "def link_to_remove_fields(name, f)\n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\")\n end", "def remove_flexi_field(name)\n flexi_fields.reject!{|f| f.name == name }\n end", "def link_to_remove_fields(name, f)\n f.hidden_field(:_destroy) + \"&nbsp;\".html_safe + ui_link_to_function('delete',name,\"remove_fields(this)\")\n end", "def link_to_remove_fields(name, f)\n f.hidden_field(:_destroy) + \"&nbsp;\".html_safe + ui_link_to_function('delete',name,\"remove_fields(this)\")\n end", "def link_to_remove_fields(name, f, div)\n f.hidden_field(:_delete) + link_to_function(name, \"remove_fields(this,'#{div}')\")\n end", "def remove_custom_field(key)\n self.contact_fields.delete(key)\n end", "def remove\n frm.button(:value=>\"Remove\").click\n end", "def remove_option(form_field_option)\n form_field_option.mark_for_destruction\n end", "def link_to_remove_fields(name, f) \n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\") \n end", "def remove(event)\n @remove.each do |field|\n event.remove(field)\n end\n end", "def remove(field)\n self.delete(field)\n @options.delete(field)\n end", "def delete_field(var_name)\n @fields.delete(var_name)\n end", "def link_to_remove_fields(name, f)\n\t\tf.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\", :class => \"btn\")\n\tend", "def link_to_remove_fields(name, f, options = {})\n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\", options)\n end", "def remove_link f\n icon = image_tag 'subtract.gif', :class => 'icon'\n if f.object.new_record?\n link_to_function(icon, \"$(this).up('.#{f.object.class.name.underscore}').remove()\", :title => \"Remove\")\n else\n f.hidden_field(:_delete) + link_to_function(icon, \"$(this).up('.#{f.object.class.name.underscore}').hide(); $(this).previous().value = '1'\", :title => \"Remove\")\n end\n end", "def link_to_remove_fields(name, field)\n field.hidden_field(:_destroy) +\n link_to(name, '#', class: 'btn btn-danger link_to_remove_fields')\n end", "def remove plataform\n end", "def delete_webform_component(fieldname)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Deleting webform component named '#{fieldname}'\")\n wait.until { @browser.find_element(:xpath => @webformmgr.fieldset_label(fieldname)) }.click\n wait.until { @browser.find_element(:xpath => @webformmgr.fieldset_label(fieldname)) }.click\n wait.until { @browser.find_element(:xpath => @webformmgr.active_delete_link) }.click\n wait.until { @browser.find_elements(:xpath => @webformmgr.active_delete_link).empty? }\n Log.logger.debug(\"Deleted webform component named '#{fieldname}'\")\n end", "def delete_field(field_name)\n if field_name.kind_of? Numeric then\n index = field_name\n field = @fields.at(index)\n @elements[field.name.to_s] = nil\n @fields.delete_at(index)\n else\n field = @element_map[field_name.to_s]\n @fields.delete(field_name.to_s)\n @elements.delete(field)\n end\n @element_map.delete(field.name.to_s)\n end", "def test_delete_form_field_without_node_path\n remote_file_name = 'TestDeleteFormFieldWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFormFieldRequest.new(name: remote_file_name, index: 0, folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n @words_api.delete_form_field(request)\n end", "def remove_field(field_name,commit=true)\n update_solr(field_name,'remove',nil,commit)\n execute_callbacks(field_name,nil)\n end", "def destroy_record_field(attr, options = {})\n @inside_destroy_record_field = true\n output_html = @template.content_tag :span, class: 'destroy' do\n label attr, class: 'middle' do\n check_box(attr, options) + destroy_icon_tag + ' Remove'\n end\n end\n @inside_destroy_record_field = false\n\n output_html\n end", "def test_delete_form_field\n remote_file_name = 'TestDeleteFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFormFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0', folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n @words_api.delete_form_field(request)\n end", "def clear_fields\n\t\tend", "def delete_form handle_form_text\n click_to_handle_form handle_form_text\n delete_form_click\n end", "def remove_dynamo_field(field_name)\n field_name = field_name.to_s\n logger.debug \"Dynamo: remove_dynamo field Name: #{field_name}\"\n # NOTE: Delete doesn't fire callbacks like before_destroy, after_destroy, but its faster.\n logger.warn \"Attempted to delete non-existing field: #{self.to_s}:#{field_name}\" if DynamoField.delete_all(:field_name=>field_name) == 0\n end", "def destroy\n @extra_field.destroy\n respond_to do |format|\n format.html { redirect_to extra_fields_url, notice: 'Extra field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def immediate_remove(field_name,params={})\n ignore_editstore=params[:ignore_editstore] || false\n update_solr(field_name,'remove',nil)\n send_delete_to_editstore(field_name) if (self.class.use_editstore && !ignore_editstore)\n self[field_name]=nil\n end", "def destroy\n @form_field.destroy\n respond_to do |format|\n format.html { redirect_to form_fields_url, notice: 'Form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_form_field(request)\n data, _status_code, _headers = delete_form_field_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def destroy\n Kernel.const_get(params[:model_name]).remove_dynamo_field(params[:field_name])\n redirect_to :controller => \"admin/fields\", :action => \"edit\", :model_name=>params[:model_name]\n end", "def remove_team_link(form_builder)\n if form_builder.object.new_record?\n # If the team is a new record, we can just remove the div from the dom\n link_to_function(\"Remove\", \"$(this).closest('.team').remove(); check_for_code_requirement(); update_fee()\");\n else\n # However if it's a \"real\" record it has to be deleted from the database,\n # for this reason the new fields_for, accept_nested_attributes helpers give us _delete,\n # a virtual attribute that tells rails to delete the child record.\n form_builder.hidden_field(:_destroy) +\n link_to_function(\"Remove\", \"$(this).closest('.team').hide(); $(this).prev().val('1'); update_fee()\")\n end\n end", "def delete()\n\n client.delete(\"/custom_fields/#{gid}\") && true\n end", "def clean_up\n @minefield = nil\n end", "def delete field\n\t\tbegin\n\t\t\tticket = read ['id'], field\n\t\t\tif ticket.count > 0\n\t\t\t\[email protected] \"DELETE FROM #{@table} WHERE #{field[0]}='#{field[1]}'\"\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\trescue Mysql::Error => e\n\t\t\tputs \"Error: #{e.error}\"\n\t\t\tnil\n\t\tend\n\tend", "def remove(value)\n #YOUR WORK HERE\n end", "def removable?\n object.respond_to?(:\"remove_#{attribute_name}=\")\n end", "def hidden_field?(field_name); end", "def destroy\n set_field\n if @field.destroy\n render :json => {}\n else\n render :json => @subject.errors, status: :unprocessable_entity\n end\n end", "def delete_field(id)\n delete(\"fields/#{id}\")\n end", "def destroy\n @custom_field = CustomField.find(params[:id])\n authorize! :update, @custom_field\n \n\t@custom_field.destroy\n respond_to do |format|\n format.html { redirect_to(custom_fields_url) }\n\tend\n end", "def remove_user_with_custom_field()\r\n remove_user_without_custom_field\r\n GroupsUserIndexed.find_by_group_id_and_user_id(@group.id, params[:user_id]).try!(&:destroy)\r\n end", "def destroy\n @field.destroy\n respond_to do |format|\n format.html { redirect_to company_form_group_fields_url(@company, @form, @group), notice: 'Form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end", "def remove_cq_question_link(form_builder)\n \n if form_builder.object.new_record?\n # If the task is a new record, we can just remove the div from the dom\n link_to_function(\"Usuń pytanie\", \"disableCQValidation(this);(this).up('.question').remove();\"\t\t\t \t\n \t);\n else\n # However if it's a \"real\" record it has to be deleted from the database,\n # for this reason the new fields_for, accept_nested_attributes helpers give us _delete,\n # a virtual attribute that tells rails to delete the child record.\n form_builder.hidden_field(:_delete) +\n link_to_function(\"Usuń pytanie\", \"$(this).up('.question').hide(); $(this).previous().value = '1';\")\n end\n end", "def delete_event_field(project_id, display_id, options = {})\n boolean_from_resposne :delete, \"project/#{project_id}/event_fields/#{display_id}\", options\n end", "def test_delete_form_field_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request = DeleteFormFieldOnlineRequest.new(document: request_document, index: 0, node_path: 'sections/0')\n\n result = @words_api.delete_form_field_online(request)\n assert_equal false, result.nil?\n end", "def link_to_remove_documents(name, f)\n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\")\n end", "def delete(field_name)\n @element_map.delete(field_name.to_s)\n end", "def remove_member_data_for_field(id)\n post(\"/fields/#{id}/clear\")\n end", "def link_to_remove_fields(name, f, confirm = false, link_class)\n if confirm\n f.hidden_field(:_destroy) + link_to_function(raw(name), \"if (confirm(\\\"Are you sure? This will delete the object.\\\")) { remove_fields(this) }\", :class=>\"#{link_class}\")\n else\n f.hidden_field(:_destroy) + link_to_function(raw(name), \"remove_fields(this)\", :class=>\"#{link_class}\")\n end\n end", "def link_to_remove_fields(name, f, confirm = false, link_class)\n if confirm\n f.hidden_field(:_destroy) + link_to_function(raw(name), \"if (confirm(\\\"Are you sure? This will delete the object.\\\")) { remove_fields(this) }\", :class=>\"#{link_class}\")\n else\n f.hidden_field(:_destroy) + link_to_function(raw(name), \"remove_fields(this)\", :class=>\"#{link_class}\")\n end\n end", "def uncheck_remove_contact(contact)\n @browser.div(:id=>\"addpeople_selected_contacts_container\").link(:text=>contact).parent.checkbox.clear\n end", "def remove_link(form, link_text = nil)\n id = form.object_id.abs\n text = link_text.blank? ? image_tag(\"/images/nested_edit/remove.png\", :class => \"icon\") : link_text\n if form.object.new_record?\n link_to(text, \"#\", :id => \"#{id}\", :class=>\"remove_link\")\n else\n link_to(text, \"#\", :id => \"#{id}\", :class => \"remove_link\") +\n form.hidden_field(:_destroy, :id => \"hidden_#{id}\")\n end\n end", "def op_remove!(field, objects)\n operate_field! field, { __op: :Remove, objects: objects }\n end", "def destroy\n @custom_field.destroy\n respond_to do |format|\n format.html { redirect_to custom_fields_url, notice: 'Custom field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def chkout_phone_number_field\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_phone_number_field, input.className(create_ats_regex_string(\"ats-phonefield\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-phonefield\")), __method__, self)\n end", "def destroy\n @template_form_field.destroy\n respond_to do |format|\n format.html { redirect_to template_form_fields_url, notice: 'Template form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def check_remove_contact(contact)\n @browser.div(:id=>\"addpeople_selected_contacts_container\").link(:text=>contact).parent.checkbox.set\n end", "def delete_if # yields: name, value\n @fields.delete_if { |i|\n yield i.name, i.value\n }\n self\n end", "def remove_child_link(name, f, options = {})\n f.hidden_field(:_delete) + link_to_function(name, \"remove_fields(this)\", options)\n end", "def clear\n wait_until_exists\n @text_field.clear\n end", "def remove!; end", "def delete(name)\n fields.delete(name.to_sym)\n end", "def delete_field(*fields)\n fields.each {|f|\n f = check_field(f)\n raise ArgumentError, \"can not delete reserved field: #{f.inspect}\" if f.start_with?(\"_\") \n @tbl.delete(f)\n @field_list.delete(f)\n }\n nil\n end", "def destroy\n @user_field.destroy\n respond_to do |format|\n format.html { redirect_to user_fields_url, notice: 'User field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_child_link(name, f)\n # name = delete_no_alt_icon + \" \" + name\n # deprecated _delete, use _destroy instead\n # f.hidden_field(:_delete) + link_to_function(name, \"remove_fields(this)\")\n f.hidden_field(:_destroy) + link_to_function(name, \"remove_fields(this)\")\n end", "def unchecks(field)\n checkbox = find_field_by_name_or_label(field)\n return flunk(\"Could not find checkbox #{field.inspect}\") if checkbox.nil?\n return flunk(\"Input #{checkbox.inspect} is not a checkbox\") unless checkbox.attributes['type'] == 'checkbox'\n remove_form_data(checkbox)\n \n (form_for_node(checkbox) / \"input\").each do |input|\n next unless input.attributes[\"type\"] == \"hidden\" && input.attributes[\"name\"] == checkbox.attributes[\"name\"]\n add_form_data(input, input.attributes[\"value\"])\n end\n end", "def link_to_remove_static_fields(hidden_field_name)\n # red X icon\n content = \"<i class='icon-remove'></i>\".html_safe\n\n # We add an _destroy field, which is used to signal to rails that a record\n # should be deleted\n return hidden_field_tag(hidden_field_name).html_safe +\n link_to_function(content,\n \"TemplateBuilder.remove_fields(this)\",\n :class => 'btn btn-danger btn-remove')\n end", "def remove\n __flag__ :remove\n end", "def destroy\n @user_field.destroy\n respond_to do |format|\n format.html { redirect_to user_fields_url, notice: \"User field was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_field_value(id)\n delete(\"fieldValues/#{id}\")\n end", "def destroy\n @custom_field.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to custom_fields_url }\n end\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def - (name) remove_attribute name end", "def test_removed_custom_field\n # => to test this, we use a similar method to the prior test, but change (or remove) an attribute\n model1 = ModelAfter.create\n model2 = ModelSecond.find(model1.id)\n model2.save!\n model2.reload\n \n assert_equal model2.serialized_attributes.keys.include?('custom_field'), false\n end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def destroy\n @field.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to magazine_issue_fields_path , notice: 'Field was successfully deleted.'}\n format.json { head :no_content }\n end\n end", "def takefield\n @field = Field.find(params[:id])\n if @field.fstate == 5 then\n @field.destroy\n end\n @fields = Field.all\n render :xml => @fields\n end", "def destroy\n @field = Field.find(params[:id])\n begin\n @field.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @field.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n \n format.html { redirect_to(\"/fieldview\", :notice => 'field was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n \n \n end\n end", "def er_chk(field,value)\n \n if value.nil? or value == \"\"\n params[:\"#{field}\"] = nil\n end\n\nend", "def mgs_chkout_phone_number_field\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(create_ats_regex_string(\"ats-phonefield\")), __method__)\n\tend", "def op_destroy!(field)\n operate_field! field, { __op: :Delete }.freeze\n end", "def clear_text_field(locator)\n find(locator).clear\n end", "def clear!\n fields.each { |tag, field| self.__send__(\"#{field.name}=\", nil) }\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_to do |format|\n format.html { redirect_to fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_to do |format|\n format.html { redirect_to fields_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.71643376", "0.70429033", "0.7025128", "0.67498195", "0.67489874", "0.66602194", "0.6494545", "0.64924115", "0.6489925", "0.6469885", "0.6469885", "0.64598745", "0.63789976", "0.6373858", "0.6341011", "0.6305041", "0.6292618", "0.6280462", "0.62710565", "0.6270757", "0.6263041", "0.61991894", "0.61686176", "0.6043565", "0.6031633", "0.59924597", "0.59847564", "0.5974472", "0.59572256", "0.59347373", "0.59308684", "0.59169173", "0.5906898", "0.5905706", "0.5895045", "0.5881809", "0.58709973", "0.5867721", "0.5819705", "0.5816862", "0.5804512", "0.5800814", "0.5785067", "0.578057", "0.5776335", "0.5775992", "0.5764326", "0.575136", "0.57467896", "0.57456315", "0.5732357", "0.5718773", "0.5712205", "0.5687072", "0.5681108", "0.5665544", "0.566412", "0.56537956", "0.56537956", "0.5644014", "0.5642411", "0.5630863", "0.56179374", "0.56152505", "0.5605245", "0.55905306", "0.55776316", "0.5564866", "0.5544727", "0.5534516", "0.55328923", "0.55286515", "0.5527324", "0.5524197", "0.5517898", "0.5503243", "0.55012864", "0.5500169", "0.5495133", "0.549348", "0.54911804", "0.54911804", "0.54911804", "0.54911804", "0.5486261", "0.548593", "0.54794616", "0.54794616", "0.54794616", "0.54794616", "0.54770106", "0.54756343", "0.5472918", "0.5460339", "0.54523396", "0.5451667", "0.5446307", "0.5446045", "0.5425462", "0.5425462" ]
0.59858537
26
Test for getting form field
def test_get_form_field filename = 'FormFilled.docx' remote_name = 'TestGetFormField.docx' index = 0 st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, "r").read @storage_api.put_create st_request request = GetFormFieldRequest.new remote_name, index, remote_test_folder + test_folder, :node_path => 'sections/0' result = @words_api.get_form_field request assert_equal 200, result.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_field?(field_name); end", "def get_field(field_name)\n\t\tend", "def form_field_params\n params[:form_field]\n end", "def field?\n true \n end", "def test_get_form_field\n remote_file_name = 'TestGetFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_form_field(request)\n assert_equal false, result.nil?\n end", "def hidden_field?(field_name); end", "def get_field(key)\n @form_fields.getField key.to_s\n end", "def has_field(field_name)\n\t\tend", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def has_field?(field_name); end", "def form_data?; end", "def read_field\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def field?\n false \n end", "def handles?(field); end", "def set_form_field\n @form_field = FormField.find(params[:id])\n end", "def get_field_name\n\t\tend", "def find_field\n @field = Field.find(params.require :id)\n redirect_to :back and return unless @field.form_draft.present?\n end", "def get_field(field_name)\n fields[field_name] || interface_fields[field_name]\n end", "def test_field(field, value, error = false)\n field.set value\n field.trigger 'blur'\n\n no_php_js_errors\n\n if error\n @page.wait_for_error_message_count(1)\n should_have_form_errors(@page)\n should_have_error_text(field, error)\n else\n @page.wait_for_error_message_count(0)\n should_have_no_form_errors(@page)\n should_have_no_error_text(field)\n end\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def get_field(tag_or_name)\n self.class.get_field(tag_or_name)\n end", "def form_field_data\n @attributes[:form_field_data]\n end", "def text_field; end", "def find_field\n @field = Field.find(params.require :id)\n redirect_back(fallback_location: forms_path) and return if @field\n .form_draft\n .blank?\n end", "def textarea_field?(field_name); end", "def set_field\n @field = @nested_form.fields.find(params[:id])\n end", "def get_field(field_name)\n field_name = field_name.to_sym\n field = @field_references[field_name]\n if field.nil?\n unless @@is_a_java_class\n field = method(field_name).call\n else\n field_object = nil\n [field_name.to_s, field_name.camelize, field_name.camelize(false)].uniq.each do |name|\n begin\n field_object = self.class.send(:class_variable_get, :@@java_class).java_class.declared_field(name)\n rescue NameError, NoMethodError => e\n end\n break unless field_object.nil?\n end\n raise UndefinedControlError, \"There is no control named #{field_name} on view #{@main_view_component.class}\" if field_object.nil?\n \n field_object.accessible = true\n field = Java.java_to_ruby(field_object.value(Java.ruby_to_java(@main_view_component)))\n end\n @field_references[field_name] = field\n end\n field\n end", "def [](field_name)\n find_field_by_name(field_name) || raise(FieldNotFoundError, \"Field named '#{field_name}' not found in form.\")\n end", "def test_mandatory_field(field, fieldname)\n if field.nil?\n show_usage\n ui.fatal(\"You must specify a #{fieldname}\")\n exit 1\n end\n end", "def field? name\n !!self.fields[name]\n end", "def field?(name)\n ! self[name].nil?\n end", "def value\n wait_until_exists\n @text_field.value\n end", "def input_field(attribute_name, options = T.unsafe(nil)); end", "def test_get_form_field_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request = GetFormFieldOnlineRequest.new(document: request_document, index: 0, node_path: 'sections/0')\n\n result = @words_api.get_form_field_online(request)\n assert_equal false, result.nil?\n end", "def test_get_form_field_without_node_path\n remote_file_name = 'TestGetFormFieldWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldRequest.new(name: remote_file_name, index: 0, folder: remote_data_folder)\n\n result = @words_api.get_form_field(request)\n assert_equal false, result.nil?\n end", "def fields\n @fields ||= form.fields\n end", "def form_method\n\t\t\t\tspecial_method = Webrat::XML.css_search(@element, 'input[name=\"_method\"]').first\n\t\t\t\tunless special_method.nil?\n\t\t\t\t\tspecial_method['value']\n\t\t\t\telse\n\t\t\t\t\tWebrat::XML.attribute(@element, \"method\").blank? ? :get : Webrat::XML.attribute(@element, \"method\").downcase\n\t\t\t\tend\n\t\t\tend", "def field(name); end", "def process_field_value(value)\r\n value\r\n end", "def method_missing(method_name, *args)\n field = args.first\n \n define_method(\"#{field}_form_field\") do |form, object|\n if form.respond_to? method_name\n form.send(method_name, *args)\n else\n raise NoMethodError, \"this form builder doesn't respond to #{method_name}\" \n end \n end\n end", "def get_field_by_tag(tag)\n self.class.get_field_by_tag(tag)\n end", "def get_field_by_tag(tag)\n self.class.get_field_by_tag(tag)\n end", "def field?(name)\n @attributes.key?(name)\n end", "def field_provided?(key)\n @params.has_key?(key)\n end", "def form; end", "def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submit\"\n submit modelname, fieldname\n end\n end", "def file_form_field\n @attributes[:file_form_field]\n end", "def caprese_is_field?(field)\n respond_to?(field = field.to_sym) || caprese_is_attribute?(field) || self.class.caprese_field_aliases[field]\n end", "def set_field\n @field = Field.find(params[:id])\n end", "def set_field\n @field = Field.find(params[:id])\n end", "def set_field\n @field = Field.find(params[:id])\n end", "def get_form_field(request)\n data, _status_code, _headers = get_form_field_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def get_field_defs_field(view_control)\n if (self.respond_to? :field_defs) && this_field = field_defs.field_called(view_control.name)\n this_field\n end\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def set_custom_form_field\n @custom_form_field = CustomFormField.find(params[:id])\n end", "def configure_field\n end", "def field_get(key)\n self.class.fetch_field(key.to_sym) # ensure that the field exists\n send key\n end", "def form_field_tag_if(condition, name, options={}, &block)\n form_field_tag(name, options, &block) if condition\n end", "def get_char_field(field_name)\n\t\tend", "def get_field(tag_or_name)\n case tag_or_name\n when Integer then get_field_by_tag(tag_or_name)\n when String, Symbol then get_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end", "def text_field?(field_name)\n texts.find { |f| f.name == field_name }\n end", "def form_field_set\n @attributes[:form_field_set]\n end", "def search_input_field(ctrlr = nil, **opt)\n # noinspection RubyMismatchedReturnType\n opt[:field]&.to_sym || search_input_type(ctrlr, **opt)[:field]\n end", "def set_field\n @field = Field.find(params[:id])\n end", "def field_supplied( field )\n return false if field.blank?\n return false if BLANK_PLACEHOLDERS.include?( field )\n return true\n end", "def get_string_field(field_name)\n\t\tend", "def expect_have_field_text(rendered_or_page, field_name, field_id, value, disabled, visible, pre_selector = '')\n expect(rendered_or_page).to have_field(field_name, disabled: disabled, count: 1, id: field_id, visible: visible)\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=text][id=#{field_id}][value='#{value}']\") if visible\n expect(rendered_or_page).to have_selector(\"#{pre_selector}input[type=text][id=#{field_id}]\") unless visible\n end", "def method_missing(method_name, *args, &block)\n name = method_name.to_s\n \n if field_keys.include? name.gsub(/=/, '')\n return name.include?(\"=\") ? self.data[name.gsub(/=/, '').to_sym] = args.first : self.data[method_name]\n else\n logger.debug(\"Form is #{form} and the fields are #{self.form.form_fields if self.form}\")\n super\n end\n end", "def form_arguments_check(form, field_name)\n raise ArgumentError, 'Form is required.' if form.blank?\n raise ArgumentError, 'Field name is required.' if field_name.blank?\n raise ArgumentError, 'Object is not decorated.' \\\n unless form.object.is_a? ResourceDecorator\n end", "def get_field_type\n\t\tend", "def field\n @field ||= quoted_field(field_name)\n end", "def get_field(tag_or_name)\n case tag_or_name\n when Integer, String, Symbol\n field_dictionary[tag_or_name]\n else\n raise TypeError, tag_or_name.class\n end\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def get_field_by_name(name)\n self.class.get_field_by_name(name)\n end", "def get_field(name)\n self[name]\n end", "def doesFieldExist(name,formName=\"\", frameName=\"\")\n\n fname = getFunctionName()\n log fname + ' Starting. Trying to see if field with name: ' + name + ' exists '\n messages = []\n\n container = getObjectContainer( name , formName, frameName )\n\n o = nil\n\n container.all.each do |c|\n next unless o == nil\n begin\n if c.invoke(\"type\").to_s.downcase ==\"text\"\n log fname + \" found text field #{c.name}\" \n if c.name.to_s == name and o == nil \n o = c\n log fname + \" found the correct text field #{c.name}\" \n end\n end\n rescue\n # probably no name\n end\n end\n\n return false if o == nil\n return true\n \n end", "def get_field_by_tag(tag)\n fields[tag]\n end", "def verify_field_required(new_fieldname, should_be_required = true)\n Log.logger.info(\"Checking if #{new_fieldname} has a required box that says: #{should_be_required}\")\n on_page_required = @browser.find_elements(:xpath => \"//label[contains(text(), '#{new_fieldname}')]/span[text()='*']\").size > 0\n on_page_required.should == should_be_required #, \"Should #{new_fieldname} be required: #{should_be_required}. What we got: #{on_page_required}.\")\n end", "def field_provided?(key)\n return send(:\"#{key}_field_provided?\") if respond_to?(:\"#{key}_field_provided?\", true)\n\n @params.key?(key)\n end", "def process_field(builder, field)\n builder.send(field.field_type.to_sym,\n field.field_name.to_sym,\n\n # Homespree Project Type Optional params\n {\n label: field.label,\n data: field.field_data,\n default: field.default,\n required: field.required,\n position: field.position,\n size: field.size,\n toggleable: field.toggleable\n }\n )\n end", "def field? key\n @validators[String(key).to_sym].is_a? ::Proc\n end", "def get_field_locator(key)\n if @fieldname[key]\n \"#{@locator}//*[contains(@#{@fieldname[key][0]},'#{@fieldname[key][1]}')]#{@fieldname[key][2].nil? ? '/input' : @fieldname[key][2]}\"\n else\n \"#{@locator}//*[//label[text()='#{key}']/@for and contains(@id,//label[text()='#{key}']/@for)]\"\n end\n end", "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end", "def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end", "def get_boolean_field(field_name)\n\t\tend", "def html_for_non_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'text' \n name = create_form[#{field}]\n placeholder = 'Type in the #{field}'\n value = '#{object.send(field)}'>\n </input>\n </p>\"\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def test_get_field\n local_file_name = 'GetField.docx'\n remote_file_name = 'TestGetField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/' + local_file_name), remote_data_folder + '/' + remote_file_name\n\n request = GetFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0/paragraphs/0', folder: remote_data_folder)\n\n result = @words_api.get_field(request)\n assert_equal false, result.nil?\n end", "def field(tag, modifier=nil)\n self.fields.detect {|field| field.tag == tag.to_s && (modifier.nil? || field.modifier == modifier) }\n end", "def test_get_form_fields\n remote_file_name = 'TestGetFormFields.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldsRequest.new(name: remote_file_name, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_form_fields(request)\n assert_equal false, result.nil?\n end", "def has_field?(name)\n fields.key?(name.to_sym)\n end", "def form_input?(tag)\n FORM_INPUTS.include?(tag)\n end", "def fetch_field(expected_key = nil, &block)\n find_field(expected_key, &block) ||\n (raise FieldNotFound,\n \"no such field `#{expected_key}` for #{self}.\")\n end", "def test_text_field\n _erbout = ''\n \n uni_form_for(:user, @user) do |f|\n f.fieldset do\n _erbout.concat f.text_field(:first_name)\n end\n end\n \n expected = <<-html\n <form action=\"http://www.example.com\" method=\"post\" class=\"uniForm\">\n <fieldset class=\"blockLabels\">\n <div class=\"ctrlHolder\">\n <label for=\"user_first_name\">First name</label>\n <input name=\"user[first_name]\" size=\"30\" type=\"text\" class=\"textInput\" id=\"user_first_name\" value=\"Marcus\"/>\n </div>\n </fieldset>\n </form>\n html\n \n assert_dom_equal expected, _erbout\n end", "def set_field\n @field = @group.fields.find(params[:id])\n end", "def form_fields\n params\n end", "def show_field?(name)\n show_fields.key?(name)\n end", "def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end" ]
[ "0.70183766", "0.6934823", "0.6554872", "0.64931667", "0.6470671", "0.64678913", "0.6422354", "0.6414923", "0.64009976", "0.6388004", "0.6384089", "0.6365697", "0.6357989", "0.62687135", "0.6241873", "0.6166287", "0.61650234", "0.60889345", "0.60750645", "0.6050422", "0.6049802", "0.6049802", "0.6042374", "0.6038561", "0.59540826", "0.5951233", "0.5946023", "0.59451514", "0.5915338", "0.5889746", "0.58819056", "0.58515066", "0.58481824", "0.5830915", "0.5828169", "0.58262324", "0.5818171", "0.5801997", "0.57990867", "0.5788408", "0.5780974", "0.57729495", "0.57729495", "0.5762788", "0.5758097", "0.5752029", "0.5746674", "0.5736048", "0.57337004", "0.5730425", "0.5730425", "0.5730425", "0.5713046", "0.5700996", "0.56963193", "0.5694885", "0.56870294", "0.5685593", "0.5668442", "0.5665194", "0.56610644", "0.5660225", "0.5653198", "0.56512606", "0.5646619", "0.56186455", "0.56130815", "0.56118053", "0.56072205", "0.5603518", "0.5600883", "0.5600694", "0.5593063", "0.55870384", "0.55870384", "0.55784297", "0.5577214", "0.5573975", "0.55675906", "0.5565279", "0.5562912", "0.5561784", "0.55603963", "0.5559051", "0.5559051", "0.5559034", "0.5555898", "0.554642", "0.55458444", "0.55452484", "0.55346894", "0.5533622", "0.5529519", "0.55270725", "0.551497", "0.5514043", "0.5513279", "0.5505456", "0.55014116", "0.549486" ]
0.62540704
14
Test for getting form fields
def test_get_form_fields filename = 'FormFilled.docx' remote_name = 'TestGetFormFields.docx' st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, "r").read @storage_api.put_create st_request request = GetFormFieldsRequest.new remote_name, remote_test_folder + test_folder, :node_path => 'sections/0' result = @words_api.get_form_fields request assert_equal 200, result.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n @fields ||= form.fields\n end", "def form_fields\n params\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend", "def test_get_form_fields\n remote_file_name = 'TestGetFormFields.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldsRequest.new(name: remote_file_name, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_form_fields(request)\n assert_equal false, result.nil?\n end", "def form_data?; end", "def text_field?(field_name); end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def form_field_params\n params[:form_field]\n end", "def test_get_form_field\n filename = 'FormFilled.docx'\n remote_name = 'TestGetFormField.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFormFieldRequest.new remote_name, index, remote_test_folder + test_folder, :node_path => 'sections/0'\n result = @words_api.get_form_field request\n assert_equal 200, result.code\n end", "def test_get_form_field\n remote_file_name = 'TestGetFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_form_field(request)\n assert_equal false, result.nil?\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def validate_fields\n expect(@browser.textfield(:id => 'lbl_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_3').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'lbl_ttl_val').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_1').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_2').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_4').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_5').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_val_6').present?).to eq(true)\n expect(@browser.textfield(:id => 'txt_ttl_val').present?).to eq(true)\n end", "def forms; end", "def test_get_form_fields_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request = GetFormFieldsOnlineRequest.new(document: request_document, node_path: 'sections/0')\n\n result = @words_api.get_form_fields_online(request)\n assert_equal false, result.nil?\n end", "def fields?; @fields; end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end", "def get_fields(template); end", "def fields!\n @validators.keys.find_all { |key| @validators[key].is_a? ::Proc }\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def test_allow_dynamic_form_fields()\n # Parameters for the API call\n name = 'farhan'\n\n # dictionary for optional form parameters\n optional_form_parameters = {}\n optional_form_parameters['field'] = 'QA'\n\n # Perform the API call through the SDK function\n result = @controller.allow_dynamic_form_fields(name, _field_parameters: optional_form_parameters)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end", "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end", "def field?\n true \n end", "def hidden_field?(field_name); end", "def form; end", "def expect_fields_to_be_blank\n expect(page).to have_field(\"Email\", with: \"\", type: \"email\")\n expect(find_field(\"Password\", type: \"password\").value).to be_nil\n expect(find_field(\"Password confirmation\", type: \"password\").value).to be_nil\n end", "def form_fields\n [:description, :status, :magic]\n end", "def has_field?(field_name); end", "def field?\n false \n end", "def fields\n missing_method :fields\n end", "def test_get_form_field_online\n request_document = File.open(File.join(local_test_folder, field_folder + '/FormFilled.docx'))\n request = GetFormFieldOnlineRequest.new(document: request_document, index: 0, node_path: 'sections/0')\n\n result = @words_api.get_form_field_online(request)\n assert_equal false, result.nil?\n end", "def fill_in_form(fields)\n fields.each do |field, value|\n f = send(\"#{field}_field\")\n f.set(value) || Array(value).each { |val| f.select(val) }\n end\n end", "def get_fields\n raise NotImplementedError.new\n end", "def form_arguments_check(form, field_name)\n raise ArgumentError, 'Form is required.' if form.blank?\n raise ArgumentError, 'Field name is required.' if field_name.blank?\n raise ArgumentError, 'Object is not decorated.' \\\n unless form.object.is_a? ResourceDecorator\n end", "def form_setup\n\tend", "def method_missing(method_name, *args, &block)\n name = method_name.to_s\n \n if field_keys.include? name.gsub(/=/, '')\n return name.include?(\"=\") ? self.data[name.gsub(/=/, '').to_sym] = args.first : self.data[method_name]\n else\n logger.debug(\"Form is #{form} and the fields are #{self.form.form_fields if self.form}\")\n super\n end\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def form_field_data\n @attributes[:form_field_data]\n end", "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "def has_field(field_name)\n\t\tend", "def required_fields\n if self.controller_name == \"registrations\"\n param_name = \"user\"\n elsif self.controller_name == \"merchants\"\n param_name = \"merchant\"\n else\n return\n end\n empty_fields = Array.new\n empty = false\n params[param_name].each_pair do |k, v|\n if v == \"\"\n empty_fields << k.gsub(\"_\", \" \")\n empty = true\n end\n end\n if empty == true\n (0..empty_fields.length - 3).each do |i|\n empty_fields[i] << \",\"\n end\n empty_fields.insert(-2, \"and\") unless empty_fields.length < 2\n field_list = empty_fields.join(\" \")\n message = \"You cannot leave empty fields. The field\" \n if empty_fields.length > 1\n message << \"s \"\n else\n message << \" \"\n end\n message << field_list \n if empty_fields.length > 1\n message << \" were left blank.\"\n else\n message << \" was left blank.\"\n end\n flash[:notice] = message\n redirect_to request.referrer\n else\n return\n end\n end", "def textfields\n find_2_eles_attr :textfield, :secure, :text\n end", "def fetch_fields\n @fields\n end", "def check_has_form(page)\n inputs = page.search('input')\n inputs.each do |input|\n attrs = input.attributes.select { |k,v| v.value =~ /^name|login|password|username|^email$$/i } \n go_ahead = (!attrs.compact.empty?)\n if go_ahead\n puts \"I think I found the login url for #{page.uri.to_s}\"\n login_page = page\n puts \">> #{login_page.uri}\\n\\n\"\n return true\n end\n\n \n end\n return false\nend", "def has_valid_form\n is_predefined_by_ak || has_valid_prefix\n end", "def field_requireds\r\n return @field_requireds\r\n end", "def fields; end", "def fields; end", "def fields; end", "def test_get_form_fields_without_node_path\n remote_file_name = 'TestGetFormFieldsWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldsRequest.new(name: remote_file_name, folder: remote_data_folder)\n\n result = @words_api.get_form_fields(request)\n assert_equal false, result.nil?\n end", "def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end", "def test_get_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'get_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def form_field_set\n @attributes[:form_field_set]\n end", "def index\n @form_fields = FormField.all\n end", "def handles?(field); end", "def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end", "def fields\n @fields\n end", "def fields\n @fields\n end", "def add_field\n if request.get?\n @info = Hash.new\n @field_hash = Hash.new\n session[:count] = 1\n else\n @fields = []\n @field_hash = Hash.new\n session[:field_hash] = @field_hash\n form = DynamicForm.find(session[:form_id])\n @info = params[:info]\n if form.fields == \"To be Filled\"\n logger.info 'FIELDS TO BE FILLED'\n form.fields = {}\n else\n @fields = YAML::load(form.fields)\n logger.info \"Loading YAML {line 92}\"\n end \n @fields << @info\n form.fields = @fields.to_yaml\n form.save\n logger.info \"Returned: #{@info}\"\n redirect_to :action => 'add_fields'\n end\n end", "def required_fields\n []\n end", "def get_field(field_name)\n\t\tend", "def should_be_required(options)\n @new_post.class.should_receive(:reflect_on_validations_for).with(:body).and_return([\n mock('MacroReflection', :macro => :validates_presence_of, :name => :body, :options => options[:options])\n ])\n \n semantic_form_for(@new_post) do |builder|\n concat(builder.input(:body))\n end\n \n if options[:required]\n output_buffer.should_not have_tag('form li.optional')\n output_buffer.should have_tag('form li.required')\n else\n output_buffer.should have_tag('form li.optional')\n output_buffer.should_not have_tag('form li.required')\n end\n end", "def given_model_fields(model_name)\n model_fields(model_name).select do |field, _value|\n given?(field)\n end\n end", "def has_form?\n @stamper.getAcroFields.getFields.size > 0\n end", "def verify_field_properties_settings(new_fieldname, fieldname_display, def_value, desc_text)\n fieldname_labels = @browser.find_elements(:xpath => \"//label[contains(text(), '#{new_fieldname}')]\")\n if fieldname_display.downcase.include? \"hidden\"\n fieldname_labels.should be_empty\n else\n fieldname_labels.should have_at_least(1).items\n end\n @browser.find_elements(:xpath => \"//input[@value='#{def_value}']\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//div[text()='#{desc_text}']\").should have_at_least(1).items\n end", "def get_fields(template)\n read(template).fields\n end", "def num_fields\n @form_fields.size\n end", "def add_fields\n session[:count] = 0\n @fields = []\n if params[:dynamic_form] #Get information from form before\n logger.info \"Params[:form]\"\n form_hash = params[:dynamic_form]\n if(params[:id]) #If Editing\n logger.info \"Editing\"\n form = DynamicForm.find(params[:id])\n form.update_attributes(form_hash)\n session[:form_id] = form.id\n logger.info \"FIELDS: #{form.fields}\"\n if form.fields == \"To be Filled\"\n @message = \"<p>No fields</p>\"\n else\n @fields = YAML::load(form.fields)\n end\n else #Creating New Form\n logger.info \"Creating a new form: #{form_hash.to_s}\"\n form = DynamicForm.create(form_hash)\n form.save!\n session[:form_id] = form.id\n end\n else #Handle field updating and list creation\n form = DynamicForm.find(session[:form_id])\n #logger.info \"Fields Hash: #{YAML::load(form.fields).to_s}\"\n unless form.fields == \"To be Filled\"\n @fields = YAML::load(form.fields)\n end \n end\n end", "def num_fields\n @form_fields.getFields.size\n end", "def field_detect(label)\n @field = fields.detect { |item| item.text.include? label }\n\n raise \"Field '#{label}' was not found on form.\" unless @field\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def form_params\n params[:form]\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def fields\n @fields\n end", "def patient_forms\n # blank\n end", "def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end", "def validate_fields\n @edit[:wf].get_dialog_order.each do |d|\n @edit[:wf].get_all_fields(d, false).each_value do |field|\n if field[:error].present?\n @error_div ||= d.to_s\n add_flash(field[:error], :error)\n end\n end\n end\n end", "def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end", "def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end", "def args?\n\t\treturn [email protected]?\n\tend", "def show_fields(**params)\n get('fields', params)\n end", "def check fields, obj\r\n fields.each{ |field|\r\n if not obj.respond_to? field then\r\n return false\r\n end\r\n }\r\n return true\r\n end", "def validate_fields(fields)\n if fields['email'] && fields['password']\n Success(fields)\n else\n Failure(:missing_fields)\n end\n end", "def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submit\"\n submit modelname, fieldname\n end\n end", "def injection_form\n # Nothing to do here\n end", "def test_get_form_field_without_node_path\n remote_file_name = 'TestGetFormFieldWithoutNodePath.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = GetFormFieldRequest.new(name: remote_file_name, index: 0, folder: remote_data_folder)\n\n result = @words_api.get_form_field(request)\n assert_equal false, result.nil?\n end", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def test_get_fields\n local_file_name = 'GetField.docx'\n remote_file_name = 'TestGetFields.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/' + local_file_name), remote_data_folder + '/' + remote_file_name\n\n request = GetFieldsRequest.new(name: remote_file_name, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_fields(request)\n assert_equal false, result.nil?\n end", "def get_form_fields(request)\n data, _status_code, _headers = get_form_fields_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def all_expected_fields_received?\n @signature_fields ||= %w(idterminal idcomercio idtransaccion importe moneda coderror codautorizacion firma).map{|value| value = value.to_sym}\n [email protected]? && @fields.areset?(@signature_fields)\n end", "def form_printable?\n properties.include?(\"form_printable\")\n end", "def form_enter type, valid_attributes\r\n valid_attributes.each { |field,value| form.send(\"#{type}[#{field}]=\",value)}\r\nend", "def verify_component_before_saving(fieldname)\n if(fieldname == \"Formatted content\")\n @browser.find_elements(:xpath => \"//strong[contains(text(), 'New HTML Markup')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n elsif(fieldname == \"Page break\" || fieldname == \"Hidden field\")\n @browser.find_elements(:xpath => \"//div[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n elsif(fieldname == \"Fieldset\")\n @browser.find_elements(:xpath => \"//span[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n else\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{fieldname}')]\").should have_at_least(1).items #\"#{fieldname} is not present in the Form Builder space area.\")\n end\n end", "def form\n end", "def fields\n @fields ||= []\n end", "def test_valid_fields\n\t page = pages(:valid_page)\n\t assert page.valid?\n\tend", "def fields\n @fields ||= begin\n default_fields\n end\n end" ]
[ "0.708444", "0.70056933", "0.67474437", "0.6640493", "0.66006523", "0.65812916", "0.654523", "0.6527126", "0.6510921", "0.6390957", "0.6379048", "0.63340795", "0.6319897", "0.6310525", "0.62590176", "0.6252043", "0.62473977", "0.6237692", "0.6230975", "0.61806184", "0.61589783", "0.6149552", "0.61384094", "0.6124528", "0.6109472", "0.6098727", "0.60872227", "0.6075273", "0.60631454", "0.6060567", "0.60088617", "0.59869903", "0.5985938", "0.59808856", "0.59590423", "0.5952606", "0.5938616", "0.59366024", "0.5921125", "0.59019864", "0.58901274", "0.5884111", "0.58833635", "0.58386046", "0.5836691", "0.5831831", "0.5813941", "0.5801115", "0.57955873", "0.57955873", "0.57955873", "0.5790436", "0.5772425", "0.57684135", "0.57613665", "0.5754406", "0.5753198", "0.5749155", "0.57431465", "0.57431465", "0.57423645", "0.57298476", "0.57227445", "0.57152057", "0.57094604", "0.5703093", "0.56887084", "0.5687471", "0.56866634", "0.56856006", "0.56805354", "0.56803143", "0.56741685", "0.56733507", "0.56677413", "0.56677413", "0.56595975", "0.56508064", "0.5637533", "0.5631626", "0.56231654", "0.56175447", "0.5608531", "0.559817", "0.5588385", "0.5576474", "0.55762345", "0.5569438", "0.5566499", "0.5560927", "0.5558102", "0.5557754", "0.55540013", "0.55481386", "0.5531894", "0.5529786", "0.55283946", "0.5528061", "0.552686", "0.5520192" ]
0.65928024
5
Changes: 1. Get form_id from selector 2. If collection is entries, not matter from context or current collection object, and form has entries_separated flag set, set collection name instance variable to entries plus form_id as new collection name 3. It's not good because it will query form to check entries_separated flag exists or not each time. Hope to find a better way later
def create_context_with_separated_entries context = create_context_without_separated_entries query_class = instance_variable_get :@klass if should_query_from_separated_collection? query_class new_collection_name = query_class.separated_collection_prefix + separated_value(query_class) # self.selector.except!('form_id') # filter = context.instance_variable_get(:@view).filter.except('form_id') # context.instance_variable_get(:@view).instance_variable_set :@filter, filter context.collection.instance_variable_set :@name, new_collection_name collection.instance_variable_set :@name, new_collection_name end instance_variable_set :@context, context context end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def criteria_with_separated_entries\n cri = criteria_without_separated_entries\n query_class = cri.instance_variable_get :@klass\n if should_query_from_separated_collection? query_class\n context = cri.context.clone\n context.collection.instance_variable_set :@name, \"#{query_class.separated_collection_prefix}#{base.id}\"\n cri.instance_variable_set :'@collection', @collection\n # cri.selector.except!('form_id')\n end\n cri\n end", "def collection_ids\n # Get the ids of the existing collections from the form.\n collection_ids = Hash(collections_for_registration).values.map { |elem| elem.fetch(:id) }\n if collection_radio == \"create\"\n collection_ids << create_collection(model.externalIdentifier)\n elsif collection[:collection].present? # guard against empty string\n collection_ids << collection[:collection]\n end\n collection_ids\n end", "def process_collections #:nodoc\r\n # If result_set is not defined on form, then it will fail. :return_to should know where to go\r\n if @form['result_set'].nil?\r\n process_return_to(params[:return_to] || 'reload')\r\n return true\r\n end\r\n # when result set is evaluated as Rails helper\r\n @form['result_set']['type'] ||= 'default'\r\n return unless @form['result_set']['type'] == 'default'\r\n\r\n # for now enable only filtering of top level documents\r\n if @tables.size == 1 \r\n check_filter_options()\r\n check_sort_options()\r\n end \r\n # result set is defined by filter method in control object\r\n form_filter = @form['result_set']['filter'] || 'default_filter'\r\n if respond_to?(form_filter)\r\n @records = send(form_filter)\r\n # something went wrong. flash[] should have explanation.\r\n if @records.class == FalseClass\r\n @records = []\r\n render(action: :index)\r\n return true\r\n end\r\n process_select_and_deny_fields\r\n # pagination but only if not already set\r\n unless (@form['table'] == 'dc_memory' || (@records.respond_to?(:options) && @records.options[:limit]))\r\n per_page = (@form['result_set']['per_page'] || 25).to_i\r\n @records = @records.page(params[:page]).per(per_page) if per_page > 0\r\n end\r\n else\r\n if @tables.size > 1 \r\n rec = @tables.first[0].find(@ids.first) # top most document.id\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n # TO DO. When field name is different then pluralized class name. Not working yet.\r\n embedded_field_name = @tables.last[0] ? @tables.last[1].pluralize : @tables.last[1]\r\n @records = rec.send(embedded_field_name) # current embedded set\r\n # sort by order if order field is present in model\r\n if @tables.last[1].classify.constantize.respond_to?(:order)\r\n @records = @records.order_by(order: 1)\r\n end\r\n end\r\n end\r\n false\r\nend", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def set_CollectionName(value)\n set_input(\"CollectionName\", value)\n end", "def collection_name\n 'form_reference_fields'\n end", "def add_collection_metaform(collection, mf_id)\n if (collection == nil or collection == \"\" or \n mf_id == nil or mf_id == \"\")\n return false\n end\n \n collection.documents.each do |doc|\n add_document_metaform(doc.id, mf_id)\n end\n \n return true\n end", "def handle_form_label(vals)\n @forms << vals.last\n @form = vals.last if matches_mdes_version(vals)\n end", "def store_in(name)\n self.collection_name = name.to_s\n set_collection\n end", "def store_in(name)\n self.collection_name = name.to_s\n set_collection\n end", "def getForm(entry)\n\t\t# split the user input by ||\n\t\tpieces = entry.split(\"||\")\n\t\tfrm = pieces[0]\n\t\tfrm = frm.to_i\n\t\t\n\t\t# get form name from array\n\t\tif(frm < @@allForms.length)\n\t\t\t@@form_index = frm\n\t\t\tfrm = @@allForms[frm][\"frm\"]\n\t\telse\n\t\t\tfrm = \"N/A\"\n\t\tend\n\t\t\n\t\t# return form name\n\t\treturn frm\n\tend", "def set_collection\n @collection = Collection.friendly.find params[:id]\n end", "def move_collection_names\n @record.xpath('./datafield[@tag=\"710\"]/subfield[@code=\"5\"]').each do |subfield|\n collection = subfield.parent.at_xpath('./subfield[@code=\"a\"]').text\n\n Nokogiri::XML::Builder.with(@doc.at('record')) do |xml|\n xml.datafield('ind1' => '0', 'ind2' => '0', 'tag' => '773') do\n xml.subfield(collection, 'code' => 't')\n end\n end\n\n subfield.parent.remove\n end\n end", "def set_NewCollectionName(value)\n set_input(\"NewCollectionName\", value)\n end", "def find_collections_for_form\n Hyrax::CollectionsService.new(self).search_results(:edit)\n end", "def import_from_previous_forms\n\t\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t\t# NEED ONLY TO LIST FORMS THAT I ARE NOT ALREADY BORROWING FROM THE CURRENT??\n\t\t@previous_extraction_forms = ExtractionForm.find(:all,:conditions=>[\"project_id = ? AND id <> ?\",params[:project_id], params[:extraction_form_id]])\n\t\t\n\t\t@assigned_questions_hash, @included_sections_hash,@checked_boxes = [Hash.new,Hash.new,Hash.new]\n\t\t# for each of the previously existing forms\n\t\t@previous_extraction_forms.each do |ef|\n\t\t\t\n\t\t\t# get the key questions assigned\n\t\t\t@assigned_questions_hash[ef.id] = ExtractionForm.get_assigned_question_numbers(ef.id)\n\t\t\t\t\n\t\t\t# get the sections included\n\t\t\t@included_sections_hash[ef.id] = ExtractionFormSection.get_included_sections_by_extraction_form_id(ef.id)\t\n\t\t\t@borrowers = ExtractionFormSectionCopy.get_borrowers(params[:extraction_form_id])\n\t\t\t\t\n\t\t\t# determine which boxes should already be checked\n\t\t\talready_entered = ExtractionFormSectionCopy.get_previous_data(params[:extraction_form_id], ef.id)\n\t\t\talready_entered = already_entered.collect{|x| x.section_name}\n\t\t\t@checked_boxes[ef.id] = already_entered\n\t\t\t\t\n\t\t\t# get rid of key questions and publications\n\t\t\t@included_sections_hash[ef.id].delete_at(0);@included_sections_hash[ef.id].delete_at(0);\n\t\t\t\n\t\tend\n\tend", "def pe_many_collection_details(details, form)\n details.each_with_index do |detail_to_ids,idx|\n detail = detail_to_ids[0]\n detail_name_plural ||= detail.class.to_s.tableize\n detail_name ||= detail_name_plural.singularize\n if detail.person.user == current_user\n form.fields_for \"#{detail_name_plural}_attributes[]\", detail,\n :index => \"new_#{idx}\" do |form_detail|\n concat(render(:partial => 'people/'+detail_name, :object => form_detail))\n end\n else\n concat(self.send('p_'+detail_name, detail))\n end\n end\n end", "def collection_name\n 'fields'\n end", "def process_form(entry)\n\t\t# set flag variable\n\t\t@@processed = true\n\t\t# check for inclusion of ||\n\t\tif(entry.include?\"||\")\n\t\t\t# get form\n\t\t\t@@form = getForm(entry)\n\t\t\t# split by ||\n\t\t\tins = entry.split(\"||\")\n\t\t\t# get user input\n\t\t\t@@last = ins[1]\n\t\telse\n\t\t\t# change flag\n\t\t\t@@processed = false\n\t\t\t# specify error format\n\t\t\tputs \"You must specify a form in this format: 1||message\"\n\t\tend\n\tend", "def form_class\n Hyrax::CalifornicaCollectionsForm\n end", "def criteria_with_separated\n cri = criteria_without_separated\n query_class = cri.instance_variable_get :@klass\n if should_query_from_separated_collection? query_class\n context = cri.context.clone\n new_collection_name = calc_new_collection_name query_class\n unless new_collection_name.blank?\n context.collection.instance_variable_set :@name, new_collection_name\n cri.instance_variable_set :'@collection', @collection\n end\n end\n cri\n end", "def nested_field_set(f, assoc, options = {})\n wrapper_partial = \"shared/nested_fields_wrapper\"\n options[:inner_partial] ||= \"#{f.object.class.model_name.route_key}/#{assoc.to_s.singularize}_fields\"\n options[:multiple] = true unless options.has_key?(:multiple)\n\n wrapper_classes = [\"nested-fields\"]\n wrapper_classes << \"no-label\" if options[:label] == false\n wrapper_classes << \"multiple\" if options[:multiple]\n\n f.input(assoc, options.slice(:required)) do\n content_tag(:div, class: \"nested-field-set\") do\n f.simple_fields_for(assoc, wrapper: :nested_fields) do |f2|\n render(wrapper_partial, f: f2, options: options, classes: wrapper_classes)\n end <<\n if options[:multiple]\n content_tag(:span) do\n link_to_add_association(t(\"cocoon.add_links.#{assoc}\"), f, assoc,\n partial: wrapper_partial,\n render_options: {\n wrapper: :nested_fields, # Simple form wrapper\n locals: {options: options, classes: wrapper_classes}\n }\n )\n end\n end\n end\n end\n end", "def create_context_with_separated\n context = create_context_without_separated\n query_class = instance_variable_get :@klass\n new_collection_name = calc_new_collection_name query_class\n unless new_collection_name.blank?\n context.collection.instance_variable_set :@name, new_collection_name\n collection.instance_variable_set :@name, new_collection_name\n end\n instance_variable_set :@context, context\n context\n end", "def form_select\n if Contact.order(\"last_name ASC, first_name ASC\").collect.present?\n Contact.order(\"last_name ASC, first_name ASC\").collect {|p| [ p.last_name + ', ' + p.first_name, p.id ] }\n end\n end", "def set_collection\n @collection = Collection.friendly.find(params[:id])\n end", "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "def set_entry\n @entry = @form.entries.find(params[:id])\n end", "def enter_obj_collection_info(data_set)\n wait_for_element_and_click({:xpath => '//button[contains(.,\"Object Collection Information\")]'})\n field_collect_event_names = data_set[CoreAcquisitionData::FIELD_COLLECT_EVENT_NAMES.name]\n field_collect_event_names && field_collect_event_names.each do |name|\n index = field_collect_event_names.index name\n logger.debug \"Entering field collection event name #{name} at index #{index}\"\n add_button_locator = add_button_locator([fieldset(CoreAcquisitionData::FIELD_COLLECT_EVENT_NAMES.name)])\n wait_for_element_and_click add_button_locator unless index.zero?\n wait_for_element_and_type(event_names_input_locator(index), name[CoreAcquisitionData::FIELD_COLLECT_EVENT_NAME.name])\n end\n end", "def set_collection\n @collection = user_collections.detect{ |c| c.id.to_s == params[:id] }\n end", "def update_collection(collection)\n # Take the name out of the list of keys so that all that remains are fields to\n # be updated\n name = collection.delete(:name)\n # Because the name may come in many forms we must use something like titlecase to help\n # account for variations\n name = name.last.titleize\n \n # Due to the way that batches are handled a collection may appear multiple times. Presume\n # that if it has already been processed it is safe to skip any duplicates\n if (@successful_updates.include?(name) or \n @failed_updates.include?(name))\n log_message(\"Skipping duplicate collection entry\")\n return\n end\n\n coll = Collection.where(title: name).first\n \n if (coll.present? and (coll.title == name))\n log_message(\"Processing #{coll.title}\")\n update_and_save_metadata(coll, collection) \n @successful_updates << name\n else\n log_message(\"Could not locate #{name}\", Logger::WARN)\n @failed_updates << name\n end\n end", "def nested_forms\n []\n end", "def create\n @collection = current_user.collections.build(params[:collection])\n\n # set some default values - set collection value to the number of current collections\n if Collection.where(\"name like ?\", \"%Untitled%\").count > 0\n count = Collection.where(\"name like ?\", \"%Untitled%\").order(\"created_at DESC\").first.name.sub('Untitled-Collection-','').to_i + 1\n else\n count = 1\n end\n \n @collection.name = \"Untitled-Collection-\"+count.to_s()\n @collection.user = current_user\n @collection.challenge = false\n @collection.privacy = \"unlisted\"\n\n respond_to do |format|\n if @collection.save\n @collection.update_attributes(:name => \"Untitled-Collection-\" + @collection.id.to_s)\n format.html { redirect_to @collection }\n format.json { render :json => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_collection_select\n @facultades = Facultad.all\n @programas = Programa.all\n @grupos = Grupo.all\n @semilleros = Semillero.all\n @investigadores = Investigador.all\n end", "def form_names\n forms.map(&:name).join(\", \")\n end", "def fields_for_collection_ids(collection_ids_name, records)\n raise ArgumentError, \"No block given\" unless block_given?\n \n records.each do |record|\n fields = Conductor::ActionView::CollectionIdsFormBuilder.new(self, collection_ids_name, record)\n yield fields, record\n end\n end", "def collection; @opts['collection'] end", "def form_names\n forms.map(&:name).join(', ')\n end", "def form_encoded_name\n return unless path\n\n options[:multiple] || options[:collection] ? super + '[]' : super\n end", "def build_collection_items\n @per_page = @view_as.max_items_per_page || 50\n @collection_results = @filter == 'editors' ? [] :\n @collection.items_from_solr(facet_type: @filter, page: @page, sort_by: @sort_by,\n per_page: @per_page,view_style: @view_as, language_id: current_language.id)\n @collection_items = @collection_results.map { |i| i['instance'] }.compact\n if params[:commit_select_all]\n @selected_collection_items = @collection_items.map { |ci| ci.id.to_s }\n end\n end", "def set_collection\n @collection = Collection.find_by_friendlier_id!(params[:id])\n end", "def add_collection_if_collection_clio_id_present!(marc_hyacinth_record)\n marc_hyacinth_record.digital_object_data['dynamic_field_data'].fetch(\"collection\", []).each do |collection_term|\n collection_term = collection_term['collection_term']\n collection_clio_id = collection_term['clio_id']\n next unless collection_clio_id\n unless @collection_clio_ids_to_uris.key?(collection_clio_id)\n begin\n collection_marc_record = @voyager_client.find_by_bib_id(collection_clio_id)\n # Return if a collection-level marc record wasn't found for the given clio id\n unless collection_marc_record && collection_marc_record.leader[7] == 'c'\n @errors << \"For bib record #{marc_hyacinth_record.clio_id}, could not resolve collection clio id #{collection_clio_id} to a collection-level marc record.\"\n return\n end\n # Raise error if the marc 001 field of this record doesn't actually match the value in collection_clio_id\n raise 'Mismatch between collection_clio_id and retrieved record 001 value' if collection_clio_id != collection_marc_record['001'].value\n\n # Create this term because it does not exist\n term = @hyacinth_client.create_controlled_term({\n 'controlled_vocabulary_string_key' => 'collection',\n 'type' => 'local',\n 'value' => self.class.extract_collection_record_title(collection_marc_record),\n 'clio_id' => collection_clio_id\n })\n # Add newly-created term to @collection_clio_ids_to_uris so it can be used for future records\n @collection_clio_ids_to_uris[collection_clio_id] = term['uri']\n rescue Encoding::InvalidByteSequenceError => e\n marc_hyacinth_record.errors << \"Collection bib record issue: #{e.message}\"\n end\n end\n\n # Assign collection term to base digital object data hash\n collection_term['uri'] = @collection_clio_ids_to_uris[collection_clio_id]\n end\n end", "def collection(new_collection)\n self.collection_key = new_collection\n end", "def push_has_many_form(field)\n (@has_many_forms ||= []) << field\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def store_in(name, options = {})\n self.collection_name = name.to_s\n set_collection(options)\n end", "def set_collection\n @collection = Collection.find(params[:collection_id])\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def setup_submission_form\n @filters = current_profile.filters\n tags = current_profile.submissions.tag_counts_on(:tags)\n tags = tags.sort_by { |tag| tag.count }.reverse\n @common_tags = tags.collect { |tag| tag.name }[0,8]\n @folders = current_profile.submission_folders.reject { |f| f.is_permanent? }\n end", "def canonical_form_object\n CanonicalForm.find(entry.name.canonical_form_id) # Yuck. But true.\n end", "def uhook_category_form form\n (form.hidden_field :content_id) + (hidden_field_tag(:from, params[:from]))\n end", "def build_mark_form(mark,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:mark_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'mark_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'mark_name'}\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'brand_code'}\n\n field_configs[3] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'external_description'}\n\n\tbuild_form(mark,field_configs,action,'mark',caption,is_edit)\n\nend", "def record_multi_select_field(name, current, options = {})\n options[:controller] ||= current.first.class.to_s.pluralize.underscore\n options[:params] ||= {}\n options[:id] ||= name.gsub(/[\\[\\]]/, '_')\n\n controller = assert_controller_responds(options[:controller])\n\n current = current.inject([]) { |memo, record| memo.push({:id => record.id, :label => label_for_field(record, controller)}) }\n\n url = url_for({:action => :browse, :controller => options[:controller], :escape => false}.merge(options[:params]))\n\n html = text_field_tag(\"#{name}[]\", nil, :autocomplete => 'off', :id => options[:id], :class => options[:class], :onfocus => \"this.focused=true\", :onblur => \"this.focused=false\")\n html << content_tag('ul', '', :class => 'record-select-list');\n html << javascript_tag(\"new RecordSelect.Multiple(#{options[:id].to_json}, #{url.to_json}, {current: #{current.to_json}});\")\n\n return html\n end", "def forms; end", "def find_or_create_collection_ids\n return self.collection_ids if collections_created?\n if sets.blank? || parser.collection_name != 'all'\n # c = Collection.where(Bulkrax.system_identifier_field => importerexporter.unique_collection_identifier(parser.collection_name)).first\n collection = find_collection(importerexporter.unique_collection_identifier(parser.collection_name))\n self.collection_ids << collection.id if collection.present? && !self.collection_ids.include?(collection.id)\n else # All - collections should exist for all sets\n sets.each do |set|\n c = Collection.find_by(work_identifier => importerexporter.unique_collection_identifier(set.content))\n self.collection_ids << c.id if c.present? && !self.collection_ids.include?(c.id)\n end\n end\n return self.collection_ids\n end", "def collection_name; end", "def collection_name; end", "def collection_name; end", "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end", "def display_parent_collections(document)\n\n text=\"\"\n parents = document.display_sets\n if parents.kind_of?(Array) and parents.count > 0\n unless parents.count == 1 && parents.first == \"info:fedora/hull:rootDisplaySet\"\n text = <<-EOS\n <div id=\"collections\" >\n <fieldset id=\"collection-fields\">\n <legend>#{pluralize(parents.count,\"In Collection\")[2..-1]}</legend>\n <div id=\"collections-list\">\n <dl>\n EOS\n parents.each { |id| \n pid=id.partition(\"/\")[2]\n text << <<-EOS\n <dt>\n EOS\n text << link_to(DisplaySet.name_of_set(pid), resource_path(pid)) \n text << <<-EOS\n </dt>\n EOS\n }\n text << <<-EOS\n </dl>\n </div>\n </fieldset>\n </div>\n EOS\n end\n end \n \n text.html_safe\n end", "def page_entries_info2(collection, options = {})\n collection_name = options[:collection_name] || (collection.empty?? 'entry' : collection.first.class.name.underscore.sub('_', ' '))\n \n if collection.num_pages < 2\n case collection.size\n when 0; info = \"No #{collection_name.pluralize} found\"\n when 1; info = \"Displaying <strong>1</strong> #{collection_name}\"\n else; info = \"Displaying <strong>all #{collection.size}</strong> #{collection_name.pluralize}\"\n end\n else\n offset_value = collection.per_page * (collection.current_page - 1)\n \n info = %{Displaying #{collection_name.pluralize} <strong>%d&ndash;%d</strong> of <strong>%d</strong> in total}% [\n offset_value + 1,\n offset_value + collection.length,\n collection.total_count\n ]\n end\n info.html_safe\n end", "def add_to_collection\n\n if request.post?\n # Actually add the item to the collection\n ids = request.params[:id].split(',')\n ids.each do |id|\n add_to_collection_action(request.params[:collection], id)\n end\n\n # Don't render the default \"Add to Collection\" dialog - render the \"Success!\" dialog contents\n flash[:success] ||= \"The item has been added to the collection\"\n render 'catalog/add_to_collection_success'\n end\n\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def collection_names; end", "def collection_name\n 'check_box_fields'\n end", "def fields_for_collection(collection_name, *args, &b)\n opts = args.extract_options!\n with_new_item = opts.delete(:new_item)\n obj_for_template = opts.delete(:template)\n\n if args.length > 0 && args.first.respond_to?(:to_ary)\n array = args.shift\n new_item_source = array.respond_to?(:build) ?\n array :\n object.send(collection_name)\n else\n array = object.send(collection_name)\n new_item_source = array\n end\n\n item_objects = Array.new(array)\n item_objects << array.build if with_new_item\n items = item_objects.map do |item_object|\n item = FieldsForItem.new(self, collection_name, item_object, opts, &b)\n item.wrap_as_item_element\n item\n end\n obj_for_template = new_item_source.build\n template_item = FieldsForItem.new(self, collection_name, obj_for_template, opts, &b)\n template_item.wrap_as_item_element\n template_item.wrap_as_new_item_template\n items << template_item\n items.map(&:content).inject{|m, content| m += (content + NEWLINE) }\n end", "def form_entry_param\n Array.new.tap do |arr|\n form.fields.map do |field|\n if field.field_type_range?\n arr << { field.id.to_s => [:from, :to] }\n\n elsif field.field_type_datetime?\n arr << { field.id.to_s => [:date, :hours, :minutes] }\n\n elsif field.field_type_address?\n arr << { field.id.to_s => [:address, :city, :postal_code, :country] }\n\n elsif field.field_type_question_group?\n # TO DO\n arr << { 'field.id' => [ 'row_10' ] }\n\n elsif field.field_type_checkbox? || field.field_type_mcq?\n arr << { field.id.to_s => [] }\n\n elsif field.field_type_statement?\n # TO DO\n field.properties['statements'].each do |key, value|\n arr << field.id.to_s + \"_#{key}\"\n end\n\n elsif field.field_type_file?\n arr << field.id.to_s\n\n else\n arr << field.id.to_s\n end\n end\n end\n end", "def collection\n instance_variable_get(collection_name) || set_collection(find_collection)\n end", "def create\n @collection = Collection.new(params[:collection])\n\n # scrape each resource URL to add those fields\n @collection.collectionizes.each do |each_collectionize|\n resource_object = Resource.scrape_data(each_collectionize.resource.raw_url)\n\n each_collectionize.resource\n resource_object = Resource.scrape_data(@resource.raw_url)\n each_collectionize.resource.keywords_scraped = resource_object[:keywords_scraped] ? resource_object[:keywords_scraped] : nil\n each_collectionize.resource.description_scraped = resource_object[:description_scraped] ? resource_object[:description_scraped] : nil\n each_collectionize.resource.title_scraped = resource_object[:title_scraped] ? resource_object[:title_scraped] : nil\n each_collectionize.resource.raw_html = resource_object[:raw_html] ? resource_object[:raw_html] : nil\n end\n\n respond_to do |format|\n if @collection.save\n redirect_to @collection, notice: 'Collection was successfully created.'\n else\n render action: \"new\"\n end\n end\n end", "def read_drg_cms_form\r\n table_name = decamelize_type(params[:table].strip)\r\n @tables = table_name.split(';').inject([]) { |r,v| r << [v.classify.constantize, v] }\r\n# split ids passed when embedded document\r\n ids = params[:ids].to_s.strip.downcase\r\n @ids = ids.split(';').inject([]) { |r,v| r << v }\r\n# formname defaults to last table specified\r\n formname = params[:formname] || @tables.last[1]\r\n @form = YAML.load_file( dc_find_form_file(formname) )\r\n# when form extends another form file. \r\n if @form['extend']\r\n form = YAML.load_file( dc_find_form_file(@form['extend']) )\r\n @form = forms_merge(form, @form)\r\n end\r\n# add readonly key to form if readonly parameter is passed in url\r\n @form['readonly'] = 1 if params['readonly'] #and %w(1 yes true).include?(params['readonly'].to_s.downcase.strip)\r\n# !!!!!! Always use strings for key names since @parms['table'] != @parms[:table]\r\n @parms = { 'table' => table_name, 'ids' => params[:ids], 'formname' => formname,\r\n 'return_to' => params['return_to'], 'edit_only' => params['edit_only'],\r\n 'readonly' => params['readonly'] \r\n }\r\nend", "def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end", "def update!(**args)\n @collection = args[:collection] if args.key?(:collection)\n end", "def assemble_collection_specific\n # TODO custom field text_type_k\n end", "def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end", "def sub_collection\n if match = @result.match(/\\[#{@field}\\](.*)\\[\\/#{@field}\\]/m) # the /m makes the dot match newlines, too!\n whole_group = match[0]\n inner_placeholders = match[1]\n inner_result = ''\n # Let the referenced object do the expanding by recursion if the collection knows placeholders\n @cur_collection.each do |item|\n inner_result << item.expand_placeholders(inner_placeholders)\n end if @cur_collection.first.respond_to?(:expand_placeholders)\n @result.gsub!(whole_group, inner_result)\n else\n @result.gsub!(@placeholder, \"END MISSING FOR #{@field}\")\n end\n end", "def set_collection\n @collection = User.find(current_user.id).collections.find(params[:id])\n end", "def collection_from_options\n if options[:collection].is_a?(Proc)\n template.instance_exec(&options[:collection])\n else\n super\n end\n end", "def new\n @collection = Collection.new\n \n 2.times { @collection.collectionizes.build.build_resource }\n\n p @collection\n p @collection.collectionizes\n p @collection.resources\n p @collection.collectionizes.first.resource\n p @collection.collectionizes.last.resource\n\n end", "def update\n @collection = Collection.find(params[:id])\n \n #Parent collection stuff\n parent_child_violation = false\n access_violation = false\n if params.include?(\"collection\") and params[:collection].include?(\"parent_id\") and params[:collection][\"parent_id\"] != \"\"\n parent_collection = Collection.find(params[:collection][\"parent_id\"])\n \n if (parent_collection.user_id != @collection.user_id)\n access_violation = true\n \n else\n #if !collection_is_parent(@collection, parent_collection)\n if !parent_collection.ancestors.include?(@collection)\n @collection.parent_id = parent_collection.id\n \n #inherits project (and permissions) of parent by default\n inherit_collection(parent_collection)\n else\n parent_child_violation = true\n end\n end #if parent\n end #if params\n \n #Update\n #do this now, so the spawn doesn't PG:Error b/c spawned code has locked @colllection\n update_collection_attrs_suc = false\n if (not parent_child_violation and not access_violation)\n update_collection_attrs_suc = @collection.update_attributes(params[:collection])\n end\n\n #Validation\n if (params.include?(\"post\") and params[:post].include?(\"ifilter_id\") and params[:post][:ifilter_id] != \"\" )\n f = get_ifilter( params[:post][:ifilter_id].to_i )\n\n validate_collection_helper(@collection, f)\n end\n \n #Add metadata from a metaform\n if (params.include?(\"post\") and params[:post].include?(\"metaform_id\") and params[:post][:metaform_id] != \"\" )\n add_collection_metaform(@collection, params[:post][:metaform_id].to_i)\n end\n\n #Add to my project\n if (params.include?(\"proj\") and params[:proj].include?(\"id\") and params[:proj][:id] != \"\" )\n project = Project.find( params[:proj][:id] )\n add_project_col(project, @collection) #call to collection helper, adds collection to project\n end\n \n #Add selected upload as a note to the collection\n if (params.include?(\"note\") and params[\"note\"].include?(\"upload_id\") and (!params[\"note\"][\"upload_id\"].blank?) )\n add_note_collection( params[\"note\"][\"upload_id\"] )\n end\n\n if (params.include?(\"remove_ids\") and (!params[\"remove_ids\"].blank?) )\n remove_notes_collection( params[\"remove_ids\"] ) #Remove notes\n end\n\n=begin\n #Add to other project (as editor)\n if (params.include?(\"ed_proj\") and params[:ed_proj].include?(\"pro_id\") and params[:ed_proj][:pro_id] != \"\" )\n project = Project.find( params[:ed_proj][:pro_id] )\n add_project_col(project, @collection) #from collection helper\n end\n=end\n #Recursive remove from project\n if params.include?(\"remove_project\")\n params[\"remove_project\"].each do |k,v|\n if v.to_i == 1\n project = Project.find(k.to_i)\n @collection.projects.delete project\n @collection.descendants.each do |c|\n if !c.projects.empty?\n c.projects.delete project\n end\n end\n end\n end\n end\n\n respond_to do |format|\n if access_violation\n @collection.errors.add(:base, \"You are not authorized to do that.\")\n format.html { render action: \"edit\" }\n elsif parent_child_violation \n #flash[:error] = \"Warning: cannot set parent collection to a child.\"\n @collection.errors.add(:base, \"Cannot set parent collection to a child.\")\n format.html { render action: \"edit\" }\n elsif update_collection_attrs_suc\n format.html { redirect_to edit_collection_path(@collection), notice: 'Collection was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def reformat_multiselect_params_format\n params = @associations[\"0\"][:element_id]\n params.each_with_index do |id, idx|\n @associations[(idx + 1).to_s] = { element_id: id, \"_destroy\" => \"0\" } if id.present?\n end\n @associations.delete(\"0\")\n end", "def set_filter_collection\n # @category_collection = Schedule::CATEGORY\n @applicant_collection = current_company.applicants.are_qualified.map{|applicant| [applicant.name, applicant.id, {\"data-job-id\": applicant.job_id}]}\n @job_collection = current_company.jobs.published_and_closed_jobs.map{|job| [job.title, job.id]}\n end", "def set_collection_name(name)\n @collection_name = name\n end", "def collection_or_multi_id_collection\n if multi_ids_request?\n selector = {multi_id_key => multi_ids}\n set_collection(resource_class.in(selector))\n else\n collection\n end\n end", "def update\n new_collections = []\n unapproved_collections = []\n errors = []\n params[:bookmark][:collection_names].split(',').map {|name| name.strip}.uniq.each do |collection_name|\n collection = Collection.find_by_name(collection_name)\n if @bookmark.collections.include?(collection)\n next\n elsif collection.closed? && !collection.user_is_maintainer?(User.current_user)\n errors << ts(\"#{collection.title} is closed to new submissions.\")\n elsif @bookmark.add_to_collection(collection) && @bookmark.save\n if @bookmark.approved_collections.include?(collection)\n new_collections << collection\n else\n unapproved_collections << collection\n end\n else\n errors << ts(\"Something went wrong trying to add collection #{collection.title}, sorry!\") \n end\n end\n\n # messages to the user\n unless errors.empty?\n flash[:error] = ts(\"We couldn't add your submission to the following collections: \") + errors.join(\"<br />\")\n end\n flash[:notice] = \"\" unless new_collections.empty? && unapproved_collections.empty?\n unless new_collections.empty?\n flash[:notice] = ts(\"Added to collection(s): %{collections}.\",\n :collections => new_collections.collect(&:title).join(\", \"))\n end\n unless unapproved_collections.empty?\n flash[:notice] += \"<br />\" + ts(\"Your addition will have to be approved before it appears in %{moderated}.\",\n :moderated => unapproved_collections.collect(&:title).join(\", \"))\n end\n\n flash[:notice] = (flash[:notice]).html_safe unless flash[:notice].blank?\n flash[:error] = (flash[:error]).html_safe unless flash[:error].blank?\n\n if errors.empty?\n if @bookmark.update_attributes(params[:bookmark])\n flash[:notice] = ts(\"Bookmark was successfully updated.\")\n redirect_to(@bookmark)\n end\n else\n @bookmark.update_attributes(params[:bookmark])\n @bookmarkable = @bookmark.bookmarkable\n render :edit and return\n end\n end" ]
[ "0.59690523", "0.58365697", "0.5706671", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.52648", "0.5254219", "0.5243418", "0.5215959", "0.5183274", "0.5183274", "0.5175138", "0.51521707", "0.51381135", "0.5131323", "0.5103109", "0.5081089", "0.5080409", "0.5043367", "0.5023624", "0.50108963", "0.4988542", "0.49516463", "0.4949521", "0.49294838", "0.49105677", "0.4901902", "0.48844576", "0.48790866", "0.48582017", "0.4851809", "0.4840452", "0.48297578", "0.4815448", "0.480999", "0.48004422", "0.47934812", "0.47891927", "0.47786418", "0.4769046", "0.4763644", "0.47301686", "0.46899813", "0.46848738", "0.4676248", "0.4676248", "0.4676248", "0.46702477", "0.46696454", "0.46617013", "0.46599492", "0.4649553", "0.46494463", "0.4639287", "0.46291074", "0.46231395", "0.46175703", "0.4617418", "0.4617418", "0.4617418", "0.46118203", "0.4601008", "0.45948339", "0.4590609", "0.4583509", "0.4583509", "0.4583509", "0.4583509", "0.45824885", "0.4575331", "0.45692176", "0.4569081", "0.4563465", "0.45603472", "0.4553253", "0.45516598", "0.45504093", "0.45487902", "0.45449123", "0.45421335", "0.45352846", "0.45270002", "0.45264238", "0.45262426", "0.45242766", "0.45214012", "0.45207143", "0.4513329", "0.4512871" ]
0.65107536
0
Changes: 1. 'base' should be an instance of Form 2. If form has entries_separated flat and collection name is entries, clone a new context because it is build each time when called and set to context. Then remove form_id from selector because all the entries inside the new collection has the same form_id
def criteria_with_separated_entries cri = criteria_without_separated_entries query_class = cri.instance_variable_get :@klass if should_query_from_separated_collection? query_class context = cri.context.clone context.collection.instance_variable_set :@name, "#{query_class.separated_collection_prefix}#{base.id}" cri.instance_variable_set :'@collection', @collection # cri.selector.except!('form_id') end cri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_context_with_separated_entries\n context = create_context_without_separated_entries\n query_class = instance_variable_get :@klass\n if should_query_from_separated_collection? query_class\n new_collection_name = query_class.separated_collection_prefix + separated_value(query_class)\n # self.selector.except!('form_id')\n # filter = context.instance_variable_get(:@view).filter.except('form_id')\n # context.instance_variable_get(:@view).instance_variable_set :@filter, filter\n context.collection.instance_variable_set :@name, new_collection_name\n collection.instance_variable_set :@name, new_collection_name\n end\n instance_variable_set :@context, context\n context\n end", "def nested_forms\n []\n end", "def clone_associations\n new_form = OregonDigital::Metadata::IngestFormContainer.new(\n :asset_map => @asset_map,\n :template_map => @template_map,\n :asset_class => @asset_class,\n :cloneable => true\n )\n for assoc in @form.associations.select {|assoc| assoc.clone == true}\n new_form.form.add_association(assoc) if assoc.clone\n end\n\n new_form.add_blank_groups\n\n return new_form\n end", "def build_ingest_form\n super\n @form.association_class = OregonDigital::Metadata::CloneableAssociation if @cloneable\n end", "def forms; end", "def build_subline_form(action,caption)\n\n\tline_config_codes = LineConfig.find_by_sql('select distinct line_config_code from line_configs').map{|g|[g.line_config_code]}\n\tline_config_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\t field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_code'}\n\n\t field_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (line_config_id) on related table: line_configs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'line_config_code',\n\t\t\t\t\t\t:settings => {:list => line_config_codes}}\n\n\tbuild_form(nil,field_configs,action,'subline',caption)\n\nend", "def setup_form\n build_form\n super\n end", "def apply_form_for_options!(object_or_array, options)\n options.merge! :builder => WebSgFormBuilder\n super\n end", "def import_from_previous_forms\n\t\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t\t# NEED ONLY TO LIST FORMS THAT I ARE NOT ALREADY BORROWING FROM THE CURRENT??\n\t\t@previous_extraction_forms = ExtractionForm.find(:all,:conditions=>[\"project_id = ? AND id <> ?\",params[:project_id], params[:extraction_form_id]])\n\t\t\n\t\t@assigned_questions_hash, @included_sections_hash,@checked_boxes = [Hash.new,Hash.new,Hash.new]\n\t\t# for each of the previously existing forms\n\t\t@previous_extraction_forms.each do |ef|\n\t\t\t\n\t\t\t# get the key questions assigned\n\t\t\t@assigned_questions_hash[ef.id] = ExtractionForm.get_assigned_question_numbers(ef.id)\n\t\t\t\t\n\t\t\t# get the sections included\n\t\t\t@included_sections_hash[ef.id] = ExtractionFormSection.get_included_sections_by_extraction_form_id(ef.id)\t\n\t\t\t@borrowers = ExtractionFormSectionCopy.get_borrowers(params[:extraction_form_id])\n\t\t\t\t\n\t\t\t# determine which boxes should already be checked\n\t\t\talready_entered = ExtractionFormSectionCopy.get_previous_data(params[:extraction_form_id], ef.id)\n\t\t\talready_entered = already_entered.collect{|x| x.section_name}\n\t\t\t@checked_boxes[ef.id] = already_entered\n\t\t\t\t\n\t\t\t# get rid of key questions and publications\n\t\t\t@included_sections_hash[ef.id].delete_at(0);@included_sections_hash[ef.id].delete_at(0);\n\t\t\t\n\t\tend\n\tend", "def create\n @group = @form.group.descendants.where.not(type: Form::CollectionGroup).find(params[:id])\n @model = build_form_model(@group)\n model_params = params.fetch(:form, {}).permit!\n @instance = @model.new model_params\n if @instance.valid?\n render :create\n else\n render :show\n end\n end", "def pe_many_collection_details(details, form)\n details.each_with_index do |detail_to_ids,idx|\n detail = detail_to_ids[0]\n detail_name_plural ||= detail.class.to_s.tableize\n detail_name ||= detail_name_plural.singularize\n if detail.person.user == current_user\n form.fields_for \"#{detail_name_plural}_attributes[]\", detail,\n :index => \"new_#{idx}\" do |form_detail|\n concat(render(:partial => 'people/'+detail_name, :object => form_detail))\n end\n else\n concat(self.send('p_'+detail_name, detail))\n end\n end\n end", "def create_context_with_separated\n context = create_context_without_separated\n query_class = instance_variable_get :@klass\n new_collection_name = calc_new_collection_name query_class\n unless new_collection_name.blank?\n context.collection.instance_variable_set :@name, new_collection_name\n collection.instance_variable_set :@name, new_collection_name\n end\n instance_variable_set :@context, context\n context\n end", "def form_class\n Hyrax::CalifornicaCollectionsForm\n end", "def show\n @join_forms = JoinForm.where([\"#{@klass}_id=?\", @supergroup.id])\n end", "def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end", "def show\n @group = @form.group.descendants.where.not(type: Form::CollectionGroup).find(params[:id])\n @model = build_form_model(@group)\n @instance = @model.new params.fetch(:form, {}).permit!\n end", "def _new_form(id, atrb = Hashx.new)\n self[id] = context_module('Form').new(@cfg, atrb.update(id: id))\n end", "def fields_for_sti(form, many, add)\n object = form.object\n add.each{|klass| object.send(many).build :type => klass }\n\n index = -1\n form.fields_for many do |vf|\n index += 1\n yield vf, index\n end\n end", "def process_collections #:nodoc\r\n # If result_set is not defined on form, then it will fail. :return_to should know where to go\r\n if @form['result_set'].nil?\r\n process_return_to(params[:return_to] || 'reload')\r\n return true\r\n end\r\n # when result set is evaluated as Rails helper\r\n @form['result_set']['type'] ||= 'default'\r\n return unless @form['result_set']['type'] == 'default'\r\n\r\n # for now enable only filtering of top level documents\r\n if @tables.size == 1 \r\n check_filter_options()\r\n check_sort_options()\r\n end \r\n # result set is defined by filter method in control object\r\n form_filter = @form['result_set']['filter'] || 'default_filter'\r\n if respond_to?(form_filter)\r\n @records = send(form_filter)\r\n # something went wrong. flash[] should have explanation.\r\n if @records.class == FalseClass\r\n @records = []\r\n render(action: :index)\r\n return true\r\n end\r\n process_select_and_deny_fields\r\n # pagination but only if not already set\r\n unless (@form['table'] == 'dc_memory' || (@records.respond_to?(:options) && @records.options[:limit]))\r\n per_page = (@form['result_set']['per_page'] || 25).to_i\r\n @records = @records.page(params[:page]).per(per_page) if per_page > 0\r\n end\r\n else\r\n if @tables.size > 1 \r\n rec = @tables.first[0].find(@ids.first) # top most document.id\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n # TO DO. When field name is different then pluralized class name. Not working yet.\r\n embedded_field_name = @tables.last[0] ? @tables.last[1].pluralize : @tables.last[1]\r\n @records = rec.send(embedded_field_name) # current embedded set\r\n # sort by order if order field is present in model\r\n if @tables.last[1].classify.constantize.respond_to?(:order)\r\n @records = @records.order_by(order: 1)\r\n end\r\n end\r\n end\r\n false\r\nend", "def render_has_many_form(form_builder, parent, &block)\n index = parent && form_builder.send(:parent_child_index, parent)\n template.concat template.capture { yield(form_builder, index) }\n template.concat has_many_actions(form_builder, \"\".html_safe)\n end", "def find_collections_for_form\n Hyrax::CollectionsService.new(self).search_results(:edit)\n end", "def base_model\n form_builder.object\n end", "def duplicate\n # get the base name\n base = name.match(/^(.+?)( v(\\d+))?$/)[1]\n version = (self.class.max_version(base) || 1) + 1\n # create the new form and set the basic attribs\n cloned = self.class.new(:mission_id => mission_id, :name => \"#{base} v#{version}\", :published => false, :form_type_id => form_type_id)\n # clone all the questionings\n cloned.questionings = Questioning.duplicate(questionings)\n # done!\n cloned.save\n end", "def builder\n form\n end", "def new\n nested_resource_pre_build\n nested_resource_build\n end", "def default_form_builder; end", "def form; end", "def build_contact_method_form(contact_method,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:contact_method_form]= Hash.new\n\tcontact_method_type_codes = ContactMethodType.find_by_sql('select distinct contact_method_type_code from contact_method_types').map{|g|[g.contact_method_type_code]}\n\tcontact_method_type_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (contact_method_type_id) on related table: contact_method_types\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'contact_method_type_code',\n\t\t\t\t\t\t:settings => {:list => contact_method_type_codes}}\n \n\tfield_configs[3] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'info_string'}\n\n\tbuild_form(contact_method,field_configs,action,'contact_method',caption,is_edit)\n\nend", "def read_drg_cms_form\r\n table_name = decamelize_type(params[:table].strip)\r\n @tables = table_name.split(';').inject([]) { |r,v| r << [v.classify.constantize, v] }\r\n# split ids passed when embedded document\r\n ids = params[:ids].to_s.strip.downcase\r\n @ids = ids.split(';').inject([]) { |r,v| r << v }\r\n# formname defaults to last table specified\r\n formname = params[:formname] || @tables.last[1]\r\n @form = YAML.load_file( dc_find_form_file(formname) )\r\n# when form extends another form file. \r\n if @form['extend']\r\n form = YAML.load_file( dc_find_form_file(@form['extend']) )\r\n @form = forms_merge(form, @form)\r\n end\r\n# add readonly key to form if readonly parameter is passed in url\r\n @form['readonly'] = 1 if params['readonly'] #and %w(1 yes true).include?(params['readonly'].to_s.downcase.strip)\r\n# !!!!!! Always use strings for key names since @parms['table'] != @parms[:table]\r\n @parms = { 'table' => table_name, 'ids' => params[:ids], 'formname' => formname,\r\n 'return_to' => params['return_to'], 'edit_only' => params['edit_only'],\r\n 'readonly' => params['readonly'] \r\n }\r\nend", "def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end", "def nested_field_set(f, assoc, options = {})\n wrapper_partial = \"shared/nested_fields_wrapper\"\n options[:inner_partial] ||= \"#{f.object.class.model_name.route_key}/#{assoc.to_s.singularize}_fields\"\n options[:multiple] = true unless options.has_key?(:multiple)\n\n wrapper_classes = [\"nested-fields\"]\n wrapper_classes << \"no-label\" if options[:label] == false\n wrapper_classes << \"multiple\" if options[:multiple]\n\n f.input(assoc, options.slice(:required)) do\n content_tag(:div, class: \"nested-field-set\") do\n f.simple_fields_for(assoc, wrapper: :nested_fields) do |f2|\n render(wrapper_partial, f: f2, options: options, classes: wrapper_classes)\n end <<\n if options[:multiple]\n content_tag(:span) do\n link_to_add_association(t(\"cocoon.add_links.#{assoc}\"), f, assoc,\n partial: wrapper_partial,\n render_options: {\n wrapper: :nested_fields, # Simple form wrapper\n locals: {options: options, classes: wrapper_classes}\n }\n )\n end\n end\n end\n end\n end", "def crud_form(*attrs, &block)\n options = attrs.extract_options!\n attrs = default_crud_attrs - %i[created_at updated_at] if attrs.blank?\n attrs << options\n standard_form(path_args(entry), *attrs, &block)\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def build_contact_method_type_form(contact_method_type,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:contact_method_type_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_type_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_type_description'}\n\n\tbuild_form(contact_method_type,field_configs,action,'contact_method_type',caption,is_edit)\n\nend", "def build_contact_method_type_form(contact_method_type,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:contact_method_type_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_type_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'contact_method_type_description'}\n\n\tbuild_form(contact_method_type,field_configs,action,'contact_method_type',caption,is_edit)\n\nend", "def build_line_config_form(line_config,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:line_config_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_config_code'}\n\n\tbuild_form(line_config,field_configs,action,'line_config',caption,is_edit)\n\nend", "def edit_collection\n id = params[:context_id]\n klass = params[:context].classify\n @objects = BulletPoint.where(:context_id => id, :context => klass)\n @context = ModelHelper.object_for(id,klass)\n end", "def ar_form_for new_or_edit, builder\n result= \"\\n\"\n \n if new_or_edit != :new && @resource.has_attribute?(:lock_version)\n result << content_tag(:dd, builder.hidden_field(:lock_version)) << \"\\n\"\n end\n\n controller.ardata.hidden_fields.each do |hidden_attr|\n result << content_tag(:dd, builder.hidden_field(hidden_attr)) << \"\\n\"\n end\n\n collection= controller.ardata.fields.send(\"for_#{new_or_edit}\")\n \n collection.each do |column, title|\n # This skips the selection of a parent on create if the parent is present (because if the resource\n # is child of a known parent the value for the parent_id is already known.\n next if new_or_edit == :new && controller.ardata.is_column_for_current_parent(column, @parent_resource)\n\n label= ar_get_index_label(title)\n\n # Only display the field if it's not empty. This is usefull when the label\n # is built from a proc: you can decide wheter to show the field or not by \n # returning and empty label for the attribute based on certain condition.\n if label && !label.strip.empty?\n field= ar_form_method(builder, @resource, column, controller.ardata)\n result << \"#{content_tag(:dt, label)}\\n #{content_tag(:dd, field)}\\n\"\n end\n end\n\n label_key_for_submit= new_or_edit == :new ? :create : :update\n result << content_tag(:dt, submit_tag(controller.ardata.labels[label_key_for_submit])) << \"\\n\"\n \n content_tag :dl, result\n end", "def uhook_category_form form\n (form.hidden_field :content_id) + (hidden_field_tag(:from, params[:from]))\n end", "def build_new_revision\n new_revision = Form.new(version_independent_id: version_independent_id,\n description: description, parent_id: parent_id, status: status,\n version: version + 1, name: name, oid: oid,\n created_by: created_by, control_number: control_number)\n\n new_revision\n end", "def new\n @profilemaster = Profilemaster.new\n @data = FormsList.all\n @i=0\n @data.length.times { \n @[email protected]\n @na.forms = @data[@i].form_name\n @i+=1\n }\n @[email protected]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profilemaster }\n end\n end", "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "def as_flattened_form\n form_title = case form_key\n when SHS_Q2_SELF_REFLECTION then 'Q2 Self-reflection'\n when SHS_WHAT_I_WANT_MY_TEACHER_TO_KNOW_MID_YEAR then 'What I want my teachers to know'\n when BEDFORD_DAVIS_TRANSITION_NOTES_FORM then 'Transition Information'\n when BEDFORD_SIXTH_GRADE_TRANSITION_FORM then 'Transition to Grade 6'\n else 'Student voice survey'\n end\n\n # Don't include `form_url` as a defense against overly permissive permissions on\n # the form itself (outside Student Insights).\n {\n id: id,\n form_key: form_key,\n form_title: form_title,\n form_timestamp: form_timestamp,\n student_id: student_id,\n educator_id: educator_id,\n text: as_text,\n updated_at: updated_at\n }\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def new\n @collection = Collection.new\n \n 2.times { @collection.collectionizes.build.build_resource }\n\n p @collection\n p @collection.collectionizes\n p @collection.resources\n p @collection.collectionizes.first.resource\n p @collection.collectionizes.last.resource\n\n end", "def handle_form_label(vals)\n @forms << vals.last\n @form = vals.last if matches_mdes_version(vals)\n end", "def linked_forms\n flexemes = self.flexemes\n if flexemes.count > 0\n flexemes.map{|f| f.word_forms.to_a}\n else\n [self.form]\n end.flatten.uniq\n end", "def build_cold_store_type_form(cold_store_type,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:cold_store_type_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'cold_store_type_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'cold_store_name'}\n\n\tbuild_form(cold_store_type,field_configs,action,'cold_store_type',caption,is_edit)\n\nend", "def create_multiple_complex_registry_field(form,\n value,\n form_prefix,\n property_name,\n label,\n field_id,\n select_values,\n locale,\n parent_id,\n schema_id,\n required: false,\n validation: nil,\n html_class: nil,\n readonly: false,\n ttip: nil,\n default_value: nil,\n overridable: nil)\n render partial: 'dynamic_form/fields/registry/multiple_complex',\n locals: {\n f: form,\n value:,\n form_prefix:,\n property_name:,\n field_label: label,\n select_values:,\n locale:,\n parent_id:,\n schema_id:,\n field_class: html_class,\n field_id:,\n readonly:,\n required:,\n validation:,\n ttip:,\n default_value:,\n overridable:\n }\n end", "def new\n 3.times { @entity_type.entity_type_aliases.build } \n 3.times { @entity_type.form_configs.build }\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def copy_form_builders\n directory \"f3-rails/app/form_builders\", \"app/form_builders\"\n end", "def fields_for_with_form_assistant(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #fields_for()\n fields_for_without_form_assistant(record_or_name_or_array, *(args << options.merge!(:builder => self.class)), &proc)\n end", "def load_aggregatee_with_cache(params)\n if params[:id] == 'editForm'\n aggregatees[:edit_form][:item].merge!(:record_id => params[:record_id])\n end\n \n super\n end", "def duplicate_form(id)\n @client.raw('post', \"/content/forms/#{id}/duplicate\")\n end", "def apply_form(resource)\n if apply_form?\n form = form_class.new(resource)\n form.prepopulate! if prepopulate_form?\n form\n else\n resource\n end\n end", "def default_fields_for_forms\n form_klass = constantize_class_name(\"Netzke::ModelExtensions::#{config[:model]}ForFormPanel\") || original_data_class\n\n # Select only those fields that are known to the form_klass\n selected_columns = columns.select do |c|\n form_klass.column_names.include?(c[:name]) ||\n form_klass.instance_methods.include?(\"#{c[:name]}=\") ||\n association_attr?(c[:name])\n end\n\n selected_columns.map do |c|\n field_config = {:name => c[:name]}\n\n # scopes for combobox options\n field_config[:scopes] = c[:editor][:scopes] if c[:editor].is_a?(Hash)\n\n field_config\n end\n end", "def add_fields_to(formtastic_form)\n fields = {}\n formtastic_form.inputs admin_fieldset_title do\n ingredients.each do |i_id, i|\n sheet = formtastic_form.object\n content = sheet.content_for i.content_key\n #debugger\n fields[i.content_key] = formtastic_form.fields_for(content) do |i_form|\n i_form.input :text\n end\n #i.add_fields_to(formtastic_form) if i.kind_of? ActiveAdmin::Cms::Recipe::Ingredient\n end\n end\n sections.each do |s_id, s|\n fields[s_id] = s.add_fields_to(formtastic_form) if s.kind_of? ActiveAdmin::Cms::Recipe::Section\n end\n\n #debugger\n\n formtastic_form.inputs\n\n end", "def clone_for_template(document)\n dup_field = self.dup\n dup_field.document = document\n dup_field\n end", "def build_target_market_form(target_market,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:target_market_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n field_configs = Array.new\n field_configs[field_configs.length] = {:field_type => 'LabelField',\n :field_name => 'target_market_code'}\n\n field_configs[field_configs.length] = {:field_type => 'TextField',\n :field_name => 'target_market_name'}\n\n field_configs[field_configs.length] = {:field_type => 'TextField',\n :field_name => 'target_market_description'}\n\n field_configs[field_configs.length] = {:field_type => 'TextField',\n :field_name => 'target_market_country_code'}\n\n field_configs[field_configs.length] = {:field_type => 'TextField',\n :field_name => 'target_market_region_code'}\n\n field_configs[field_configs.length] = {:field_type => 'TextField',\n :field_name => 'sector_code'}\n\n\n field_configs[field_configs.length()] = {:field_type => 'LabelField', :field_name => 'du', :non_db_field => true, :settings => {:is_separator => false, :static_value => '', :css_class => \"borderless_label_field\"}}\n\n\n field_configs[field_configs.length] = {:field_type => 'CheckBox',\n :field_name => 'is_specific'}\n\n field_configs[field_configs.length] = {:field_type => 'CheckBox',\n :field_name => 'is_supermarket'}\n field_configs[field_configs.length()] = {:field_type => 'LabelField', :field_name => 'du', :non_db_field => true, :settings => {:is_separator => false, :static_value => '', :css_class => \"borderless_label_field\"}}\n\n if is_edit\n field_configs[field_configs.length()] = {:field_type => 'Screen',\n :field_name =>\"child_form1\",\n :settings =>{\n #:host_and_port => request.host_with_port.to_s,\n :controller =>\"party_manager/trade\",\n :target_action => 'list_grades',\n :width => 1000,\n :height => 225,\n :id_value => target_market.id.to_s,\n :no_scroll => true}}\n @submit_button_align = \"left\"\n set_form_layout \"2\", nil, 0, 10\n end\n\n\tbuild_form(target_market,field_configs,action,'target_market',caption,is_edit)\n\nend", "def all_forms\n\t\t\treturn [{}]\n\t\tend", "def update_form!\n form_attributes = attributes.except 'form_id', 'user_id', 'id'\n form = self.form || Form.new\n form.update form_attributes\n # Don't need to retain the fields, since the draft will be deleted.\n # Just switch them over to belonging to the form.\n form.fields.delete_all\n fields.update_all form_draft_id: nil, form_id: form.id\n delete\n end", "def insert_instant_messenger_type_options(form)\n form.collection_select :type_id, InstantMessengerType.all,\n :id, :description, {}\n end", "def deep_clone\n bi = dup\n bi.save\n feature_selections.each { |fs| bi.feature_selections << fs.dup }\n bi\n end", "def contact_detail_selector(f, current_instance)\n render partial: 'shared/resource_form/contact_detail_selector', locals: {\n f: f,\n current_instance: current_instance\n }\n end", "def form_elements(identifier)\n platform.forms_for(identifier.clone)\n end", "def contact_detail_selector(f, current_instance)\n render partial: 'common/form/contact_detail_selector', locals: {\n f: f,\n current_instance: current_instance\n }\n end", "def user_form_and_fields(admin_form_id)\n\t\tcase_form_template = AdminForm.find(admin_form_id)\n\t\tfields = []\n\t\t\n\t\tcase_form_template.form_fields.each do |field_id|\n\t\t\tadmin_field = AdminField.find(field_id)\n\t\t\tfield = current_user.user_fields.find_or_initialize_by(field_name: admin_field.field_name,field_slug:admin_field.field_slug,field_type: admin_field.field_type)\n\t\t\tif admin_field.field_type == 'select' || admin_field.field_type == 'radio'\n\t\t\t\tfield.field_options = admin_field.field_options\n\t\t\tend\n\t\t\tfield.save\n\t\t\tfields << field.id.to_s\n\t\tend\n\n\t\ti=0\n\t\tform_field_count = 1\n\t\twhile i <= current_user.user_forms.count do\n\t\t form_name = \"#{case_form_template.form_name}-#{i}\"\n\t\t if !current_user.user_forms.where(:form_name => form_name).blank?\n\t\t form_field_count += 1\n\t\t end\n\t\t i +=1\n\t\tend\n\t\t\n\t\tform = current_user.user_forms.find_or_initialize_by(form_name: \"#{case_form_template.form_name}-#{form_field_count}\",form_name_slug:case_form_template.form_name_slug, form_fields:fields)\n\t\tform.form_fields=form.form_fields.to_a+params[:case_user_fields_ids].to_a\n\t\tform.save\n\t\treturn form\n\tend", "def new\n @object ||= @Klass.new\n @update_span = params[:update]\n @parent_class = params[:parent_class]\n begin\n @parent_id = params[:parent_id]\n foreign_key = @Klass.reflect_on_association(@parent_class.underscore.to_sym).options[:foreign_key] || @parent_class.foreign_key\n @object[foreign_key] = @parent_id\n end unless @parent_class.nil? || @Klass.reflect_on_association(@parent_class.underscore.to_sym).nil?\n\n @object.inline_forms_attribute_list = @inline_forms_attribute_list if @inline_forms_attribute_list\n respond_to do |format|\n format.html { render 'inline_forms/_new', :layout => 'inline_forms' } unless @Klass.not_accessible_through_html?\n format.js { }\n end\n end", "def build_standard_size_count_form(standard_size_count,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:standard_size_count_form]= Hash.new\n\tstandard_count_values = StandardCount.find_by_sql('select distinct standard_count_value from standard_counts').map{|g|[g.standard_count_value]}\n\tstandard_count_values.unshift(\"<empty>\")\n\tcommodity_codes = Commodity.find_by_sql('select distinct commodity_code from commodities').map{|g|[g.commodity_code]}\n\tcommodity_codes.unshift(\"<empty>\")\n\tbasic_pack_codes = BasicPack.find_by_sql('select distinct basic_pack_code from basic_packs').map{|g|[g.basic_pack_code]}\n\tbasic_pack_codes.unshift(\"<empty>\")\n\told_pack_codes = OldPack.find_by_sql('select distinct old_pack_code from old_packs').map{|g|[g.old_pack_code]}\n\told_pack_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'standard_size_count_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (commodity_id) on related table: commodities\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'commodity_code',\n\t\t\t\t\t\t:settings => {:list => commodity_codes}}\n \n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'diameter_mm'}\n\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (old_pack_id) on related table: old_packs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[3] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'old_pack_code',\n\t\t\t\t\t\t:settings => {:list => old_pack_codes}}\n \n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (standard_count_id) on related table: standard_counts\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[4] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'standard_size_count_value',\n\t\t\t\t\t\t:settings => {:list => standard_count_values}}\n \n\n\tfield_configs[5] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'actual_count'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (basic_pack_id) on related table: basic_packs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[6] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'basic_pack_code',\n\t\t\t\t\t\t:settings => {:list => basic_pack_codes}}\n\t#NAE 2015-04-17 add new field average_weight_gm\n\tfield_configs[7] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'average_weight_gm'}\n \n\tbuild_form(standard_size_count,field_configs,action,'standard_size_count',caption,is_edit)\n\nend", "def default_fields_for_forms\n [\n { name: :get_verbose_conflicting_row, width: 50,\n label: I18n.t('admin_import.conflicting_row')\n },\n { name: :import_text, flex: 1, label: I18n.t('admin_import.import_text') },\n\n { name: :name, width: 180, label: I18n.t('activerecord.attributes.team.name') },\n { name: :badge_number, width: 100, label: I18n.t('activerecord.attributes.team.zip') },\n\n { name: :data_import_city__name, width: 200,\n label: I18n.t('activerecord.models.data_import_city')\n },\n { name: :city__get_full_name, width: 200, label: I18n.t('activerecord.models.city')\n }\n ]\n end", "def deep_copy(src)\n field = Field.find(src)\n name = field.name\n if (name !~ /\\(copy\\)\\s*$/)\n name += \" (copy)\"\n end\n self.name = field.parent_id ? field.name : name\n self.group_id = field.group_id\n self.parent_id = field.parent_id\n self.is_required = field.is_required\n self.is_multi = field.is_multi\n self.type = field.type\n self.par_hi_lim = field.par_hi_lim\n self.par_lo_lim = field.par_lo_lim\n self.display_as = field.display_as\n self.save\n field.limits.each do |l|\n newL = l.clone :except => :field_id\n newL.field_id = self.id\n newL.save\n end\n field.children.each do |k|\n newK = Field.new\n newK.deep_copy(k.id)\n newK.parent_id = self.id\n newK.save\n end\n return self.id\n end", "def new\n @all_properties = Property.all.sort!{|x,y| x.name <=> y.name}\n @all_prods_comps = (Product.all + Component.all).sort!{|x,y| x.name <=> y.name}\n @all_products = Product.all\n @components = []\n @products = []\n @all_products = Product.all\n @all_components = Component.all\n\n #if statement for duplicating a record\n if params[:duplicate_valuefield]\n #Assign value to be duplicated\n value_to_duplicate = Valuefield.find params[:duplicate_valuefield]\n #set value to duplicated info minus id\n @valuefield = value_to_duplicate.dup\n #Global Variables for duplicate\n @property = value_to_duplicate.property\n @items_to_select = value_to_duplicate.components + value_to_duplicate.products\n else\n #New category\n @valuefield = Valuefield.new\n if(!params[:property_id].nil?)\n @property = Property.find(params[:property_id])\n end\n if(!params[:component_id].nil?)\n @items_to_select = [Component.find(params[:component_id])]\n end\n\n if(!params[:product_id].nil?)\n @items_to_select = [Product.find(params[:product_id])]\n end\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @valuefield }\n end\n end", "def default_fields_for_forms\n [\n { :name => :le_title__get_full_name, :field_label => I18n.t(:le_title, {:scope=>[:activerecord, :models]}),\n # [20121121] For the combo-boxes to have a working query after the 4th char is entered in the edit widget,\n # a lambda statement must be used. Using a pre-computed scope from the Model class prevents Netzke\n # (as of this version) to append the correct WHERE clause to the scope itself (with an inline lambda, instead, it works).\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :name, :field_label => I18n.t(:name) },\n { :name => :surname, :field_label => I18n.t(:surname) },\n { :name => :le_contact_type__get_full_name, :field_label => I18n.t(:le_contact_type, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :is_suspended, :field_label => I18n.t(:is_suspended),\n :default_value => false, :unchecked_value => 'false',\n :field_style => 'min-height: 13px; padding-left: 13px;'\n },\n { :name => :address, :field_label => I18n.t(:address) },\n { :name => :le_city__get_full_name, :field_label => I18n.t(:le_city, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC, area ASC\") }\n },\n { :name => :tax_code, :field_label => I18n.t(:tax_code) },\n { :name => :vat_registration, :field_label => I18n.t(:vat_registration) },\n { :name => :date_birth, :field_label => I18n.t(:date_birth) },\n { :name => :phone_home, :field_label => I18n.t(:phone_home) },\n { :name => :phone_work, :field_label => I18n.t(:phone_work) },\n { :name => :phone_cell, :field_label => I18n.t(:phone_cell) },\n { :name => :phone_fax, :field_label => I18n.t(:phone_fax) },\n { :name => :e_mail, :field_label => I18n.t(:e_mail) },\n\n { :name => :date_last_met, :field_label => I18n.t(:date_last_met) },\n { :name => :notes, :field_label => I18n.t(:notes), :width => 200 },\n { :name => :personal_notes, :field_label => I18n.t(:personal_notes), :width => 200 },\n { :name => :family_notes, :field_label => I18n.t(:family_notes), :width => 200 }\n ]\n end", "def build_entry\n model_scope.new\n end", "def search_context\n builder = Builder.new(view_context)\n\n builder.with_snippet(@snippet) if @snippet.present?\n @snippets.each(&builder.method(:with_snippet)) if @snippets.present?\n builder.with_project(@project) if @project.present? && @project.persisted?\n builder.with_group(@group) if @group.present? && @group.persisted?\n builder.with_ref(@ref) if @ref.present?\n\n builder.build!\n end", "def index\n @joining_forms = JoiningForm.all\n end", "def collection_name\n 'form_reference_fields'\n end", "def build_mark_form(mark,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:mark_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'mark_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'mark_name'}\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'brand_code'}\n\n field_configs[3] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'external_description'}\n\n\tbuild_form(mark,field_configs,action,'mark',caption,is_edit)\n\nend", "def forms_fields(form, action)\n section_fields = []\n form.form_sections.each do |section|\n if section['permissions'][\"#{current_user.role.short_name}\"][action] == '1'\n section_fields << section.section_fields.map do |field|\n if field.field_type.field_type.start_with?('select') && field.field_type.options['multivalue'] == '1'\n { field.id.to_s.to_sym => [] }\n else\n field.id.to_s.to_sym\n end\n end\n end\n end\n section_fields\n end", "def form_objects\n BaseForm.descendants.map(&:name).grep(/^Steps::/)\nend", "def add_full_set_link(form_builder)\n link_to_function 'Extra Full Set' do |page|\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'laptop', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'interface_box', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'pads', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n end\n end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end", "def initialize(form)\n @expander = FormExpander.new(form)\n end", "def edit_form\n parsed = Namae::Name.parse(current_user.name)\n generic_file = ::GenericFile.new(creator: [parsed.sort_order], title: @batch.generic_files.map(&:label))\n edit_form_class.new(generic_file)\n end", "def purge_nested_form\n self.target_hostnames.find_all{|r| r.marked_for_destruction?}.each do |c|\n c.delete\n end\n end", "def setup_submission_form\n @filters = current_profile.filters\n tags = current_profile.submissions.tag_counts_on(:tags)\n tags = tags.sort_by { |tag| tag.count }.reverse\n @common_tags = tags.collect { |tag| tag.name }[0,8]\n @folders = current_profile.submission_folders.reject { |f| f.is_permanent? }\n end", "def inline_mtm_edit_forms(obj)\n assocs = model.inline_mtm_assocs(request)\n return if assocs.empty?\n\n t = String.new\n t << \"<div class='inline_mtm_add_associations'>\"\n assocs.each do |assoc|\n form_attr = form_attributes(:action=>url_for(\"mtm_update/#{model.primary_key_value(obj)}?association=#{assoc}&redir=edit\"), :class => 'mtm_add_associations', 'data-remove' => \"##{assoc}_remove_list\")\n t << Forme.form(obj, form_attr, form_opts(form_attr[:action])) do |f|\n opts = model.column_options_for(:mtm_edit, request, assoc)\n add_opts = opts[:add] ? opts.merge(opts.delete(:add)) : opts.dup\n add_opts = {:name=>'add[]', :id=>\"add_#{assoc}\"}.merge!(add_opts)\n if model.association_autocomplete?(assoc, request)\n f.input(assoc, {:type=>'text', :class=>'autoforme_autocomplete', :attr=>{'data-type'=>'association', 'data-column'=>assoc, 'data-exclude'=>model.primary_key_value(obj)}, :value=>''}.merge!(add_opts))\n else\n f.input(assoc, {:dataset=>model.unassociated_mtm_objects(request, assoc, obj), :multiple=>false, :add_blank=>true}.merge!(add_opts))\n end\n f.button(:value=>'Add', :class=>'btn btn-xs btn-primary')\n end\n end\n t << \"</div>\"\n t << \"<div class='inline_mtm_remove_associations'><ul>\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"<ul id='#{assoc}_remove_list'>\"\n obj.send(assoc).each do |assoc_obj|\n t << mtm_edit_remove(assoc, mc, obj, assoc_obj)\n end\n t << \"</ul></li>\"\n end\n t << \"</ul></div>\"\n end", "def set_form\n #@form = Form.find(params[:id])\n end", "def set_form_vars\n form_instance_vars\n\n @edit = {}\n @edit[:ems_id] = @ems.id\n @edit[:key] = \"ems_edit__#{@ems.id || \"new\"}\"\n @edit[:new] = {}\n @edit[:current] = {}\n\n @edit[:new][:name] = @ems.name\n @edit[:new][:provider_region] = @ems.provider_region\n @edit[:new][:hostname] = @ems.hostname\n @edit[:new][:emstype] = @ems.emstype\n @edit[:new][:port] = @ems.port\n @edit[:new][:api_version] = @ems.api_version\n @edit[:new][:provider_id] = @ems.provider_id\n\n if @ems.kind_of?(ManageIQ::Providers::Openstack::CloudManager) ||\n @ems.kind_of?(ManageIQ::Providers::Openstack::InfraManager)\n # Special behaviour for OpenStack while keeping it backwards compatible for the rest\n @edit[:protocols] = retrieve_openstack_security_protocols\n else\n @edit[:protocols] = [['Basic (SSL)', 'ssl'], ['Kerberos', 'kerberos']]\n end\n\n if @ems.kind_of?(ManageIQ::Providers::Openstack::CloudManager) ||\n @ems.kind_of?(ManageIQ::Providers::Openstack::InfraManager)\n # Special behaviour for OpenStack while keeping it backwards compatible for the rest\n @edit[:new][:default_security_protocol] = @ems.security_protocol ? @ems.security_protocol : 'ssl'\n else\n if @ems.id\n # for existing provider before this fix, set default to ssl\n @edit[:new][:default_security_protocol] = @ems.security_protocol ? @ems.security_protocol : 'ssl'\n else\n @edit[:new][:default_security_protocol] = 'kerberos'\n end\n end\n\n @edit[:new][:realm] = @ems.realm if @edit[:new][:emstype] == \"scvmm\"\n if @ems.zone.nil? || @ems.my_zone == \"\"\n @edit[:new][:zone] = \"default\"\n else\n @edit[:new][:zone] = @ems.my_zone\n end\n\n @edit[:server_zones] = Zone.order('lower(description)').collect { |z| [z.description, z.name] }\n\n @edit[:openstack_infra_providers] = ManageIQ::Providers::Openstack::Provider.order('lower(name)').each_with_object([[\"---\", nil]]) do |openstack_infra_provider, x|\n x.push([openstack_infra_provider.name, openstack_infra_provider.id])\n end\n\n @edit[:openstack_api_versions] = retrieve_openstack_api_versions\n @edit[:nuage_api_versions] = retrieve_nuage_api_versions\n @edit[:vmware_cloud_api_versions] = retrieve_vmware_cloud_api_versions\n\n @edit[:new][:default_userid] = @ems.authentication_userid\n @edit[:new][:default_password] = @ems.authentication_password\n @edit[:new][:default_verify] = @ems.authentication_password\n\n @edit[:new][:metrics_userid] = @ems.has_authentication_type?(:metrics) ? @ems.authentication_userid(:metrics).to_s : \"\"\n @edit[:new][:metrics_password] = @ems.has_authentication_type?(:metrics) ? @ems.authentication_password(:metrics).to_s : \"\"\n @edit[:new][:metrics_verify] = @ems.has_authentication_type?(:metrics) ? @ems.authentication_password(:metrics).to_s : \"\"\n\n @edit[:new][:amqp_userid] = @ems.has_authentication_type?(:amqp) ? @ems.authentication_userid(:amqp).to_s : \"\"\n @edit[:new][:amqp_password] = @ems.has_authentication_type?(:amqp) ? @ems.authentication_password(:amqp).to_s : \"\"\n @edit[:new][:amqp_verify] = @ems.has_authentication_type?(:amqp) ? @ems.authentication_password(:amqp).to_s : \"\"\n\n @edit[:new][:ssh_keypair_userid] = @ems.has_authentication_type?(:ssh_keypair) ? @ems.authentication_userid(:ssh_keypair).to_s : \"\"\n @edit[:new][:ssh_keypair_password] = @ems.has_authentication_type?(:ssh_keypair) ? @ems.authentication_key(:ssh_keypair).to_s : \"\"\n\n @edit[:new][:bearer_token] = @ems.has_authentication_type?(:bearer) ? @ems.authentication_token(:bearer).to_s : \"\"\n @edit[:new][:bearer_verify] = @ems.has_authentication_type?(:bearer) ? @ems.authentication_token(:bearer).to_s : \"\"\n\n if @ems.kind_of?(ManageIQ::Providers::Vmware::InfraManager)\n @edit[:new][:host_default_vnc_port_start] = @ems.host_default_vnc_port_start.to_s\n @edit[:new][:host_default_vnc_port_end] = @ems.host_default_vnc_port_end.to_s\n end\n @edit[:ems_types] = model.supported_types_and_descriptions_hash\n @edit[:saved_default_verify_status] = nil\n @edit[:saved_metrics_verify_status] = nil\n @edit[:saved_bearer_verify_status] = nil\n @edit[:saved_amqp_verify_status] = nil\n set_verify_status\n\n @edit[:current] = @edit[:new].dup\n session[:edit] = @edit\n end", "def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end", "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], party: self, details: details)\n end\n end", "def sub_collection\n if match = @result.match(/\\[#{@field}\\](.*)\\[\\/#{@field}\\]/m) # the /m makes the dot match newlines, too!\n whole_group = match[0]\n inner_placeholders = match[1]\n inner_result = ''\n # Let the referenced object do the expanding by recursion if the collection knows placeholders\n @cur_collection.each do |item|\n inner_result << item.expand_placeholders(inner_placeholders)\n end if @cur_collection.first.respond_to?(:expand_placeholders)\n @result.gsub!(whole_group, inner_result)\n else\n @result.gsub!(@placeholder, \"END MISSING FOR #{@field}\")\n end\n end", "def build_postal_address_type_form(postal_address_type,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:postal_address_type_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'postal_address_type_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'address_type_code'}\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'postal_address_type_description'}\n\n\tbuild_form(postal_address_type,field_configs,action,'postal_address_type',caption,is_edit)\n\nend", "def record_multi_select_field(name, current, options = {})\n options[:controller] ||= current.first.class.to_s.pluralize.underscore\n options[:params] ||= {}\n options[:id] ||= name.gsub(/[\\[\\]]/, '_')\n\n controller = assert_controller_responds(options[:controller])\n\n current = current.inject([]) { |memo, record| memo.push({:id => record.id, :label => label_for_field(record, controller)}) }\n\n url = url_for({:action => :browse, :controller => options[:controller], :escape => false}.merge(options[:params]))\n\n html = text_field_tag(\"#{name}[]\", nil, :autocomplete => 'off', :id => options[:id], :class => options[:class], :onfocus => \"this.focused=true\", :onblur => \"this.focused=false\")\n html << content_tag('ul', '', :class => 'record-select-list');\n html << javascript_tag(\"new RecordSelect.Multiple(#{options[:id].to_json}, #{url.to_json}, {current: #{current.to_json}});\")\n\n return html\n end", "def build_class(form)\n @labels = []\n\n dataset = WPDB.db[:\"#{WPDB.prefix}rg_lead___l\"]\n .where(:\"l__form_id\" => form.id)\n\n dataset = join_fields(dataset, form.fields)\n dataset = dataset.select_all(:l)\n dataset = select_fields(dataset, form.fields)\n dataset = dataset.from_self\n\n Class.new(Sequel::Model) do\n set_dataset dataset\n end\n end", "def add_new_task_form\n if params[:note_id].blank?\n @note = Communication.new(:assigned_by_employee_user_id=> params[:lawyer_id])\n else\n @note = Communication.find(params[:note_id])\n end\n @from_edit = params[:from_edit]\n @time_zone = @note.receiver.time_zone\n users = []\n if current_user.belongs_to_front_office\n users = User.all_cluster_livian(@note.clusters)\n @common_pool_user = false\n @back_office_user = false\n elsif current_user.belongs_to_common_pool\n users = Cluster.get_common_pool_livian_users\n @common_pool_user = true\n @back_office_user = false\n elsif current_user.belongs_to_back_office\n users = Cluster.get_back_office_cluster_livians\n @common_pool_user = false\n @back_office_user = true\n end\n @work_types = @back_office_user ? WorkType.back_office_work_types : WorkType.livian_work_types\n first_work_subtype = @work_types.first.work_subtypes.first\n @complexities = first_work_subtype.blank? ? [] : first_work_subtype.work_subtype_complexities\n get_work_subtypes_and_diffentiate_users(users,@work_types)\n render :update do |page|\n page.insert_html :bottom, :new_task_form, :partial=>'task_fields',:locals=>{:index=>params[:task_index]}\n end\n end", "def edit_collection\n id = params[:context_id]\n klass = params[:context].classify\n @objects = SocialProfile.where(id, klass)\n @context = ModelHelper.object_for(id,klass)\n end", "def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end", "def build_treatment_form(treatment,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:treatment_form]= Hash.new\n\ttreatment_type_codes = TreatmentType.find_by_sql('select distinct treatment_type_code from treatment_types').map{|g|[g.treatment_type_code]}\n\ttreatment_type_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'treatment_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (treatment_type_id) on related table: treatment_types\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'treatment_type_code',\n\t\t\t\t\t\t:settings => {:list => treatment_type_codes}}\n\t\t\t\t\t\t\n\tfield_configs[3] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'ranking'}\t\t\t\t\t\t\n \n\tbuild_form(treatment,field_configs,action,'treatment',caption,is_edit)\n\nend" ]
[ "0.6576616", "0.5736769", "0.56707036", "0.5559668", "0.5378339", "0.53390276", "0.53301847", "0.526304", "0.51821935", "0.5130522", "0.5095146", "0.50912625", "0.5086299", "0.5052921", "0.5042052", "0.5038239", "0.50339264", "0.50334024", "0.5026997", "0.4990072", "0.49691805", "0.49577376", "0.49123383", "0.49110955", "0.48872396", "0.48754743", "0.4871321", "0.4852293", "0.48431122", "0.48430228", "0.4819015", "0.48170117", "0.48142406", "0.4813961", "0.4813961", "0.48106763", "0.4805738", "0.4805578", "0.4805458", "0.4796805", "0.47967193", "0.47824815", "0.47818983", "0.47796625", "0.47770935", "0.47725728", "0.47720906", "0.47667783", "0.47607872", "0.47534782", "0.47472492", "0.4744214", "0.47433904", "0.47376654", "0.47337413", "0.4733086", "0.4732081", "0.47304204", "0.47199658", "0.47095376", "0.4708235", "0.46965808", "0.46895555", "0.46886677", "0.46883842", "0.46820918", "0.46811217", "0.46752632", "0.46684927", "0.46566564", "0.46528772", "0.46516106", "0.46358588", "0.46313834", "0.46304202", "0.46285576", "0.46243268", "0.46211657", "0.46165752", "0.46143", "0.46119586", "0.46104142", "0.4609592", "0.46020764", "0.4594039", "0.4593955", "0.45920205", "0.4588452", "0.4582047", "0.45763287", "0.4574438", "0.45726523", "0.4570816", "0.45645115", "0.45628384", "0.4562192", "0.45569822", "0.45567587", "0.4551429", "0.45505127" ]
0.57978886
1
this perhaps needs to be private?
def save @history << {@entry_station => @exit_station} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def private_method\n end", "def probers; end", "def schubert; end", "def custom; end", "def custom; end", "def refutal()\n end", "def internal?; end", "def wrapper; end", "def initialize\n \n end", "def extra; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def overrides; end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize() end", "def used?; end", "def public; end", "def public; end", "def methods() end", "def handle; end", "def weber; end", "def accessibility; end", "def isolated; end", "def isolated; end", "def operations; end", "def operations; end", "def initialize\r\n\r\n end", "def suivre; end", "def initialize\n\t\t\n\tend", "def processor; end", "def initialize\n \n end", "def initialize\n\n end", "def initialize\n\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def public_method; end", "def called_from; end", "def called_from; end", "def r; end", "def r; end", "def internship_passed; end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def under_construction\n end", "def escaper=(_); end", "def implemented_in; end", "def final; end", "def original; end", "def attr_reader(*)\n end", "def extra_state; end", "def reflection; end", "def reflection; end", "def writethis; end", "def sitemaps; end", "def private_method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end" ]
[ "0.8628043", "0.68844175", "0.6809401", "0.6809401", "0.6738669", "0.6738669", "0.6738669", "0.6738669", "0.67097336", "0.66628116", "0.64757186", "0.6448042", "0.6448042", "0.6329847", "0.6317827", "0.63101923", "0.61640596", "0.6153795", "0.61508685", "0.61508685", "0.61508685", "0.61508685", "0.61415845", "0.6109147", "0.6109147", "0.6109147", "0.6109147", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.60903895", "0.6077504", "0.6052396", "0.60521007", "0.60521007", "0.60435504", "0.6036079", "0.6022686", "0.60171753", "0.60068643", "0.60068643", "0.6003412", "0.6003412", "0.6002518", "0.5976677", "0.5976322", "0.59429383", "0.5936793", "0.5929446", "0.5929446", "0.5929004", "0.5929004", "0.5929004", "0.5929004", "0.5929004", "0.5929004", "0.5929004", "0.5929004", "0.58997583", "0.5881137", "0.5881137", "0.58771735", "0.58771735", "0.58649415", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58598715", "0.58557713", "0.585513", "0.58541733", "0.58527637", "0.58465236", "0.5838894", "0.5831474", "0.58298504", "0.58298504", "0.5822672", "0.5821717", "0.58206064", "0.5817359", "0.5817359", "0.5817359", "0.5817359", "0.5817359", "0.5817359", "0.5817359", "0.5817359" ]
0.0
-1
Get a single snippet.
def user_snippet(id) get("/snippets/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_snippet(name, options = {})\n fetch('/snippets/%s' % name, options)\n end", "def get_published_snippet\n @snippet = Snippet.published.find params[:id]\n end", "def show\n # The snippet should be destroyed in the case where it is one-time and it should no longer be\n # pe possible to access to it. In other cases, the views counter of the snippet is incremented.\n if @snippet.one_time_view_consumed?\n @snippet.destroy\n else\n @snippet.increment!(:views_counter)\n end\n\n # Returns the raw snippet content if it was explicitely requested by the client.\n return render(plain: @snippet.content) if params.include?('raw')\n\n # Users have the ability to create a new snippet using the content of the currently displayed\n # snippet. This is why a new Snippet instance is created at this point.\n @new_snippet_from_current = Snippet.new(\n lexer: @snippet.lexer, content: @snippet.content, user: current_user\n )\n end", "def show\n @snippet = Snippet.find(params[:id])\n respond_with @snippet\n end", "def snippet(path)\n File.read(File.join(__dir__, 'snippets', *path.split('/')))\nend", "def set_snippet\n @snippet = Snippet.first\n end", "def [](key)\n load_snippets(key) if @snippets[key].empty?\n @snippets[key]\n end", "def snippet\n context.site.snippets.detect { |s| s.identifier == identifier } ||\n context.site.snippets.build(identifier: identifier)\n end", "def show\n resource, id = request.path.split('/')[1, 2]\n if id\n @snippet = Snippet.find(params[:id])\n else\n @snippet = Snippet.find_by_snippet_type(resource)\n end\n \n respond_to do |format|\n format.html { render layout: \"fluid\" }# show.html.erb\n format.json { render json: @snippet }\n end\n end", "def set_snippet\n @snippet = Snippet.find(params[:id])\n end", "def set_snippet\n @snippet = Snippet.find(params[:id])\n end", "def set_snippet\n @snippet = Snippet.find(params[:id])\n end", "def set_snippet\n @snippet = Snippet.find(params[:id])\n end", "def set_snippet\n @snippet = Snippet.find(params[:id])\n end", "def snippet\n page.site.snippets.detect{|s| s.slug == self.label.to_s} || page.site.snippets.build(:slug => self.label.to_s)\n end", "def show(id)\n @title = \"Show Snippet!\"\n\n # Find the snippet if it exists\n @snippet = Snippet[id]\n\n if @snippet != nil\n # Get some text we can use to substitute for the \"[/code]\" text so that it doesn't\n # mess up Syntaxi.\n replacer = Time.now.strftime('[code-%d]')\n\n # Do the syntax highlighting of the text with Syntaxi after we've done our\n # substitution.\n @snippet_highlight = Syntaxi.new(\"[code lang='ruby']#{@snippet.body.gsub('[/code]', replacer)}[/code]\").process\n\n # Substitute the '[/code]' back in for our replacement text.\n @snippet_highlight = \"#{@snippet_highlight.gsub(replacer, '[/code]')}\"\n else\n # The snippet doesn't exist, so set a message and just redirect\n # to the main/index page.\n flash[:message] = \"Snippet #{id} not found.\"\n redirect rs :index\n end\n end", "def user_snippet_raw(id)\n get(\"/snippets/#{id}/raw\",\n format: nil,\n headers: { Accept: 'text/plain' },\n parser: ::Gitlab::Request::Parser)\n end", "def set_snippet\n @snippet = Snippet.find_by slug: params[:slug]\n end", "def show\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def show\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end", "def show\n @languages = [\"c\", \"python\", \"css\", \"html\", \"javascript\", \"php\", \"lua\", \"ruby\", \"scheme\"]\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @snippet }\n end\n end", "def index\n @snippet = Snippet.new\n logger.debug @snippet\n logger.debug \"New snippet id: #{@snippet.uuid}\"\n end", "def show\n @snippet = Snippet.find(params[:id])\n\n # add_breadcrumb :show, snippet_path(@snippet.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @snippet }\n end\n end", "def get_snippet(id)\n # Make an API call using 'rest-client' gem\n target_url = 'https://publish.twitter.com/oembed?' \\\n 'url=https%3a%2f%2ftwitter%2ecom%2fInterior%2fstatus%2f' +\n id.to_s + '&omit_script=true'\n response = RestClient::Request.execute(\n method: :get,\n url: target_url\n )\n result = JSON.parse(response)\n\n return result['html']\n end", "def snippet_title snippet\n if snippet.description.blank?\n \"Snippet \\##{snippet.id}\"\n else\n snippet.description\n end\n end", "def set_snippet\n @snippet = Snippet.where(uuid: params[:uuid]).first\n @snippets = Snippet.all.order('created_at desc').limit(5)\n logger.debug @snippet\n end", "def snippets\n @clip = Clip.find(params[:id])\n end", "def show\n @snippet = @snippet.decorate\n\n respond_to do |format|\n format.html # show.html.slim\n format.json { render json: @snippet }\n end\n end", "def show\n generator = ColorGenerator.new saturation: 0.3, lightness: 0.75\n @nickname = generate_nick_name\n @snippet = Snippet.find_by slug: params[:slug]\n end", "def cms_snippet_content(identifier, cms_site = @cms_site, &block)\n unless cms_site\n host, path = request.host_with_port.downcase, request.fullpath if respond_to?(:request) && request\n cms_site = Comfy::Cms::Site.find_site(host, path)\n end\n return '' unless cms_site\n\n snippet = cms_site.snippets.find_by_identifier(identifier)\n\n if !snippet && block_given?\n snippet = cms_site.snippets.create(\n :identifier => identifier,\n :label => identifier.to_s.titleize,\n :content => capture(&block)\n )\n end\n\n snippet ? snippet.content : ''\n end", "def index\n @snippets = Snippet.all.order(snippet_view_count: :desc)\n puts @snippets.first\n puts \"Snippet ID here\"\n end", "def show_snippet\n @clam = Clam.find(params[:id])\n @clam.content_type =~ /^Resource::(.*)$/\n @template = $1 ? $1.downcase : \"octet_stream\"\n\n render :action => \"clam_snippet\", :layout => false\n end", "def cms_snippet_content(identifier, cms_site = @cms_site, &block)\n unless cms_site\n host, path = request.host.downcase, request.fullpath if respond_to?(:request) && request\n cms_site = Comfy::Cms::Site.find_site(host, path)\n end\n return '' unless cms_site\n\n snippet = cms_site.snippets.find_by_identifier(identifier)\n\n if !snippet && block_given?\n snippet = cms_site.snippets.create(\n :identifier => identifier,\n :label => identifier.to_s.titleize,\n :content => capture(&block)\n )\n end\n\n snippet ? snippet.content : ''\n end", "def snippet_for_new type\n self.send(\"snippet_for_new_#{type}\".to_sym)\n end", "def snippet(snippet_name, scope)\n snippets_file = \"snippets/#{snippet_name}.erb\"\n libdir = File.exist?(\"local/#{snippets_file}\") ? 'local' : 'lib'\n template = \"#{libdir}/#{snippets_file}\"\n\n if File.exist?(template)\n output = ERB.new(File.read(template), 0, '<>-', '_snippet').result(scope)\n else\n output = ''\n puts \"WARNING: snippet \\\"#{snippet_name}\\\" not found.\".red\n end\n\n output\nend", "def random_snippet\n create_snippets if snippets_created_at.nil?\n return nil if pending_snippet_count.nil? or pending_snippet_count.zero?\n ids = snippets.pending.map { |snippet| snippet.id }\n random_id = ids[rand(ids.length)]\n snippets.pending.find(random_id)\n end", "def set_code_snippet\n @code_snippet = @language.code_snippets.find(params[:id])\n end", "def get_book_snippet(book)\nend", "def new_snippet(name, template = nil)\n @site.snippets.new(:name => name, :template => template)\nend", "def snippet=(v)\n case v\n when String\n @snippet = Snippet.new(v)\n when Snippet\n @snippet = v\n else\n raise ArgumentError, \"Snippet must be a String or a Snippet\"\n end\n end", "def create_snippet(snippet)\n params = self.buffer_log { snippet_to_params(snippet) }\n\n # make a call to the API to create the snippet, no need to set\n # the locale since it first happens for the default locale.\n response = self.post :snippets, params, nil, true\n\n snippet._id = response['id'] if response\n\n !response.nil?\n end", "def snippet( params={} )\n snippet = get_connections(\"snippet\", params)\n return map_connections snippet, :to => Facebook::Graph::Generic\n end", "def set_codesnippet\n @codesnippet = Codesnippet.find(params[:id])\n end", "def load_snippet(name, group)\n path = File.expand_path name, snippet_path(group)\n File.read path\n end", "def load_snippet(name, group)\n path = File.expand_path name, snippet_path(group)\n File.read path\n end", "def public_snippets(options = {})\n get('/snippets/public', query: options)\n end", "def load_snippet(snippet_name, snippet_group = \"default\", parent_binding = nil)\n load_from_file_in_template(snippet_name, parent_binding, snippet_group, :snippet)\n end", "def display_snippet(content)\n content = display_full(content)\n\n # If our entire post fits in the snippet, just parse the HTML and return it.\n return content if content.length <= MINIMUM_CHARS_FOR_PREVIEW\n \n\n first_part = content[0...MINIMUM_CHARS_FOR_PREVIEW]\n remainder = content[MINIMUM_CHARS_FOR_PREVIEW..-1]\n (first_part + remainder.split(\"</p>\").first + \"</p>\")\n\n end", "def snippet_for_new_rdf\n snippet_for_new_rd\n end", "def snippet_tag\n end", "def get_content_instance(slug)\r\n @client.raw('get', \"/content/content-instances/#{slug}\")\r\n end", "def parse_snippet_template(template_name)\n source = if template_name.include?('{{')\n template_name\n else\n snippet = services.snippet_finder.find(template_name)\n if snippet\n snippet.liquid_source\n else\n Locomotive::Common::Logger.warn \"[Liquid][Nav] unable to find the #{template_name} snippet\"\n nil\n end\n end\n\n source ? ::Liquid::Template.parse(source) : nil\n end", "def index\n @snippets = Snippet.all\n end", "def snippet\n snippet = text.split(\"\\r\\n\\r\\n\")[0]\n snippet = snippet[0, 500] + ' **[. . .]**' if snippet.length > 550\n snippet\n end", "def update_snippet(snippet)\n params = self.buffer_log { snippet_to_params(snippet) }\n\n locale = Locomotive::Mounter.locale\n\n # make a call to the API for the update\n response = self.put :snippets, snippet._id, params, locale\n\n !response.nil?\n end", "def show\n @snip = Snip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @snip }\n format.text { render text: @snip.body }\n end\n end", "def snippet text, limit = 100\n document = parse text\n\n RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document\n end", "def update\n @snippet = current_user.snippets.find(params[:id])\n @snippet.update_attributes(params[:snippet])\n respond_with(@snippet)\n end", "def cache_snippet(snippet, key, options={}, &block)\n return snippet.html_safe if !snippet.blank?\n if options.delete(:ignore_cache)\n cache_capture_data( &block )\n else\n cache_block( key, options, &block )\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end", "def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end", "def show\n if :html.empty?\n redirect_to edit_snippit_path(@snippit)\n end\n @current_snippit ||= Snippit.find_by_id(params[:snippit_id]) || Snippit.find_by_id(params[:id])\n @html = @current_snippit.html\n @css = @current_snippit.css\n @css = \"<style>#{@css}</style>\"\n @js = @current_snippit.javascript\n @js = \"<script type='text/javascript'>#{@js}</script>\"\n @code = \"#{@html} #{@js} #{@css}\"\n end", "def snippet_wrapper_path\n 'app/views/spree/snippets/_snippet.html.erb'\n end", "def snippet_tag\n :div\n end", "def show\n @snippet=Snippet.find_by_id(params[:id])\n @tags= Tag.where(\"snippet_id = :query\",query:params[:id])\n end", "def snippet_user_agent_details(id)\n get(\"/snippets/#{id}/user_agent_detail\")\n end", "def snippet_label\n class_name.to_s.humanize\n end", "def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_loaded\n @code_snippets\n end", "def new\n @snippet = current_user.snippets.build\n respond_with @snippet\n end", "def index\n @comments = @snippet.comments\n end", "def create\n @snippet = Snippet.new(snippet_params)\n\n respond_to do |format|\n if @snippet.save\n format.html { redirect_to @snippet, notice: 'Snippet was successfully created.' }\n format.json { render :show, status: :created, location: @snippet }\n puts @snippet\n else\n format.html { render :new }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @snippet = Snippet.find(params[:id])\n @comment = @snippet.comments.build\n @author = User.find(@snippet.user_id)\n\n if @snippet.private && (@login_user.nil? || (@snippet.user_id != @login_user.id))\n redirect_to snippets_url, alert: \"このスニペットは非公開です\"\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @snippet }\n end\n end", "def retrieve_story(uid)\n response = get(\"/api/v1/stories/#{uid}\")\n Trubl::Story.new.from_response(response)\n end", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end", "def new\n @snippet = Snippet.new(user: current_user)\n @snippet.require_expiration\n end", "def show\n @stackoverflow_url = \"#\"\n settings = {\n \"github_api_user\" => ENV['GITHUB_API_USER'],\n \"github_api_token\" => ENV['GITHUB_API_TOKEN'],\n \"stackoverflow_key\" => ENV['STACKOVERFLOW_KEY']\n }\n external_info = ExternalUserInfoAdapter.instance()\n external_info.set_settings(settings)\n profile = Profile.find(params[:id])\n if profile.avatar_url.to_s.empty?\n @avatar = external_info.get_user_avatar_url(profile.user_id)\n if [email protected]?\n profile.update(avatar_url: @avatar)\n end\n else\n @avatar = profile.avatar_url\n end\n @stackoverflow_link = external_info.get_stackoverflow_link(profile.user_id)\n @snippets = Snippet.where(:user_id => profile.user_id)\n @snippet = Snippet.new\n end", "def get_by_slug(slug)\n record = @dao.search({ 'slug' => slug }, { limit: 1 })\n translate(record)\n end", "def content_for(part_slug)\n part_with_slug(part_slug).try(:body)\n end", "def create\n logger.debug \"CREATE\"\n @snippet = Snippet.new(snippet_params)\n\n respond_to do |format|\n if @snippet.save\n format.html { redirect_to @snippet, notice: 'Snippet was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @snippet }\n format.json { render json: @snippet }\n else\n #format.html { render action: 'new' }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def destroy\n @snippet = current_user.snippets.find(params[:id])\n @snippet.destroy\n\n respond_with(@snippet)\n end", "def create\n @snippet = Snippet.new(params[:snippet])\n @snippet.text = ActionView::Base.full_sanitizer.sanitize(@snippet.content)\n ## per user\n # @user = current_user\n # @snippet.user = @user\n\n ## hack to assoc with first (maybe use an annon user for this)\n if (user_signed_in?)\n @user = current_user\n @user.snippets.push(@snippet)\n end\n\n respond_to do |format|\n if @snippet.save\n format.html { redirect_to @snippet, notice: 'Snippet was successfully created.' }\n format.json { render json: @snippet, status: :created, location: @snippet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @snippet = Snippet.new.decorate\n\n respond_to do |format|\n format.html # new.html.slim\n format.json { render json: @snippet }\n end\n end", "def create\n @snippet = current_user.snippets.build(params[:snippet])\n @snippet.save\n respond_with(@snippet)\n end", "def index\n @code_snippets = @language.code_snippets\n end", "def update\n @snippet = Snippet.find(params[:id])\n \n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n flash[:notice] = 'Snippet was successfully updated.'\n format.html { redirect_to(@snippet) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snippet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def set_snipet\n @snipet = Snipet.find_by_id(params[:id])\n unless @snipet\n flash[:alert] = \"No snippet found with the id \" + params[:id]\n redirect_to :action => :index\n end\n end", "def new\n @snippet = Snippet.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def descr\n return text_get(2, id)\n end", "def get(id)\n self.class.get(\"/paste/#{id}\").parsed_response\n end", "def update\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n @snippet.text = ActionView::Base.full_sanitizer.sanitize(@snippet.content)\n format.html { redirect_to @snippet, notice: 'Snippet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_snippets(content)\n snippet_regex = /\\[snippet_\\d+\\/*\\d*\\]/\n if content.value =~ snippet_regex\n content.value.gsub(snippet_regex) do |txt|\n cleaned_snippet = txt.delete \"[]\" # delete brackets\n snippet = MercurySnippet.where(name: cleaned_snippet).first\n if snippet\n name = snippet.snippet[1]['name']\n render(:file => \"mercury/snippets/#{name}/preview.html\", locals: {params: snippet.snippet[1]})\n end\n end\n else\n content.value.html_safe\n end\n end", "def create\n @snippet = Snippet.new(params[:snippet])\n\n respond_to do |format|\n if @snippet.save\n format.html { redirect_to @snippet, notice: 'Snippet was successfully created.' }\n format.json { render json: @snippet, status: :created, location: @snippet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_note(note_id)\n @notes[note_id]\n end", "def get_note(note_id)\n @notes[note_id]\n end" ]
[ "0.75138646", "0.7378621", "0.70046693", "0.6905942", "0.6880125", "0.68199795", "0.6800261", "0.6763094", "0.6744326", "0.669336", "0.66555685", "0.66555685", "0.66555685", "0.66555685", "0.6567685", "0.6567061", "0.652993", "0.6518845", "0.647275", "0.647275", "0.63400865", "0.629281", "0.6243613", "0.6228193", "0.6198164", "0.6190994", "0.6164008", "0.6149296", "0.6138718", "0.61268544", "0.61139464", "0.61132765", "0.60683614", "0.6050353", "0.6008146", "0.59419125", "0.59008795", "0.58425593", "0.5813316", "0.57831955", "0.57526565", "0.5745113", "0.5717471", "0.57127714", "0.5628322", "0.5628322", "0.5596732", "0.5563679", "0.5559839", "0.5545034", "0.5516624", "0.5480066", "0.5477604", "0.5476621", "0.54003173", "0.5382488", "0.53777707", "0.5358174", "0.5299868", "0.5293433", "0.52867776", "0.52867776", "0.52692723", "0.5262275", "0.5259614", "0.5237939", "0.52353525", "0.5200102", "0.51984775", "0.51949483", "0.51541513", "0.5148229", "0.51461864", "0.5141971", "0.51254374", "0.5124327", "0.5124327", "0.51042366", "0.50857675", "0.5082917", "0.5081763", "0.5073004", "0.5072457", "0.5067704", "0.5060147", "0.504941", "0.50491196", "0.5044009", "0.5036176", "0.5029882", "0.5025768", "0.5024634", "0.50166243", "0.5015304", "0.50120556", "0.50071084", "0.49980703", "0.4997147", "0.4994379", "0.4994379" ]
0.7436838
1
Get raw contents of a single snippet.
def user_snippet_raw(id) get("/snippets/#{id}/raw", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw\n\t\treturn @content\n\tend", "def raw\n\t\treturn @content\n\tend", "def raw\n workhorse_set_content_type!\n\n # Until we don't migrate all snippets to version\n # snippets we need to support old `SnippetBlob`\n # blobs\n if defined?(blob.snippet)\n send_data(\n convert_line_endings(blob.data),\n type: 'text/plain; charset=utf-8',\n disposition: content_disposition,\n filename: Snippet.sanitized_file_name(blob.name)\n )\n else\n send_snippet_blob(snippet, blob)\n end\n end", "def raw_content(snip, part)\n selected_part = (part || :content).to_sym\n snip.__send__(selected_part) if snip.respond_to?(selected_part)\n end", "def snippet(path)\n File.read(File.join(__dir__, 'snippets', *path.split('/')))\nend", "def content\n return @raw if @raw\n\n if self.uri\n @raw = HTTParty.get(self.uri.to_s).body\n # elsif self.precompiled?\n # template = Tilt.new(self.filepath)\n # @raw = template.render\n else\n @raw = File.read(self.filepath)\n end\n end", "def show\n # The snippet should be destroyed in the case where it is one-time and it should no longer be\n # pe possible to access to it. In other cases, the views counter of the snippet is incremented.\n if @snippet.one_time_view_consumed?\n @snippet.destroy\n else\n @snippet.increment!(:views_counter)\n end\n\n # Returns the raw snippet content if it was explicitely requested by the client.\n return render(plain: @snippet.content) if params.include?('raw')\n\n # Users have the ability to create a new snippet using the content of the currently displayed\n # snippet. This is why a new Snippet instance is created at this point.\n @new_snippet_from_current = Snippet.new(\n lexer: @snippet.lexer, content: @snippet.content, user: current_user\n )\n end", "def raw_contents\n File.read(path)\n end", "def raw\n content = ''\n File.open(path) { |f| content = f.read }\n content\n rescue IOError\n raise \"cannot open #{path}\"\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw_source\n end", "def raw_source\n @raw ||= File.read source_path\n end", "def raw_source\n @raw ||= File.read source_path\n end", "def get_published_snippet\n @snippet = Snippet.published.find params[:id]\n end", "def fetch_snippet(name, options = {})\n fetch('/snippets/%s' % name, options)\n end", "def user_snippet(id)\n get(\"/snippets/#{id}\")\n end", "def raw\n\n @raw\n\n end", "def cms_snippet_content(identifier, cms_site = @cms_site, &block)\n unless cms_site\n host, path = request.host_with_port.downcase, request.fullpath if respond_to?(:request) && request\n cms_site = Comfy::Cms::Site.find_site(host, path)\n end\n return '' unless cms_site\n\n snippet = cms_site.snippets.find_by_identifier(identifier)\n\n if !snippet && block_given?\n snippet = cms_site.snippets.create(\n :identifier => identifier,\n :label => identifier.to_s.titleize,\n :content => capture(&block)\n )\n end\n\n snippet ? snippet.content : ''\n end", "def cms_snippet_content(identifier, cms_site = @cms_site, &block)\n unless cms_site\n host, path = request.host.downcase, request.fullpath if respond_to?(:request) && request\n cms_site = Comfy::Cms::Site.find_site(host, path)\n end\n return '' unless cms_site\n\n snippet = cms_site.snippets.find_by_identifier(identifier)\n\n if !snippet && block_given?\n snippet = cms_site.snippets.create(\n :identifier => identifier,\n :label => identifier.to_s.titleize,\n :content => capture(&block)\n )\n end\n\n snippet ? snippet.content : ''\n end", "def body\n @raw\n end", "def get\n @contents\n end", "def raw_content(path, ctype=DEFAULT_CTYPE)\n node = @content_tree.lookup(path, ctype)\n node ? node.raw_contents : ''\n end", "def contents\n read\n end", "def snippet(snippet_name, scope)\n snippets_file = \"snippets/#{snippet_name}.erb\"\n libdir = File.exist?(\"local/#{snippets_file}\") ? 'local' : 'lib'\n template = \"#{libdir}/#{snippets_file}\"\n\n if File.exist?(template)\n output = ERB.new(File.read(template), 0, '<>-', '_snippet').result(scope)\n else\n output = ''\n puts \"WARNING: snippet \\\"#{snippet_name}\\\" not found.\".red\n end\n\n output\nend", "def content_for(part_slug)\n part_with_slug(part_slug).try(:body)\n end", "def content\n if GalleryConfig.storage.database_notebooks\n notebookFile = NotebookFile.where(save_type: \"stage\", uuid: uuid).first\n notebookFile.content if !notebookFile.nil?\n else\n File.read(filename, encoding: 'UTF-8') if File.exist?(filename)\n end\n end", "def show\n @snippet = Snippet.find(params[:id])\n respond_with @snippet\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def raw\n @template\n end", "def content\n return '' if @item.content_encoded.nil?\n @item.content_encoded\n end", "def contents\n rendered_contents\n end", "def raw\n @xbrl_content\n end", "def content\n return @content_ unless @content_.nil?\n @note.nil? and get\n @content_ = [email protected]? && [email protected]? ? @auth_store.note_store.getNoteContent(@auth_store.auth_token, @note.guid) : \"\"\n end", "def contents\n self.content\n end", "def get_raw\n\n path = File.join(self.get_dir, self.id.to_s + Email::EXT_RAW)\n\n if File.exist?(path)\n return open(path) { |f| f.read }\n else\n return ''\n end\n end", "def raw_read(context)\n raw(context)\n end", "def show\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def show\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snippet }\n end\n end", "def raw_text\n text = ''\n\n objects = get_objects(get_data(@file))\n objects = decode_objects(objects)\n\n objects.each { |o| text += o[:data] if(o[:data] and is_text_header?(o[:header])) }\n\n text\n end", "def read\n object.content\n end", "def display_snippet(content)\n content = display_full(content)\n\n # If our entire post fits in the snippet, just parse the HTML and return it.\n return content if content.length <= MINIMUM_CHARS_FOR_PREVIEW\n \n\n first_part = content[0...MINIMUM_CHARS_FOR_PREVIEW]\n remainder = content[MINIMUM_CHARS_FOR_PREVIEW..-1]\n (first_part + remainder.split(\"</p>\").first + \"</p>\")\n\n end", "def body\n project.client.agent.get(self.url).at('div.description/p').inner_text\n end", "def body\n source\n end", "def content\n return IO.read(@file)\n end", "def raw_plain\n @raw_plain\n end", "def content\n page.formatted_data\n end", "def _raw\n @_raw\n end", "def raw\n #\n end", "def content\n @content ||= @client.get(@link)\n end", "def get_contents_for(path)\n out = get_path(path)\n out.css(\"#content\").inner_html\n end", "def view_source\n File.read(@script)\n end", "def raw_body\n if @rev\n @raw_body ||= blob.contents\n else\n @raw_body ||= File.exists?(@filename) ? File.read(@filename) : ''\n end\n end", "def raw\n @lines.map(&:first).join(\"\\n\") + \"\\n\"\n end", "def contents\n f = self.class.mongo_client.database.fs.find_one({:_id=>BSON::ObjectId.from_string(@id)})\n if f\n buffer = \"\"\n f.chunks.reduce([]) do |x, chunk|\n buffer << chunk.data.data\n end\n return buffer\n end\n end", "def snippets\n @clip = Clip.find(params[:id])\n end", "def show\n resource, id = request.path.split('/')[1, 2]\n if id\n @snippet = Snippet.find(params[:id])\n else\n @snippet = Snippet.find_by_snippet_type(resource)\n end\n \n respond_to do |format|\n format.html { render layout: \"fluid\" }# show.html.erb\n format.json { render json: @snippet }\n end\n end", "def raw_code\n @raw_code ||= (File.read path).to_s.force_encoding(Encoding::UTF_8)\n end", "def get_snippet(id)\n # Make an API call using 'rest-client' gem\n target_url = 'https://publish.twitter.com/oembed?' \\\n 'url=https%3a%2f%2ftwitter%2ecom%2fInterior%2fstatus%2f' +\n id.to_s + '&omit_script=true'\n response = RestClient::Request.execute(\n method: :get,\n url: target_url\n )\n result = JSON.parse(response)\n\n return result['html']\n end", "def body\n @note.content\n end", "def content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n file.content\n end", "def raw_body\n @attributes[:raw_body]\n end", "def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend", "def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend", "def content\n ERB.new(load, nil, '-').result(binding)\n end", "def raw\n @raw ||= ''\n end", "def snippet\n snippet = text.split(\"\\r\\n\\r\\n\")[0]\n snippet = snippet[0, 500] + ' **[. . .]**' if snippet.length > 550\n snippet\n end", "def content\n @content\n end", "def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end", "def raw\n repr.raw\n end", "def get_raw(element_spec, node)\n result = node && node.text or \"\"\n #puts \"#{__method__}: #{result}\" if result.index('Comments Alert, 54 yo f Pt.')\n result\n end", "def content\n @lines.as_text\n end", "def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_loaded\n @code_snippets\n end", "def data\n return @content.data\n end", "def show\n @snippet = @snippet.decorate\n\n respond_to do |format|\n format.html # show.html.slim\n format.json { render json: @snippet }\n end\n end", "def content_source\n return @content_source\n end", "def content\n @content ||= parts.map(&:body).join(\"\\n\")\n end", "def show_snippet\n @clam = Clam.find(params[:id])\n @clam.content_type =~ /^Resource::(.*)$/\n @template = $1 ? $1.downcase : \"octet_stream\"\n\n render :action => \"clam_snippet\", :layout => false\n end", "def snippets filepath, fileext\n prefix = snippet_detail_prefix(fileext)\n\n snippet = nil; result = []\n readlines(filepath) do |line|\n unless line.strip.start_with?(prefix)\n snippet[:body] << line unless snippet.nil?\n next\n end\n\n result << snippet unless snippet.nil?\n snippet = parse_snippet_details(line, prefix)\n snippet[:body] = [] unless snippet.nil?\n end\n\n result << snippet unless snippet.nil?\n result\n end", "def the_content(content=nil, raw=false) \n \n if node = content || @content || Content.get(params[:id])\n \n # Show raw markdown, or html translation\n raw ? node.body : Maruku.new(\"#{node.body}\").to_html\n\n else\n \"<strong>Error:</strong> No content could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n \n end", "def read\n @contents ||= File.read @src_path if readable?\n end", "def get_source_content\n\t\treturn [] unless File.exists? @source\n\t\treturn File.read(@source).split(\"\\n\")\n\tend", "def parse_snippets(content)\n snippet_regex = /\\[snippet_\\d+\\/*\\d*\\]/\n if content.value =~ snippet_regex\n content.value.gsub(snippet_regex) do |txt|\n cleaned_snippet = txt.delete \"[]\" # delete brackets\n snippet = MercurySnippet.where(name: cleaned_snippet).first\n if snippet\n name = snippet.snippet[1]['name']\n render(:file => \"mercury/snippets/#{name}/preview.html\", locals: {params: snippet.snippet[1]})\n end\n end\n else\n content.value.html_safe\n end\n end", "def contents\n @content.clone.freeze\n end", "def raw_body\n unless @raw_body\n @in.rewind\n @raw_body = @in.read(content_length)\n end\n\n @raw_body\n end", "def content\n @content\n end", "def content\n @content\n end", "def getContent() \n return @obj.getContent().toString()\n end", "def cms_block_content(identifier, blockable = @cms_page, use_old_code = false)\n if use_old_code\n tag = blockable && (block = blockable.blocks.find_by_identifier(identifier)) && block.tag\n return '' unless tag\n tag.content\n else\n pluck_page_block_content(identifier, blockable)\n end\n end", "def contents\n response ? response.read_body : nil\n end", "def source\n @source || load_file_contents\n end", "def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end", "def content\n text\n end", "def raw_codewords\n @raw_codewords\n end", "def data\n @content\n end" ]
[ "0.7177273", "0.7177273", "0.6960773", "0.6859287", "0.6824384", "0.67682606", "0.65983325", "0.657727", "0.6518336", "0.63670653", "0.63670653", "0.63670653", "0.63167167", "0.63167167", "0.63064367", "0.62408125", "0.620866", "0.6205441", "0.6190683", "0.61764574", "0.6146011", "0.6136296", "0.61108977", "0.60536605", "0.599612", "0.5969052", "0.5962173", "0.5947189", "0.5921656", "0.5921656", "0.5921656", "0.5921656", "0.5921656", "0.5921656", "0.5902281", "0.5891608", "0.58823603", "0.587451", "0.58473486", "0.5839438", "0.5836326", "0.5814294", "0.580556", "0.580556", "0.5801464", "0.57907444", "0.5768038", "0.57579833", "0.57525027", "0.5748009", "0.5734251", "0.57296926", "0.57236177", "0.571267", "0.5708459", "0.5706147", "0.5676061", "0.56749845", "0.5664727", "0.5648217", "0.56463486", "0.56426233", "0.5641671", "0.56334865", "0.56324327", "0.56301725", "0.56284934", "0.5623826", "0.5623826", "0.5616689", "0.5614776", "0.56042755", "0.5602686", "0.5600797", "0.5599986", "0.5599731", "0.55909187", "0.5584881", "0.55826104", "0.5582294", "0.5577362", "0.5574937", "0.5572525", "0.55629516", "0.5562603", "0.5554373", "0.554411", "0.554229", "0.55367607", "0.552795", "0.5523102", "0.5523102", "0.5519384", "0.5518604", "0.5516922", "0.550524", "0.5503838", "0.55012697", "0.5496477", "0.54892844" ]
0.7356102
0
Delete an existing snippet.
def delete_user_snippet(id) delete("/snippets/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @page = Comatose::Page.find_is_snippet params[:id]\n if request.post?\n expire_cms_pages_from_bottom @page\n expire_cms_fragments_from_bottom @page\n @page.destroy\n flash[:notice] = \"Deleted snippet '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to(snippets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to(snippets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Snippet was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet.destroy\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n check_snippet_author\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @codesnippet = Codesnippet.find(params[:id])\n @codesnippet.destroy\n\n respond_to do |format|\n format.html { redirect_to codesnippets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @snippet = current_user.snippets.find(params[:id])\n @snippet.destroy\n\n respond_with(@snippet)\n end", "def destroy\n @snippet.destroy\n respond_to do |format|\n format.html { redirect_to snippets_url, notice: 'Snippet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet.destroy\n respond_to do |format|\n format.html { redirect_to snippets_url, notice: 'Snippet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet.destroy\n respond_to do |format|\n format.html { redirect_to snippets_url, notice: 'Snippet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_snippet.destroy\n respond_to do |format|\n format.html { redirect_to language_code_snippets_url(@language), notice: 'Code snippet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @snippet = current_user.company.snippets.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy unless @snippet.snippet_type == 'about'\n\n respond_to do |format|\n format.html { redirect_to snippets_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_snippet_repository(snippet)\n snippet.snippet_repository&.delete\n rescue StandardError => e\n logger.error(message: \"Snippet Migration: error destroying snippet repository. Reason: #{e.message}\", snippet: snippet.id)\n end", "def delete_repository(snippet)\n return unless snippet.repository_exists?\n\n snippet.repository.remove\n snippet.repository.expire_exists_cache\n rescue StandardError => e\n logger.error(message: \"Snippet Migration: error deleting repository. Reason: #{e.message}\", snippet: snippet.id)\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json do\n render :json => { :notice => \"Snippet deleted\" }\n end\n end\n end", "def destroy\n @simple_question_alternative.destroy\n head :no_content\n end", "def destroy\r\n\t \t@codeblock = @step.codeblocks.find_by(id: params[:id])\r\n\t @codeblock.destroy\r\n\t respond_to do |format|\r\n\t format.html { redirect_to tutorial_step_url(@tutorial, @step), notice: 'CodeBlock was successfully destroyed.' }\r\n\t format.json { head :no_content }\r\n\t end\r\n\t end", "def after_destroy(snippet)\n expire_cache_for(snippet)\n end", "def delete_page(page)\n transaction \"delete `#{page.title}'\" do\n store.delete(page.title + '.md')\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @description.destroy!\n head :no_content\n end", "def delete_statement(statement)\n self.deletes << statement\n end", "def delete_statement(statement)\n self.deletes << statement\n end", "def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end", "def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end", "def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end", "def delete(x)\n @contents.delete x\n end", "def del\n delete\n end", "def delete(p)\n puts \"Deleting page #{p}\"\n FileUtils.rm_rf \"#{p}\"\n end", "def destroy\n @recipe.destroy\n head :no_content\n end", "def destroy\n @code_sample.destroy\n respond_to do |format|\n format.html { redirect_to code_samples_url, notice: 'Code sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n DATABASE.execute(\"DELETE from slides WHERE id = #{id}\")\n end", "def destroy\n @exercise_template.destroy\n\n head :no_content\n end", "def destroy\n @pug.destroy\n\n head :no_content\n end", "def destroy\n @recommended_link.destroy\n\n head :no_content\n end", "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end", "def delete!\n clear!\n delete\n end", "def destroy\n @code_help = CodeHelp.find(params[:id])\n @code_help.destroy\n\n respond_to do |format|\n format.html { redirect_to code_helps_url }\n format.json { head :no_content }\n end\n end", "def delete_content(params)\n delete(set_path(params[:id]), params) if validate_params(params)\n end", "def delete(_identifier)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def delete\n path = @p.path\n File::unlink path\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete(p)\n @store.delete(p)\n end", "def destroy\n @example_code.destroy\n respond_to do |format|\n format.html { redirect_to example_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @question.destroy\n head :no_content\n end", "def delete\n finder = SlugFinder.new slug: identifier, dao: dao, factory: factory\n result = finder.find\n return result unless result.success\n dao.delete identifier\n result\n end", "def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend", "def sample_for_delete(src = :delete_example)\n current = delete_id && Manifest.find_by(id: delete_id)\n return current if current && (src == :delete_example)\n current&.delete\n new_record(src).tap do |record|\n self.delete_id = record.id if record.save!\n end\n end", "def destroy(code)\n @@urls.delete(code)\n end", "def remove_content(id)\n delete(\"/#{id}\")\n end", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def delete_content_for( obj )\n @_content_for.delete(obj)\n end", "def delete\n @client.delete_document(@path)\n end", "def _delete\n # Set id and cache key\n id = @options[:id]\n cache_key = nil #\"bookmark_#{id}\"\n\n # Retrieve bookmark object\n bookmark = Taupe::Model::Bookmark.load id, cache_key\n fail \"Unknown bookmark ##{id}\" if bookmark.empty?\n\n # Delete it\n Taupe::Model::Tag.exec \"DELETE FROM bookmark_tag WHERE bookmark_id = #{bookmark.bookmark_id}\"\n bookmark.delete\n\n puts 'Bookmark deleted successfully'\n end", "def delete\n # TODO: implement delete\n end", "def destroy\n @block.destroy\n\n head :no_content\n end", "def destroy\n @phrase.destroy\n destroy_respond_to\n end", "def destroy_item_with_content(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def delete_content(title)\n File.delete(\"pages/#{title}.txt\")\nend", "def destroy_item_with_content(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def delete!\n delete_if { true }\n end", "def delete\n end", "def delete\n @section = Section.find(params[:id])\n end", "def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete\n @text.slice!(@cursor, 1)\n end", "def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end", "def deleteItem\n\t\tif @public_id\n\t\t\tCloudinary::Uploader.destroy(@public_id)\n\t\tend\n\tend", "def delete\n storage.delete(id)\n end", "def destroy\n @content.destroy\n\n head :no_content\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def destroy\n @article.destroy\n\n head :no_content\n end", "def delete_item(code)\n @stock.delete(code.to_sym)\n end", "def delete_script\n\t\tupdate_script = Script.find_by(id: self.script_tag)\n\t\tupdate_script.destroy if update_script\n\tend", "def delete_from_secret(code, n)\n code.delete_at(code.index(n)) if code.index(n)\n end", "def destroy\n @parish.destroy\n\n head :no_content\n end", "def delete\n CMark.node_unlink(@pointer)\n end", "def delete\n\t\treturn self.repo.bookmark( self.name, delete: true )\n\tend", "def destroy\n @shelter.destroy\n\n head :no_content\n end", "def destroy\n @idea = Idea.find(params[:id])\n @idea.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ideas_url) }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end", "def delete_comments\n end", "def destroy\n @story.destroy\n head :no_content\n end", "def remove(item)\r\n @contents.delete(item)\r\n end", "def destroy\n @document_part.destroy\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @extra.destroy\n\n head :no_content\n end", "def delete!\n polls = read_polls_data\n polls.delete(id)\n save_polls_data(polls)\n end", "def destroy\n @spoiler.destroy\n\n head :no_content\n end", "def destroy\n @question_section = @question.question_section\n @question.destroy\n\n redirect_to edit_question_section_path(@question_section)\n end" ]
[ "0.77703464", "0.75513184", "0.75513184", "0.74863595", "0.74863595", "0.73953474", "0.73678786", "0.7328685", "0.729586", "0.7294756", "0.72580326", "0.7186157", "0.7186157", "0.7186157", "0.71098465", "0.70793664", "0.6899279", "0.6711864", "0.6635156", "0.6625694", "0.6113232", "0.60866064", "0.6067166", "0.6065981", "0.5997371", "0.5991754", "0.5902183", "0.5902183", "0.5848358", "0.5833421", "0.581673", "0.58130014", "0.5793071", "0.57887805", "0.5778264", "0.57621855", "0.5748835", "0.57390976", "0.5727008", "0.5701676", "0.5696275", "0.56596124", "0.5651281", "0.5639419", "0.5632873", "0.5628975", "0.5627683", "0.5619964", "0.56011957", "0.5599948", "0.5599948", "0.5599948", "0.55765086", "0.557006", "0.5554374", "0.55459756", "0.55451137", "0.5534638", "0.5534545", "0.5527856", "0.55263495", "0.55254745", "0.5520194", "0.55149984", "0.55149704", "0.5513723", "0.5503913", "0.550367", "0.5503386", "0.5488421", "0.5486419", "0.5484228", "0.548153", "0.5481068", "0.54805076", "0.54785985", "0.54780096", "0.5477814", "0.5464255", "0.5457064", "0.5452813", "0.545274", "0.54518205", "0.54516846", "0.5449886", "0.54457664", "0.5443233", "0.54384613", "0.5434287", "0.54336774", "0.5431482", "0.5413459", "0.5410063", "0.5409685", "0.5409448", "0.5409448", "0.54089063", "0.5408497", "0.5407763", "0.5407584" ]
0.72834575
10
List all public snippets.
def public_snippets(options = {}) get('/snippets/public', query: options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @snippets = Snippet.all\n end", "def index\n if(current_user)\n @snippets= current_user.snippets.paginate(page: params[:page],:per_page => 10)\n end\n end", "def index\n @snippets = Snippet.order(\"updated_at DESC\").where(private: false).paginate(page: params[:page], per_page: 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def index\n @tags= Tag.where(\"snippet_id =?\",params[:id].to_i)\n\n @snippets = Snippet.it_aint_private\n end", "def index\n @public_privates = PublicPrivate.all\n end", "def index\n\n @supress_social_bar = true\n @bare = true\n\n ## per user\n if (user_signed_in?)\n @user = current_user\n #@snippets = @user.snippets #constrain to my snippets\n end\n\n #filter by user\n if (params[:user].present?)\n @filter_user = User.where(email: params[:user]).first\n if @filter_user\n @snippets = Snippet.where(user_id: @filter_user.id)\n else\n @snippets = []\n end\n end\n\n\n @snippets = @snippets || Snippet.all\n @snippets = @snippets.order_by([['votes.point', :desc]]) if @snippets.respond_to? :order_by\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def index\n @parent = params[:user_id] ? User.find(params[:user_id]).snippets :\n Snippet\n @snippets = @parent.search(params[:q]).recent.page(params[:page]).per(per_page)\n respond_with(@snippets)\n end", "def public_pages\n list = []\n self.div(:id=>\"lhnavigation_public_pages\").links.each do |link|\n list << link.text\n end\n return list\n end", "def index\n if params[:whose]\n @codebanks = Codebank.my_snippets(params[:whose])\n if params[:private]\n @codebanks = @codebanks.my_private_snippets(params[:whose])\n else\n @codebanks = @codebanks.my_shared_snippets(params[:whose])\n end\n else\n @codebanks = Codebank.shared\n end\n @codebanks = @codebanks.paginate(page: params[:page], per_page: 10)\n\n end", "def list\n @manage_sieve.print_scripts\n end", "def index\n\n @account = current_account\n\n if @account.soft_account?\n @snippets = Snippet.where(soft_token: @account.soft_token).reverse_order\n else\n @snippets = current_account.snippets.last_touched\n end\n\n if params[:search]\n @snippets = @snippets.search(params[:search])\n elsif params[:tag]\n @snippets = @snippets.tagged_with(params[:tag]).reverse_order\n elsif params[:project]\n @snippets = @snippets.tagged_with(params[:project])\n end\n end", "def index\n @catalogs = Catalog.list_public()\n end", "def index\n @code_snippets = @language.code_snippets\n end", "def index\n @public_repositories = PublicRepository.all\n end", "def user_list\n @snippets = Snippet\n .where(user: current_user)\n .paginate(page: params[:page], per_page: 30)\n .order(created_at: :desc)\n render 'user_list'\n end", "def index\n if params[:tag]\n @snippets = Snippet.where(:tag => params[:tag]).all\n else\n @snippets = Snippet.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def public_templates\n Template.includes(org: :identifiers)\n .joins(:org)\n .published\n .publicly_visible\n .where(customization_of: nil)\n .order(:title)\n end", "def index\n @wx_publics = WxPublic.all\n end", "def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_loaded\n @code_snippets\n end", "def index\n @publicaciones = publicaciones_scope.all\n end", "def index\n @snippets = Snippet.paginate(:all,:order => 'title ASC', :per_page => 20, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snippets }\n end\n end", "def index\n @admin_publiccomments = Admin::Publiccomment.all\n end", "def index\n @publicos = Publico.all\n end", "def index\n @snippet = Snippet.new\n logger.debug @snippet\n logger.debug \"New snippet id: #{@snippet.uuid}\"\n end", "def user_snippet(id)\n get(\"/snippets/#{id}\")\n end", "def index\n @public_keys = PublicKey.all\n end", "def get_unowned_snippets\r\n admin = User.find_by admin: true\r\n admin_snippets = Snippet.where(:default => true).where(:user => admin)\r\n users_default_snippets = Snippet.accessible_by(current_ability).where(:default => true)\r\n\r\n unowned_snippets = admin_snippets\r\n user_snippets = users_default_snippets.pluck(:default_id).uniq\r\n if !user_snippets.empty?\r\n unowned_snippets = unowned_snippets.where('id NOT IN (?)', user_snippets)\r\n else\r\n unowned_snippets = admin_snippets\r\n end\r\n unowned_snippets.each do |unowned_snippet|\r\n p unowned_snippet.inspect\r\n end\r\n unowned_snippets\r\n end", "def get_pubs(suggestions)\n pub_ids = suggestions.join(',')\n JSON.parse(client.publication_items(pub_ids, 'json'))\n end", "def snippets\n self.mounting_point.snippets\n end", "def index\n @snippets = Snippet.with_assoc.published.date_desc.page(params[:page]).decorate\n\n if request.formats.include? :html\n respond_to do |format|\n format.html # index.html.slim\n end\n else\n if stale? @snippets.first\n respond_to do |format|\n format.atom { render atom: @snippets }\n format.json { render json: @snippets }\n end\n end\n end\n end", "def index\n # The notebooks of the current user\n @notebooks = current_user.notebooks\n end", "def list\n items = storage.items\n if items.empty?\n puts 'No items in the list.'\n return\n end\n\n storage.items.each do |(id, data)|\n puts \"#{id} #{data[:stamp]} #{data[:source].ljust(48)}\"\n end\n end", "def index\n @snippits = current_user.snippits\n end", "def all_public_list_view_fields\n return @all_public_list_view_fields if defined? @all_public_list_view_fields\n\n @all_public_list_view_fields ||= all_fields.select(&:display_in_public_list)\n end", "def index\n @public_speakers = PublicSpeaker.all\n end", "def index\n #@wikis = Wiki.visible_wiki(current_user)\n @wikis = policy_scope(Wiki)\n end", "def list\n stream.puts \"List of bookmarks\"\n\n bookmarks = Services::List.new.list\n renderer.new(bookmarks, stream: stream).render\n end", "def index\n @codes = Code.public_codes\n end", "def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end", "def index\n @publicacions = Publicacion.all\n end", "def public\n public_files = []\n files = session[:user].x_files.all(public: true)\n files.each do |file|\n public_files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: public_files, success: true }\n end", "def index\n \n\n #@publics = connect.to_hash\n #@publics = \n Public.all\n @publics = Corporation.all.order(\"id asc\").limit(15)\n end", "def notebooks\n self.notestore.listNotebooks(self.token)\n end", "def index\n @public_bookmarks = PublicBookmark.all\n end", "def index\n @publicaciones = Publicacion.all\n end", "def show\n\t\tnot_found\tunless for_public?\n\tend", "def publish(snippets)\n result = {}\n snippets.each do |timestamp, snippet_batch|\n published = []\n snippet_batch.each do |snippet|\n unless @public_mode and !snippet['public']\n publish_snippet(snippet, published)\n end\n end\n result[timestamp] = published unless published.empty?\n end\n result.sort.to_h\n end", "def index\n #anyone\n # @wikis = policy_scope(Wiki)\n @wikis = Wiki.all\n @wikis = Wiki.visible_to(current_user)\n\n @wiki = policy_scope(Wiki)\n end", "def index\n @pagy, @private_notes = pagy(PrivateNote.order(created_at: :desc), items: 25)\n authorize @private_notes\n end", "def public_urls\n #Rails.cache.fetch(\"public_urls-#{Globalize.locale}-#{self.cache_key}\") do\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.compact.uniq\n #end\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @ssh_public_keys = SshPublicKey.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ?\", session[:user_id]], :order => \"description DESC\"\n\n respond_to do |format|\n format.xml { render :xml => @ssh_public_keys }\n format.any { render :json => @ssh_public_keys }\n end\n end", "def publications\n typed_exec(<<-SQL)\n SELECT\n pubname::TEXT AS name,\n usename::TEXT AS owner,\n puballtables,\n pubinsert,\n pubupdate,\n pubdelete\n FROM\n pg_publication\n JOIN pg_user ON pubowner = usesysid\n SQL\n end", "def list\n @urls = Url.all\n @admin = ADMIN\n end", "def public_roots\n roots, publics = [*options.roots], [*options.publics]\n roots.map{|root| publics.map{|public| ::File.join(root, public) }}.flatten\n end", "def index\n @pubs = Pub.all\n\n render json: @pubs\n end", "def index\n # @wikis = Wiki.all\n @user = current_user\n @wikis = policy_scope(Wiki)\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @public_keys }\n end\n end", "def public_keys\n @public_keys\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def list_all\n init_ivars\n uri_list = @pages.map { |page| page.uri }\n\n uri_list.empty? ? ',' : uri_list.join(',')\n end", "def list\n return unless has_permission :can_edit_site_content\n @page_title = 'Static Pages'\n @documents = StaticContent.find_by_school current_school\n \nend", "def index\n @snippets = Snippet.all\n\n respond_to do |format|\n format.html { render layout: \"fluid\" }# index.html.erb\n format.json { render json: @snippets }\n end\n end", "def get_public_structures(opts = {})\n data, _status_code, _headers = get_public_structures_with_http_info(opts)\n return data\n end", "def index\n \n if params[:notebooks]\n @notebooks =Notebook.find_all_by_user_id(current_user.id)\n elsif params[:priv]\n @notebooks = Notebook.where(:access=>\"invite-only\")\n else\n @notebooks = Notebook.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end", "def list\n get()\n end", "def index\n @exercises = Exercise.where(is_public: true)\n end", "def index\n @admin_public_transports = City.find(session[:current_city_id]).utility.public_transports.page(params[:page]).per(10)\n end", "def list(opts = {})\n search_provider.list(opts)\n end", "def list(_filter = Set.new)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def show\n initLists\n end", "def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end", "def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end", "def index\n @p_apps = App.where(is_public: true)\n if user_signed_in?\n @u_apps = current_user.apps.where.not(is_public: true)\n @apps = @u_apps + @p_apps\n else\n @apps = @p_apps\n end\n\n # published_apps = App.where(is_published: true)\n # own_apps = current_user.apps\n # published_apps + own_apps\n end", "def show\n @public = Public.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public }\n end\n end", "def index\n @documents = Document.not_templates.publicly_available\n render layout: \"layouts/public\"\n end", "def index\n @publicidads = Publicidad.all\n end", "def index\n @plugs = Plug.all\n authorize! :read, @plug\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plugs }\n format.xml # { render json: @plugs }\n end\n end", "def user_snippet_raw(id)\n get(\"/snippets/#{id}/raw\",\n format: nil,\n headers: { Accept: 'text/plain' },\n parser: ::Gitlab::Request::Parser)\n end", "def index\n @urls = current_user.urls\n end", "def public_bookmarks\n @public_bookmarks ||=\n Bookmark.with_missing_bookmarkable.or(\n Bookmark.with_bookmarkable_visible_to_all\n ).is_public\n end", "def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end", "def index\n @snippets = Snippet.most_recent.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snippets }\n end\n end", "def show_only_public_files(solr_parameters, user_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] += [\"-#{Solrizer.solr_name('read_access_group', :symbol)}:#{Hydranorth::AccessControls::InstitutionalVisibility::UNIVERSITY_OF_ALBERTA}\"]\n end", "def show_list\n\t\t\t@my_list.show\n\t\tend", "def index\n @author_site_storages = SiteStorage.fetch_data(current_user)\n end", "def index\n @experiments = list_public\n begin\n @experiments_by_user = current_user.experiments\n rescue Exception\n # seems we dont have a session\n end\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @experiments }\n end\n end", "def index\n @publications = Publication.all.order(:pub_name)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def register_snippets\n # Loop through all snippets\n Snippet.all.each do |snippet|\n # Register the snippet view\n Hooks::View.register_dynamic_view(snippet.location, snippet.content, snippet.id)\n # Add the snippet to the array of registered snippets\n @@registered[snippet.id] = {:location => snippet.location, :created_at => snippet.created_at}\n end\n end", "def get_public_invitations(opts = {})\n data, _status_code, _headers = get_public_invitations_with_http_info(opts)\n data\n end", "def all\n storage.lists.each do |list|\n output \" #{list.name}\"\n list.items.each do |item|\n output \" #{item.short_name}:#{item.spacer} #{item.value}\"\n end\n end\n end", "def index\n @stories = (Story.where(access: \"PUBLIC\")).recent.page(params[:page])\n @PVT = (Story.where(user_id: current_user.id))\n @private_stories = (@PVT.where(access: \"PRIVATE\")).recent.page(params[:page])\n @tweets = SocialTool.twitter_search\n @topics = Topic.all\n end", "def set_public\n Public.all\n @public = Corporation.find(params[:id])\n end", "def list(*) end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def index\n @pagos_publicidads = PagosPublicidad.all\n end", "def index\n @publications = Publication.limit(20)\n end" ]
[ "0.67842335", "0.6760895", "0.6756018", "0.65286833", "0.63160247", "0.63156354", "0.62739253", "0.62032723", "0.62002754", "0.61789966", "0.6137268", "0.6126715", "0.61149895", "0.60618025", "0.6061513", "0.5976118", "0.59445965", "0.5856423", "0.584539", "0.5820418", "0.5813315", "0.5793171", "0.5787428", "0.57693875", "0.5762195", "0.5749146", "0.5737437", "0.5705626", "0.56893265", "0.5652885", "0.56470925", "0.56410515", "0.5637353", "0.56352067", "0.5632492", "0.56286424", "0.5624295", "0.5623354", "0.5592862", "0.5586048", "0.55859894", "0.5572365", "0.5567285", "0.5545621", "0.55037045", "0.5496522", "0.5477658", "0.5467586", "0.5460676", "0.54579884", "0.5444316", "0.5437502", "0.5432696", "0.5409209", "0.5408628", "0.5406829", "0.540619", "0.5405709", "0.5404835", "0.5404835", "0.5404835", "0.5404835", "0.54026556", "0.5396792", "0.5382887", "0.53733915", "0.5363549", "0.53631485", "0.53498214", "0.5336151", "0.5331406", "0.53309876", "0.53309715", "0.5328304", "0.53263116", "0.53233635", "0.5318883", "0.5304426", "0.5304197", "0.5289564", "0.52885586", "0.52833575", "0.528061", "0.5280423", "0.527544", "0.52676636", "0.52671283", "0.5263765", "0.5260289", "0.52561516", "0.52546513", "0.52509505", "0.5246108", "0.52438354", "0.524258", "0.52401346", "0.5237667", "0.52338916", "0.52283055", "0.52191675" ]
0.8098759
0
Get user agent details for a snippet.
def snippet_user_agent_details(id) get("/snippets/#{id}/user_agent_detail") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent\n @data[\"user_agent\"]\n end", "def get_user_agent\n user_agent\n end", "def user_agent\n @headers['User-Agent']\n end", "def user_agent\n @headers['User-Agent']\n end", "def user_agent\n @headers['User-Agent']\n end", "def harvest_user_agent\n return \"TimeTrackingConsolidator ([email protected])\"\n end", "def user_agent\n @request['User-Agent']\n end", "def user_agent\n @agent.user_agent\n end", "def user_agent\n headers[\"HTTP_USER_AGENT\"] || headers[\"USER-AGENT\"]\n end", "def user_agent; end", "def user_agent; end", "def user_agent; end", "def user_agent_on_header\n request.headers['HTTP_USER_AGENT']\n end", "def ua\n @ua ||= begin\n request.env['HTTP_USER_AGENT'].downcase\n rescue\n ''\n end\n end", "def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end", "def getUserAgent()\n printDebugMessage('getUserAgent', 'Begin', 11)\n clientRevision = '$Revision$'\n clientVersion = '0'\n if clientRevision.length > 11\n clientVersion = clientRevision[11..-3]\n end\n userAgent = \"EBI-Sample-Client/#{clientVersion} (#{self.class.name}; Ruby #{RUBY_VERSION}; #{RUBY_PLATFORM}) \"\n printDebugMessage('getUserAgent', \"userAgent: #{userAgent}\", 11)\n printDebugMessage('getUserAgent', 'End', 11)\n return userAgent\n end", "def getUserAgent()\n printDebugMessage('getUserAgent', 'Begin', 11)\n clientRevision = '$Revision$'\n clientVersion = '0'\n if clientRevision.length > 11\n clientVersion = clientRevision[11..-3]\n end\n userAgent = \"EBI-Sample-Client/#{clientVersion} (#{self.class.name}; Ruby #{RUBY_VERSION}; #{RUBY_PLATFORM}) \"\n printDebugMessage('getUserAgent', \"userAgent: #{userAgent}\", 11)\n printDebugMessage('getUserAgent', 'End', 11)\n return userAgent\n end", "def http_user_agent\n # User agent is required for cookie validation\n request.env['HTTP_USER_AGENT'].to_s\n end", "def getUserAgent()\n\t\t\tUSER_AGENT\n\t\tend", "def some_user_agent\n \"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20090920 Firefox/3.5.3 (Swiftfox)\"\n end", "def user_agent\n \"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3\"\n end", "def name\n Agent.name_for_user_agent string\n end", "def get_user_agent\n # If `browser` method is called from a rails view\n if defined?(controller)\n controller.view_context.request.user_agent\n\n # Else `browser` method was called from a ruby component\n elsif defined?(view_context)\n view_context.request.user_agent\n end\n end", "def user_agent\n @user_agent || USER_AGENT\n end", "def user_agent\n @user_agent || USER_AGENT\n end", "def user_agent\n kernel = Facter[:kernel] ? Facter[:kernel].value : 'unknown'\n kvers = Facter[:kernelversion] ? Facter[:kernelversion].value : 'unknown'\n values = {\n 'razor' => MK::VERSION,\n 'facter' => Facter.version, # sigh\n 'ruby' => RUBY_VERSION,\n 'kernel' => \"#{kernel}-#{kvers}\"\n }.reject{|k,v| v.nil?}.map{|k,v| k+'/'+v}.join(' ')\n end", "def ua_string\n window.execute_script('navigator.userAgent')\n end", "def user_agent\n self.class.user_agent ||= USER_AGENTS.shuffle.first\n end", "def user_agent\n @request[FUA]\n end", "def user_agent (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_useragent(to_native, value)\n\t\telse\n\t\t\tto_native[:useragent]\n\t\tend\n\tend", "def agent\n @agent ||= Sawyer::Agent.new('', sawyer_options) do |http|\n http.headers[:user_agent] = user_agent\n end\n end", "def user_agent_string\n user_agent_tokens.reverse.join(' ')\n end", "def user_agent=(user_agent); end", "def engine\n Agent.engine_for_user_agent string\n end", "def user_agent(agent)\n headers.update 'User-Agent' => agent\n end", "def default_user_agent\n \"#{NAME}/#{VERSION} (Ruby/#{RUBY_VERSION})\"\n end", "def user_agent\n @options[:user_agent] || \"Ruby Twitter Gem\"\n end", "def agent\n anonymous? ? nil : user.agent\n end", "def user_agent_string(id)\n case id\n when :ie\n 'MSIE'\n when :safari\n 'Safari'\n when :chrome\n 'Chrome'\n when :opera\n 'Opera'\n when :firefox\n 'Firefox'\n else\n raise \"Define mising browser agent: #{id.inspect}\"\n end\nend", "def user_agent(vendor: T.unsafe(nil)); end", "def user_agent(user_agent)\n @user_agent = user_agent\n end", "def bot_user_agent(vendor: T.unsafe(nil)); end", "def user_agent(string)\n string = string.to_s\n return nil if string.empty?\n UserAgent.new(string)\n end", "def initialize user_agent\n @user_agent = user_agent.strip\n end", "def initialize user_agent\n @user_agent = user_agent.strip\n end", "def initialize user_agent\n @user_agent = user_agent.strip\n end", "def initialize user_agent\n @user_agent = user_agent.strip\n end", "def initialize user_agent\n @user_agent = user_agent.strip\n end", "def user_agent(value)\n value || DEFAULT_USER_AGENT\n end", "def user_agent\n [\n \"#{config.application_name}/#{config.application_version}\",\n \"google-api-ruby-client/#{Google::APIClient::VERSION::STRING}\",\n Google::APIClient::ENV::OS_VERSION,\n '(gzip)'\n ].join(' ').delete(\"\\n\")\n end", "def user_agent_alias=(name); end", "def agent_details\n authenticate_request\n if @current_user && !@current_user.is_developer\n details = @current_user.details\n render json: details, status: 200\n end\n end", "def headers\n { 'User-Agent' => user_agent }\n end", "def user_system_info\n {\n :system => NoPlanB::HttpHeaderUtils.extract_system_info(request.env['HTTP_USER_AGENT']),\n :browser => NoPlanB::HttpHeaderUtils.extract_browser_info(request.env['HTTP_USER_AGENT']),\n :ip_address => request.remote_ip\n }\n end", "def user_agent\n \"SocketLabs-ruby/#{VERSION};ruby(#{RUBY_VERSION})\"\n end", "def user_agent\n # This particular string is required by the Discord devs.\n required = \"DiscordBot (https://github.com/meew0/discordrb, v#{Discordrb::VERSION})\"\n @bot_name ||= ''\n\n \"rest-client/#{RestClient::VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL} discordrb/#{Discordrb::VERSION} #{required} #{@bot_name}\"\n end", "def user_agent\n # This particular string is required by the Discord devs.\n required = \"DiscordBot (https://github.com/meew0/discordrb, v#{Discordrb::VERSION})\"\n @bot_name ||= ''\n\n \"rest-client/#{RestClient::VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL} discordrb/#{Discordrb::VERSION} #{required} #{@bot_name}\"\n end", "def analytics_ua\n h Settings.analytics_ua\n end", "def generate_user_agent(extra_ids = [])\n agent_app = @config.read('authentication.user_agent')\n extra_ids << ['AwApi-Ruby/%s' % BingAdsApi::ApiConfig::CLIENT_LIB_VERSION]\n super(extra_ids, agent_app)\n end", "def user_agent\n if defined?(::RUBY_VERSION) && defined?(::RUBY_PLATFORM)\n ruby_description = \"(ruby #{::RUBY_VERSION} #{::RUBY_PLATFORM}) \" # NOTE: the trailing space!\n end\n zlib_version = \"zlib/#{Zlib.zlib_version}\" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)\n \"NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}\"\n end", "def useragent=(value)\n Curl.set_option(:useragent, value_for(value, :string), handle)\n end", "def user_agent\n ENV[\"CHEF_API_USER_AGENT\"] || config[\"CHEF_API_USER_AGENT\"] || USER_AGENT\n end", "def generate_user_agent(product, file_name)\n emit_user_agent(\n product, nil,\n [\n 'TODO(alexstephen): Check how to get the original Chef user agent.',\n 'TODO(alexstephen): Check how to fetch cookbook version.'\n ],\n file_name\n )\n end", "def browser\n Browser.new(user_agent)\n end", "def user_agent\n \"pokitdok-ruby 0.8 #{RUBY_DESCRIPTION}\"\n end", "def generate_user_agent(extra_ids = [])\n agent_app = @config.read('authentication.user_agent')\n extra_ids << ['AwApi-Ruby/%s' % YahooAdApi::ApiConfig::CLIENT_LIB_VERSION]\n super(extra_ids, agent_app)\n end", "def user_agent= user_agent\n @agent.user_agent = user_agent\n end", "def headers\n {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'}\n end", "def user_agent_alias= name\n self.user_agent = AGENT_ALIASES[name] ||\n raise(ArgumentError, \"unknown agent alias #{name.inspect}\")\n end", "def user_agent=(name)\n @user_agent = USER_AGENT[name] || USER_AGENT['bot']\n end", "def user_snippet(id)\n get(\"/snippets/#{id}\")\n end", "def user_agent=(user_agent)\n @attributes[\"user_agent\"] = user_agent\n end", "def convert_user_agent(value, definition)\n value # TODO\n end", "def user_agent\n 'eventful-ruby/%s (Rubygems; Ruby %s %s)' % [Eventful::VERSION, RUBY_VERSION, RUBY_PLATFORM]\n end", "def ua_tracking_snippet(ga_tracking_code=nil)\n ga_tracking_code ||= @config[:ga_tracking_code] || \"UA-xxxxxx-x\"\n js = <<-EOS\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{ga_tracking_code}', 'auto');\n ga('send', 'pageview');\n EOS\n content_tag('script', js, { :type => 'text/javascript' })\n end", "def user_agent\n \"BookingSync API gem v#{BookingSync::API::VERSION}\"\n end", "def user_agent\n ruby_description = ''\n # note the trailing space!\n ruby_description << \"(ruby #{::RUBY_VERSION} #{::RUBY_PLATFORM}) \" if defined?(::RUBY_VERSION) && defined?(::RUBY_PLATFORM)\n zlib_version = ''\n zlib_version << \"zlib/#{Zlib.zlib_version}\" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)\n \"NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}\"\n end", "def show\n render json: @user_agent\n end", "def browser_data(browser)\n @data[\"agents\"][CAN_I_USE_NAMES[browser]]\n end", "def get_agent\n\t\tagent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }\n\tend", "def validate_user_agent(_item)\n nil\n end", "def user_agent=(user_agent)\n @request_headers['User-Agent'] = user_agent\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end", "def os\n Agent.os_for_user_agent string\n end", "def default_header\n {\n \"User-Agent\" => user_agent\n }\n end", "def agent\n @agent ||= Mechanize.new do |agent|\n agent.user_agent_alias = 'Mac Safari'\n end\n end", "def user_agent\n \"PriceHubbleGem/#{PriceHubble::VERSION}\"\n end", "def init_user_agent(options)\n @headers ||= {}\n @headers['User-Agent'] = options[:user_agent] || default_user_agent\n end", "def sanitize_user_agent(string)\n user_agent = user_agent(string)\n return nil unless user_agent\n user_agent.to_s\n end", "def ua_parser(agent)\n # Load all user agent data / regexp / patterns once\n @ua ||= UserAgentParser::Parser.new\n @ua.parse(agent)\n end", "def user_variables\n {:ip=>request.remote_ip, :user_agent=>request.env['HTTP_USER_AGENT'], :referrer=>request.env['HTTP_REFERER']}\n end", "def agent_alias value\n\t\tself.out \"agent_alias #{value}\"\n\t\[email protected]_agent_alias = value#'Mac Safari' \n\tend", "def snip\n @app.soup[snip_name]\n end", "def index\n validate_arguments!\n\n display(Mortar::USER_AGENT)\n end", "def specialty\n self.dig_for_string(\"agentSummary\", \"specialty\")\n end", "def get_useragent(hid = false, no_flash = false)\n if get_carrier() != CARRIER_DOCOMO || hid == false || (not has_key?(:hid))\n return @props[:useragent]\n end\n\n ua = @props[:useragent].dup\n unless ua.to_s == ''\n if ua =~ /DoCoMo\\/1.0/ # PDC\n ua.concat '/' + self['hid'] unless self['hid'].nil?\n else # FOMA\n param_start = ua.index('(')\n ua = ua[0, param_start] unless param_start.nil?\n\n ua.concat '(c100;TB'\n ua.concat ';' + self[:hid]\n ua.concat ';' + self[:icc] if has_key?(:icc)\n ua.concat ')'\n\n # ua.gsub!(/;TB/, ';TC') unless no_flash\n end\n end\n return ua\n end", "def get_page(uri)\n agent.get(URI(uri))\n end", "def agent\n @agent ||= Sawyer::Agent.new(endpoint, sawyer_options) do |http|\n http.headers[:accept] = default_media_type\n http.headers[:content_type] = \"application/json\"\n http.headers[:user_agent] = user_agent\n end\n end", "def mobile_phone\n self.dig_for_string(\"agentSummary\", \"mobilePhone\")\n end", "def ipad\n 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10'\nend", "def random_user_agent\n agent_version = ['Chrome/43.0.2357', 'Chrome/44.0.2403', 'Chrome/45.0.2454', 'Chrome/46.0.2490', 'Chrome/47.0.2526', 'Chrome/48.0.2564', 'Chrome/49.0.2623', 'Chrome/50.0.2661', 'Chrome/51.0.2704', 'Chrome/52.0.2743', 'Chrome/53.0.2785', 'Chrome/54.0.2840', 'Chrome/55.0.2883', 'Chrome/56.0.2924', 'Chrome/57.0.2987', 'Chrome/58.0.3029', 'Chrome/59.0.3071', 'Chrome/61.0.3163', 'Chrome/62.0.3202', 'Chrome/64.0.3282']\n index_number = rand(0...agent_version.length)\n agent_version[index_number]\n end" ]
[ "0.68625015", "0.67451423", "0.648771", "0.648771", "0.648771", "0.64798355", "0.6454123", "0.6439662", "0.6254034", "0.62220424", "0.62220424", "0.62220424", "0.61704874", "0.61264014", "0.6078006", "0.60755724", "0.60755724", "0.60540515", "0.60437596", "0.60300773", "0.6028159", "0.60058075", "0.5958753", "0.5924091", "0.5924091", "0.5921352", "0.5867679", "0.5858062", "0.5796834", "0.5792235", "0.57885045", "0.5674844", "0.56294423", "0.561593", "0.55180126", "0.5504577", "0.54965025", "0.54691255", "0.54684144", "0.54522943", "0.54401493", "0.5339718", "0.53379357", "0.5311793", "0.5311793", "0.5311793", "0.5311793", "0.5311793", "0.53028023", "0.52960354", "0.528674", "0.52855337", "0.52757233", "0.52616775", "0.5248333", "0.5242651", "0.5242651", "0.5233471", "0.52259845", "0.5209882", "0.51845974", "0.5172315", "0.5154625", "0.51518637", "0.51483023", "0.51400274", "0.5107248", "0.5103288", "0.50821084", "0.5073259", "0.50613266", "0.5052725", "0.50482637", "0.5046852", "0.5030678", "0.50283015", "0.49502972", "0.49407274", "0.49392983", "0.49212554", "0.48923126", "0.4856429", "0.4849965", "0.4824368", "0.47912717", "0.47869584", "0.47806227", "0.47789824", "0.47610325", "0.47364494", "0.47295478", "0.47063425", "0.4705097", "0.47033724", "0.46823746", "0.4650467", "0.46163806", "0.46142867", "0.4596171", "0.45886987" ]
0.832505
0
Add member to usergroup
def add_member(id, user) client.post("#{path}/#{id}/members", user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_group_as_member(group)\n self.groups.push group\n end", "def add_user_member(user, group)\n ids = users_by_group_id(group.id).push(user).map(&:id)\n current_ids = users_by_group_id(group.id).map(&:id)\n create_member(ids, current_ids, 'User', inherited_by: group.id, destroy: false)\n end", "def add_user_to_group(user, group)\n\t\t\tend", "def add_member\n @group = Group.find(params[:id])\n @user = User.find_by_username(params[:username])\n\n unless @user.nil? || @group.users.include?(@user)\n @group.users << @user\n flash[:notice] = \"Miembro añadido exitosamente.\" if @group.save\n else\n flash[:error] = \"No se pudo añadir a este usuario. Verifique que el usuario a añadir sea el correcto.\"\n end\n\n redirect_to group_path(@group)\n end", "def add(user)\n GroupMembers.new(:id => id).post(user)\n end", "def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => group_id, :user_id => user_id)\n \tm.save\n end", "def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end", "def addMembers (group_id, user_id)\n \tm = GroupUser.new(:group_id => @group_id, :user_id => @user_id)\n \tm.save\n end", "def add_member(user)\n update_membership(user, true)\n end", "def add_member(user)\n if (!self.members.include?(user))\n self.members << user\n else\n raise GroupsManagement::UserIsAlreadyMember, \"The user \" + user.email + \" is already a member of '\" + self.name + \"'.\"\n end\n end", "def add_group_member(group_id, user_id)\n post(\"/v1/groups/#{group_id}/members\", id: user_id)\n end", "def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end", "def add_group_member(team_id, user_id, access_level)\n post(\"/groups/#{team_id}/members\", :body => {:user_id => user_id, :access_level => access_level})\n end", "def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end", "def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend", "def add_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n raise unless group.exists?\n self[:groupmembers] << group.generateduid.first \n self[:groupmembers].uniq!\n end", "def add_user(newuser)\n @group_users.push(newuser)\n end", "def add_group_members(members)\n logger.debug(\"#{new_resource} adding members #{members.join(\", \")}\") unless members.empty?\n members.each do |user|\n shell_out!(\"user\", \"mod\", \"-G\", new_resource.group_name, user)\n end\n end", "def add(response)\n toggle_membership(response, :add_user_to_group, \"user_added\", \"user_already_in\")\n end", "def add_member(user, group)\n relation = group.group_member_relations.find_or_initialize_by(user: user, accepted_at: nil)\n relation.accepted_at = Time.now\n relation.accepter = self\n relation.save\n end", "def add_to_group(group_id, users)\n url = \"/groups/#{group_id}/members\"\n body = {\n members: users\n }\n post(url, body)\n end", "def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end", "def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end", "def add_members_to_group(id, params = {})\n put(\"/groups/#{id}/members\", params)\n end", "def create\n @group = current_user.groups.build(:name => params[:group][:name])\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'new'\n end\n\n end", "def add(group, members)\n @group[group] = members(group) | members\n end", "def add_group_member\n @group_member = RockGroupMember.find_or_initialize_by({\n GroupId: @group_id,\n PersonId: person.mapped_record.person_alias.PersonId\n })\n @group_member.IsSystem = false\n @group_member.GroupRoleId = 266 # member for worship services\n @group_member.GroupMemberStatus = 1 #\n @group_member.Guid = SecureRandom.uuid\n @group_member.CreatedDateTime = Time.new\n @group_member.Note = 'Imported From Arena'\n\n @group_member.save!\n end", "def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend", "def addUserToGroup(uid, groupId)\r\n uri = sprintf(\"/api/v1/groups/%d/memberships\", groupId)\r\n\t $canvas.post(uri, {'user_id' => uid})\r\nend", "def add_user_to_usergroup(group)\n groups = `getent group | grep #{group} | cut -d \":\" -f1`.split(\"\\n\").join(',')\n if groups.empty?\n @ui.error(\"Cannot add user to #{group} group. #{group} group not found\") if groups.empty?\n return ERROR_RESULT\n end\n run_command(\"sudo usermod -a -G #{group} $(whoami)\")[:value].success?\n end", "def add_member\n return unless (request.post? && params[:student_user_name])\n # add member to the group with status depending if group is empty or not\n grouping = Grouping.find(params[:grouping_id])\n @assignment = Assignment.find(params[:id], include: [{groupings: [{student_memberships: :user, ta_memberships: :user}, :group]}])\n student = Student.find_by_user_name(params[:student_user_name])\n if student.nil?\n @error = \"Could not find student with user name #{params[:student_user_name]}\"\n render :error_single\n return\n end\n set_membership_status = grouping.student_memberships.empty? ?\n StudentMembership::STATUSES[:inviter] :\n StudentMembership::STATUSES[:accepted]\n grouping.invite(params[:student_user_name], set_membership_status)\n grouping.reload\n @grouping = construct_table_row(grouping, @assignment)\n end", "def addUserToGroup\n @user_to_add = User.find(params[:user_to_add])\n @current_group = Group.find_by_id(session[:current_group_id])\n @user_to_add.groups << @current_group\n redirect_to findAvailableUsers_url, notice: 'User was successfully added.'\n end", "def add_member(user)\n members << user unless has_member? user\n end", "def add_member(member)\n Rails.logger.info(\"------------adding #{member} to circle\")\n if !self.circle.users.include?( member )\n member.memberships.create(:circle => self.circle)\n UserMailer.notify_added_to_circle(self,member).deliver\n #send email\n else\n Rails.logger.info(\"--------------already a member!\") \n end\n end", "def add username\n @members.add username\n end", "def add_member(user)\n user.add_role(:member, self)\n end", "def add_to_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n if gm.nil?\n gm = self.actor_containers.create(:group => group, :actor => self)\n end\n\n gm\n end", "def add_user_to_group(orgname, user, groupname, actor=nil)\n alter_group(orgname, groupname, :add, :user, user.name, actor)\n end", "def create\n @group = Group.new(group_params)\n member = Member.create\n @group.members << member\n current_user.members << member\n\n @group.owner = member\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end", "def join_group(user = nil, role = nil)\n role = 'member' if role != 'admin'\n raise 'NotValidGroup' if id.nil?\n raise 'AlreadyMember' if member?(user)\n user_group = Membership.new(\n user_id: user.id,\n group_id: id,\n role: role\n )\n user_group.save!\n user_group\n end", "def addMember(group_or_eperson)\n raise 'must give non nil group_or_eperson' if group_or_eperson.nil?\n\n @model.addMember(group_or_eperson)\n @model.update\n @model\n end", "def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_member(user, id = nil)\n raise \"The user \\\"#{user.name}\\\" is already a member of the team, \\\"#{self.name}\\\"\" if user?(user)\n t_user = TeamsUser.create(user_id: user.id, team_id: self.id)\n parent = TeamNode.find_by(node_object_id: self.id)\n TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)\n add_participant(self.parent_id, user)\n end", "def add_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.post(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/$ref\", { \n \n body: user_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n \"Content-Type\" => 'application/json', \n\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end", "def add_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group(self)\n end", "def add_default_group_membership!\n return if guest?\n return if Account.global_tenant?\n\n Hyrax::Group.find_or_create_by!(name: Ability.registered_group_name).add_members_by_id(id)\n end", "def ldap_add_members!\n Rails.logger.tagged(:ldap) { Rails.logger.info \"Looking up an LDAP group matching '#{name}'\" }\n\n portus_user = User.portus\n usernames = users.map(&:username)\n\n ::Portus::LDAP::Search.new.find_group_and_members(name).each do |member|\n next if usernames.include?(member)\n next unless User.exists?(username: member)\n\n add_team_member!(portus_user, member)\n end\n\n update!(ldap_group_checked: Team.ldap_statuses[:checked], checked_at: Time.zone.now)\n end", "def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end", "def add_user_to_group(default_group)\n if default_group.present?\n default_group.split(',').each do |group_name|\n if group = Group.named(group_name).first\n group.users << @user\n elsif logger\n logger.warn \"MailHandler: could not add user to [#{group_name}], group not found\"\n end\n end\n end\n end", "def insert_group_member(**args)\n\t\t\tnew_member = @api.members.insert.request_schema.new({\n\t\t\t\t'email' => args[:email],\n\t\t\t\t'role' => 'MEMBER'\n\t\t\t\t})\n\t\t\tres = @client.execute(\n\t\t\t\t:api_method => @api.members.insert,\n\t\t\t\t:parameters => {'groupKey' => args[:group_email]},\n\t\t\t\t:body_object => new_member\n\t\t\t\t)\n\t\t\treturn unJSON(res.body)\n\t\tend", "def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end", "def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end", "def add_member(user, _assignment_id = nil)\n raise \"The user #{user.name} is already a member of the team #{self.name}\" if user?(user)\n can_add_member = false\n unless full?\n can_add_member = true\n t_user = TeamsUser.create(user_id: user.id, team_id: self.id)\n parent = TeamNode.find_by(node_object_id: self.id)\n TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)\n add_participant(self.parent_id, user)\n ExpertizaLogger.info LoggerMessage.new('Model:Team', user.name, \"Added member to the team #{self.id}\")\n end\n can_add_member\n end", "def add_member(user)\r\n fail \"missing user\" if user.nil?\r\n\r\n @member_limits.store(user.email, Limit.create(user, self))\r\n self.members.store(user.email, user)\r\n end", "def add_user!( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group!(self)\n end", "def add(response)\n return unless valid_message?(response)\n\n if Lita::Authorization.add_user_to_group(response.user, @user, @group)\n response.reply \"#{@user.name} was added to #{@group}.\"\n else\n response.reply \"#{@user.name} was already in #{@group}.\"\n end\n end", "def add_member(user, send_invite = false, send_message = false)\n member_id = Ecircle.client.\n create_member(:userId => user.id, :groupId => @id,\n :invite => send_invite, :sendMessage => send_message)\n Ecircle::Member.find_by_id(member_id)\n end", "def add_member\n become_member = $browser.element(@selector).link(text: 'Become a Member')\n become_member.click if become_member.exist?\n\n add_new = $browser.element(@selector).link(text: 'Add New')\n add_new.click if add_new.exist?\n end", "def add_user(member)\n user = @member_class.new :name => member, :node => self.node\n raise unless user.exists?\n self[:users] << member\n self[:users].uniq!\n end", "def add_group(group, gid=nil)\n\t\t\tend", "def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end", "def addmember(user)\n\t\t#generate random leid for mailchimp\n\t\tuser.euid = rand(1 .. 500000000).to_s\n\t\tuser.save\n\t\t#assuming LEID is our user id and EUID is mailchimp's unique one\n\t\t#taken from here https://bitbucket.org/mailchimp/mailchimp-api-ruby/\n\t\tsubscribers = [{ \"EMAIL\" => { \"email\" => user.email,\n \"LEID\" => user.id.to_s,\n \"EUID\" => user.euid\n },\n\n :EMAIL_TYPE => 'html',\n :merge_vars => { \"FNAME\" => user.first_name,\n \"LNAME\" => user.last_name,\n \"STATUS\" => \"Subscribed\"\n }\n }]\n\n #batch-subscribe(string apikey, string id, array batch, boolean double_optin, boolean update_existing, boolean replace_interests)\n \[email protected]_subscribe(@mli, subscribers, false, true, false)\n\tend", "def add(name, ugid, homedir)\n fail 'user already exists' if include?(name)\n syscmd(\"groupadd -g #{ugid} #{name}\")\n syscmd(\"useradd -u #{ugid} -g #{ugid} -d #{homedir} -c #{COMMENT} #{name}\")\n exclusively { users[name] = ugid }\n end", "def add_to_group(team, this_user)\n team[:user_ids] << this_user\n end", "def add_user_to_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend", "def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def add_member(_team, _user, _role: :reader, _email: false)\n # stub\n end", "def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def add_member(entity, role_id = IdeasUsers::MENTOR)\n return false if self.users.include?(entity)\n IdeasUsers.create(:user_id => entity.id, :idea_id => self.id, :role_id => role_id)\n NotificationWorker.added_member(entity, self)\n end", "def add_user_to_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddUserToGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def add_group(user)\n cmd_args = [\"'#{user.group}'\"]\n cmd_args.unshift '--system' if user.is_system\n\n groupadd_args = cmd_args.join \"\\s\"\n groupmod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupmod #{groupmod_args}\n else\n /usr/sbin/groupadd #{groupadd_args}\n fi\n HERE\n end", "def add_members_to_group(team_id, group_id, user_ids)\n params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end", "def add_group_to_members(working_group, member_type,\n team_members, all_wg_members)\n return unless working_group.member? member_type\n\n wg_members = working_group[member_type].map {|i| team_members[i]}\n working_group[member_type] = wg_members\n\n wg_members.each do |member|\n unless member.member? 'working_groups'\n member['working_groups'] = []\n end\n member['working_groups'] << working_group\n all_wg_members[member['name']] = member\n end\n end", "def add_group(user)\n # NB: system users aren't supported on solaris 10\n return <<-HERE.undent\n if ! getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupadd '#{user.group}'\n fi\n HERE\n end", "def update_group_member_set(principal, members)\n end", "def join_group(user_group, admin=0)\n Membership.create!(:user => self,\n :user_group => user_group,\n :admin => admin,\n :accepted_at => Time.now) unless user_group.is_member?(self)\n end", "def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end", "def create\n @member = GroupMember.new(params[:member])\n if @current_member.group.add_member @member\n render :json=>{success:true, new_id:@member.id}\n UserMailer.invite_email(@member.email).deliver\n else\n render :json=>{success:false, errors:@member.errors}\n end\n end", "def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current_user.to_s} has added you to user group: #{group.name}\",\n group, \n \"group\"\n )\n else\n group.admin.each do |admin|\n admin.notify(\n \"#{current_user.to_s} has requested to be added to the user group: #{group.name}\",\n group,\n \"group\"\n )\n end\n end\n end\n if users.count === 1 && users.first === current_user\n flash[:notice] = \"Request sent!\"\n else\n flash[:notice] = \"#{\"Invitation\".pluralize(users)} sent!\"\n end\n end\n respond_to do |format|\n format.json { render :json => {}, :status => :ok }\n format.html {\n if users\n flash.now[:success] = \"Group membership pending for #{users.map(&:username).join(', ')}.\"\n end \n redirect_to group_path(group) \n }\n end\n end", "def invite_to_group(user_group, user)\n if user_group.is_member?(self) and not user_group.is_member?(user)\n membership = Membership.create_with_notification!(:user => user,\n :user_group => user_group,\n :admin => false,\n :invited_by => self,\n :invited_at => Time.now)\n return true unless membership.blank?\n end\n return false\n end", "def post(member, request_opts={})\n unless member.is_a?(User)\n raise DataTypeError.new(\"User object is expected, but got [#{member.inspect}]\")\n end\n member = GroupMember.new(:group_id => self.id, :member_id => member.id)\n http(request_opts).post(resolved_path, member.as_hash)\n end", "def create\n @group = Group.new(params[:group])\n @group.users.push @current_user\n \n respond_to do |format|\n if @group.save\n @group.invite params[:invite_emails].split(',')\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def addmember\n\t\t@member=User.new\n\t\tend", "def add_guild_member(guild_id, user_id, access_token:, nick: nil, roles: nil, mute: nil, deaf: nil)\n response = request(\n :guilds_gid_members_uid, guild_id,\n :put,\n \"guilds/#{guild_id}/members/#{user_id}\",\n access_token: access_token, nick: nick, roles: roles, mute: mute, deaf: deaf,\n )\n\n return nil if response.status == 204\n\n Rapture::Member.from_json(response.body)\n end", "def add\n @groups = CwaGroups.new\n\n user_name_regex = /^[a-zA-Z0-9-]{3,20}$/\n\n if params[:user_name] !~ ::CwaConstants::USER_REGEX\n flash[:error] = \"You entered an invalid username!\"\n redirect_to :action => :show, :group_name => params[:group_name]\n return\n end\n\n if @groups.add_to_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_add_member(params[:user_name], params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been added to \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem adding \\\"#{params[:user_name]}\\\" to \\\"#{params[:group_name]}\\\". The user probably does not exist.\"\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end", "def add_team_member!(author, username)\n role = APP_CONFIG[\"ldap\"][\"group_sync\"][\"default_role\"]\n params = { id: id, role: TeamUser.roles[role], user: username }\n\n team_user = ::TeamUsers::BuildService.new(author, params).execute\n team_user = ::TeamUsers::CreateService.new(author, team_user).execute\n return true if team_user.valid? && team_user.persisted?\n\n Rails.logger.tagged(:ldap) do\n Rails.logger.warn \"Could not add team member: #{team_user.errors.full_messages.join(\", \")}\"\n end\n false\n end", "def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end", "def create\n if params[:member_id].nil?\n @group = Group.new(params[:group])\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n else\n # Add member to an group.\n # POST /members/:member_id/groups\n RAILS_DEFAULT_LOGGER.debug(\"Add member #{params[:member_id]} to group #{params[:post][:group_id]}.\")\n @member = Member.find(params[:member_id])\n @member.group << Group.find(params[:post][:group_id])\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully added.'\n format.html { redirect_to(@member) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def manage_group\n if new_resource.append\n members_to_be_added = [ ]\n if new_resource.excluded_members && !new_resource.excluded_members.empty?\n # First find out if any member needs to be removed\n members_to_be_removed = [ ]\n new_resource.excluded_members.each do |member|\n members_to_be_removed << member if current_resource.members.include?(member)\n end\n\n unless members_to_be_removed.empty?\n # We are using a magic trick to remove the groups.\n reset_group_membership\n\n # Capture the members we need to add in\n # members_to_be_added to be added later on.\n current_resource.members.each do |member|\n members_to_be_added << member unless members_to_be_removed.include?(member)\n end\n end\n end\n\n if new_resource.members && !new_resource.members.empty?\n new_resource.members.each do |member|\n members_to_be_added << member unless current_resource.members.include?(member)\n end\n end\n\n logger.debug(\"#{new_resource} not changing group members, the group has no members to add\") if members_to_be_added.empty?\n\n add_group_members(members_to_be_added)\n else\n # We are resetting the members of a group so use the same trick\n reset_group_membership\n logger.debug(\"#{new_resource} setting group members to: none\") if new_resource.members.empty?\n add_group_members(new_resource.members)\n end\n end", "def add_member(name, member)\n lacp = parse_lacp_mode(name)[:lacp_mode]\n grpid = /(\\d+)/.match(name)[0]\n configure_interface(member, \"channel-group #{grpid} mode #{lacp}\")\n end", "def create\n member_email = params[:member_email]\n member = User.find_by_email(member_email)\n group = Group.find(params[:group_member][:group_id])\n \n if group.owner != current_user\n respond_to do |format|\n format.html { redirect_to group, notice: 'User not authorized.' }\n format.json { render json: group, status: :not_authorized, location: group }\n end\n return\n end\n \n if member\n if !group.has_member(member_email)\n @group_member = GroupMember.new\n @group_member.user = member\n @group_member.group = group\n if @group_member.save\n message = \"Successfully added #{member_email} to the group\"\n AddUserToGroupNotifier.delay.added(@group_member.user, @current_user.name)\n end\n else\n message = \"Group already contains the member #{member_email}\"\n end\n else\n message = \"No member exists with the email #{member_email}\"\n end\n\n respond_to do |format|\n format.html { redirect_to group, notice: message }\n format.json { render json: group, status: :created, location: @group_member }\n end\n end", "def add_user_team_member(team_id, user_id, access_level)\n post(\"/user_teams/#{team_id}/members\", :body => {:user_id => user_id, :access_level => access_level})\n end", "def set_member_group\n @member_group = MemberGroup.find(params[:id])\n end", "def set_group_member\n @group_member = GroupMember.find_by(group_id:params[:id])\n end", "def promote_in_group( group )\n self.groups_where_admin_and_wrapper.push group\n end", "def add_member\n [email protected]_member(params[:username])\n member = \"\"\n if result==0\n notice = \"User does not exist. \"\n elsif result==-1\n notice = \"User already in cabal. \"\n else\n notice = \"Successfully added user to cabal. \"\n member = \", \" + params[:username]\n end\n @response = notice\n @member = member\n respond_to do |format|\n format.js {}\n end\n end", "def request_membership_of(user_group)\n Membership.create!(:user => self,\n :admin => false,\n :user_group => user_group)\n end", "def add_creator_as_member\n Membership.add_membership(created_by_id, id)\n end" ]
[ "0.8129533", "0.8114213", "0.8070852", "0.8070257", "0.7820665", "0.7810652", "0.77881706", "0.7749405", "0.7713207", "0.7700273", "0.7693648", "0.75566113", "0.754295", "0.75424236", "0.74921227", "0.74745256", "0.739522", "0.739209", "0.73549634", "0.73436064", "0.7336587", "0.7332406", "0.7310612", "0.72758806", "0.7272677", "0.71982366", "0.71682227", "0.715656", "0.715656", "0.7146917", "0.71423256", "0.7130751", "0.7117581", "0.707688", "0.70765513", "0.70541734", "0.70295066", "0.7022474", "0.6980977", "0.6968994", "0.6953715", "0.69512564", "0.6933706", "0.69275904", "0.69235885", "0.69176817", "0.69089574", "0.6908835", "0.6904789", "0.6883229", "0.68681616", "0.68670404", "0.6862747", "0.6850533", "0.6837455", "0.6836185", "0.6832572", "0.68233913", "0.6823376", "0.6813505", "0.6803696", "0.6802836", "0.6795611", "0.6788738", "0.6759967", "0.6738831", "0.6731949", "0.6724023", "0.671067", "0.6692921", "0.6687737", "0.66756874", "0.6670104", "0.6660809", "0.66369677", "0.66321605", "0.66250134", "0.66177106", "0.65902805", "0.65687937", "0.6561472", "0.65613085", "0.6559595", "0.6553097", "0.6549515", "0.6534739", "0.6531299", "0.65301067", "0.651625", "0.65146726", "0.6462239", "0.6461171", "0.64545614", "0.6436824", "0.6431938", "0.64279556", "0.6426877", "0.6424193", "0.64179605", "0.6416358" ]
0.6696365
69
Remove member from usergroup
def remove_member(id, user) client.delete("#{path}/#{id}/members", user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end", "def remove_user_from_group(user, group)\n\t\t\tend", "def remove(user)\n GroupMember.new(:group_id => id, :member_id => user.id).delete\n end", "def remove_group_member(team_id, user_id)\n delete(\"/groups/#{team_id}/members/#{user_id}\")\n end", "def remove_member(user)\n update_membership(user, false)\n end", "def remove_user!( user )\n user.remove_group!( self )\n end", "def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end", "def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end", "def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end", "def remove_group_member(group_id, user_id)\n delete(\"/v1/groups/#{group_id}/members/#{user_id}\")\n end", "def remove_member(user)\n members.delete user if has_member? user\n end", "def rm_user(member)\n self[:users].delete member\n end", "def remove(response)\n toggle_membership(response, :remove_user_from_group, \"user_removed\", \"user_not_in\")\n end", "def del_member(_user_id)\n update!(del_members: [_user_id])\n end", "def rm_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n return nil unless group.exists?\n self[:groupmembers].delete group.generateduid.first\n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def remove_member(user)\n raise 'cannot remove admin, set a new admin first!' if user == self.admin\n raise \"cannot remove member #{user.name}, he isn't a member!\" unless self.members.include?(user)\n\n members.delete(user)\n end", "def remove_group(group)\n self.groups.destroy group \n end", "def remove_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.delete(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/#{user_id}/$ref\", { \n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end", "def remove_member(user)\r\n fail \"not enough admins left\" if self.is_last_admin?(user)\r\n\r\n @member_limits.delete(user.email)\r\n self.members.delete(user.email)\r\n self.admins.delete(user.email) if self.is_admin?(user)\r\n end", "def remove_member(_team, _user)\n # stub\n end", "def remove_member(name, member)\n grpid = /(\\d+)/.match(name)[0]\n configure_interface(member, \"no channel-group #{grpid}\")\n end", "def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end", "def remove_from_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:remove_user)\n # just be lazy and hand off to the group to do the work...\n group.remove_user(self)\n end", "def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend", "def remove_member(mbr_id)\n member = student_memberships.find(mbr_id)\n if member\n # Remove repository permissions first\n member.destroy\n if member.membership_status == StudentMembership::STATUSES[:inviter] &&\n (member.grouping.accepted_student_memberships.length > 0)\n membership = member.grouping.accepted_student_memberships.first\n membership.membership_status = StudentMembership::STATUSES[:inviter]\n membership.save\n end\n end\n end", "def remove\n @group_user.remove!\n respond_to do |format|\n flash[:notice] = 'Membership was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def remove_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.remove_group(self)\n end", "def remove_user_with_custom_field()\r\n remove_user_without_custom_field\r\n GroupsUserIndexed.find_by_group_id_and_user_id(@group.id, params[:user_id]).try!(&:destroy)\r\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def remove_members_from_group(id, params = {})\n put(\"/groups/#{id}/members/remove\", params)\n end", "def destroy\n @member = Member.where(user_id: params[:user_id], group_id: params[:group_id]).take\n @member.destroy\n redirect_to root_path, notice: 'Вы удалились из группы'\n end", "def remove(response)\n return unless valid_message?(response)\n\n if Lita::Authorization.remove_user_from_group(\n response.user,\n @user,\n @group\n )\n response.reply \"#{@user.name} was removed from #{@group}.\"\n else\n response.reply \"#{@user.name} was not in #{@group}.\"\n end\n end", "def remove_user_from_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveUserFromGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def call(group_id, user_id)\n client.delete(\"/api/rest/v1/groups/#{group_id}/memberships/#{user_id}.json\")\n true\n end", "def unlink_group\n if self.parentID != nil\n Group.find(self.parentID).remove_members([self.id.to_s])\n end\n end", "def remove_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Remove failed. Can't find user #{user_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id || @current_user.id == user.id\n if group.leader_id == user.id\n render json: { error: \"Can't remove user that is the leader of the group.\" }, status: :bad_request\n return\n end\n\n membership = group.group_memberships.where(user_id: user).first\n membership.workflow_state = 'deleted'\n membership.save\n render json: { message: 'Successfully removed user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't remove user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end", "def delete_user(deluser_id)\n @group_users.delete_if { |item| item.user_id == deluser_id }\n end", "def delete_group_memberships_for_end_users\n self.group_memberships.delete_all if self.end_user?\n end", "def delete_unused_members\n if !member.nil? && !member.is_a?(User) and \nmember.roles(:true).empty?\n member.destroy\n end\n end", "def remove_from_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n return false if gm.nil?\n\n self.actor_containers.delete(gm)\n true\n end", "def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\n end", "def remove_group!( group )\n save if remove_group( group )\n end", "def remove_member\n Member.find_by(band_id: params[:id], user_id: params[:user_id]).destroy\n\n flash[:success] = \"The user is no longer part of the band!\"\n\n redirect_to band_url(params[:id])\n end", "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n if @membership.user == current_user\n flash[:success] = \"Quit #{@group.name} successfully.\"\n redirect_to @membership.group\n else\n flash[:success] = \"Removed member successfully.\"\n redirect_to group_members_url(@membership.group)\n end\n end", "def destroy_similar\n group.memberships.where(:user_id => user.id).destroy_all\n end", "def postUserGroup_admin_remove( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"post\",\"/user/group_admin_remove\",params)\n end", "def action_remove\n notifying_block do\n remove_user\n remove_group if new_resource.group\n end\n end", "def remove_all_members_from_group(id, params = {})\n delete(\"/groups/#{id}/members\", params)\n end", "def remove_member_from_list(user, list, member_id)\n delete(\"/#{user}/#{list}/members.json?id=#{member_id}\")\n end", "def remove_member\n @team = Team.find(params[:id])\n authorize @team, :update?\n\n @user = User.find(params[:user_id])\n @user.remove_role :member, @team\n\n respond_to do |format|\n format.html { redirect_to @team, notice: 'User was successfully removed as member.' }\n format.json { head :no_content }\n end\n end", "def delete_group(group)\n\t\t\tend", "def delete_group(group)\n\t\t\tend", "def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend", "def remove_user_team_member(team_id, user_id)\n delete(\"/user_teams/#{team_id}/members/#{user_id}\")\n end", "def remove_group( group )\n raise TypeError.new('not a group') unless group.is_a?(Ecore::Group)\n tmp_group_ids = self.group_ids.split(',')\n tmp_group_ids.delete(group.id)\n self.group_ids = tmp_group_ids.join(',')\n true\n end", "def remove_member(auth, server_id, user_id, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_members_uid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}\",\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end", "def remove_organization_member(org, username)\n boolean_request :delete, \"/orgs/#{org}/members/#{username}\"\n end", "def remove_group(id)\n delete(\"/groups/#{id}\")\n end", "def remove_user_from_group(group_id, user_id, options = {})\n delete(\"/groups/#{group_id}/users/#{user_id}\", options)\n end", "def remove_all_members_from_groups(id, params = {})\n delete(\"/groups/#{id}/members/remove\", params)\n end", "def remove_member_from_team(opts)\n HelloSign::Resource::Team.new post('/team/remove_member', :body => opts)\n end", "def remove_user\n group = Group.find(params[:group_id])\n user = User.find(params[:user_id])\n if (GroupsController.group_owner? current_user.id, group.id) && (user != current_user)\n group.users.delete user\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: 'Removed user successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: \"Not removed. You are not the owner of the group or you are attempting to remove the owner from the group\"}\n format.json { render json: \"Only owners can remove users from the group and owners themselves cannot be removed from the group\", status: :unauthorized}\n end\n end\n end", "def remove_from_all_groups\n self.group_memberships.each {|m| m.destroy}\n end", "def removeTeamMember _obj, _args\n \"_obj removeTeamMember _args;\" \n end", "def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end", "def remove_from_group(group)\n if (group.class == Group)\n g = group\n elsif (group.class == Fixnum)\n g = Group.find(group)\n end\n raise \"Invalid group\" unless g\n raise \"object is not in group\" unless self.groups.include?(g)\n raise \"cannot remove a middle level group\" if (self.class == Group && !Grouping.find_by_group_id(self.id).nil?)\n self.groups.delete(g)\n end", "def remove_members_from_group(team_id, group_id, user_ids)\n params = { query: [team_id, group_id, :members, :remove], req: user_ids.to_array_obj(:users) }\n\n data = endpoint(name: 'TeamUserGroups', params: params).do_put\n\n resource 'TeamUserGroup', data\n end", "def remove_member(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n\n user_name = user_name_from_params(params)\n raise ArgumentError.new(\"user_id or user_mention or user_email required\") unless user_name\n\n call_api(:method => :delete, :uri => @api_base.merge(\"room/#{room_id}/member/#{user_name}\"), :body_params => params)\n end", "def leave(group)\n group_membership_ids.include? group.id\n groups.destroy(group)\n end", "def remove_from_group\n @group_user = GroupUser.find(params[:id])\n @user_id = @group_user.user_id\n if !@login_user.belongs_to_group(@user_id).blank?\n @group_user.destroy\n @deleted = true\n @notice = \"User removed from group successfully.\"\n @group_user = @login_user.belongs_to_group(@user_id)\n if @group_user.blank?\n @defalut_group = @login_user.default_group[0]\n @new_group_user = GroupUser.create(:user_id=>@user_id,:group_id=>@defalut_group.id)\n end\n else\n @notice = \"The user must belongs to atleast one group.\"\n end\n respond_to do |format|\n format.js\n end\n \n end", "def remove_member_from_team(opts)\n HelloSign::Resource::Team.new post('/team/remove_member', body: opts)\n end", "def destroy\n begin\n @user_group.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"User group deleted\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been deleted.\")\n ensure\n redirect_to user_groups_path\n end\n end", "def remove_guild_member(guild_id, user_id, reason: nil)\n request(\n :guilds_gid_members_uid, guild_id,\n :delete,\n \"guilds/#{guild_id}/members/#{user_id}\",\n nil,\n 'X-Audit-Log-Reason': reason,\n )\n end", "def remove_member(opts)\n opts = check_params(opts,[:members])\n super(opts)\n end", "def unjoin(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.remove(self)\n\t\tend", "def admin_conversations_restrictAccess_removeGroup(options = {})\n raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?\n raise ArgumentError, 'Required arguments :group_id missing' if options[:group_id].nil?\n raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?\n post('admin.conversations.restrictAccess.removeGroup', options)\n end", "def remove_member(member)\n return unless self.organizations.include?(member)\n\n if member.association_can_delete? then\n member.destroy\n else\n member.associations.delete(self)\n end\n end", "def remove_group(name)\n visit 'groups'\n click_link name\n\n page.accept_alert do\n click_button 'group_delete'\n end\n end", "def remove_staff_member(selected)\n\ts = StaffMember.find(selected)\n\ts.destroy\nend", "def remove_member(RegisteredUser r)\n r.destroy\n unless members.include? (r)\n return false\n else\n members.delete(r)\n return true\n end\n\n # POST /groups\n # POST /groups.json\n def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # PATCH/PUT /groups/1\n # PATCH/PUT /groups/1.json\n def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # DELETE /groups/1\n # DELETE /groups/1.json\n def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end\n\n # This is a function that allows a group member to create a status in a group\n # Returns nothing\n # Time complexity: O(1)\n # Author: Mohamed Bahgat Elrakaiby\n def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end\n\n # This is a function that views members of the group\n # Returns nothing\n # Time Complexity: O(n).\n # Author: Mohamed Bahgat Elrakaiby\n def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end\n\n private\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n\n # End of autogenerated methods\n \n # start of my methods\n # This is a function that adds a member to the group by his name.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def add_member_name(name)\n\n end\n\n # This is a function that adds a member to the group by his email.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_email(email)\n\n end\n\n # This is a function that adds a member to the group by his phone number.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_phone(phone)\n\n end\n\n # This is a function that allows members in the group to accept the join requests from other users.\n # Doesn't return anything.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def accept_invitation\n \n end\n \n # This is a function that allows the user to send request to a group.\n # Doesn't return anything.\n # Time complexity: O(1).\n #Authors: Mohammed T. Nabih.\n def join_request\n \n end\n\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n \nend", "def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end", "def hcRemoveGroup _obj, _args\n \"_obj hcRemoveGroup _args;\" \n end", "def delete_user_from_group(username, groupname)\n\t\t\t\tif !user?(username)\n\t\t\t\t\traise(NoSuchUserError, \"No such user: #{username}\")\n\t\t\t\tend\n\n\t\t\t\tif !group?(groupname)\n\t\t\t\t\traise(NoSuchGroupError, \"No such user: #{groupname}\")\n\t\t\t\tend\n\t\t\tend", "def remove_user_from_mailchimp\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key)\n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list\n result = mailchimp.list_unsubscribe(list_id, self.email, true, false, true) \n Rails.logger.info(\"Mailchimp unsubscribed for email id #{self.email}\")\n end\n end", "def remove_user_group(email_address, group_id)\n # note the user is stored in the group via uid only\n user_dn = email_address\n group_dn = get_group_DN(group_id)\n\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found = ldap.search(:base => @group_base, :filter => filter).to_a()[0]\n\n if group_found\n removed = group_found[GROUP_MEMBER_ATTRIBUTE].delete(user_dn)\n if removed\n if group_found[GROUP_MEMBER_ATTRIBUTE].empty?\n if !ldap.delete(:dn => group_dn)\n raise ldap_ex(ldap, \"Could not remove user #{user_dn} for group #{group_id}\")\n end\n else\n if !ldap.replace_attribute(group_dn, GROUP_MEMBER_ATTRIBUTE, group_found[GROUP_MEMBER_ATTRIBUTE])\n raise ldap_ex(ldap, \"Could not remove user #{user_dn} for group #{group_id}\")\n end\n end\n end\n end\n end\n end", "def destroy\n @group_member = GroupMember.find(params[:id])\n\n if @group_member.group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group_member.group, notice: 'User not authorized.' }\n format.json { render json: @group_member, status: :not_authorized, location: @group_member }\n end\n return\n end\n\n group = @group_member.group\n @group_member.destroy\n\n respond_to do |format|\n format.html { redirect_to group_url(group) }\n format.json { head :no_content }\n end\n end", "def remove_role_assignments_from_group_members_if_needed\n return unless entity.type == 'Group'\n\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n entity.members.each do |m|\n logger.info \"Removing role (#{role.id}, #{role.token}, #{role.application.name}) about to be removed from group (#{entity.id}/#{entity.name} from its member #{m.id}/#{m.name})\"\n ra = RoleAssignment.find_by_role_id_and_entity_id_and_parent_id(role.id, m.id, self.id)\n if ra\n ra.destroy!\n else\n logger.warn \"Failed to remove role (#{role.id}, #{role.token}, #{role.application.name}) assigned to group member (#{m.id}/#{m.name}) which needs to be removed as the group (#{entity.id}/#{entity.name}) is losing that role.\"\n end\n end\n end\n end", "def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user_group.user_id == current_user || (current_user.admin == true && @current_user_group.group_id == @user_group.group_id)\n @user_group.destroy\n render json: {message: \"this user group has been successfully deleted\"}\n else\n render json: {:errors => @user_group.errors.full_messages}, Status: :Unauthorized\n end\n end", "def empty_group\n self.group_memberships.each {|m| m.destroy}\n end", "def unpublicize_membership(org, username)\n boolean_request :delete, \"/orgs/#{org}/public_members/#{username}\"\n end", "def student_group_remove(student_group_name)\n if not self.scenario.stopped?\n return []\n end\n\n players = []\n user = User.find(self.scenario.user.id)\n if not student_group = user.student_groups.find_by_name(student_group_name)\n errors.add(:name, \"student group not found\")\n return\n end\n student_group.student_group_users.each do |student_group_user|\n if player = self.players.find_by_user_id(student_group_user.user.id)\n players.push(player)\n player.destroy\n end\n end\n players\n end", "def leave(person)\n members.delete(person);\n end", "def destroy_group_with_extension\n # INFO: currently only a superuser can destroy a group. See CartoDB/cartodb-postgresql#114\n organization.owner.in_database(as: :superuser) do |conn|\n Carto::Group.destroy_group_extension_query(conn, name)\n end\n end", "def destroy\n contact_group = ContactGroup.find(@share_invite.contact_group_id)\n #logger.debug \"Grabbed the contact group #{contact_group} with a list of users of #{contact_group.users}\"\n contact_group.users.delete(current_user)\n @share_invite.destroy\n respond_to do |format|\n format.html { redirect_to homes_url, notice: \"#{contact_group.group_name} has been removed from your Groups list\" }\n format.json { head :no_content }\n end\n end", "def delete_member(id)\n @m = Member.find_by_society_id_and_user_id(self.id, id) #not using .where method as just 1 record is expected to be found\n if @m != nil and [email protected]\n @m.destroy\n\t\t\tadd_post(id, \"Left the society\")\n end\n end", "def remove_user_by_id(user_id)\n # ........\n end", "def delete\n @groups = CwaGroups.new\n\n if params[:user_name]\n if @groups.delete_from_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_remove_member(User.find_by_login(params[:user_name]), params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been removed from \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing \\\"#{params[:user_name]}\\\" from \\\"#{params[:group_name]}\\\"\"\n end\n else\n if @groups.delete_me_from_group params[:group_name]\n flash[:notice] = \"You have been removed from group \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing you from group \\\"#{params[:group_name]}\\\"\"\n end\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end", "def delete_member path\n rewrite_members member_paths.delete(path)\n end", "def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end" ]
[ "0.8267318", "0.8212022", "0.81986845", "0.80474216", "0.785455", "0.78542924", "0.7830964", "0.7814298", "0.7770279", "0.77317727", "0.7729017", "0.76877916", "0.7653267", "0.7618087", "0.76009494", "0.7597236", "0.75732785", "0.751058", "0.74489677", "0.7446031", "0.7413682", "0.7301154", "0.72926295", "0.7291982", "0.7239352", "0.7216551", "0.72164595", "0.7204541", "0.7204142", "0.7190001", "0.7187594", "0.71353555", "0.71166456", "0.7059746", "0.70328224", "0.70107615", "0.6941745", "0.69404984", "0.6936669", "0.69323516", "0.6910663", "0.69099027", "0.690575", "0.68919104", "0.6885973", "0.68725526", "0.6862121", "0.68321055", "0.67958724", "0.67877287", "0.67673343", "0.67635554", "0.67635554", "0.6761131", "0.6743283", "0.67004627", "0.6692415", "0.66680694", "0.66465", "0.6607363", "0.658013", "0.6553795", "0.6547398", "0.65432507", "0.65404737", "0.65357417", "0.65248567", "0.65223116", "0.6518735", "0.6511985", "0.6511545", "0.6510484", "0.65069103", "0.64855766", "0.6485529", "0.6478452", "0.6470552", "0.6430235", "0.6429542", "0.6426473", "0.64157516", "0.6414593", "0.64092785", "0.64051324", "0.6401001", "0.63879013", "0.6340923", "0.6336009", "0.63335097", "0.63309795", "0.6330637", "0.6329242", "0.6325057", "0.6318594", "0.6313035", "0.6311824", "0.63100827", "0.6304851", "0.6301909", "0.6301647" ]
0.7216261
27
GET /funds/1 GET /funds/1.json
def show @fund = Fund.friendly.find(params[:id]) render json: @fund end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\n render json: @fund\n end", "def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_fund }\n end\n end", "def index\n @funds = Fund.all\n \t\n end", "def show\n @title = t('view.trust_funds.show_title')\n @trust_fund = TrustFund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trust_fund }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n\t @funds = Fund.all\n end", "def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end", "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end", "def show\n @unpaid_debt = UnpaidDebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unpaid_debt }\n end\n end", "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @wallet_id = params[:wallet_id]\n @investment_funds = InvestmentFund.where(\"wallet_id = ?\", @wallet_id)\n end", "def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def index\n @userfunds = Userfund.all\n end", "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end", "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def show\n @money = Money.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money }\n end\n end", "def index\r\n @mutual_funds = MutualFund.all\r\n end", "def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end", "def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end", "def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end", "def index\n @fundraisers = Fundraiser.all\n end", "def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end", "def show\n @hwm_fund_type = HwmFundType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_fund_type }\n end\n end", "def show\n @income = Income.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income }\n end\n end", "def index_funds\n Bsf::Scraper::FundIndexer.new.index\n end", "def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n\n\t@project = Project.find(params[:id])\n\t@promises = Promise.all\n\t@actual = Fund.where(:project_id => @project.id).sum(:amount)\n end", "def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end", "def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end", "def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end", "def show\n @debt_paper_price = DebtPaperPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt_paper_price }\n end\n end", "def show\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end", "def show\n @hwm_fund_value = HwmFundValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_fund_value }\n end\n end", "def show\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money_receipt }\n end\n end", "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def show\n @mydebt = Mydebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mydebt }\n end\n end", "def show\n render json: @bank\n end", "def add_fund\n invoice = Spree::PaymentMethod::BitPayment.first.create_invoice(add_fund_params)\n @invoice_url = \"#{invoice['url']}\"\n render json: @invoice_url.to_json\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def show\n @income_entry = IncomeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @income_entry }\n end\n end", "def index\n @cb_funds = CbFund.all\n end", "def show\n @withdrawal = Withdrawal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @withdrawal }\n end\n end", "def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def show\n @utilized_bitcoin_wallet = UtilizedBitcoinWallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utilized_bitcoin_wallet }\n end\n end", "def index\n @investment_funds = InvestmentFund.all\n end", "def show\n @di_transaction = DiTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @di_transaction }\n end\n end", "def index\n @budgets = Budget.all\n end", "def show\n @our_coin = OurCoin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @our_coin }\n end\n end", "def index\n @financial_aid_packages = @participant.financial_aid_packages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_packages }\n end\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def taken_funds\n authenticated_post(\"taken_funds\").body\n end", "def show\n @wallet = Wallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wallet }\n end\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end", "def index\n @component_funds = ComponentFund.all\n end", "def show\n @incomestock = Incomestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomestock }\n end\n end", "def show\n @flat_rate_price = FlatRatePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flat_rate_price }\n end\n end", "def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end", "def show\n @balance = scope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @balance }\n end\n end", "def show\n @fund_exchange_activity = FundExchangeActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fund_exchange_activity }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end", "def index\n @trades = Trade.all\n render json: @trades\n end", "def show\n @rebalance_trade = RebalanceTrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rebalance_trade }\n end\n end", "def index\n @fund_applications = FundApplication.all\n end", "def show\n @paymentcash = Paymentcash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paymentcash }\n end\n end", "def show\n find_payment\n render json: @payment\n end", "def show\n @trade = Trade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trade }\n end\n end", "def show\n @settlement = Settlement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @settlement }\n end\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end", "def funding_info(symbol = \"fUSD\")\n authenticated_post(\"auth/r/funding/#{symbol}\").body\n end", "def show\n @stats_money_transaction = Stats::MoneyTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stats_money_transaction }\n end\n end", "def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def index\n get_budgets\n end", "def index\n @donation_record_actual_funds = DonationRecord::ActualFund.all\n end", "def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n @balance_detail = scope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @balance_detail }\n end\n end", "def get_financials\n render json: [current_user]\n end", "def new\n @finance = Finance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance }\n end\n end", "def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n @funding_status_option = FundingStatusOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funding_status_option }\n end\n end" ]
[ "0.7764602", "0.7490024", "0.70740074", "0.70078856", "0.6895374", "0.6871844", "0.6871844", "0.68113285", "0.6648034", "0.66044545", "0.65751237", "0.65477", "0.6480862", "0.6479069", "0.64501476", "0.641185", "0.6359536", "0.63481283", "0.63373536", "0.63302416", "0.6317559", "0.6305403", "0.6290517", "0.62848485", "0.62683606", "0.62683606", "0.6265243", "0.6265243", "0.6265243", "0.62590563", "0.622162", "0.61905664", "0.6178425", "0.61560446", "0.61512196", "0.61411995", "0.61349607", "0.61347926", "0.6118251", "0.61136806", "0.6110246", "0.61050886", "0.6102839", "0.6101202", "0.6100515", "0.6078241", "0.6076208", "0.605247", "0.6046232", "0.6037755", "0.60286415", "0.6018732", "0.6014374", "0.6010534", "0.6006022", "0.6001004", "0.59967065", "0.59915763", "0.59782875", "0.59699655", "0.5967682", "0.5960477", "0.59511477", "0.59480864", "0.59454006", "0.5936416", "0.593195", "0.59278196", "0.5925611", "0.59160674", "0.59137845", "0.5905005", "0.59028816", "0.5902684", "0.59023535", "0.5899259", "0.58989275", "0.5893925", "0.5890809", "0.5888945", "0.5886826", "0.58835346", "0.5883134", "0.58749604", "0.5873724", "0.5872999", "0.58684564", "0.58602816", "0.5859682", "0.5858736", "0.5858632", "0.58501905", "0.58430386", "0.5839048", "0.583088", "0.5827937", "0.58271736", "0.581079", "0.5810592", "0.5808033" ]
0.7769627
0
POST /funds POST /funds.json
def create @fund = Fund.new(fund_params) if @fund.save render json: @fund, status: :created, location: api_v1_fund_path(@fund) else render_validation_errors @fund.errors end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def create\n @admin_fund = Fund.new(params[:admin_fund])\n\n respond_to do |format|\n if @admin_fund.save\n format.html { redirect_to @admin_fund, notice: 'Fund was successfully created.' }\n format.json { render json: @admin_fund, status: :created, location: @admin_fund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def create\n @fund = Fund.new(fund_params)\n authorize @fund\n\n respond_to do |format|\n if @fund.save\n format.html { redirect_to @fund, notice: 'Fund was successfully created.' }\n format.json { render :show, status: :created, location: @fund }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userfund = Userfund.new(userfund_params)\n\n respond_to do |format|\n if @userfund.save\n format.html { redirect_to @userfund, notice: 'Userfund was successfully created.' }\n format.json { render :show, status: :created, location: @userfund }\n else\n format.html { render :new }\n format.json { render json: @userfund.errors, status: :unprocessable_entity }\n end\n end\n end", "def fund_params\n params.require(:fund).permit(:state, :user_id, :promise_id, :project_id, :amount)\n end", "def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @mutual_fund = MutualFund.new(mutual_fund_params)\r\n\r\n respond_to do |format|\r\n if @mutual_fund.save\r\n format.html { redirect_to @mutual_fund, notice: 'Mutual fund was successfully created.' }\r\n format.json { render :show, status: :created, location: @mutual_fund }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @mutual_fund.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @fundraiser = Fundraiser.new(params[:fundraiser])\n\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render json: @fundraiser, status: :created, location: @fundraiser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_funds\n raise \"payment must be paid\" if !payment.paid?\n\n bank_account = PagarMe::BankAccount.new(bank_account_attributes.delete(:bank_account))\n bank_account.create\n raise \"unable to create an bank account\" unless bank_account.id.present?\n\n transfer = PagarMe::Transfer.new({\n bank_account_id: bank_account.id,\n amount: value_for_transaction\n })\n transfer.create\n raise \"unable to create a transfer\" unless transfer.id.present?\n\n #avoid sending notification\n payment.update(state: 'pending_refund')\n payment.payment_transfers.create!({\n user: payment.user,\n transfer_id: transfer.id,\n transfer_data: transfer.to_json\n })\n end", "def create\n @fund = Fund.new(fund_params)\n\n respond_to do |format|\n if @fund.save\n MoneyMailer.funding_confirmation(current_user, @fund).deliver_now\n Fund.find(@fund.id).update(:state => true)\n format.html { redirect_to @fund, notice: 'Fund was successfully created.' }\n format.json { render :show, status: :created, location: @fund }\n else\n format.html { render :new }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def fund_params\n params.require(:fund).permit(:title, :slug, :fund_owners, :description, :marketing_content,\n :marketing_content_expiration, :allocation_code,\n :suggested_amount, :featured_fund, :active, :campus, :keywords,\n :interest, :fund_type)\n end", "def create\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new(params[:trust_fund])\n\n respond_to do |format|\n if @trust_fund.save\n format.html { redirect_to @trust_fund, notice: t('view.trust_funds.correctly_created') }\n format.json { render json: @trust_fund, status: :created, location: @trust_fund }\n else\n format.html { render action: 'new' }\n format.json { render json: @trust_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def fund_params\n params.require(:fund).permit(:person_id, :amount, :name, :description, :date, :external, :source)\n end", "def fund_params\n params.require(:fund).permit(:needed, :collected)\n end", "def add_fund\n invoice = Spree::PaymentMethod::BitPayment.first.create_invoice(add_fund_params)\n @invoice_url = \"#{invoice['url']}\"\n render json: @invoice_url.to_json\n end", "def taken_funds\n authenticated_post(\"taken_funds\").body\n end", "def create\n @fundraiser = Fundraiser.new(fundraiser_params)\n @fundraiser.owner_id = current_user.id\n @fundraiser.start_date = Date.current\n @fundraiser.raised = 0\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render :show, status: :created, location: @fundraiser }\n else\n format.html { render :new }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cb_fund = CbFund.new(cb_fund_params)\n\n respond_to do |format|\n if @cb_fund.save\n format.html { redirect_to @cb_fund, notice: 'Cb fund was successfully created.' }\n format.json { render :show, status: :created, location: @cb_fund }\n else\n format.html { render :new }\n format.json { render json: @cb_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @financial = Financial.new(params[:financial])\n\n respond_to do |format|\n if @financial.save\n format.html { redirect_to @financial, notice: 'Financial was successfully created.' }\n format.json { render json: @financial, status: :created, location: @financial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def userfund_params\n params.require(:userfund).permit(:user_id, :fund_id)\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end", "def show\n render json: @fund\n end", "def create\n @financial = Financial.new(financial_params)\n\n respond_to do |format|\n if @financial.save\n format.html { redirect_to @financial, notice: 'Financial was successfully created.' }\n format.json { render :show, status: :created, location: @financial }\n else\n format.html { render :new }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_funds!\n self.transfer = Stripe::Transfer.create(transfer_params)\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def investment_fund_params\n params.require(:investment_fund).permit(:name, :buyDate, :admTax, :aditionalInfo, :exitTax, :fundBegin, :manager, :managerContact, :shareValue, :capital, :wallet_id)\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @classification_fund = ClassificationFund.new(classification_fund_params)\n\n respond_to do |format|\n if @classification_fund.save\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully created.' }\n format.json { render :show, status: :created, location: @classification_fund }\n else\n format.html { render :new }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @funds = Fund.all\n \t\n end", "def create\n # raise donation_record_actual_fund_params.inspect\n @donation_record_actual_fund = DonationRecord::ActualFund.new(donation_record_actual_fund_params)\n @donation_record_actual_fund.donation_record = @donation_record\n respond_to do |format|\n if @donation_record_actual_fund.save\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :created, location: @donation_record_actual_fund }\n else\n format.html { render :new }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mutual_fund_list = MutualFundList.new(mutual_fund_list_params)\n\n respond_to do |format|\n if @mutual_fund_list.save\n format.html { redirect_to @mutual_fund_list, notice: 'Mutual fund list was successfully created.' }\n format.json { render :show, status: :created, location: @mutual_fund_list }\n else\n format.html { render :new }\n format.json { render json: @mutual_fund_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end", "def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end", "def create\n @fund_application = FundApplication.new(fund_application_params)\n\n respond_to do |format|\n if @fund_application.save\n format.html { redirect_to @fund_application, notice: 'Fund application was successfully created.' }\n format.json { render :show, status: :created, location: @fund_application }\n else\n format.html { render :new }\n format.json { render json: @fund_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @fund_request.save\n flash[:notice] = 'Fund request was successfully created.'\n format.html { redirect_to @fund_request }\n format.xml { render :xml => @fund_request, :status => :created, :location => @fund_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fund_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pay_fee = PayFee.new(pay_fee_params)\n\n respond_to do |format|\n if @pay_fee.save\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully created.' }\n format.json { render :show, status: :created, location: @pay_fee }\n else\n format.html { render :new }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render json: @debt, status: :created, location: @debt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def cb_fund_params\n params.require(:cb_fund).permit(:fund_id, :object_id, :name, :funded_at, :raised_amount, :raised_currency_code, :source_url, :source_description)\n end", "def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fund_company_investment = FundCompanyInvestment.new(fund_company_investment_params)\n\n respond_to do |format|\n if @fund_company_investment.save\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fund_company_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_funding_using_post(funding_request, opts = {})\n data, _status_code, _headers = create_funding_using_post_with_http_info(funding_request, opts)\n data\n end", "def create\n @debt = Debt.new(debt_params)\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render :show, status: :created, location: @debt }\n else\n format.html { render :new }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def create\n @bankdeposit = Bankdeposit.new(bankdeposit_params)\n\n respond_to do |format|\n if @bankdeposit.save\n format.html { redirect_to @bankdeposit, notice: 'Bankdeposit was successfully created.' }\n format.json { render :show, status: :created, location: @bankdeposit }\n else\n format.html { render :new }\n format.json { render json: @bankdeposit.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def investment_fund_params\n params.require(:investment_fund).permit(:category, :name, :redemption_period, :value)\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @component_fund = ComponentFund.new(component_fund_params)\n\n respond_to do |format|\n if @component_fund.save\n format.html { redirect_to @component_fund, notice: 'Component fund was successfully created.' }\n format.json { render :show, status: :created, location: @component_fund }\n else\n format.html { render :new }\n format.json { render json: @component_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @finance = Finance.new(params[:finance])\n\n respond_to do |format|\n if @finance.save\n format.html { redirect_to @finance, notice: 'Finance was successfully created.' }\n format.json { render json: @finance, status: :created, location: @finance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debt = Debt.new(debt_params)\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @debt }\n else\n format.html { render action: 'new' }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end", "def index_funds\n Bsf::Scraper::FundIndexer.new.index\n end", "def create\n @funding_event = FundingEvent.new(funding_event_params)\n\n respond_to do |format|\n if @funding_event.save\n format.html { redirect_to @funding_event, notice: 'Funding event was successfully created.' }\n format.json { render :show, status: :created, location: @funding_event }\n else\n format.html { render :new }\n format.json { render json: @funding_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget_for_order = BudgetForOrder.new(budget_for_order_params)\n @budget_for_order.total=0\n respond_to do |format|\n if @budget_for_order.save\n format.html { redirect_to budget_new_add_path(@budget_for_order.id), notice: 'Favor de agregar los detalles' }\n format.json { render :show, status: :created, location: @budget_for_order }\n else\n format.html { render :new }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bank = Bank.new(params[:bank])\n\n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: 'Bank was successfully created.' }\n format.json { render json: @bank, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_deposit_using_post_with_http_info(daily_deposit_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_deposit_using_post ...'\n end\n # verify the required parameter 'daily_deposit_request' is set\n if @api_client.config.client_side_validation && daily_deposit_request.nil?\n fail ArgumentError, \"Missing the required parameter 'daily_deposit_request' when calling FundingApi.create_deposit_using_post\"\n end\n # resource path\n local_var_path = '/deposit'\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(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(daily_deposit_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DailyDeposit')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_deposit_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end", "def create\n p params\n donation = Donation.new(\n amount: params[:amount],\n frequency: params[:frequency])\n # save the information from user input to create a new donation.\n donation.save!\n if donation.save!\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end", "def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @training_fund = TrainingFund.new(training_fund_params)\n\n respond_to do |format|\n if @training_fund.save\n format.html { redirect_to @training_fund.training, notice: 'Training fund was successfully added.' }\n format.json { render :show, status: :created, location: @training_fund }\n else\n format.html { render :new }\n format.json { render json: @training_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kf_diary = Kf::Diary.new(params[:kf_diary])\n\n respond_to do |format|\n if @kf_diary.save\n format.html { redirect_to kf_diaries_url({:page => params[:page]}), notice: 'Diary was successfully created.' }\n format.json { render json: @kf_diary, status: :created, location: @kf_diary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n # Assigns the correct user_id in case the user puts another user's ID\n\n @transaction.user_id = User.find_by(api_key: params[:api_key]).id\n\n if @transaction.save\n\n @coin = Coin.find(@transaction.coin_id)\n\n # If deposit, increment @coin's value, else decrement \n # Also, send email if value is less than 4\n\n if @transaction.transaction_type == 1\n @coin.update_attributes(value: @coin.value+1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n\n else\n\n # If withdraw, must ensure the value is > 0\n\n if (@coin.value > 0)\n @coin.update_attributes(value: @coin.value-1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n else\n render json: [\"Sorry! There are no more of those coins.\"], status: 422\n end\n end\n @coin.save\n\n # Return the transaction \n \n render json: @transaction\n else\n render json: @transaction.errors.full_messages, status: 422\n end\n end", "def create\n @therapy_budget = TherapyBudget.new(therapy_budget_params)\n\n respond_to do |format|\n if @therapy_budget.save\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully created.' }\n format.json { render :show, status: :created, location: @therapy_budget }\n else\n format.html { render :new }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def mutual_fund_params\r\n params.require(:mutual_fund).permit(:institution_id, :name, :minimum_principal_pesewas, :debit_order_pesewas, :management_fee_rate, :min_days_before_withdrawal, :risk_rating, :links, :email, :phone_number, :description)\r\n end", "def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kentrade = Kentrade.new(kentrade_params)\n\n respond_to do |format|\n if @kentrade.save\n format.html { redirect_to @kentrade, notice: 'Kentrade was successfully created.' }\n format.json { render :show, status: :created, location: @kentrade }\n else\n format.html { render :new }\n format.json { render json: @kentrade.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @finance = Finance.new(finance_params)\n\n respond_to do |format|\n if @finance.save\n format.html { redirect_to @finance, notice: 'Finance was successfully created.' }\n format.json { render :show, status: :created, location: @finance }\n else\n format.html { render :new }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def total_taken_funds\n authenticated_post(\"total_taken_funds\").body\n end", "def create_funding_using_post_with_http_info(funding_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_funding_using_post ...'\n end\n # verify the required parameter 'funding_request' is set\n if @api_client.config.client_side_validation && funding_request.nil?\n fail ArgumentError, \"Missing the required parameter 'funding_request' when calling FundingApi.create_funding_using_post\"\n end\n # resource path\n local_var_path = '/funding'\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(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(funding_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Funding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_funding_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @budget = Budget.new(params[:budget])\n @budget.user = current_user\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def fund_crowdsale_using_post(crowdsale_fund_params, opts = {})\n data, _status_code, _headers = fund_crowdsale_using_post_with_http_info(crowdsale_fund_params, opts)\n data\n end", "def create\n @stadium = Stadium.new(stadium_params)\n\n respond_to do |format|\n if @stadium.save\n format.html { redirect_to @stadium, notice: 'Stadium was successfully created.' }\n format.json { render :show, status: :created, location: @stadium }\n else\n format.html { render :new }\n format.json { render json: @stadium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @money_transaction = MoneyTransaction.new(params[:money_transaction])\n\n respond_to do |format|\n if @money_transaction.save\n format.html { redirect_to root_url, flash: { success: \"Founds were successfully transfered to #{@money_transaction.to.formatted_uid}\" } }\n format.json { render json: @money_transaction, status: :created, location: @money_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @money_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_financials\n current_user.update(assets: params[:assets], average_annual_income: params[:average_annual_income], credit_score: params[:credit_score], total_debt: params[:total_debt])\n user_listings = current_user.listings\n render json: [current_user, user_listings]\n end", "def create\n @fixed_deposit = FixedDeposit.new(params[:fixed_deposit])\n\n respond_to do |format|\n if @fixed_deposit.save\n flash[:notice] = 'FixedDeposit was successfully created.'\n format.html { redirect_to(@fixed_deposit) }\n format.xml { render :xml => @fixed_deposit, :status => :created, :location => @fixed_deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @debt_payment = DebtPayment.new(debt_payment_params)\n\n respond_to do |format|\n if @debt_payment.save\n format.html { redirect_to @debt_payment, notice: 'Debt payment was successfully created.' }\n format.json { render :show, status: :created, location: @debt_payment }\n else\n format.html { render :new }\n format.json { render json: @debt_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deposit = Deposit.new(deposit_params)\n @deposit.user_id = current_user.id\n @account = Account.find(@deposit.account_id)\n\n respond_to do |format|\n if @deposit.deposit\n format.html { redirect_to account_path(@deposit.account_id), notice: 'Deposit was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @deposit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @flat_details = Flat.find_by_id(transaction_params[:flat_id])\n @flat_details.balance_amount = @flat_details.balance_amount.to_i - transaction_params[:debit].to_i\n @transaction.balance = @flat_details.balance_amount\n @flat_details.save\n respond_to do |format|\n if @transaction.save\n\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @fund }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bank = Bank.new(bank_params)\n\n if @bank.save\n render :show, status: :created, location: @bank\n else\n render json: @bank.errors, status: :unprocessable_entity\n end\n end", "def create\n @mydebt = Mydebt.new(params[:mydebt])\n\n respond_to do |format|\n if @mydebt.save\n format.html { redirect_to @mydebt, notice: 'Mydebt was successfully created.' }\n format.json { render json: @mydebt, status: :created, location: @mydebt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mydebt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debt = current_user.debts.new(debt_params)\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to debts_path, notice: 'Debt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @debt }\n else\n format.html { render action: 'new' }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_fund_table\n @connection.create_table?(:funds) do\n primary_key :id\n String :symbol, :size=>255, :unique => true, :index => true\n String :name, :size=>255\n String :type, :size=>255\n String :objective, :size=>255\n String :category, :size=>255\n String :family, :size=>255\n String :style_size, :size=>6\n String :style_value, :size=>6\n Float :price\n Float :pcf # price cashflow\n Float :pb # price book\n Float :pe # price earnings\n Float :ps # price sales\n Float :expense_ratio\n Float :load_front # maximum front end sales load\n Float :load_back # maximum deferred sales load\n Fixnum :min_inv # minimum_initial_investment\n Float :turnover # annual holdings turnover\n Float :biggest_position\n Float :assets\n DateTime :created_at\n DateTime :updated_at\n end\n end", "def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end" ]
[ "0.76247156", "0.67201215", "0.6639017", "0.6637702", "0.6556015", "0.65248096", "0.6471608", "0.6471608", "0.6406482", "0.639882", "0.6394309", "0.6377749", "0.63629115", "0.6358371", "0.6312209", "0.630026", "0.62258595", "0.6196665", "0.6178535", "0.6114387", "0.6107545", "0.6107459", "0.61016953", "0.6025667", "0.60104805", "0.60090864", "0.600292", "0.59109944", "0.58812946", "0.58666503", "0.5866163", "0.58650094", "0.5863275", "0.5846826", "0.58368117", "0.58331865", "0.582513", "0.5790472", "0.5782468", "0.5776451", "0.5767503", "0.5767017", "0.5759893", "0.5756006", "0.57504165", "0.5742413", "0.5724863", "0.57190746", "0.57153195", "0.57153064", "0.5710755", "0.56861484", "0.56858826", "0.56799155", "0.56799155", "0.56799155", "0.56784916", "0.5673823", "0.5673333", "0.5653893", "0.56531346", "0.5651095", "0.5644327", "0.564087", "0.564073", "0.5639377", "0.5627164", "0.5608138", "0.5596898", "0.55737287", "0.55707824", "0.5567437", "0.5567405", "0.5566053", "0.5555448", "0.55533105", "0.55412537", "0.5536284", "0.55350286", "0.55335087", "0.5531647", "0.55276173", "0.5526341", "0.5511555", "0.55114436", "0.5510167", "0.55003864", "0.5495885", "0.547963", "0.5476955", "0.54768986", "0.5475888", "0.5464919", "0.54630995", "0.54579157", "0.54568994", "0.5453309", "0.54525083", "0.54499984", "0.5447849" ]
0.7463888
1
PATCH/PUT /funds/1 PATCH/PUT /funds/1.json
def update @fund = Fund.friendly.find(params[:id]) authorize! :manage, @fund if @fund.update(fund_params) head :no_content else render_validation_errors @fund.errors end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @fund }\n else\n format.html { render :edit }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @fund }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n if @admin_fund.update_attributes(params[:admin_fund])\n format.html { redirect_to @admin_fund, notice: 'Fund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @mutual_fund.update(mutual_fund_params)\r\n format.html { redirect_to @mutual_fund, notice: 'Mutual fund was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @mutual_fund }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @mutual_fund.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @cb_fund.update(cb_fund_params)\n format.html { redirect_to @cb_fund, notice: 'Cb fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @cb_fund }\n else\n format.html { render :edit }\n format.json { render json: @cb_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n if @fundraiser.update_attributes(params[:fundraiser])\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @userfund.update(userfund_params)\n format.html { redirect_to @userfund, notice: 'Userfund was successfully updated.' }\n format.json { render :show, status: :ok, location: @userfund }\n else\n format.html { render :edit }\n format.json { render json: @userfund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fund_request.update_attributes(params[:fund_request])\n flash[:notice] = 'Fund request was successfully updated.'\n format.html { redirect_to @fund_request }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fund_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title = t('view.trust_funds.edit_title')\n @trust_fund = TrustFund.find(params[:id])\n\n respond_to do |format|\n if @trust_fund.update_attributes(params[:trust_fund])\n format.html { redirect_to @trust_fund, notice: t('view.trust_funds.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trust_fund.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_trust_fund_url(@trust_fund), alert: t('view.trust_funds.stale_object_error')\n end", "def update\n respond_to do |format|\n if @component_fund.update(component_fund_params)\n format.html { redirect_to @component_fund, notice: 'Component fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @component_fund }\n else\n format.html { render :edit }\n format.json { render json: @component_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @fund.update(fund_params)\n redirect_to about_path, notice: 'Fund was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n if @financial.update_attributes(params[:financial])\n format.html { redirect_to @financial, notice: 'Financial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @fundraiser.update(fundraiser_params)\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully updated.' }\n format.json { render :show, status: :ok, location: @fundraiser }\n else\n format.html { render :edit }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @pay_fee.update(pay_fee_params)\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_fee }\n else\n format.html { render :edit }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compound = Compound.find(params[:id])\n\n respond_to do |format|\n if @compound.update_attributes(params[:compound])\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # Record who updated the record\n @funding_request.updator = current_user\n\n respond_to do |format|\n if @funding_request.update(form_params)\n notify_user(:notice, \"The Funding Request was successfully updated\")\n format.html {\n redirect_back(fallback_location: root_path)\n }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n if @klass_fee.update_attributes(params[:klass_fee])\n format.html { redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @money = Money.find(params[:id])\n\n respond_to do |format|\n if @money.update_attributes(params[:money])\n format.html { redirect_to @money, notice: 'Money was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @money.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end", "def update\n @flat = Flat.find(params[:id])\n\n respond_to do |format|\n if @flat.update_attributes(params[:flat])\n format.html { redirect_to @flat, notice: 'Flat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to book_fee_path(@book,@fee), notice: '费项更新成功.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment].has_key?(a)\n params[:payment][a].gsub!(/[$,]/, \"\")\n params[:payment][a] = (params[:payment][a].to_f * 100).to_i\n end\n\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to :payments, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n @editable = true\n format.html { render :show }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mutual_fund_list.update(mutual_fund_list_params)\n format.html { redirect_to @mutual_fund_list, notice: 'Mutual fund list was successfully updated.' }\n format.json { render :show, status: :ok, location: @mutual_fund_list }\n else\n format.html { render :edit }\n format.json { render json: @mutual_fund_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fund_company_investment.update(fund_company_investment_params)\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(income_params)\n format.html { redirect_to @income, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flat = Flat.find(params[:id])\n\n respond_to do |format|\n if @flat.update_attributes(params[:flat])\n format.html { redirect_to @flat, notice: 'Flat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end", "def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.json { head :ok }\n format.js\n else\n format.json { render json: @income.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @classification_fund.update(classification_fund_params)\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @classification_fund }\n else\n format.html { render :edit }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fat.update(fat_params)\n format.html { redirect_to @fat, notice: 'Fat was successfully updated.' }\n format.json { render :show, status: :ok, location: @fat }\n else\n format.html { render :edit }\n format.json { render json: @fat.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\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @membership_fee = MembershipFee.find(params[:id])\n\n respond_to do |format|\n if @membership_fee.update_attributes(params[:membership_fee])\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # Expecting the following format:\n # {\n # \"dmp\": {\n # \"dmp_id\": {\n # 'type': 'doi',\n # 'identifier': '10.234/erfere.234d'\n # },\n # \"contributor\": [{\n # \"name\": 'Jane Doe',\n # \"mbox\": '[email protected]',\n # \"roles\": 'https://credit.org/roles/program_officer',\n # \"affiliation\": {\n # \"name\": 'National Science Foundation (NSF)'\n # },\n # }],\n # \"project\": {\n # \"start_on\": '2020-05-15 10:34:21 UCT',\n # \"end_on\": '2022-05-15 10:34:21 UCT',\n # \"funding\": [{\n # \"name\": \"Example Funder\",\n # \"funder_id\": {\n # 'typer':'ROR',\n # 'identifier': 'http://ror.org/45y4545'\n # },\n # \"grant_id\": {\n # 'type': 'url',\n # 'identifier': 'http://awards.example.org/1234'\n # }\n # \"funding_status\": \"granted\"\n # }]\n # }\n # }\n # }\n @funding = Funding.where(id: params[:id]).first\n if @funding.present? && funding_params.fetch('dmp_id', {}).any? &&\n funding_params['dmp_id']['identifier'].present? &&\n funding_params.fetch('project', {})['funding'].present?\n\n dmp = DataManagementPlan.find_by_doi(funding_params['dmp_Id']['identifier']).first\n if @funding.project.data_management_plans.first.id == dmp.id\n prepare_project_for_update(params: funding_params['project'])\n prepare_funding_for_update(params: funding_params['project']['funding'].first)\n\n if funding_params.fetch('contributor', []).any? && authorize_person_assertions\n DataManagementPlan.contributors_from_json(\n provenance: current_client[:name],\n dmp: dmp,\n json: funding_params\n )\n end\n\n if dmp.save && @funding.project.save && @funding.save\n head :no_content, location: landing_page_url(id: dmp.dois.first&.value)\n\n else\n project_errs = @funding.project.errors.collect { |e, m| { \"#{e}\": m } } || []\n funding_errs = @funding.errors.collect { |e, m| { \"#{e}\": m } } || []\n errs = (project_errs + funding_errs).join(', ')\n Rails.logger.warn \"Error saving Project + Funding during api/v0/fundings#update: #{errs}\"\n render_error errors: \"Unable to assert your Funding: #{errs}\", status: :unprocessable_entity\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n end", "def update\n respond_to do |format|\n if @tottle.update(tottle_params)\n format.html { redirect_to @tottle, notice: 'Tottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @tottle }\n else\n format.html { render :edit }\n format.json { render json: @tottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def set_fund\n @fund = Fund.find(params[:id])\n end", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @settlement = Settlement.find(params[:id])\n\n respond_to do |format|\n if @settlement.update_attributes(params[:settlement])\n format.html { redirect_to @settlement, :notice => 'Settlement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @settlement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tax = Tax.find(params[:id])\n\n if @tax.update(tax_params)\n head :no_content\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def update\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n if @money_receipt.update_attributes(params[:money_receipt])\n format.html { redirect_to @money_receipt, notice: 'Money receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @money_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @much_withdraw.update(much_withdraw_params)\n format.html { redirect_to \"/\", notice: 'much withdraw so success' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @much_withdraw.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n if @pay.update_attributes(params[:pay])\n format.html { redirect_to @pay, notice: 'Pay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basis = Base.find(params[:id])\n\n respond_to do |format|\n if @basis.update_attributes(params[:basis])\n format.html { redirect_to @basis, notice: 'Base was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n params[:fundation][:population_ids] ||= [] \n @fundation = Fundation.find(params[:id])\n\n respond_to do |format|\n if @fundation.update_attributes(params[:fundation])\n format.html { redirect_to(@fundation, :notice => 'Fundation was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => {:resp => \"ok\"} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fundation.errors, :status => :unprocessable_entity }\n format.json { render :json => {:resp => \"error\"} } \n end\n end\n end", "def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n if @bank.update_attributes(params[:bank])\n format.html { redirect_to @bank, notice: 'Bank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @flat.update_attributes(params[:flat])\n format.html { redirect_to @flat, notice: 'Flat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @personal_finance.update(personal_finance_params)\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flat_rate_price = FlatRatePrice.find(params[:id])\n\n respond_to do |format|\n if @flat_rate_price.update_attributes(params[:flat_rate_price])\n format.html { redirect_to @flat_rate_price, notice: 'Flat rate price was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flat_rate_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @financial.update(financial_params)\n format.html { redirect_to @financial, notice: 'Financial was successfully updated.' }\n format.json { render :show, status: :ok, location: @financial }\n else\n format.html { render :edit }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @tier = Tier.find(params[:id])\n\n respond_to do |format|\n if @tier.update_attributes(params[:tier])\n format.html { redirect_to @tier, :notice => 'Tier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @donation_record_actual_fund.update(donation_record_actual_fund_params)\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :ok, location: @donation_record_actual_fund }\n else\n format.html { render :edit }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @compound.update(compound_params)\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { render :show, status: :ok, location: @compound }\n else\n format.html { render :edit }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fun = Fun.find(params[:id])\n\n respond_to do |format|\n if @fun.update_attributes(params[:fun])\n format.html { redirect_to @fun, :notice => 'Fun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @fun.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.737266", "0.70351905", "0.70329", "0.6857465", "0.6688017", "0.6627489", "0.6570984", "0.6570984", "0.65417963", "0.6516786", "0.6513741", "0.64612806", "0.64612806", "0.6456487", "0.6388797", "0.6368233", "0.6368233", "0.63540655", "0.635353", "0.6350312", "0.6318475", "0.63138103", "0.63125616", "0.627125", "0.6245259", "0.6228112", "0.62131643", "0.62037057", "0.61966443", "0.6186909", "0.6186909", "0.6186775", "0.6180974", "0.61748564", "0.617339", "0.6157824", "0.6136444", "0.6131946", "0.6128505", "0.6124919", "0.6117152", "0.61097866", "0.6101581", "0.6096958", "0.6094568", "0.60918415", "0.6081725", "0.6077433", "0.6068754", "0.60638994", "0.6058566", "0.6055467", "0.6052256", "0.60422134", "0.60382664", "0.60348594", "0.60271245", "0.6022778", "0.6021988", "0.6017756", "0.6017384", "0.6007026", "0.60033536", "0.5996393", "0.5982181", "0.597914", "0.5973262", "0.59672743", "0.59627414", "0.596182", "0.59609395", "0.59609395", "0.59609395", "0.5959228", "0.5959198", "0.59591365", "0.59438187", "0.59416693", "0.5940743", "0.59390056", "0.59373057", "0.59354407", "0.59328216", "0.59316885", "0.5927193", "0.5925304", "0.5925051", "0.59137756", "0.59070015", "0.5905397", "0.5903586", "0.5901827", "0.58977634", "0.589265", "0.58912617", "0.58900553", "0.5887686", "0.5885692", "0.5882467", "0.5880392" ]
0.65056443
11
DELETE /funds/1 DELETE /funds/1.json
def destroy @fund = Fund.friendly.find(params[:id]) authorize! :manage, @fund @fund.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fund.destroy\n\n head :no_content\n end", "def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_fund = Fund.find(params[:id])\n @admin_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_funds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trust_fund = TrustFund.find(params[:id])\n @trust_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to trust_funds_url }\n format.json { head :ok }\n end\n end", "def destroy\n @investment_fund.destroy\n respond_to do |format|\n format.html { redirect_to wallets_path, notice: 'Investment fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cb_fund.destroy\n respond_to do |format|\n format.html { redirect_to cb_funds_url, notice: 'Cb fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @mutual_fund.destroy\r\n respond_to do |format|\r\n format.html { redirect_to mutual_funds_url, notice: 'Mutual fund was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @userfund.destroy\n respond_to do |format|\n format.html { redirect_to userfunds_url, notice: 'Userfund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundraiser = Fundraiser.find(params[:id])\n @fundraiser.destroy\n\n respond_to do |format|\n format.html { redirect_to fundraisers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unpaid_debt = UnpaidDebt.find(params[:id])\n @unpaid_debt.destroy\n\n respond_to do |format|\n format.html { redirect_to unpaid_debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to @fee.booth, flash: { warning: 'Fee was deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @donation_record_actual_fund.destroy\n respond_to do |format|\n format.html { redirect_to @donation_record}\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @financial = Financial.find(params[:id])\n @financial.destroy\n\n respond_to do |format|\n format.html { redirect_to financials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundation = Fundation.find(params[:id])\n @fundation.destroy\n resp ={\"resp\" => \"ok\"}\n\n respond_to do |format|\n format.html { redirect_to(fundations_url) }\n format.xml { head :ok }\n format.json {render :json=>resp}\n end\n end", "def destroy\n @pay = Pay.find(params[:id])\n @pay.destroy\n\n respond_to do |format|\n format.html { redirect_to pays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @investment_fund.destroy\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Investment fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: \"Deposit was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pay_fee.destroy\n respond_to do |format|\n format.html { redirect_to pay_fees_url, notice: 'Pay fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt = Debt.find(params[:id])\n @debt.destroy\n\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fund_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to fund_company_investments_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @income = Income.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @deposit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to deposits_url, notice: 'Deposit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @debt.destroy\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt.destroy\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenant_fee.destroy\n respond_to do |format|\n format.html { redirect_to tenant_fees_url, notice: 'Tenant fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @component_fund.destroy\n respond_to do |format|\n format.html { redirect_to component_funds_url, notice: 'Component fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @withdrawal = Withdrawal.find(params[:id])\n @withdrawal.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bankdeposit.destroy\n respond_to do |format|\n format.html { redirect_to bankdeposits_url, notice: 'Bankdeposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenpay.destroy\n respond_to do |format|\n format.html { redirect_to tenpays_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @our_coin = OurCoin.find(params[:id])\n @our_coin.destroy\n\n respond_to do |format|\n format.html { redirect_to our_coins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @finance = Finance.find(params[:id])\n @finance.destroy\n\n respond_to do |format|\n format.html { redirect_to finances_url }\n format.json { head :no_content }\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 @dailybank.destroy\n respond_to do |format|\n format.html { redirect_to dailybanks_url, notice: 'Dailybank was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end", "def destroy\n @mutual_fund_list.destroy\n respond_to do |format|\n format.html { redirect_to mutual_fund_lists_url, notice: 'Mutual fund list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@klass_fee = KlassFee.find(params[:id])\n #@klass_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to klass_fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @withdraw.destroy\n respond_to do |format|\n format.html { redirect_to withdraws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paymentcash = Paymentcash.find(params[:id])\n @paymentcash.destroy\n\n respond_to do |format|\n format.html { redirect_to paymentcashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @money.destroy\n respond_to do |format|\n format.html { redirect_to money_index_url, notice: 'Money was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @income_entry = IncomeEntry.find(params[:id])\n @income_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to income_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sumit.destroy\n respond_to do |format|\n format.html { redirect_to sumits_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @financial.destroy\n respond_to do |format|\n format.html { redirect_to financials_url, notice: 'Financial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url, notice: 'Ledger was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url, notice: 'Ledger was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mydebt = Mydebt.find(params[:id])\n @mydebt.destroy\n\n respond_to do |format|\n format.html { redirect_to mydebts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @amount = Amount.find(params[:id])\n @amount.destroy\n\n respond_to do |format|\n format.html { redirect_to(amounts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @journal_debit.destroy\n respond_to do |format|\n format.html { redirect_to journal_debits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @money_receipt = MoneyReceipt.find(params[:id])\n @money_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to money_receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @withdrawal_request = WithdrawalRequest.find(params[:id])\n @withdrawal_request.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawal_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url, notice: t('view.banks.correctly_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n @di_transaction = DiTransaction.find(params[:id])\n @di_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to di_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fund_request.destroy\n\n respond_to do |format|\n flash[:notice] = 'Fund request was successfully destroyed.'\n format.html { redirect_to( profile_url ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt = Debt.find(params[:id])\n @debt.destroy\n\n respond_to do |format|\n format.html { redirect_to debts_url,notice:'Debt was successfully deleted'}\n format.json { head :no_content }\n end\n end", "def destroy\n @income_payment.destroy\n respond_to do |format|\n format.html { redirect_to income_income_payments_url(@income), notice: 'Income payment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7649942", "0.7518577", "0.7518577", "0.7509717", "0.74515253", "0.7195393", "0.7154278", "0.7129348", "0.7128182", "0.7114289", "0.70852596", "0.70835376", "0.70716876", "0.70389086", "0.7015833", "0.7006431", "0.6990429", "0.6984278", "0.6981383", "0.6976844", "0.6973521", "0.6969046", "0.6967596", "0.6967596", "0.6967596", "0.69626063", "0.6953816", "0.6938463", "0.6936334", "0.6916048", "0.6916048", "0.6900418", "0.6900418", "0.6874369", "0.6874227", "0.68713415", "0.6859658", "0.68588144", "0.6852266", "0.68299097", "0.6827907", "0.6826889", "0.6801791", "0.6799783", "0.6794658", "0.6793408", "0.67931634", "0.6790123", "0.6784817", "0.67801154", "0.67801154", "0.6777999", "0.6777716", "0.67701393", "0.6758257", "0.67555255", "0.6753152", "0.6751512", "0.6748794", "0.67420095", "0.67385083", "0.67366505", "0.67366505", "0.67366505", "0.67366505", "0.6735701", "0.6735234", "0.6723954", "0.6723471", "0.67136353", "0.6711565", "0.6711565", "0.67076653", "0.67023885", "0.6699385", "0.66985947", "0.66936487", "0.6692383", "0.6691081", "0.669056", "0.6686092", "0.66852534", "0.66852534", "0.6679521", "0.6673453", "0.66734004", "0.6670948", "0.6670558", "0.6669674", "0.6665315", "0.66639555", "0.66633815", "0.6661833", "0.6660089", "0.6657839", "0.6657391", "0.6650843", "0.6650107", "0.664875", "0.6637712" ]
0.70333636
14
This challenge took me [] hours. Pseudocode input: an array of integers output: a fizzbuzz array were integers with a multiple of 3 are replaced by "fizz", integers with a multiple of 5 are replaced with "buzz", and integers with a multiple of 15 are replace with "fizzbuzz" Iterate over an array of integers Check to see if integer is a multiple of 3 and replace integer in array with 'Fizz' if it is. Check to see if integer is a multiple of 5 and replace integer in array with 'Buzz' if it is. Check to see if integer is a multiple of 15 and replace integer in array with 'FizzBuzz' if it is. Otherwise, keep the existing integer. Initial Solution def super_fizzbuzz(array) array.map do |number| if number % 15 === 0 'FizzBuzz' elsif number % 3 === 0 'Fizz' elsif number % 5 === 0 'Buzz' else number end end end Refactored Solution
def super_fizzbuzz(array) array.map do |number| case when number % 15 === 0 then 'FizzBuzz' when number % 3 === 0 then 'Fizz' when number % 5 === 0 then 'Buzz' else number end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super_fizzbuzz(array)\n array.map do |x|\n if x % 15 == 0\n x = x.to_s.replace(\"FizzBuzz\")\n elsif x % 5 == 0\n x = x.to_s.replace(\"Buzz\")\n elsif x % 3 == 0\n x = x.to_s.replace(\"Fizz\")\n else\n x = x\n end\nend\nend", "def super_fizzbuzz(array)\n array.map! do |x| \n if x % 3 == 0 && x % 5 != 0\n x = \"Fizz\"\n elsif x % 5 == 0 && x % 3 != 0\n x = \"Buzz\"\n elsif x % 15 == 0\n x = \"FizzBuzz\"\n else x = x\n end\n end\nend", "def super_fizzbuzz(array)\n array.map do |num|\n if num % 15 == 0\n num = 'FizzBuzz'\n elsif num % 5 == 0\n num = 'Buzz'\n elsif num % 3 == 0\n num = 'Fizz'\n else\n num\n end\n end\nend", "def super_fizzbuzz(array)\n array.map! do |num|\n if (num % 3 == 0 && num % 5 == 0 && num % 15 == 0)\n \"FizzBuzz\"\n elsif (num % 3 == 0)\n \"Fizz\"\n elsif (num % 5 == 0)\n \"Buzz\"\n else\n num\n end\n end\n array\nend", "def super_fizzbuzz(array)\n array.map do |num|\n if (num % 15 == 0)\n num = \"FizzBuzz\"\n elsif (num % 3 == 0)\n num = \"Fizz\"\n elsif (num % 5 == 0)\n num = \"Buzz\"\n else\n num\n end\n end\nend", "def super_fizzbuzz(array)\n\tarray.map do |num| #got rid of the ! that I had in the original solution. There's no need to alter the underlying array here.\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\nend", "def super_fizzbuzz(array)\n array.map do |i|\n if i%15 == 0\n i = 'FizzBuzz'\n elsif i%5 == 0\n i = 'Buzz'\n elsif i%3 == 0\n i = 'Fizz'\n else \n i\n end\n end\nend", "def super_fizzbuzz(array)\n array.map do |number|\n if number % 15 == 0\n number = \"FizzBuzz\"\n elsif number % 3 == 0\n number = \"Fizz\" \n elsif number % 5 == 0\n number = \"Buzz\"\n else\n number = number\n end \n end\nend", "def super_fizzbuzz(array)\n array.map! { |num|\n if num % 3 == 0 && num % 5 == 0\n num = \"FizzBuzz\"\n elsif num % 3 == 0\n num = \"Fizz\"\n elsif num % 5 == 0\n num = \"Buzz\"\n else\n num\n end\n }\n array\nend", "def super_fizzbuzz(array)\n array.map do |x|\n if (x % 15 ==0)\n x = \"FizzBuzz\"\n elsif (x % 5 ==0)\n x = \"Buzz\"\n elsif (x % 3 ==0)\n x = \"Fizz\"\n else\n x\n end\n end\nend", "def super_fizzbuzz(array)\n array.map! do |x|\n if x % 15 == 0\n \"FizzBuzz\"\n elsif x % 5 == 0\n \"Buzz\"\n elsif x % 3 == 0\n \"Fizz\"\n else\n x\n end\n end\nend", "def super_fizzbuzz (array)\n array.map do |num|\n if num % 15 == 0 then num = \"FizzBuzz\"\n elsif num % 3 == 0 then num = \"Fizz\"\n elsif num % 5 == 0 then num = \"Buzz\"\n else num = num\n end\n end\nend", "def super_fizzbuzz(array)\n\tarray.map do |x|\n\t\tif (x % 15 == 0)\n\t\t\tx = \"FizzBuzz\"\n\t\telsif (x % 5 == 0)\n\t\t\tx = \"Buzz\"\n\t\telsif (x % 3 == 0)\n\t\t\tx = \"Fizz\"\n\t\telse \n\t\t\tx\n\t\tend\n\tend\nend", "def super_fizzbuzz(array)\n array.map! do |element|\n if element % 15 == 0\n element = \"FizzBuzz\"\n elsif element % 5 == 0\n element = \"Buzz\"\n elsif element % 3 == 0\n element = \"Fizz\"\n else\n element = element\n end\n end\nend", "def super_fizzbuzz(array)\n array.map do |x|\n if x % 15 ==0\n x = \"FizzBuzz\"\n elsif x % 5 == 0\n x = \"Buzz\"\n elsif x % 3 == 0\n x = \"Fizz\"\n else\n x = x\n end\n end\n\nend", "def super_fizzbuzz(array)\n array.map! do |x|\n if x % 3 == 0 \n x = \"Fizz\"\n elsif x % 5 == 0 \n x = \"Buzz\"\n elsif x % 15 == 0 \n x = \"FizzBuzz\"\n else x % 3 == 0 || x % 5 == 0 || x % 15 == 0\n p x\n end\n end\nend", "def super_fizzbuzz(array)\n\tarray.map! do |num|\n\t\tif num % 15 == 0\n\t\t\tnum = 'FizzBuzz'\n\t\telsif num % 5 == 0\n\t\t\tnum = 'Buzz'\n\t\telsif num % 3 == 0\n\t\t\tnum = 'Fizz'\n\t\telse num\n\t\tend\n\tend\n\tp array\nend", "def super_fizzbuzz(array)\n\tarray.map! {|i|\n\t\tif i % 3 == 0 && i % 5 == 0\n\t\t\ti = \"FizzBuzz\"\n\t\telsif i % 3 == 0\n\t\t\ti = \"Fizz\"\n\t\telsif i % 5 == 0\n\t\t\ti = \"Buzz\"\n\t\telse i = i\n\t\tend\n\t\t}\t\t\n\treturn array\nend", "def super_fizzbuzz(array)\n array.map {|x|\n if x % 15 == 0\n \"FizzBuzz\"\n elsif x % 3 == 0\n \"Fizz\"\n elsif x % 5 == 0\n \"Buzz\"\n else\n x\n end\n }\nend", "def super_fizzbuzz(array)\n array.map do |i| \n if i % 15 == 0 then 'FizzBuzz'\n elsif i % 3 == 0 then 'Fizz' \n elsif i % 5 == 0 then 'Buzz'\n else i\n end\n end\nend", "def super_fizzbuzz(array)\n array.map do |value|\n if (value % 3 == 0 && value % 5 == 0)\n 'FizzBuzz'\n elsif (value % 3 == 0)\n 'Fizz'\n elsif (value % 5 == 0)\n 'Buzz'\n else\n value\n end\n end\nend", "def super_fizzbuzz(array)\n fizz_ary = array\n\n fizz_ary.map! { |x|\n if x % 15 == 0\n x = \"FizzBuzz\"\n elsif x % 5 == 0\n x = \"Buzz\"\n elsif x % 3 == 0\n x = \"Fizz\"\n else\n x\n end }\n fizz_ary\nend", "def super_fizzbuzz(array)\n\tarray.map! do |num|\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\nreturn array\t\t\nend", "def super_fizzbuzz(array)\n\tarray.map.with_index do |num, index|\n\t\tif array[index] % 15 == 0\n\t\t\tarray[index] = \"FizzBuzz\"\n\t\telsif array[index] % 3 == 0\n\t\t\tarray[index] = \"Fizz\"\n\t\telsif array[index] % 5 == 0\n\t\t\tarray[index] = \"Buzz\"\n\t\tend\n\tend\n\treturn array\nend", "def super_fizzbuzz(array)\n array.map! do |x|\n if x % 3 == 0 && x % 5 != 0\n x = \"Fizz\"\n elsif x % 3 != 0 && x % 5 == 0\n x = \"Buzz\"\n elsif x % 3 == 0 && x % 5 == 0\n x = \"FizzBuzz\"\n else\n x\n end\n end\n p array\nend", "def super_fizzbuzz(array)\r\n\r\n\treturn array.map do |number|\r\n\t\tif number % 3 == 0 && number % 5 == 0\r\n\t\t\tnumber = \"FizzBuzz\"\r\n\t\telsif number % 3 == 0 \r\n\t\t\tnumber = \"Fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tnumber = \"Buzz\"\r\n\t\telse\r\n\t\t\tnumber = number\r\n\t\tend\r\n\tend\r\n\r\nend", "def super_fizzbuzz(array)\n array.map do |element|\n if (element % 3 == 0 && element % 5 == 0)\n element = \"FizzBuzz\"\n elsif (element % 3 == 0)\n element = \"Fizz\"\n elsif (element % 5 == 0)\n element = \"Buzz\"\n else\n element\n end\n end \nend", "def super_fizzbuzz(array)\n\n if !(array.is_a? Array)\n raise Argumenterror, \"That is not a valid array\"\n end\n\n result = array.map do |x|\n if (x % 5 == 0) && (x % 3 == 0)\n x = \"FizzBuzz\"\n elsif (x % 5 == 0)\n x = \"Buzz\"\n elsif (x % 3 == 0)\n x = \"Fizz\"\n else\n x = x\n end\n end\n\n return result\n\nend", "def super_fizzbuzz(array)\n array.map! {|variable|\n if variable % 15 == 0\n variable = \"FizzBuzz\"\n elsif variable % 5 == 0\n variable = \"Buzz\"\n elsif variable % 3 == 0\n variable = \"Fizz\"\n else\n variable = variable\n end\n }\n\n return array\n\nend", "def super_fizbuzz(array)\n array.map! do |value|\n if value % 15 == 0\n value = \"FizzBuzz\"\n elsif value % 5 == 0\n value = \"Buzz\"\n elsif value % 3 == 0\n value = \"Fizz\"\n else\n value\n end\n end\n p array\nend", "def super_fizzbuzz(array)\narray.map!{|item|\n if item % 3 == 0 && item % 5 == 0\n item = \"FizzBuzz\"\n elsif item % 3 == 0\n item = \"Fizz\"\n elsif item % 5 == 0\n item = \"Buzz\"\n else item = item\n end\n}\n\nend", "def super_fizzbuzz(array)\n array.map! do |num|\n num =\n \t\tif (num % 3 == 0 && num % 5 == 0)\n \t \"FizzBuzz\"\n \t\telsif (num % 3 == 0)\n \t\"Fizz\"\n \telsif (num % 5 == 0)\n \t\"Buzz\"\n \telse \n \tnum\n \tend\n \tend\n p array\nend", "def super_fizzbuzz(array)\nbuzz_array=[]\narray.map { |number| \n if number % 15 == 0\n \tbuzz_array << \"FizzBuzz\"\n elsif number % 3 == 0\n \tbuzz_array << \"Fizz\"\n elsif number % 5 == 0\n \tbuzz_array << \"Buzz\" \n else\n \tbuzz_array << number\n end\n}\nreturn buzz_array\nend", "def super_fizzbuzz(array)\n\tarray.collect do |i|\n \tif i % 15 == 0\n \t\t\"FizzBuzz\"\n \telsif i % 5 == 0\n \t\t\"Buzz\"\n \telsif i % 3 == 0\n \t\t\"Fizz\"\n \telse\n \t\ti\n \tend\n \tend\nend", "def super_fizzbuzz(array)\n\ti = 0\n\tarray.each do |num|\n\t\t\tarray[i] = \"Fizz\" if num % 3 == 0 && num % 5 != 0\n\t\t array[i] = \"Buzz\" if num % 5 == 0 && num % 3 != 0\n\t\t\tarray[i] = \"FizzBuzz\" if num % 3 == 0 && num % 5 == 0\n\t\t\ti += 1\n\t end\nend", "def super_fizzbuzz(array)\n\narray.map! do |e|\n if e % 15 == 0\n e = \"FizzBuzz\"\n elsif e % 3 == 0\n e = \"Fizz\"\n elsif e % 5 == 0\n e = \"Buzz\"\n else\n e\n end\n end\np array\n\nend", "def super_fizzbuzz(array)\n # Your code goes here!\n array.map do |x|\n if x % 15 == 0 \n \"FizzBuzz\"\n elsif\n x % 3 == 0\n \"Fizz\"\n elsif \n x % 5 == 0\n \"Buzz\"\n else\n x \n end\n end\nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |x|\n if x % 3 == 0 && x % 5 == 0\n new_array << \"FizzBuzz\"\n elsif x % 3 == 0\n new_array << \"Fizz\"\n elsif x % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << x\n end\n end\n new_array\nend", "def super_fizzbuzz(array)\n\narray.map! { |element| \n if(element % 15 == 0) \n \"FizzBuzz\" \n elsif (element % 3 == 0) \n \"Fizz\" \n elsif (element % 5 == 0) \n \"Buzz\" \n else \n element \n end\n}\n\np array\n\nend", "def super_fizzbuzz(array)\n\tnew_array = []\n\tarray.each do |num| \n\t\tif num % 15 == 0\n\t\t\tnew_array << \"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\tnew_array << \"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\tnew_array << \"Buzz\"\n\t\telse \n\t\t\tnew_array << num\n\t\tend\n\tend\n\tnew_array\nend", "def super_fizzbuzz(array)\n array.map! {|num| puts \"#{'Fizz' if num % 3 == 0}#{'Buzz' if num % 5 == 0}#{num if num % 5 != 0 && num % 3 != 0}\"}\nend", "def super_fizzbuzz(array)\n\t# this iterator will keep track of the location of the current element\n\ti = 0 \n\n\t# go through each item in the array\n\tarray.each do |x| \n\t\t# see if it is divisible by 3 \t\t\n\t\tif (x % 3 == 0)\n\t\t\t# see if it is divisible by 15\n\t\t\tif (x % 15 == 0)\n\t\t\t\tarray[i] = \"FizzBuzz\"\n\t\t\telse\n\t\t\t\tarray[i] = \"Fizz\"\n\t\t\tend\n\t\t# if no divisible by 3, see if \n\t\t# divisible by 5\n\t\telsif (x % 5 == 0)\n\t\t\tarray[i] = \"Buzz\" \t\t\n\t\tend\n\n\t\ti +=1\n\tend \nend", "def super_fizzbuzz(array)\n\tnew_arr = []\n\tarray.each do |x|\n\t\tif x % 3 == 0 && x % 5 == 0\n\t\t\tnew_arr << \"FizzBuzz\"\n\t\telsif x % 5 == 0\n\t\t\tnew_arr << \"Buzz\"\n\t\telsif x % 3 == 0\n\t\t\tnew_arr << \"Fizz\"\n\t\telse\n\t\t\tnew_arr << x\n\t\tend\n\tend\n\treturn new_arr\n\nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend", "def super_fizzbuzz(array)\n fb_arr = []\n array.map do |digit|\n case\n when digit % 15 == 0\n fb_arr.push(\"FizzBuzz\")\n when digit % 3 == 0\n fb_arr.push(\"Fizz\")\n when digit % 5 == 0\n fb_arr.push(\"Buzz\")\n else\n fb_arr.push(digit)\n end #end case\n end #end iterator\n return fb_arr\nend", "def super_fizzbuzz(array)\n\tfizzbuzzed_array = []\n\tarray.each do |element|\n\t\tif element % 15 == 0\n\t\t\tfizzbuzzed_array << \"FizzBuzz\"\n\t\telsif element % 3 == 0\n\t\t\tfizzbuzzed_array << \"Fizz\"\n\t\telsif element % 5 == 0\n\t\t\tfizzbuzzed_array << \"Buzz\"\n\t\telse\n\t\t\tfizzbuzzed_array << element\n\t\tend\n\tend\n\tfizzbuzzed_array\nend", "def fizz_buzz\n [*1..100].map do |num|\n if num % 5 == 0 && num % 3 == 0\n 'FizzBuzz'\n elsif num % 5 == 0\n 'Buzz'\n elsif num % 3 == 0\n 'Fizz'\n else\n num\n end\n end\nend", "def fizzbuzz(n)\n range = [*1..n]\n range.map! do |num|\n if num % 3 == 0 && num % 5 == 0\n num = \"fizzbuzz\"\n elsif num % 5 == 0\n num = \"buzz\"\n elsif num % 3 == 0\n num = \"fizz\"\n else\n num\n end\n end\nend", "def super_fizzbuzz(array)\n fizzy=[]\n\tarray.each do |x| \n\t if x%3==0 && x%5==0\n\t\t fizzy << \"FizzBuzz\"\n\t elsif x%5==0\n\t\t fizzy << \"Buzz\"\n\t elsif x%3==0\n\t\t fizzy << \"Fizz\"\n\t else\n\t\t fizzy << x\n\t end\n\tend\nreturn fizzy\nend", "def super_fizzbuzz(array)\n newarray = []\n array.each do |x|\n \tif x % 15 == 0\n \t\t newarray << \"Fizzbuzz\"\n \telsif x % 5 == 0\n \t newarray << \"Buzz\"\n\telsif x % 3 == 0\n\t\tnewarray << \"Fizz\"\n\telse\n\tnewarray << x\n\tend\nend\nputs newarray\nputs array\narray.replace(newarray)\nputs array\nend", "def fizzbuzz\n (1..100).map do |i|\n\tif (i % 15).zero?\n\t 'FizzBuzz'\n\telsif (i % 3).zero?\n\t 'Fizz'\n\telsif (i % 5).zero?\n\t 'Buzz'\n\telse\n\t i\n\tend\n end\nend", "def super_fizzbuzz(array)\ni=0\nwhile i < array.length\n if array[i]%5==0 && array[i]%3==0\n array[i]= 'FizzBuzz'\n elsif array[i]%3==0\n array[i]= 'Fizz'\n elsif array[i]%5==0\n array[i]= 'Buzz'\n end\ni+=1\nend\np array\nend", "def super_fizzbuzz(array)\n buzz_array = []\n array.each do |x|\n if x % 3 == 0 && x % 5 != 0\n buzz_array.push(\"Fizz\")\n elsif x % 3 != 0 && x % 5 == 0\n buzz_array.push(\"Buzz\")\n elsif x % 3 == 0 && x % 5 == 0\n buzz_array.push(\"FizzBuzz\")\n else\n buzz_array.push(x)\n end\n end\n p buzz_array\nend", "def fizzbuzz(num1, num2)\n array = (num1..num2).to_a\n fizzbuzz = array.map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 5 == 0\n 'Buzz'\n elsif n % 3 == 0\n 'Fizz'\n else \n n\n end\n end\n fizzbuzz.join(' ')\nend", "def fizzbuzz(array)\n\tfor num in array\n\t\tif num % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif num % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telsif num % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telse \n\t\t\tputs num.to_s\n\t\tend\n\tend\nend", "def super_fizzbuzz(array)\n array.each_with_index do |element, index|\n if element % 15 == 0\n array.delete_at(index)\n array.insert(index, \"FizzBuzz\")\n \n elsif element % 5 == 0\n array.delete_at(index)\n array.insert(index, \"Buzz\")\n \n elsif element % 3 == 0\n array.delete_at(index)\n array.insert(index, \"Fizz\") \n \n end\n end\n return array\nend", "def super_fizzbuzz(array)\n length = array.length\n # print length\n i = 0\n while i < length\n if (array[i] % 3 == 0 && array[i] % 5 != 0)\n array[i] = \"Fizz\"\n elsif (array[i] % 5 == 0) && (array[i] % 3 != 0)\n array[i] = \"Buzz\"\n elsif (array[i] % 3 == 0) && (array[i] % 5 == 0)\n array[i] = \"FizzBuzz\"\n\n end\n i += 1\n end\n\n return array\n\nend", "def fizzbuzz\n\n fb_array = (1..100).to_a\n for i in fb_array\n if i % 3 == 0\n if i % 5 == 0\n fb_array[i-1] = 'FizzBuzz'\n else \n fb_array[i-1] = 'Fizz'\n end\n elsif i % 5 == 0\n fb_array[i-1] = 'Buzz'\n end\n end\n\nend", "def fizzbuzz(n)\n numbers = (1..n).to_a\n numbers.map do |num|\n if (num % 15 == 0)\n \"FizzBuzz\"\n elsif (num % 5 == 0)\n \"Buzz\"\n elsif (num % 3 == 0)\n \"Fizz\"\n else num\n end\n end\n end", "def super_fizzbuzz(array)\n fizzbuzz_array = []\n counter = 0\n while counter < array.length\n if array[counter] % 3 == 0 && array[counter] % 5 != 0\n fizzbuzz_array << \"Fizz\"\n elsif array[counter] % 5 == 0 && array[counter] % 3 != 0\n fizzbuzz_array << \"Buzz\"\n elsif array[counter] % 3 == 0 && array[counter] % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n else\n fizzbuzz_array << array[counter]\n end\n counter += 1\n end\n p fizzbuzz_array\nend", "def fizzbuzz(n)\n (1..n).map do |num|\n if num % 3 == 0 && num % 5 == 0\n 'FizzBuzz'\n elsif num % 3 == 0\n 'Fizz'\n elsif num % 5 == 0\n 'Buzz'\n else\n num\n end\n end\nend", "def fizzbuzz(n)\n array = (1..n).to_a\n answer = []\n for i in array do\n if (i % 15 == 0)\n answer.push('FizzBuzz')\n elsif (i % 3 == 0)\n answer.push('Fizz')\n elsif (i % 5 == 0)\n answer.push('Buzz')\n else \n answer.push(i)\n end\n end\n answer\nend", "def fizzbuzz(arr)\n arr.map do |num|\n # binding.pry\n if num % 5 == 0 && num % 3 == 0\n 'FizzBuzz'\n elsif num % 5 == 0\n 'Buzz'\n elsif num % 3 == 0\n 'Fizz'\n else\n num\n end\n end\nend", "def fizzbuzz(n)\n (1..n).map do |n|\n if n%3==0 && n%5==0\n \"fizzbuzz\"\n elsif n%3==0\n \"fizz\"\n elsif n%5==0\n \"buzz\"\n else\n n\n end\n end\nend", "def super_fizzbuzz(array)\n\tarray = [1..100]\n\tarray.each do |num|\n\t\tif num % 3 == 0 \n\t\t\tprint \"Fizz\"\n\t\tend \n\t\tif num % 5 == 0 \n\t\t\tprint \"Buzz\"\n\t\tend \n\t\tif num % 15 == 0 \n\t\t\tprint \"FizzBuzz\"\n\t\tend \n\tend \nend", "def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end", "def fizzbuzz(start_num, end_num)\n (start_num..end_num).map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n\n end\n end\nend", "def fizzbuzz(n)\n\t(1..n).map do |n|\n\t\tif n % 15 == 0\n\t\t\t\"fizzbuzz\"\n\t\telsif n % 3 == 0\n\t\t\t\"fizz\"\n\t\telsif n % 5 == 0\n\t\t\t\"buzz\"\n\t\telse\n\t\t\tn\n\t\tend\n\tend\nend", "def fizzbuzz(n)\n array = []\n (1..n).each do |num|\n if num % 15 == 0\n array << \"fizzbuzz\"\n elsif num % 3 == 0\n array << \"fizz\"\n elsif num % 5 == 0\n array << \"buzz\"\n else\n array << num\n end\n end\n return array\nend", "def fizzbuzz(start, last)\n array = (start..last).map do |num|\n if (num % 3 == 0 && num % 5 == 0)\n 'FizzBuzz'\n elsif (num % 3 == 0)\n 'Fizz'\n elsif (num % 5 == 0)\n 'Buzz'\n else\n num.to_s \n end\n end\n puts array.join(', ')\nend", "def fizzbuzz\narray = []\n\tfor i in 1..100\n\t\tif i%3 == 0 && i%5 == 0\n\t\t\tarray << 'FizzBuzz'\n\t\telsif i%3 == 0\n\t\t\tarray << 'Fizz'\n\t\telsif i%5 == 0 \n\t\t\tarray << 'Buzz'\n\t\telse\n\t\t\tarray << i\n \t\t\ti+= 1\n\t\tend\n\tend\n\t\t\treturn array\nend", "def fizzbuzz(num1, num2)\n arr = Array(num1..num2).map! do |num|\n if num % 3 == 0 && num % 5 == 0\n 'FizzBuzz'\n elsif num % 3 == 0\n 'Fizz'\n elsif num % 5 == 0\n 'Buzz'\n else\n num\n end\n end.join(', ')\n print arr\nend", "def fizzbuzz(n)\n numbers = []\n (1..n).each do |num|\n if num % 3 == 0\n value = (num % 5 == 0) ? \"fizzbuzz\" : \"fizz\"\n numbers << value\n elsif num % 5 == 0\n numbers << \"buzz\"\n else\n numbers << num\n end\n end\n numbers\nend", "def fizzbuzz\n\tnum_arr = Array.new(100) {|index| index+1}\n\tarr = Array.new(100) {''}\n\tnum_arr.each do |i|\n\n\t \tif i%3 == 0\n\t \t\tif i%5 == 0\n\t \t\t\tarr[i-1] = 'FizzBuzz'\n\t \t\telse\n\t \t\t\tarr[i-1] = 'Fizz'\n\t \t\tend\n\t \telsif i%5 == 0\n\t \t\tarr[i-1] = 'Buzz'\n\t \telse\n\t \t\tarr[i-1] = i.to_s\n\t \tend\n\t end\n \tarr\nend", "def fizzbuzz(num1, num2)\n arr = num1.upto(num2).map do |num|\n if num % 3 == 0 && num % 5 == 0\n 'Fizzbuzz'\n elsif num % 5 == 0\n 'Buzz'\n elsif num % 3 == 0\n 'Fizz'\n else\n num\n end\n end\n arr.join(', ')\nend", "def fizzbuzz(n)\n output_arr = []\n\n (1..n).each do |num|\n if num % 5 == 0 && num % 3 == 0\n output_arr << 'fizzbuzz'\n elsif num % 5 == 0\n output_arr << 'buzz'\n elsif num % 3 == 0\n output_arr << 'fizz'\n else\n output_arr << num\n end\n end\n\n output_arr\nend", "def fizzbuzz\n fizzBuzzArray = Array.new\n for num in 1..100\n if num.to_f / 3.to_f == num/3 && num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'FizzBuzz'\n elsif num.to_f / 3.to_f == num/3 then\n\tfizzBuzzArray << 'Fizz'\n elsif num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'Buzz'\n else\n fizzBuzzArray << num\n end\n end\n fizzBuzzArray\nend", "def fizzbuzz\n zz_array = []\n 1.upto(100) do |num|\n if num % 3 == 0 && num % 5 == 0\n zz_array << 'FizzBuzz'\n elsif num % 3 == 0\n zz_array << 'Fizz'\n elsif num % 5 == 0\n zz_array << 'Buzz'\n else\n zz_array << num\n end\n end\n return zz_array\nend", "def tiy_fizz_buzz(string)\n special = (0..9).to_a + ('!'..'?').to_a\n arr = string.chars\n arr.map do |a|\n case\n when special.include?(a) == true\n a\n when \"AEIOU\".include?(a) == true\n a = \"Iron Yard\"\n when \"aeiou\".include?(a) == true\n a = \"Yard\"\n when \"BCDFGHJKLMNPQRSTVWXYZ\".include?(a) == true\n a = \"Iron\"\n else\n a\n end\n end.join(\"\")\nend", "def fizzbuzz(n)\n result = []\n (1..n).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"fizzbuzz\"\n elsif num % 3 == 0\n result << \"fizz\"\n elsif num % 5 == 0\n result << \"buzz\"\n else\n result << num\n end\n end\n result\nend", "def fizzbuzz\n # TODO write your code here\n fizz_array = []\n\n for count in 1..100\n if (count%3 == 0 && count%5 == 0)\n fizz_array[count] = 'FizzBuzz'\n elsif count%3 == 0\n fizz_array[count] = 'Fizz'\n elsif count%5 == 0\n fizz_array[count] = 'Buzz'\n else\n fizz_array[count] = count\n end\n end\n\n fizz_array\nend", "def fizzbuzz\r\n # your code goes here\r\n arr = []\r\n\r\n for i in 1 .. 30\r\n if i % 5 == 0 && i % 3 == 0\r\n arr << \"fizzbuzz\"\r\n\r\n elsif i % 3 == 0\r\n arr << \"fizz\"\r\n\r\n elsif i % 5 == 0\r\n arr << \"buzz\"\r\n\r\n else arr << i\r\n end\r\n end\r\n arr\r\nend", "def fizzbuzz(start_num, end_num)\n new_arr = []\n (start_num..end_num).each do |num|\n case \n when (num % 3 == 0) && (num % 5 == 0)\n new_arr << \"FizzBuzz\"\n when num % 5 == 0\n new_arr << \"Buzz\"\n when num % 3 == 0 \n new_arr << \"Fizz\" \n else\n new_arr << num\n end\n end\n puts new_arr.join(', ')\nend", "def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend", "def fizzbuzz(max)\n arr =[]\n (1..max).each do |n|\n if n % 3 != 0 && n % 5 != 0\n arr.push n\n else\n val = ''\n if n % 3 == 0\n val = \"fizz\"\n end\n if n % 5 == 0\n val += \"buzz\"\n end\n arr.push val\n end\n end\n arr\nend", "def fizzbuzz(n)\n arr = []\n (1..n).each do |i|\n case\n when (i % 3 == 0) && (i % 5 == 0) then arr << \"fizzbuzz\"\n when i % 3 == 0 then arr << \"fizz\"\n when i % 5 == 0 then arr << \"buzz\"\n else arr << i\n end\n end\n arr\nend", "def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend", "def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend", "def fizzbuzz(num1, num2)\n numbers = num1..num2\n fizzbuzz_array = []\n numbers.each do |x|\n case\n when x % 3 == 0 && x % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n when x % 3 == 0\n fizzbuzz_array << \"Fizz\"\n when x % 5 == 0\n fizzbuzz_array << \"Buzz\"\n else\n fizzbuzz_array << x\n end\n end\n\n p fizzbuzz_array.join(\", \")\nend", "def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz\n drink = Array.new(100)\n for i in 1..100\n if i % 15 == 0\n drink[i] = 'FizzBuzz'\n elsif i % 3 == 0\n drink[i] = 'Fizz'\n elsif i % 5 == 0\n drink[i] = 'Buzz'\n else\n drink[i] = i\n end\n end\n drink\nend", "def fizzbuzz\n # TODO write your code here\n fbArray = Array.new\n i = 1\n #fbArray[0] = 0\n while i <= 100 do\n if i % 15 == 0\n fbArray[i] = \"FizzBuzz\"\n elsif i % 3 == 0\n fbArray[i] = \"Fizz\"\n elsif i % 5 == 0\n fbArray[i] = \"Buzz\"\n else\n fbArray[i] = i\n end\n i += 1\n end\n fizzbuzz = fbArray\nend", "def fizzbuzz(number)\n return 'FizzBuzz' if number % 15 == 0\n return 'Fizz' if number % 3 == 0\n return 'Buzz' if number % 5 == 0\n return number\nend", "def fizzbuzz(n)\n arr = []\n (1..n).each do |num|\n mod3 = (num % 3).zero?\n mod5 = (num % 5).zero?\n result = ''\n result += 'fizz' if mod3\n result += 'buzz' if mod5\n result.empty? ? arr.push(num) : arr.push(result)\n end\n arr\nend", "def fizzbuzz\n\tcount = 0\n\tan_array = []\n\twhile count <100\n\t\tan_array[count] = count\n\t\tif count%5 == 0\n\t\t\tan_array[count] = 'Buzz'\n\t\tend\n\t\tif count%3 == 0\n\t\t\tif count%5 == 0\n\t\t\t\tan_array[count] = 'FizzBuzz'\n\t\t\telse\n\t\t\t\tan_array[count] = 'Fizz'\n\t\t\tend\n\t\tend\n\t\tcount +=1\n\tend\n\treturn an_array\nend", "def fizzBuzz\n array = [*1..100]\n array.each { |num|\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"FizBuzz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n elsif num % 3 == 0\n puts \"Fizz\"\n else \n puts num\n end\n }\nend", "def fizzbuzz(number)\n\t\tif number % 15 == 0\n\t\t\t\"fizzbuzz\"\n\t\telsif number % 3 == 0 \n\t\t\t\"fizz\"\n\t\telsif number % 5 == 0\n\t\t\t\"buzz\"\n\t\telse\n\t\t\tnumber\n\t\tend\nend", "def fizzbuzz(n) n%15==0 ? \"FizzBuzz\" : n%3==0 ? \"Fizz\" : n%5==0 ? \"Buzz\" : nil end", "def fizzbuzz(n)\n new_sent = []\n(1..n).each do |x|\n if x % 15 == 0\n new_sent << \"fizzbuzz\"\n elsif x % 5 == 0\n new_sent << \"buzz\"\n elsif x % 3 == 0\n new_sent << \"fizz\"\n else\n new_sent << x\n end\n end\n new_sent\nend" ]
[ "0.9009288", "0.8897243", "0.8878064", "0.8870779", "0.88473666", "0.88398254", "0.88394076", "0.88104224", "0.8786902", "0.87707025", "0.8755419", "0.8721189", "0.8715512", "0.8704932", "0.8688922", "0.86843157", "0.86776346", "0.8657403", "0.86435914", "0.8643129", "0.86311144", "0.86276734", "0.86208355", "0.86036795", "0.8587287", "0.8556331", "0.8536002", "0.8505768", "0.8499235", "0.84802747", "0.8472494", "0.8434716", "0.8429733", "0.8411636", "0.8396028", "0.83816016", "0.8359831", "0.8298628", "0.8291426", "0.82612646", "0.82257664", "0.82233167", "0.8155218", "0.8122767", "0.8122767", "0.8114544", "0.806353", "0.80582297", "0.8049928", "0.80411386", "0.80375755", "0.80212337", "0.79536694", "0.79145956", "0.78993386", "0.7873333", "0.7844849", "0.7839081", "0.78350616", "0.7825597", "0.78119624", "0.7788726", "0.77513397", "0.7702883", "0.7694449", "0.7653792", "0.7628982", "0.753541", "0.7530479", "0.7493195", "0.74874157", "0.7465719", "0.7463041", "0.74224365", "0.74113154", "0.7383619", "0.7379055", "0.7345585", "0.73161674", "0.73161614", "0.73130506", "0.7306125", "0.7294799", "0.72668535", "0.72434634", "0.72430164", "0.7242191", "0.7216601", "0.72155356", "0.7200243", "0.7182807", "0.71775234", "0.7172626", "0.7162555", "0.7161585", "0.7150343", "0.713315", "0.7117165", "0.7116582", "0.7112698" ]
0.8575835
25
POST /parking_spaces POST /parking_spaces.json
def create space = ParkingSpace.new(user_id: current_user.id,cost: params[:cost], latitude: params[:latitude], longitude: params[:longitude], status: true, address: params[:address]) space.save redirect_to "/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to root_path, notice: \"Space was successfully created.\" }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space = Space.new(space_params)\n @space.user = current_user\n if @space.save\n render json: @space\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def create\n @space = Space.new(params[:space])\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render json: @space, status: :created, location: @space }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to @space, notice: 'Space was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space }\n else\n format.html { render action: 'new' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_station = SpaceStation.new(space_station_params)\n\n if @space_station.save\n render json: @space_station, status: :created, location: @space_station\n else\n render json: @space_station.errors, status: :unprocessable_entity\n end\n end", "def set_parking_space\n @parking_space = ParkingSpace.find(params[:parking_space_id])\n end", "def destroy\n @parking_space.destroy\n respond_to do |format|\n format.html { redirect_to parking_spaces_url, notice: 'Parking space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @space = Space.new(space_params)\n if @space.save\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def create\n @safe_space = SafeSpace.new(safe_space_params)\n\n respond_to do |format|\n if @safe_space.save\n format.html { redirect_to @safe_space, notice: 'Safe space was successfully created.' }\n format.json { render :show, status: :created, location: @safe_space }\n else\n format.html { render :new }\n format.json { render json: @safe_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_form = Space::Form.new(space: current_team.spaces.new,\n user: current_user,\n attributes: space_params)\n\n authorize @space_form.space, :create?\n\n respond_to do |format|\n if @space_form.save\n format.html do\n redirect_to case\n when @space_form.space.access_control.private? then space_members_path(@space_form.space)\n else space_pages_path(@space_form.space)\n end\n end\n format.json { render :show, status: :created, location: @space_form.space }\n else\n format.html { render :new }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newspace = current_user.created_spaces.new(space_params)\n\n respond_to do |format|\n if @newspace.save && update_subscription(@newspace)\n\n current_user.spaces << @newspace # Creates the join record to add the admin to this space\n\n format.html { redirect_to space_members_path(@newspace), notice: 'Space was successfully created.' }\n format.json { render :show, status: :created, location: @newspace }\n else\n format.html { render :new }\n format.json { render json: @mewspace.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:name, :spaceType, :multiplier, :area)\n end", "def create\n @office_space = OfficeSpace.new(office_space_params)\n\n respond_to do |format|\n if @office_space.save\n format.html { redirect_to @office_space, notice: 'Office space was successfully created.' }\n format.json { render :show, status: :created, location: @office_space }\n else\n format.html { render :new }\n format.json { render json: @office_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space = Space.new(space_params)\n @space.user = current_user\n\n if !space_params.has_key? :is_private\n @space.is_private = @space.user.prefers_private?\n if @space.organization\n @space.is_private = @space.is_private || @space.organization.prefers_private?\n end\n end\n\n if @space.save\n render json: SpaceRepresenter.new(@space).to_json(user_options: {current_user_can_edit: true})\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def park_spacerental_params\r\n params.require(:park_spacerental).permit(:park_space_id, :car_id, :start_rent, :end_rent, :price, :total, :apartment_id, :picture, :requested_start_rent, :requested_end_rent, :apartment, :park_space)\r\n end", "def create_space_with_http_info(create_space_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.create_space ...'\n end\n # verify the required parameter 'create_space_request' is set\n if @api_client.config.client_side_validation && create_space_request.nil?\n fail ArgumentError, \"Missing the required parameter 'create_space_request' when calling SpacesApi.create_space\"\n end\n # resource path\n local_var_path = '/video/v1/spaces'\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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(create_space_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SpaceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SpacesApi.create_space\",\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SpacesApi#create_space\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @myspace = Myspace.new(params[:myspace])\n\n respond_to do |format|\n if @myspace.save\n format.html { redirect_to @myspace, notice: 'Myspace was successfully created.' }\n format.json { render json: @myspace, status: :created, location: @myspace }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myspace.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @park_spacerental = ParkSpacerental.new(park_spacerental_params)\r\n\r\n respond_to do |format|\r\n if @park_spacerental.save\r\n format.html { redirect_to @park_spacerental, notice: 'Park spacerental was successfully created.' }\r\n format.json { render :show, status: :created, location: @park_spacerental }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @park_spacerental.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @space.save\n format.html { redirect_to spaces_path, notice: 'Friend was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space }\n else\n format.html { render action: 'new' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_reservation = SpaceReservation.new(space_reservation_params)\n\n respond_to do |format|\n if @space_reservation.save\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully created.' }\n format.json { render :show, status: :created, location: @space_reservation }\n else\n format.html { render :new }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space = current_user.spaces.build(space_params)\n @space.photos << Photo.where(space_token: @space.token)\n\n respond_to do |format|\n if @space.save\n flash[:success] = \"空间创建成功\"\n format.html { redirect_to @space }\n format.json { render :show, status: :created, location: @space }\n else\n format.html { render :new }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def spacecraft_params\n params.require(:spacecraft).permit(:name, :crew, :lat, :long)\n end", "def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end", "def create\n @parking_area = ParkingArea.new(parking_area_params)\n\n respond_to do |format|\n if @parking_area.save\n format.html { redirect_to @parking_area, notice: 'Parking area was successfully created.' }\n format.json { render :show, status: :created, location: @parking_area }\n else\n format.html { render :new }\n format.json { render json: @parking_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @open_space = current_user.open_spaces.new(params[:open_space])\n\n respond_to do |format|\n if (@open_space && @open_space.save)\n format.html { redirect_to(@open_space, :notice => 'Open space was successfully created.') }\n format.xml { render :xml => @open_space, :status => :created, :location => @open_space }\n format.js \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @open_space.errors, :status => :unprocessable_entity }\n format.js { render :json => @open_space.errors, :status => :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:calendar_frequency, \n :listing_weekly_price_native, \n :title, :summary,\n :bedrooms, :beds, :bathrooms, :bed_style, :home_style, :room_style, :person_capacity, \n :directions, \n :country_code, :street_address, :apt_ste_bld, :city, :state, :postal_code)\n end", "def create\n @espace = Espace.new(espace_params)\n respond_to do |format|\n if @espace.save\n format.html { redirect_to @espace, notice: 'Espace was successfully created.' }\n format.json { render action: 'show', status: :created, location: @espace }\n else\n format.html { render action: 'new' }\n format.json { render json: @espace.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spaceship = Spaceship.new(params[:spaceship])\n\n respond_to do |format|\n if @spaceship.save\n format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }\n format.json { render json: @spaceship, status: :created, location: @spaceship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaceship.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:name, :address, :phone, :fax, :website, :country, :postal, :timezone, :currency, :subdomain, :user_id, :plan, \n locations_attributes: [ :name, :address, :city, :state, :postal_code, :country, :timezone, :currency, :tax_rate ])\n end", "def create\n @space_amenity = SpaceAmenity.new(space_amenity_params)\n\n respond_to do |format|\n if @space_amenity.save\n format.html { redirect_to @space_amenity, notice: 'Space amenity was successfully created.' }\n format.json { render :show, status: :created, location: @space_amenity }\n else\n format.html { render :new }\n format.json { render json: @space_amenity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game = Game.new(game_params)\n\n @game.save\n\n old_map = Map.find(params[:game][:map_id]) \n @game.map = old_map.dup\n old_map.spaces.each do |old_space|\n new_space = old_space.dup\n @game.map.spaces << new_space\n end\n @game.map.save\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:name, :category, :address, :city, :state, :hours, :phone, :email, :website, :description)\n end", "def create\n @space_scene = SpaceScene.new(space_scene_params)\n\n respond_to do |format|\n if @space_scene.save\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully created.' }\n format.json { render :show, status: :created, location: @space_scene }\n else\n format.html { render :new }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def create\n @parking_space = ParkingSpace.find(booking_params.values.at(2))\n if check_overlap\n redirect_to booking_fail_path\n return\n end\n parking_space.booking.create(booking_params)\n redirect_to root_path\n end", "def create\n @space_type = SpaceType.new(space_type_params)\n authorize! :create, @space_type\n\n respond_to do |format|\n if @space_type.save\n format.html { redirect_to @space_type, notice: t('.create_ok') }\n format.json { render action: 'show', status: :created, location: @space_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @space_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parking_space.update()\n format.html { redirect_to @parking_space, notice: 'Parking space was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_space }\n else\n format.html { render :edit }\n format.json { render json: @parking_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorization(\"create\")\n\n @sharespace = Sharespace.new(sharespace_params)\n\n respond_to do |format|\n if @sharespace.save\n format.html { redirect_to @sharespace, notice: 'Sharespace was successfully created.' }\n format.json { render :show, status: :created, location: @sharespace }\n else\n format.html { render :new }\n format.json { render json: @sharespace.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spacecraft = Spacecraft.new(spacecraft_params)\n\n respond_to do |format|\n if @spacecraft.save\n format.html { redirect_to @spacecraft, notice: 'Spacecraft was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spacecraft }\n else\n format.html { render action: 'new' }\n format.json { render json: @spacecraft.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:title, :space_setting_id, :num_of_people_id, :content, :address, :token,\n :atmosphere_id, :city_id, :price_hour, :price_day, :price_month, :price_year,\n :detailed_ids => [], :user_group_ids => [], :rent_env_ids => [], photos_attributes: [:data] )\n end", "def create\r\n @parkspacelog = Parkspacelog.new(parkspacelog_params)\r\n\r\n respond_to do |format|\r\n if @parkspacelog.save\r\n format.html { redirect_to @parkspacelog, notice: 'Parkspacelog was successfully created.' }\r\n format.json { render :show, status: :created, location: @parkspacelog }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @parkspacelog.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def office_space_params\n params.require(:office_space).permit(:name, :address, :zip, :city, :description)\n end", "def parking_lot_params\n params.require(:parking_lot).permit(:floor_level, :slot_no, :distance, :is_allocated, :pk_lots)\n end", "def space_params\n params.require(:space).permit(:name, :cover, :access_control).to_h\n end", "def parkspacelog_params\r\n params.require(:parkspacelog).permit(:parking_no, :date, :message, :park_space_id)\r\n end", "def create\n @parking = Parking.new(parking_params)\n\n if @parking.save\n render :show, status: :created, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end", "def space_params\n params.require(:space).permit(:company_name, :description)\n end", "def space_params\n params.require(:space).permit(:name, :description, :user_id, :is_private, graph: graph_structure)\n end", "def create\n @parking_place = ParkingPlace.new(parking_place_params)\n\n if @parking_place.save\n render :show, status: :created, location: @parking_place\n else\n render json: @parking_place.errors, status: :unprocessable_entity\n end\n end", "def create\n @parking_spot = ParkingSpot.new(params[:parking_spot])\n\n respond_to do |format|\n if @parking_spot.save\n format.html { redirect_to @parking_spot, notice: 'Parking spot was successfully created.' }\n format.json { render json: @parking_spot, status: :created, location: @parking_spot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @parking_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_cat = SpaceCat.new(params[:space_cat])\n\n respond_to do |format|\n if @space_cat.save\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully created.' }\n format.json { render json: @space_cat, status: :created, location: @space_cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @spaces = Space.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spaces }\n end\n end", "def create\n @park = Park.new(params[:park])\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render json: @park, status: :created, location: @park }\n else\n format.html { render action: \"new\" }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @space_cat = SpaceCat.new(space_cat_params)\n\n respond_to do |format|\n if @space_cat.save\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @space_cat }\n else\n format.html { render action: 'new' }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parking_place = ParkingPlace.new(parking_place_params.merge(parking: @parking))\n\n respond_to do |format|\n if @parking_place.save\n format.html { redirect_to @parking_place, notice: t(:parking_place_created) }\n format.json { render :show, status: :created, location: @parking_place }\n else\n format.html { render :new }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parking_lot = ParkingLot.new(parking_lot_params)\n\n respond_to do |format|\n if @parking_lot.save\n format.html { redirect_to @parking_lot, notice: 'Parking lot was successfully created.' }\n format.json { render :show, status: :created, location: @parking_lot }\n else\n format.html { render :new }\n format.json { render json: @parking_lot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: \"Park was successfully created.\" }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_params\n params.require(:space).permit(:name, :description, :url, :is_public, :user_id)\n end", "def create_alt\n @parking_space = ParkingSpace.find(params[:id])\n if check_overlap\n redirect_to booking_fail_path\n return\n end\n @parking_space.booking.create(booking_params)\n redirect_to root_path\n end", "def parker_params\n params.require(:parker).permit(:garage_name, :point, :total_parking_spaces, :remaining_parking_spaces, :address, :price, :isOpen, :status, :road_garage)\n end", "def space_params\n params.require(:space).permit(:group_id, :start_at, :end_at, :note)\n end", "def create\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_member_ids = Member.where(group_id: group.id).pluck(:user_id)\n unless group_member_ids.include?(@current_user.id)\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render json: @reservation, status: :created\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @park = Park.new(park_params)\n\n respond_to do |format|\n if @park.save\n format.html { redirect_to @park, notice: 'Park was successfully created.' }\n format.json { render :show, status: :created, location: @park }\n else\n format.html { render :new }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def space_amenity_params\n params.require(:space_amenity).permit(:amenity_id, :space_id)\n end", "def create\n @availability_parking_place = AvailabilityParkingPlace.new(availability_parking_place_params)\n\n respond_to do |format|\n if @availability_parking_place.save\n format.html { redirect_to @availability_parking_place, notice: 'Availability parking place was successfully created.' }\n format.json { render :show, status: :created, location: @availability_parking_place }\n else\n format.html { render :new }\n format.json { render json: @availability_parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parking_place = current_user.parking_places.new(parking_place_params)\n\n respond_to do |format|\n if @parking_place.save\n format.html { redirect_to @parking_place, notice: 'Parking place was successfully created.' }\n format.json { render :show, status: :created, location: @parking_place }\n else\n format.html { render :new }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @space = Space.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @space }\n end\n end", "def parking_area_params\n params.require(:parking_area).permit(:capacity)\n end", "def car_params\n params.require(:car).permit(:name, :space_ids => [])\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url }\n format.json { head :no_content }\n end\n end", "def apartment_params\n params.require(:apartment).permit(:surface, :price, :latitude, :longitude)\n end", "def list_spaces_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.list_spaces ...'\n end\n # resource path\n local_var_path = '/video/v1/spaces'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ListSpacesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SpacesApi.list_spaces\",\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: SpacesApi#list_spaces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def space_create_with_http_info(account_id, space_create_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpacesApi.space_create ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling SpacesApi.space_create\"\n end\n # verify the required parameter 'space_create_parameters' is set\n if @api_client.config.client_side_validation && space_create_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'space_create_parameters' when calling SpacesApi.space_create\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/spaces'.sub('{' + 'account_id' + '}', CGI.escape(account_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(space_create_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'Space' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SpacesApi#space_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def sharespace_params\n params.require(:sharespace).permit(:space_type, :description, :cost, :sharespace_venue_id)\n end", "def park_params\n params.require(:park).permit(:status, :name, :url, :google_map_url, :address, :city, :state, :zip, :by_car, :by_bus, :by_train, :parking, :is_active, :long, :lat)\\\n end", "def space_params\n # TODO(matthew): Clean up client so we don't need to nest previous_updated_at within space.\n params.require(:space).permit(:name, :description, :is_private, :previous_updated_at, :organization_id, graph: graph_structure)\n end", "def list_spaces(opts = {})\n data, _status_code, _headers = list_spaces_with_http_info(opts)\n data\n end", "def set_park_spacerental\r\n @park_spacerental = ParkSpacerental.find(params[:id])\r\n end", "def room_params\n params.require(:room).permit(:beds, :storage_spaces)\n end", "def space_type_params\n params.require(:space_type).permit(\n :name, :short_name, :spaces_count, :notes,\n equipment_items_attributes: [:id, :qty, :notes, :equipment_model_id, :_destroy] )\n end", "def krowspace_params\n params.permit(:location, :startDate, :endDate)\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def space_type_params\n params.require(:space_type).permit(:name)\n end", "def make\n @spaces.each { |position| position.occupied = true }\n # pp \"made ship: #{@spaces}\"\n end", "def parking_params\n params.permit(:name, :addres, :phone, :quota)\n end", "def create\n apartment = Apartment.create(apartment_params)\n render json: apartment\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @space_user = SpaceUser.new(params[:space_user])\n\n respond_to do |format|\n if @space_user.save\n format.html { redirect_to space_users_path, notice: 'Space user was successfully created.' }\n format.json { render json: @space_user, status: :created, location: @space_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: \"Space was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def park_params\n params.require(:park).permit(:name, :address, :slug, :city, :available, :has_camera, :has_watchman, :zip_code, :district, :price_month, :main_picture, :lat, :lng)\n end" ]
[ "0.66497165", "0.6637594", "0.65458053", "0.65427285", "0.6508127", "0.6339218", "0.6222908", "0.6212978", "0.6210185", "0.6129767", "0.6123309", "0.6094469", "0.6066002", "0.605453", "0.6046955", "0.59935045", "0.5983363", "0.59381974", "0.5905322", "0.5893489", "0.588292", "0.58542347", "0.5780673", "0.5762063", "0.5758089", "0.57134414", "0.57132757", "0.5708788", "0.56906706", "0.56803244", "0.5670476", "0.56659853", "0.56578124", "0.5654487", "0.56461143", "0.5645447", "0.5620193", "0.56086826", "0.5607282", "0.5601383", "0.5599236", "0.5578879", "0.5568134", "0.5547612", "0.55419", "0.5517481", "0.5505011", "0.548009", "0.54688454", "0.54562926", "0.54426914", "0.54315543", "0.543127", "0.5422266", "0.54175806", "0.5408438", "0.5381952", "0.53708434", "0.5364488", "0.5352375", "0.53447896", "0.5344446", "0.5337456", "0.53359705", "0.53260314", "0.53160846", "0.5312701", "0.53087807", "0.5303472", "0.53019", "0.5296416", "0.5291632", "0.5285286", "0.5281933", "0.5271767", "0.52710384", "0.52710384", "0.5264822", "0.52554953", "0.52519876", "0.5249128", "0.52486426", "0.5239857", "0.52295196", "0.52230513", "0.5212325", "0.5212325", "0.5212325", "0.5212325", "0.5212325", "0.52114236", "0.5196429", "0.5185769", "0.51838964", "0.518164", "0.5181548", "0.5181548", "0.5175257", "0.5173328", "0.51706904" ]
0.5955855
17
PATCH/PUT /parking_spaces/1 PATCH/PUT /parking_spaces/1.json
def update respond_to do |format| if @parking_space.update() format.html { redirect_to @parking_space, notice: 'Parking space was successfully updated.' } format.json { render :show, status: :ok, location: @parking_space } else format.html { render :edit } format.json { render json: @parking_space.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n old_name = @space_type.name\n if @space_type.update(space_type_params)\n @space_type.spaces.each { |s| s.touch }\n format.html { redirect_to @space_type, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: 'Space was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @space = Space.find(params[:id])\n \n respond_to do |format|\n if @space.update_attributes(params[:space])\n format.html { redirect_to @space, notice: 'Space was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: \"Space was successfully updated.\" }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @space_station = SpaceStation.find(params[:id])\n\n if @space_station.update(space_station_params)\n head :no_content\n else\n render json: @space_station.errors, status: :unprocessable_entity\n end\n end", "def update\n logger.info(params)\n @space = Space.find(params[:id])\n respond_to do |format|\n if @space.update(space_params)\n flash[:info] = \"空间更新成功!\"\n format.html { redirect_to @space }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\r\n respond_to do |format|\r\n if @park_spacerental.update(park_spacerental_params)\r\n format.html { redirect_to @park_spacerental, notice: 'Park spacerental was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @park_spacerental }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @park_spacerental.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n filtered_params = space_params.reject { |k,v| k == 'previous_updated_at' }\n if @space.update(filtered_params)\n @space.take_checkpoint(current_user) if @space.needs_checkpoint?\n render json: SpaceRepresenter.new(@space).to_json(user_options: {current_user_can_edit: true}), status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @spacecraft.update(spacecraft_params)\n format.html { redirect_to @spacecraft, notice: 'Spacecraft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spacecraft.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @office_space.update(office_space_params)\n format.html { redirect_to @office_space, notice: 'Office space was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_space }\n else\n format.html { render :edit }\n format.json { render json: @office_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_space_in_system(slug, body, headers=default_headers)\n @logger.info(\"Updating Space \\\"#{slug}\\\"\")\n put(\"#{@api_url}/spaces/#{slug}\", body, headers)\n end", "def update\n @spaceship = Spaceship.find(params[:id])\n\n respond_to do |format|\n if @spaceship.update_attributes(params[:spaceship])\n format.html { redirect_to @spaceship, notice: 'Spaceship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaceship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @myspace = Myspace.find(params[:id])\n\n respond_to do |format|\n if @myspace.update_attributes(params[:myspace])\n format.html { redirect_to @myspace, notice: 'Myspace was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myspace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @space_form = Space::Form.new(space: @space,\n user: current_user,\n attributes: space_params)\n\n authorize @space, :update?\n\n respond_to do |format|\n if @space_form.save\n format.html { redirect_to space_pages_path(@space_form.space), notice: 'Space was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_form.space }\n else\n format.html { render :edit }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space_cat.update(space_cat_params)\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space_reservation.update(space_reservation_params)\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_reservation }\n else\n format.html { render :edit }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @safe_space.update(safe_space_params)\n format.html { redirect_to @safe_space, notice: 'Safe space was successfully updated.' }\n format.json { render :show, status: :ok, location: @safe_space }\n else\n format.html { render :edit }\n format.json { render json: @safe_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_parking_space\n @parking_space = ParkingSpace.find(params[:parking_space_id])\n end", "def update\n respond_to do |format|\n if @parking_lot.update(parking_lot_params)\n format.html { redirect_to @parking_lot, notice: 'Parking lot was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_lot }\n else\n format.html { render :edit }\n format.json { render json: @parking_lot.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\n \n @space = Space.find(params[:id])\n @space.update(space_params)\n \n if @space.save\n redirect_to @space, notice: 'El Espacio fue actualizado satisfactoriamente'\n else\n render :edit\n end\n \n end", "def update\n @open_space = current_user.open_spaces.get(params[:id])\n\n respond_to do |format|\n if @open_space.update(params[:open_space])\n format.html { redirect_to(@open_space, :notice => 'Open space was successfully updated.') }\n format.xml { head :ok }\n format.js \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @open_space.errors, :status => :unprocessable_entity }\n format.js { render :json => @open_space.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n if @space.update(space_params)\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end", "def update\n authorization(\"update\", @sharespace)\n\n respond_to do |format|\n if @sharespace.update(sharespace_params)\n format.html { redirect_to @sharespace, notice: 'Sharespace was successfully updated.' }\n format.json { render :show, status: :ok, location: @sharespace }\n else\n format.html { render :edit }\n format.json { render json: @sharespace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space_amenity.update(space_amenity_params)\n format.html { redirect_to @space_amenity, notice: 'Space amenity was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_amenity }\n else\n format.html { render :edit }\n format.json { render json: @space_amenity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @space_cat = SpaceCat.find(params[:id])\n\n respond_to do |format|\n if @space_cat.update_attributes(params[:space_cat])\n format.html { redirect_to @space_cat, notice: 'Space cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @space_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @facility_space.update(facility_space_params)\n format.html { redirect_to @facility_space, notice: 'Facility space was successfully updated.' }\n format.json { render :show, status: :ok, location: @facility_space }\n else\n format.html { render :edit }\n format.json { render json: @facility_space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n raise User::NotAuthorized, '수정할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.update_attributes(space_params)\n\n broadcast_update_space(@space)\n end", "def update\n respond_to do |format|\n if @parking_area.update(parking_area_params)\n format.html { redirect_to @parking_area, notice: 'Parking area was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_area }\n else\n format.html { render :edit }\n format.json { render json: @parking_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @space_id = args[:space_id] if args.key?(:space_id)\n end", "def update\n respond_to do |format|\n if @space_scene.update(space_scene_params)\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_scene }\n else\n format.html { render :edit }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slot.update(slot_params)\n @slot.update_slot_status\n format.html { redirect_to @slot, notice: 'Slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @slot }\n else\n format.html { render :edit }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ship_placement.update(ship_placement_params)\n format.html { redirect_to @ship_placement, notice: 'Ship placement was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship_placement }\n else\n format.html { render :edit }\n format.json { render json: @ship_placement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cargo_slot.update(cargo_slot_params)\n format.html { redirect_to @cargo_slot, notice: 'Cargo slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @cargo_slot }\n else\n format.html { render :edit }\n format.json { render json: @cargo_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @memory_slot.update(memory_slot_params)\n format.html { redirect_to @memory_slot, notice: 'Memory slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @memory_slot }\n else\n format.html { render :edit }\n format.json { render json: @memory_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_space_type_params\n params.require(:space_type).permit(:id, :name)\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @espace.update(espace_params)\n format.html { redirect_to @espace, notice: 'Espace was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @espace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slot_name.update(slot_name_params)\n format.html { redirect_to @slot_name, notice: 'Slot name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slot_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space.update(space_params) && update_subscription(@space)\n format.html { redirect_to edit_space_url(@space), notice: 'Space was successfully updated.' }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n apartment = Apartment.find(params[:id])\n apartment.update_attributes(apartment_params)\n render json: apartment\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slot.update(slot_params)\n format.html { redirect_to \"/slots\", notice: 'Slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @slot }\n else\n format.html { render :edit }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slot = Slot.find(params[:id])\n\n respond_to do |format|\n if @slot.update_attributes(params[:slot])\n format.html { redirect_to @slot, notice: 'Slot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mission_capacity.update(mission_capacity_params)\n format.html { redirect_to @mission_capacity, notice: 'Mission capacity was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_capacity }\n else\n format.html { render :edit }\n format.json { render json: @mission_capacity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sphere.update(sphere_params)\n format.html { redirect_to @sphere, notice: 'Sphere was successfully updated.' }\n format.json { render :show, status: :ok, location: @sphere }\n else\n format.html { render :edit }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n if @lot.update_attributes(params[:lot])\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @parkspacelog.update(parkspacelog_params)\r\n format.html { redirect_to @parkspacelog, notice: 'Parkspacelog was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @parkspacelog }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @parkspacelog.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @availability_slot = AvailabilitySlot.find(params[:id])\n\n respond_to do |format|\n if @availability_slot.update_attributes(params[:availability_slot])\n format.html { redirect_to @availability_slot, :notice => 'Availability slot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @availability_slot.errors, :event => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: \"Park was successfully updated.\" }\n format.json { render :show, status: :ok, location: @park }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @availability_parking_place.update(availability_parking_place_params)\n format.html { redirect_to @availability_parking_place, notice: 'Availability parking place was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability_parking_place }\n else\n format.html { render :edit }\n format.json { render json: @availability_parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @park = Park.find(params[:id])\n\n respond_to do |format|\n if @park.update_attributes(params[:park])\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @parking_spot = ParkingSpot.find(params[:id])\n\n respond_to do |format|\n if @parking_spot.update_attributes(params[:parking_spot])\n format.html { redirect_to @parking_spot, notice: 'Parking spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @parking_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { render :show, status: :ok, location: @park }\n else\n format.html { render :edit }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { render :show, status: :ok, location: @park }\n else\n format.html { render :edit }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n respond_to do |format|\n if @parking_place.update(parking_place_params)\n format.html { redirect_to @parking_place, notice: 'Parking place was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_place }\n else\n format.html { render :edit }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cargo = current_scope.find(params[:id])\n\n respond_to do |format|\n if @cargo.update_attributes(params[:cargo])\n format.html { redirect_to admin_cargo_outs_path, notice: 'current_scope was successfully updated.' }\n format.json { head :no_content }\n else\n @shippings = @cargo.shippings.includes(:to_huozhan) + current_user.huozhan.ship_outs.with_status(\"received\").with_to_huozhan(params[:to]).includes(:to_huozhan)\n format.html { render action: \"edit\" }\n format.json { render json: @cargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @parking.update(parking_params)\n render :show, status: :ok, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @parking.update(parking_params)\n format.html { redirect_to @parking, notice: 'Parking was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking }\n else\n format.html { render :edit }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @computer_geometry.update(computer_geometry_params)\n format.html { redirect_to @computer_geometry, notice: 'Computer geometry was successfully updated.' }\n format.json { render :show, status: :ok, location: @computer_geometry }\n else\n format.html { render :edit }\n format.json { render json: @computer_geometry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if spot = SkateSpot.where(:id => params[:id]).first and info = parse_input(params)\n if info.has_key?(:alt_names)\n info[:alt_names].map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) }\n end\n\n if info[:name]\n info[:name] = SpotName.find_or_create_by(:name => info[:name], :spot => spot) \n end\n\n if info.has_key?(:obstacles)\n info[:obstacles].map! { |o|\n Obstacle.find_or_create_by(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot)\n }\n end\n\n render :json => { :status => (spot.update(info) == true ? :success : :unprocessable_entity) }\n else\n render :json => { :status => :unprocessable_entity }\n end\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end", "def update\n respond_to do |format|\n if @parking_place.update(parking_place_params)\n format.html { redirect_to @parking_place, notice: t(:parking_place_updated) }\n format.json { render :show, status: :ok, location: @parking_place }\n else\n format.html { render :edit }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @process_lot.update(process_lot_params)\n format.html { redirect_to @process_lot, notice: 'Process lot was successfully updated.' }\n format.json { render :show, status: :ok, location: @process_lot }\n else\n format.html { render :edit }\n format.json { render json: @process_lot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capartment.update(capartment_params)\n format.html { redirect_to calc_apartments_path, notice: 'Capartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @parking_place.update(parking_place_params)\n render :show, status: :ok, location: @parking_place\n else\n render json: @parking_place.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize! :update, @it_park\n respond_to do |format|\n if @it_park.update(it_park_params)\n format.html { redirect_to @it_park, notice: 'It park was successfully updated.' }\n format.json { render :show, status: :ok, location: @it_park }\n else\n format.html { render :edit }\n format.json { render json: @it_park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @apartment.update(apartment_params)\n render :show, status: :ok, location: @apartment\n else\n render json: @apartment.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @ag_apartment.update(ag_apartment_params)\n format.html { redirect_to @ag_apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @ag_apartment }\n else\n format.html { render :edit }\n format.json { render json: @ag_apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slot_machine.update(slot_machine_params)\n format.html { redirect_to @slot_machine, notice: 'Slot machine was successfully updated.' }\n format.json { render :show, status: :ok, location: @slot_machine }\n else\n format.html { render :edit }\n format.json { render json: @slot_machine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @planetary_system.update(planetary_system_params)\n format.html { redirect_to @planetary_system, notice: 'Planetary system was successfully updated.' }\n format.json { render :show, status: :ok, location: @planetary_system }\n else\n format.html { render :edit }\n format.json { render json: @planetary_system.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n if @apartment.update_attributes(params[:apartment])\n format.html { redirect_to building_url(@building), notice: 'Apartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { render :show, status: :ok, location: @field }\n else\n format.html { render :edit }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slot = Slot.find(params[:id])\n\n error = false\n msg = \"\"\n\n shelf = Shelf.find_by_number(params[:slot][:shelf])\n unless shelf\n error = true\n msg << \"Shelf does not exist\"\n else\n box = shelf.boxes.find_by_number(params[:slot][:box])\n unless box\n error = true\n msg << \"Box does not exist, Please create box first\"\n else\n slot = box.slots.find_by_number(params[:slot][:number]) \n msg << \"New Slot created\" if slot\n @slot.box = box\n @slot.number = params[:slot][:number]\n end \n end\n\n respond_to do |format|\n if !error and @slot.update_attributes(params[:slot])\n flash[:notice] = 'Slot was successfully updated.'\n format.html { redirect_to(@slot) }\n format.xml { head :ok }\n else\n flash[:notice] = msg\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shipfleet.update(shipfleet_params)\n format.html { redirect_to @shipfleet, notice: 'Shipfleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipfleet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end", "def update\n\n respond_to do |format|\n if @allocation.update(allocation_params)\n format.html { redirect_to @allocation, notice: t(:allocation_updated) }\n format.json { render :show, status: :ok, location: @allocation }\n else\n format.html { render :edit }\n format.json { render json: @allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @allocation = Allocation.find(params[:id])\n\n respond_to do |format|\n if @allocation.update_attributes(params[:allocation])\n format.html { redirect_to @allocation, notice: 'Allocation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @allocation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @park.update(park_params)\n format.html { redirect_to @park, notice: 'Park was successfully updated.' }\n format.json { render :show, status: :ok, location: @park }\n else\n format.html { render :edit }\n format.json { render json: @park.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def set_space\n @space = Space.find(params[:id])\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @climbing_route.update(climbing_route_params)\n format.html { redirect_to @climbing_route, notice: 'Climbing route was successfully updated.' }\n format.json { render :show, status: :ok, location: @climbing_route }\n else\n format.html { render :edit }\n format.json { render json: @climbing_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @space_user = SpaceUser.find(params[:id])\n\n respond_to do |format|\n if @space_user.update_attributes(params[:space_user])\n format.html { redirect_to space_users_path, notice: 'Space user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @space_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brace.update(brace_params)\n format.html { redirect_to @brace, notice: 'Brace was successfully updated.' }\n format.json { render :show, status: :ok, location: @brace }\n format.js { render :nothing => true }\n else\n format.html { render :edit }\n format.json { render json: @brace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @shopping_area = ShoppingArea.find(params[:id])\n\n respond_to do |format|\n if @shopping_area.update_attributes(params[:shopping_area])\n format.html { redirect_to @shopping_area, notice: 'Shopping area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_park_spacerental\r\n @park_spacerental = ParkSpacerental.find(params[:id])\r\n end", "def update\n @apartment = Apartment.find(params[:id])\n respond_to do |format|\n if @apartment.update(apartment_params)\n format.html { redirect_to apartments_path, notice: 'Apartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.html { redirect_to @spot, notice: t(:course_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mission_environment.update(mission_environment_params)\n format.html { redirect_to @mission_environment, notice: 'Mission environment was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_environment }\n else\n format.html { render :edit }\n format.json { render json: @mission_environment.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7036821", "0.6905672", "0.67417186", "0.67258394", "0.672431", "0.6577326", "0.6521679", "0.6505496", "0.63878936", "0.6386075", "0.6371937", "0.62871313", "0.62064886", "0.62012887", "0.6196917", "0.6152263", "0.6124943", "0.6115081", "0.61142737", "0.6094343", "0.6090963", "0.6080547", "0.6080239", "0.60706604", "0.605906", "0.6036867", "0.60196096", "0.599374", "0.5971064", "0.5884485", "0.58749634", "0.58689165", "0.5859145", "0.5853107", "0.5838994", "0.5833509", "0.5812535", "0.5804291", "0.5787054", "0.57749265", "0.57677937", "0.57663727", "0.57519996", "0.5730368", "0.57151896", "0.57135755", "0.5713197", "0.5705386", "0.56990045", "0.56971085", "0.56882346", "0.568337", "0.56809324", "0.5678081", "0.5675386", "0.56681615", "0.56563634", "0.56557685", "0.56557685", "0.5655718", "0.5655718", "0.5655629", "0.5638651", "0.56361085", "0.56310713", "0.56287235", "0.5628387", "0.5624758", "0.56164795", "0.5616109", "0.56159544", "0.5614816", "0.5612107", "0.560136", "0.56003165", "0.55977035", "0.5592408", "0.5574059", "0.55654275", "0.5552605", "0.5552469", "0.55480134", "0.5546398", "0.5544914", "0.5539775", "0.55349904", "0.55349904", "0.5534857", "0.55333495", "0.5528144", "0.55212265", "0.55168253", "0.5513606", "0.5512342", "0.5505658", "0.55052143", "0.5502253", "0.5496562", "0.5492449", "0.54885954" ]
0.7160079
0
DELETE /parking_spaces/1 DELETE /parking_spaces/1.json
def destroy @parking_space.destroy respond_to do |format| format.html { redirect_to parking_spaces_url, notice: 'Parking space was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @space = Space.find(params[:id])\n\n @space.destroy\n\n respond_to do |format|\n format.html { redirect_to spaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @space = @basic.spaces.find(params[:id])\n @space.destroy\n respond_to do |format|\n format.html { redirect_to edit_basic_path(@basic), notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url, notice: \"Space was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @space.destroy\n head :no_content\n end", "def destroy\n @space.destroy\n head :no_content\n end", "def destroy\n @myspace = Myspace.find(params[:id])\n @myspace.destroy\n\n respond_to do |format|\n format.html { redirect_to myspaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spacecraft.destroy\n respond_to do |format|\n format.html { redirect_to spacecrafts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_station.destroy\n\n head :no_content\n end", "def destroy\n authorize @space, :destroy?\n\n @space.destroy\n respond_to do |format|\n format.html { redirect_to spaces_url(@space.team), notice: 'Space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @espace.destroy\n respond_to do |format|\n format.html { redirect_to espaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @office_space.destroy\n respond_to do |format|\n format.html { redirect_to office_spaces_url, notice: 'Office space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @open_space = current_user.open_spaces.get(params[:id])\n @open_space.destroy\n\n respond_to do |format|\n format.html { redirect_to(open_spaces_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html { redirect_to spaceships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @safe_space.destroy\n respond_to do |format|\n format.html { redirect_to safe_spaces_url, notice: 'Safe space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_type.destroy\n respond_to do |format|\n format.html { redirect_to space_types_url, status: 303 }\n format.json { head :no_content }\n end\n end", "def destroy\n authorization(\"destroy\", @sharespace)\n\n @sharespace.destroy\n respond_to do |format|\n format.html { redirect_to sharespaces_url, notice: 'Sharespace was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_amenity.destroy\n respond_to do |format|\n format.html { redirect_to space_amenities_url, notice: 'Space amenity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_scene.destroy\n respond_to do |format|\n format.html { redirect_to space_scenes_url, notice: 'Space scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility_space.destroy\n respond_to do |format|\n format.html { redirect_to facility_spaces_url, notice: 'Facility space was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_cat.destroy\n respond_to do |format|\n format.html { redirect_to space_cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_cat = SpaceCat.find(params[:id])\n @space_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to space_cats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pic_space = PicSpace.find(params[:id])\n @pic_space.destroy\n\n respond_to do |format|\n format.html { redirect_to pic_spaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @space_reservation.destroy\n respond_to do |format|\n format.html { redirect_to space_reservations_url, notice: 'Space reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @park_spacerental.destroy\r\n respond_to do |format|\r\n format.html { redirect_to park_spacerentals_url, notice: 'Park spacerental was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @shard = Shard.find(params[:id])\n @shard.destroy\n\n respond_to do |format|\n format.html { redirect_to shards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipfleet.destroy\n respond_to do |format|\n format.html { redirect_to shipfleets_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @allocation.destroy\n respond_to do |format|\n format.html { redirect_to allocations_url, notice: t(:allocation_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocation = Allocation.find(params[:id])\n @allocation.destroy\n\n respond_to do |format|\n format.html { redirect_to allocations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @parking_area.destroy\n respond_to do |format|\n format.html { redirect_to parking_areas_url, notice: 'Parking area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @parkspacelog.destroy\r\n respond_to do |format|\r\n format.html { redirect_to parkspacelogs_url, notice: 'Parkspacelog was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @osm.destroy\n respond_to do |format|\n format.html { redirect_to osms_url, notice: 'Osm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @space = Space.find(params[:id])\n @space.destroy\n\n redirect_back(fallback_location: request.referer, notice: \"Listing deleted.\")\n end", "def destroy\n @line_station_2.destroy\n respond_to do |format|\n format.html { redirect_to line_station_2s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @parking_lot.destroy\n respond_to do |format|\n format.html { redirect_to parking_lots_url, notice: 'Parking lot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocation.destroy\n respond_to do |format|\n format.html { redirect_to allocations_url, notice: 'Allocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n raise User::NotAuthorized, '삭제할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.destroy\n\n broadcast_delete_space(@space)\n end", "def destroy\n @park = Park.find(params[:id])\n @park.destroy\n\n respond_to do |format|\n format.html { redirect_to parks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url, notice: 'Field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission_capacity.destroy\n respond_to do |format|\n format.html { redirect_to mission_capacities_url, notice: 'Mission capacity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url, notice: 'Park was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url, notice: 'Park was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url, notice: \"Park was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @gas_station = GasStation.find(params[:id])\n @gas_station.destroy\n\n respond_to do |format|\n format.html { redirect_to gas_stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slot_name.destroy\n respond_to do |format|\n format.html { redirect_to slot_names_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grass_allocation.destroy\n respond_to do |format|\n format.html { redirect_to grass_allocations_url, notice: 'Grass allocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apartment.destroy\n respond_to do |format|\n format.html { redirect_to apartments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capartment.destroy\n respond_to do |format|\n format.html { redirect_to capartments_url }\n format.json { head :no_content }\n end\n end", "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def destroy\n @stroke.destroy\n respond_to do |format|\n format.html { redirect_to strokes_url, notice: 'Stroke was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apartment = @building.apartments.find(params[:id])\n @apartment.destroy\n\n respond_to do |format|\n format.html { redirect_to @building, notice: 'Apartment was successfully removed.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @barrio_colonium.destroy\n respond_to do |format|\n format.html { redirect_to barrio_colonia_url, notice: 'Barrio colonium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship_placement.destroy\n respond_to do |format|\n format.html { redirect_to ship_placements_url, notice: 'Ship placement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz32.destroy\n respond_to do |format|\n format.html { redirect_to baz32s_url, notice: \"Baz32 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @station = Station.find(params[:id])\n @station.destroy\n\n respond_to do |format|\n format.html { redirect_to stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brace.destroy\n respond_to do |format|\n format.html { redirect_to braces_url, notice: 'Brace was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lot = Lot.find(params[:id])\n @lot.destroy\n\n respond_to do |format|\n format.html { redirect_to myadmin_lots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @station.destroy\n respond_to do |format|\n format.html { redirect_to stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @geometry.destroy\n respond_to do |format|\n format.html { redirect_to geometries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpsquest.destroy\n respond_to do |format|\n format.html { redirect_to gpsquests_url, notice: 'Gpsquest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asos_station.destroy\n respond_to do |format|\n format.html { redirect_to asos_stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gp40.destroy\n respond_to do |format|\n format.html { redirect_to gp40s_url, notice: 'Gp40 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @slot = Slot.find(params[:id])\n @slot.destroy\n\n respond_to do |format|\n format.html { redirect_to slots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @warehouse_allocation.destroy\n respond_to do |format|\n format.html { redirect_to warehouse_allocations_url, notice: 'Warehouse allocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @grant_sector.destroy\n respond_to do |format|\n format.html { redirect_to grant_sectors_url, notice: 'Grant sector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @region.destroy\n\n head :no_content\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargo_slot.destroy\n respond_to do |format|\n format.html { redirect_to cargo_slots_url, notice: 'Cargo slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @maze.destroy\n respond_to do |format|\n format.html { redirect_to mazes_url, notice: 'Labirinto destruído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cartridge.destroy\n respond_to do |format|\n format.html { redirect_to cartridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipcount.destroy\n respond_to do |format|\n format.html { redirect_to shipcounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fleet.destroy\n respond_to do |format|\n format.html { redirect_to fleets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage_lun = StorageLun.find(params[:id])\n @storage_lun.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_luns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asteroid.destroy\n respond_to do |format|\n format.html { redirect_to asteroids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz54.destroy\n respond_to do |format|\n format.html { redirect_to baz54s_url, notice: \"Baz54 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @memory_slot.destroy\n respond_to do |format|\n format.html { redirect_to memory_slots_url, notice: 'Memory slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n movement_history @movement, 3\n\n @movement.destroy\n\n respond_to do |format|\n format.html { redirect_to pockets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @township.destroy\n respond_to do |format|\n format.html { redirect_to townships_url, notice: 'Township was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7579779", "0.748946", "0.73665106", "0.7360793", "0.7360793", "0.73544115", "0.7353935", "0.7353935", "0.73025227", "0.7278187", "0.7246087", "0.7114373", "0.70578474", "0.7021938", "0.7005223", "0.7001286", "0.6980316", "0.69774145", "0.69031316", "0.6890877", "0.6887043", "0.6883554", "0.6867375", "0.6780678", "0.67611283", "0.6738058", "0.67075664", "0.66963834", "0.6695912", "0.6641596", "0.66060024", "0.6601778", "0.6594448", "0.659281", "0.6584537", "0.65716255", "0.65659046", "0.65643686", "0.6554901", "0.6551196", "0.65426445", "0.6536821", "0.65347844", "0.65314746", "0.65291613", "0.6504447", "0.65040255", "0.65003794", "0.6486341", "0.6476523", "0.64756835", "0.64717925", "0.64551896", "0.6453737", "0.64473206", "0.6446404", "0.64444375", "0.643973", "0.64363945", "0.64344364", "0.64328784", "0.64319193", "0.6427972", "0.6427694", "0.6422387", "0.6419957", "0.641971", "0.64178205", "0.6411859", "0.6411495", "0.6410533", "0.64075106", "0.6404531", "0.6404455", "0.64038825", "0.64001083", "0.63980424", "0.63885844", "0.63865", "0.63859606", "0.63859016", "0.6383487", "0.63794136", "0.6379209", "0.6378731", "0.63743144", "0.63736624", "0.63718057", "0.63695", "0.6369369", "0.6368377", "0.636484", "0.6360996", "0.6358121", "0.63571924", "0.6356175", "0.63555163", "0.63543516", "0.63543516", "0.63543516" ]
0.7652014
0
GET /practitioners GET /practitioners.json
def index @practitioners = Practitioner.paginate(page: params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end", "def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end", "def show\n @practitioner_type = PractitionerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "def index\n @medical_practitioners_profiles = MedicalPractitionersProfile.all\n render json: @medical_practitioners_profiles\n end", "def index\n @practitioner_profiles = PractitionerProfile.all\n end", "def index\n @practices = Practice.order(\"practice_name\").paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @practices }\n end\n end", "def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "def index\n courses = Course.includes(:professors).includes(:ratings).all\n\n render json: courses.to_json(include: [:professors, :ratings])\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def index\n tutor = User.find(params[:tutor_id])\n\n courses = Course.joins(tutor_subjects: :user)\n .select('courses.course_prefix, courses.course_code, tutor_subjects.id')\n .where('tutor_subjects.user_id = ' + params[:tutor_id])\n\n course_list = []\n courses.each do |course|\n course_list << course.course_prefix + course.course_code\n end\n\n avg_rate = TutorSubject.where(:user_id => params[:tutor_id]).average(:rate)\n rating = (tutor.agg_tutor_rating.to_f / tutor.num_tutor_rating.to_f).round(1)\n\n response = {\n biography: tutor.tutor_description,\n caption: tutor.tutor_short_description,\n firstname: tutor.first_name,\n lastname: tutor.last_name,\n phonenumber: tutor.phone_number,\n degree: tutor.education,\n coursesTeaching: course_list,\n rating: rating,\n rate: avg_rate,\n image: tutor.image\n }\n\n json_response(response)\n end", "def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end", "def grab_professors\n professor_size = User.where(:professor => true).length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n if current_offset + direction < professor_size && current_offset + direction >= 0\n offset = current_offset + direction\n @professors = User.where(:professor => true).offset(offset).take(10)\n render :json => @professors\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n\n }\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def index\n @collection = current_user.collections.find(params[:collection_id]) \n @recommenders = @collection.recommenders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommenders }\n end\n end", "def index\n @teachers = Teacher.all.select { |t| t unless t.user.nil? }\n respond_with @teachers\n end", "def show\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def my_interviews\n @interviews = Interview.find(:all, :conditions => ['teacher_id = ?', self.current_user.teacher.id])\n \n respond_to do |format|\n format.html # my_interviews.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @researchers = Researcher.all\n end", "def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end", "def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end", "def show\n json_response(@faculty)\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def index\n # @lecturers = Lecturer.all\n respond_to do |format|\n format.html\n format.json {render json: LecturersDatatable.new(view_context)}\n end\n end", "def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end", "def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n \n @lectures = Lecture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lectures }\n end\n end", "def show\n @user = User.find(params[:id])\n @planners = @user.planners\n @competitions = @user.competitions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor }\n end\n end", "def index\n @practices = Practice.all\n end", "def index\n @practices = Practice.all\n end", "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "def generate_practitioners\n PDEX::NPPESDataRepo.practitioners.each do |nppes_data|\n PDEX::PractitionerGenerator.new(nppes_data).generate.each do |resource|\n write_resource(resource)\n end\n end\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end", "def show\n render json: {teacher: @course.teacher, course: @course, categories: @course.categories, training_sessions: @course.training_sessions}\n end", "def show\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommender }\n end\n end", "def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reviewer }\n end\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @expertises = Expertise.all\n\n render json: @expertises\n end", "def puzzles\n puzzles = RatedPuzzle.for_user(current_user)\n unless params[:next].present?\n puzzles = [RepetitionLevel.number(1).first_puzzle] + puzzles\n end\n render json: {\n puzzles: puzzles\n }\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend", "def index\n @teachers = Teacher.all\n end", "def index\n @teachers = Teacher.all\n end", "def index\n @teachers = Teacher.all\n end", "def index\n @teachers = Teacher.all\n end", "def index\n @teachers = Teacher.all\n end", "def show\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def show\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer }\n end\n end", "def index\n @competitions = Competition.paginate(:page => params[:page], :per_page => 3)\n\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def index\n @tutors = Tutor.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @teacher }\n end\n end", "def show\n render json: @faculty\n end", "def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end", "def index\n @recruiters = Recruiter.all\n render_json_serializer(@recruiters)\n end", "def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def new\n @practitioner_type = PractitionerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def show\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end", "def show\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recruiter }\n end\n end", "def index\n #@meeting_threads = MeetingThread.all\n\n @calendar_guesses = @current_user.calendar_guesses\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calendar_guesses }\n end\n end", "def show\n fhir_client = SessionHandler.fhir_client(session.id)\n fhir_practitionerRole = fhir_client.read(FHIR::PractitionerRole, params[:id]).resource\n\n @practitioner_role = PractitionerRole.new(fhir_practitionerRole) unless fhir_practitionerRole.nil?\n end", "def show\n render json: @instructor\n end", "def index\n @presenters = Presenter.all\n @meetings = Meeting.all\n @users = User.all\n end", "def show\n @recommender = User.where(username: params[:username]).first.recommender\n if @recommender.nil?\n render json: \"No Recommender of this user found\"\n else\n render json: @recommender.to_json(only: :latest_recommendation)\n end\n end", "def index\n @teaches = Teach.all\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@teaches) }\n\t\tend\n\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def show\n @course_professor = CourseProfessor.find(params[:id])\n\n @reviews_temp = @course_professor.reviews.sort_by{|r| - r.created_at.to_i}\n @reviews = @reviews_temp.paginate(:page => params[:page], :per_page=> 2)\n\n @grades = @course_professor.grades\n @course = Course.where(:id => @course_professor.course_id).first()\n @subdepartment = Subdepartment.where(:id => @course.subdepartment_id).first()\n @professor = Professor.where(:id => @course_professor.professor_id).first()\n @paginate = @course_professor.reviews.paginate(page: 1, per_page: 2)\n @professors = CourseProfessor.where(\"course_id = ?\", @course[:id])\n .joins(:professor)\n\n #used to pass grades to the donut chart\n gon.grades = @grades\n\n if @reviews.length > 0\n @rev_ratings = get_review_ratings\n @rev_emphasizes = get_review_emphasizes\n end\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @course_professor }\n end\n end", "def index\n @partners = Partner.all\n end", "def index\n @interviews = Interview.paginate(:page => params[:page]).order(\"storyteller_name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end" ]
[ "0.7090701", "0.67998195", "0.65641993", "0.6466721", "0.64629376", "0.6378065", "0.63714486", "0.63593394", "0.63593394", "0.634581", "0.62098026", "0.617209", "0.616472", "0.61512583", "0.61117274", "0.607021", "0.6057666", "0.6049288", "0.6047453", "0.6035049", "0.6028155", "0.5991926", "0.59897316", "0.5966429", "0.5956415", "0.594369", "0.5934848", "0.591891", "0.5912185", "0.58959705", "0.58681893", "0.5846217", "0.5846217", "0.58458084", "0.5844129", "0.58380866", "0.5835565", "0.58293295", "0.58277225", "0.5826156", "0.58214206", "0.58206946", "0.5818857", "0.5816734", "0.5815502", "0.5815502", "0.5809163", "0.57976496", "0.5786983", "0.5786983", "0.5782509", "0.5779562", "0.5777587", "0.57750314", "0.5762296", "0.57443756", "0.5742746", "0.5742648", "0.5738737", "0.5736876", "0.5736876", "0.573019", "0.57233053", "0.57233053", "0.57215464", "0.57135934", "0.57135934", "0.57135934", "0.57135934", "0.57135934", "0.57131124", "0.5710475", "0.5708616", "0.5706316", "0.5705179", "0.5705179", "0.5695693", "0.56948507", "0.5693281", "0.5690409", "0.5688806", "0.5682861", "0.56825805", "0.568185", "0.5680413", "0.5677271", "0.5675967", "0.56745076", "0.5673459", "0.5672127", "0.5660376", "0.5656165", "0.5653065", "0.5651808", "0.5651549", "0.564776", "0.56446683", "0.5644258", "0.56439644", "0.56403995" ]
0.6931075
1
GET /practitioners/1 GET /practitioners/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @practitioner_type = PractitionerType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def index\n @practitioners = Practitioner.paginate(page: params[:page])\n end", "def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end", "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end", "def index\n @practitioner_profiles = PractitionerProfile.all\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def index\n @practices = Practice.order(\"practice_name\").paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @practices }\n end\n end", "def show\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def get_researcher\n @researcher = Researcher.find(params[:id])\n end", "def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end", "def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end", "def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reviewer }\n end\n end", "def index\n @medical_practitioners_profiles = MedicalPractitionersProfile.all\n render json: @medical_practitioners_profiles\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def show\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recruiter }\n end\n end", "def new\n @practitioner_type = PractitionerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "def new\n @practice = Practice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end", "def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end", "def show\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor }\n end\n end", "def show\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer }\n end\n end", "def my_interviews\n @interviews = Interview.find(:all, :conditions => ['teacher_id = ?', self.current_user.teacher.id])\n \n respond_to do |format|\n format.html # my_interviews.html.erb\n format.json { render json: @interviews }\n end\n end", "def show\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end", "def show\n fhir_client = SessionHandler.fhir_client(session.id)\n fhir_practitionerRole = fhir_client.read(FHIR::PractitionerRole, params[:id]).resource\n\n @practitioner_role = PractitionerRole.new(fhir_practitionerRole) unless fhir_practitionerRole.nil?\n end", "def show\n json_response(@faculty)\n end", "def show\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommender }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @teacher }\n end\n end", "def show\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end", "def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end", "def show\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collaborator }\n end\n end", "def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def show\n @user = User.find(params[:id])\n @planners = @user.planners\n @competitions = @user.competitions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end", "def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end", "def show\n @recommender = User.where(username: params[:username]).first.recommender\n if @recommender.nil?\n render json: \"No Recommender of this user found\"\n else\n render json: @recommender.to_json(only: :latest_recommendation)\n end\n end", "def show\n @interview = Interview.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end", "def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end", "def show\n @laboratory = Laboratory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laboratory }\n end\n end", "def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end", "def index\n @researchers = Researcher.all\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\n end\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end", "def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "def index\n @collection = current_user.collections.find(params[:collection_id]) \n @recommenders = @collection.recommenders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommenders }\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcher }\n end\n end", "def index\n @practices = Practice.all\n end", "def index\n @practices = Practice.all\n end", "def show\n render json: @instructor\n end", "def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end", "def grab_professors\n professor_size = User.where(:professor => true).length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n if current_offset + direction < professor_size && current_offset + direction >= 0\n offset = current_offset + direction\n @professors = User.where(:professor => true).offset(offset).take(10)\n render :json => @professors\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n\n }\n end\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def show\n render json: @faculty\n end", "def create\n @practitioner = Practitioner.new(practitioner_params)\n\n respond_to do |format|\n if @practitioner.save\n format.html { redirect_to @practitioner, notice: 'Practitioner was successfully created.' }\n format.json { render :show, status: :created, location: @practitioner }\n else\n format.html { render :new }\n format.json { render json: @practitioner.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end", "def show\n @lecturer_post_page = LecturerPostPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecturer_post_page }\n end\n end", "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "def show\n render json: @laboratory\n end", "def index\n tutor = User.find(params[:tutor_id])\n\n courses = Course.joins(tutor_subjects: :user)\n .select('courses.course_prefix, courses.course_code, tutor_subjects.id')\n .where('tutor_subjects.user_id = ' + params[:tutor_id])\n\n course_list = []\n courses.each do |course|\n course_list << course.course_prefix + course.course_code\n end\n\n avg_rate = TutorSubject.where(:user_id => params[:tutor_id]).average(:rate)\n rating = (tutor.agg_tutor_rating.to_f / tutor.num_tutor_rating.to_f).round(1)\n\n response = {\n biography: tutor.tutor_description,\n caption: tutor.tutor_short_description,\n firstname: tutor.first_name,\n lastname: tutor.last_name,\n phonenumber: tutor.phone_number,\n degree: tutor.education,\n coursesTeaching: course_list,\n rating: rating,\n rate: avg_rate,\n image: tutor.image\n }\n\n json_response(response)\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def index\n courses = Course.includes(:professors).includes(:ratings).all\n\n render json: courses.to_json(include: [:professors, :ratings])\n end", "def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end", "def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end", "def show\n @review = Review.find(params[:id])\n render json: @review\n end", "def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end", "def show\n @training = Training.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training }\n end\n end", "def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end", "def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end", "def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def set_practitioner_profile\n @practitioner_profile = PractitionerProfile.find(params[:id])\n end", "def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end", "def show\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optin_contestant }\n end\n end", "def show\n render json: {teacher: @course.teacher, course: @course, categories: @course.categories, training_sessions: @course.training_sessions}\n end", "def show\n @annex1_project_participant = Annex1ProjectParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annex1_project_participant }\n end\n end", "def show\n render status: 200, json: Training.find(params[:id])\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def show\n @competitor = Competitor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competitor }\n end\n end", "def show\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_c }\n end\n end", "def set_practitioner_profession\n @practitioner_profession = PractitionerProfession.find(params[:id])\n end" ]
[ "0.69858426", "0.6791103", "0.6791103", "0.6753636", "0.6624337", "0.6498484", "0.6352189", "0.62798154", "0.62798154", "0.6258256", "0.6213024", "0.6201559", "0.61860955", "0.61835057", "0.6173803", "0.6146138", "0.6146138", "0.61447597", "0.60932773", "0.6086389", "0.6076834", "0.6059785", "0.6045349", "0.6041483", "0.60209566", "0.6018035", "0.6003057", "0.6001073", "0.5977329", "0.5972957", "0.5969006", "0.59652823", "0.59565824", "0.5955459", "0.595289", "0.59514725", "0.5930211", "0.5927206", "0.59269744", "0.592599", "0.5919547", "0.5896119", "0.58930063", "0.58897036", "0.58777857", "0.5877785", "0.5875524", "0.5875349", "0.5872487", "0.5866089", "0.5857209", "0.5850013", "0.5847548", "0.58453125", "0.5844684", "0.5844037", "0.58390903", "0.583883", "0.58305645", "0.5830401", "0.5827636", "0.58147603", "0.58147603", "0.58053404", "0.5800957", "0.5799767", "0.57951355", "0.57861847", "0.57796717", "0.5776574", "0.5776205", "0.5767206", "0.57659245", "0.57634133", "0.5760621", "0.5760455", "0.57549775", "0.5746018", "0.57449734", "0.57428527", "0.57361376", "0.5733068", "0.5730771", "0.57296497", "0.5729311", "0.571487", "0.57144237", "0.5713263", "0.5713263", "0.57110864", "0.57110864", "0.57101154", "0.5701471", "0.57004446", "0.5700315", "0.5699787", "0.5694246", "0.5693958", "0.56924844", "0.5692199", "0.5685774" ]
0.0
-1
POST /practitioners POST /practitioners.json
def create @practitioner = Practitioner.new(practitioner_params) respond_to do |format| if @practitioner.save format.html { redirect_to @practitioner, notice: 'Practitioner was successfully created.' } format.json { render :show, status: :created, location: @practitioner } else format.html { render :new } format.json { render json: @practitioner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def practitioner_params\n params.require(:practitioner).permit(:name, :description)\n end", "def create\n @practitioner_type = PractitionerType.new(params[:practitioner_type])\n\n respond_to do |format|\n if @practitioner_type.save\n format.html { redirect_to @practitioner_type, :notice => 'Practitioner type was successfully created.' }\n format.json { render :json => @practitioner_type, :status => :created, :location => @practitioner_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @practitioner_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @practice = Practice.new(params[:practice])\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to @practice, notice: 'Practice was successfully created.' }\n format.json { render json: @practice, status: :created, location: @practice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practice = Practice.new(practice_params)\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to @practice, notice: 'Practice was successfully created.' }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practitioner_role = PractitionerRole.new(practitioner_role_params)\n\n respond_to do |format|\n if @practitioner_role.save\n format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' }\n format.json { render :show, status: :created, location: @practitioner_role }\n else\n format.html { render :new }\n format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def practitioner_params\n params.require(:practitioner).permit(:name, :phone, :email, :registration, :address, :fax, :location, :signature)\n end", "def create\n @practice = Practice.new(practice_params)\n\n\n respond_to do |format|\n if @practice.save\n\n @practice.team_season.players.each do |pp|\n player_practice = PlayerPractice.new\n player_practice.player = pp\n player_practice.practice = @practice\n player_practice.save\n end\n\n format.html { redirect_to @practice, notice: 'Practice was successfully created.' }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practice = Practice.new(practice_params)\n if params[:recruiter_partner].present?\n @partner = Partner.find(params[:recruiter_partner])\n @practice.partners << @partner\n end\n\n @practice.site_id = @current_partner.site.id\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to partner_path(current_partner), notice: 'Practice was successfully created.' }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutoring = @homework.tutorings.new(tutoring_params)\n\n respond_to do |format|\n if @tutoring.save\n format.html { redirect_to tutorings_path, notice: 'Ha acceptado el encargo.' }\n format.json { render :show, status: :created, location: @tutoring }\n else\n format.html { render :new }\n format.json { render json: @tutoring.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @researcher = Researcher.new(params[:researcher])\n\n respond_to do |format|\n if @researcher.save\n format.html { redirect_to @researcher, notice: 'Researcher was successfully created.' }\n format.json { render json: @researcher, status: :created, location: @researcher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @researcher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:user_id] && params[:recruiter_id] && params[:review]\n user = User.find(params[:user_id])\n # puts user\n recruiter = Recruiter.find(params[:recruiter_id])\n # puts recruiter\n ################################\n params[\"got_interview\"] ? got_interview = params[\"got_interview\"] : got_interview = false\n params[\"got_job\"] ? got_job = params[\"got_job\"] : got_job = false\n got_job ? got_interview = true : \"null\" #if got job then must have had interview\n params[\"rating\"] ? rating = params[\"rating\"] : rating = 0 #0 means not rated\n params[\"recommended\"] ? recommended = params[\"recommended\"] : recommended = false\n params[\"ghoster\"] ? ghoster = params[\"ghoster\"] : ghoster = false\n # puts \"*********$\"\n # puts params\n # puts recommended\n # puts params[:recommended]\n # puts \"***************$\"\n review = Review.new(\n user_id: user.id,\n recruiter_id: recruiter.id,\n review: params[\"review\"],\n got_interview: got_interview,\n got_job: got_job,\n rating: rating,\n recommended: recommended,\n ghoster: ghoster\n ) #Review.new\n\n if review.save\n render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"ERROR SAVE POSTED REVIEW\"}\n end\n ################################\n # render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"no user_id or recruiter_id or review\"}\n end # if params[:user_id]\n end", "def create\n professor = Professor.new(professor_params)\n \n if professor.save\n render json: professor.to_json(include: :courses)\n else\n render :json => { :errors => professor.errors }, :status => 422\n end\n end", "def new\n @practitioner_type = PractitionerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @practitioner_type }\n end\n end", "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def generate_practitioners\n PDEX::NPPESDataRepo.practitioners.each do |nppes_data|\n PDEX::PractitionerGenerator.new(nppes_data).generate.each do |resource|\n write_resource(resource)\n end\n end\n end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def create\n @practitioner_profile = PractitionerProfile.new(practitioner_profile_params)\n @practitioner_profile.user_id = current_user.id\n\n respond_to do |format|\n if @practitioner_profile.save\n format.html { redirect_to dashboard_index_path, notice: 'Practitioner profile was successfully created.' }\n format.json { render :show, status: :created, location: @practitioner_profile }\n else\n format.html { render :new }\n format.json { render json: @practitioner_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practice = Practice.new(practice_params)\n\n if @practice.name == nil or @practice.name == \"\"\n @practice.name = @practice.default_name\n end\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to executive_practices_path }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(params.require(:teacher).permit(:name, :email, :address, :discipline, :phone))\n #redirect_to '/teachers'\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @recruiter = Recruiter.find_or_initialize_by(id: params[:recruiter_id])\n @interview = Interview.new(interview_params)\n @recruiters = Recruiter.all\n\n respond_to do |format|\n if @interview.save\n format.html { redirect_to interviews_path, notice: 'Interview was successfully created.' }\n format.json { render :show, status: :created, location: @interview }\n else\n format.html { render :new }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lecturer = Lecturer.new(lecturer_params)\n\n respond_to do |format|\n if @lecturer.save\n format.html { redirect_to @lecturer, notice: \"Lecturer was successfully created.\" }\n format.json { render :show, status: :created, location: @lecturer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @lecturer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @personal_training = PersonalTraining.new(personal_training_params)\n\n respond_to do |format|\n if @personal_training.save\n format.html { redirect_to @personal_training, notice: 'Personal training was successfully created.' }\n format.json { render :show, status: :created, location: @personal_training }\n else\n format.html { render :new }\n format.json { render json: @personal_training.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pre_training_review = PreTrainingReview.new(pre_training_review_params)\n\n respond_to do |format|\n if @pre_training_review.save\n # format.html { redirect_to @pre_training_review, notice: 'Pre training review was successfully created.' }\n format.html {redirect_to new_enrolment_path, notice: 'Pre training review is complete.'}\n format.json { render :show, status: :created, location: @pre_training_review }\n else\n format.html { render :new }\n format.json { render json: @pre_training_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def create\n @recruiter = Recruiter.new(recruiter_params)\n\n if @recruiter.save\n render_json_message({:success => t('.success')}, 201, {id: @recruiter.id})\n else\n render_json_message({:errors => @recruiter.errors.messages}, 422)\n end\n\n end", "def create\n @petition_review_member = PetitionReviewMember.new(petition_review_member_params)\n\n respond_to do |format|\n if @petition_review_member.save\n format.html { redirect_to petition_review_members_path, notice: 'Petition review member was successfully created.' }\n format.json { render :show, status: :created, location: @petition_review_member }\n else\n format.html { render :new }\n format.json { render json: @petition_review_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @participant_rating = ParticipantRating.new(params[:participant_rating])\n @participant_rating.participant_id = @participant.id\n\n\n respond_to do |format|\n if @participant_rating.save\n format.html { redirect_to(new_participant_question_set1_path(@participant.id))}\n format.json { render json: @participant_rating, status: :created, location: @participant_rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutor = Tutor.new(params[:tutor])\n\n respond_to do |format|\n if @tutor.save\n format.html { redirect_to @tutor, notice: 'Tutor was successfully created.' }\n format.json { render json: @tutor, status: :created, location: @tutor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end", "def create\n @info_practice = InfoPractice.new(info_practice_params)\n\n respond_to do |format|\n if @info_practice.save\n format.html { redirect_to info_practices_url, notice: 'Info practice was successfully created.' }\n format.json { render :show, status: :created, location: @info_practice }\n else\n format.html { render :new }\n format.json { render json: @info_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:id]\n begin\n check_admin\n course = Course.find(params[:course_id])\n teacher = User.find(params[:id])\n course.teachers << teacher\n if course.save\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n else\n json_failed(REASON_NOT_IMPLEMENTED)\n end\n end", "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def new\n @practice = Practice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @practice }\n end\n end", "def demonstrator_params\n params.require(:demonstrator).permit(:sam_demonstrator_id, :practical_id)\n end", "def create\n @tutor = Tutor.new(tutor_params)\n\n respond_to do |format|\n if @tutor.save\n format.html { redirect_to @tutor, notice: 'Tutor was successfully created.' }\n format.json { render :show, status: :created, location: @tutor }\n else\n format.html { render :new }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.new(params[:practice])\n @practice.team = @team\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to team_workout_practices_path(@team, @workout), notice: 'Practice was successfully created.' }\n format.json { render json: @practice, status: :created, location: @practice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_interview = Interview.new(params[:interview])\n\n respond_to do |format|\n if @admin_interview.save\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista criada com sucesso.' }\n format.json { render json: [:admin, @admin_interview], status: :created, location: @admin_interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end", "def create\n @teamrider = Teamrider.new(teamrider_params)\n\n respond_to do |format|\n if @teamrider.save\n format.html { redirect_to @teamrider, notice: 'Teamrider was successfully created.' }\n format.json { render :show, status: :created, location: @teamrider }\n else\n format.html { render :new }\n format.json { render json: @teamrider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @petition = Petition.new(params[:petition])\n\n respond_to do |format|\n if @petition.save\n format.html { redirect_to @petition, notice: 'Petition was successfully created.' }\n format.json { render json: @petition, status: :created, location: @petition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end", "def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def create\n @petition = Petition.new(petition_params)\n\n respond_to do |format|\n if @petition.save\n format.html { redirect_to @petition, notice: 'Petition was successfully created.' }\n format.json { render :show, status: :created, location: @petition }\n else\n format.html { render :new }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @exercice = Exercice.new(params[:exercice])\n\n respond_to do |format|\n if @exercice.save\n format.html { redirect_to @exercice, notice: 'Exercice was successfully created.' }\n format.json { render json: @exercice, status: :created, location: @exercice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n case\n when params[:teacher_id]\n course_create_params = params.require(:course).permit(:name, :description, :semester_id)\n check_token(params[:teacher_id], params[:token], true)\n teacher = User.find(params[:teacher_id])\n course = Course.create(course_create_params)\n if teacher.teaching_courses.create(course_id: course.id)\n json_successful(id: course.id)\n else\n json_failed\n end\n when params[:assistant_id] && params[:id]\n check_token(params[:assistant_id])\n if Participation.create(user_id: params[:assistant_id],\n course_id: params[:id], role: ROLE_ASSISTANT).valid?\n json_successful\n else\n json_failed\n end\n when params[:student_id] && params[:id]\n check_token(params[:student_id])\n if Participation.create(user_id: params[:student_id],\n course_id: params[:id], role: ROLE_STUDENT).valid?\n json_successful\n else\n json_failed\n end\n else\n json_failed(REASON_INVALID_OPERATION)\n end\n rescue\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n end", "def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n \n respond_to do |format|\n if @teacher.save\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schooldef = ['FGV', 'other']\n @professor = Professor.new(professor_params)\n @review = Review.new\n respond_to do |format|\n if verify_recaptcha(model: @professor) && @professor.save\n format.html { redirect_to controller: 'reviews', action: 'new', professor_id: @professor.id, notice: 'O professor foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @professor }\n else\n format.html { render :edit, notice: 'Por favor, preencha o captcha.' }\n format.json { render json: @professor.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @practitioners = Practitioner.paginate(page: params[:page])\n end", "def create\n @schedule_practice = SchedulePractice.new(schedule_practice_params)\n\n respond_to do |format|\n if @schedule_practice.save\n format.html { redirect_to @schedule_practice, notice: 'Schedule practice was successfully created.' }\n format.json { render :show, status: :created, location: @schedule_practice }\n else\n format.html { render :new }\n format.json { render json: @schedule_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @petition = Petition.new(petition_params)\n\n if @petition.save\n render json: @petition, status: :created,\n location: api_v1_petition_path(@petition)\n else\n render_validation_errors @petition.errors\n end\n end", "def create\n teacher = Teacher.new(teacher_params)\n if teacher.save\n render json: {status: 'SUCCESS', message: 'Teacher has been saved.', data: teacher}, include:'school', status: :ok\n else\n render json: {status: 'ERROR', message: 'Teacher has not been saved.', data: teacher.errors}, status: :unprocessable_entity\n end\n end", "def create\n \"\"\"\n on save of researcher form, send the researcher's email \n and their current question number (0) to the researcher\n rankings controller\n \"\"\"\n @researcher = Researcher.new(researcher_params)\n\n respond_to do |format|\n\n if @researcher.save\n format.html { redirect_to controller: 'instruction', action: 'show', email: @researcher.email }\n\n format.json { render action: 'show', status: :created, location: @researcher }\n else\n format.html { render action: 'new' }\n format.json { render json: @researcher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end", "def create\n @petition = Petition.new(petition_params)\n @petition.citizen = current_citizen\n\n respond_to do |format|\n if @petition.save\n current_user.likes @petition\n format.html { redirect_to @petition, notice: 'Petition was submitted.' }\n format.json { render :show, status: :created, location: @petition }\n else\n format.html { render :new }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end", "def destroy\n @practitioner.destroy\n respond_to do |format|\n format.html { redirect_to practitioners_url, notice: 'Practitioner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n final_set = []\n params['doctors_review'].permit!\n doctors_id = params['doctors_review']['doctors_id']\n specialties_id = DoctorsSpecialty.where(doctors_id: doctors_id).first\n .specialties_id\n specialty = Specialty.find(specialties_id)\n unless specialties_id.nil?\n params['doctors_review']['specialties_id'] = specialties_id\n end\n @doctors_reviews = DoctorsReview.new(params['doctors_review'])\n if @doctors_reviews.save\n rating = params['doctors_review']['rating']\n unless rating.nil?\n all_reviews = DoctorsReview.where(specialties_id: specialties_id)\n .where('rating >= ?', rating).order('rating')\n all_reviews&.each do |review|\n doctor = Doctor.find(review['doctors_id'])\n recommendations = { specialty: specialty.name,\n doctor: doctor.name,\n rating: review.rating,\n comments: review.comments\n }\n final_set << recommendations\n end\n end\n final_set\n else\n @doctors_reviews.errors.full_messages\n end\n end", "def create\n respond_to do |format|\n if petitioner.save\n format.html { redirect_to candidate_petitioners_url( petitioner.candidate ), flash: { success: 'Petitioner created.' } }\n format.xml { render xml: petitioner, status: :created, location: petitioner }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: petitioner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @techers_assignment = TechersAssignment.new(techers_assignment_params)\n\n respond_to do |format|\n if @techers_assignment.save\n format.html { redirect_to @techers_assignment, notice: 'Techers assignment was successfully created.' }\n format.json { render :show, status: :created, location: @techers_assignment }\n else\n format.html { render :new }\n format.json { render json: @techers_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @employer_study.save\n format.html { redirect_to @employer_study, notice: t2('create.notice') }\n format.json { render json: @employer_study, status: :created, location: @employer_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employer_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assigner = Assigner.new(assigner_params)\n\n respond_to do |format|\n if @assigner.save\n format.html { redirect_to @assigner, notice: 'Assigner was successfully created.' }\n format.json { render :show, status: :created, location: @assigner }\n else\n format.html { render :new }\n format.json { render json: @assigner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t\tquiz = Quiz.new(quiz_params)\n\t\t\tif quiz.save\n\t\t\t\tcurrent_instructor.quizzes << quiz\n\t\t\t\trender json: { id: quiz.id }, status: 201\n\t\t\telse\n\t\t\t\trender json: { error: quiz.errors }, status: 422\n\t\t\tend\n\t\tend", "def practice_params\n params.require(:practice).permit(:date, :location, :has_happened, :team_id)\n end", "def create\n @practice = Practice.new(practice_params)\n @lessons = current_user.lessons.select(:id,:name)\n @lesson = Lesson.find(practice_params[\"lesson_id\"])\n @practice.category = @lesson.category\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to new_question_path(practice_id: @practice.id), notice: 'Practice was successfully created.' }\n format.json { render :show, status: :created, location: @practice }\n else\n format.html { render :new }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee_reviewer = EmployeeReviewer.new(employee_reviewer_params)\n\n respond_to do |format|\n if @employee_reviewer.save\n format.html { redirect_to employee_reviewers_url, notice: 'Employee reviewer was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reviewer }\n else\n format.html { render :new }\n format.json { render json: @employee_reviewer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reviewer = Reviewer.new(params[:reviewer])\n\n respond_to do |format|\n if @reviewer.save\n format.html { redirect_to @reviewer, notice: 'Reviewer was successfully created.' }\n format.json { render json: @reviewer, status: :created, location: @reviewer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reviewer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n if !params[:course_id].blank? && !params[:professor_id].blank?\n @review.course_id = params[:course_id]\n @review.professor_id = params[:professor_id]\n @review.authuser_id = current_user.id\n respond_to do |format|\n if @review.save\n format.html do\n redirect_to professor_course_path(\n @review.professor_id,\n @review.course_id\n ),\n notice: 'Your review was submitted'\n end\n format.json { render :show, status: :created, location: @review }\n else\n @professors = load_professors\n @courses = load_courses\n format.html { render :new }\n format.json do\n render json: @review.errors, status: :unprocessable_entity\n end\n end\n end\n else\n redirect_to new_review_path, notice: 'Fill out all required fields'\n end\n end", "def create\n @recruiter = current_user\n @posting = @recruiter.recruiter_postings.build(posting_params)\n puts \"posting #{@posting.inspect}\"\n # fail\n respond_to do |format|\n if @posting.save \n format.html { redirect_to @posting, notice: 'Posting was successfully created.' }\n format.json { render :show, status: :created, location: @posting }\n else\n format.html { render :new }\n format.json { render json: @posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @critic_review = CriticReview.new(critic_review_params)\n\n respond_to do |format|\n if @critic_review.save\n format.html { redirect_to @critic_review, notice: 'Critic review was successfully created.' }\n format.json { render :show, status: :created, location: @critic_review }\n else\n format.html { render :new }\n format.json { render json: @critic_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_practices()\n\t\t@@practices[:mail] = create_mail_practice()\n\t\t@@practices[:none] = create_none_practice()\n\t\t@@practices[:fax] = create_fax_practice()\n\t\t#@practices[:athena] = create_athena_practice()\n\tend", "def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to [:admin, @teacher], :notice => 'Teacher was successfully created.' }\n format.json { render :json => @teacher, :status => :created, :location => @teacher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n return\n teacher = Teacher.find_by_name(params[:teacher])\n user = User.new(:username => params[:username])\n\n teacher.users << user\n \n user.record_exam(params)\n\n respond_to do |format|\n format.html { render :status => 200, :text => 'done' }\n end\n end", "def create\n #binding.pry\n review = Review.new(review_params) \n if review.save\n render json: ReviewSerializer.new(review)\n else\n render json: {errors: review.errors.full_messages}\n end\n end", "def create\n @pr_committee = PrCommittee.new(pr_committee_params)\n respond_to do |format|\n if @pr_committee.save\n format.html { redirect_to @pr_committee.petition, notice: 'Petition Review committee was successfully created.' }\n format.json { render :show, status: :created, location: @pr_committee }\n else\n format.html { render :new }\n format.json { render json: @pr_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @training = Training.new(training_params)\n respond_to do |format|\n if @training.save\n format.html { redirect_to team_training_path(@team, @training), notice: 'Training was successfully created.' }\n format.json { render :show, status: :created, location: @training }\n else\n format.html { render :new }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end", "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end", "def create\n @exercise = Exercise.all.map{ |c| [c.name, c.id]}\n @training = Training.new(training_params)\n\n respond_to do |format|\n if @training.save\n format.html { redirect_to @training, notice: 'Training was successfully created.' }\n format.json { render :show, status: :created, location: @training }\n else\n format.html { render :new }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end", "def practice_params\n params[:practice].permit(:name, :address, :phone, :url,\n :primary_care, :email, :parent_organization,\n :prac_ehr_yr, :prac_ehr, :prac_ehrname, :prac_ehrversion,\n :prac_ehrname_other, :prac_ehr_mu, :prac_mu_stage1, :prac_mu_stage2,\n :prac_ehr_extractdata, :prac_ehr_person_extractdata,\n :prac_ehr_person_extractdata_other, :prac_it_support,\n :prac_ehr_vendor, :prac_share_healthinfo, :prac_cqm,\n :prac_cqm_submit, :prac_cqm_who, :prac_ehr_satisfaction,\n :prac_new_ehr, :elig_phys_count, :elig_phys_fte,\n :number_clinicians, :fte_clinicians,\n :prac_own_other_specify, :prac_own_yrs,\n :elig_clinic_count, :prac_spec_mix, :prac_pcmh,\n :prac_aco_join_medicaid, :interest_why, :interest_expect,\n :interest_challenge, :recruitment_source, :recruitment_source_referral,\n :prac_ehr_mu_yr, :interest_yn, :interest_why_not, :interest_why_not_other,\n :interest_contact_month, :prac_state, :site_id, :prac_own_clinician,\n :prac_own_hosp, :prac_own_hmo, :prac_own_fqhc, :prac_own_nonfed, :prac_own_academic,\n :prac_own_fed, :prac_own_rural, :prac_own_ihs, :prac_own_other,\n :prac_aco_medicaid, :prac_aco_medicare, :prac_aco_commercial,\n :prac_aco_other, :prac_aco_none, :prac_aco_dk,\n :prac_aco_join_medicare, :prac_aco_join_commercial,\n :zip_code, :city, :residency_training_site, :eligibility_exception,\n personnels_attributes: [:id, :_destroy, :name, :role, :role_other, :phone1,\n :phone1_best, :phone2, :phone2_best, :email1, :email1_best,\n :email2, :email2_best, :ehr_extractor, :ehr_helper, :ehr_cqm,\n :site_contact_primary, :site_contact_secondary, :site_contact_champion])\n end", "def create\n @responder = Responder.new(params[:responder])\n\n respond_to do |format|\n if @responder.save\n format.html { redirect_to @responder, :notice => 'Responder was successfully created.' }\n format.json { render :json => @responder, :status => :created, :location => @responder }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pt_trainer = Pt::Trainer.new(pt_trainer_params)\n\n respond_to do |format|\n if @pt_trainer.save\n format.html { redirect_to @pt_trainer, notice: 'Trainer was successfully created.' }\n format.json { render :show, status: :created, location: @pt_trainer }\n else\n format.html { render :new }\n format.json { render json: @pt_trainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @learner = Learner.new(learner_params)\n\n respond_to do |format|\n if @learner.save\n format.html { head :created, content_type: \"text/html\" }\n format.json { head :created, location: @order }\n else\n format.html { head :bad_request, content_type: \"text/html\" }\n format.json { head :bad_request }\n end\n end\n end", "def create\n @tester = Tester.new(params[:tester])\n \n\n respond_to do |format|\n if @tester.save\n tester = @tester\n session[:tester_id] = tester.id\n format.html { redirect_to @tester, notice: 'Tester was successfully created.' }\n format.json { render json: @tester, status: :created, location: @tester }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def practice_params\n params.require(:practice).permit(:practice_date, :observations, :team_season_id)\n end", "def create\n @interview = Interview.new(params[:interview])\n @routine_interview = RoutineInterview.new(params[:routine_interview])\n @routine_interview.interview = @interview\n\n respond_to do |format|\n if @routine_interview.save\n format.html { redirect_to @routine_interview, notice: 'Followup interview was successfully created.' }\n format.json { render json: @routine_interview, status: :created, location: @routine_interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: @routine_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcher }\n end\n end" ]
[ "0.65139526", "0.6278431", "0.62691057", "0.62454134", "0.6224758", "0.61928886", "0.6185542", "0.6185398", "0.6178266", "0.60633326", "0.6053146", "0.60506445", "0.5919848", "0.5906567", "0.58720607", "0.58642817", "0.5858906", "0.5850141", "0.5836924", "0.57995397", "0.5793223", "0.57848704", "0.57696205", "0.57693535", "0.57432306", "0.574016", "0.574016", "0.5734368", "0.57162803", "0.5710447", "0.57068634", "0.5684297", "0.56620646", "0.56493086", "0.5648377", "0.56477964", "0.5639738", "0.5637596", "0.56337726", "0.56337726", "0.5632581", "0.5630974", "0.5608883", "0.56074756", "0.55921376", "0.55917025", "0.5591645", "0.5587894", "0.5585617", "0.5583517", "0.5583517", "0.5583517", "0.5581961", "0.55808496", "0.5580004", "0.5580004", "0.55631274", "0.55615103", "0.55594033", "0.5559229", "0.5550307", "0.5534559", "0.55343664", "0.55279046", "0.55270183", "0.5525181", "0.55200535", "0.55116975", "0.55045295", "0.5503097", "0.54983276", "0.549816", "0.5496456", "0.548917", "0.54827744", "0.5481302", "0.5473823", "0.5473823", "0.54734325", "0.5473325", "0.54697376", "0.54614943", "0.54552126", "0.5453975", "0.54497385", "0.5448626", "0.5448461", "0.54456943", "0.54436034", "0.5442978", "0.5440076", "0.5438842", "0.5431144", "0.54274464", "0.5426306", "0.5424378", "0.5417774", "0.5414834", "0.5413742", "0.5411771" ]
0.7080237
0
PATCH/PUT /practitioners/1 PATCH/PUT /practitioners/1.json
def update respond_to do |format| if @practitioner.update(practitioner_params) format.html { redirect_to @practitioner, notice: 'Practitioner was successfully updated.' } format.json { render :show, status: :ok, location: @practitioner } else format.html { render :edit } format.json { render json: @practitioner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n # Delete the currently associated partner\n if params[:original_recruiter].present?\n delete_sql = \"DELETE FROM partners_practices WHERE \" +\n \"partner_id = #{params[:original_recruiter]} AND practice_id = #{@practice.id};\"\n ActiveRecord::Base.connection.execute delete_sql\n end\n # Add the new associated partner (if any)\n if params[:recruiter_partner].present?\n insert_sql = \"INSERT INTO partners_practices (partner_id, practice_id) \" +\n \"VALUES (#{params[:recruiter_partner]}, #{@practice.id});\"\n ActiveRecord::Base.connection.execute insert_sql\n end\n format.html { redirect_to partner_path(current_partner), notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @practitioner_type = PractitionerType.find(params[:id])\n\n respond_to do |format|\n if @practitioner_type.update_attributes(params[:practitioner_type])\n format.html { redirect_to @practitioner_type, :notice => 'Practitioner type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @practitioner_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @practice.assign_attributes(practice_params)\n\n if @practice.name == nil or @practice.name == \"\"\n @practice.name = @practice.default_name\n end\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to executive_practices_path }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to new_question_path(practice_id: @practice.id), notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practitioner_role.update(practitioner_role_params)\n format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' }\n format.json { render :show, status: :ok, location: @practitioner_role }\n else\n format.html { render :edit }\n format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to team_workout_practices_path(@team, @workout), notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n if @researcher.update_attributes(params[:researcher])\n format.html { redirect_to @researcher, notice: 'Researcher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @researcher.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n debugger\n if @best_practice.update(best_practice_params)\n format.html { redirect_to @best_practice, notice: 'Best practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @best_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practitioner_profile.update(practitioner_profile_params)\n format.html { redirect_to dashboard_index_path, notice: 'Practitioner profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @practitioner_profile }\n else\n format.html { render :edit }\n format.json { render json: @practitioner_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info_practice.update(info_practice_params)\n format.html { redirect_to info_practices_url, notice: 'Info practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_practice }\n else\n format.html { render :edit }\n format.json { render json: @info_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @routine_interview = RoutineInterview.find(params[:id])\n @interview = Interview.find(@routine_interview.interview_id)\n\n respond_to do |format|\n if @routine_interview.update_attributes(params[:routine_interview]) && @interview.update_attributes(params[:interview])\n format.html { redirect_to @routine_interview, notice: 'Followup interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercice = Exercice.find(params[:id])\n\n respond_to do |format|\n if @exercice.update_attributes(params[:exercice])\n format.html { redirect_to @exercice, notice: 'Exercice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end", "def update\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n if @collaborator.update_attributes(params[:collaborator])\n format.html { redirect_to @collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n if @employer.update_attributes(params[:employer])\n format.html { redirect_to @employer, :flash => {notice: 'Employer was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @participation = Participation.find(params[:id])\n\n respond_to do |format|\n if @participation.update_attributes(params[:participation])\n format.html { redirect_to volunteer_participation_url(current_user, @participation), notice: 'Participation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule_practice.update(schedule_practice_params)\n format.html { redirect_to @schedule_practice, notice: 'Schedule practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule_practice }\n else\n format.html { render :edit }\n format.json { render json: @schedule_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @admin_interview.update_attributes(params[:interview])\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista atualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end", "def update\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n if @teacher.update(params.require(:teacher).permit(:name, :email, :address, :discipline, :phone))\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_url, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tutor = Tutor.find(params[:id])\n params[:tutor].delete :user_id\n params[:tutor].delete :approved\n respond_to do |format|\n if @tutor.update_attributes(params[:tutor])\n format.html { redirect_to @tutor, notice: 'Tutor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @programme_exercise.update(programme_exercise_params)\n format.html { redirect_to @programme_exercise, notice: 'Programme exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @programme_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n if @recruiter.update_attributes(params[:recruiter])\n format.html { redirect_to @recruiter, notice: 'Recruiter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n if @recommender.update_attributes(params[:recommender])\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @personal_training.update(personal_training_params)\n format.html { redirect_to @personal_training, notice: 'Personal training was successfully updated.' }\n format.json { render :show, status: :ok, location: @personal_training }\n else\n format.html { render :edit }\n format.json { render json: @personal_training.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @research_appointment = ResearchAppointment.find(params[:id])\n\n respond_to do |format|\n if @research_appointment.update_attributes(params[:research_appointment])\n format.html { redirect_to @research_appointment, notice: 'Research appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n if @apprentice.update_attributes(params[:apprentice])\n format.html { redirect_to @apprentice, notice: 'Apprentice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apprentice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to restaurent_path(@restaurent.id), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n if @petition.update_attributes(params[:petition])\n format.html { redirect_to @petition, notice: 'Petition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @adopter = Adopter.find(params[:id])\n\n if @adopter.update(adopter_params)\n head :no_content\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def update\n if @recruiter.update(recruiter_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @recruiter.errors.messages}, 422)\n end\n end", "def update\n @instructor1 = Instructor1.find(params[:id])\n\n respond_to do |format|\n if @instructor1.update_attributes(params[:instructor1])\n format.html { redirect_to @instructor1, notice: 'Instructor1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @fake_professional.update(fake_professional_params)\n format.html { redirect_to @fake_professional, notice: 'Fake professional was successfully updated.' }\n format.json { render :show, status: :ok, location: @fake_professional }\n else\n format.html { render :edit }\n format.json { render json: @fake_professional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @faculty.update(faculty_params)\n head :no_content\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n if @judgement.update_attributes(params[:judgement])\n format.html { redirect_to @judgement, notice: 'Judgement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n if @researcher.update_attributes(params[:researcher])\n format.html { redirect_to(researchers_url, :notice => 'Researcher was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @researcher.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @volunteer = Volunteer.find(params[:id])\n\n respond_to do |format|\n if @volunteer.update_attributes(params[:volunteer])\n format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_path, notice: 'Interview was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview }\n else\n format.html { render :edit }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @learner.update(learner_params)\n format.html { redirect_to @learner, notice: 'Learner was successfully updated.' }\n format.json { head :ok, location: @learner }\n else\n format.html { render :edit }\n format.json { render json: @learner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recital.update(recital_params)\n format.html { redirect_to @recital, notice: 'Recital was successfully updated.' }\n format.json { render :show, status: :ok, location: @recital }\n else\n format.html { render :edit }\n format.json { render json: @recital.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @research = Research.find(params[:id])\n\n respond_to do |format|\n if @research.update_attributes(params[:research])\n format.html { redirect_to @research, notice: 'Research was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @farm_practice_typology.update(farm_practice_typology_params)\n format.html { redirect_to @farm_practice_typology, notice: 'Farm practice typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farm_practice_typology.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @leadership.update(leadership_params)\n format.html { redirect_to @leadership, notice: 'Leadership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leadership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n if @reviewer.update_attributes(params[:reviewer])\n format.html { redirect_to @reviewer, notice: 'Reviewer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reviewer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @volunteer.update(volunteer_params)\n format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n # TODO: add push notification here\n pending_request = PendingTutorRequest.find(params[:id])\n accepted_request = AcceptedTutorRequest\n .create(pending_request.as_json(only: [:tutor_subject_id, :student_id, :tutor_id]))\n pending_request.destroy\n json_response(accepted_request, :ok)\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @performed_exercise.update(performed_exercise_params)\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @performed_exercise }\n else\n format.html { render :edit }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.lecture, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review.lecture }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @employer.update(employer_params)\n format.html { redirect_to @employer, notice: 'Employer was successfully updated.' }\n format.json { render :show, status: :ok, location: @employer }\n else\n format.html { render :edit }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n @interview.activify\n format.html { redirect_to '/teacher_applications', notice: 'Interview details have been updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.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 @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n if @admin_collaborator.update_attributes(params[:admin_collaborator])\n format.html { redirect_to @admin_collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_collaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @optician = Optician.find(params[:id])\n\n respond_to do |format|\n if @optician.update_attributes(params[:optician])\n format.html { redirect_to @optician, notice: 'Optician was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optician.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def set_practitioner\n @practitioner = Practitioner.find(params[:id])\n end", "def update\n respond_to do |format|\n if @pr_committee.update(pr_committee_params)\n format.html { redirect_to @pr_committee.petition, notice: 'Petition Review committee was successfully updated.' }\n format.json { render :show, status: :ok, location: @pr_committee }\n else\n format.html { render :edit }\n format.json { render json: @pr_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.67615384", "0.67583185", "0.6685504", "0.6667822", "0.6667592", "0.6585007", "0.6544552", "0.6529318", "0.6356153", "0.63487786", "0.63487786", "0.6326776", "0.62937963", "0.62401474", "0.6216254", "0.6213003", "0.6213003", "0.6178898", "0.61749166", "0.6171659", "0.6165178", "0.61567205", "0.61562794", "0.61521494", "0.612335", "0.6112275", "0.6109679", "0.6100729", "0.6098657", "0.6089052", "0.60877925", "0.6081348", "0.6063547", "0.6051753", "0.6039368", "0.6031033", "0.60182095", "0.6014664", "0.6008209", "0.59986204", "0.59889483", "0.59808594", "0.5973297", "0.5968058", "0.59585375", "0.59558105", "0.5955202", "0.59428203", "0.59416795", "0.5940912", "0.5940382", "0.5939588", "0.59392554", "0.5939119", "0.5938508", "0.593395", "0.59308827", "0.59291023", "0.59265125", "0.5920932", "0.59181994", "0.59180176", "0.5914763", "0.5914763", "0.5907862", "0.5905684", "0.59030795", "0.5902549", "0.5897064", "0.58969206", "0.58956105", "0.58947694", "0.5894267", "0.5886097", "0.58853275", "0.58844835", "0.5884159", "0.58799", "0.5874081", "0.58715934", "0.58657193", "0.5864117", "0.5858963", "0.5856497", "0.58550835", "0.5853139", "0.5853139", "0.58499074", "0.58483064", "0.58480275", "0.5844141", "0.58435416", "0.58404297", "0.58403414", "0.58372813", "0.58359414", "0.58320117", "0.58320117", "0.5830738", "0.5830298" ]
0.70598936
0
DELETE /practitioners/1 DELETE /practitioners/1.json
def destroy @practitioner.destroy respond_to do |format| format.html { redirect_to practitioners_url, notice: 'Practitioner was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @practitioner_type = PractitionerType.find(params[:id])\n @practitioner_type.destroy\n\n respond_to do |format|\n format.html { redirect_to practitioner_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice = Practice.find(params[:id])\n @practice.destroy\n\n respond_to do |format|\n format.html { redirect_to practices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice = Practice.find(params[:id])\n @practice.destroy\n\n respond_to do |format|\n format.html { redirect_to practices_url }\n format.json { head :ok }\n end\n end", "def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url, notice: 'Practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url, notice: 'Practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url, notice: 'Practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercice = Exercice.find(params[:id])\n @exercice.destroy\n\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice.destroy\n \n respond_to do |format|\n format.html { redirect_to \"/practices/category/all\", notice: 'Practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @researcher = Researcher.find(params[:id])\n @researcher.destroy\n\n respond_to do |format|\n format.html { redirect_to researchers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @best_practice.destroy\n respond_to do |format|\n format.html { redirect_to best_practices_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @practitioner_role.destroy\n respond_to do |format|\n format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @practitioner_profile.destroy\n respond_to do |format|\n format.html { redirect_to practitioner_profiles_url, notice: 'Practitioner profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_interview = Interview.find(params[:id])\n @admin_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recruiter = Recruiter.find(params[:id])\n @recruiter.destroy\n\n respond_to do |format|\n format.html { redirect_to recruiters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @demonstrator.destroy\n respond_to do |format|\n format.html { redirect_to demonstrators_url, notice: 'Demonstrator was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview = Interview.find(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: \"Interview #{@interview.name} deleted\" }\n format.json { head :ok }\n end\n end", "def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to tutors_url }\n format.json { head :no_content }\n end\n end", "def destroyit\n @judgement = Judgement.find(params[:id])\n @judgement.destroy\n\n respond_to do |format|\n format.html { redirect_to judgements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor1 = Instructor1.find(params[:id])\n @instructor1.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @farm_practice_typology.destroy\n respond_to do |format|\n format.html { redirect_to farm_practice_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url, notice: 'Interview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url, notice: 'Interview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_teach_resource = LabTeachResource.find(params[:id])\n @lab_teach_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_teach_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apprentice = Apprentice.find(params[:id])\n @apprentice.destroy\n\n respond_to do |format|\n format.html { redirect_to apprentices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: \"Lecture was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n authorize @info_practice\n @info_practice.destroy\n respond_to do |format|\n format.html { redirect_to info_practices_url, notice: 'Info practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule_practice.destroy\n respond_to do |format|\n format.html { redirect_to schedule_practices_url, notice: 'Schedule practice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exhibition = Exhibition.find(params[:id])\n @exhibition.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @leadership.destroy\n respond_to do |format|\n format.html { redirect_to leaderships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @requisition.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participation.destroy\n respond_to do |format|\n format.html { redirect_to trips_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to @examination.project }\n format.json { head :no_content }\n end\n end", "def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advancement = Advancement.find(params[:id])\n @advancement.destroy\n\n respond_to do |format|\n format.html { redirect_to advancements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @petition = Petition.find(params[:id])\n @petition.destroy\n\n respond_to do |format|\n format.html { redirect_to petitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recital.destroy\n respond_to do |format|\n format.html { redirect_to recitals_url, notice: 'Recital was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to restaurent_path(@restaurent.id),\n notice: \"Review was successfully destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_training.destroy\n respond_to do |format|\n format.html { redirect_to personal_trainings_url, notice: 'Personal training was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutor.destroy\n respond_to do |format|\n format.html { redirect_to tutors_url, notice: 'Tutor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutor.destroy\n respond_to do |format|\n format.html { redirect_to tutors_url, notice: 'Tutor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @contestant.destroy\n respond_to do |format|\n format.html { redirect_to contestants_url, notice: 'Contestant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourth_review.destroy\n respond_to do |format|\n format.html { redirect_to fourth_reviews_url, notice: 'Fourth review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @employer = Employer.find(params[:id])\n @employer.destroy\n\n respond_to do |format|\n format.html { redirect_to employers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @employer = Employer.find(params[:id])\n @employer.destroy\n\n respond_to do |format|\n format.html { redirect_to employers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relatorio_colaborador.destroy\n respond_to do |format|\n format.html { redirect_to relatorios_colaborador_url, notice: 'Relatorio colaborador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @review.lecture, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lector.destroy\n respond_to do |format|\n format.html { redirect_to lectors_url, notice: 'El lector fue eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recitator.destroy\n respond_to do |format|\n format.html { redirect_to recitators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @research = Research.find(params[:id])\n @research.destroy\n\n respond_to do |format|\n format.html { redirect_to researches_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n authorize! :destroy, resource\n @lecture = resource.lecture\n resource.destroy\n\n respond_to do |format|\n format.html { redirect_to lecture_path(@lecture) }\n format.json { head :no_content }\n end\n end" ]
[ "0.7297245", "0.72492486", "0.7194853", "0.7190964", "0.71013653", "0.71013653", "0.71013653", "0.7033669", "0.7001017", "0.6996043", "0.6931695", "0.692397", "0.69155365", "0.68976986", "0.6885773", "0.688508", "0.68744", "0.6853067", "0.68352884", "0.68323356", "0.68323356", "0.68285096", "0.68285096", "0.68188095", "0.68150115", "0.6800842", "0.67980397", "0.67939657", "0.6789317", "0.67779845", "0.67550266", "0.67536116", "0.6748817", "0.6738151", "0.6736825", "0.6726771", "0.6719215", "0.6719215", "0.6711506", "0.6711059", "0.67057866", "0.67057866", "0.67057866", "0.6704748", "0.6701019", "0.66953146", "0.66926533", "0.6685764", "0.668203", "0.66819406", "0.6681926", "0.6679693", "0.6678591", "0.6675477", "0.6670654", "0.66694236", "0.66688997", "0.6668242", "0.6668073", "0.666234", "0.6660612", "0.6657879", "0.66511774", "0.66511774", "0.66511774", "0.66511774", "0.66508377", "0.6649169", "0.664867", "0.6645592", "0.66443217", "0.664393", "0.6638834", "0.6635046", "0.6634669", "0.6631275", "0.663115", "0.6630168", "0.6629871", "0.6629868", "0.66292727", "0.66292727", "0.66285765", "0.6624485", "0.6612187", "0.6610059", "0.66081077", "0.66081077", "0.66067165", "0.66067165", "0.66067165", "0.66067165", "0.66010255", "0.66003996", "0.6597885", "0.65894824", "0.6589323", "0.65877134", "0.65869445", "0.6586167" ]
0.74766666
0
Use callbacks to share common setup or constraints between actions.
def set_practitioner @practitioner = Practitioner.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def practitioner_params params.require(:practitioner).permit(:name, :phone, :email, :registration, :address, :fax, :location, :signature) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def params(list)\n @declared_params = list\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69485277", "0.6813547", "0.6799911", "0.6796169", "0.6745757", "0.6741778", "0.6527065", "0.65204644", "0.64925444", "0.64314413", "0.64314413", "0.64314413", "0.6398711", "0.6355623", "0.6355327", "0.6345812", "0.6343951", "0.6338371", "0.6327366", "0.6327366", "0.6327366", "0.63136744", "0.63001245", "0.6264419", "0.62613016", "0.6259317", "0.623719", "0.6227251", "0.6220037", "0.621864", "0.620889", "0.6199145", "0.61970234", "0.61728656", "0.61563927", "0.6155928", "0.6152361", "0.6136508", "0.6122662", "0.6109611", "0.60738647", "0.6072253", "0.6058575", "0.60571283", "0.6044282", "0.6033789", "0.6018841", "0.601607", "0.6014327", "0.6010113", "0.60086375", "0.60080284", "0.60060716", "0.6004647", "0.6004647", "0.5999453", "0.59945875", "0.5990942", "0.5983142", "0.5969449", "0.59688187", "0.5965012", "0.5964062", "0.5960668", "0.59599936", "0.59338915", "0.59288186", "0.5921217", "0.59072363", "0.59049433", "0.58997554", "0.58917797", "0.5890338", "0.5879621", "0.5879621", "0.5879621", "0.5872355", "0.58605725", "0.5853338", "0.58435106", "0.5842603", "0.58328134", "0.5830374", "0.5829657", "0.5828463", "0.5817261", "0.58149874", "0.58147764", "0.5810487", "0.5801209", "0.5801009", "0.5801009", "0.5794343", "0.5785498", "0.57794553", "0.5778505", "0.577467", "0.57682633", "0.5768243", "0.57627535", "0.5757951" ]
0.0
-1
determine how many days in the iteration are considered 'workdays' as defined by the workspace configuration
def calculate_workdays iteration_start_date = Date.parse(@iteration.start_date) iteration_end_date = Date.parse(@iteration.end_date) total_iteration_days = iteration_end_date - iteration_start_date + 1 # number of total possible workdays within entire iteration total_workdays = 0 curr_day = iteration_start_date for i in 1..total_iteration_days total_workdays += 1 if $conn.workspace.is_workday?(curr_day.to_s) curr_day += 1 end total_workdays end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potential_working_days(start_date, end_date)\n days_worked = (start_date..end_date).select do |day|\n day = day.strftime(\"%A\").downcase.to_sym\n works_on?(day)\n end\n days_worked.count\n end", "def working_days(from, to)\n days = (to - from).to_i\n if days > 0\n weeks = days / 7\n result = weeks * (7 - non_working_week_days.size)\n days_left = days - weeks * 7\n start_cwday = from.cwday\n days_left.times do |i|\n unless non_working_week_days.include?(((start_cwday + i - 1) % 7) + 1)\n result += 1\n end\n end\n result\n else\n 0\n end\n end", "def workdays_in_range\n end_time ? (start_time.to_date..end_time.to_date).select { |d| (1..5).cover?(d.wday) }.size - offset : 1\n end", "def days_worked\n days = account.account_setting.working_days\n Hash[days.map { |k,v| [k, (v == \"1\")] }]\n end", "def current_cycle_day_count\n count = (Time.now.to_date - self.started.to_date).to_i\n if count <= 30\n return 30\n else\n return count\n end\n end", "def number_of_days\n return ( end_date - start_date ).to_i\n end", "def all_working_days_of_month\n ending_of_month.downto(beginning_of_month).select(&:working_day?)\n end", "def compute_actual_days_worked(year, start_date, end_date)\n working_days_in_year = Float(52*5)\n\n if Date.new(year, 1, 1) < start_date\n start_date_to_consider = start_date\n else\n start_date_to_consider = Date.new(year, 1, 1)\n end\n\n if Date.new(year, 1, 1).end_of_year < end_date\n end_date_to_consider = Date.new(year, 1, 1).end_of_year\n else\n end_date_to_consider = end_date\n end\n\n # we have to add one to include last day of work. We multiply by working_days_in_year/365 to remove weekends.\n ((end_date_to_consider - start_date_to_consider + 1).to_i * (working_days_in_year/365)).to_i #actual days worked in 'year'\n end", "def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n working_date.step(self) { |a_day| \n if a_day.wday == _week_day_numbers.first\n week_num += 1\n end\n }\n week_num\n end", "def working_days_count(from_date, to_date, include_sat = false, include_sun = false, include_bank_holidays = false)\r\n\t\t \tdates_interval = (from_date..to_date).to_a\r\n\r\n\t\t\t\tuser_region = LeavesHolidaysLogic.user_params(self, :region)\r\n\r\n\t\t\t\tif !include_bank_holidays\r\n\t\t\t\t\tbank_holidays_list = Holidays.between(from_date, to_date, user_region.to_sym, :observed).map{|k| k[:date]}\r\n\t\t\t\t\tdates_interval -= bank_holidays_list\r\n\t\t\t\tend\r\n\r\n \t\t\tdates_interval.delete_if {|i| i.wday == 6 && !include_sat || #delete date from array if day of week is a saturday (6)\r\n \t\t\t i.wday == 0 && !include_sun } #delete date from array if day of week is a sunday (0)\r\n\r\n \t\treturn dates_interval.count\r\n\t\t\tend", "def getDayOffCount\n\t\tdayCount = 0\n\t\tunless Setting.plugin_redmine_wktime['wk_schedule_weekend'].blank?\n\t\t\tdayCount = Setting.plugin_redmine_wktime['wk_schedule_weekend'].length\n\t\tend\n\t\tdayCount\n\tend", "def days\n monday..sunday\n end", "def get_works_total_hours\n res_hours =0\n self.works.each do |w|\n res_hours+=w.workhours unless w.workhours.nil?\n end\n return res_hours\n end", "def duration_with_work_days\n if self.start_date && self.due_date\n RedmineBetterGanttChart::Calendar.workdays_between(self.start_date, self.due_date)\n else\n 0\n end\n end", "def time_days() (@time_end.jd - @time_start.jd) + 1; end", "def workdays(calendar = Spok.default_calendar)\n (@start_date..@end_date).to_a.delete_if{ |date| Workday.restday?(date, calendar: calendar) }\n end", "def non_working_week_days\n @non_working_week_days ||= begin\n days = [] # Setting.non_working_week_days\n if days.is_a?(Array) && days.size < 7\n days.map(&:to_i)\n else\n []\n end\n end\n end", "def set_workdays\n self.workdays = workdays_total\n end", "def effective_num_days\n [sessions.count, time_constraint(:max_days)].compact.min\n end", "def length\n (Date.week_days(@start_date, @end_date) - Personel.holidays).size\n end", "def weeks() 7 * days end", "def number_of_weeks\n @number_of_weeks ||= cell_row(last_of_month) + 1\n end", "def specific_days_in_semester\n date_start = USDateParse(self.start_date)#USDateParse(self.start_date)\n date_end = USDateParse(self.end_date)#USDateParse(self.end_date)\n curr_date = date_start\n date_hash = Hash.new(0)\n while curr_date <= date_end do\n if (! self.individual_dates_with_no_classes.include?(curr_date))\n date_hash[curr_date.cwday] += 1\n end\n curr_date += 1\n end\n return date_hash\n end", "def days\n self * SECONDS_IN_DAY\n end", "def days\n self.to_i * 86_400\n end", "def working_days_from_date(date)\r\n date = date + 1.day if date.cwday == 6\r\n day_of_the_week = date.cwday == 7 ? 0 : date.cwday\r\n calendar_days, business_days = self, self\r\n result_date = day_of_the_week + business_days\r\n if (result_date >= 6)\r\n business_days -= (6 - day_of_the_week)\r\n calendar_days += 2\r\n weeks = business_days / 5\r\n calendar_days += (weeks * 2)\r\n end\r\n date + calendar_days.days\r\n end", "def add_working_days(date, working_days)\n if working_days > 0\n weeks = working_days / (7 - non_working_week_days.size)\n result = weeks * 7\n days_left = working_days - weeks * (7 - non_working_week_days.size)\n cwday = date.cwday\n while days_left > 0\n cwday += 1\n unless non_working_week_days.include?(((cwday - 1) % 7) + 1)\n days_left -= 1\n end\n result += 1\n end\n next_working_date(date + result)\n else\n date\n end\n end", "def number_of_days(rental)\n\tnumber_of_days = (rental.end_date - rental.start_date)\n\tnumber_of_days = number_of_days.to_i + 1\nend", "def lead_days\n 0\n end", "def days(from_date = first_day.date, to_date = last_day.date)\n from_date = Date.new(2017, 1, 1)\n to_date = Date.new(2017, 12, 31)\n\n @days ||= workdays.select { |day| day.hours > 0 && (from_date..to_date).include?(day.date) }\n end", "def days_count\n (@end_date - @start_date).to_i\n end", "def working_days_until(other)\n return -other.working_days_until(self) if other < self\n\n whole_days_to(other).count do |day|\n day.weekday? && !day.public_holiday?\n end\n end", "def days_of_rent\n (1..(Rules.compute_rental_duration(@rental_data))).to_a\n end", "def days_left_in_week\n 7 - days_past_in_week\n end", "def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biweek[1]].compact.uniq\n\n @schedule.each_with_index do |row, i|\n DAYS.each_with_index do |day, j|\n date = ( i < biweek[1] ? week_1[j] : week_2[j] )\n day_name = day[:day]\n name = row[day[:name]]\n hours = row[day[:hours]]\n if name && hours && name.downcase.include?(@person.downcase)\n work_days.push({\n :name => @person,\n :date => get_date(date, hours)\n })\n end\n end\n end\n puts \"Work days:\\n#{work_days}\"\n return work_days\nend", "def days\n 1 + (@end_date - @start_date).to_i\n end", "def estimated_velocity_per_working_day\n estimated_velocity / NUMBER_OF_WORKING_DAYS_BY_WEEK\n end", "def days_hours_worked(date_and_times)\n days_hours_worked = 0\n day_periods(date_and_times).split(',').each do |day_period, index|\n beginning_of_period, end_of_period = day_period.strip.split('-')\n beginning_of_period = beginning_of_period.strip\n end_of_period = end_of_period.strip\n begin_time = DatelessTime.new(beginning_of_period).to_time\n end_time = DatelessTime.new(end_of_period).to_time\n days_hours_worked += (end_time - begin_time)/60/60\n end\n days_hours_worked\nend", "def w_day; end", "def get_not_worked_days start_date, end_date, employee_id\n not_worked_days = []\n if start_date != \"\" && end_date != \"\"\n start_date = DateTime.parse(start_date)\n end_date = DateTime.parse(end_date)\n for i in 0..get_difference_days(start_date, end_date) + 1\n current_date = start_date + i.days\n if !is_weekend?(current_date) && didnt_come_to_work?(employee_id, current_date)\n not_worked_days << current_date\n end\n end\n end\n return not_worked_days\n end", "def day_in_week_int \n\t\tdays = []\n\t\ttoday = Time.now\n\t\tdays.push(today.to_i)\n\t\ttoday_week_day = today.wday\n\t\tanothers = (0..6).select {|e| e != today_week_day}\n\t\tanothers.map do |e|\n\t\t\tdays.push(today.to_i - e*day_second)\n\t\tend\n\n\t\tdays.sort\n\tend", "def calculate\n intervals = intervals_in_range\n\n # How many minutes is left to work\n @left_minutes = total_work_minutes\n\n @days = get_work_intervals(intervals).map do |interval_group|\n interval_group.sort! { |a, b| a.id <=> b.id }\n date = interval_group.first.time_in.to_date\n\n work_day_minutes = get_minutes_in_day(date)\n\n left_today =\n if @left_minutes >= work_day_minutes\n work_day_minutes\n else\n @left_minutes\n end\n\n # Amount of minutes worked during this day\n total_worked = interval_group.sum(&:minutes_worked)\n\n @left_minutes -= total_worked\n # Indicates whether user worked more or less (overtime or undertime) in that day,\n # than he should\n # true - overtime, false - undertime\n is_overtime = total_worked > left_today\n\n # Difference between minutes user worked and minutes he has to work\n # Basically shows how many minutes he has over or underworked\n overtime_minutes = (left_today - total_worked).abs\n\n is_finished = interval_group.all?(&:finished?)\n\n WorkDay.new(intervals: interval_group,\n date: date,\n total_worked: total_worked,\n is_overtime: is_overtime,\n overtime_minutes: overtime_minutes,\n is_finished: is_finished,\n is_missing: false,\n is_day_off: day_off?(date))\n\n end\n\n @total_overtime = days.sum(&:overtime)\n\n # Ideal time when day should be finished\n # Calculated depending on how many hours should be worked at this day\n @day_ends_at = nil\n if unfinished_day\n left_today = get_minutes_in_day(Date.current) - unfinished_day.total_worked\n left_today = @left_minutes if @left_minutes < left_today\n @day_ends_at = Time.zone.now + left_today * 60\n end\n\n # TODO: when to finish work (distributed overtime between rest of days)\n end", "def nth_wday; (day - 1) / 7 end", "def calc_weeks_till\n (calc_days_till / 7.0).round(2)\n end", "def cfp_weeks\n result = 0\n if call_for_papers\n result = call_for_papers.weeks\n end\n result\n end", "def days_left\n if hw_coverage_end_date.present?\n diff = hw_coverage_end_date.to_date - Time.now.to_date\n diff.to_i\n end\n end", "def days_left\n if hw_coverage_end_date.present?\n diff = hw_coverage_end_date.to_date - Time.now.to_date\n diff.to_i\n end\n end", "def total_work_minutes\n @date_range.inject(0) do |minutes, date|\n # Do not count days off\n minutes += get_minutes_in_day(date) unless day_off?(date)\n minutes\n end\n end", "def nights\n return (@end_date - @start_date).to_i\n end", "def nights\n (end_date - start_date).to_i\n end", "def days(n)\n n * 3600 * 24\nend", "def end_of_week; self + (6 - wday).days end", "def lead_days\n 1\n end", "def lead_days\n 1\n end", "def lead_days\n 1\n end", "def lead_days\n 1\n end", "def num_of_nights\n num_of_nights = (end_date - start_date).to_i\n end", "def nights\n count = (@end_date - @start_date)/(60*60*24)\n return count\n end", "def num_days_online(days)\n return (1..days).inject(0) { |sum, i| (i%100==0 or i%14==0 or i%3==0) ? sum : sum + 1 }\nend", "def dayOfWeek\n days = 0;\n tempYear = MIN_YEAR\n while tempYear < @year\n days += SimpleDate.daysInYear(tempYear).to_i\n tempYear+=1\n end\n\n days = days + ordinalDate\n #puts \"days #{days}\"\n days = days % 7\n\n end", "def odd_week?; (to_i / 7.days).odd? end", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def calculate_timeline_week_count\n ((@course.timeline_end.to_date - @beginning_of_first_week).to_f / 7).ceil\n end", "def days_diff\n if self.end_at.nil? || self.start_at.nil?\n return 0\n end\n n = Integer(self.end_at - self.start_at) + 1\n return n\n end", "def days\n return \"There are #{self * (24 * 60 * 60)} seconds in #{self} days\"\n end", "def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend", "def days\n\t\treturn self * 24.hours\n\tend", "def days\n\t\treturn self * 24.hours\n\tend", "def wday() end", "def work_week=(days)\n config[:work_week] = days\n self._weekdays = nil\n end", "def weeks\n\t\treturn self * 7.days\n\tend", "def weeks\n\t\treturn self * 7.days\n\tend", "def count_working_days_between(start_date, end_date)\n start_date = to_date(start_date)\n end_date = to_date(end_date)\n populate_public_holiday_collection_for_year(start_date.year)\n populate_public_holiday_collection_for_year(end_date.year)\n if start_date >= end_date\n raise ArgumentError.new(\"start_date passed to HolidayCalendar.count_days_between() is not before end_date\")\n end\n\n working_day_count = 0\n date = start_date\n while date < end_date\n date += 1\n working_day_count += 1 if working_day?(date)\n end\n working_day_count\n end", "def sundayCounter\n days = [31,28,31,30,31,30,31,31,30,31,30,31]\n date, sundays = 0, 1\n\n (1901...2000).each do\n (0..11).each do |month|\n date = (date + days[month]) % 7\n sundays += 1 if date == 6\n end\n end\n sundays\nend", "def _week_day_numbers\n week_day_start = self.week_day_start\n week_day_start.capitalize if week_day_start.is_a? String\n [0, 1, 2, 3, 4, 5, 6].partition {|on| on >= day_names.index(week_day_start)%7 }.flatten\n end", "def deprecated_day_number\n time_zone = self.program_player.user.time_zone_or_default\n now_in_time_zone = Time.now.in_time_zone(time_zone)\n \n # If this budge has been paused, return the number of days until it is UNpaused\n # Note that if they paused this on day 6, and it's starting tomorrow, the day number will still be -1, but\n # tomorrow it will be 6, since it will resume with the day number that it was paused at.\n if !self.program_player.respond_to?(:restart_at)\n if self.program_player.temp_restart_at.present? and self.program_player.temp_restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.temp_restart_at)\n return (now_in_time_zone.to_date-self.program_player.temp_restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n elsif self.program_player.restart_at.present? and self.program_player.restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.restart_at)\n return (now_in_time_zone.to_date-self.program_player.restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n end", "def days() 24 * hours end", "def execution_count(days=30)\n latest_executions(days).count\n end", "def days_validation\n @start_cycle = @vote_setting.start_cycle.to_date \n @end_cycle = @vote_setting.end_cycle.to_date\n @days_count = (@end_cycle - @start_cycle).round\n end", "def days; self * DAY; end", "def days; self * DAY; end", "def working_day?\n !week_end?\n end", "def weeks ; self * 7.days ; end", "def check_for_workdays\n if not work_days.empty?\n errors.add(:base, :cannot_delete)\n return false\n end\n end", "def event_days\n time_span / (24 * 60 * 60)\n end", "def days ; self * 24.hours ; end", "def working_days_after(start_date, num_working_days)\n start_date = to_date(start_date)\n populate_public_holiday_collection_for_year(start_date.year)\n working_days_offset(start_date, num_working_days, :forward)\n end", "def working_hours\n return @working_hours\n end", "def number_of_parent_work(login=nil)\n count_by_frbr(login, :is_part_of, :how_many_works?) \n end", "def continuous_overstay_days\n days = continuous_overstay_days\n days > 90 ? days - 90 : 0\n end", "def nwday_day(n)\n w = n % 7\n 1 + (w - (wday - day + 1)) % 7 + n - w\n end", "def total_weeks\n week_split.size\n end", "def num_funding_rounds\n FundingRound.all.select {|funding| funding.startup == self }.count\n end", "def calculate_open_weeks\n @timeline_week_count - blackout_weeks_count - @course.weeks.count\n end", "def visa_overstay_days\n if visa_entry_overstay?\n return no_days\n elsif visa_date_overstay?\n return visa_date_overstay_days\n else\n 0\n end\n end", "def days\n # +1 because end_date is included in the duration range\n ((end_date - start_date) / 3600 / 24).to_i + 1\n end", "def total_weeks\n ((self.deadline - self.start_date) / 7).to_i\n end", "def fortnights ; self * 2.weeks ; end", "def task_count_instances\n #ex_count = find_exception_count\n if self.occurrence_type.eql?(\"count\")\n count = self.count.to_i\n return count\n elsif self.occurrence_type.eql?(\"until\")\n if self.start_date and self.until\n case(self.repeat)\n when \"DAI\" then daily_count\n when \"WEE\" then weekly_count\n when \"MON\" then monthly_count\n when \"YEA\" then yearly_count\n end\n end\n else\n 1 \n end\n end" ]
[ "0.6902245", "0.6877124", "0.6850414", "0.6725095", "0.63789624", "0.63611805", "0.6360334", "0.6337088", "0.626955", "0.6264542", "0.62607074", "0.62492824", "0.62163204", "0.62117904", "0.61999243", "0.61975473", "0.61950326", "0.618262", "0.61129516", "0.61029315", "0.60977024", "0.60747737", "0.6063698", "0.60461825", "0.6038798", "0.6030776", "0.6014496", "0.60102063", "0.5990909", "0.59826875", "0.59669673", "0.5963978", "0.59414804", "0.5919681", "0.5918879", "0.5896823", "0.5889137", "0.5870699", "0.5866528", "0.58654094", "0.58519554", "0.5851595", "0.58416516", "0.5838581", "0.58356136", "0.5835161", "0.5835161", "0.5830964", "0.5828846", "0.58263266", "0.58159703", "0.5809832", "0.5805383", "0.5805383", "0.5805383", "0.5805383", "0.58037895", "0.5801586", "0.5801196", "0.57775575", "0.5773188", "0.57693374", "0.57693374", "0.5758266", "0.57535464", "0.574093", "0.57394546", "0.5739045", "0.5739045", "0.57208794", "0.5720005", "0.57188195", "0.57188195", "0.57103777", "0.5709622", "0.56961244", "0.5692286", "0.5690464", "0.5680896", "0.5673496", "0.56673914", "0.56673914", "0.56664747", "0.56494606", "0.5624282", "0.5621413", "0.561691", "0.56132436", "0.5606924", "0.5604414", "0.5598175", "0.55973727", "0.55903894", "0.5589885", "0.55760324", "0.55715847", "0.55688554", "0.55677515", "0.5560387", "0.5559786" ]
0.8777553
0
state_data is a hash of schedule states and associated icf data
def initialize(creation_date, state_data) @creation_date = creation_date @state_data = state_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [calendar_name, description, name, next_fire_time, previous_fire_time, state].hash\n end", "def state\n hash = {}\n hash[:frozen] = self.frozen \n hash[:active] = self.board.active\n hash[:students] = self.students.as_json\n hash[:tas] = self.tas.as_json\n hash\n end", "def initialize data, is_closed\n @is_closed = is_closed\n if is_closed\n @closed_data = data.reject {|key,_v| 'state' == key}\n end\n tab_state = is_closed ? data['state'] : data\n setup tab_state\n end", "def state\n data[:state]\n end", "def state_obj; @_hegemon_states[@_hegemon_state]; end", "def state\n data.state\n end", "def state\n data.state\n end", "def states\r\n @states.collect {|id| $data_states[id] }\r\n end", "def states\n @states ||= {}\n end", "def load_state(state)\n state.symbolize_keys!\n\n @mine = state[:mine].present?\n @revealed = state[:revealed].present?\n @flagged = state[:flagged].present?\n @neighbors_count = state[:neighbors_count]\n end", "def initialize_state\n @value_hash, @result_hash = {}, {}\n @derived_values, @attrs = [], []\n @timevec = []\n @utc_offset = Time.now.utc_offset\n @enum_index = 0\n end", "def state\n data['State']\n end", "def state\n @state ||= getStateData()\n end", "def states; @_hegemon_states.keys; end", "def known_states; end", "def known_states; end", "def known_states; end", "def orderStates\n @states = Hash.new\n @states[0] = \"Processing\"\n @states[1] = \"Shipped\"\n @states[2] = \"Delivered\"\n @states[3] = \"Cancelled\"\n end", "def reservation_state(base = self.date_from)\n\t\t\t\t\t@reservation_states = {} if @reservation_state.nil?\n\t\t\t\t\t@reservation_state_behaviors = {} if @reservation_state_behaviors.nil?\n\t\t\t\t\tif @reservation_states[base.to_s].nil?\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Now\n\t\t\t\t\t\tnow = Time.current\n\t\t\t\t\t\t\n\t\t\t\t\t\t# States\n\t\t\t\t\t\treservation_states = config(:reservation_states)\n\n\t\t\t\t\t\t# Break times\n\t\t\t\t\t\tif config(:reservation_state_policy) == \"time_fixed\"\n\t\t\t\t\t\t\tbreak_times = []\n\t\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\t\tif index != 0 # Do not consider first state\n\t\t\t\t\t\t\t\t\tstate_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\t\ttime_fixed = self.send(\"time_fixed_#{state_name}\")\n\t\t\t\t\t\t\t\t\tif time_fixed\n\t\t\t\t\t\t\t\t\t\tbreak_times << time_fixed\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak_times = [self.datetime_from(base)]\n\t\t\t\t\t\t\treservation_states.reverse_each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\t\tif index != 0 && index != (reservation_states.length - 1) # Do not consider first and last state\n\t\t\t\t\t\t\t\t\tstate_name = reservation_state_spec[:name]\n\t\t\t\t\t\t\t\t\ttime_window = self.send(\"time_window_#{state_name}\")\n\t\t\t\t\t\t\t\t\tif time_window\n\t\t\t\t\t\t\t\t\t\tbreak_times << (break_times.last - time_window.days_since_new_year.days - time_window.seconds_since_midnight.seconds)\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\tbreak_times << break_times.last\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\t# State recognititon\n\t\t\t\t\t\treservation_states.each_with_index do |reservation_state_spec, index|\n\t\t\t\t\t\t\tif index < reservation_states.length - 1\n\t\t\t\t\t\t\t\tif !break_times[reservation_states.length - 2 - index].nil? && now < break_times[reservation_states.length - 2 - index]\n\t\t\t\t\t\t\t\t\t@reservation_states[base.to_s] = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\t\t@reservation_state_behaviors[base.to_s] = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse # Last fallback state\n\t\t\t\t\t\t\t\t@reservation_states[base.to_s] = reservation_state_spec[:name].to_sym\n\t\t\t\t\t\t\t\t@reservation_state_behaviors[base.to_s] = reservation_state_spec[:behavior].to_sym\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\treturn @reservation_states[base.to_s]\n\t\t\t\tend", "def hash\n state.hash\n end", "def hash\n state.hash\n end", "def initialize(data = {})\n @data = data\n @last_state = nil\n end", "def state\n [\n [\"AC\",\"Acre\"],\n [\"AL\",\"Alagoas\"],\n [\"AP\",\"Amapa\"],\n [\"AM\",\"Amazonas\"],\n [\"BA\",\"Bahia\"],\n [\"CE\",\"Ceara\"],\n [\"DF\",\"Distrito Federal\"],\n [\"ES\",\"Espirito Santo\"],\n [\"GO\",\"Goias\"],\n [\"MA\",\"Maranhao\"],\n [\"MT\",\"Mato Grosso\"],\n [\"MS\",\"Mato Grosso do Sul\"],\n [\"MG\",\"Minas Gerais\"],\n [\"PA\",\"Para\"],\n [\"PB\",\"Paraiba\"],\n [\"PR\",\"Parana\"],\n [\"PE\",\"Pernambuco\"],\n [\"PI\",\"Piaui\"],\n [\"RJ\",\"Rio de Janeiro\"],\n [\"RN\",\"Rio Grande do Norte\"],\n [\"RS\",\"Rio Grande do Sul\"],\n [\"RO\",\"Rondonia\"],\n [\"RR\",\"Roraima\"],\n [\"SC\",\"Santa Catarina\"],\n [\"SP\",\"Sao Paulo\"],\n [\"SE\",\"Sergipe\"],\n [\"TO\",\"Tocantins\"],\n ]\n end", "def state_code\n decode hash[\"StateCode\"]\n end", "def states\n @attributes[\"data\"][\"states\"]\n end", "def get_state\[email protected]\nend", "def state\n [\n [\"AC\", \"Acre\"],\n [\"AL\", \"Alagoas\"],\n [\"AP\", \"Amapa\"],\n [\"AM\", \"Amazonas\"],\n [\"BA\", \"Bahia\"],\n [\"CE\", \"Ceara\"],\n [\"DF\", \"Distrito Federal\"],\n [\"ES\", \"Espirito Santo\"],\n [\"GO\", \"Goias\"],\n [\"MA\", \"Maranhao\"],\n [\"MT\", \"Mato Grosso\"],\n [\"MS\", \"Mato Grosso do Sul\"],\n [\"MG\", \"Minas Gerais\"],\n [\"PA\", \"Para\"],\n [\"PB\", \"Paraiba\"],\n [\"PR\", \"Parana\"],\n [\"PE\", \"Pernambuco\"],\n [\"PI\", \"Piaui\"],\n [\"RJ\", \"Rio de Janeiro\"],\n [\"RN\", \"Rio Grande do Norte\"],\n [\"RS\", \"Rio Grande do Sul\"],\n [\"RO\", \"Rondonia\"],\n [\"RR\", \"Roraima\"],\n [\"SC\", \"Santa Catarina\"],\n [\"SP\", \"Sao Paulo\"],\n [\"SE\", \"Sergipe\"],\n [\"TO\", \"Tocantins\"],\n ]\n end", "def from_states; end", "def from_states; end", "def states; end", "def hash\n self.state.hash\n end", "def state\n [@identifier, @estimated_time, @priority, @completed_at]\n end", "def read_state\n end", "def state\n super\n table :cs_rep, ['ident'], ['payload']\n table :cs_meter, ['ident'], ['payload']\n scratch :rmg_can_store, ['ident'], ['payload']\n end", "def state_table(item)\n get_state_table(item) || {}\n end", "def state_hash\n @board.flatten.join\n end", "def state_objs; @_hegemon_states.clone; end", "def initialize(state_of_origin, data)#when taking hash values as parameters, better to use 'data' as parameter and use [] notation to get specific values \n @state = state_of_origin\n @population = data[:population]\n @population_density = data[:population_density]\n end", "def state\n info[:state]\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def state_code\n end", "def hash\n [container_id, image, image_id, last_state, name, ready, restart_count, state].hash\n end", "def save_state(data_grid)\n cookies[\"data_grid_state_#{data_grid.name}\"] ||= {}\n \n state = {}\n STATE_KEYS.each do |key|\n state[key] = data_grid.send(key)\n end\n \n data_grid.columns.each_with_index do |col, col_index|\n state[:columns] ||= {}\n state[:columns][col_index] = col.filter_value\n end\n \n cookies[\"data_grid_state_#{data_grid.name}\"] = Marshal.dump(state)\n end", "def setup_states\n @jobs.each do |job|\n @job_states[job[:id]] ||= {:run_at => Time.now.utc, :runs_left => job[:times_to_run]}\n @job_states[job[:id]][:found] = true\n end\n end", "def initialize\n\t\t@current_state = {:A1 => nil, :A2 => nil, :A3 => nil,\n\t\t :B1 => nil, :B2 => nil, :B3 => nil, \n\t\t :C1 => nil, :C2 => nil, :C3 => nil}\n @over = false\n end", "def state\n object.state_code\n end", "def state_code\n end", "def ticketstate_params\n params.require(:ticketstate).permit(:stateinfo, :start_time)\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def gamestate(figure_id)\n {\n figure_id: figure_id,\n routes: possible_routes_for(@figures[figure_id]),\n board: @board,\n position_of_mrx: position_of_mrx,\n positions_of_agents: positions_of_agents,\n turns: @turns,\n tickets: tickets,\n mrx_last_used_ticket: @mrx_last_used_ticket\n }\n end", "def state\n @@states[@state]\n end", "def access_state_data\n STATE_DATA.each do |state, population_hash|\n VirusPredictor.new(state, population_hash[:population_density], population_hash[:population]).virus_effects\n end\nend", "def connection_states\n hash = {}\n names = STATENAMES.reverse\n \n STATECODES.sort.each_with_index do |code, index|\n hash[names[index]] = code\n end\n \n return hash\n end", "def state\n @state\n end", "def hash\n fsm_class.to_s.hash ^ state_var.to_s.hash\n end", "def hash_more_data_state\n super\n end", "def state\n \n session[ flow_session_name ].fetch( state_session_name )\n \n end", "def state\n end", "def human_readable_state\n hash = {}\n @state.dup.each do |c, v|\n hash[Dictionary.command_to_name(c).to_s] = (Dictionary.command_value_to_value_name(c, v) || v.to_s).to_s\n end\n hash\n end", "def state\n @state\n end", "def state_keys\n @state.keys\n end", "def state_array\n %w(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)\nend", "def event_state\n FFILib::ReaderStateQuery.unpack_state self[:event_state]\n end", "def state_stats\n state_data = {}\n @file.each do |line|\n state = line[:state]\n if state_data[state].nil?\n state_data[state] = 1\n else\n state_data[state] += 1\n end\n\n end\n rank = state_data.sort_by{|state, counter| -counter}.collect{|state,counter| state unless state.nil?}\n state_data = state_data.select{|state, counter| state}.sort_by{|state,counter| state unless state.nil?}\n state_data.each do |state, counter|\n puts \"(#{rank.index(state)+1}) #{state}: #{counter}\"\n end\n end", "def initial_state\n {}\n end", "def state\n @state\n end", "def state()\n info[:state]\n end", "def states #NOTE: This should return and array of name_desc_value structs. Fix asap.\r\n states = [\r\n [ \"Alabama\", \"AL\" ],\r\n [ \"Alaska\", \"AK\" ],\r\n [ \"Arizona\", \"AZ\" ],\r\n [ \"Arkansas\", \"AR\" ],\r\n [ \"California\", \"CA\" ],\r\n [ \"Colorado\", \"CO\" ],\r\n [ \"Connecticut\", \"CT\" ],\r\n [ \"Delaware\", \"DE\" ],\r\n [ \"Florida\", \"FL\" ],\r\n [ \"Georgia\", \"GA\" ],\r\n [ \"Hawaii\", \"HI\" ],\r\n [ \"Idaho\", \"ID\" ],\r\n [ \"Illinois\", \"IL\" ],\r\n [ \"Indiana\", \"IN\" ],\r\n [ \"Iowa\", \"IA\" ],\r\n [ \"Kansas\", \"KS\" ],\r\n [ \"Kentucky\", \"KY\" ],\r\n [ \"Louisiana\", \"LA\" ],\r\n [ \"Maine\", \"ME\" ],\r\n [ \"Maryland\", \"MD\" ],\r\n [ \"Massachusetts\", \"MA\" ],\r\n [ \"Michigan\", \"MI\" ],\r\n [ \"Minnesota\", \"MN\" ],\r\n [ \"Mississippi\", \"MS\" ],\r\n [ \"Missouri\", \"MO\" ],\r\n [ \"Montana\", \"MT\" ],\r\n [ \"Nebraska\", \"NE\" ],\r\n [ \"Nevada\", \"NV\" ],\r\n [ \"New Hampshire\", \"NH\" ],\r\n [ \"New Jersey\", \"NJ\" ],\r\n [ \"New Mexico\", \"NM\" ],\r\n [ \"New York\", \"NY\" ],\r\n [ \"North Carolina\", \"NC\" ],\r\n [ \"North Dakota\", \"ND\" ],\r\n [ \"Ohio\", \"OH\" ],\r\n [ \"Oklahoma\", \"OK\" ],\r\n [ \"Oregon\", \"OR\" ],\r\n [ \"Pennsylvania\", \"PA\" ],\r\n [ \"Rhode Island\", \"RI\" ],\r\n [ \"South Carolina\", \"SC\" ],\r\n [ \"South Dakota\", \"SD\" ],\r\n [ \"Tennessee\", \"TN\" ],\r\n [ \"Texas\", \"TX\" ],\r\n [ \"Utah\", \"UT\" ],\r\n [ \"Vermont\", \"VT\" ],\r\n [ \"Virginia\", \"VA\" ],\r\n [ \"Washington\", \"WA\" ],\r\n [ \"West Virginia\", \"WV\" ],\r\n [ \"Wisconsin\", \"WI\" ],\r\n [ \"Wyoming\", \"WY\" ]\r\n ]\r\n return states\r\n end", "def state\n params['state']\n end", "def hash\n [class_schedule_id, visits, clients, location, resource, max_capacity, web_capacity, total_booked, total_booked_waitlist, web_booked, semester_id, is_canceled, substitute, active, is_waitlist_available, is_enrolled, hide_cancel, id, is_available, start_date_time, end_date_time, last_modified_date_time, class_description, staff, booking_window, booking_status].hash\n end", "def map_state(state)\n @state_mapping.each do |key, value|\n return key if value.include? state\n end\n :today\nend", "def state_attrs\n @resource.class.state_attrs.map(&:to_sym)\n end", "def state\n ret = self[:state] || {}\n if game.facts[:contraband] && game.facts[:contraband].include?(card_type)\n ret[:contraband] = true\n end\n return ret\n end", "def state\n self[:ST]\n end", "def get_initial_state\n {\n appointments_for_dates: {}\n }\n end", "def state\n self.well_info.state\n end", "def __state_internal\n @state\n end", "def add_state(v)\nunless has_state?(v)\n@state[v] = true\n@transition[v] = {}\nend\nend", "def workflow_states\n wfs = workflows\n states = {}\n wfs.each { |wf| states[wf.id] = workflow_state(workflow_id: wf.id) }\n states\n end", "def value\n Hash[model.states.zip(@array_value)]\n end", "def all_state(id)\n $app_sessions[id][:state]\nend", "def all_state\n result = {:cook_state => RightScale::CookState, :chef_state => RightScale::ChefState}\n end", "def load_breweries_per_capita(state)\n @per_capita_hash[state]\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def get_structure()\n [state_type, @name, @state]\n end", "def print_all_states\n STATE_DATA.each_key { |key|\n new_state = VirusPredictor.new(key, STATE_DATA[key][:population_density], STATE_DATA[key][:population])\n new_state.virus_effects\n }\n end", "def write_state; end", "def write_state; end" ]
[ "0.6714574", "0.6670478", "0.6506519", "0.62995106", "0.6203239", "0.6118409", "0.6118409", "0.6060443", "0.6031019", "0.59907514", "0.5987839", "0.59561497", "0.5938627", "0.58565134", "0.5824632", "0.5824632", "0.5824632", "0.5799751", "0.57913816", "0.57582605", "0.57582605", "0.5750612", "0.5747173", "0.5723657", "0.57006586", "0.5689066", "0.56825817", "0.5631908", "0.5631908", "0.5623566", "0.55742425", "0.5553631", "0.55393237", "0.55367523", "0.55357254", "0.5529451", "0.5523013", "0.5513218", "0.55103683", "0.54919577", "0.54906994", "0.5489448", "0.5469607", "0.5467565", "0.54640836", "0.54623663", "0.5456388", "0.5445423", "0.5444706", "0.5444706", "0.5444706", "0.5444706", "0.5444706", "0.5444706", "0.5444706", "0.5444706", "0.54398364", "0.5433102", "0.54314536", "0.54219747", "0.5408833", "0.5403737", "0.539007", "0.5386143", "0.5385061", "0.53799236", "0.53688604", "0.53573585", "0.5356191", "0.53448534", "0.5341427", "0.53412884", "0.53379864", "0.5333996", "0.53069526", "0.52994335", "0.5269946", "0.5239728", "0.5237957", "0.52331865", "0.522354", "0.5219841", "0.5219401", "0.5218006", "0.5202848", "0.52027375", "0.5198026", "0.5195663", "0.5174053", "0.5170741", "0.51701325", "0.51701325", "0.51701325", "0.51701325", "0.51701325", "0.51701325", "0.5168418", "0.5163123", "0.51588464", "0.51588464" ]
0.56197613
30
Creates a new filter for testing using the given `fragment`.
def new_filter(fragment) if fragment.kind_of? String pipeline = new_pipeline fragment = pipeline.call(fragment)[:output].to_s end HTML::Pipeline::CiteFilter.new(fragment) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(fragment)\n @fragment = fragment\n end", "def to_fragment\n SomaticsFilter::Fragment.new({\n SomaticsFilter::Query::ParamNames[:is_set] => self.is_default? ? '1' : '0',\n SomaticsFilter::Query::ParamNames[:operator] => self.default_operator,\n SomaticsFilter::Query::ParamNames[:value] => self.default_value,\n SomaticsFilter::Query::ParamNames[:value1] => self.default_value,\n SomaticsFilter::Query::ParamNames[:value2] => self.default_value,\n :filter => self\n })\n end", "def filter(samplemethod=:sample,&block)\n return Filter.new( self, samplemethod, &block )\n end", "def filter\n @filter ||= filter_class.new default_filter\n end", "def initialize(filter_type, &block)\n if FILTER_TYPES.include?(filter_type)\n @filter_type = filter_type\n else\n raise ArgumentError, \"invalid type #{filter_type}, allowed: #{FILTER_TYPES.join(', ')}\"\n end\n @block = block\n end", "def initialize(base, &filter)\n @base = base\n @filter = filter\n end", "def initialize(&block)\n @filter = (block || method(:filter))\n super()\n end", "def add_filter(filter = nil, &block)\n id = \"#{filter.inspect}/#{block.inspect}\".hash\n\n @filters[id] = if filter.is_a?(Filter)\n filter\n elsif filter.is_a?(String)\n StringFilter.new(filter)\n elsif filter.is_a?(Regexp)\n RegexpFilter.new(filter)\n elsif block\n BlockFilter.new(block)\n else\n raise ArgumentError, \"Please specify either a string, \" \\\n \"filter, or block to filter source files with!\"\n end\n\n true\n end", "def define_filter(name, &block)\n filters[name.to_sym] = block\n nil\n end", "def start_filtered(filter)\n unless @block_opened\n raise SyntaxError.new('Filters must have nested text.')\n end\n push_and_tabulate([:filtered, filter])\n @flat_spaces = @template_tabs * 2\n @filter_buffer = String.new\n end", "def parse_filter(filter_argument = T.unsafe(nil), &filter_proc); end", "def add_filter filter = nil, &block\n @filters.push( filter ) unless filter.blank?\n @filters.push( block ) if block_given?\n end", "def create_filter(filter)\n return nil,nil if filter.nil?\n\n db_adapter = MongoDBConv.new(@current_var, true) #do push 'or'\n\n db_expr,hop_expr = filter.db_conv(@parent, db_adapter) \n end", "def event_filter(&block)\n filter = EventFilter.new(block)\n @event_filters << filter\n filter\n end", "def add_filter(name, &block)\n raise ArgumentError, \"Expected block to be given\" if block.nil?\n\n @filters[name] = block\n end", "def filter(filter)\n raise_method_not_available(__method__, 'is nested asset') if nested_asset?\n assets = client.get(asset_type, {}, { query: { filter: filter } })\n assets.map { |data| self.new_from_payload(data) }\n end", "def create_filter(options = {})\n context = options.delete(:context)\n context = [ context ] unless context.kind_of? Array\n options['context[]'] = context\n \n perform_request_with_object(:post, '/api/v1/filters',\n options, Mastodon::Filter)\n end", "def fragment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = FRAGMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 9:12: 'fragment'\n match(\"fragment\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end", "def filter(klass = nil, &block)\n @filterClass = klass\n @filterBlock = block\n end", "def applied_filter(_fragment, _filter, machines)\n machines\n end", "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end", "def create_filter(title, expression)\n filter = {\n \"userFilter\" => {\n \"content\" => {\n \"expression\" => expression\n },\n \"meta\" => {\n \"category\" => \"userFilter\",\n \"title\" => title\n }\n }\n }\n puts filter.to_json\n GoodData.post \"/gdc/md/#{@project_id}/obj\", filter\n end", "def filter( *filterspec )\n\t\tif filterspec.empty?\n\t\t\topts = self.options\n\t\t\topts[:filter] = Treequel::Filter.new(opts[:filter]) unless\n\t\t\t\topts[:filter].is_a?( Treequel::Filter )\n\t\t\treturn opts[:filter]\n\t\telse\n\t\t\tself.log.debug \"cloning %p with filterspec: %p\" % [ self, filterspec ]\n\t\t\tnewfilter = Treequel::Filter.new( *filterspec )\n\t\t\treturn self.clone( :filter => self.filter + newfilter )\n\t\tend\n\tend", "def to_filter_proc(filter)\n case ff = filter\n when NilClass then ->(f){ true }\n when Proc then ff\n when Regexp then ->(f){ ff =~ f.to_s }\n else\n ->(f){ ff === f }\n end\n end", "def Filter=(arg0)", "def filter(name, &block)\n @filters[name.to_s] = block\n end", "def filter(filter)\n @query[:q] << \"filter:#{filter}\"\n self\n end", "def create\n \t@query = current_user.queries.find(params[:query_id])\n @filter = current_user.queries.find(params[:query_id]).filters.new(params[:filter])\n\n respond_to do |format|\n if @filter.save\n format.html { redirect_to @query, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end", "def filter= filter\n grpc.filter = filter\n end", "def fragment(name, on, &block)\n Fragment.new(name, on, &block)\n end", "def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end", "def add_filter(filter)\n @filters << filter\n end", "def initialize(filter_type)\n @filter_type = filter_type\n begin\n filter_module = self.class.const_get(filter_type.to_s.gsub(/^([a-z])/) {|e| $1.upcase })\n self.extend(filter_module)\n rescue NameError\n raise FilterNotFoundError\n end\n end", "def fragment_set(fragment)\n rebuild_uri :fragment => fragment\n end", "def add_filter\n @filter = true \n end", "def fragment(ast_node, &block)\n GeneratedFragment.new(self, ast_node).tap do |frag|\n yield frag if block_given?\n end\n end", "def register_filter(mod); end", "def initialize( *expression_parts )\n\t\tself.log.debug \"New filter for expression: %p\" % [ expression_parts ]\n\t\t@component = self.class.parse_expression( expression_parts )\n\t\tself.log.debug \" expression parsed into component: %p\" % [ @component ]\n\n\t\tsuper()\n\tend", "def add_filter(filter)\n @filters << filter\n self\n end", "def create\n @filter = Filter.find_or_create_by_name( params[:filter][:name], :group => params[:filter][:group], :pattern => params[:filter][:pattern] )\n\n Auditlog( self.class.name, @filter )\n\n respond_to do |format|\n if @filter\n format.html { redirect_to @filter, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filter.errors, status: :unprocessable_entity }\n end\n end\n end", "def filter(filter)\n tl = AlienTagList.new\n\n self.each do |ele|\n if ele.tag =~ filter\n tl.add_tag(ele)\n end\n end\n\n return tl\n end", "def add_filter(filter)\n @filters <<\n if filter =~ /\\./\n filter\n else\n \"solr.#{filter}FilterFactory\"\n end\n end", "def addfilter( newfilter )\n if not subfilter\n @subfilter = newfilter\n else\n subfilter.addfilter( newfilter )\n end\n return self\n end", "def filter!(filter)\n # {:scope => :transaction, :merchant => { :matcher => 'ATM WITHDRAWAL' }}\n # {:scope => :collection, :name => :credit_card_payments }\n @transactions.reject! do |t|\n t.send(filter[:field]).downcase == filter[:matcher].downcase\n end\n end", "def fragment(*args, &block)\n Loofah::HTML::DocumentFragment.parse(*args, &block)\n end", "def filter(filter)\n current_widget.filter filter\n end", "def add_filter(name, assertion, equals)\n @filters << Filter.new(name, assertion, equals)\n end", "def initialize(attributes={})\n self.filters ||= {}\n super\n end", "def add_filter(type, &block)\n filters[type] << block\n end", "def filter(expr); end", "def filter(expr); end", "def filter(uri_or_ref, &block)\n uri = uri_or_ref\n if uri.kind_of?(Builder)\n visitor = ServiceBuilderVisitor.new(context())\n uri_or_ref.accept_visitor(visitor)\n uri = uri_or_ref.uri\n end\n raise ExecutionException, \"no block given!\", caller() unless block_given?\n\n builder = EndpointFilterBuilder.new(context())\n builder.set_endpoint(uri)\n builder.instance_eval(&block)\n\n context().lookup_uri(builder.uri())\n filtered_endpoint = builder.product()\n context().register_endpoint(filtered_endpoint)\n return filtered_endpoint\n end", "def initialize\n @filters = []\n end", "def before_filter(&block)\n @before_filter = block\n end", "def filter(name, function)\n design_doc.create_filter(name, function)\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def initialize(attributes)\n self.filters ||= {}\n super\n end", "def filter_create(payload, opts = {})\n data, _status_code, _headers = filter_create_with_http_info(payload, opts)\n data\n end", "def filter(filter_form_url = {}, filter_form_options = {:method => 'get'}, &block)\n raise 'You must pass a block to use for a filter' unless block_given?\n @filter_block = block\n @filter_form = {:url => filter_form_url, :options => filter_form_options}\n end", "def new\n @filter = Object::Filter.new\n @filter.source = @source\n\n if params[:positive] == 'false'\n @filter.positive = false\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @filter }\n end\n end", "def add_filter!(filter, condition)\n if @root_filter.nil?\n @root_filter = filter\n else\n get_last_filter.set_next_filter!(filter, condition)\n end\n end", "def initialize()\n @filters ||= []\n end", "def filter\n @filter = params[:q]\n end", "def test_add_filter\n flunk\n end", "def filter_clause\n @filters[filter % @filters.size] unless @filters.size.zero?\n end", "def apply_filter\n end", "def initialize(object=nil, samplemethod=:sample, &block)\n if object\n # Trace(\"Filter::initialize object #{object.inspect} method #{samplemethod.inspect} \")\n @proc = object.method( samplemethod )\n else\n @proc = Proc.new( &block )\n end\n end", "def test_composite_var_filter__var_and_method_match\n composite_filter = Var_composite_filter\n \n context = {:vars => [\"template_path\" => 'b/taglib/b'], :self => Obj.new('b/taglib/b')}.context\n \n options = {:filters => composite_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end", "def initialize(filter_select:)\n @filter_select = filter_select\n end", "def parse_filter_from_variable(variable_name, filter_name, **options)\n variable = instance_variable_get(\"@#{variable_name}\")\n @filters[filter_name] = variable if variable\n end", "def filter(sparql)\n raise \"Must be overridden\"\n end", "def process_fragment(fragment)\n Types.check( binding, { :fragment => Fragment } )\n\n if Blank === fragment\n then process_blank(fragment)\n else process_nonblank(fragment)\n end\n end", "def create_filter_info(position, options = {})\n filter = Filter.new(position, options)\n\n ajax_filters << filter\n\n filter\n end", "def global_filter(&block)\n @filters[nil] = block\n end", "def initialize(chromosome, start, stop=nil, exact=false)\n begin\n if not start.nil?\n start = Integer(start)\n end\n\n stop = stop ? Integer(stop) : start\n rescue ValueError\n raise ValueError('Start and stop positions must be integers or nil')\n end\n\n if exact or start.nil?\n # Handle the case where start is None because sometimes\n # a record will have only the chromosome set (no positions).\n f = SolveBio::Filter.new({FIELD_START => start, FIELD_STOP => stop})\n else\n f = SolveBio::Filter.new({\"#{FIELD_START}__lte\" => start,\n \"#{FIELD_STOP}__gte\" => stop})\n if start != stop\n f |= SolveBio::Filter.new({\"#{FIELD_START}__range\" =>\n [start, stop]})\n f |= SolveBio::Filter.new({\"#{FIELD_STOP}__range\" =>\n [start, stop]})\n end\n end\n\n if chromosome.nil?\n f &= SolveBio::Filter.new({\"#{FIELD_CHR}\" => nil})\n else\n f &= SolveBio::Filter.new({\"#{FIELD_CHR}\" => chromosome.sub('chr', '')})\n end\n\n @filters = f.filters\n end", "def filter\n end", "def filter!(filter)\n self.delete_if { |ele| !(ele.tag =~ filter)}\n return self\n end", "def from_s(filter)\n unless filter.bytesize == m / 8\n raise ArgumentError,\n \"expected a #{m / 8} byte filter, provided #{filter.bytesize}\"\n end\n\n self.filter = BitArray.new(filter)\n end", "def filter(filter)\n filtered_height_map = HeightMap.new\n filtered_height_map.load(filter.filter(@data), @size_x)\n filtered_height_map\n end", "def add_filters(filters); end", "def test_constructor\n \t\t\n \t\tfilter = nil\n \t\tassert_nothing_raised{\n \t\t\tfilter = ReferenceFilter.new(@reference)\n \t\t}\n \t\t\n \t\tassert_equal(@reference, filter.reference_for_comparison)\n \t\tassert_equal([], filter.collected_references)\n \t\tassert_equal([], filter.filtered_references)\n \t\t\n \t\tassert_raise(Bibmix::Error){\n \t\t\tfilter = ReferenceFilter.new(nil)\n \t\t}\n \tend", "def before_filter(&block)\n @before_filter = block\n end", "def initialize( attribute, value, filtertype=:equal )\n\t\t\tself.log.debug \"creating a new %s %s for %p and %p\" %\n\t\t\t\t[ filtertype, self.class.name, attribute, value ]\n\n\t\t\t# Handle Sequel :attribute.identifier\n\t\t\tattribute = attribute.value if attribute.respond_to?( :value )\n\n\t\t\tfiltertype = filtertype.to_s.downcase.to_sym\n\t\t\tif FILTERTYPE_OP.key?( filtertype )\n\t\t\t\t# no-op\n\t\t\telsif FILTEROP_NAMES.key?( filtertype.to_s )\n\t\t\t\tfiltertype = FILTEROP_NAMES[ filtertype.to_s ]\n\t\t\telse\n\t\t\t\traise Treequel::ExpressionError,\n\t\t\t\t\t\"invalid simple item operator %p\" % [ filtertype ]\n\t\t\tend\n\n\t\t\t@attribute = attribute\n\t\t\t@value = value\n\t\t\t@filtertype = filtertype\n\t\tend", "def filter(filter)\n @filters << CGI.escape(filter)\n self\n end", "def new\n\t\t@query = current_user.queries.find(params[:query_id])\n\t\t@filter = @query.filters.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\n end\n end", "def assert_filter(attribute, initial_value, final_value)\n object = create_record(attribute.to_sym => initial_value)\n object.reload\n assert_equal final_value, object.send(attribute), \"#{object}##{attribute}\"\n object.destroy\n end", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def add_transaction_filter(filter)\n @transaction_filters << filter\n end", "def filter(expression = {}, &block)\n case expression\n when SPARQL::Algebra::Expression\n filter_without_expression do |solution|\n expression.evaluate(solution).true?\n end\n filter_without_expression(&block) if block_given?\n self\n else filter_without_expression(expression, &block)\n end\n end", "def filter(*cond, &block)\n clause = (@opts[:having] ? :having : :where)\n cond = cond.first if cond.size == 1\n raise(Error::InvalidFilter, \"Invalid filter specified. Did you mean to supply a block?\") if cond === true || cond === false\n cond = transform_save(cond) if @transform if cond.is_a?(Hash)\n cond = filter_expr(block || cond)\n cond = SQL::BooleanExpression.new(:AND, @opts[clause], cond) if @opts[clause] && !@opts[clause].blank?\n clone(clause => cond)\n end", "def filter!; end", "def _add_filter(where, method_or_filter, options, block)\n self.filters[where] << [method_or_filter, options, block]\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def filter(*args, &block)\n @filter = block ? Filter.new(*args, &block) : args.first\n self\n end", "def parse_line line,header,options,bedfilter,samples,template,stats=nil\n fields = VcfLine.parse(line)\n rec = VcfRecord.new(fields,header)\n r = rec # alias\n\n filter = options[:filter]\n sfilter = options[:sfilter]\n efilter = options[:efilter]\n ifilter = options[:ifilter]\n add_filter = options[:add_filter] # contains a filter name (soft filter)\n seval = options[:seval]\n ignore_missing = options[:ignore_missing]\n quiet = options[:quiet]\n set_filter_field = nil\n\n if sfilter or efilter or ifilter or seval\n # check for samples\n header_samples = header.column_names[9..-1]\n raise \"Empty sample list, can not execute query!\" if not header_samples\n end\n\n # --------------------------\n # Filtering and set analysis\n if bedfilter\n bed = bedfilter.contains(rec)\n return if not bed\n end\n\n skip = lambda { |&m|\n matched = m.call\n if add_filter\n set_filter_field = true if matched\n false # always continue processing with an add-filter\n else\n not matched\n end\n }\n\n if filter\n return if skip.call { rec.gfilter(filter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n \n if sfilter # sample 'or' filter\n rec.each_sample(options[:sfilter_samples]) do | sample |\n return if skip.call { sample.sfilter(sfilter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n end\n\n if ifilter # include sample filter\n found = false\n rec.each_sample(options[:ifilter_samples]) do | sample |\n if sample.ifilter(ifilter,ignore_missing_data: ignore_missing,quiet: quiet)\n found = true\n break\n end\n end\n # Skip if there are no matches\n return if skip.call {found}\n end\n\n if efilter # exclude sample filter\n rec.each_sample(options[:efilter_samples]) do | sample |\n return if skip.call{ sample.efilter(efilter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n end\n\n stats.add(rec) if stats\n\n # -----------------------------\n # From here on decide on output\n \n rec.add_to_filter_field(add_filter) if set_filter_field\n\n if samples\n # Select certain samples for output\n newfields = fields[0..8]\n samples.each do |s|\n newfields << fields[s+9] \n end\n fields = newfields\n end\n if options[:eval] or seval\n begin\n results = nil # result string\n if options[:eval] \n res = rec.eval(options[:eval],ignore_missing_data: ignore_missing,quiet: quiet)\n results = res if res\n end\n if seval\n list = (results ? [] : [rec.chr,rec.pos])\n rec.each_sample(options[:sfilter_samples]) { | sample |\n list << sample.eval(seval,ignore_missing_data: ignore_missing,quiet: quiet)\n }\n results = (results ? results.to_s + \"\\t\" : \"\" ) + list.join(\"\\t\")\n end\n rescue => e\n $stderr.print \"\\nLine: \",line\n $stderr.print \"ERROR evaluating --eval <#{options[:eval]}> #{e.message}\\n\"\n raise if options[:verbose]\n exit 1\n end\n return results.to_s+\"\\n\" if results\n else\n if options[:rdf]\n # Output Turtle RDF\n VcfRdf::record(options[:id],rec,options[:tags])\n elsif options[:template]\n # Use ERB template\n begin\n template.body(binding)\n rescue Exception => e\n $stderr.print e,\": \",fields,\"\\n\"\n $stderr.print e.backtrace.inspect if options[:verbose]\n raise \n end\n elsif options[:rewrite]\n # Default behaviour prints VCF line, but rewrite info\n eval(options[:rewrite]) \n (fields[0..6]+[rec.info.to_s]+fields[8..-1]).join(\"\\t\")+\"\\n\"\n elsif stats\n # do nothing\n else\n # Default behaviour prints VCF line\n fields.join(\"\\t\")+\"\\n\"\n end\n end\nend", "def searchUsing(filter)\n @zqlQuery = filter\n end" ]
[ "0.5810302", "0.55942386", "0.55397385", "0.5403405", "0.5361076", "0.5331779", "0.52745616", "0.5221384", "0.52118", "0.5189971", "0.51821774", "0.5161637", "0.5156447", "0.5105578", "0.50708187", "0.5033136", "0.50254375", "0.5006601", "0.50006294", "0.4998111", "0.49865073", "0.49832478", "0.49702835", "0.49581346", "0.49381483", "0.49358696", "0.49290738", "0.49273503", "0.4924506", "0.4921439", "0.49193984", "0.49032056", "0.48932526", "0.48892254", "0.48643956", "0.48617783", "0.48594728", "0.48524708", "0.48339114", "0.48277688", "0.48208836", "0.48135054", "0.480366", "0.47652495", "0.47604984", "0.47581849", "0.4757368", "0.47530058", "0.47487962", "0.4747206", "0.4747206", "0.47404483", "0.47328696", "0.4726196", "0.47199756", "0.47189787", "0.47189787", "0.47189787", "0.47189787", "0.47189787", "0.47169566", "0.47128847", "0.4704753", "0.47043234", "0.470132", "0.46926337", "0.46643782", "0.4663384", "0.4660381", "0.46597376", "0.46578228", "0.4646039", "0.46401942", "0.4630162", "0.4628734", "0.46250725", "0.46184295", "0.46150866", "0.46064186", "0.46009538", "0.45965382", "0.45944908", "0.45752406", "0.45735988", "0.45721474", "0.4571568", "0.4569888", "0.4566628", "0.45662913", "0.4564855", "0.4556946", "0.45525908", "0.4542434", "0.45410195", "0.45382753", "0.4529893", "0.4529893", "0.4524069", "0.45127785", "0.4509983" ]
0.7674772
0
if user is logged in show review form else show flash message with link to log in (later after login redirect to previous page) redirect to show page
def create @site = Site.find(params[:site_id]) @review = Review.new(review_params) @review.site = @site @review.user = current_user @review.save redirect_to site_path(@site) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view\n if !logged_in?\n\n redirect_to \"/\"\n flash[:notice] = \"You must be logged in to view your module reviews.\"\n end\n end", "def authorize_user_review\n session[:return_to] ||= request.referer\n if current_user != @review.user\n flash[:notice] = \"You didn't write that review\"\n redirect_to session.delete(:return_to)\n end\n\n end", "def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end", "def login_required\n if !logged_in?\n flash[:notice] = \"Log in to edit or delete your post\"\n redirect_to welcome_index_path\n else\n flash[:notice] = \"Alerting you to the monkey on your car!\"\n end\n end", "def req_login\n unless curr_user\n flash[:danger] = \"Login to view this content\"\n redirect_to login_url\n end\n end", "def index\n if user_signed_in?\n redirect_to :controller=>'reviews', :action => 'index'\n end\nend", "def logged_in_customer\n if logged_in?\n if current_person.producer?\n flash[:danger] = \"Content not available for producers.\"\n redirect_back fallback_location: root_url\n end # Else customer is logged in and do nothing\n else\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_producer\n if logged_in?\n if current_person.customer?\n flash[:danger] = \"Content not available for customers.\"\n redirect_back fallback_location: root_url\n end # Else producer is logged in and do nothing\n else\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in to vote\"\n redirect_to login_url\n end\n end", "def show\n @review = Review.new(user: current_user) if user_signed_in?\n end", "def login\n session[:user_id] = nil\n if request.post?\n user = User.authenticate(params[:name], params[:password])\n if user\n session[:user_id] = user.id\n redirect_to({:controller => \"review\", :action => \"list\" })\n else\n flash[:notice] = \"Invalid user/password combination\"\n end\n end\n end", "def update\n #find the individual review\n @review = Review.find(params[:id])\n\n #check to see if you're the poster\n if @review.user != @current_user\n #take it back to homepage\n redirect_to root_path\n else\n #update the new info from the form - update with new info from the form\n if @review.update(form_params)\n #redirect to individual show page\n redirect_to review_path(@review)\n else\n # using this it will render any validation to the main edit page\n render \"edit\"\n end\n end\n end", "def logged_in\n return if logged_in?\n store_forwarding_loc\n flash[:danger] = 'You must be logged in to comment.'\n redirect_to login_url\n end", "def logged_in_user\n \t\tunless logged_in?\n \t\t\tflash[:error] = \"You must be logged in\"\n \t\tredirect_to login_path\n \t\tend\n \tend", "def require_user_like\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to :back\n \n end\n end", "def show\n if !current_user || current_user.status != \"1\"\n redirect_to new_user_session_path\n end\n end", "def show\n if @user.id != session[:user_id]\n redirect_to '/', flash: {error: \"You do not have access to this page\"}\n end\n end", "def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end", "def show \n find_user\n # if !session[:user_id] == params[:id]\n # flash[:message] = \"Restricted Access!!!\"\n end", "def logged_in_user\n unless logged_in? #Unless a user is logged in, run this loop\n store_location\n flash[:danger] = \"Please log in to access this material.\" #Flash warning\n redirect_to login_url #Go to login path\n end\n end", "def login_required\n \t\t redirect_to(root_url, notice: 'You have to be signed in to do that! Top right ~') unless current_user\n \tend", "def user_check\n #check if sighned in?\n if user_signed_in?\n #format.html { redirect_to @post, notice: 'Every Vote Counts.' }\n\n end\n\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end", "def new\n if logged_in?\n # Users who are logged in should not be shown the logon page, per feedback from confused users\n redirect_back_or_home \n elsif request.referer\n # If the user tried to access a page was denied, redirect them to the original page they\n # were denied access to, and not the '/denied' page\n flash[:login_referer_page] = (flash[:denied_path] ? flash[:denied_path] : request.referer)\n end\n end", "def logged_in_golfer\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to view or modify content. Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_golfer\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to view or modify content. Please log in.\"\n redirect_to login_url\n end\n end", "def require_user\n #If not logged in display message then return to home page\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_url_destination\n flash[:danger] = \"please log in.\"\n redirect_to login_path\n end\n end", "def logged_in_user\n unless logged_in?\n \n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def user_login\n unless logged_in?\n navigated_location #stores the location that was navigated before login\n flash[:alert]= \"You Must Be Log In Order To Access that Portion of the Site\" \n redirect_to login_path\n end\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end", "def logged_in_user\n\t \t\tunless logged_in?\n\t \t\t\tstore_location\n\t \t\t\tflash[:danger] = t(:please_login)\n\t \t\t\tredirect_to login_url\n\t \t\tend\n\t \tend", "def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def require_user_like\n if !logged_in?\n flash[:danger] = \"You have to be logged in to perform this action\"\n redirect_to :back\n end\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def require_login\n if session[:user_id].blank?\n redirect_to root_url, notice: \"Login is required to perform this action!\"\n end\n end", "def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end", "def show\n if session[:student_current_user].nil?\n @login= false\n else\n @login=true\n end\n end", "def show\n if user_signed_in? && current_user.admin?\n @new_review = NewReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @new_review }\n end\n else\n redirect_to root_path\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\" #\n redirect_to login_url\n end\n end", "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = t(\"users.edit.danger\")\n redirect_to login_url\n end\n end", "def logged_in_user\n\tunless logged_in?\n\t\tflash[:danger] = \"please log in.\"\n\t\tredirect_to login_url\n\t\t\n\tend\n\t\nend", "def logged_in_user\n store_location unless logged_in?\n flash[:info] = 'Please log in.' unless logged_in?\n redirect_to login_url unless logged_in?\n end", "def logged_in_user\n unless logged_in?\n # store current location to automatically redirect user after login\n store_location\n # show a flash message on the page\n flash[:danger] = \"Per favore effettua il login\"\n # redirect user to login page\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to visit this page\"\n redirect_to login_url\n end\n end", "def logged_in_user\n\tunless logged_in?\n\tstore_location\n\tflash[:danger] = \"Please log in.\"\n\tredirect_to login_url\n\tend\n\tend", "def require_login\n unless current_user\n flash[:error] = \"You must be logged in to do that.\"\n redirect_back fallback_location: root_path\n end\n end", "def require_login\n if current_user.nil?\n flash[:alert] = \"Please sign in to see this content.\"\n redirect_to :root\n end\n end", "def require_user\n if !logged_in?\n # flash message\n flash[:danger] = \"You must be logged in to perform that action.\"\n # and redirect to index page\n redirect_to root_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n #this only runs if the user is NOT logged in\n #logged_in method comes from the sessions helper file, and returns a boolean\n unless logged_in?\n #this method comes from the sessions_helper file. it stores where you were trying to go, so that after you log in, it will get you there. reference comments in the helper file.\n store_location\n #adds a flash - it is not flash.now because it is redirected to the login page, so that login page counts as a new request which is what we want.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url(@user)\n end\n end", "def login_required\n if session[:user_id]\n @user = current_user if @user.nil?\n return true if @user\n end\n flash[:warning]='Please login to continue'\n session[:return_to]=request.fullpath\n redirect_to :controller => \"user\", :action => \"login\"\n return false \n end", "def security\n if !logged_in?\n flash[:login_please] = \"Please Exist\"\n redirect_to login_path\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def logged_in_user\n\t\tunless logged_in?\n\t\tstore_location\n\t\tflash[ :danger] = \"Please log in\"\n\t\tredirect_to login_url\n\tend\n\tend", "def redirect_if_user_logged_in\n return unless user_logged_in?\n\n flash[:danger] = t('errors.access_denied')\n redirect_to edit_polymorphic_path(current_user)\n end", "def logged_in_user\n return if logged_in?\n store_location\n flash[:danger] = t \"flash.login_required\"\n redirect_to login_url\n end", "def post_login\n \t\tif logged_in?\n \t\t\tflash[:error] = \"You are already logged in as #{current_user_full_name}\"\n \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n \t\telse\n\t \t\tcurrent_user = User.find_by_login(params[:login])\n\t\t\t\tif(current_user == nil) then\n\t\t\t\t\t# If no user exists with the given login, redisplay login form with error message.\n\t \t\t\t\tflash[:error] = \"Invalid username\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telsif(!current_user.password_valid?(params[:password])) then\n\t\t\t\t\t# If incorrect password, display error message\n\t\t\t\t\tflash[:error] = \"Invalid password\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telse\n\t\t\t \t\t# Upon successful login, stores user id in session where it can be checked by other code and\n\t\t\t \t\t# redirects to the page displaying the user's photos.\n\t\t \t\t\tsession[:current_user_id] = current_user.id\n\t\t \t\t\tflash[:success] = \"Welcome, #{current_user_first_name}!\"\n\t\t \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n\t \t\t\tend\n\t \tend\n \tend", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = t 'login_message'\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in to access this page.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"You must be logged in to use this feature. Please login or make an account.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless current_user\n flash[:danger] = \"Please log in.\"\n redirect_to log_in_path\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end", "def show\n if (is_signed_in)\n @preview=true; #the same user is viewing the profile.\n puts(\"------- DEBUG ------------\" + session[:user].to_s)\n else\n @preview = false;\n end\n\n if params[:id]== (\"sign_in\")\n redirect_to :controller => 'authentication',:action => 'show'\n end\n if params[:id]== (\"sign_out\")\n redirect_to :controller => 'authentication',:action => 'destroy'\n end\n if params[:id]== (\"uploads\")\n redirect_to :controller => 'users',:action => 'uploads'\n\n end\n\n end", "def no_log_show\n if !session[:user_id]\n flash[:notice] = \"Please log in or sign up!\"\n redirect_to root_path\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: \"Please log in.\" }\n end\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end \n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform the action\"\n redirect_to login_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in to view this page.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n\t store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in? #this is equivalent to if !logged_in? or user is not logged in\n store_location #session help method that stores the accessed url\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def signed_in\n unless session[:companion_id]\n flash[:notice] = \"You must be logged in to add a comment\"\n redirect_to :back\n end\n end", "def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n end", "def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n\tunless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in.\"\n\t redirect_to login_url\n\tend\n end", "def logged_in_user\n unless user_logged_in?\n store_location\n flash[:danger] = 'Please log in.'\n redirect_to login_url\n end\n end", "def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end", "def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end", "def logged_in_user\n unless logged_in\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:negative] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\tend\n end", "def logged_in_user\n unless current_user\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def logged_in_user\r\n unless logged_in?\r\n flash[:danger] = \"Please log in.\"\r\n redirect_to login_url\r\n end\r\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to login_path\n end\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def show\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\n\tend", "def show\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\n\tend" ]
[ "0.787887", "0.7670798", "0.7043299", "0.70101374", "0.69598126", "0.6876825", "0.6833981", "0.6822782", "0.6781194", "0.6780646", "0.67798996", "0.6768844", "0.676586", "0.67054856", "0.66735727", "0.66675806", "0.6666045", "0.66397005", "0.6639458", "0.6632791", "0.6613093", "0.658983", "0.6583619", "0.6571244", "0.6534875", "0.65307045", "0.65307045", "0.65226877", "0.6512423", "0.6504885", "0.65046066", "0.649354", "0.64818144", "0.6477186", "0.6467814", "0.64582324", "0.64571023", "0.64571023", "0.645047", "0.64438564", "0.64432037", "0.6442102", "0.6441682", "0.6407715", "0.6406801", "0.64043427", "0.6402994", "0.6398835", "0.6395516", "0.63932747", "0.638391", "0.6382265", "0.6374799", "0.6373832", "0.6372578", "0.63724095", "0.6366599", "0.6365719", "0.63645625", "0.6360155", "0.6356884", "0.6352775", "0.63527435", "0.63522303", "0.63449645", "0.6343599", "0.6337822", "0.6337097", "0.6336899", "0.63340616", "0.6325506", "0.6318914", "0.6318545", "0.63129836", "0.63109267", "0.6307942", "0.63070023", "0.63067734", "0.6305774", "0.63027513", "0.6302714", "0.6302313", "0.63011", "0.63007444", "0.63007444", "0.63003457", "0.6299608", "0.6299425", "0.6295608", "0.6293801", "0.62925446", "0.62924737", "0.62913024", "0.62908274", "0.6290176", "0.6289045", "0.6289011", "0.6289002", "0.6288427", "0.6282931", "0.6282931" ]
0.0
-1
Check the categories calendar to control "free sales / stop sales" == Parameters: from:: The starting date to:: The ending date == Returns: An array of String that represents available category codes
def categories_available(from, to) not_available_event_type = ::Yito::Model::Calendar::EventType.first(:name => 'not_available') condition = Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('event_type', '$eq', not_available_event_type), Conditions::JoinComparison.new('$or', [Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('from','$lte', from), Conditions::Comparison.new('to','$gte', from) ]), Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('from','$lte', to), Conditions::Comparison.new('to','$gte', to) ]), Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('from','$eq', from), Conditions::Comparison.new('to','$eq', to) ]), Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('from', '$gte', from), Conditions::Comparison.new('to', '$lte', to)]) ] ), ] ) not_available_calendars = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map { |item| item.calendar.id }).to_a categories_with_calendar = ::Yito::Model::Booking::BookingCategory.all(active: true).select { |cat| not cat.calendar.nil? } calendars = categories_with_calendar.map { |cat| {:code => cat.code, :calendar => cat.calendar.id} } calendars.select! { |cal| not_available_calendars.index(cal[:calendar]) == nil } calendars.map { |cal| cal[:code] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_payment_enabled(from, to)\n\n if SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n ::Yito::Model::Booking::BookingCategory.all.map { |item| item.code }\n else\n\n payment_enabled = ::Yito::Model::Calendar::EventType.first(:name => 'payment_enabled')\n\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('event_type', '$eq', payment_enabled),\n Conditions::Comparison.new('from', '$lte', from),\n Conditions::Comparison.new('to', '$gte', to)])\n\n cat_payment_available = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map {|item| item.calendar.name}).to_a\n\n end\n\n end", "def build_cal from, to\n (from..to).map{ |d| [d.month, d.year ] }.uniq.map { |m,y|\n `cal #{m} #{y}`\n }.join(\"\\n\").split(/\\n/)\n end", "def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end", "def category categories\n categories = categories.to_a if !categories.is_a? Array\n categories.collect { |i| calendars.find_by_title i.to_s }.compact\n end", "def category_in_bounds(swy, swx, ney, nex, category_id, to_return = 10, start_from = 0)\n results_from_search many.within_bounds_in_category(swy, swx, ney, nex, category_id, to_return, start_from)\n end", "def get_app_traffic(start_date, end_date)\n total_vc = Array.new\n while start_date.next_week < end_date\n total_vc.push get_all_viewcounts(start_date.utc, start_date.next_week.utc)\n start_date = start_date.next_week\n end\n total_vc\n end", "def city_openings(start_date, end_date)\n date_range = (Date.parse(start_date)..Date.parse(end_date))\n listings.collect do |listing|\n available = true\n listing.booked_dates.each do |date|\n if date_range === date\n available = false\n end\n end\n listing if available\n end\n end", "def current_businesses\r\n ct = Localization::localizer.now()\r\n current_date = ::Date.new(ct.year, ct.month, ct.day)\r\n businesses = []\r\n unit_contracts.each do | uc |\r\n if ( (current_date >= uc.start_date) && \r\n ((uc.end_date.nil?) || (current_date < uc.end_date )) )\r\n businesses << uc.business\r\n end\r\n end\r\n \r\n return businesses\r\n end", "def scheduled_projects_ics(start_date = Date.today, end_date = 8.days.from_now)\n calendar = Icalendar::Calendar.new\n selected_entries_started = entries.where(start_date: start_date.to_date...end_date.to_date).all\n selected_entries_ended = entries.where(end_date: start_date.to_date...end_date.to_date).all\n selected_entries_started.concat(selected_entries_ended).uniq.each do |entry|\n calendar.add_event(entry.to_ics)\n end\n calendar\n end", "def calculate_searches_for_years(from, to)\n case to - from\n when -1\n []\n when 0,1\n [[from, 0]] + calculate_searches_for_years(from + 1, to)\n when 2,3\n [[from + 1, 1]] + calculate_searches_for_years(from + 3, to)\n when 4,5,6,7,8\n [[from + 2, 2]] + calculate_searches_for_years(from + 5, to)\n else\n [[from + 5, 5]] + calculate_searches_for_years(from + 10, to)\n end\n end", "def places_in_categories_within_bounds(categories, bounds, to_return = 10, start_from = 0)\n results_from_search many.places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude], to_return, start_from)\n end", "def create_occurrences\n if (from_date && to_date)\n current_date = from_date\n #this does not include the final date, could change so it does\n while (current_date < to_date)\n\n occurrence_end = current_date + event_length\n\n if(current_date.wday == recurring_day) #in case start date is not the right day of week\n occurrence_date.create( {start: current_date, end: occurrence_end})\n end\n\n case frequency\n when \"weekly\"\n current_date = current_date + 7.days\n if (recurring_day)\n current_date = current_date.beginning_of_week + recurring_day\n end\n when \"monthly\" ## need option to select which month month\n current_date = current_date + 1.month\n if(recurring_day && recurring_day_order)\n beginning_of_month= current_date.beginning_of_month\n current_date = week_day_of_month(beginning_of_month, recurring_day, recurring_day_order)\n end\n when \"daily\"\n current_date = current_date.next_day\n else\n console.log(\"not a valid frequency\")\n end\n end\n end\n end", "def choose_dates\n authorize! :choose_dates, :Reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n\n @start_date = Date.today.next_month.beginning_of_month\n\n # pick_up_dates is the first full week of next month starting from the first weekday\n @pick_up_start_date = @start_date\n @pick_up_start_date += 1.days until @pick_up_start_date.wday == 1 # wday 1 is monday, etc.\n @pick_up_dates = @pick_up_start_date..(@pick_up_start_date + 5.days)\n\n # return_dates is the last full week of next month ending on the last weekday\n @return_end_date = Date.today.next_month.end_of_month\n @return_end_date -= 1.days until @return_end_date.wday == 1 # wday 1 is monday, etc.\n @return_dates = (@return_end_date)..(@return_end_date + 5.days)\n @end_date = @return_dates.last\n end", "def calc_business_days_for_range(start_date, end_date)\n total = 0\n return total if start_date.blank? or end_date.blank?\n (start_date..end_date).each do |date|\n total += 1 unless date.saturday? or date.sunday? or \n date.thanksgiving? or date.labor_day? or date.memorial_day? or\n date.christmas? or date.christmas_eve? or date.independence_day? or\n date.black_friday? or date.new_years_day?\n end\n return total\n end", "def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end", "def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end", "def clil_categories_codes\n self.clil_categories.map { |c| c.code }.uniq\n end", "def bisac_categories_codes\n self.bisac_categories.map { |c| c.code }.uniq\n end", "def holidays(range=(Date.today..Date.today.next_month))\n output = []\n @tokens.each do |token|\n if ALL_HOLIDAYS.include?(token)\n return HOLIDAYS.values.map do |dates|\n dates.call(range)\n end.flatten.uniq\n end\n HOLIDAYS.each_pair do |labels,dates|\n if labels.include?(token)\n output.concat(dates.call(range))\n end\n end\n end\n output\n end", "def periods_critical_days(periods, date_from, date_to)\n critical_days = {}\n periods.each do |period|\n period.critical_days.each do |critical_day|\n if critical_day.date >= date_from && critical_day.date <= date_to\n critical_days[critical_day.date.to_s] = critical_day\n end\n end\n end\n critical_days\n end", "def event_categories\n data.event_categories\n end", "def calculate(from_date, to_date)\n calendar_days_between(from_date, to_date)\n end", "def transactions_in_date_range(from_date, to_date, transaction_type = :all)\n validate_transaction_type transaction_type\n\n from_date = format_date from_date\n to_date = format_date to_date\n\n url = \"history/transactions/#{transaction_type.to_s.upcase}/#{from_date}/#{to_date}\"\n\n @dealing_platform.gather url, :transactions, AccountTransaction\n end", "def check_available_dates(dress_size, month, year)\n\t\tdates = []\n\t\tstart_date = Date.parse(\"#{year}-#{month}-1\")\n\t\tend_date = start_date.end_of_month\n\t\tfor date in start_date..end_date\n\t\t\tif can_make_reservation?(dress_size, date) and !date.saturday? and !date.sunday?\n\t\t\t\tdates << date\n\t\t\tend\n\t\tend\n\t\treturn dates\n\tend", "def approved_sell_categories\n @approved = ApprovedSellCat.where(trader_id: current_trader.id, status: 1)\n @approved_cat = Array.new(@approved.length)\n count = 0\n @approved.each do |f|\n @approved_cat[count] = f.sell_cat\n count = count + 1\n end\n return @approved_cat\n end", "def get_all_viewcounts(start_date, end_date)\n view_counts = Viewcount.where(created_at: start_date..end_date).count\n formatted_vc = Array.new\n formatted_vc.push end_date.to_f * 1000\n formatted_vc.push view_counts\n formatted_vc\n end", "def availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21))\n PrioTicket::Availabilities.find(distributor_id: distributor_id, ticket_id: ticket_id, identifier: identifier, from_date: from_date, until_date: until_date) \n end", "def range_check(date)\n if date < @start_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh menor que #{@start_date} -> #{@end_date}\"\n build(date - 2.days, @end_date, @holidays)\n elsif date > @end_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh maior que #{end_date}\"\n build(@start_date, date + 252.days, @holidays)\n end\n end", "def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_date+21\n @date_range = (@start_date..@end_date)\n @weeks = @date_range.to_a.in_groups_of(3)\n\n\n end", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def calendar(from_date = nil, to_date = nil)\n if @calendar.nil?\n logger.debug \"Building project calendar\"\n\n # Establish the bounds of the calendar\n @calendar = ActiveSupport::OrderedHash.new()\n from_date = sprints.values.first.start_date if from_date.nil?\n to_date = Date.today() if to_date.nil?\n sprint_label = nil\n\n # Add all days between start date and today\n (from_date..to_date).each_with_index do |cur_date, day_index|\n\n date_key = cur_date.as_sortable_date\n sprint_label = sprint_schedule.fetch(date_key, sprint_label)\n day_of_sprint = cur_date.days_from(sprint.from_date).to_i\n week_of_sprint = day_of_sprint / 7\n week_index = day_index / 7 # week_index is the number of weeks that have passed since the start of the calendar\n # weekday_index = cur_date.wday\n # weekday = cur_date.strftime('%A') # Sunday\n\n # Build up a reference table with date and sprint data\n @calendar[date_key] = {\n :date => cur_date,\n :uweek => cur_date.strftime('%U').to_i + 1,\n :day_index => day_index + 1,\n :week_index => week_index,\n :day_of_sprint => day_of_sprint,\n :week_of_sprint => week_of_sprint,\n :sprint => sprints[sprint_label],\n :issue_types => {}, # TODO: Add a key for each type initilized to {:created => 0}\n :assignees => {}, # TODO: Add a key for each user initilized to {:created => 0}\n }\n # puts \"#{date_key} : #{week_index} : #{day_index} : Sprint #{sprint.label} (#{days_in_sprint}): #{week_of_sprint} : #{day_of_sprint} : #{cur_date.weekend?} : #{weekday} (#{weekday_index})\"\n\n end\n end\n @calendar\n end", "def adv_categories\n return ['AIR', 'BIKING', 'CULTURAL', 'CAMPING', 'MOTOR', 'CLIMBING', 'HIKING', 'SNOW', 'WATER', 'OTHER']\n end", "def categories\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @categories = @categories.select { |x| x.accessible? }\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n @fee_category_present = FinanceFeeCategory.first\n # @fixed_categories = @categories.reject { |c| !c.is_fixed }\n # @other_categories = @categories.reject { |c| c.is_fixed }\n end", "def forecast_charged(date_from, date_to)\n query = <<-QUERY\n select sum(o.total_pending) as total, DATE_FORMAT(oi.date, '%Y-%m') as period \n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n WHERE oi.date >= '#{date_from}' and \n oi.date < '#{date_to}' and\n o.status NOT IN (1,3)\n group by period\n QUERY\n @repository.adapter.select(query)\n end", "def forecast_charged(date_from, date_to)\n result = {total: 0, detail: {}}\n month = date_from.month \n year = date_from.year\n last_month = date_to.month\n last_year = date_to.year\n until (month == last_month && year == last_year) do\n result[:detail].store(\"#{year}-#{month.to_s.rjust(2, '0')}\", 0)\n if month == 12\n month = 1\n year += 1\n else\n month += 1\n end\n end\n data = query_strategy.forecast_charged(date_from, date_to)\n data.each do |item| \n result[:total] += item.total\n result[:detail][item.period] += item.total\n end\n return result\n end", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def events(from, to)\n results = applescript EVENT_SCRIPT,\n as_ruby: true,\n args: [from.strftime('%d/%m/%Y %H:%M'), to.strftime('%d/%m/%Y %H:%M')]\n\n results.map do |result|\n Waddup::Event.new do |e|\n e.label = result[:summary]\n e.at = Time.parse(result[:start_date])\n e.until = Time.parse(result[:end_date])\n e.source = self\n end\n end\n end", "def choose_dates\n # Not multiple dates - just return the From date.\n return [@from] unless @multiple_dates\n\n # Multiple dates - return the array, adjusted as per input\n all_days = (@from..@to).to_a\n\n case @select\n when 'days'\n days = @dates.gsub(/\\s/, '').split(',')\n all_days.select { |date| days.include?(date.mday.to_s) }\n when 'specific_days'\n days = @specific_dates.gsub(/\\s/, '').split(',')\n days.map(&:to_date)\n when 'weekdays'\n raise DateChooserException, 'No days of the week selected' if @weekdays.weekdays.empty?\n raise DateChooserException, 'No weekly interval selected' if @interval&.empty?\n\n all_days.select do |date|\n next unless @weekdays.has_day?(date.wday)\n\n case @interval[:unit]\n when 'week'\n # 0 = first week, 1 = second week, 2 = third week, etc.\n nth_week = (date - @from).to_i / 7\n # true every 2nd week (0, 2, 4, 6, etc.)\n (nth_week % @interval[:level].to_i).zero?\n when 'week_of_month'\n week = @interval[:level].to_i\n (date.mday > (week - 1) * 7 && date.mday <= week * 7)\n end\n end\n else\n all_days\n end\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def build_dates\n from = @start_date || @settlement\n temp = from\n\n @accrual_dates = []\n @payment_dates = []\n @periods = []\n\n unless @first_coupon_date.nil?\n from = @first_coupon_date\n @accrual_dates << from\n end\n\n @accrual_dates = @frequency.build(from, @maturity)\n\n @accrual_dates.each do |date|\n @periods << @day_count.period(temp, date)\n @payment_dates << @business_day.next_day(date, @calendar)\n temp = date\n end\n end", "def find_season_type_category_codes\n CategoryType.are_not_relays.is_divided.for_season_type(@season.season_type)\n .for_season(@season)\n .sort_by_age\n .pluck(:code).uniq\n end", "def dates(start_date, end_date)\n @start = start_date.to_date\n @end = end_date.to_date\n @array_array_dates = []\n @range = (@start..@end)\n\n @dates = @range.map do |date|\n @day = date.day\n @month = date.mon - 1\n @year = date.year\n date = []\n date << @year\n date << @month\n date << @day\n @array_array_dates << date\n end\n return @array_array_dates\n end", "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end", "def determine_category_from_contact_type(code)\n case code\n when 1,4,6\n NcsCode.for_list_name_and_local_code('EVENT_DSPSTN_CAT_CL1', 3)\n when 2\n NcsCode.for_list_name_and_local_code('EVENT_DSPSTN_CAT_CL1', 4)\n when 3,5\n NcsCode.for_list_name_and_local_code('EVENT_DSPSTN_CAT_CL1', 5)\n else\n nil\n end\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end", "def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end", "def analyze\n @categories = Violation.unique_categories\n end", "def customers(from=nil, to=nil, sales_channel_code=nil)\n \n conditions = \"(status not in (1,5))\"\n query_parameters = []\n \n if !from.nil? and !to.nil?\n conditions << \"and (bookds_bookings.date_from >= ? and bookds_bookings.date_from <= ?)\"\n query_parameters << from\n query_parameters << to\n end \n\n if sales_channel_code.nil? or sales_channel_code.empty?\n conditions << \"and (sales_channel_code IS NULL or sales_channel_code = '')\" \n elsif sales_channel_code != 'all'\n conditions << \"and (sales_channel_code = ?)\" \n query_parameters << sales_channel_code \n end\n\n conditions.prepend(\"where \") unless conditions.empty?\n\n query = <<-QUERY\n select trim(upper(customer_surname)) as customer_surname, \n trim(upper(customer_name)) as customer_name, \n lower(customer_email) as customer_email, \n customer_phone,\n sales_channel_code,\n locds_address.street as street,\n locds_address.number as number,\n locds_address.complement as complement,\n locds_address.city as city,\n locds_address.state as state,\n locds_address.zip as zip,\n locds_address.country as country \n FROM bookds_bookings \n left join locds_address on locds_address.id = bookds_bookings.driver_address_id\n #{conditions}\n group by trim(upper(customer_surname)), trim(upper(customer_name)), lower(customer_email), customer_phone,\n sales_channel_code, street, number, complement, city, state, zip, country\n order by customer_surname, customer_name\n QUERY\n\n #p \"query: #{query} query_paramaters: #{query_parameters.inspect}\" \n\n if query_parameters.empty?\n repository.adapter.select(query)\n else\n repository.adapter.select(query, *query_parameters)\n end\n\n end", "def in_what_class_at?(start_time, end_time = nil)\n quarter = Quarter.find_by_date(start_time)\n return false if quarter.nil?\n regs = registrations.for(quarter)\n return [] if regs.nil?\n regs.courses.enrolled.select{|c| c.meets_at?(start_time, end_time)}\n end", "def ipo_calendar(from, to, opts = {})\n data, _status_code, _headers = ipo_calendar_with_http_info(from, to, opts)\n data\n end", "def costs_by_category(params = {})\n costs = Hash.new\n options = Hash.new\n params[:from] = self.activated_at if params[:from].blank?\n params[:to] = Time.now if params[:to].blank?\n\n payments.between(params[:from], params[:to]).closed.each do |payment|\n costs[payment.bill.category.name] = 0 if costs[payment.bill.category.name].blank?\n costs[payment.bill.category.name] += payment.amount\n end\n costs\n end", "def list(category: nil, start_date_before: nil, start_date: nil, start_date_after: nil, end_date_before: nil, end_date: nil, end_date_after: nil, limit: nil, page_size: nil)\n self.stream(\n category: category,\n start_date_before: start_date_before,\n start_date: start_date,\n start_date_after: start_date_after,\n end_date_before: end_date_before,\n end_date: end_date,\n end_date_after: end_date_after,\n limit: limit,\n page_size: page_size\n ).entries\n end", "def city_openings(start_date, end_date)\n listings.collect do |listing|\n reservations_in_range = listing.reservations.collect do |reservation|\n reservation.checkin <= end_date.to_date && reservation.checkout >= start_date.to_date\n end\n listing unless reservations_in_range.include?(true)\n end\n end", "def results_within_date_range\n eles = get_entries\n\n from = Date.strptime(summary_from.text, '%m/%d/%Y').strftime('%m/%d/%Y')\n to = Date.strptime(summary_to.text, '%m/%d/%Y').strftime('%m/%d/%Y')\n\n range = (from..to)\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n eles.each do |result|\n the_date = Date.parse(result.find(input_elements[:result_date])['data-absolute-date']).strftime('%m/%d/%Y')\n unless range.include? the_date\n fail(ArgumentError.new(the_date.to_s + ' was not between ' + from.to_s + ' and ' + to.to_s))\n end\n end\n end\n end", "def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end", "def active_classes_by_month events\n event_list = method_events(events)\n event_list.group_by {|e| month_from_date(e.date) }\n .map {|_, es| es.map {|e| e.class_name }.uniq.count }\nend", "def total_off_days(from, to)\n total_off_days = 0\n (from..to).map(&:wday).each do |day|\n total_off_days += 1 if [0, 1].include?(day)\n end\n total_off_days\n end", "def appctrl_dates_from_search( default_start, default_end )\n a = appctrl_date_from_params( :search_range_start ) || default_start\n b = appctrl_date_from_params( :search_range_end ) || default_end\n\n a, b = b, a if ( a > b )\n\n return [ a, b ]\n end", "def category_sets(category)\n category.curriculum_category_sets.map do |category_set|\n complete[category][category_set] = category_set.courses & taken_courses\n\n get_incomplete_from_set(category, category_set)\n end\n end", "def calculate_ffck_category\n season_year = Date.today.year\n user_birth_year = birth_date.year rescue Date.today.year\n case season_year - user_birth_year\n when 0..8; 'Pitchoun'\n when 9; 'Poussin 1'\n when 10; 'Poussin 2'\n when 11; 'Benjamin 1'\n when 12; 'Benjamin 2'\n when 13; 'Minime 1'\n when 14; 'Minime 2'\n when 15; 'Cadet 1'\n when 16; 'Cadet 2'\n when 17; 'Junior 1'\n when 18; 'Junior 2'\n when 19..34; 'Senior'\n when 35..39; 'Veteran 1'\n when 40..44; 'Veteran 2'\n when 45..49; 'Veteran 3'\n when 50..999; 'Veteran +'\n else 'Inconnu'\n end\n end", "def potential_working_days(start_date, end_date)\n days_worked = (start_date..end_date).select do |day|\n day = day.strftime(\"%A\").downcase.to_sym\n works_on?(day)\n end\n days_worked.count\n end", "def get_categories(min = nil, cllimit = 500, clshow = nil, sortkey = true)\n clcontinue = nil\n cls = Array.new\n count = 0\n\n if sortkey \n clprop = \"sortkey\"\n end\n\n loop {\n result = @site.query_prop_categories(@normtitle, clprop, clshow, cllimit, clcontinue)\n if result['query']['pages']['page'].key?('missing')\n raise NoPage.new(), \"Page [[#{@title}]] does not exist\"\n end\n page = result['query']['pages']['page']\n if page['categories']['cl'].is_a? Array\n cls = cls + page['categories']['cl']\n else\n cls.push(page['categories']['cl'])\n end\n\n if result.key?('query-continue')&& min && count < min\n count += lllimit\n clcontinue = result['query-continue']['categories']['clcontinue']\n else\n break\n end\n }\n return cls\n end", "def calcs_for_date_range(start_date, end_date, abandon_rate)\n puts \"\\tFrom #{start_date} to #{end_date} inclusive:\"\n\n total_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day\n ).count\n total_registrations_s = number_with_delimiter(total_registrations)\n puts \"\\tTotal registrations: #{total_registrations}, of which:\"\n\n assisted_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: \"full\"\n ).count\n assisted_digital_registrations_s = number_with_delimiter(assisted_digital_registrations)\n puts \"\\t... assisted digital: #{assisted_digital_registrations_s}\"\n\n fully_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: nil\n ).count\n fully_digital_registrations_s = number_with_delimiter(fully_digital_registrations)\n puts \"\\t... fully digital: #{fully_digital_registrations}\"\n\n delta = total_registrations - assisted_digital_registrations - fully_digital_registrations\n puts \"\\t(delta of #{delta} is due to some registrations not having metaData.route set)\" unless delta.zero?\n\n abandon_rate_s = number_to_percentage(100.0 * abandon_rate, precision: 0)\n non_abandon_rate_s = number_to_percentage(100.0 * (1 - abandon_rate), precision: 0)\n\n total_registrations_started = (total_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_s = number_with_delimiter(total_registrations_started.to_i)\n\n total_registrations_completed = fully_digital_registrations + assisted_digital_registrations + delta\n total_registrations_completed_s = number_with_delimiter(total_registrations_completed)\n\n total_registrations_started_online = (fully_digital_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_online_s = number_with_delimiter(total_registrations_started_online)\n\n total_registrations_abandoned = total_registrations_started - total_registrations_completed\n total_registrations_abandoned_s = number_with_delimiter(total_registrations_abandoned)\n\n puts \"\\tSo including abandoned attempts, estimated orders started = \" \\\n \"#{total_registrations_s} / (1 - #{abandon_rate_s}) = #{total_registrations_started_s}, of which: \"\n puts \"\\t... completed: #{total_registrations_completed_s}\"\n puts \"\\t... abandoned: #{total_registrations_abandoned_s}\"\n\n puts \"\\nSummary:\"\n puts \"\\t1. Total number of transactions started and completed online only: #{fully_digital_registrations_s}\"\n puts \"\\t2. Total number of transactions started online: ESTIMATED: #{total_registrations_started_online_s}\"\n puts \"\\t\\t(Estimated dropoff rate for the last 30 days: #{abandon_rate_s}\"\n puts \"\\t\\t so estimated completion (non-abandoned) rate for the last 30 days: #{non_abandon_rate_s}\"\n puts \"\\t\\t so given #{fully_digital_registrations_s} fully digital orders, \" \\\n \"estimated total orders started online = \" \\\n \"(#{fully_digital_registrations_s}/#{non_abandon_rate_s}) = #{total_registrations_started_online_s})\"\n puts \"\\t3. Number of online claims: #{fully_digital_registrations_s}\"\n puts \"\\t4. Total number of claims (online + offline + unknown): \" \\\n \"#{fully_digital_registrations_s} + #{assisted_digital_registrations_s} + \" \\\n \"#{delta} = #{total_registrations_completed_s}\"\n\n puts \"====================================================================================================\"\n end", "def date_range(items, from, to)\n\n date_range_items = items.reject{ |item| item[\"date\"] < from }\n date_range_items.reject!{ |item| item[\"date\"] > to }\n\n return date_range_items\nend", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def transactions_in_date_range(start_date_text, end_date_text)\n\n the_display_list = []\n\n\n the_start_date, the_end_date = scrubbed_dates(start_date_text,\n end_date_text)\n\n #TODO replace all this with a join returning as_json\n\n\n\n Transaction.where(created_at: the_start_date.beginning_of_day..the_end_date.end_of_day).order(created_at: :desc).all.each do |transaction|\n\n the_display_list << {\n #FIXME we need a join here, not these lookups\n sku_num: ((transaction.sku_id.nil? || (not Sku.exists?(transaction.sku_id))) ? \"NA\" : Sku.find(transaction.sku_id).name),\n description: ((transaction.sku_id.nil? || (not Sku.exists?(transaction.sku_id))) ? \"NA\" : Sku.find(transaction.sku_id).description),\n from: ((transaction.from_id.nil? || (not Location.exists?(transaction.from_id))) ? \"TRANS.IN\" : Location.find(transaction.from_id).name),\n to: ((transaction.to_id.nil? || (not Location.exists?(transaction.to_id))) ? \"TRANS.OUT\" : Location.find(transaction.to_id).name),\n qty: transaction.qty,\n comment: transaction.comment,\n timestamp: transaction.created_at,\n who: ((transaction.user_id.nil? || (not User.exists?(transaction.user_id))) ? \"NA\" : User.find(transaction.user_id).name)}\n\n end\n\n return the_display_list\n\n end", "def holidays_with_bbqs(holiday_supplies)\n bbqs_array = []\n holiday_supplies.each do |season, holiday_hash| \n holiday_hash.each do |day, supplies| \n supplies.each do |supply| \n if supply == \"BBQ\"\n bbqs_array << day \n end\n end\n end\n end\nbbqs_array\nend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def dates(start_at, end_on)\n start_at.to_datetime.step(end_on).select { |d| d.cwday == @day }\n end", "def ffck_categories_detailed()\n ['Pitchoun', 'Poussin 1', 'Poussin 2', 'Benjamin 1', 'Benjamin 2', 'Minime 1', 'Minime 2', 'Cadet 1', 'Cadet 2',\n 'Junior 1', 'Junior 2', 'Senior', 'Veteran 1', 'Veteran 2', 'Veteran 3', 'Veteran +', 'Inconnu']\n end", "def categories\n rpg_shop.handled_categories\n end", "def fetch_month_sheets()\n date = Date.today\n days_in_month = date.end_of_month.day\n for day in ('1'..days_in_month.to_s).to_a\n range = day + \"!\" + ENV[\"CELL_RANGE\"]\n info_list = get_sheet_response(range)\n detect_change_send_email(info_list)\n end \nend", "def valid_conc?(op, range)\n op.input_array(\"Input Array\").each do |field_value|\n conc = field_value.part.get(\"Stock Conc (ng/ul)\".to_sym)\n return false unless range.cover?(conc)\n end\n true\nend", "def category\n business_event_category\n end", "def categories\n category_keys.collect(&:to_s)\n end", "def class_lifeline_ticker es, class_name, upto_date = Time.now.month_start\n active_months = class_months(es, class_name)\n range = month_range(active_months.first, upto_date)\n range.map {|mo| active_months.include?(mo) ? \"*\" : \".\" }.join\nend", "def retrieve_date_range_11\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)\n @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)\n end", "def array_of_valid_end_dates(start_date, bookings)\n\t\tstart_dates = []\n\t\tvalid_end_date_array = []\n\t\tlast_valid_end_date = nil\n\t\tbookings.each { |booking| start_dates << booking[:start_date] }\n\t\tstart_dates.sort!\n\t\tstart_dates.each do |date|\n\t\t\tif last_valid_end_date == nil && date > start_date\n\t\t\t\tlast_valid_end_date = date.prev_day\n\t\t\tend\n\t\tend\n\t\tif last_valid_end_date == nil\n\t\t\tlast_valid_end_date = start_date.next_month\n\t\tend\n\t\tvalid_end_date_array = (start_date..last_valid_end_date).to_a\n\tend", "def booked_dates\n dates = []\n bookings.each do |date|\n range = (date.checkin..date.checkout).to_a\n range.each do |interval|\n dates << interval.strftime(\"%Y-%m-%d\")\n end\n end\n return dates.uniq\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def summrize_stories(from_date, to_date = Date.today)\n stories = current_stories\n story_summaries = Array.new\n (from_date .. to_date).each{|current_date|\n if (current_date <= Date.today) then\n story_summaries << [current_date , aggrigate_story_size_by_date(current_date, stories)].flatten\n else\n story_summaries << [current_date , [nil, nil, nil]]\n end\n }\n story_summaries\n end", "def unavailable_date_ranges_from_today\n self.reservations\n .where('end_date > ?', Date.today())\n .where(status: [1, 5])\n .map {|item| [item.start_date, item.end_date]}\n end", "def on_sale\n all.select {|event| (event.starts..event.ends) === (@date_for_test || Date.today)}\n end", "def find_agenda_item_categories\n @categories = AgendaItemCategory.all(:order => 'name')\n end", "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "def eligible_advocate_categories\n Claims::FetchEligibleAdvocateCategories.for(self)\n end", "def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")}:#{end_time.strftime(\"%M\")}\") - 1.second\n timecode_array << \"#{curr_time.strftime(\"%H\").to_i}:#{curr_time.strftime(\"%M\")}\"\n curr_time = curr_time + 30.minutes\n end\n timecode_array_with_days = []\n %w(monday tuesday wednesday thursday friday saturday sunday).each do |day|\n timecode_array_with_days << timecode_array.collect{|t| \"#{t}_#{day}\"}.flatten if read_attribute(day)\n end\n timecode_array_with_days.flatten\n end", "def data_categories_sheet\r\n @book.worksheet(WBF[:category_sheet])\r\n end", "def get_foot_traffic(start_date, end_date)\n total_rc = Array.new\n while start_date.next_week < end_date\n total_rc.push get_all_redemptions(start_date, start_date.next_week)\n start_date = start_date.next_week\n end\n total_rc\n end", "def get_busy_slots(start_min, start_max, time_zone)\n result = Array.new\n @googleCalendars.each do |x|\n result.push(x[:connection].query([x[:id]],start_min, start_max, time_zone))\n end\n return result\n end", "def retrieve_distinct_categories\n if @distinct_categories\n categories = @distinct_categories\n else\n categories = []\n @team.season_types.each do |season_type|\n season_type.seasons.sort_season_by_begin_date\n .last\n .category_types.are_not_relays\n .sort_by_age.each do |category_type|\n categories << category_type unless categories.rindex { |e| e.code == category_type.code }\n end\n end\n end\n categories\n end", "def events_calendar_display\n\n if params[:category_id]\n current_category = Category.find(params[:category_id])\n if params[:id]\n the_date = Time.parse(params[:id])\n else\n the_date = parse_params_date_or_now_date\n end\n else\n #get the current category or use the general category\n if(controller_name == \"categories\" && params[:id])\n current_category = Category.find(params[:id])\n else\n current_category = categories_not_to_display.first\n end\n the_date = parse_params_date_or_now_date\n end\n\n\n \n \n complete = \"$('spinner-cal').hide(); \" + \"$('the-cal').show()\"\n loading = \"$('spinner-cal').show(); \" + \"$('the-cal').hide(); \"\n\n \n if the_date.year > 2008\n prev_date = \"01-#{the_date.last_month.month}-#{the_date.last_month.year}\"\n prev_month_link = link_to_remote( l(the_date.last_month, :format => 'only_month'),\n :url => { :controller => \"calendar\",\n :action => \"generate\", :category_id => current_category.id, :date => prev_date, :no_day_selection => true},\n :loading => loading, :complete => complete)\n #prev_month_link = link_to( l(the_date.last_month, :format => 'only_month'), category_path(current_category, :date => \"01-#{the_date.last_month.month}-#{the_date.last_month.year}\" ))\n #raise prev_month_link.inspect\n end\n if the_date.year < (Time.now.year+2)\n next_date = \"01-#{the_date.next_month.month}-#{the_date.next_month.year}\"\n next_month_link = link_to_remote( l(the_date.next_month, :format => 'only_month'), :url => { :controller => \"calendar\",\n :action => \"generate\", :category_id => current_category.id, :date => next_date, :no_day_selection => true}, :loading => loading, :complete => complete)\n #next_month_link = link_to( l(the_date.next_month, :format => 'only_month'), category_path(current_category, :date => \"01-#{the_date.next_month.month}-#{the_date.next_month.year}\" ))\n end\n \n calendar(:year => the_date.year, :month => the_date.month, :first_day_of_week => 1, :previous_month_text => prev_month_link, :next_month_text => next_month_link, :the_date => the_date) do |d|\n cell_attrs = {:class => 'day'}\n \n number_of_events = Term.count_occuring_in_the_day(current_category.id, d)\n if number_of_events > 0 \n cell_text = \"<div class='dayEvent'>\"\n cell_text += link_to( \"#{d.mday}\", category_date_path(current_category, :id => \"#{d.day}-#{d.month}-#{d.year}\" ))\n cell_text += \"</div><div class='numberEvent'>#{number_of_events}</div>\"\n\n cell_attrs[:class] = 'specialDay'\n else\n cell_text = \"#{d.mday}<br />\"\n cell_attrs = {:class => 'day'}\n end\n\n # we use the class 'today' if the day is the one selected\n if !params[:no_day_selection]\n if (d.year == the_date.year && d.month == the_date.month && d.day == the_date.day)\n cell_attrs = {:class => 'today'}\n end\n end\n \n [cell_text, cell_attrs]\n end\n\n end", "def historic_trading_by_range(region, start, finish)\n region = AEMO::Region.new(region) if region.is_a?(String)\n\n required_data = []\n (start..finish).map { |d| { year: d.year, month: d.month } }\n .uniq.each do |period|\n required_data += historic_trading(region, period[:year],\n period[:month])\n end\n\n required_data.select do |values|\n values.datetime >= start && values.datetime <= finish\n end\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkassetdepreciation][:period_type]\n\t\tperiod = session[:wkassetdepreciation][:period]\n\t\tfromdate = session[:wkassetdepreciation][:from]\n\t\ttodate = session[:wkassetdepreciation][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def create_calendar_dates(interval, ed_org_id)\n calendar_dates = []\n begin_date = interval.get_begin_date\n end_date = interval.get_end_date\n holidays = interval.get_holidays\n (begin_date..end_date).step(1) do |date|\n if DataUtility.rand_float_to_int(@prng, @scenarioYAML['HACK_PERCENTAGE_CALENDAR_DATES'] || 1) > 0\n if holidays.include?(date)\n calendar_dates << {\"date\" => date, \"event\" => :HOLIDAY, \"ed_org_id\" => ed_org_id}\n else\n calendar_dates << {\"date\" => date, \"event\" => :INSTRUCTIONAL_DAY, \"ed_org_id\" => ed_org_id} if date.wday != 0 and date.wday != 6\n end\n end\n end\n calendar_dates\n end" ]
[ "0.6058778", "0.57509524", "0.5526555", "0.5476436", "0.53019786", "0.52073634", "0.51404333", "0.51291525", "0.5119761", "0.50636834", "0.5048777", "0.5009363", "0.49875358", "0.4975264", "0.49614623", "0.49453184", "0.49319103", "0.49149552", "0.49043623", "0.4886717", "0.48698488", "0.48628148", "0.48587304", "0.48542634", "0.48381153", "0.48246616", "0.48160917", "0.48145312", "0.48094526", "0.4803876", "0.47921512", "0.4786025", "0.4760705", "0.4758911", "0.4755877", "0.47504234", "0.47504234", "0.47355494", "0.47341517", "0.47327876", "0.47281837", "0.47156018", "0.4715448", "0.47088662", "0.470494", "0.4688593", "0.46871284", "0.46861345", "0.46692118", "0.46547595", "0.4645226", "0.46437687", "0.4642224", "0.46372575", "0.4627164", "0.46257013", "0.4622604", "0.46198386", "0.4618434", "0.4611967", "0.46072885", "0.46003622", "0.4600201", "0.45920157", "0.45917115", "0.45888364", "0.4588272", "0.4587888", "0.45861557", "0.45816794", "0.45769227", "0.45769227", "0.4574726", "0.45690086", "0.45686498", "0.45643094", "0.45612198", "0.45601144", "0.45531887", "0.45515862", "0.45501417", "0.4547899", "0.45405984", "0.45398277", "0.45379058", "0.45368242", "0.45311067", "0.4529682", "0.4528167", "0.45214942", "0.45212856", "0.45106202", "0.4505587", "0.4504163", "0.45018008", "0.44942525", "0.4493483", "0.44914404", "0.44903803", "0.4488699" ]
0.7215028
0
Check the categories that allow payment on a date range == Parameters: from:: The starting date to:: The ending date == Returns: An array of String that represents available category codes
def categories_payment_enabled(from, to) if SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool ::Yito::Model::Booking::BookingCategory.all.map { |item| item.code } else payment_enabled = ::Yito::Model::Calendar::EventType.first(:name => 'payment_enabled') condition = Conditions::JoinComparison.new('$and', [Conditions::Comparison.new('event_type', '$eq', payment_enabled), Conditions::Comparison.new('from', '$lte', from), Conditions::Comparison.new('to', '$gte', to)]) cat_payment_available = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map {|item| item.calendar.name}).to_a end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_available(from, to)\n\n not_available_event_type = ::Yito::Model::Calendar::EventType.first(:name => 'not_available')\n\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('event_type', '$eq', not_available_event_type),\n Conditions::JoinComparison.new('$or', \n [Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new('from','$lte', from),\n Conditions::Comparison.new('to','$gte', from)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from','$lte', to),\n Conditions::Comparison.new('to','$gte', to)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from','$eq', from),\n Conditions::Comparison.new('to','$eq', to)\n ]),\n Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('from', '$gte', from),\n Conditions::Comparison.new('to', '$lte', to)]) \n ]\n ),\n ]\n )\n not_available_calendars = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map { |item| item.calendar.id }).to_a\n\n categories_with_calendar = ::Yito::Model::Booking::BookingCategory.all(active: true).select { |cat| not cat.calendar.nil? }\n calendars = categories_with_calendar.map { |cat| {:code => cat.code, :calendar => cat.calendar.id} }\n calendars.select! { |cal| not_available_calendars.index(cal[:calendar]) == nil }\n calendars.map { |cal| cal[:code] }\n\n \t \tend", "def activities_in_date_range(from_date, to_date)\n from_date = format_date from_date\n to_date = format_date to_date\n\n @dealing_platform.gather \"history/activity/#{from_date}/#{to_date}\", :activities, AccountActivity\n end", "def transactions_in_date_range(from_date, to_date, transaction_type = :all)\n validate_transaction_type transaction_type\n\n from_date = format_date from_date\n to_date = format_date to_date\n\n url = \"history/transactions/#{transaction_type.to_s.upcase}/#{from_date}/#{to_date}\"\n\n @dealing_platform.gather url, :transactions, AccountTransaction\n end", "def availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21))\n PrioTicket::Availabilities.find(distributor_id: distributor_id, ticket_id: ticket_id, identifier: identifier, from_date: from_date, until_date: until_date) \n end", "def between(first_date, last_date)\n return [] if first_date > last_date\n current_date = first_date\n active_dates = []\n until current_date >= last_date\n active_dates << current_date if active?(current_date)\n current_date = current_date.next_day\n end\n\n active_dates\n rescue NoMethodError\n p 'provided date is not of valid type'\n nil\n end", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def range_check(date)\n if date < @start_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh menor que #{@start_date} -> #{@end_date}\"\n build(date - 2.days, @end_date, @holidays)\n elsif date > @end_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh maior que #{end_date}\"\n build(@start_date, date + 252.days, @holidays)\n end\n end", "def calculate_searches_for_years(from, to)\n case to - from\n when -1\n []\n when 0,1\n [[from, 0]] + calculate_searches_for_years(from + 1, to)\n when 2,3\n [[from + 1, 1]] + calculate_searches_for_years(from + 3, to)\n when 4,5,6,7,8\n [[from + 2, 2]] + calculate_searches_for_years(from + 5, to)\n else\n [[from + 5, 5]] + calculate_searches_for_years(from + 10, to)\n end\n end", "def city_openings(start_date, end_date)\n date_range = (Date.parse(start_date)..Date.parse(end_date))\n listings.collect do |listing|\n available = true\n listing.booked_dates.each do |date|\n if date_range === date\n available = false\n end\n end\n listing if available\n end\n end", "def category_in_bounds(swy, swx, ney, nex, category_id, to_return = 10, start_from = 0)\n results_from_search many.within_bounds_in_category(swy, swx, ney, nex, category_id, to_return, start_from)\n end", "def get_drs_from_range(start_date, end_date)\n self.delta_requests.select do |dr|\n begin\n dr.start_time > start_date and dr.start_time < end_date\n rescue\n false\n end\n end\n end", "def vacancy_list_by_date(in_date, out_date)\n list = []\n in_date.upto(out_date - 1) do |date|\n if Vacancy.find_by_property_id_and_in_date(self.id, date)\n list.push true\n else\n list.push false\n end\n end\n list\n end", "def results_within_date_range\n eles = get_entries\n\n from = Date.strptime(summary_from.text, '%m/%d/%Y').strftime('%m/%d/%Y')\n to = Date.strptime(summary_to.text, '%m/%d/%Y').strftime('%m/%d/%Y')\n\n range = (from..to)\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n eles.each do |result|\n the_date = Date.parse(result.find(input_elements[:result_date])['data-absolute-date']).strftime('%m/%d/%Y')\n unless range.include? the_date\n fail(ArgumentError.new(the_date.to_s + ' was not between ' + from.to_s + ' and ' + to.to_s))\n end\n end\n end\n end", "def date_range(items, from, to)\n\n date_range_items = items.reject{ |item| item[\"date\"] < from }\n date_range_items.reject!{ |item| item[\"date\"] > to }\n\n return date_range_items\nend", "def check_available_dates(dress_size, month, year)\n\t\tdates = []\n\t\tstart_date = Date.parse(\"#{year}-#{month}-1\")\n\t\tend_date = start_date.end_of_month\n\t\tfor date in start_date..end_date\n\t\t\tif can_make_reservation?(dress_size, date) and !date.saturday? and !date.sunday?\n\t\t\t\tdates << date\n\t\t\tend\n\t\tend\n\t\treturn dates\n\tend", "def rule_date_range_validation\n if self and self.from_date > self.to_date\n return [false,\"from_date should be less than to_date\"]\n else\n return true\n end\n end", "def periods_critical_days(periods, date_from, date_to)\n critical_days = {}\n periods.each do |period|\n period.critical_days.each do |critical_day|\n if critical_day.date >= date_from && critical_day.date <= date_to\n critical_days[critical_day.date.to_s] = critical_day\n end\n end\n end\n critical_days\n end", "def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end", "def payment_dates_array_up_to_date(date)\n start_enrollment = self.order('enrollment_date ASC').limit(1).first\n stop_enrollment = self.order('cancel_date DESC').limit(1).first\n \n if start_enrollment and stop_enrollment \n start = start_enrollment.enrollment_date\n stop = stop_enrollment.cancel_date\n payment_dates_array = []\n \n if date < stop_enrollment.cancel_date\n length_in_months = Date.length_in_months_including_last(start, date)\n else\n length_in_months = Date.length_in_months_including_last(start, stop)\n end\n \n length_in_months.times do |add_month|\n payment_dates_array << ((start + Payment::DATE_SPACER) >> add_month)\n end\n return payment_dates_array\n else\n return []\n end \n end", "def in_what_class_at?(start_time, end_time = nil)\n quarter = Quarter.find_by_date(start_time)\n return false if quarter.nil?\n regs = registrations.for(quarter)\n return [] if regs.nil?\n regs.courses.enrolled.select{|c| c.meets_at?(start_time, end_time)}\n end", "def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end", "def array_of_valid_end_dates(start_date, bookings)\n\t\tstart_dates = []\n\t\tvalid_end_date_array = []\n\t\tlast_valid_end_date = nil\n\t\tbookings.each { |booking| start_dates << booking[:start_date] }\n\t\tstart_dates.sort!\n\t\tstart_dates.each do |date|\n\t\t\tif last_valid_end_date == nil && date > start_date\n\t\t\t\tlast_valid_end_date = date.prev_day\n\t\t\tend\n\t\tend\n\t\tif last_valid_end_date == nil\n\t\t\tlast_valid_end_date = start_date.next_month\n\t\tend\n\t\tvalid_end_date_array = (start_date..last_valid_end_date).to_a\n\tend", "def calc_business_days_for_range(start_date, end_date)\n total = 0\n return total if start_date.blank? or end_date.blank?\n (start_date..end_date).each do |date|\n total += 1 unless date.saturday? or date.sunday? or \n date.thanksgiving? or date.labor_day? or date.memorial_day? or\n date.christmas? or date.christmas_eve? or date.independence_day? or\n date.black_friday? or date.new_years_day?\n end\n return total\n end", "def periods_dates(periods, date_from, date_to)\n periods_dates = {}\n periods.each do |period|\n (period.from .. period.to).each do |date|\n periods_dates[date.to_s] = true if date >= date_from && date <= date_to\n end\n end\n periods_dates\n end", "def dates(start_date, end_date)\n @start = start_date.to_date\n @end = end_date.to_date\n @array_array_dates = []\n @range = (@start..@end)\n\n @dates = @range.map do |date|\n @day = date.day\n @month = date.mon - 1\n @year = date.year\n date = []\n date << @year\n date << @month\n date << @day\n @array_array_dates << date\n end\n return @array_array_dates\n end", "def calcs_for_date_range(start_date, end_date, abandon_rate)\n puts \"\\tFrom #{start_date} to #{end_date} inclusive:\"\n\n total_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day\n ).count\n total_registrations_s = number_with_delimiter(total_registrations)\n puts \"\\tTotal registrations: #{total_registrations}, of which:\"\n\n assisted_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: \"full\"\n ).count\n assisted_digital_registrations_s = number_with_delimiter(assisted_digital_registrations)\n puts \"\\t... assisted digital: #{assisted_digital_registrations_s}\"\n\n fully_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: nil\n ).count\n fully_digital_registrations_s = number_with_delimiter(fully_digital_registrations)\n puts \"\\t... fully digital: #{fully_digital_registrations}\"\n\n delta = total_registrations - assisted_digital_registrations - fully_digital_registrations\n puts \"\\t(delta of #{delta} is due to some registrations not having metaData.route set)\" unless delta.zero?\n\n abandon_rate_s = number_to_percentage(100.0 * abandon_rate, precision: 0)\n non_abandon_rate_s = number_to_percentage(100.0 * (1 - abandon_rate), precision: 0)\n\n total_registrations_started = (total_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_s = number_with_delimiter(total_registrations_started.to_i)\n\n total_registrations_completed = fully_digital_registrations + assisted_digital_registrations + delta\n total_registrations_completed_s = number_with_delimiter(total_registrations_completed)\n\n total_registrations_started_online = (fully_digital_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_online_s = number_with_delimiter(total_registrations_started_online)\n\n total_registrations_abandoned = total_registrations_started - total_registrations_completed\n total_registrations_abandoned_s = number_with_delimiter(total_registrations_abandoned)\n\n puts \"\\tSo including abandoned attempts, estimated orders started = \" \\\n \"#{total_registrations_s} / (1 - #{abandon_rate_s}) = #{total_registrations_started_s}, of which: \"\n puts \"\\t... completed: #{total_registrations_completed_s}\"\n puts \"\\t... abandoned: #{total_registrations_abandoned_s}\"\n\n puts \"\\nSummary:\"\n puts \"\\t1. Total number of transactions started and completed online only: #{fully_digital_registrations_s}\"\n puts \"\\t2. Total number of transactions started online: ESTIMATED: #{total_registrations_started_online_s}\"\n puts \"\\t\\t(Estimated dropoff rate for the last 30 days: #{abandon_rate_s}\"\n puts \"\\t\\t so estimated completion (non-abandoned) rate for the last 30 days: #{non_abandon_rate_s}\"\n puts \"\\t\\t so given #{fully_digital_registrations_s} fully digital orders, \" \\\n \"estimated total orders started online = \" \\\n \"(#{fully_digital_registrations_s}/#{non_abandon_rate_s}) = #{total_registrations_started_online_s})\"\n puts \"\\t3. Number of online claims: #{fully_digital_registrations_s}\"\n puts \"\\t4. Total number of claims (online + offline + unknown): \" \\\n \"#{fully_digital_registrations_s} + #{assisted_digital_registrations_s} + \" \\\n \"#{delta} = #{total_registrations_completed_s}\"\n\n puts \"====================================================================================================\"\n end", "def get_app_traffic(start_date, end_date)\n total_vc = Array.new\n while start_date.next_week < end_date\n total_vc.push get_all_viewcounts(start_date.utc, start_date.next_week.utc)\n start_date = start_date.next_week\n end\n total_vc\n end", "def range\n (start_date...end_date) #exclusive date range\n end", "def is_available_between(start_date, end_date)\n number_of_booking = self.bookings.where('(? <= bookings.start_date AND bookings.start_date <= ?)\n OR (? <= bookings.end_date AND bookings.end_date <= ?)\n OR (bookings.start_date <= ? AND ? <= bookings.end_date)\n OR (bookings.start_date <= ? AND ? <= bookings.end_date)',\n start_date, end_date, start_date, end_date, start_date, start_date, end_date, end_date).count\n\n return number_of_booking <= 0\n end", "def holidays(range=(Date.today..Date.today.next_month))\n output = []\n @tokens.each do |token|\n if ALL_HOLIDAYS.include?(token)\n return HOLIDAYS.values.map do |dates|\n dates.call(range)\n end.flatten.uniq\n end\n HOLIDAYS.each_pair do |labels,dates|\n if labels.include?(token)\n output.concat(dates.call(range))\n end\n end\n end\n output\n end", "def places_in_categories_within_bounds(categories, bounds, to_return = 10, start_from = 0)\n results_from_search many.places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude], to_return, start_from)\n end", "def to_range\n start_date..end_date\n end", "def booked_dates\n dates = []\n bookings.each do |date|\n range = (date.checkin..date.checkout).to_a\n range.each do |interval|\n dates << interval.strftime(\"%Y-%m-%d\")\n end\n end\n return dates.uniq\n end", "def is_date_range_visible(from_date, to_date)\n found = false\n if (date_from.text.include? from_date) && (date_to.text.include? to_date)\n found = true\n end\n found\n end", "def dates(start_at, end_on)\n start_at.to_datetime.step(end_on).select { |d| d.cwday == @day }\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = params[:period_type]\n\t\tperiod = params[:period]\n\t\tfromdate = params[:from]\n\t\ttodate = params[:to]\n\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = Date.civil((fromdate.to_s.to_date).year,(fromdate.to_s.to_date).month, 1) unless fromdate.blank?; rescue; end\n\t\t begin; @to = (@from >> 1) - 1 unless @from.blank?; rescue; end\n\t\t if @from.blank?\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\tend \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\t end", "def historic_trading_by_range(region, start, finish)\n region = AEMO::Region.new(region) if region.is_a?(String)\n\n required_data = []\n (start..finish).map { |d| { year: d.year, month: d.month } }\n .uniq.each do |period|\n required_data += historic_trading(region, period[:year],\n period[:month])\n end\n\n required_data.select do |values|\n values.datetime >= start && values.datetime <= finish\n end\n end", "def eligible_advocate_categories\n Claims::FetchEligibleAdvocateCategories.for(self)\n end", "def list_rooms_available_for_date_range(start_date, end_date)\n # Select room if all reservations for the room return false for overlap with the given start date end date\n rooms_available = rooms.select do |room|\n room.reservations.all? { |reservation| date_range_overlap?(start_date, end_date, reservation.check_in, reservation.check_out) == FALSE }\n end\n # If there is no room available, raise an error\n if rooms_available.empty?\n raise NoRoomsAvailableError, \"No rooms are available for this date range\"\n else\n return rooms_available\n end\n end", "def attendance_between_dates_condition\n\t\t\"attendances.attendance_on BETWEEN '#{start_on}' AND '#{end_on}'\"\n\tend", "def transactions_in_date_range(start_date_text, end_date_text)\n\n the_display_list = []\n\n\n the_start_date, the_end_date = scrubbed_dates(start_date_text,\n end_date_text)\n\n #TODO replace all this with a join returning as_json\n\n\n\n Transaction.where(created_at: the_start_date.beginning_of_day..the_end_date.end_of_day).order(created_at: :desc).all.each do |transaction|\n\n the_display_list << {\n #FIXME we need a join here, not these lookups\n sku_num: ((transaction.sku_id.nil? || (not Sku.exists?(transaction.sku_id))) ? \"NA\" : Sku.find(transaction.sku_id).name),\n description: ((transaction.sku_id.nil? || (not Sku.exists?(transaction.sku_id))) ? \"NA\" : Sku.find(transaction.sku_id).description),\n from: ((transaction.from_id.nil? || (not Location.exists?(transaction.from_id))) ? \"TRANS.IN\" : Location.find(transaction.from_id).name),\n to: ((transaction.to_id.nil? || (not Location.exists?(transaction.to_id))) ? \"TRANS.OUT\" : Location.find(transaction.to_id).name),\n qty: transaction.qty,\n comment: transaction.comment,\n timestamp: transaction.created_at,\n who: ((transaction.user_id.nil? || (not User.exists?(transaction.user_id))) ? \"NA\" : User.find(transaction.user_id).name)}\n\n end\n\n return the_display_list\n\n end", "def choose_dates\n authorize! :choose_dates, :Reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n\n @start_date = Date.today.next_month.beginning_of_month\n\n # pick_up_dates is the first full week of next month starting from the first weekday\n @pick_up_start_date = @start_date\n @pick_up_start_date += 1.days until @pick_up_start_date.wday == 1 # wday 1 is monday, etc.\n @pick_up_dates = @pick_up_start_date..(@pick_up_start_date + 5.days)\n\n # return_dates is the last full week of next month ending on the last weekday\n @return_end_date = Date.today.next_month.end_of_month\n @return_end_date -= 1.days until @return_end_date.wday == 1 # wday 1 is monday, etc.\n @return_dates = (@return_end_date)..(@return_end_date + 5.days)\n @end_date = @return_dates.last\n end", "def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\nend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def covering(date_range)\n merge(covering: date_range)\n end", "def costs_by_category(params = {})\n costs = Hash.new\n options = Hash.new\n params[:from] = self.activated_at if params[:from].blank?\n params[:to] = Time.now if params[:to].blank?\n\n payments.between(params[:from], params[:to]).closed.each do |payment|\n costs[payment.bill.category.name] = 0 if costs[payment.bill.category.name].blank?\n costs[payment.bill.category.name] += payment.amount\n end\n costs\n end", "def unavailable_dates\n errors[:base] << \"Unavailable dates.(-1)\" if start_date.present? && start_date < Time.zone.today\n errors[:base] << \"Unavailable dates.(-2)\" if (start_date.present? && end_date.present?) && start_date >= end_date\n errors[:base] << \"Unavailable dates.(-3)\" if (start_time.present? && end_time.present?) && start_time >= end_time\n errors[:base] << \"Unavailable dates.(-4)\" if (day_of_week.present? && week_of_month.present?) && ([0,1].exclude?(day_of_week) && week_of_month == 6)\n end", "def check_availability(params, campsites)\n # make array of inputed dates\n user_dates = (params[:start]..params[:end]).to_a\n\n # get all start and end dates of ALL bookings\n temp_campsites = []\n taken_dates = []\n\n campsites.each do |campsite|\n taken_dates = []\n campsite.bookings.each do |booking|\n # all taken dates for 1 campsite\n taken_dates << ((booking[:start_date].strftime(\"%Y-%m-%d\"))..booking[:end_date].strftime(\"%Y-%m-%d\")).to_a\n end\n\n taken_dates = taken_dates.flatten\n # p user_dates\n # p taken_dates\n if taken_dates[0].nil?\n puts \"No bookings made by anyone - all dates avaiable\"\n temp_campsites << campsite\n elsif user_dates.all? { |date| taken_dates.include?(date)}\n puts \"NO AVAILABLITY\"\n elsif user_dates.all? { |date| !taken_dates.include?(date)}\n puts \"All days avaiable\"\n temp_campsites << campsite\n else\n puts \"some dates avaiable\"\n temp_campsites << campsite\n end\n end\n\n return temp_campsites\n end", "def availabilities_in_week(start_date)\n start = DateTime.strptime(start_date, '%d%m%Y')\n lessons = self.lessons\n lessons_booked = lessons.select{ |l| ((start)..(start + 7.days)).cover?(DateTime.strptime(l.date, '%d/%m/%Y')) }\n availabilities_booked = lessons_booked.map{ |l| l.availability }\n\n return self.availabilities.each_with_index.map do |a, i|\n a.attributes.merge({booked: availabilities_booked.include?(a), date: start + i.days})\n end\n end", "def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end", "def check_dates\n if start_end_dates.count > 0 && !start_end_dates.nil?\n start_end_dates.each do |d|\n return true if d.check_date_ranges\n end\n\n false\n else\n true\n end\n end", "def acceptable_years_in_school\n Array(min_year_in_school..max_year_in_school)\n end", "def qualified_candidates(candidates)\n array = []\n candidates.each do |candidate| \n if experience?(candidate) && languages?(candidate) && last_15_days?(candidate) && over_17?(candidate)\n array << candidate\n end\n end\n array\nend", "def retrieve_date_range_11\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)\n @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)\n end", "def date_include?(date_range)\n # if date >= @checkin_date && date <= @checkout_date\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if start_date >= @checkin_date && end_date <= @checkout_date\n return true\n else\n return false\n end\n end", "def unavailable_date_ranges_from_today\n self.reservations\n .where('end_date > ?', Date.today())\n .where(status: [1, 5])\n .map {|item| [item.start_date, item.end_date]}\n end", "def choose_dates\n # Not multiple dates - just return the From date.\n return [@from] unless @multiple_dates\n\n # Multiple dates - return the array, adjusted as per input\n all_days = (@from..@to).to_a\n\n case @select\n when 'days'\n days = @dates.gsub(/\\s/, '').split(',')\n all_days.select { |date| days.include?(date.mday.to_s) }\n when 'specific_days'\n days = @specific_dates.gsub(/\\s/, '').split(',')\n days.map(&:to_date)\n when 'weekdays'\n raise DateChooserException, 'No days of the week selected' if @weekdays.weekdays.empty?\n raise DateChooserException, 'No weekly interval selected' if @interval&.empty?\n\n all_days.select do |date|\n next unless @weekdays.has_day?(date.wday)\n\n case @interval[:unit]\n when 'week'\n # 0 = first week, 1 = second week, 2 = third week, etc.\n nth_week = (date - @from).to_i / 7\n # true every 2nd week (0, 2, 4, 6, etc.)\n (nth_week % @interval[:level].to_i).zero?\n when 'week_of_month'\n week = @interval[:level].to_i\n (date.mday > (week - 1) * 7 && date.mday <= week * 7)\n end\n end\n else\n all_days\n end\n end", "def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n p ranges\n end", "def bisac_categories_codes\n self.bisac_categories.map { |c| c.code }.uniq\n end", "def list_by_date_range\n\n # TODO\n # raise 400 if \n # invalid :device_id format\n # invalid :date format\n # invalid :from format\n # invalid :to format\n # from > to\n # from > current year\n # to > current year\n\n @device = Device.get_pings_by_date_range(params)\n\n json_response(@device, :ok)\n\n end", "def confirm_date(start_date, end_date)\n confirm = 0\n for booking in @bookings\n if start_date >= booking[0] && start_date < booking[1]\n confirm += 1\n elsif end_date > booking[0] && end_date <= booking[1]\n confirm += 1\n elsif start_date <= booking[0] && end_date >= booking[1]\n confirm += 1\n end\n end\n return confirm\n # if confirmation is 1 then there is a clash. 0 if not.\n end", "def getLeasesByDate(date)\n leases = getLeases()\n today_leases = []\n if leases.length !=0\n leases.each do |lease|\n if lease[\"status\"] == \"accepted\"\n #puts \"Gia na assssssssssssss\"\n #puts lease[\"valid_from\"].split('T')[0]\n #puts date\n #puts lease[\"valid_until\"].split('T')[0]\n if lease[\"valid_from\"].split(' ')[0] <= date && lease[\"valid_until\"].split(' ')[0]>=date\n #puts \"mpika\"\n today_leases << lease\n end\n end\n end\n end\n\n return today_leases\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkassetdepreciation][:period_type]\n\t\tperiod = session[:wkassetdepreciation][:period]\n\t\tfromdate = session[:wkassetdepreciation][:from]\n\t\ttodate = session[:wkassetdepreciation][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend", "def valid_month_interval(arr)\n if k = DATES_MAP[:cardinals][arr.first] \n [k, valid_day_of_week(arr.last)]\n else\n arr.slice(0,1).map {|v| valid_month_date(v) }.uniq.sort\n end\n end", "def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end", "def adv_categories\n return ['AIR', 'BIKING', 'CULTURAL', 'CAMPING', 'MOTOR', 'CLIMBING', 'HIKING', 'SNOW', 'WATER', 'OTHER']\n end", "def dates_of_birth\n raise(ArgumentError, 'Need category to calculate dates of birth') unless category\n Date.new(date.year - category.ages.end, 1, 1)..Date.new(date.year - category.ages.begin, 12, 31)\n end", "def determine_date_range\n case @time_frame\n when 'week' then (@[email protected]_of_week)\n when 'month' then (@[email protected]_of_month)\n end\n end", "def booked_date_range\n { from: :start_date, to: :end_date }\n end", "def find_in_date_range(participant_id:, start_date:, end_date:)\n response = request(\n :get_all_decns_at_issue_for_date_range,\n \"veteranID\": participant_id,\n \"startDate\": start_date,\n \"endDate\": end_date\n )\n response.body[:get_all_decns_at_issue_for_date_range_response][:decns_at_issue_for_date_range]\n end", "def date_range(from_date, until_date, options = {})\n options.symbolize_keys!\n format = options[:format] || :short\n separator = options[:separator] || \"-\"\n\n if format.to_sym == :short\n month_names = I18n.t(\"date.abbr_month_names\")\n else\n month_names = I18n.t(\"date.month_names\")\n end\n\n from_day = from_date.day\n from_month = month_names[from_date.month]\n from_year = from_date.year\n until_day = until_date.day\n\n dates = { from_day: from_day }\n\n if from_date.day == until_date.day && from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_day\"\n dates.merge!(day: from_day, month: from_month, year: from_year)\n elsif from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_month\"\n dates.merge!(until_day: until_day, month: from_month, year: from_year)\n else\n until_month = month_names[until_date.month]\n\n dates.merge!(from_month: from_month, until_month: until_month, until_day: until_day)\n\n if from_date.year == until_date.year\n date_format = \"different_months_same_year\"\n dates.merge!(year: from_year)\n else\n until_year = until_date.year\n\n date_format = \"different_years\"\n dates.merge!(from_year: from_year, until_year: until_year)\n end\n end\n\n I18n.t(\"date_range.#{format}.#{date_format}\", dates.merge(sep: separator))\n end", "def birthdays(from_year:, to_year:)\n rows = []\n\n config_hash.characters.each do |chara|\n (from_year..to_year).each do |year|\n date = Date.parse(\"#{year}/#{chara.birthday}\")\n rows << CalendarRow.new(date: date, chara: chara)\n rescue ArgumentError => e\n # NOTE: うるう年以外で2/29をparseしようとするとエラーになるので握りつぶす\n raise unless e.message == \"invalid date\"\n end\n end\n\n rows.sort_by { |row| [row.date, row.chara.name] }\n end", "def range(c_begin, c_end, alphabet = DEFAULT_ALPHABET)\n any((c_begin..c_end).to_a, alphabet)\n end", "def calculate(from_date, to_date)\n calendar_days_between(from_date, to_date)\n end", "def get_all_viewcounts(start_date, end_date)\n view_counts = Viewcount.where(created_at: start_date..end_date).count\n formatted_vc = Array.new\n formatted_vc.push end_date.to_f * 1000\n formatted_vc.push view_counts\n formatted_vc\n end", "def ineligible_statuses\n ['1 Day Loan',\n '1 Week No Renew',\n '1 Week No Renew Equip',\n '2 Day Loan',\n '24 Hour Loan',\n '3 Day Loan',\n 'Audio Recorder',\n 'Due at Closing',\n 'Journal Loan',\n 'Music CD/DVD',\n 'Pass',\n 'See Note Above',\n 'Two Week Loan']\n end", "def retrieve_date_range\n \t@all = false\n \tif params[:daily_summary][:from].nil? && params[:daily_summary][:to].nil?\n\t @free_period = false\n\t @from, @to = nil, nil\n\t if params[:daily_summary][:period_type] == '1' || (params[:daily_summary][:period_type].nil? && !params[:daily_summary][:period].nil?)\n\t case params[:daily_summary][:period].to_s\n\t when 'today'\n\t @from = @to = Date.today\n\t when 'yesterday'\n\t @from = @to = Date.yesterday\n\t when 'current_week'\n\t @from = Date.today.beginning_of_week(:sunday)\n\t @to = @from + 6\n\t when 'last_week'\n\t @from = Date.today - 7 - (Date.today.cwday - 1)%7\n\t @to = @from + 6\n\t when 'last_2_weeks'\n\t @from = Date.today - 14 - (Date.today.cwday - 1)%7\n\t @to = @from + 13\n\t when '7_days'\n\t @from = Date.today - 7\n\t @to = Date.today\n\t when 'current_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1)\n\t @to = (@from >> 1) - 1\n\t when 'last_month'\n\t @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t @to = (@from >> 1) - 1\n\t when '30_days'\n\t @from = Date.today - 30\n\t @to = Date.today\n\t when 'current_year'\n\t @from = Date.civil(Date.today.year, 1, 1)\n\t @to = Date.civil(Date.today.year, 12, 31)\n\t when 'all'\n\t @all = true\n\t end\n\t elsif params[:free_period] || params[:daily_summary][:period_type] == '2' || (params[:daily_summary][:period_type].nil? && (!params[:daily_summary][:date_from].nil? || !params[:daily_summary][:date_to].nil?))\n\t begin; @from = params[:daily_summary][:date_from].to_s.to_date unless params[:daily_summary][:date_from].blank?; rescue; end\n\t begin; @to = params[:daily_summary][:date_to].to_s.to_date unless params[:daily_summary][:date_to].blank?; rescue; end\n\t @free_period = true\n\t else\n\t # default\n\t end\n\n\t @from, @to = @to, @from if @from && @to && @from > @to\n\telse\n \t @from = params[:daily_summary][:from]\n \t @to = params[:daily_summary][:to]\n end\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkattendance][:period_type]\n\t\tperiod = session[:wkattendance][:period]\n\t\tfromdate = session[:wkattendance][:from]\n\t\ttodate = session[:wkattendance][:to]\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'today'\n\t\t\t@from = @to = Date.today\n\t\t when 'yesterday'\n\t\t\t@from = @to = Date.today - 1\n\t\t when 'current_week'\n\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t@to = Date.today #@from + 6\n\t\t when 'last_week'\n\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t@to = @from + 6\n\t\t when '7_days'\n\t\t\t@from = Date.today - 7\n\t\t\t@to = Date.today\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t when '30_days'\n\t\t\t@from = Date.today - 30\n\t\t\t@to = Date.today\n\t\t when 'current_year'\n\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t@to = Date.today #Date.civil(Date.today.year, 12, 31)\n\t\t end\n\t\t#elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\tend \n\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def dates_in_span_valid?(date_string)\n dates_array = date_string.split(\"-\")\n start_range = dates_array[0]\n begin\n start_range = USDateParse(start_range)\n self.individual_dates_with_no_classes += [start_range]\n rescue\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the date is not parsable.')\n return false\n end\n #also need to check if startdate is before enddate\n if dates_array.length == 2\n end_range = dates_array[1]\n begin\n end_range = USDateParse(end_range)\n if end_range < start_range\n errors.add(:dates_with_no_classes_day, 'Could not add the date range because end date is before start date.')\n return false\n end\n date = start_range\n while date < end_range\n date += 1\n self.individual_dates_with_no_classes += [date]\n end\n rescue\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the date is not parsable.')\n return false\n end\n elsif dates_array.length > 2\n errors.add(:dates_with_no_classes_day, 'Could not verify the date range because the range is not parsable.')\n return false\n end\n return true\n end", "def build_cal from, to\n (from..to).map{ |d| [d.month, d.year ] }.uniq.map { |m,y|\n `cal #{m} #{y}`\n }.join(\"\\n\").split(/\\n/)\n end", "def to_range\n (@start_date..@end_date)\n end", "def get_available_rooms(date_range)\n unavailable_rooms = []\n # Send the room to unavailable rooms if room has a reservation for a specific data_range. \n @reservations.each do |reservation|\n if reservation.daterange.overlap?(date_range) == true\n unavailable_rooms << reservation.room\n end\n end\n # Array substrating total_rooms minus unavailable rooms.\n return @rooms - unavailable_rooms\n end", "def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end", "def available_missions\n MissionCategory.where(\"minimum_balance <= ?\", [balance]).all.map do |c|\n c.missions.all\n end.flatten\n end", "def build_dates\n from = @start_date || @settlement\n temp = from\n\n @accrual_dates = []\n @payment_dates = []\n @periods = []\n\n unless @first_coupon_date.nil?\n from = @first_coupon_date\n @accrual_dates << from\n end\n\n @accrual_dates = @frequency.build(from, @maturity)\n\n @accrual_dates.each do |date|\n @periods << @day_count.period(temp, date)\n @payment_dates << @business_day.next_day(date, @calendar)\n temp = date\n end\n end", "def get_all_paydates_on_days(start_date, end_date, valid_days)\r\n #end the range here instead of end_date so that any payday failling between end_date and this will be included, which will then get paid inside start_date...end_date\r\n first_valid_payday_outside_range = get_next_valid_paydate(end_date)\r\n\r\n result = (start_date..first_valid_payday_outside_range).to_a.select! {|day| is_corresponding_paydate?(valid_days, day)}\r\n result.map! {|day| get_last_valid_paydate(day)}\r\n result.keep_if {|day| (start_date...end_date).cover?(day) }\r\n end", "def all_dates\n return (@start_date...@end_date).to_a\n end", "def dates_of_birth\n raise(ArgumentError, \"Need category to calculate dates of birth\") unless category\n\n Date.new(date.year - category.ages.end, 1, 1)..Date.new(date.year - category.ages.begin, 12, 31)\n end", "def retrieve_date_range_14\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n\n @from, @to = @to, @from if @from && @to && @from > @to\n end", "def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end", "def between_dates(start, finish)\n start = start.chronify(guess: :begin, future: false) if start.is_a?(String)\n finish = finish.chronify(guess: :end) if finish.is_a?(String)\n WWID.new.filter_items(self, opt: { date_filter: [start, finish] })\n end", "def city_openings(start_date, end_date)\n listings.collect do |listing|\n reservations_in_range = listing.reservations.collect do |reservation|\n reservation.checkin <= end_date.to_date && reservation.checkout >= start_date.to_date\n end\n listing unless reservations_in_range.include?(true)\n end\n end", "def items_between(start_date, end_date, opts={})\n items do |obj|\n obj.restriction = { :and =>\n [\n {:is_greater_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>start_date}}}\n ]\n },\n {:is_less_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>end_date}}}\n ]\n }\n ]\n }\n end\n end", "def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end", "def unreserved_rooms_by_date(start_date, end_date)\n dates = date_range(start_date, end_date)\n dates << Date.parse(end_date)\n unreserved_rooms = []\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n unreserved_rooms << room\n end\n end\n return unreserved_rooms\n end", "def find_season_type_category_codes\n CategoryType.are_not_relays.is_divided.for_season_type(@season.season_type)\n .for_season(@season)\n .sort_by_age\n .pluck(:code).uniq\n end", "def between_dates(start_date, end_date)\n start_date = coerce_date(start_date)\n end_date = coerce_date(end_date)\n time_sheet = TimeSheet.new\n each do |record|\n time_sheet << record if record[:date] >= start_date and\n record[:date] <= end_date\n end\n time_sheet\n end" ]
[ "0.7101328", "0.62735635", "0.58970535", "0.56554693", "0.55817103", "0.55375636", "0.55375636", "0.54960567", "0.54903847", "0.542484", "0.54075336", "0.53934556", "0.53893495", "0.53806585", "0.5347599", "0.5340662", "0.5339512", "0.5334514", "0.53178", "0.5295136", "0.5292935", "0.52792543", "0.5267101", "0.5258433", "0.52565885", "0.52485555", "0.52262723", "0.5199203", "0.5194652", "0.51861703", "0.518521", "0.51751155", "0.5139579", "0.5139519", "0.51278514", "0.5127258", "0.5118598", "0.5117916", "0.51091623", "0.5106987", "0.50878495", "0.508633", "0.50811374", "0.5070612", "0.5069431", "0.5069431", "0.5068603", "0.5067145", "0.50620013", "0.5058638", "0.50575435", "0.50569296", "0.5051509", "0.5045733", "0.5041768", "0.50351524", "0.5029743", "0.50254065", "0.50219786", "0.5012463", "0.50114304", "0.50065696", "0.49950984", "0.4989114", "0.49868378", "0.497392", "0.4969361", "0.4958719", "0.49583566", "0.4957747", "0.49520013", "0.4951408", "0.49441725", "0.49414104", "0.4933476", "0.4929781", "0.49285096", "0.49263906", "0.4926213", "0.49235523", "0.49234802", "0.49154285", "0.4913303", "0.49103022", "0.4908905", "0.49087805", "0.4905623", "0.49043307", "0.49038264", "0.4903268", "0.48985758", "0.4897945", "0.48929328", "0.48918754", "0.48910502", "0.48880354", "0.48831993", "0.48823476", "0.4882117", "0.4878685" ]
0.65191936
1
Affiche combien le nom et les pdv
def gets_damage(attack_value) @life_points -= attack_value if @life_points <= 0 @life_points = 0 return " Le joueur #{self.name} a été tué !" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mostrar_dados\n puts \"Partido: #{@nome} - Votos: #{@votos}\" \n end", "def get_txt_panneau\n\t\treturn [mdl_par.panneaux[0].to_s,mdl_par.panneaux[1].to_s]\n\tend", "def listerParticipants\n puts \"\"\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n @participants.each do |participant|\n puts \" #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n end\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n puts \"\"\n end", "def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end", "def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end", "def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end", "def nombre\n m = []\n m << self.padre.nombre unless self.padre.blank?\n m << self.madre.nombre unless self.madre.blank?\n m = m.join('&')\n n = []\n n << self.padre.apepat unless self.padre.blank? \n n << self.madre.apepat unless self.madre.blank?\n n << \"(#{m})\"\n n.join(' ')\n end", "def patients_name\n self.pets.map {|p| p.name}\n end", "def select_inicia_P(names)\n imp= names.select{|nombres|nombres if nombres[0] =='P'} \n print \"los nombres en que inician con P #{imp} \\n\"\nend", "def get_psv\n psv = []\n psv[0] = self.id.to_s\n psv[1] = self.username\n psv[2] = self.fullname\n psv[3] = self.nickname\n psv[4] = self.irc_nick\n psv[5] = self.email\n psv[6] = self.webpage\n psv[7] = self.flickr_username\n psv[8] = self.yahooim_username\n psv[9] = self.gtalk_username\n psv[10] = self.visible\n return \"#{psv[0]}|#{psv[1]}|#{psv[2]}|#{psv[3]}|#{psv[4]}|#{psv[5]}|#{psv[6]}|#{psv[7]}|#{psv[8]}|#{psv[9]}|#{psv[10]}\"\n end", "def infosSauvegardes\n\t\n return requete(\"SELECT nompartie, nomgrille, taillegrille, jokersRestants, grillejouee.datemaj FROM grillejouee INNER JOIN grilleediter ON grillejouee.idGrille=grilleediter.id WHERE joueur = #{@profil.getStats[\"id\"]}\")\n\tend", "def nome_perfil\n \tself.descricao\n end", "def afficheFocusDepartParticipants\n puts \"\"\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n @participants.each do |participant|\n if participant.focus == true\n puts \"* #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n else\n puts \" #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n end\n end\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n puts \"\"\n end", "def namekomplett\n\t\t\t\t vorname.capitalize + \" \" + nachname.capitalize # methode vor und nachname mit leerzeichen\n\t\t\t\tend", "def names\n [\n \"Charge de travail\" , #00\n \"Travail en groupe\" , #01\n \"Maths\" , #02\n \"Codage\" , #03\n \"Théorique\" , #04\n \"Technique\" , #05\n \"Satisfaction\" , #06\n \"Dur à valider\" , #07\n \"Fun\" , #08\n \"Pipo\" , #09\n \"Économie\" , #10\n \"fondamental\" , #11\n \"Difficile à suivre\" , #12\n \"Calcul\" , #13\n \"Professionalisant\" , #14\n \"Étendue du cours\" , #15\n \"Interactivité\" , #16\n \"Culture générale\" , #17\n ]\n end", "def get_info\n @output = \"Voter, #{@name}, #{@politics}\"\n end", "def show_person( title, person )\n\n #puts \"#{title} #{person}\"\n puts \"#{title}\"\n show_field( 'ix', person.index, ' ' )\n show_field( 'cid', person.computing_id, ' ' )\n show_field( 'first_name', person.first_name, ' ' )\n show_field( 'last_name', person.last_name, ' ' )\n show_field( 'department', person.department, ' ' )\n show_field( 'institution', person.institution, ' ' )\n end", "def list_of_politician_and_their_voters\nputs \"REPS and A List of their Voters.\"\n pol_votes = $db.execute(\"SELECT n.name, r.first_name, r.last_name) \n FROM congress_members n, voters r, votes v \n WHERE n.id = v.politician_id AND v.votes_id = r.id \n GROUP BY n.name\")\n \n pol_votes.each {|rep, fn, ln| puts \"#{rep}\"\n puts \"#{fn}\"\n puts \"#{ln}\"}\nend", "def print_personal_list(db, name)\r\n\tputs \"Chores for #{name}\"\r\n\tprint_chores = db.execute(\"SELECT chores.complete_by_day, chores.name FROM chores, family WHERE family.name = ? AND chores.family_id = family.id\", [name])\r\n\tprint_chores.each do |x|\r\n\t\tputs \"#{x[0]} : #{x[1]}\"\r\n\tend\r\nend", "def vampire_questions\n \tputs @prompt\n vampire_name\n vampire_age\n vampire_birth_year\n garlic_bread\n health_insurance\n allergie_checker\n end", "def department_names; end", "def prt\n puts \"Federalist #@fedno\"\n puts \"Title: \" + @title.join(\" \")\n puts \"Publication: \" + @publication.join(\" \")\n puts \"Author: \" + @author.join(\" \")\n \n end", "def show\n # FIXME really this should be the other way around: 'Bank of America' and\n # 'Americard Points' should be 2 separate columns which we join, not split,\n # in the view\n name.sub(/\\s+\\(.*\\)\\s*/, '')\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def show_pasta\n @nameP.each do |pastaType|\n puts \"- #{pastaType}\"\n end\n end", "def print_voters_who_voted_for_politician\n\tputs \"People & Who they voted for\"\n\tputs $db.execute(SELECT name || ' - ' ||GROUP_CONCAT(first_name|| ' ' ||last_name, ', ')FROM congress_members JOIN votes ON congress_members.id = cotes.politician_id JOIN voters ON voters.id = votes.voter_id GROUP BY name)\n\nend", "def diz_adeus\n\t\tif @nomes.nil?\n\t\t\tputs \"...\"\n\t\telsif @nome.respond_to?(\"join\")\n\t\t\t#juntar os elemenos à lista\n\t\t\t#juntando a virgula como separador\n\t\t\tputs \"Adeus #{@nomes.join(\", \")}. Voltem em breve.\"\n\t\telse\n\t\t\tputs \"Adeus #{@nomes}. Volta em breve.\"\n\t\tend\n\tend", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def show\n @organisme.departements.each do |dep|\n logger.debug \"Departement present : \" + dep.description.to_s()\n end\n end", "def to_s\n\t\t\t\"#{@nombre}: #{@proteinas}g de proteínas, #{@glucidos}g de glúcidos y #{@lipidos}g de lípidos\"\n\t\tend", "def print_politicians_votes_recieved\n\tputs \"Votes Recieved by Congress member\"\n\tputs $db.execute(\"SELECT name|| ' - ' ||COUNT(voter_id) FROM votes JOIN congress_members ON(congress_members.id = politician_id GROUP BY name\")\nend", "def npwpd_nama_usaha\n \"#{npwpd} - #{nama_usaha}\"\n end", "def to_s\n\t\t\t \"( Nombre:#{@nombre}, Conjunto Alimentos: #{@la} ,Conjunto Gramos: #{@lg} ,Proteinas :#{@proteinas},Carbo :#{@carbohidratos},Lipidos :#{@lipidos},VCT :#{@vct} )\"\n\n\t\tend", "def cd\n pname_field=self.de\n entries=pname_field.split(\";\")\n entries.each do |entry|\n m=entry.match(/\\s*(.*?):\\s*(.*?)=(.*)/)\n if ( m!=nil)\n if ( (m[1]==\"AltName\") && (m[2]==\"CD_antigen\") )\n return m[3]\n end\n end\n end\n \n return \"\"\n end", "def devolver_nombre \n return @nombre\n end", "def titulares_serial\n Representante.find(self.titular_ids_serial).map(&:nombre)\n end", "def select_names\n q = make_work\n # binding.pry\n names = []\n names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n #names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n names.push(q.collect{|xx| xx[\"drinks\"][1][\"strDrink\"]})\n #binding.pry\n #count +=1\n # end\n \n names\n end", "def list_pokemon_stats\n puts(\"Name: {#name}\")\n puts(\"HP: {#hp}\")\n end", "def mostrar_partidos\n \n puts \" \"\n puts \"Quantidade de votos por partido\"\n \n for partido in @partido\n partido.mostrar_dados \n end\n end", "def title_and_name\n result = []\n result << self.academic_title.name if self.academic_title && self.academic_title != AcademicTitle.no_title\n result << self.name\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end", "def to_s\n i = 0\n temp = \"\"\n for pk in @pl\n i += 1\n temp += i.to_s + \". \" + pk.nombre + \"\\n\"\n end\n temp\n end", "def get_proteinas\n @_100=((@proteinas*100)/@peso)\n @ir_100=(@_100/50)*100\n @porcion=((@proteinas*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/50)*100\n\t\t#p\"| #{@proteinas} | #{@_100} | #{@ir_100.round(1)}% | #{@porcion} | #{@ir_porcion.round(1)}% |\"\n [ @proteinas , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "def show\n @onscrits = Onscrit.order(nom: :asc).to_a\n @votes = Vote.where('pg_id ='+session[:pg_id].to_s+' AND sondage_id ='[email protected]_s).to_a\n end", "def print_execute_titles(execute)\r\n execute.each do |line|\r\n titles = []\r\n line.each do |name, value|\r\n if name.is_a? String\r\n titles << name\r\n end\r\n end\r\n puts titles.join(\"|\")\r\n end\r\nend", "def print_directors(nds)\n pp nds\nend", "def person_name_fields\n \"\".tap do |result|\n fields_for(:person_name) do |f|\n result << f.text_field(:name_prefix)\n result << f.text_field(:first_name)\n result << f.text_field(:middle_name)\n result << f.text_field(:last_name)\n result << f.text_field(:name_suffix)\n end\n end\n end", "def all_names(pokemon)\n pokemon.map do |pokemon_data|\n pokemon_data[:name]\n end\nend", "def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend", "def pokemons_names\n Pokemon.collect do |pokemon|\n pokemon[:name]\n end\nend", "def names\n collect { |n, v|\n n\n }\n end", "def decir_adios\n\t\tif @nombres.nil?\n\t\t\tputs \"...\"\n\t\telsif @nombres.respond_to?(\"join\")\n\t\t\t\tputs \"Adios #{@nombres.join(\", \")}. Vuelvan pronto\"\n\t\telse\n\t\t\t\tputs \"Adios #{@nombres}. Vuelve pronto\"\n\t\tend\n\t\tend", "def salutation_and_title_and_name(dative=false)\n result = []\n result << self.salutation(dative)\n result << self.academic_title.name if self.academic_title && self.academic_title != AcademicTitle.no_title\n result << self.first_name\n result << self.last_name\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end", "def show_name_city\n @cidades = Cidade.order(:nome)\n end", "def partners(duo, where)\n puts duo + where\nend", "def full_name_apellido_paterno\n self.apellido_paterno.to_s + \" \" + self.apellido_materno.to_s + \" \" + self.nombre.to_s\n end", "def guard_name(p)\n [p.first_name, p.last_name, p.relation].join(' ')\n end", "def PersonDetails()\n\t\tgenderList()\n\t\tputs \"\"\n\t\tputs \"Top Male List regarding salary\\n\"\n\t\ttop10salary($MaleList);\n\t\tputs \"\"\n\t\tputs \"Top Female List regarding salary\\n\"\n\t\ttop10salary($FemaleList);\n\tend", "def veichles\n ['Bil', 'Moped', 'Motorsykkel', 'Tungt kjøretøy', 'ATV', 'Buss', 'Sykkel']\n end", "def display_pets\n\t\tpets.join(\"\\n\")\n\tend", "def show\n @mia_tabella = Search.mia_tabella(@search.tabella)\n @mio_campo = Search.mio_campo(@search.campo)\n @mio_tipo = Search.mio_tipo(@search.tipo)\n #\n @descrizione = @search.descrivi()\n end", "def all_deputies_full_names\n names = []\n\n @doc.css('span[class = list_nom]').each do |element|\n names << element.text.strip\n end\n\n names.map { |name| name.split(', ') }.flatten\nend", "def get_verbose_name\n v = get_date_schedule() + ' ' + get_verb_description()\n v = v + self.patient.get_full_name unless self.patient_id.nil? || (self.patient_id == 0)\n v = v + ' ' unless self.notes.blank? || self.patient_id.nil? || self.patient_id == 0\n v = v + self.notes unless self.notes.blank?\n v\n end", "def det\n\t\t\t@frecuencias['determinantes']\n\t\tend", "def setResult(divisores)\t\t\n\t\tcadena=\"\"\n\t\tdivisores.each do |num|\t\t\n\t\t\tcase num\n\t\t\t\twhen 3\n\t\t\t\t cadena = cadena.concat(\"Pling\")\n\t\t\t\twhen 5\n\t\t\t\t cadena = cadena.concat(\"Plang\")\n\t\t\t\twhen 7 \t\n\t\t\t\tcadena = cadena.concat(\"Plong\")\t\t\t\t\n\t\t\tend\t\t\t\t\n\t\tend\n\t\treturn cadena\n\tend", "def lister( les_cours )\n \n recup = recuperer_option \n format = recup[0]\n sep = recup[2]\n if !recup[1].nil?\n cours = les_cours.sort_by(&:sigle)\n end\n \n cours ||= les_cours.select{|c| c.actif?}\n sep ||= CoursTexte::SEPARATEUR_PREALABLES\n cours =cours.sort_by(&:sigle)\n cours.each { |e| puts e.to_s(format, sep) }\n \n return [les_cours, nil]\n \nend", "def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end", "def nombres_p(nombres) \n nombres.select{|x| x =~ /P/} # [\"Paula\", \"Pía\"]\nend", "def show_pe_findings(model)\n columns = Visit.content_columns\n pe_columns = []\n # Get list of all the columns (variables) with form like 'pe_mouth', excluding the matching\n # items, 'pe_mouth_ok' etc. This gives a list of the elements in the physical exam\n for column in Visit.content_columns\n if (column.name.slice(0,VSIZE) == VARBASE) && (column.name.slice(-3,3) != SUFFIX)\n pe_columns << column.name.slice(VSIZE,column.name.size-VSIZE)\n end\n end\n # First, generate list of all the items which have some text.\n s = ''\n for column in pe_columns\n s << ' ' if s > ''\n finding = model.send(VARBASE+column)\n s << (column.capitalize) + ': ' + finding.to_s + '.' unless finding.blank?\n end\n s_findings = s\n s_normal = ''\n # Second, generate a list of items ticked as normal. This could be optional.\n normal_count = 0\n for column in pe_columns\n if (model.send(VARBASE+column+SUFFIX) || 0) == 1 # append the name if ticked\n s_normal << ', ' if s_normal > ''\n s_normal << column\n normal_count = normal_count + 1\n end\n end\n if s_normal > ''\n s_normal << ' all' if normal_count > 1 # just for style, to say 'mouth, eyes ... all normal'\n s_normal << ' normal.'\n end\n\n return s_findings + ' ' + s_normal.capitalize\n end", "def decir_adios\n if @nombres.nil?\n puts \"...\" \n elsif @nombres.respond_to?(\"join\")\n # junta los elementos de la lista usando la coma como separador\n puts \"Adiós #{@nombres.join(\", \")}. Vuelvan pronto.\"\n else\n puts \"Adiós #{@nombres}. Vuelve pronto.\"\n end\n end", "def list_pets\n \"I have #{self.pets[:fishes].length} fish, #{self.pets[:dogs].length} dog(s), and #{self.pets[:cats].length} cat(s).\"\n end", "def listinfo\n puts \"排名:#{@no}\"\n puts \"月份:#{@month}\" if @month\n puts \"标签: #{@subtag}\" if @subtag\n puts \"标题:#{@title}\"\n puts \"集数:#{@episode}\" if @episode\n puts \"链接:#{@link}\"\n puts \"<bilibili独家哟!>\" if @bilibilionly_flag\n puts \"--------------------\"\n end", "def get_proteinas\n \"#{@proteinas}%\" \n end", "def voices\n @voices.each do |name, saying|\n puts name.strip\n end\n end", "def text_pax(p)\n\t \treturn \"#{p[:@name_number]} #{p[:surname]}/#{p[:given_name]} (#{p[:@passenger_type]}) #{p[:@name_reference]}\"\n\t end", "def dumpDpms()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" unless dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"DSM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@dpms.length > 0)\r\n dpms = @dpms.sort\r\n dpms.each do |key, dpm|\r\n puts \"#{dpm.name}\\t(#{dpm.alias})\" if dpm.varType == \"DSM\"\r\n end\r\n\r\n else\r\n puts \"No DSM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n end", "def name_and_email_val_doise\n\tresult = []\n\tlist_url = urls_of_val_doise_townhalls # city pages urls\n\tlist_url.each { |town_url| name, mail = emails_from_webpage(town_url); result.push({:name => name.to_s, :email => mail}) } # name & email from each city\n\tputs result; # un tableau avec le nom et le mail des mairies\nend", "def title_values\n find_record_values(:dc_title)\n end", "def hide_name\n str = \" utente Fiscosport n° \" + self.id.to_s\n if self.comune_id && self.comune\n str += \" - prov. di \" + self.comune.province.name + \" (\" + self.comune.province.sigla + \")\" unless self.comune.province.nil?\n end\n return (str.nil? || str.blank?) ? \"-\" : str\n end", "def nama\n puts \"nama : #{@nama}\"\n puts \"blood : #{@blood}\"\n puts \"manna : #{@manna}\"\n end", "def print_all_type(type_ins)\n type_ins.pokemon_array.each.with_index(1) {|p,i| puts \"#{i}. #{p.name}\"}\n end", "def print_label\n puts \"#{@nombre_etiqueta}\"\n puts \"\\nValor energetico o nutriente | por 100g o 100ml de producto \"\n puts \"--------------------------------|--------------------------------\"\n puts \"valor energetico |\" + \" #{energetic_value_KJ}\" + \" KJ/\" + \"#{energetic_value_Kcal}\" + \" Kcal\"\n puts \"Camtidad de grasas |\" + \" #{@grasa}g\"\n puts \"Camtidad de grasas saturadas |\" + \" #{@grasa_saturada}g\"\n puts \"Camtidad de hidratos de carbono |\" + \" #{@hid_carbono}g\"\n puts \"Camtidad de azucares |\" + \" #{@azucares}g\"\n puts \"Camtidad de proteinas |\" + \" #{@proteinas}g\"\n puts \"Camtidad de sal |\" + \" #{@sal}g\"\n @nombre_etiqueta\n end", "def verProductos()\n for i in (0..$productos.size-1) #filas (i)\n for j in (0..$productos[i].size-1) #columnas (j)\n print \"{$productos[i][j]} \\s\"\n end\n print \"\\n\"\n end\nend", "def get_vct\n \"#{@calorias} kcal\" \n end", "def show\n @pdestaf = Mercadorium.where fabricante: @fabrica.name\n\n end", "def asignaturas_peda_por(profe)\n # per = Horario.where('professor_id = ?', profe.id).joins(:asignatura).where('lectiva=true')\n per = Horario.where('professor_id = ?', profe.id).joins(:asignatura)\n .where('asignaturas.lectiva=TRUE').order('asignaturas.orden')\n a = per.map do |h|\n [\"#{h.asignatura.name} #{h.curso.name} \", \"#{h.horas}\"]\n end\n\n end", "def ausgabe\n\t\t@name\n\tend", "def devolver_proteinas\n\t\treturn @proteinas\n\tend", "def calculate_str_points_det(player_name, det)\r\n s1 = 0\r\n s1 = @points_status[player_name.to_sym][det] if @points_status[player_name.to_sym][det]\r\n str_points = \"\"\r\n case det\r\n when :scopa\r\n str_points = \"Scope: #{s1}\"\r\n when :tot\r\n tot_points = @core_game.game_opt[:target_points]\r\n str_points = \"Punti : #{s1} (#{tot_points})\" \r\n end\r\n \r\n return str_points\r\n end", "def show\n @ciudadDomicilio = @ciudadesColombia.select{|h| h.id == @persona.pers_ciudadDomicilio}.map{|j| j.enter_nombreCorto}.pop\n end", "def show\n if @input.devolucion\n @es_devolucion = \"Devolución\"\n else\n @es_devolucion = [\"Remito: \",@input.remito].join\n end\n end", "def show\n $total = VoteLog.all.count\n ## 임시코드 xxx\n #for k in [email protected]_i\n # instance_variable_set \"@winner_#{k}\" , Voter.where(id: $result[k]).pluck(:studentid).to_s.gsub('{\"studentid\"=>','').gsub('}','')\n #end \n\n ##테스트 코드 xxx\n #@firstwinner = Voter.where(id: $result[0]).pluck(:studentid).to_s.gsub('{\"studentid\"=>','').gsub('}','')\n end", "def list \n @people.each_with_index do |a,i|\n puts \"Entry \" + (i+1).to_s + \": \" + a.fullname\n end\n end", "def ausgabe\n\t\t@name\n\t\n\tend", "def print_reps(input)\n @list = if input != \"ALL\"\n @@all.select { |rep| rep.party.strip == input.to_s }\n else\n @@all\n end\n @list.each_with_index do |rep, index|\n puts <<-DOC\n #{index + 1}. #{rep.name} - Party: #{rep.party.rstrip}, #{rep.district}\n Phone: #{rep.phone}, Email: #{rep.email}\n DOC\n end\n end", "def plant_list\n self.plant_types.order('name').map {|m| m.name}.to_sentence\n end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end", "def names; end" ]
[ "0.5883103", "0.5812132", "0.5741143", "0.56386125", "0.56386125", "0.5598354", "0.55919", "0.5575619", "0.5546636", "0.5527956", "0.54854494", "0.5358714", "0.5345943", "0.53400177", "0.53290886", "0.53200686", "0.5296151", "0.52958256", "0.5294061", "0.5288503", "0.5274722", "0.5252786", "0.525228", "0.52401525", "0.52308345", "0.5229481", "0.5227943", "0.5220044", "0.5218269", "0.52068603", "0.5206647", "0.52060604", "0.52051616", "0.5201854", "0.5193445", "0.5191796", "0.51869375", "0.5186867", "0.51829904", "0.51725525", "0.5169709", "0.51691514", "0.51538754", "0.5151396", "0.5142075", "0.5141057", "0.51337975", "0.5132896", "0.5125597", "0.512031", "0.5101803", "0.5092144", "0.50911605", "0.50781643", "0.5077458", "0.5075851", "0.5066782", "0.506012", "0.50593764", "0.50583714", "0.5049166", "0.5048256", "0.5043622", "0.504262", "0.5042239", "0.503886", "0.5032844", "0.502788", "0.50266486", "0.502395", "0.502315", "0.50150067", "0.5013992", "0.50102144", "0.5007194", "0.49953485", "0.4985186", "0.4983411", "0.49824643", "0.497928", "0.49707037", "0.49703074", "0.49698415", "0.49661902", "0.49661297", "0.49645925", "0.49639577", "0.49621826", "0.49583146", "0.49571905", "0.49549273", "0.4953027", "0.4952691", "0.49499473", "0.4941006", "0.49216044", "0.49216044", "0.49216044", "0.49216044", "0.49216044", "0.49216044" ]
0.0
-1
Affiche le nom, les pdv et le niveau de l'arme d'un HumanPlayer
def compute_damage return rand(1..6) * @weapon_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_players\r\n puts \"Tu as #{human_player.life_points}\"\r\n puts \"il reste #{@enemies.length} bots, courage!!\"\r\n end", "def show_players\n puts \"#{@human_player.name} a #{@human_player.life_points} points de vies\"\n @enemies.each do |mechant|\n puts \"#{mechant.name} a #{mechant.life_points} points de vies\"\n end #end of \"\".each do\" that show mechant name and life points\n end", "def all_player_status\n linebreak\n @players.each{ |p| puts p; linebreak; }\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def show_players\n\t\tputs @human_player.show_state\n\t\tputs \"Il reste #{@enemies.length} ennemies !\"\n\tend", "def examine \n\t\tputs \"Your Description: #{@player.desc}\" \n\t\tputs \"Health Status: #{@player.health}\" \n\tend", "def player_info\n if @health <= 0\n puts \"#{@name} has 0 health remaining!\"\n puts \"\"\n else \n puts \"#{@name} has #{@health} health remaining.\"\n puts \"\"\n \n end\n\n end", "def std_player_names\n\t\tnames = []\n\t\tfor i in 1..Constants::MAX_PLAYERS\n\t\t\tnames << \"Player\" + i.to_s\n\t\tend\n\t\tnames\n\tend", "def print_name_and_health(player)\n puts \"#{player.name.ljust(20,'.')}#{player.score}\"\n player.each_treasure do |treasure|\n puts \"#{treasure.points} points from #{treasure.name}\"\n end\n puts \"...for a grand total of #{player.points} points.\"\n end", "def display_player_stats\n @output.puts '- Players -'.center(WIDTH)\n seperator = \"\\t\"\n stat_width = WIDTH - 5\n stats = String.new\n bot_stats = String.new\n\n stats << \"Player: #{@player.name}\".ljust(WIDTH/2)\n stats << seperator\n stats << \"Chips: #{@player.chips}\"\n @output.puts stats.center(stat_width)\n\n if @bots.empty?\n @output.puts 'No AI opponents.'.center(WIDTH)\n else\n @bots.each do |bot|\n bot_stats = \"AI: #{bot.name}\".ljust(WIDTH/2)\n bot_stats << seperator\n bot_stats << \"Chips: #{bot.chips}\"\n @output.puts bot_stats.center(stat_width)\n end\n end\n end", "def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"player\"\nend", "def show_player(name)\n if player = Player.find_by_name(name)\n puts \"____________________________________________________________________\"\n puts \"#{player.player} Age:#{player.age} Position:#{player.position}\"\n puts \"Team:#{player.team}\"\n puts \"Games Played: #{player.games_played}\"\n puts \"Goals: #{player.goals}\"\n puts \"Assists: #{player.assists}\"\n puts \"Points: #{player.points}\"\n puts \"Shooting Percentage: #{player.shooting_percentage}\"\n puts \"Plus Minus: #{player.plus_minus}\"\n puts \"Penalty Minutes: #{player.penalty_minutes}\"\n puts \"Average TOI: #{player.toi_avg}\"\n puts \"Blocks: #{player.blocks}\"\n puts \"Hits: #{player.hits}\"\n puts \"Faceoff Percentage: #{player.faceoff_percentage}\"\n puts \"____________________________________________________________________\"\n else\n raise_player_error\n end\n end", "def list_pokemon_stats\n puts(\"Name: {#name}\")\n puts(\"HP: {#hp}\")\n end", "def current_hp\n puts \"P1: #{@player1.hp}/3 vs P2: #{@player2.hp}/3\"\n end", "def show_players\n puts\n @humanplayer.show_state\n puts \"2) #{@ennemies.size} enemies are still fighting\"\n puts\n end", "def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end", "def print_player_hands()\n puts \"--- Player #{@position} --- \"\n @hands.each do |hand| # The player might have multiple hands, if splitting was used\n puts hand.to_s() # Print the details of the hand\n end\n end", "def get_player\n\t @name\n\tend", "def print_player(player)\n\t\tputs (\"-player #{player}-\")\n\t\tfor j in 0...5\n\t\t\tputs(\"#{@value_names[@values[@players[player].hand[j]]]} #{@suit_names[@suits[@players[player].hand[j]]]}\")\n\t\tend\n\t\tputs (\"-----------\")\n\tend", "def players; [@hunter, @prey] end", "def stats\n puts 'You have ' + self.health.to_s + ' health remaining and have ' + self.denarii.to_s + ' denarii to your name.'\n end", "def player_name\n player.name\n end", "def show\n @votes = @summary.summary_votes.count\n @player_name = \"#{@summary.player.first_name} #{@summary.player.last_name}\"\n end", "def showHands\n @players.times do |p|\n i=p + 1\n print \"\\nPlayer #{i}:\"\n # DJBHERE DJB HERE str = \"file_\" + i.to_s.rjust(n, \"0\")\n @playersCards[i].each do |c|\n print \" #{c.visible}\"\n end\n end\n end", "def title\n \"Game #{self.id}: \" + players.map { |p| p.username }.join(\" vs \")\n end", "def show_players\n @game.players.map do |gamer|\n colorize_nick(gamer)\n end.join ', '\n end", "def print_player_outcomes\n @players.each{ |p|\n puts \"#{p.name}:\"\n p.hands.each_with_index{ |h, i|\n print \"Hand #{i+1}: \"\n eval_hand(p, h)\n }\n puts \"#{p.name} total: $#{p.wallet}\"\n linebreak\n }\n end", "def player_names\n self.players.pluck(:username).join(\", \")\n end", "def print_all_players(print_title, players)\r\n puts\r\n puts(print_title)\r\n players.each do |player|\r\n puts(\"\\t >> #{player}\")\r\n end\r\n puts\r\nend", "def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end", "def print_players()\n\t\tfor i in 0...@num_players\n\t\t\tprint_player(i)\n\t\tend\n\tend", "def display_info\n \n puts \"\\nPlayer Name: #{self.name}\"\n puts \"Current Rank: #{self.rank}\"\n puts \"Position: #{self.position}\"\n puts \"School/Club: #{self.schoolclub}\"\n # binding.pry\n #if there is no class_year, nothing is displayed\n puts \"Year: #{self.class_year}\"\n #\n puts \"Height/Weight: #{self.height}, #{self.weight} \"\n puts \"Age: #{self.age}\"\n puts \"Last rank: #{self.last_rank}\"\n puts \"Scouting Report: #{self.blurb}\"\n puts \"------------------------------------\"\n end", "def listerParticipants\n puts \"\"\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n @participants.each do |participant|\n puts \" #{participant.nom.upcase}[#{participant.initiative}] - PV(#{participant.pv} / #{participant.pv_max}) >> #{participant.etat}\"\n end\n puts \"\"\n puts \"---------------| PARTICIPANTS |----------------------\"\n puts \"\"\n puts \"\"\n end", "def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end", "def display_details()\n puts \"Numele persoanei: #@nume\"\n puts \"Prenumele persoanei: #@prenume\"\n end", "def show_hand\n puts \"Player Score: #{player.score}: [#{player.dealt.join(\"][\")}]\"\n puts \"Dealer Score: #{dealer.score}: [#{dealer.dealt.join(\"][\")}]\"\n end", "def show_lives\n puts \"Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3\"\n end", "def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol} il débutera la partie\"\n else\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol}\"\n end\n end", "def player_names\n puts \"What name do you want to use, Player 1?\"\n @player_1_name = gets.chomp\n puts \"What name do you want to use, Player 2?\"\n @player_2_name = gets.chomp\n end", "def name_all_players()\n set_name()\n set_other_name()\n end", "def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n puts \"Nombre: #{players_win.name} || Puntos: #{players_win.points}\"\n #players_win.cards_wins.each do |cards|\n # puts cards.id\n #end\n @players.each do |player|\n puts ''\n puts player.name\n puts 'Cartas: '\n player.cards_wins.each do |cards|\n print \"#{cards.id}\"\n print ' || '\n end\n end\n end", "def display_status\r\n puts self.playerOne.status\r\n puts self.playerTwo.status\r\n end", "def player_names(n)\n puts \"Player \" + n.to_s + \"! What is your name?\"\n return gets.chomp\n end", "def life_count\n puts \"#{@player1.name}'s lives: #{@player1.lives}\\n#{@player2.name}'s lives: #{@player2.lives}\"\n end", "def show_players\n puts \"Il reste #{players_left} enemies\"\n player1.show_state\n puts \"\\n\"\n end", "def winner\n @players.each do |current_player|\n if current_player.position >= length\n #puts \"#{current_player.name} JUST WON!!!\"\n return \"#{current_player.name}\"\n end\n end\n end", "def status(player)\n puts player\n linebreak\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n # Si la méthode show_state est appliqué à l'instance player1 (Josiane), le programme sait que la variable @nom est \"Josiane\" et @life_points est le nombre de points de vie de Josiane\n end", "def show_players\n puts @cards.length\n @players.each do |player|\n puts \"Nombre: #{player.name}\"\n player.cards.each do |card|\n puts card.id\n end\n end\n end", "def player_label(player_hash)\r\n return \"N/A\" unless player_hash.has_key?(:player_id)\r\n\r\n \"#{player_hash[:first_name]} #{player_hash[:last_name]} (#{player_hash[:player_id]})\"\r\n end", "def player_info(player, pot)\n system 'clear'\n puts \"#{player.player_name},\".light_green + ' it is your turn to act.'\n puts ''\n puts 'You have ' + player.chip_stack.to_s.light_green + ' chips.'\n puts 'The total pot size (including current bets) is ' + pot.to_s.light_red + ' chips.'\nend", "def display_scores\n puts \"P1: #{@player1.lives}/3 vs P2: #{@player2.lives}/3\"\n end", "def player_info\n \n clear_terminal\n @prompt = TTY::Prompt.new\n puts \"Enter the name of the player\"\n query = get_user_input\n if Player.all.find_by(name: \"#{query}\") == nil\n clear_terminal\n puts \"Try with hockey, that guy doesn't play soccer!\"\n pause\n pause\n player_info \n else player_info = Player.all.find_by(name: \"#{query}\") \n end\n clear_terminal\n divider\n choice = @prompt.select(\"#{player_info.name} is a great #{player_info.position} who plays in #{player_info.club_id} and has score #{player_info.goals} playing #{player_info.minutes} minutes this season. He had comitted #{player_info.fouls_committed} fouls and has #{player_info.yellow_cards} yellow cards and #{player_info.red_cards}\",\n [\"-> Back\",\"-> Quit\",\"-> Restart\"])\n case choice\n when \"-> Back\"\n players_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n error\n end\n end", "def parse_players(player)\n player.each_with_index.map do |s, i|\n [i+1, s.name, s.power, s.combat]\n end\n end", "def get_names\n print \"Player 1, what is your name? \"\n @player_1_name = gets.chomp\n print \"Player 2, what is your name? \"\n @player_2_name = gets.chomp\nend", "def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end", "def display_player_scores(player1,player2)\n puts \"#{player1.name}'s score: #{player1.score}\"\n puts \"#{player2.name}'s score: #{player2.score}\"\nend", "def record\n word = \"GHOST\"\n @losses.each do |player, losses|\n p \"#{player.name}: #{word[0...losses]}\"\n end\n end", "def vs(player_name)\n @vs = player_name.dup.to_s\n end", "def name\n \"Player#{@ix}\"\n end", "def show_stats(players, losers, rounds, games)\n puts \"Players left in the game.\" unless players == []\n for player in players\n puts player.to_s\n end\n\n puts \"Players that have lost so far.\" unless losers == []\n for loser in losers\n puts loser.to_s\n end\n\n puts \"You completed #{games} complete games\"\n puts \" && #{rounds} rounds in the final game.\"\n end", "def show_winner(player)\n puts \"Winner: #{player.name} #{player.identity} CONGRATULATIONS!!!\"\nend", "def display_winner\n\t\tif @player_one.return_number_of_win > @player_two.return_number_of_win # on fait une condition qui compare le nombre de victoire des joueurs pour savoir lequel a gagner la partie\n\t\t\tputs \"\\n\\n\\nBravo #{@player_one.return_name.colorize(:green)} Vous avez battu #{@player_two.return_name.colorize(:red)}\"\n\t\telsif @player_one.return_number_of_win < @player_two.return_number_of_win\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:green)} Vous avez battu #{@player_one.return_name.colorize(:red)}\"\n\t\telse\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:blue)} et #{@player_one.return_name.colorize(:blue)} Vous avez fait un match nul!\"\n\t\tend\n\tend", "def player_name(id)\n name = Player.find(id)\n end", "def show\n #@game.round = @game.rounds.sort_by{|e| e[:place]}\n #@player_stats = @player_stats.sort_by{|e| -e[:wins]}\n end", "def game_lancement_combat\n puts \"\\n Voici l'état des joueurs :\\n\\n \"\n puts \"#{@player1.show_stats}\\n#{@player2.show_stats}\"\n puts \"\\n\\n Press Enter pour démarrer le combat !!\"\n gets.chomp\nend", "def print_scores\n puts \"+--------------+\"\n @players.each do |player|\n puts \"| Player #{player.player_number} : #{player.lives} |\"\n end\n puts \"+--------------+\"\n end", "def initialize\n puts \" -----------------------------------------------\"\n puts \"| |\"\n puts \"| Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\"\n puts \"| |\"\n puts \"|-----------------------------------------------|\"\n puts \"| |\"\n puts \"|Le but du jeu est d'être le dernier survivant !|\"\n puts \"| |\"\n puts \" -----------------------------------------------\"\n puts \"Nom du joueur?\"\n player1_input=gets.chomp\n puts \"\\n\"\n @player1=HumanPlayer.new(player1_input)\n @players_left=10\n @enemies_in_sight=[]\n\n \n \n end", "def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end", "def basic_stats\n if @player_champs_list.present?\n {\n spec_user: User.find_by(name: @player.summoner.name.downcase),\n summoner: @player.summoner,\n top_played: first_champ(top_played_champs),\n top_kd: first_champ(top_kd_champs),\n top_wl: first_champ(top_wl_champs)\n }\n else \n nil\n end\n end", "def player_stats (player_name)\n lookup_by_player(player_name);\nend", "def point_count\n puts \"#{@player1.name}'s points: #{@player1.point}\\n#{@player2.name}'s points: #{@player2.point}\"\n end", "def human_player_and_ai(size)\n\tif first?()\n @player1 = \"player\"\n @player2 = difficulty(size,\"o\")\n else\n @player1 = difficulty(size,\"x\")\n @player2 = \"player\"\n end\nend", "def list_all_titles\n Anime.all.sort{|a,b| a.name <=> b.name}.each_with_index do |anime,i|\n puts \"#{i+1}. #{anime.name}\"\n end\n self.more_info\n end", "def ask_name\n\n puts \"Bienvenue sur TIC-TAC-TOE\"\n puts \"Veuillez écrire vos noms :\"\n\n puts \"Joueur 1 :\"\n print \">\"\n\n @player_one = Player.new(\"Emeran\")\n\n puts \"Joueur 2 : \"\n\n @player_two = Player.new(\"Martin\")\n @player_array = [@player_one, @player_two]\n end", "def show_favorite_players(fan) #this method is backend finding the players of a specifc fan\n players_array = favorite_players(fan)\n players_array.each do |player|\n puts player.name \n end\nend", "def print_vs_msg(player, hand, dealer)\n print \"Player #{player.id}: \"\n \n if hand.is_blackjack\n print \"Blackjack! \"\n elsif hand.is_bust\n print \"Bust! \"\n else\n print \"#{hand.get_points} \"\n end\n \n print \"vs \"\n print \"Dealer: \"\n \n if dealer.is_blackjack\n print \"Blackjack! \"\n elsif dealer.is_bust\n print \"Bust! \"\n else\n print \"#{dealer.get_points} \"\n end\n puts \"Bet: #{hand.get_bet_amount}\"\n end", "def show_start_game(game)\n puts \"#{game.player1.name} is: #{game.player1.identity}\"\n puts \"#{game.player2.name} is: #{game.player2.identity}\"\n puts 'TIC TAC TOE.. start!'\nend", "def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end", "def show_hands(players)\n for player in players\n for hand in player.hands\n puts \"#{player.to_s} ------ #{hand.to_s}\"\n end\n end\n end", "def get_info\n @output = \"Voter, #{@name}, #{@politics}\"\n end", "def get_player_name(name)\n return prompt(\"Player Name? [Player #{name}]\",\"Player #{name}\")\n end", "def status\n puts \"Player #{@playerNo}\".center(60)\n puts \"Name: #{@name}\".center(60)\n puts \"Class: #{@fightClass[:name]}\".center(60)\n puts \"Race: #{@race[:name]}\".center(60)\n puts \"HP: #{@hp}\".center(60)\n puts \"Level: #{@level}\".center(60)\n puts \"Actions: #{@actions.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Attacks: #{@attacks.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Inventory: #{@inventory.join(', ')}\".center(60)\n puts \"\"\n end", "def show\n @games = @player.games.sort_by(&:id)\n if @games.count != 0\n @games_data = []\n @games.each_with_index do |g, i|\n @games_data << if g.player1id == @player.id\n [i+1, g.player1aelo]\n else\n [i+1, g.player2aelo]\n end\n end\n @events_data = []\n Event.all.sort_by(&:id).each do |e|\n @events_data << [e.name, eval(e.elos)[@player.id]]\n end\n @min = @games_data.map(&:last).min - 20\n @max = @games_data.map(&:last).max + 20\n end\n end", "def score\n puts \"---#{player.name.upcase}: #{player.score} -- #{dealer.name.upcase}: #{dealer.score}---\"\n end", "def pt_memb_name\n {:name=>$game_party.members[@party_index_tb].name}\n end", "def print_stats(viking)\n puts \"#{viking.name} Information:\"\n puts \"Name: #{viking.name}\".blue\n puts \"Health: #{viking.health}\".green\n puts \"Age: #{viking.age}\".yellow\n puts \"Strength: #{viking.strength}\".red\n\n puts(\"\\n\")\nend", "def getName\n @value + \":\" + @suit + \" \"\n end", "def show_current_description\n\t\tputs find_room_in_dungeon(@player.location).full_description\n\tend", "def display_hands(cards_of_player, cards_of_dealer, player_name, hidden)\n system 'clear'\n print \"#{player_name}:\\t\"\n cards_of_player.each {|card| print card.join + ' '}\n puts \"\\t\\tPoints: #{calculate_points(cards_of_player)}\"\n puts\n print \"Dealer:\\t\"\n cards_of_dealer.each_with_index do |v, index|\n if !hidden || index == 0\n print v.join + ' '\n else\n print \"??\" + ' '\n end\n end\n\n print \"\\t\\tPoints: #{calculate_points(cards_of_dealer)}\" if !hidden\n puts\n puts\nend", "def call_player\n print \"C'est à #{@name} de jouer : Choisissez une case à jouer entre 1 et 9 \"\n gets.chomp.to_i\n end", "def i_choose_you\r\n\t\ttemp_name= @pokemon_name\r\n\t\tputs \"#{@nickname}, I choose you!\"\r\n\tend", "def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\n end\n end", "def longestName\n players.collect do|name, stats|\n name\n end\nend", "def player_name(hash)\n return hash[:name]\nend", "def display_villains\n line\n i = 1\n Villain.all.each do |villain| \n puts \"#{i}. \" + villain.alter_ego\n i +=1\n end\n line\n end", "def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end", "def ask_name\n\n puts ''\n puts \"Bienvenue sur TIC-TAC-TOE\"\n puts \"Veuillez écrire vos noms :\"\n\n puts \"Joueur 1 : \"\n print \"> \"\n\n @player_one = Player.new(gets.chomp)\n\n puts \"Joueur 2 : \"\n print \"> \"\n\n @player_two = Player.new(gets.chomp)\n\n end", "def get_player_name\n puts \"Who is playing WITCH WARRIOR today?\"\n @validate_input.get_input\n end", "def get_player_name\n get_console_input.capitalize\n end", "def show_inventory\n\t\tempty = String.new\n\t\tempty = \"empty pockets\" if @player.inventory.size == 0\n\t\tputs \"\\nYou have: \" + @player.inventory.join(\", \") + empty\n\tend", "def get_psv\n psv = []\n psv[0] = self.id.to_s\n psv[1] = self.username\n psv[2] = self.fullname\n psv[3] = self.nickname\n psv[4] = self.irc_nick\n psv[5] = self.email\n psv[6] = self.webpage\n psv[7] = self.flickr_username\n psv[8] = self.yahooim_username\n psv[9] = self.gtalk_username\n psv[10] = self.visible\n return \"#{psv[0]}|#{psv[1]}|#{psv[2]}|#{psv[3]}|#{psv[4]}|#{psv[5]}|#{psv[6]}|#{psv[7]}|#{psv[8]}|#{psv[9]}|#{psv[10]}\"\n end" ]
[ "0.7031339", "0.6702909", "0.6618194", "0.6551857", "0.65414995", "0.6494093", "0.64341444", "0.6412389", "0.64101124", "0.6290578", "0.62794024", "0.6270742", "0.6239798", "0.6226701", "0.61776364", "0.6175895", "0.61131114", "0.6094717", "0.60884255", "0.6076224", "0.60720915", "0.6055265", "0.60165644", "0.6006902", "0.5979151", "0.59759974", "0.59678525", "0.595016", "0.5948322", "0.5945868", "0.59283966", "0.592013", "0.5913424", "0.5913424", "0.5893349", "0.58860034", "0.5880204", "0.5864598", "0.5843898", "0.58437246", "0.58351845", "0.5826016", "0.58196884", "0.5818527", "0.5812864", "0.5809071", "0.578845", "0.57765204", "0.5773217", "0.5770464", "0.5760262", "0.5751937", "0.57206386", "0.5720289", "0.570539", "0.5668773", "0.566867", "0.5657329", "0.5652315", "0.56496507", "0.5639662", "0.56396216", "0.56387186", "0.5635211", "0.56314844", "0.5624106", "0.5617361", "0.56036365", "0.559209", "0.5584591", "0.55839247", "0.55801755", "0.55778414", "0.55677366", "0.55578643", "0.55419147", "0.5531261", "0.5531045", "0.5525908", "0.5519952", "0.55065984", "0.55038345", "0.55024886", "0.54993373", "0.5489672", "0.54855114", "0.5484873", "0.54820347", "0.54791874", "0.5477655", "0.5468931", "0.5449935", "0.5445515", "0.5439118", "0.54261494", "0.54238427", "0.5423125", "0.541072", "0.5408294", "0.5407795", "0.5404528" ]
0.0
-1
Add an object (e.g. ActiveRecord model instance) to this ResultSet with an accompanying permission hash.
def add_object(object, with_permissions: {}) @object_permission_map[object].merge!(with_permissions) do |_k, v1, v2| { states: (v1[:states] + v2[:states]).uniq.sort } end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_permission(permission) \n self.permissions << permission\n end", "def add_permission(permission) \n\t\tself[:permission_ids] << permission.id \n\t\tself[:permissions] << permission.name\n\t\tself.save\n\tend", "def add(permission)\n\t\t\tkparams = {}\n\t\t\t# The new permission\n\t\t\tclient.add_param(kparams, 'permission', permission);\n\t\t\tclient.queue_service_action_call('permission', 'add', 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 add_permission(permission)\n permission=Permission.gfind(permission)\n return false if permission.nil? || permissions.include?(permission)\n permissions.push(permission)\n true\n end", "def << (record)\n raise \"Obj should be a Record\" unless record.class == Record\n @entries << record\n end", "def add(obj)\n @set.addObject obj\n end", "def add_permissions\r\n @role = Role.find(params[:id])\r\n end", "def add_permission(value)\n @children['permission'][:value] << value\n end", "def add_permission!(permission)\n add_permission(permission)\n self.save\n end", "def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end", "def add_permission( value, type, role )\n new_permission = @connection.drive.permissions.insert.request_schema.new({\n 'value' => value, # '[email protected]',\n 'type' => type, # 'group',\n 'role' => role, #'reader' \n })\n\n result = @connection.client.execute(\n :api_method => @connection.drive.permissions.insert,\n :body_object => new_permission,\n :parameters => { 'fileId' => @google_file.data.id })\n end", "def one_object_perm privilege, obj\n Permission.new( :privilege => privilege,\n :class_name => obj.class.name,\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => false,\n :target => obj\n )\n \n end", "def add_permission(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @permissions[key] = Permission.new(self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end", "def add(object, parent=nil)\n iter = self.append parent\n case object\n when Hash\n update_iter_from_hash iter, object\n else\n update_iter_from_object iter, object\n end\n iter[ self.class.column_id[:object] ] = object\n iter\n end", "def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend", "def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend", "def add(*permissions)\n permissions.flatten!\n control_definitions(permissions)\n permissions.each do |permission|\n new_permission = defined_permissions[permission]\n @permissions_integer += new_permission unless include?(permission)\n end\n sync_with_owner\n end", "def <<(obj)\n check(obj)\n super\n end", "def add(class_name, object)\n @data = get_all()\n \n @data[class_name].push(object.to_hash())\n \n save()\n end", "def obj_add(obj,klass,member)\n obj_manipulate obj,klass do |man|\n man.checks do \n raise_if_member_is_not_valid_for klass, member\n end \n man.in_session do \n raise_if_obj_do_not_exist obj\n raise_if_obj_do_not_exist member \n get_response_and_validate_for(obj,klass,\"add\",member)\n end\n end\n end", "def set_access(*args)\n options = args.extract_options!\n options[:object] ||= Array(@_controller).first.to_s.singularize.to_sym if @_controller.present?\n permissions.add(*args, options)\n end", "def add_permission(permission)\n unless permission.match(/.*#.*/)\n raise 'invalid permission format. '\\\n 'Permissions must follow the format of '\\\n '\"name/of/controller#action_name\".'\n end\n self.permissions << permission\n end", "def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end", "def add(o); addObject o end", "def permissions = {}", "def set_permission(name)\n @permission_objects[name] = Lockdown::Permission.new(name)\n end", "def can!(permission, object = nil)\n assert_permission_not_nil(permission)\n assert_canhaz_object(object)\n object_type = object.nil? ? nil : object.class.to_s\n object_id = object.nil? ? nil : object.id\n perm = self.permissions.build(:permission => permission, :type => object_type, :cobject_id => object_id)\n if perm.valid?\n perm.save\n return true\n end\n self.permissions.delete perm\n perm.destroy\n false\n end", "def add_user_permission(u)\n\t\t\n\tend", "def add(type_, object_)\n @config.lock\n\n # Some sanity checks of the arguments.\n if object_.nil?\n raise ObjectKeyError, \"Attempt to add a nil object\"\n end\n unless @types.has_key?(type_)\n raise ObjectKeyError, \"Unrecognized type: #{type_}\"\n end\n\n # Synchronize the actual add to protect against concurrent mutation.\n @mutex.synchronize do\n _internal_add(type_, object_, nil, nil)\n end\n self\n end", "def save_permission(permission)\n option = \"q\" + @qid\n key = \"q\" + @qid + \"_\" + @answers.fetch(option) + \"_\" # i.e. q8_c_\n \n permission.agreementid = @agreementid\n permission.note = @answers.fetch(key + \"exceptions\") if @answers.key?(key + \"exceptions\")\n permission.note = @answers.fetch(key + \"inclusions\") if @answers.key?(key + \"inclusions\")\n permission.triggerdate = @answers.fetch(key + \"eventdate\") if @answers.key?(key + \"eventdate\")\n permission.event = @answers.fetch(key + \"eventtext\") if @answers.key?(key + \"eventtext\")\n permission.eventoperator = \"Until\" if @answers.key?(key + \"eventtext\") || @answers.key?(key + \"eventdate\")\n permission.status_lu_id = StatusLu.active\n permission.createdate = Date.today\n permission.createuser = @user\n permission.auditdate = Date.today\n permission.audituser = @user\n\n if permission.save\n permission.originalpermissionid = permission.permissionid\n permission.save\n @permission_count = @permission_count + 1\n return true\n else\n @error = true\n end\n\n return false\n end", "def add_permission_for_user(user, *permission)\n add_policy(Util.join_slice(user, *permission))\n end", "def <<(object)\n # TODO\n end", "def add_object(object)\n\t\t\t\tfname=\"ArWorkitem.\"+__method__.to_s\n\t\t\t\tret=0\n\t\t\t\ttype_object=object.model_name\n\t\t\t\tfields = self.field_hash\n\t\t\t\tif fields == nil\n\t\t\t\t\tfields = {}\n\t\t\t\t\tfields[\"params\"] = {}\n\t\t\t\tend\n\t\t\t\turl=\"/\"+type_object+\"s\"\n\t\t\t\turl+=\"/\"+object.id.to_s\n\t\t\t\tlabel=type_object+\":\"+object.ident\n\t\t\t\tunless fields[\"params\"][url]==label\n\t\t\t\t\tfields[\"params\"][url]=label\t\n\t\t\t\t\tret+=1\n\t\t\t\t\tself.replace_fields(fields)\n\t\t\t\telse\n\t\t\t\t\tLOG.info (fname) {\"objet deja present dans cette tache\"}\n\t\t\t\tend\n\t\t\t\tret\n\t\t\tend", "def insert(object)\n key_name = attributes.key[0].name\n tuple = dump(object)\n tuple.delete(key_name)\n key_value = relation.insert(tuple)\n\n object.public_send(\"#{key_name}=\", key_value)\n\n object\n end", "def add_wildcard_permission(query)\n if @permission.to_sym != Permission::WILDCARD.to_sym\n query.where(Permission.arel_table[:action].eq(@permission))\n end\n end", "def <<(obj)\n raise Error::TypeError\n end", "def add(permission_item)\n\t\t\tkparams = {}\n\t\t\t# The new permission item\n\t\t\tclient.add_param(kparams, 'permissionItem', permission_item);\n\t\t\tclient.queue_service_action_call('permissionitem', 'add', 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 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 add_associated_object(opts, o, *args)\n o = make_add_associated_object(opts, o)\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n ensure_associated_primary_key(opts, o, *args)\n return if run_association_callbacks(opts, :before_add, o) == false\n return if !send(opts._add_method, o, *args) && opts.handle_silent_modification_failure?\n if array = associations[opts[:name]] and !array.include?(o)\n array.push(o)\n end\n add_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_add, o)\n o\n end", "def add(obj)\n return self if self.has_key? name_of(obj)\n\n hook_wrap :add, obj do\n begin\n name = name_of(obj)\n insert_sorted(obj)\n hashed[name] = obj\n obj\n rescue Exception => e\n delete(name)\n raise e\n end\n end\n\n self\n end", "def add_account_user account_user\n \n \n # find or create catalog user\n catalog_user = CatalogUser.where( user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role)\n .first_or_create( \n user_id: account_user.user_id, \n catalog_id: self.id,\n account_id: self.account_id,\n role: account_user.role\n )\n \n # copy permissions to catalog user \n Permissions::TYPES.each do |permission|\n #eval \"catalog_user.#{permission} = account_user.#{permission}\"\n catalog_user[permission] = account_user[permission]\n end\n catalog_user.save!\n catalog_user\n end", "def canAdd _obj, _args\n \"_obj canAdd _args;\" \n end", "def add_perm(*perms)\n @perms.concat(perms)\n end", "def add(model)\n self[model.primary_key] = model\n end", "def add_to_group_permissions(group, folder, permission_to_everything)\n group_permission = GroupPermission.new\n group_permission.folder = folder\n group_permission.group = group\n group_permission.can_create = permission_to_everything\n group_permission.can_read = permission_to_everything\n group_permission.can_update = permission_to_everything\n group_permission.can_delete = permission_to_everything\n group_permission.save\n end", "def add(o)\n @hash[o] = true\n self\n end", "def new\n @permission = Permission.new\n end", "def add_row(obj)\n obj = DataRow.new(obj) unless obj.is_a?(DataRow)\n raise(StandardError, \"wrong row size #{obj.cells_count}, should be #{columns_count})\") if obj.cells_count != columns_count\n obj.close\n @rows << obj\n self\n end", "def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end", "def create_permission(attributes)\n BrickFTP::API::Permission.create(attributes)\n end", "def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">> Lockdown: Permission not found in db: #{str}, creating.\"\n ::Permission.create(:name => str)\n end\n end\n end", "def evaluate_permission(permission, *args)\n # object; Event, Discount, etc\n o = args[0]\n # default to allow\n result = true\n role = get_role_of(o)\n\n\n # evaluate procs\n if (proc = PermissionUtilities.has_procs?(permission))\n result &= proc.call(o, self)\n end\n\n # Here is where the addition of adding collaborations may reside\n\n # finally, determine if the user (self) can do the requested action\n result &= allowed_to_perform?(permission, role)\n\n # so we don't need to do everything again\n cache.set_for_role(\n name: permission,\n value: result,\n role: role\n )\n\n result\n end", "def permission_for (collection)\n permission = Permission.find_or_create_by_user_id_and_collection_id(self.id, collection.id)\n end", "def set_permission\n\t @permission = Permission.find(params[:id])\n\t end", "def add(id, object)\n self.objects[id] = object\n end", "def add_to_database\n Link.add({\"assignment_id\" => \"#{self.assignment_id}\", \"link\" => \"#{self.link}\", \"type\" => \"#{self.type}\"})\n end", "def <<(obj)\n @content << obj\n end", "def add(o)\n validate_member!(o)\n @val |= 1 << o\n self\n end", "def set_permission\n @permission = Permission.find(params[:id])\n end", "def set_permission\n @permission = Permission.find(params[:id])\n end", "def set_permission\n @permission = Permission.find(params[:id])\n end", "def add(o)\n really_added = false\n oh = o.hash\n unless @hash.key?(oh)\n really_added = true\n @hash[oh] = o\n @plans << o\n end\n really_added \n end", "def add_role_permissions(permissions_model, role)\n if permissions_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('permissions_model')\n end\n if isNullOrWhiteSpace(role)\n raise LoginRadius::Error.new, getValidationMessage('role')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role/' + role + '/permission'\n put_request(resource_path, query_parameters, permissions_model)\n end", "def object_data_add(oDataObject)\n object_type = oDataObject.object_type?\n\n if oDataObject.type == :list\n old_data_object = @params.rh_get(:query, object_type)\n old_data_object.unregister if old_data_object\n @params.rh_set(oDataObject, :query, object_type)\n else\n old_data_object = @params.rh_get(object_type)\n old_data_object.unregister if old_data_object\n @params[object_type] = oDataObject\n end\n end", "def add(r)\n db[r.name] = r\n end", "def add(env, id)\n member = ActiveFedora::Base.find(id)\n return unless env.current_ability.can?(:edit, member)\n env.curation_concern.ordered_members << member\n end", "def add\n request('add').auth_required!\n end", "def _internal_add(type_, obj_, tuple_, pattern_) # :nodoc:\n # Check if this object is present already.\n if (objdata_ = @objects[obj_.object_id])\n # The object is present already. If it has the right type,\n # then just return the object and don't regenerate tuples.\n # If it has the wrong type, give up.\n if objdata_[1] != type_\n raise ObjectKeyError, \"Object is already present with type #{objdata_[1]}\"\n end\n true\n else\n # Object is not present.\n # Generate list of tuples to add, and make sure they are unique.\n tuple_list_ = []\n @types[type_].each do |pat_|\n if (block_ = @patterns[pat_][2])\n tup_ = block_.call(obj_)\n else\n tup_ = nil\n end\n if !tup_ && pat_ == pattern_\n tup_ = tuple_\n end\n if tup_\n if @tuples.has_key?(tup_)\n raise ObjectKeyError, \"New object wants to overwrite an existing tuple: #{tup_.inspect}\"\n end\n tuple_list_ << tup_\n end\n end\n return false if tuple_list_.size == 0\n\n # Insert the object. This is the actual mutation.\n objdata_ = [obj_, type_, {}]\n @objects[obj_.object_id] = objdata_\n tuple_list_.each do |tup_|\n _add_tuple(objdata_, tup_) if tup_\n end\n true\n end\n end", "def add(symbol, comment)\n # initialize variables (if applicable)\n @sets = Hash.new if @sets.nil?\n # check for double creation\n raise ArgumentError, \"CBAC: PrivilegeSet was already defined: #{symbol.to_s}\" if @sets.include?(symbol)\n # Create record if privilege set doesn't exist\n record = Cbac::PrivilegeSetRecord.find_or_create_by(name: symbol.to_s)\n record.set_comment(comment)\n record.save\n\n @sets[symbol] = record\n end", "def create\n @screen = session.active_screen\n\n params[:permission][:actions] = nil if params[:permission][:actions].nil?\n \n permission_type = params[:permission_type].to_s\n permission_attributes = params[:permission] || {}\n screen_id = params[:screen_id].to_i\n \n @permissions = Permission.create_permissions(permission_type, permission_attributes, screen_id)\n @permission = @permissions.last\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @permission }\n end\n end", "def << (obj)\n @objects << obj if obj\n end", "def add_entry entry\n @data << entry\n end", "def grant(subject, object, right=Right::RW)\n capability = Capability.new(subject, object, right, @seed)\n object_map[object] = [capability, subject]\n subject.give(capability.clone)\n capability\n end", "def <<(resource)\n relate_resource(resource)\n super\n end", "def <<(record)\n @cache[record.class] << record\n end", "def add_reader(arg)\n chg_permission(readers, arg, :add)\n end", "def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end", "def add!(child)\n #should add defensive check here: is the child a Permission or a Command?\n self.children.add(child)\n end", "def <<(*object)\n object = object.flatten\n \n # Convert any IDs (strings) into their correct objects.\n object.map! { |o| o.kind_of?(String) && PublicEarth::Db::Base.find_in_general(o) || o }\n object.compact!\n \n places = object.select { |o| o.kind_of? Atlas::Place }\n add_place(*places) unless places.blank?\n\n categories = object.select { |o| o.kind_of?(PublicEarth::Db::Category) || o.kind_of?(Atlas::Category)}\n add_category(*categories) unless categories.blank?\n \n sources = object.select { |o| o.kind_of? PublicEarth::Db::Source }\n add_source(*sources) unless sources.blank?\n \n self\n end", "def add_access\n user = User.find_by(email: params[:email])\n if user.nil?\n render json: {error: \"No user found under that email\"}\n return\n end\n board = Board.find(params[:board_id].to_i)\n if board.nil?\n render json: {error: \"Invalid board id\"}\n return\n end\n if board.user_id.eql? user.id\n render json: {error: \"User is creator\"}\n return\n end\n access = BoardAccess.new({user_id: user.id, board_id: board.id})\n begin\n access.save\n render json: {message: \"User added\"}\n rescue Exception => e\n render json: {error: \"User already added\"}\n end\n end", "def add_object(iObject)\n @StatementInsertIntoStatsObjects.execute(iObject)\n\n return @StatementInsertIntoStatsObjects.insert_id\n end", "def <<( object )\n\t\t\tself.payload << object\n\t\t\treturn self\n\t\tend", "def add_permissions(resource, actions)\n raise ArgumentError, 'invalid resource' unless resource\n raise ArgumentError, 'invalid actions' unless actions\n\n acts = actions.is_a?(Array) ? actions : [actions]\n @permissions << { resource: resource, actions: acts }\n end", "def add_associated_object(opts, o)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n raise(Sequel::Error, 'associated object does not have a primary key') if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_add, o) == false\n send(opts._add_method, o)\n @associations[opts[:name]].push(o) if @associations.include?(opts[:name])\n add_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_add, o)\n o\n end", "def add_right_to_personalgroup(right)\n self.rights << right\n end", "def allow_edit(user)\n permission = self.content_permissions.by_user(user).first\n if !permission # Make sure the user is only added once\n permission = self.content_permissions.create(:user => user)\n end\n permission\n end", "def addRating _obj, _args\n \"_obj addRating _args;\" \n end", "def add_group_permission(g)\n\t\t\n\tend", "def add(type, name, values)\n object = from_table(type, name)\n add_values_to_existing!(object, values)\n end", "def create\n\t\t@permission = Permission.new(params[:permission])\n\n\t\trespond_to do |format|\n\t\t\tif @permission.save\n\t\t\t\tformat.html\t{ redirect_to(@permission, :notice => 'Permission was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @permission, :status => :created, :location => @permission }\n\t\t\telse\n\t\t\t\tformat.html\t{ redirect_to :action => 'new', :new_permission_user_id => @permission.user_id, :not_initial_run => '1', :already_exists => false }\n\t\t\t\tformat.xml\t{ render :xml => @permission.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def save\n store = NotFoundCatcher.request_store.store\n store.transaction do\n\n store[self.role] = self\n\n end\n\n\n end", "def add_principal(principal, id=nil)\n modify do |_principals|\n if _principals.member? principal\n # add an id to the existing principal (dup safe for sets)\n _principals[principal] << id if not id == nil\n else \n # add the principal # id set is empty if id is nil\n _principals.merge!({principal => Set.new(id ? [id] : [])})\n end\n end\n end", "def add2(env, id)\n member = ActiveFedora::Base.find(id)\n return unless env.current_ability.can?(:edit, member)\n env.curation_concern.ordered_members << member\n end", "def handle_grant_permission\n return if cbac_permission_exists?\n\n permission = Cbac::Permission.new\n permission.privilege_set = privilege_set\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission.context_role = pristine_role.name\n else\n generic_role = Cbac::GenericRole.where(name: pristine_role.name).first\n permission.generic_role = generic_role || Cbac::GenericRole.where(name: pristine_role.name, remarks: \"Autogenerated by Cbac loading / upgrade system\").create\n end\n\n register_change if permission.save\n permission\n end", "def << x\n # $stderr.puts \" #{self.object_id} << #{x.class} #{x.id}\"\n case x\n when Content, Content::Version\n add_content x\n when ContentKey, ContentKey::Version\n add_content_key x\n else\n raise ArgumentError, \"expected Content or ContentKey\"\n end\n self\n end", "def <<(obj)\n @members << obj\n end", "def add_attempt(attempt)\n\n #Add the hash to our list of attempts\n @attempts << attempt\n\n #Add the attempt to our by-usage hash...\n unless attempt.copy_id.nil?\n @by_copy[attempt.copy_id] ||= []\n @by_copy[attempt.copy_id] << attempt\n end\n\n #... and to our by-question hash.\n #TODO: Remove duplication.\n unless attempt.question_id.nil?\n @by_question[attempt.question_id] ||= []\n @by_question[attempt.question_id] << attempt\n end\n\n end", "def add_permissions(topic_arn, label, grantees, actions)\n params = {}\n # add each member\n grantees.each_with_index { |awsid,i| params.merge!(\"AWSAccountId.member.#{i + 1}\" => awsid) }\n # add each action\n actions.each_with_index { |action,i| params.merge!(\"ActionName.member.#{i + 1}\" => action) }\n # standard params\n params.merge!('Label' => label,\n 'TopicArn' => topic_arn )\n req_hash = generate_request('AddPermission', params)\n request_info(req_hash, SnsStatusParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def <<(object)\n unless include?(object)\n object.send(:\"#{@foreign_key}=\", @parent)\n object.save\n super\n end\n end", "def add(resource)\n get_resource(resource.type).add(resource.value)\n end" ]
[ "0.65119207", "0.6150227", "0.5786772", "0.5785791", "0.5690522", "0.5611273", "0.5585335", "0.55801797", "0.55314183", "0.5509732", "0.5465966", "0.5431941", "0.53828233", "0.53794724", "0.5327558", "0.5327558", "0.5321097", "0.5295404", "0.5247277", "0.5226252", "0.522274", "0.51976097", "0.5182951", "0.51792777", "0.51719326", "0.51690257", "0.516586", "0.51475334", "0.5134951", "0.5125833", "0.51206833", "0.5092661", "0.5078879", "0.5078775", "0.50525963", "0.5043517", "0.5023282", "0.50094306", "0.49857232", "0.49796128", "0.49766943", "0.49754632", "0.49709997", "0.4967386", "0.49613822", "0.49596643", "0.49559966", "0.49423867", "0.49078327", "0.49078327", "0.4898058", "0.48836058", "0.4876552", "0.4874144", "0.48716483", "0.48677418", "0.48570728", "0.4851754", "0.48398554", "0.48398554", "0.48398554", "0.48336866", "0.48169965", "0.48101604", "0.4788654", "0.47843918", "0.47833475", "0.47807923", "0.478006", "0.47716603", "0.47716275", "0.47662708", "0.4764895", "0.476372", "0.47633842", "0.4753444", "0.47409013", "0.4735993", "0.47318602", "0.47221568", "0.47162825", "0.47146565", "0.47100353", "0.47084117", "0.4708107", "0.47078347", "0.47076008", "0.47017708", "0.47001305", "0.46835825", "0.46807596", "0.46749306", "0.4670763", "0.4667282", "0.46645808", "0.46637675", "0.4655763", "0.46473938", "0.4646624", "0.4645589" ]
0.5503314
10
Add multiple objects (e.g. ActiveRecord model instances) to this \ ResultSet all with the accompanying permission hash.
def add_objects(objects, with_permissions: {}) objects.each do |object| add_object object, with_permissions: with_permissions end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end", "def <<(values)\n values = prepare_relation(values) if values.is_a?(Relation)\n self.set(objects.to_a | Array.wrap(values))\n end", "def add(*permissions)\n permissions.flatten!\n control_definitions(permissions)\n permissions.each do |permission|\n new_permission = defined_permissions[permission]\n @permissions_integer += new_permission unless include?(permission)\n end\n sync_with_owner\n end", "def save_permissions(role_ids)\n permissions.map{|perm| perm.delete } unless permissions.nil?\n unless role_ids.nil?\n role_ids.each do |permission| \n p = Permission.new(JSON.parse(permission))\n (p.class.reflect_on_all_associations(:has_many) & p.class.reflect_on_all_associations(:has_and_belongs_to_many)).each { |association|\n permissions << Permission.new(\n :role_id => id,\n :controller => association.class_name.singularize,\n :ability => p.ability\n )\n }\n permissions << p\n end\n end\n end", "def serializable\n results = []\n each do |object, permissions|\n results << SerializableResult.new(object, permissions)\n end\n results\n end", "def add_perm(*perms)\n @perms.concat(perms)\n end", "def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end", "def add_permission(permission) \n self.permissions << permission\n end", "def bulk_create \t\n \tauthorize! :manage, :all #checking authorization who are having all permissions\n\n \tif params[\"permissions\"].present?\n \t\tresource_id = params[\"permissions\"][\"resource_id\"]\n \t\tresource_type = params[\"permissions\"][\"resource_type\"]\n \t\tif resource_id.present? && resource_type.present?\n\t \t\t#Checking model permissions and creating model permissions \n\t \t\tif params[\"permissions\"][\"1\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"1\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tvalue.each do |sub|\n\t \t\t\t\t\tsub_values = sub.split('_')\n\t \t\t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>1,:subject_class=>sub_values[0]).first_or_initialize\t\t \t\t\t\n\t\t \t\t\t\tpermission[:status] = sub_values[1]\n\t\t \t\t\t\tpermission[:actions_list] = []\n\t\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\t \t\t\t\t\n\t\t \t\t\t\tpermission.save\n\t \t\t\t\tend\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\t#Checking controller permissions and creating controller permissions\n\t \t\tif params[\"permissions\"][\"0\"].present? \n\t \t\t\tactions = params[\"permissions\"][\"0\"]\n\t \t\t\tactions.each do |key,value|\n\t \t\t\t\tpermission = Permission.where(:resource_id => resource_id, :resource_type => resource_type,:action=>key,:no_model_permission=>false).first_or_initialize\t \t\t\t\t\t\t\t\n\t \t\t\t\tpermission[:actions_list] = value.reject(&:empty?).map{|x| x.to_sym }\n\t \t\t\t\tpermission[:created_by] = current_user.id if current_user\n\t \t\t\t\tpermission[:updated_by] = current_user.id if current_user\n\t \t\t\t\tpermission.save\n\t \t\t\tend \t\t\t\n\t \t\tend\n\t \t\tflash[:notice] = \"Groups permissions successfully saved\"\n\t \t\tredirect_to_back_or_default\n\t \telse\n\t \t\tflash[:error] = \"permissions not saved , Please fill required fields\"\n \t\t\tredirect_to_back_or_default\n\t \tend\n \telse\n \t\tflash[:error] = \"permissions not saved\"\n \t\tredirect_to_back_or_default\n \tend\n end", "def add_permission(permission) \n\t\tself[:permission_ids] << permission.id \n\t\tself[:permissions] << permission.name\n\t\tself.save\n\tend", "def permissions = {}", "def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">> Lockdown: Permission not found in db: #{str}, creating.\"\n ::Permission.create(:name => str)\n end\n end\n end", "def add_wildcard_permission(query)\n if @permission.to_sym != Permission::WILDCARD.to_sym\n query.where(Permission.arel_table[:action].eq(@permission))\n end\n end", "def << *list\n @collection ||= []\n if invalid = list.reject {|record| valid_target_instance?(record)} and !invalid.empty?\n raise ArgumentError, \"invalid object, expecting #{target.class_name} got #{invalid}\"\n end\n @collection += list\n end", "def <<(*object)\n object = object.flatten\n \n # Convert any IDs (strings) into their correct objects.\n object.map! { |o| o.kind_of?(String) && PublicEarth::Db::Base.find_in_general(o) || o }\n object.compact!\n \n places = object.select { |o| o.kind_of? Atlas::Place }\n add_place(*places) unless places.blank?\n\n categories = object.select { |o| o.kind_of?(PublicEarth::Db::Category) || o.kind_of?(Atlas::Category)}\n add_category(*categories) unless categories.blank?\n \n sources = object.select { |o| o.kind_of? PublicEarth::Db::Source }\n add_source(*sources) unless sources.blank?\n \n self\n end", "def add_perms_to_user (user, perms)\n perms.each { |v|\n exec_sql \"INSERT INTO u_apis_perms(u_api_id, u_perm_id) VALUES('#{user}', '#{v}')\"\n }\nend", "def initialize_permissions\n return [] unless id\n response = self.class.client.describe_permissions(stack_id: id)\n Permission.from_collection_response(response)\n end", "def permits=(permissions)\n # make a copy!\n @permissions = {}.merge(permissions)\n end", "def permits=(permissions)\n # make a copy!\n @permissions = {}.merge(permissions)\n end", "def index\n @permissions = Permission.all\n end", "def permissions=(perms)\n fetched_roles = Hash.new { Set.new }\n fetched_perms = Hash.new { Set.new }\n\n perms.each do |r|\n res = r[:resource]\n role = r[:role]\n\n fetched_roles[res] = fetched_roles[res] << role\n fetched_perms[res] += r[:permissions]\n end\n\n # replace the role and permission caches with the latest data\n @resource_roles = fetched_roles\n @resource_permissions = fetched_perms\n end", "def add_permissions\r\n @role = Role.find(params[:id])\r\n end", "def create\n @role = Role.new(role_params)\n\n # create a Array of action object from each line from table\n respond_to do |format|\n if @role.save\n @i = 0;\n @role.permissions = params[:role][:permission].values.map do |action_p|\n @p = Permission.new(action_p)\n if @p.new || @p.edit || @p.remove then @p.index = true end\n @p.session = @i\n @i = @i + 1\n @p\n end\n @role.save\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :created }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(obj)\n @set.addObject obj\n end", "def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end", "def index\n @role_permissions = RolePermission.all\n end", "def add_rows(list)\n list.each { |obj| add_row(obj) }\n self\n end", "def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end", "def multi_insert(tuples)\n pks = relation.multi_insert(tuples, return: :primary_key)\n relation.where(relation.primary_key => pks).to_a\n end", "def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end", "def run_multiple(um)\n #debugger\n initial_data = []\n column_names = um[0].get_column_names\n num_rows = um.length\n\n c = 0\n 0.upto(num_rows - 1) do\n o = OpenStruct.new\n class << o\n attr_accessor :id\n end\n \n #turn the outgoing object into a VO if neccessary\n map = VoUtil.get_vo_definition_from_active_record(um[0].class.to_s)\n if map != nil\n o._explicitType = map[:outgoing]\n end\n \n #first write the primary \"attributes\" on this AR object\n column_names.each_with_index do |v,k|\n k = column_names[k]\n val = um[c].send(:\"#{k}\")\n eval(\"o.#{k}=val\")\n end\n\n \n associations = um[0].get_associates\n if(!associations.empty?)\n #now write the associated models with this AR\n associations.each do |associate|\n na = associate[1, associate.length]\n ar = um[c].send(:\"#{na}\")\n #if !ar.empty? && !ar.nil?\n\t #debugger \n\n\t ok = false;\n if (ar.instance_of? Array)\n if (!ar.empty? && !ar.nil?)\n ok=true;\n end\n else\n\t \tisArray = true\n\t end\n\n if (isArray && !ar.nil?) || ok\n\n\t if(use_single?(ar))\n initial_data_2 = run_single(ar) #recurse into single AR method for same data structure\n else\n initial_data_2 = run_multiple(ar) #recurse into multiple AR method for same data structure\n end\n eval(\"o.#{na}=initial_data_2\")\n end\n end\n end\n\n c += 1\n initial_data << o\n end\n initial_data\n end", "def table_data(objects, *arguments)\n rows = [[*arguments]]\n\n rows += flatten_uniq(objects).map do |obj|\n arguments.map do |argument|\n begin\n obj = obj.query if obj.respond_to?(:query)\n if argument.respond_to?(:call)\n obj.instance_eval(&argument)\n else\n obj.instance_eval(argument.to_s)\n end\n rescue => e\n 'error'\n end\n end\n end\n\n rows\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateMemberResultSet.new(resp)\n return results\n end", "def <<(*args)\n docs = args.flatten\n return concat(docs) if docs.size > 1\n\n if (doc = docs.first)\n append(doc)\n doc.save if persistable? && !_assigning? && !doc.validated?\n end\n self\n end", "def collection\n @collection ||= Permission.all\n end", "def set_access(*args)\n options = args.extract_options!\n options[:object] ||= Array(@_controller).first.to_s.singularize.to_sym if @_controller.present?\n permissions.add(*args, options)\n end", "def index\n @rolepermissions = Rolepermission.all\n end", "def users_permitted_to( priv, obj )\n User.where(\"id in (#{users_permitted_sql( priv, obj )})\").to_a\n end", "def set_permissions(params, permissions_ds)\n # default to rightsMetadata (like standard Hydra) if permissions_ds isn't set\n permissions_ds = \"rightsMetadata\" if permissions_ds.to_s == \"\"\n perm_hash = permission_hash\n #params[:new_user_name].each { |name, access| perm_hash['person'][name] = access } if params[:new_user_name].present?\n params[:new_group_name].each { |name, access| perm_hash[\"group\"][name] = access } if params[:new_group_name].present?\n\n #params[:user].each { |name, access| perm_hash['person'][name] = access} if params[:user]\n params[:group].each { |name, access| perm_hash[\"group\"][name] = access} if params[:group]\n\n update_permissions(perm_hash, permissions_ds)\n end", "def save_permission_keys\n if @permission_keys and Array === @permission_keys\n self.permission_users(true).clear\n\n @permission_keys = @permission_keys.uniq - self.role.permission_keys\n\n @permission_keys.each do |key|\n permission = ::Permission[key]\n\n if permission\n self.permission_users.create({\n :permission_id => permission.id,\n :user_id => self.id\n }, :without_protection => true)\n end\n end\n\n @permission_keys = nil\n @user_permission_keys = nil\n\n self.permissions(true).collect(&:key)\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = AddCollaborationResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateEntryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateEntryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateEntryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateEntryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateEntryResultSet.new(resp)\n return results\n end", "def add_permissions(resource, actions)\n raise ArgumentError, 'invalid resource' unless resource\n raise ArgumentError, 'invalid actions' unless actions\n\n acts = actions.is_a?(Array) ? actions : [actions]\n @permissions << { resource: resource, actions: acts }\n end", "def add_members(members, sharing_permissions = RepositoryManager.default_sharing_permissions)\n if members.kind_of?(Array)\n # Add each member to this sharing\n members.each do |i|\n unless i.respond_to? :create_folder # Check if this object \"has_repository\"\n raise RepositoryManager::RepositoryManagerException.new(\"add members failed. The object passed into members should be a model who 'has_repository'\")\n end\n sharing_member = RepositoryManager::SharingsMember.new(sharing_permissions)\n sharing_member.member = i\n # Add the sharings members in the sharing\n self.sharings_members << sharing_member\n end\n else\n unless members.respond_to? :create_folder # Check if this object \"has_repository\"\n raise RepositoryManager::RepositoryManagerException.new(\"add members failed. The object passed into members should be a model who 'has_repository'\")\n end\n sharing_member = RepositoryManager::SharingsMember.new(sharing_permissions)\n sharing_member.member = members\n # Add the sharings members in the sharing\n self.sharings_members << sharing_member\n end\n end", "def all\n folder.data_objects.all(parameters).collect do |data_object|\n model.new(data_object)\n end\n end", "def many(model, sql, params={})\n sql_query(sql, params).map { |h| model.new(h) }\n end", "def assign_all\n @batch = Batch.shod(params[:format])\n @students ||= @batch.students\n authorize! :read, @batch\n end", "def insert(tuples)\n pks = tuples.map { |tuple| relation.insert(tuple) }\n relation.where(relation.primary_key => pks).to_a\n end", "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end", "def resultset; end", "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertRecordsResultSet.new(resp)\n return results\n end", "def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end", "def save_permissions\n\t\t\tgroup = SystemGroup.find params[:id]\n\n\t\t\tresult = group.save_permissions params[:permission_ids]\n\n\t\t\trender json: result\n\t\tend", "def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end", "def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def grant(*roles)\n self << roles\n reload\n end", "def show\n @all_permissions = Permission.all\n end", "def all\n\t\tquery.execute\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = InsertActivityResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = AddRealFolderResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateFriendshipResultSet.new(resp)\n return results\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def << (record)\n raise \"Obj should be a Record\" unless record.class == Record\n @entries << record\n end", "def save \n @@all << self\n end", "def add_permissions(topic_arn, label, grantees, actions)\n params = {}\n # add each member\n grantees.each_with_index { |awsid,i| params.merge!(\"AWSAccountId.member.#{i + 1}\" => awsid) }\n # add each action\n actions.each_with_index { |action,i| params.merge!(\"ActionName.member.#{i + 1}\" => action) }\n # standard params\n params.merge!('Label' => label,\n 'TopicArn' => topic_arn )\n req_hash = generate_request('AddPermission', params)\n request_info(req_hash, SnsStatusParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def create_res_perms (name, add = [])\n perms = %w(_edit) + add\n\n create_u_perm(name)\n perms.each { |v|\n create_u_perm(name + v)\n }\nend", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateListResultSet.new(resp)\n return results\n end", "def add_all\n helper.index_write do |index|\n index.add_all\n index.update_all\n end\n\n self\n end", "def add_each_to_set(adds)\n view.update_many(\"$addToSet\" => collect_each_operations(adds))\n end", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def set_permissions(*args)\n self.permissions = {}\n args.each do | permission |\n raise InvalidPermissionError.new(\"Permission #{permission} is invalid.\") unless ALLOWED_PERMISSIONS.include?(permission)\n self.permissions[permission] = true\n end\n end", "def index\n @permission_sheets = PermissionSheet.all\n end", "def all\n id_list = redis.zrange \"#{klass}:all\", 0, -1\n\n obj_list = []\n id_list.each do |obj_id|\n obj = self.new\n obj.send(:id=, obj_id.to_i)\n obj_list << obj\n end\n\n obj_list\n end", "def add(*objects)\n objects.each do |object|\n @objects << object\n end\n self\n end", "def implied_perms_for(permissions)\n implied_permissions = []\n permissions.each do |p|\n next if p.class_name.to_sym == :any\n next unless p.target_class_exists?\n p.target_class.sg_priv_to_implied_privs[p.privilege].each do |pi|\n\tp_new = p.dup\n\tp_new.privilege = pi\n\timplied_permissions << p_new\n\tend\n end\n implied_permissions \n end", "def addRecords(recs); recs.each { |r| addRecord r } end", "def << (obj)\n @objects << obj if obj\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateDatabaseResultSet.new(resp)\n return results\n end", "def save\n @@all << self\n end", "def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end", "def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend", "def permission_mapping\n super.merge(\n {\n 'index_role_screen' => 'index',\n 'index_role_field' => 'index',\n 'index_user_screen' => 'index',\n 'index_user_field' => 'index',\n 'fetch_row' => 'index'\n }\n )\n end", "def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end", "def add_rights(verbs, resources)\n @rights << RoleRight.new(verbs, resources)\n self\n end", "def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend", "def permissions_attributes=(attributes_collection)\n if attributes_collection.is_a? Hash\n keys = attributes_collection.keys\n attributes_collection = if keys.include?('id') || keys.include?(:id)\n Array(attributes_collection)\n else\n attributes_collection.sort_by { |i, _| i.to_i }.map { |_, attributes| attributes }\n end\n end\n\n attributes_collection = attributes_collection.map(&:with_indifferent_access)\n attributes_collection.each do |prop|\n existing = case prop[:type]\n when 'group'\n search_by_type(:group)\n when 'person'\n search_by_type(:person)\n end\n\n next if existing.blank?\n selected = existing.find { |perm| perm.agent_name == prop[:name] }\n prop['id'] = selected.id if selected\n end\n\n clean_collection = remove_bad_deletes(attributes_collection)\n\n self.permissions_attributes_without_uniqueness = clean_collection\n end", "def push(*rows)\n rows.each { |row| self << row }\n self\n end", "def permissions\n User.do_find_permissions session_id: kb_session_id\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateUserResultSet.new(resp)\n return results\n end", "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def add_all(set)\n raise NotImplementedError\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = AddToFavoritesResultSet.new(resp)\n return results\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def add_permissions_for(datafiles)\n self.conversation.users.each do |recipient|\n datafiles.each do |datafile|\n recipient.add_permission_for(datafile)\n end\n end\n end", "def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end" ]
[ "0.6408168", "0.57425654", "0.56682897", "0.5578576", "0.55255276", "0.55217415", "0.54989785", "0.5288826", "0.5227736", "0.51521134", "0.50619525", "0.50576097", "0.50567317", "0.5052704", "0.5052105", "0.50357103", "0.5004472", "0.49950257", "0.49950257", "0.4990647", "0.49235794", "0.49216145", "0.49154046", "0.48828673", "0.48495993", "0.4840045", "0.48212257", "0.4805734", "0.48001358", "0.47979212", "0.47958025", "0.47919944", "0.47872788", "0.478727", "0.47831059", "0.47696924", "0.47677752", "0.47653013", "0.47606012", "0.47496834", "0.4747534", "0.47442347", "0.47442347", "0.47442347", "0.47442347", "0.47442347", "0.4738974", "0.4727276", "0.4724714", "0.4721721", "0.47193578", "0.47192693", "0.4718997", "0.47183317", "0.47168952", "0.47113648", "0.47106233", "0.470957", "0.47091132", "0.47090757", "0.4701931", "0.4700962", "0.4694747", "0.46933243", "0.46826842", "0.4681525", "0.46812338", "0.46717903", "0.46688235", "0.46652365", "0.46648046", "0.46637207", "0.46598345", "0.4655668", "0.46549907", "0.46486202", "0.4646582", "0.46301025", "0.4629137", "0.46287227", "0.4628004", "0.46210817", "0.4618116", "0.4616882", "0.4615535", "0.46124977", "0.46112934", "0.4604862", "0.45996067", "0.45960462", "0.45940682", "0.45915163", "0.45883986", "0.45812216", "0.4579566", "0.45782444", "0.4577198", "0.45688295", "0.45664623", "0.45609775" ]
0.54416794
7
Return all of the objects (e.g. ActiveRecord model instances) in this ResultSet.
def objects @object_permission_map.keys end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def all\n table_name = self.table_name\n \n results = CONNECTION.execute(\"SELECT * FROM '#{table_name}';\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def all_objects\n processed_rows.collect { |_i, rp| rp.all_objects }.flatten\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\n self.as_objects(CONNECTION.execute(\"SELECT * FROM #{table_name};\"))\n end", "def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end", "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects(results)\n\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects(results)\n \n end", "def fetch_all\n self.to_a\n end", "def all\n Ribs.with_handle(self.database) do |h|\n h.all(self.metadata.persistent_class.entity_name)\n end\n end", "def all_rows\n @rows\n end", "def all\r\n copy_and_return(@records)\r\n end", "def all_rows\n cache.all_rows\n end", "def all\n self.class.all\n end", "def all\n load_all! unless @objs_list\n @objs_list.values\n end", "def resultset; end", "def all\n all_records = Array.new(self.real_size)\n\n self.each_with_index { |record, index| all_records[index] = record }\n\n all_records\n end", "def all\n ::ActiveRecord::Base.connection_pool.with_connection do\n execute(:all).to_a\n end\n end", "def get_all_from_database\n model.all\n end", "def all_objects; end", "def all(table_name)\n \n many_results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n # => Array of lots of hashes.\n \n objects_array = []\n \n many_results.each do |record_hash|\n if table_name == \"authors\"\n obj = self.new(\"id\" => record_hash[\"id\"], \"name\" => record_hash[\"name\"])\n \n elsif table_name == \"location_keys\"\n obj = self.new(\"id\" => record_hash[\"id\"], \"location_name\" => record_hash[\"location_name\"], \n \"street\" => record_hash[\"street\"], \"city\" => record_hash[\"city\"], \n \"state\" => record_hash[\"state\"], \"country\" => record_hash[\"country\"])\n \n elsif table_name == \"articles\"\n obj = self.new(record_hash)\n end # if loop\n \n objects_array << obj\n \n end # each do loop\n \n objects_array\n\n end", "def read_all(res, klass, options = nil)\n return [] if res.blank?\n\n if options and join_relations = options[:include]\n join_relations = [join_relations].flatten.collect do |n|\n klass.relation(n)\n end\n end\n\n objects = []\n\n if options and options[:select]\n res.each_row do |res_row, row|\n obj = klass.og_allocate(res_row, row)\n read_row(obj, res, res_row, row)\n objects << obj\n end\n else\n res.each_row do |res_row, row|\n obj = klass.og_allocate(res_row, row)\n obj.og_read(res_row, row)\n read_join_relations(obj, res_row, row, join_relations) if join_relations\n objects << obj\n end\n end\n\n return objects\n\n ensure\n res.close\n end", "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end", "def fetch_all\n fetch_many0(nil, Array)\n end", "def all( model )\n model( model ).all\n end", "def all\n repository.all(self)\n end", "def all\n @data_adapter.relations\n end", "def all\n results_from(response)\n end", "def rows\r\n @all_rows\r\n end", "def find_all\n execute_sql(:read, :user) { table.map {|u| inflate_model(u) } }\n end", "def all\n @adapter.all(collection)\n end", "def all\n id_list = redis.zrange \"#{klass}:all\", 0, -1\n\n obj_list = []\n id_list.each do |obj_id|\n obj = self.new\n obj.send(:id=, obj_id.to_i)\n obj_list << obj\n end\n\n obj_list\n end", "def all\n db.transaction(true) do\n ids = extract_model_ids(db)\n ids.map { |key| db[key] }\n end\n end", "def objects(with_table=false, &block)\n hashes(with_table) do |row|\n row = Row.convert(row, self.fetch_fields, with_table)\n (block) ? yield(row) : row\n end\n end", "def elements\n # execute query\n ordered_objects.compact.uniq\n end", "def rows\n return @rows\n end", "def rows\n @rows.lazy\n end", "def all\n folder.data_objects.all(parameters).collect do |data_object|\n model.new(data_object)\n end\n end", "def all\n @customer_objects\n end", "def array\n self.allObjects\n end", "def to_a\n data.all\n end", "def list(options = nil)\n table = DB.from(@table)\n \n if options[:rows]\n if options[:offset]\n table = table.limit(options[:rows],options[:offset])\n elsif options[:page] \n offset = options[:page] * options[:rows]\n table = table.limit(options[:rows],offset)\n end\n end\n \n # convert the array of hashes to an array of model objects\n table.all.map{|row| @model_class.new row}\n end", "def all\n @collection ||= Collection.new model_name\n end", "def all\n\n @all ||= dataset.map { |item| self.new item }\n\n end", "def list_objects\n objects = @model_class.method(:list).arity == 0 ? @model_class.list : @model_class.list(true)\n objects.map { |obj| Array(obj).find { |o| o.is_a?(@model_class) } }\n end", "def records_base(_options = {})\n _model_class.all\n end", "def all\n self.all\n end", "def all\n @all.dup\n end", "def all\n\t\tquery.execute\n end", "def all\n load[:results]\n end", "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "def results_with_rows\n load_from_rows(@dataset.all, true)\n end", "def collect_objects\n results = []\n generate_objects! if object_ids.nil?\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n rescue ActiveRecord::RecordNotFound\n generate_objects!\n collect_objects\n end\n end", "def all\n @all ||= raw.map { |item| new(item) }\n end", "def to_a\n return @records unless loadable?\n\n @response = cache.get_or_set_query(klass, options) do\n connection.documents({ query: options })\n end\n\n @records = []\n\n if @response.success?\n records = @response.members.attributes[\"query\"]\n\n records.each do |record|\n @records << klass.new(record.merge(persisted: true))\n end\n\n @loaded = true\n end\n\n @records\n end", "def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end", "def all\n _register_class_observer\n if _class_fetch_states.has_key?(:all) && 'fi'.include?(_class_fetch_states[:all]) # if f_etched or i_n progress of fetching\n collection = HyperRecord::Collection.new\n _record_cache.each_value { |record| collection.push(record) }\n return collection\n end\n promise_all\n HyperRecord::Collection.new\n end", "def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end", "def collect_objects\n results = []\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n # rescue ActiveRecord::RecordNotFound\n # generate_objects!\n # collect_objects\n end\n end", "def records\n arr = @klass.all(find_options)\n arr.empty? ? nil : arr\n end", "def all(model)\n store.all(table: table_name).map {|data| model.new data}\n end", "def all\n results = connection.exec_params('SELECT * FROM contacts LIMIT 5 OFFSET\n $1::int;', [get_offset])\n return results.map do |contact|\n self.new(contact['name'], contact['email'], contact['id'])\n end \n end", "def results_as_objects(results)\n array_of_objects = []\n results.each do |hash|\n array_of_objects << self.new(hash)\n end\n return array_of_objects\n end", "def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end", "def all\n self\n end", "def raw_all\n query_all\n end", "def all\n return @data\n end", "def all\n return @data\n end", "def get_all_sobjects(type)\n case type\n when 'Account'\n records = @client.materialize(type).query(\"Agents__c != ''\")\n when 'ccrmbasic__Email__c'\n records = @client.materialize(type).query(\"ccrmbasic__Contact__c != ''\")\n else\n records = @client.materialize(type).all\n end\n sobjects = records.dup.to_a\n while records.next_page?\n sobjects += records.next_page\n records = records.next_page\n end\n sobjects\n end", "def rows \n @r\n end", "def all\n @document = Document.all\n end", "def results\n Opinion.where(id: super.pluck(:id))\n end", "def getObjects\n readObjects\n\n return @Objects\n end", "def get_all\n Rutodo::Database::Todo.map(&:as_entity)\n end", "def result_set\n\t @result_set ||= plan.query_result_set(self)\n\tend", "def get_all_objects(class_name, count)\n per_page = 1000\n objects = []\n times = [(count/per_page.to_f).ceil, 10].min\n 0.upto(times) do |offset|\n query = Parse::Query.new(class_name)\n query.limit = per_page\n query.skip = offset * per_page\n objects << query.get\n end\n objects.flatten(1)\n end", "def all\n @list\n end", "def self_and_descendants_from_active_record\n [self]\n end", "def list\n\t\tdocs = proxy_database.view(\"#{shared_data_context.name}/all\")[\"rows\"]\n\t\treturn docs\n \tend", "def to_a\n records\n end", "def all\n __getobj__.column_names\n end", "def all\n @data\n end", "def find_all\n response = fetch()\n new(response)\n end", "def results\n @dataset.all\n end", "def self_and_descendants_from_active_record\n [self]\n end", "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end", "def to_a\n @rows\n end", "def all_rows_for(type, request)\n all_dataset_for(type, request).all\n end", "def records\n Importu::Record::Iterator.new(@source.rows, config)\n end", "def each\n @cursor.forEach { |row| yield @model_class.new(row) }\n end", "def all_rows\n rows = []\n while row = next_row\n rows << row\n end\n return rows\n end", "def query\n ::Dummy.all\n end", "def all\n data\n end", "def all_objects(opts = {})\n objects(\"*\", opts)\n end", "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "def all_objects\n objects = []\n each_namespace{|n| objects << n}\n each_namespace{|n| \n n.each_relvar{|r| objects << r}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_candidate_key{|k| objects << k}}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_foreign_key{|k| objects << k}}\n }\n objects\n end" ]
[ "0.8098161", "0.8090431", "0.7949621", "0.7930559", "0.7898488", "0.78934777", "0.78613794", "0.7834249", "0.7743518", "0.77111906", "0.73122084", "0.70876086", "0.6983087", "0.6976729", "0.6970721", "0.6849735", "0.6780889", "0.67503935", "0.6690838", "0.6679457", "0.66497296", "0.66402614", "0.66186494", "0.6609051", "0.6600165", "0.65661085", "0.6547361", "0.6535542", "0.6448918", "0.6425313", "0.641289", "0.63989115", "0.6370316", "0.6363607", "0.6362147", "0.63557243", "0.633825", "0.6310059", "0.62622297", "0.62405825", "0.62009263", "0.619535", "0.619231", "0.6185255", "0.6179224", "0.6178552", "0.61460537", "0.61445415", "0.6128841", "0.60898924", "0.60895616", "0.6052305", "0.6048027", "0.60480034", "0.60427123", "0.60337", "0.6033445", "0.60298085", "0.6028012", "0.602074", "0.6016335", "0.60134524", "0.60006267", "0.5984835", "0.59816164", "0.5975899", "0.59748363", "0.59637", "0.59578526", "0.5927752", "0.5923587", "0.5910834", "0.5910834", "0.5910299", "0.59023166", "0.5888759", "0.58879125", "0.58878654", "0.58838284", "0.58792466", "0.5874586", "0.58681583", "0.58609456", "0.58603734", "0.58549625", "0.58499", "0.58439875", "0.58378506", "0.5835205", "0.5827381", "0.5818031", "0.5817752", "0.5802876", "0.5796308", "0.57883567", "0.5781585", "0.57698524", "0.5769162", "0.5752053", "0.5738215", "0.57141644" ]
0.0
-1
Retruns a collection of Authorizations::Query::Result objects that can be serialized for client applications to consume.
def serializable results = [] each do |object, permissions| results << SerializableResult.new(object, permissions) end results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "def to_a\n return @results\n end", "def results\n\t\t\tArray(result)\n\t\tend", "def to_a\n return @records unless loadable?\n\n @response = cache.get_or_set_query(klass, options) do\n connection.documents({ query: options })\n end\n\n @records = []\n\n if @response.success?\n records = @response.members.attributes[\"query\"]\n\n records.each do |record|\n @records << klass.new(record.merge(persisted: true))\n end\n\n @loaded = true\n end\n\n @records\n end", "def all\n results_from(response)\n end", "def get_query_results(query)\n hits = execute_query(query).hpath('hits.hits').first\n return [] unless hits && !hits.empty?\n hits.map do |hit|\n hit['_source'].expand.merge(hit.only('_id', '_type', '_index')).kmap do |key|\n key.to_s.gsub('@', '_').to_sym\n end\n end\n end", "def fetch_all\n self.to_a\n end", "def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end", "def results(client)\n @client = client\n\n res = @client.search\n collections = load_all(res.data.hits.hit.map(&:id))\n if @client.parameters[:size] && @client.parameters[:start]\n round_correct_page\n\n Nazrin.paginated_array(\n collections,\n current_page: @current_page,\n per_page: @client.parameters[:size],\n total_count: res.data.hits.found,\n last_page: @last_page)\n else\n collections\n end\n end", "def results\n unless errors\n if total_results_returned == 1\n [Yahoo::SE::Result.new(self.to_json[\"ResultSet\"][\"Result\"])]\n elsif total_results_available == 0\n []\n else\n self.to_json[\"ResultSet\"][\"Result\"].map do |result_hash|\n Yahoo::SE::Result.new(result_hash)\n end\n end\n end\n end", "def to_a\n fetch(ids)\n end", "def to_a\n fetch(ids)\n end", "def results\n @scope.where(@scope.primary_key => @ids).to_a\n end", "def raw_results\n results\n end", "def results\n get_domain_data\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def index\n @q = apply_scopes(User).all.search(params[:q])\n @users = @q.result(distinct: true).page(params[:page])\n\n respond_with(@users)\n end", "def results\n fetch unless @results\n @results\n end", "def query_multiple_results(query_string, provided_client = nil)\n results = with_client(provided_client) do |client|\n result = []\n result << client.query(query_string)\n result << client.store_result while client.next_result\n result.compact\n end\n\n results.map(&:to_a)\n end", "def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend", "def to_a\n data.all\n end", "def array_result\n [@result['results']].flatten\n end", "def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "def results_for_query(query)\n raise ArgumentError unless query.is_a?(Query)\n @results[query] ? @results[query] : []\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def get_query_result_docs(query_obj)\n response = @query_server.query(query_obj)\n response.getResults\n end", "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def get_all\n\t\tif !params.has_key?(\"count\") or params[:count].empty?\n\t\t\tparams[:count]= 50\n\t\tend\n\t\tif !params.has_key?(\"start\") or params[:start].empty? \n\t\t\tparams[:start] = 0 \n\t\tend\n\t\tusers = []\n\t\tUser.all.limit(params[:count]).offset(params[:start]).each do |u|\n\t\t\thash = u.attributes \n\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\tusers.push(hash)\n\t\tend\n\t\trespond({ status: 0, users: users, start: params[:start] })\n\tend", "def to_a\n @result\n end", "def to_a\n @result\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def results\n @results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetCollectionResultSet.new(resp)\n return results\n end", "def resultset; end", "def index\n @q = Client.ransack(params[:q])\n\n @clients = @q.result.includes(:state, :city, :employee).accessible_by(current_ability).order(id: :desc).page params[:page]\n end", "def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end", "def resultset\n @resultset ||= parse_resultset(stored_data)\n end", "def find_all_accounts(authorizer)\n debug \"central find_all_accounts\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def all\n load[:results]\n end", "def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end", "def raw_all\n query_all\n end", "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end", "def raw\n results\n end", "def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end", "def query_result_set(query)\n\t result = ValueSet.new\n\t call(:query_result_set, query) do |marshalled_set|\n\t\tfor task in marshalled_set\n\t\t task = local_object(task)\n\t\t Distributed.keep.ref(task)\n\t\t result << task\n\t\tend\n\t end\n\n\t result\n\tend", "def results_as_objects(results)\n array_of_objects = []\n results.each do |hash|\n array_of_objects << self.new(hash)\n end\n return array_of_objects\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def results\n @dataset.all\n end", "def results\n populate\n @results\n end", "def to_response\n []\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def results(query, reverse = false)\n raise NotImplementedError.new\n end", "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def results_from(response)\n response.data.collect do |obj|\n case resource\n when RedboothRuby::Client\n next unless resource_form_hash(obj.merge(session: session))\n resource_form_hash(obj.merge(session: session))\n else\n resource.new(obj.merge(session: session))\n end\n end.compact\n end", "def to_a\n if parsed_body['result']['companies']\n parsed_body['result']['companies'].map do |_,data|\n Result.new('Entity', renderer.result(data), self).finalize!\n end\n else\n []\n end\n end", "def results\n return error if error?\n return response if response?\n end", "def get_attribs_all( )\n url = \"#{self.url}/cid?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['results'] if ok?( status ) && response['results']\n return status, ''\n end", "def results\n documents\n end", "def documents\n authorizations.map(&:document)\n end", "def all\n @adapter.all(collection)\n end", "def to_a\n records\n end", "def all\n @oauth_client = OauthClient.new\n @page[:per_page] = OauthClient.count\n @oauth_clients = OauthClient.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @oauth_clients, callback: params[:callback] }\n format.xml { render xml: @oauth_clients }\n format.rss { render 'feed' }\n end\n end", "def result_set\n\t @result_set ||= plan.query_result_set(self)\n\tend", "def get_objects(syncer, query, status)\n\t\traise \"getObjects: Not Implemented\"\n\t\t\n\t\t# object_list = []\n\t\t# #for each object that matches the query\n\t\t# # object = an active record database object that contains the information from the store object\n\t\t# # store_object_id = the object_id of the store object\n\t\t# object.set_dbID(syncer, self, store_object_id)\n\t\t# object_list.push(object)\n\t\t# #end\n\t\t# return object_list\n\tend", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetAccountDetailsResultSet.new(resp)\n return results\n end", "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "def results\n @results ||= paginate_collection(verified_hits.map { |hit| hit.instance })\n end", "def results\n @results ||= paginate_collection(verified_hits.map { |hit| hit.instance })\n end", "def all\n table_name = self.table_name\n \n results = CONNECTION.execute(\"SELECT * FROM '#{table_name}';\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetPublicListResultSet.new(resp)\n return results\n end", "def fetch_all\n fetch_many0(nil, Array)\n end", "def get_results\n response = @api.get(@cloud.url(:result, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @results = []\n response.each do |res|\n @results.push(CopyleaksApi::ResultRecord.new(res))\n end\n @results\n end", "def all\n response = RestClient::Request.execute({\n url: \"https://#{connection.path}/apiv1/Get\",\n method: :get,\n verify_ssl: false,\n headers: { params: { typeName: geotab_reference_name, credentials: connection.credentials, search: formatted_conditions }}\n })\n\n body = MultiJson.load(response.body).to_ostruct_recursive\n\n if MultiJson.load(response.body).has_key?(\"error\")\n if body.error.errors.first.message.start_with?(\"Incorrect MyGeotab login credentials\")\n raise IncorrectCredentialsError, body.error.errors.first.message\n else\n raise ApiError, body.error.errors.first.message\n end\n else\n attributes = body.result\n results = []\n\n if attributes && attributes.any?\n attributes.each do |result|\n results.push(new(result, connection))\n end\n end\n\n reset\n\n results\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = ListCollectionsResultSet.new(resp)\n return results\n end", "def results ; @@RESULT_DIRS.keys.map{ |k| result k }.compact ; end", "def getResultRecepientEmailList()\n return @resultRecepients\n end", "def all\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n @collection.deserialize(response.entities)\n end", "def results\n if Gem.loaded_specs['simplecov'].version >= Gem::Version.new('0.19')\n ::SimpleCov::Result.from_hash(resultset)\n else\n array = []\n resultset.each do |command_name, data|\n array << ::SimpleCov::Result.from_hash(command_name => data)\n end\n array\n end\n end", "def get_results(projection = nil)\n selection = Dynamicloud::API::DynamicloudHelper.build_string(get_conditions, get_group_by, get_order_by,\n (Dynamicloud::API::DynamicloudHelper.build_projection(projection)),\n @alias, @joins)\n @current_projection = projection\n\n url = Configuration::PROPERTIES.get_property :url\n if projection\n url_get_records = Configuration::PROPERTIES.get_property :url_get_specific_fields\n else\n url_get_records = Configuration::PROPERTIES.get_property :url_get_records\n end\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credentials[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credentials[:aci])\n url_get_records = url_get_records.gsub '{mid}', @mid.to_s\n url_get_records = url_get_records.gsub '{count}', get_count.to_s\n url_get_records = url_get_records.gsub '{offset}', get_current_offset.to_s\n\n params = {\n :criteria => selection\n }\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, params, 'post'\n\n Dynamicloud::API::DynamicloudHelper.build_record_results response\n\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetAccessTokenResultSet.new(resp)\n return results\n end", "def get_all options=nil\n url = [\"/v1/catalog/services\"]\n url += check_acl_token\n url << use_named_parameter('dc', options[:dc]) if options and options[:dc]\n begin\n ret = @conn.get concat_url url\n rescue Faraday::ClientError\n raise Diplomat::PathNotFound\n end\n\n return OpenStruct.new JSON.parse(ret.body)\n end", "def index\n @authorizations = Authorization.all\n end", "def index\n @authorizations = Authorization.all\n end", "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def search(q)\n url = build_query_url q\n begin\n raw_response = json(url)\n rescue JSON::ParserError\n Rails.logger.info \"Could not parse response as JSON. Request url: #{url}\"\n return []\n end\n parse_authority_response(raw_response)\n end", "def find_all\n response = fetch()\n new(response)\n end", "def fetch\n VACUUM_QUERIES.collect { |query|\n Craigslist.city(:boulder).free.query(query).fetch\n }.flatten\n end", "def get_records\n return error_response unless is_get_records_request?\n as_json\n end", "def results\n raise NotImplementedError\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def result\n if success?\n results = to_hash['results'] || []\n count == 1 ? results.first : results\n else\n []\n end\n end", "def all(client, opts = {})\n request = Request.new(client, :get, RESOURCE_COLLECTION, params: opts)\n Cursor.new(self, request, init_with: [client])\n end", "def index\n @clients = Client.where(params.except(:action, :controller, :format)).to_a # TODO: remove .to_a when Rails to_json bug fixed\n respond_with(@clients)\n end", "def index\n respond_with(Response.collection_as_unity_JSON(:all))\n end", "def clients\n clis = []\n url = prefix + \"listc\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n clis << User.new(u[\"id\"], @authid, @subdomain, u)\n end\n return clis\n else #failed\n return users\n end\n end", "def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end", "def returning_users\n []\n end" ]
[ "0.7321772", "0.6461048", "0.6400923", "0.6286542", "0.6171394", "0.6171019", "0.60967255", "0.6091276", "0.60432345", "0.5935571", "0.5913783", "0.5913783", "0.59001476", "0.58964026", "0.58836544", "0.5872037", "0.5868297", "0.580177", "0.58009595", "0.57990634", "0.57929194", "0.5787817", "0.5785725", "0.57742405", "0.57555276", "0.57551837", "0.5747491", "0.573653", "0.5722006", "0.5720067", "0.5716355", "0.5716355", "0.57124853", "0.5708407", "0.5700525", "0.56973094", "0.5685161", "0.5678024", "0.566711", "0.56598043", "0.5656685", "0.5655579", "0.5627839", "0.56187224", "0.56171846", "0.5614667", "0.5607185", "0.5600914", "0.5591691", "0.55900806", "0.558761", "0.5581779", "0.55793667", "0.5572111", "0.55682623", "0.556088", "0.555966", "0.55560493", "0.5551548", "0.5550746", "0.5549436", "0.5549169", "0.5539722", "0.5514881", "0.55129784", "0.5512413", "0.5510442", "0.5498262", "0.5497897", "0.549567", "0.549567", "0.549515", "0.5495052", "0.54886204", "0.5481598", "0.54784685", "0.54758805", "0.5474115", "0.5473209", "0.545993", "0.5443877", "0.54405254", "0.54348326", "0.54327595", "0.54287475", "0.54287475", "0.54161346", "0.5415201", "0.54076344", "0.5405459", "0.5403166", "0.54004645", "0.53892475", "0.5384075", "0.5377955", "0.53716826", "0.53705746", "0.5366088", "0.5357173", "0.5353513" ]
0.6175182
4
the array of groups. Case doesn't matter in classifying string as anagrams (but case should be preserved in the output), and the order of the anagrams in the groups doesn't matter.
def combine_anagrams(words) [] unless words.empty? combine = Hash.new words.each do |word| sorted = word.downcase.chars.sort.join if combine.has_key?(sorted) combine[sorted] << word else combine[sorted] = [word] end end combine.values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grouped_anagrams(strings)\n return [] if strings.empty?\n\n result = {}\n groups = []\n\n strings.each do |word|\n key = word.split(\"\").sort.join\n if result.has_key?(key)\n result[key] << word\n else\n result[key] = [word]\n end\n end\n\n result.each do |k, v|\n groups << v\n end\n\n return groups\nend", "def group_anagrams(arr)\n hash = Hash.new { |h, k| h[k] = [] }\n arr.each do |str|\n hash[str.chars.sort] << str\n end\n\n hash.values.map(&:sort)\nend", "def grouped_anagrams(strings)\n\n hash = {}\n\n # take each word in 'strings' array ...\n strings.each do |word|\n # ... and split it into letters, alphabetize those letters, and join them back together: this produces a standardized string for words that are anagrams of each other ('ate', 'eat' => 'aet')\n letters = word.split(//).sort().join()\n \n # if the standardized string isn't already in the hash, add it as the key and an empty array as the value\n if hash[letters].nil?\n hash[letters] = []\n end\n\n # push the word to the array for the associated standardized string\n hash[letters] << word\n\n end\n\n # return the values (array of words that are anagrams) for each standardized string\n return hash.values\n\nend", "def grouped_anagrams(strings)\n return [] if strings == []\n anagrams = {}\n\n strings.each_with_index do |string, i|\n sorted_string = string.split(\"\").sort.join(\"\").downcase\n if anagrams[sorted_string]\n anagrams[sorted_string] << string\n else\n anagrams[sorted_string] = [string]\n end\n end\n\n return anagrams.values\nend", "def grouped_anagrams(strings)\n hash = Hash.new\n strings.each do |element|\n key = element.chars.sort.join()\n groupedAnagrams = hash[key]\n if groupedAnagrams == nil\n hash[key] = []\n groupedAnagrams = hash[key]\n end\n groupedAnagrams << element\n end\n return hash.values\nend", "def grouped_anagrams(strings) \n h = {}\n return [] if strings.nil? || strings.empty? || !strings.is_a?(Array)\n strings.each do |str| \n key = str.chars.sort.join\n if h.include?(key)\n h[key] << str\n else\n h[key] = [str]\n end \n end\n return h.values\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n\n anagram_hash = Hash.new()\n strings.each do |string|\n word_array = string.split(\"\").sort\n if anagram_hash.include?(word_array)\n anagram_hash[word_array] << string\n else\n anagram_hash[word_array] = [string]\n end\n end\n\n result = []\n anagram_hash.each do |key, value|\n result << value\n end\n return result\n\nend", "def grouped_anagrams(strings)\n # create an anagrams hash of arrays\n anagrams = {}\n # for each string, split the characters and sort them\n # join the characers, and test the hash keys\n # if the key already exists add it to the array of that key\n # if not create one\n strings.each do |word| \n sorted_word = word.split(//).sort.join\n if anagrams[sorted_word]\n anagrams[sorted_word] << word\n else\n anagrams[sorted_word] = [word]\n end\n end\n \n # return the arrays\n anagrams.values\nend", "def grouped_anagrams(strings)\n hash = {}\n\n strings.each do |word|\n letter_grouping = word.split('').sort().join()\n\n if !hash[letter_grouping]\n hash[letter_grouping] = []\n end \n \n hash[letter_grouping] << word\n end \n\n return hash.values\nend", "def grouped_anagrams(strings)\n hash = {}\n\n strings.each do |string|\n sorted_string_array = string.split(\"\").sort\n\n if hash[sorted_string_array]\n hash[sorted_string_array] << string\n else\n hash[sorted_string_array] = [string]\n end\n end\n\n answer = []\n\n hash.each do |key, value|\n answer.push(value)\n end\n\n return answer\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n hash = {}\n\n strings.each do |string|\n alphabetized = string.chars.sort.join\n\n if hash[alphabetized]\n hash[alphabetized] << string\n else\n hash[alphabetized] = [string]\n end\n end\n return hash.values\nend", "def grouped_anagrams(strings)\n grouped = {}\n strings.each do |e|\n current_sorted = e.split(\"\").sort.join(\"\") \n if !grouped[\"#{current_sorted}\"]\n grouped[\"#{current_sorted}\"] = [e]\n else\n grouped[\"#{current_sorted}\"] << e\n end \n end \n return grouped.values\nend", "def grouped_anagrams(strings)\n result = []\n return result if strings.empty?\n\n anagrams = {}\n strings.each do |string|\n sorted_string = string.split(\"\").sort.join(\"\")\n anagrams[sorted_string] ? anagrams[sorted_string] << string : anagrams[sorted_string] = [string]\n end\n\n return anagrams.values\nend", "def grouped_anagrams(strings)\n hash = {}\n acc = 0\n return_array = []\n strings.each do |str|\n if !(hash[str.split(//).sort!.join().hash])\n hash[str.split(//).sort!.join().hash] = acc\n return_array[acc] = [str]\n acc += 1\n else\n return_array[hash[str.split(//).sort!.join().hash]] << str\n end\n end\n return return_array\nend", "def grouped_anagrams(strings)\n res = []\n return res if strings.empty?\n hash = {}\n strings.each do |word|\n key = word.split(\"\").sort.join\n if hash[key]\n hash[key] << word\n else\n hash[key] == [word]\n end\n end\n hash.each do |k, v|\n res << v \n end\n return res\nend", "def grouped_anagrams(strings)\n string_hashmap = {}\n strings.each do |string|\n if string_hashmap[grouped_anagrams_helper(string)]\n string_hashmap[grouped_anagrams_helper(string)] << string\n else\n string_hashmap[grouped_anagrams_helper(string)] = []\n string_hashmap[grouped_anagrams_helper(string)] << string\n end\n end\n return string_hashmap.values\nend", "def grouped_anagrams(strings)\n\n string_hash = {}\n\n strings.each do |string|\n \n temp = string.chars.sort.join\n if string_hash.has_key?(temp)\n string_hash[temp] << string\n else\n string_hash[temp] = Array.new()\n string_hash[temp] << string\n end\n \n end\n return string_hash.values\n\nend", "def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "def grouped_anagrams(strings)\n results = []\n return results if strings.empty?\n\n hash_map = {}\n set_no = 1 \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.empty?\n hash_map[set_no] = letters\n set_no += 1\n elsif !hash_map.has_value?(letters)\n hash_map[set_no] = letters\n set_no += 1\n end \n end \n\n results = []\n\n hash_map.keys.each do |sub_arr|\n sub_arr = []\n results << sub_arr\n end \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.has_value?(letters)\n sub_group = hash_map.key(letters)\n results[sub_group-1] << word\n end \n end \n\n results.each do |list|\n list.sort!\n end \nend", "def grouped_anagrams(strings)\n strings = {}\n\n strings.each do |string|\n # https://stackoverflow.com/questions/9464065/how-to-sort-a-strings-characters-alphabetically\n alphabetized_string = string.chars.sort.join\n if strings[alphabetized_string]\n strings[alphabetized_string] << [string]\n else\n strings[alphabetized_string] = [string]\n end\n end\n\n return strings.values\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n\n hash_groups = []\n anagrams_grouped = []\n\n strings.each do |string|\n string_hash = {}\n\n # count freq of characters in string through hash\n string.each_char do |char|\n if string_hash[char]\n string_hash[char] += 1\n else\n string_hash[char] = 1\n end\n end\n\n # if no hash_groups exist, add new string hash to hash group and add string to anagrams list\n if hash_groups.empty?\n hash_groups << string_hash\n anagrams_grouped << [string]\n \n # otherwise, test string hash against all previous hashes, if match, add to existing anagram group, if unique, add hash group, create new anagram group\n else\n unique = true\n hash_groups.each_with_index do |hash, index|\n if hash == string_hash\n unique = false\n anagrams_grouped[index] << string\n end\n end\n\n if unique\n hash_groups << string_hash\n anagrams_grouped << [string]\n end\n end\n end\n\n return anagrams_grouped\nend", "def grouped_anagrams(strings)\n hash = {}\n strings.each do | i |\n key = i.chars.sort.join\n if hash[key] != nil \n hash[key] << i\n else \n hash[key] = [i]\n end\n end\n return hash.values\n\nend", "def grouped_anagrams(strings)\n sorted_words = {}\n anagrams = []\n\n strings.each do |word|\n word_sorted = word.chars.sort.join\n if !sorted_words.keys.include?(word_sorted)\n # In the hashmap, the sorted word will point to the index in the outer array that the anagram should be placed.\n index = sorted_words.length\n sorted_words[word_sorted] = index\n anagrams[index] = [word]\n else\n # Add anagram to correct group.\n anagrams[sorted_words[word_sorted]].push(word)\n end\n end\n\n return anagrams\nend", "def grouped_anagrams_version2(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # new array has the same number of elements as the input array\n # each inner array has 25 elements, by the number of letter in the English alphabet\n anagrams_storage = {}\n strings.each do |word|\n letters = Array.new(26, 0)\n word.chars.each do |char|\n # get an Integer ordinal of a letter\n letters[char.ord - 97] += 1\n end\n\n # we freeze the array as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { [1,0,0,0...all 26 elements] => [\"tan\", \"nat\", \"ant\"] }\n return anagrams_storage.values\nend", "def grouped_anagrams(strings)\n if strings.length == 0\n return []\n end\n\n anagram_hash = {}\n\n strings.each do |string|\n sorted_letters = string.split(\"\").sort.join\n if anagram_hash[sorted_letters]\n anagram_hash[sorted_letters] << string\n else\n anagram_hash[sorted_letters] = [string]\n end\n end\n return anagram_hash.values\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n numbered_letters = {}\n ('a'..'z').each_with_index { |l, i| numbered_letters[l] = i}\n\n possible_anagrams = {}\n\n strings.each do |string|\n value = 0\n string.each_char do |char|\n value += numbered_letters[char]\n end\n if possible_anagrams[value]\n possible_anagrams[value] << string \n else\n possible_anagrams[value] = [string]\n end\n end\n\n return possible_anagrams.values\nend", "def grouped_anagrams(strings)\n return [] if strings.length == 0\n \n hash = {}\n strings.each do |word|\n sorted_word = word.split(\"\").sort\n if hash[sorted_word]\n hash[sorted_word] << word\n end\n end\n final_anagrams = []\n hash.each do |k, v|\n anagrams << v\n end\n return final_anagrams\nend", "def grouped_anagrams(strings)\n return [] if strings.length == 0\n\n result = []\n hash = {}\n count = 0\n\n strings.each do |string|\n sorted_string = string.chars.sort.join\n\n if hash[sorted_string] \n result[hash[sorted_string]].push(string)\n else\n hash[sorted_string] = count\n result.push([string])\n count += 1\n end\n end\n\n return result\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n anagram_hash = {}\n \n strings.each do |word|\n letters = word.split(\"\").sort.join(\"\")\n if anagram_hash[letters].nil?\n anagram_hash[letters] = [word]\n else\n anagram_hash[letters] << word\n end\n end\n return anagram_hash.values\nend", "def grouped_anagrams(strings)\n return [] if strings.empty?\n\n #create empty hash\n hash = {}\n strings.each do |word|\n alphabet = word.chars.sort.join\n if !hash[alphabet]\n hash[alphabet]\n else\n hash[alphabet] = [word]\n end\n end\nend", "def groups_from_string(groups_string)\n unless groups_string.blank?\n groups = smart_split groups_string # split on comma, remove white space\n return groups.map {|g| Group.find_or_create_by_group_name(g, :abbrev => g)}.uniq\n end \n end", "def grouped_anagrams(strings)\n hash_ana = {}\n outerArray = []\n\n # The way I identify they are anagrams is using bytes to get the ASCII value of each char sum them,\n # Then we know all the characters have the same letter on it.\n strings.each do |string|\n if hash_ana[string.bytes.sum]\n hash_ana[string.bytes.sum].push(string)\n else\n hash_ana[string.bytes.sum] = [string]\n end\n end\n\n hash_ana.each do |key|\n outerArray << key[1]\n end\n\n return outerArray\nend", "def grouped_anagrams(strings)\n\n new_hash = Hash.new()\n\n strings.each do |word|\n # calculate the hash key\n key_word = word.downcase.chars.sort.join\n\n if new_hash[key_word] == nil\n new_hash[key_word] = []\n end\n array_value = new_hash[key_word]\n\n length = array_value.length\n array_value[length] = word\n end\n\n return new_hash.values\nend", "def group_anagrams(words)\n if words.length == 0\n return []\n end\n\n sorted_words = words.map { |word|\n word.split(\"\").sort().join(\"\")\n }\n indices = (Array.new(words.length) { |i| i }).sort { |a, b| sorted_words[a] <=> sorted_words[b] }\n\n result = []\n current_anagram_group = []\n current_anagram = sorted_words[indices[0]]\n\n indices.each { |index|\n word = words[index]\n sorted_word = sorted_words[index]\n\n if sorted_word == current_anagram\n current_anagram_group << word\n next\n end\n\n result << current_anagram_group\n current_anagram_group = [word]\n current_anagram = sorted_word\n }\n result << current_anagram_group\nend", "def grouped_anagrams(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # a hash is going to have hashes with letters as a key, and array of words\n # containing those letters as values\n anagrams_storage = {}\n strings.each do |word|\n # create a hash with letters as keys and a number of times it appears in that word as values\n letters = {}\n word.chars.each do |char|\n if letters[char]\n letters[char] += 1\n else\n letters[char] = 1\n end\n end\n # we freeze the hash as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { {\"t\"=>1,\"a\"=>1,\"n\"=>1} => [\"tan\", \"nat\", \"ant\"], \"b\"=>1,\"a\"=>1,\"t\"=>1} => [\"bat\"] }\n return anagrams_storage.values\nend", "def group_anagrams(strs)\n hash = {}\n \n strs.each do |s|\n sorted = s.split('').sort().join()\n if !hash[sorted]\n hash[sorted] = [s]\n else\n hash[sorted].push(s)\n end\n end\n\n hash.values\nend", "def group_anagrams(words)\n anagrams = {}\n words.each { |word|\n sorted_word = word.split(\"\").sort().join(\"\")\n if anagrams.has_key?(sorted_word)\n anagrams[sorted_word] << word\n else\n anagrams[sorted_word] = [word]\n end\n }\n return anagrams.values()\nend", "def combine_anagrams(words)\r\n words.group_by{|w| w.downcase.chars.sort.to_s}.values\r\nend", "def grouped_anagrams(strings)\n \n inventory = {}\n # key = alphabetically sorted word\n # value = array of original word(s), where each can be sorted into the key.\n # example: \"bat\" from strings[] would show up in inventory as \"abt\" => [\"bat\"]\n # and later if \"tab\" is found in strings[], inventory would now include \"abt\" => [\"bat\", \"tab\"]\n \n strings.each do |word|\n # source for line below: https://solidfoundationwebdev.com/blog/posts/how-to-sort-a-string-alphabetically-in-ruby\n sortedWord = word.chars.sort_by(&:downcase).join\n \n if inventory[sortedWord]\n inventory[sortedWord] << word \n else\n inventory[sortedWord] = [word]\n end\n end\n \n output = []\n inventory.each do |key, value|\n output << value\n end\n \n return output\nend", "def grouped_anagrams(strings)\n word_hash = {}\n\n strings.each do |word|\n char_hash = {}\n\n word.each_char do |char|\n if char_hash[char] \n char_hash[char] += 1\n else\n char_hash[char] = 1\n end\n end\n\n if word_hash[char_hash]\n word_hash[char_hash] << word\n else\n word_hash[char_hash] = [word]\n end\n end\n\n return word_hash.values\nend", "def anagrams(string, array)\nend", "def combine_anagrams(words)\r\n\tanagrams = words.group_by { |word| word.chars.sort }.values\t\r\nend", "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "def grouped_anagrams(strings)\n return strings if strings.empty?\n \n anagrams = {}\n # for each word, if the sum is in the hash\n strings.each do |word|\n if anagrams[word.sum].nil?\n anagrams[word.sum] = [word]\n else\n anagrams[word.sum] << word\n end\n end\n \n return anagrams.values\nend", "def grouped_anagrams(strings)\n string_hash = {}\n\n strings.each do |string|\n key = string.split(\"\").sort.join # probably an O(n log n) operation, I couldn't find an integer based hashing function i liked\n\n string_hash[key] ||= [] # trying this thing out\n string_hash[key] << string\n end\n \n return string_hash.values # also probably an O(n) operation\nend", "def grouped_anagrams(strings)\n result = {}\n strings.each do |word|\n letter_occurrence = {}\n word.each_char do |char|\n if letter_occurrence[char] \n letter_occurrence[char] += 1\n else\n letter_occurrence[char] = 1\n end\n end\n \n if result[letter_occurrence]\n result[letter_occurrence] << word\n else\n result[letter_occurrence] = [word]\n end\n end\n return result.values\nend", "def combine_anagrams(words)\n groups = []\n words.each { |word|\n inserted = false\n groups.each { |item|\n if word.isAnagram(item[0])\n item << word\n inserted = true\n end\n }\n if ! inserted\n list = []\n list << word\n groups << list\n end\n }\n return groups\nend", "def combine_anagrams(words)\n\toutput = Array.new # function result\n\twords.each do |word|\n\t\tsorted = word.upcase.chars.sort.join\n\t\tprint sorted, ' '\n\t\tgroup = output.find {|g| sorted == g[0].upcase.chars.sort.join}\n\t\tif not group\n\t\t\tgroup = []\n\t\t\toutput.push group\n\t\tend\n\t\tgroup.push word\n\tend\n\toutput\nend", "def grouped_anagrams(strings)\n hash_map = {}\n \n strings.each do |str| #n\n chars = str.chars #k length of string\n sorted = chars.sort # k log(k)\n hash_map[sorted] ? hash_map[sorted].push(str) : hash_map[sorted] = [].push(str)\n end\n \n return hash_map.values\nend", "def group_anagrams(strs)\n result = Hash.new{|h,k| h[k] = []}\n strs.each do |str|\n hash = Hash.new(0)\n str.each_char do |char|\n hash[char] +=1\n end\n result[hash] << str\n end\n return result.values\nend", "def discover_groups_string\n discover_groups.join(', ')\n end", "def combine_anagrams(words)\n anagrams = []\n available_words = words\n words.each do |e|\n group = []\n temp_words = []\n anagram_invariant = e.downcase.chars.sort.join\n available_words.each do |i|\n test = i.downcase.chars.sort.join\n if test == anagram_invariant\n group.push(i)\n else\n temp_words.push(i)\n end\n end\n if(!group.empty?)\n anagrams.push(group)\n end\n available_words = temp_words\n end\n return anagrams\nend", "def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend", "def groups(*groups); end", "def groups(*groups); end", "def combine_anagrams(words)\n words.group_by {|w| w.downcase.chars.sort {|a,b| a <=> b}.to_s}.values\nend", "def combine_anagrams(words)\n groups = Hash.new\n words.each do |word|\n (groups[word.downcase.chars.sort.join] ||= []) << word\n end\n groups.flatten.values_at(* groups.flatten.each_index.select {|i| i.odd?})\nend", "def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend", "def combine_anagrams(words)\n\n\twords.group_by{|word| word.downcase.chars.sort}.values\n\t\nend", "def grouped_anagrams(strings)\n words = {} \n \n until strings.empty? \n i = 0 \n word_to_compare = strings[0] # \"eat\" => \"tan\" => \"bat\"\n words[word_to_compare] = []\n # [\"eat\", \"tea\", \"ate\"]\n # [\"tan\", \"nat\"]\n # [\"bat\"]\n\n while i < strings.length \n if permutation(word_to_compare, strings[i])\n words[word_to_compare].push(strings[i])\n strings.delete_at(i) \n i -= 1\n end\n i += 1 # 0 => 0\n end\n end\n\n return words.values\nend", "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "def group_names\n groups.collect { |g| g.name }\n end", "def match(array) #takes in an array of possible anagrams\n anagrams = []\n \n # iterate over array of words\n array.each do |word|\n # compare each word of array to OG word \n # determine if word is anagram\n if word.chars.sort == @word.chars.sort\n anagrams << word\n end\n end\n anagrams #return all matches/ empty array if no matches exist\n end", "def groups\n z.standardize.map do |val|\n if val.positive?\n 'H'\n else\n 'L'\n end\n end\n end", "def combine_anagrams(words) \n # for each word, sort the word to create the \n # signature for the anagrams\n anagram_groups = {}\n words.each do |w|\n key = w.downcase.chars.sort.join\n if anagram_groups[key].nil?\n anagram_groups[key] = [w]\n else\n anagram_groups[key].push(w)\n end\n end\n \n return anagram_groups.values\n\nend", "def make_groups(array)\n groups=Hash.new\n counter = 1\n while array.length > 3\n selection = array.sample(4)\n groups[counter] = selection\n selection.each {|x| array.delete(x)}\n counter += 1\n end\n while array.length != 0\n counter -= 1\n groups[counter] << array.pop\n end\n groups\nend", "def list_groups(data)\n groups = []\n data.each_key { |k| groups.push(k.to_s) }\n puts groups.sort.join(\" \")\nend", "def combine_anagrams(words)\r\n\tswords = Array.new\r\n\tnoDups = Array.new\r\n\tgroupWords = Array.new\r\n\tanagrams = Array.new\r\n\twords.each {|word| swords << word.downcase.chars.sort.join}\r\n\tswords.each{|word| noDups << word unless !noDups.index(word).nil? }\r\n\tnoDups.each do|tword|\r\n\t\t\t\t\t\r\n\t\t\t\t\tgroupWords = Array.new\r\n\t\t\t\t\twords.each {|word| groupWords << word unless word.downcase.chars.sort.join != tword}\r\n\t\t\t\t\tanagrams << groupWords\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\treturn anagrams\r\nend", "def combine_anagrams(wordArray)\n \n \n sortedCharsHash = Hash.new\n groupedArray = Array.new\n n = 0\n \n wordArray.each do |word|\n \n #if freq hash not in freq hash array, put in there and add to grouped array\n #if freq hash in freq hash array, iterate through items until match and put in there\n \n sortedChars = word.downcase.split(//).sort.join\n if sortedCharsHash[sortedChars]\n groupedArray[sortedCharsHash[sortedChars].to_i] << word\n else\n sortedCharsHash[sortedChars] = n\n n = n +1\n groupedArray << [word]\n end\n end\n \n return groupedArray\n \n \nend", "def get_group(string); end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def group(names)\n\tunits = []\n\t3.times do\n\t\tnames = names.shuffle\n\t\tremainder = []\n\t\tcount = names.length % 4\n\t\tcount.times do\n\t\t\tremainder << names.shift\n\t\tend\n\t\tgroupsArray = names.each_slice(4).to_a\n\t\twhile count != 0\n\t\t\tgroupsArray[count-1] << remainder.shift\n\t\t\tcount -= 1\n\t\tend\n\t\tunits << groupsArray\n\tend\n\treturn units\nend", "def discover_groups_string=(groups)\n self.discover_groups = groups.split(/[\\s,]+/)\n end", "def groups\n hyrax_groups.map(&:name)\n end", "def groups()\n grlist = []\n Etc.group { |g|\n grlist.push(g.name)\n }\n return grlist.uniq.sort\n end", "def groups\n match(/Groups\\s+:\\s+(.+)$/).split rescue []\n end", "def regroup(groups)\n return if groups.empty?\n\n index = groups.count - 2\n while true\n break if index < 0\n if groups[index + 1] && groups[index].char == groups[index + 1].char\n groups[index].count += groups[index + 1].count\n groups.delete_at(index + 1)\n end\n if groups[index].count > 2\n groups.delete_at(index)\n end\n index -= 1\n end\n\n if groups[0] && groups[0].count > 2\n groups.detele_at(0)\n end\nend", "def combine_anagrams(words)\n Array anagrams = []\n words.each {|x|\n flag = false\n anagrams.collect {|y|\n if x.downcase.chars.to_a.sort == y[0].downcase.chars.to_a.sort then\n y << x\n flag = true\n break\n end\n }\n unless flag; anagrams << [x] end \n }\n anagrams\nend", "def find_anagrams(target_word, array_of_words)\n array_of_anagrams = []\n\n array_of_words.each do |member|\n if member.split(//).sort == target_word.split(//).sort\n array_of_anagrams.push(member)\n else\n next\n end\n end\n array_of_anagrams\nend", "def combine_anagrams(strings)\n lettercombinations = strings.map{|string| string.downcase.count_regex(/\\w/)}\n lettercombinationsunique = lettercombinations.uniq\n lettercombinationsindex = lettercombinations.map{|lettercombination| lettercombinationsunique.index(lettercombination)}\n newarray = lettercombinationsunique.map{[]}#pitfall, new will make the same copy of the array throughout\n strings.each_index{|i| newarray[lettercombinationsindex[i]].push(strings[i])}\n newarray\nend", "def combine_anagrams(words)\n\tresult = []\n\twords.each do |word|\n\t\ttemp_word = sort_letters(word)\n\t\tis_found = false\n\t\tresult.each do |grouped_array|\n\t\t\tif !false and sort_letters(grouped_array.last) == temp_word\n\t\t\t\tgrouped_array << word\n\t\t\t\tis_found = true\n\t\t\tend\n\t\tend\n\t\tresult << [word] if !is_found\n\tend\n\tresult\nend", "def acct_groups(namelist)\n\tfull_size = namelist.size\n\tsize_of_group = 4 #because I counted the full list and counted 88 members... not sure how you'd go about it without having that number available\n\tnumber_of_groups = full_size / size_of_group #In this case 88/4 = 22\n\trandom_order = namelist.shuffle\n\tgroups = Array.new(number_of_groups) {[]}\n\t\tuntil random_order.empty?\n\t\t\tgroups.each do |group| \n\t\t\tgroup << (random_order.pop)\n\t\t\tend\n\t\tend\n\t\nreturn groups\nend", "def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend", "def groups; end", "def groups; end", "def groups; end", "def combine_anagrams(words)\n anagram_group = Hash.new([])\n words.each {|word| anagram_group[word.downcase.split(//).sort.join] += [word]}\n return anagram_group.values\nend", "def part1 groups\n return groups.map { | g |\n g.gsub(/[^a-z]/,\"\").chars.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "def hyrax_group_names\n groups\n end", "def anagrams_for(word, array)\n #Pasar la palabra a minuscula para que sea igual\n word.downcase!\n #Arreglo vacio para meter los que sean anagramas\n arr = []\n #Separar la palabra en su forma canonica\n cano = word.chars.sort\n #iterar dentro de cada palabra del array\n array.each do |dicc|\n #crear una variable donde pase la palabra del array a su forma canonica\n word_cano = dicc.chars.sort\n #si la palabra es igual a la palabra del array\n #Ya las 2 en su forma canonica\n if cano == word_cano\n #mete la palabra a el array\n arr << dicc\n #De lo contrario deja el array igual\n else\n arr\n end\n end\n #Regresar el array lleno si habia palabras\n #o vacio si no las encontro\n arr\nend", "def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end", "def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end", "def group_maker(array)\n group_hash = {}\n arrays = array.each_slice(5).to_a\n arrays.each do |item|\n if item.length == 2\n arrays[0].push(item[0])\n arrays[1].push(item[1])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n \n elsif item.length == 1\n arrays[0].push(item[0])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n else\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n end\n end\n return group_hash\nend", "def group_names\r\n\t\tnames = []\r\n\t\tgroup.each do |mem|\r\n\t\t\tnames << mem.name\r\n\t\tend\r\n\t\tnames\r\n\tend", "def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end", "def groups\n find(:group).map { |g| g.content }\n end", "def i_groups; end", "def grouper(array)\n array = array.shuffle\n p num_groups = array.length / 4\n p remainder = array.length % 4\n groups = Array.new\n array.each_slice(4) {|slice| groups.push(slice)}\n if array.length == 6\n groups[1].push(groups[0][3])\n groups[0].pop\n\n elsif remainder == 0\n return groups\n elsif remainder == 1\n groups[0].push(groups[-1][0])\n groups.pop\n elsif remainder == 2\n groups[0].push(groups[-1][0])\n groups[1].push(groups[-1][1])\n groups.pop\n end\np groups\nend", "def acct_groups(names)\r\n\r\n\tnum_groups = names.size / 4\r\n\r\n\tgroups_ary = Array.new(num_groups) { Array.new }\r\n\r\n\tnames.each_with_index do |name, index|\r\n\t\tgroups_ary[index % num_groups] << name\r\n\tend\r\n\r\n\tgroups_hash = Hash.new\r\n\tgroups_ary.each_with_index do |group_ary, index|\r\n\t\tgroups_hash[\"Accountability Group \" + (index+1).to_s] = group_ary\r\n\tend\r\n\r\n\treturn groups_hash\r\n\r\nend", "def anagrams(array_of_words)\n ana_hash = Hash.new { |hash, key| hash[key] = [] }\n array_of_words.each { |word| ana_hash[word.split(\"\").sort.join] << word }\n ana_hash.map { |key, list| list }.select { |list| list.size > 1 }\nend" ]
[ "0.7192206", "0.7080902", "0.70755094", "0.70583254", "0.7051047", "0.7012753", "0.7006105", "0.70009506", "0.6990449", "0.6973939", "0.69702774", "0.6956652", "0.6953352", "0.69491625", "0.69365895", "0.69168514", "0.69047385", "0.6903787", "0.6893285", "0.6885485", "0.68852746", "0.68800664", "0.6870944", "0.6867599", "0.6853093", "0.68432987", "0.6813606", "0.6767897", "0.67157984", "0.67150307", "0.6670649", "0.6668169", "0.66463435", "0.6597414", "0.65914255", "0.6582434", "0.6579879", "0.6518426", "0.6514458", "0.6510082", "0.6482977", "0.6482437", "0.64741373", "0.64615715", "0.64483374", "0.64241284", "0.6418449", "0.63882625", "0.63532495", "0.63461334", "0.6339626", "0.6338323", "0.63329893", "0.6320319", "0.6320319", "0.630668", "0.62924767", "0.62693286", "0.6253761", "0.6237554", "0.6166554", "0.61641324", "0.61286527", "0.61110383", "0.6109751", "0.60988", "0.60788167", "0.6060243", "0.60540116", "0.6031255", "0.60256755", "0.60237145", "0.60144573", "0.59961873", "0.59895146", "0.5977309", "0.59677976", "0.5959973", "0.595173", "0.59444666", "0.5935265", "0.59266436", "0.5923606", "0.59234196", "0.5915937", "0.5915937", "0.5915937", "0.5890307", "0.5883396", "0.5864563", "0.5851349", "0.5848775", "0.5848775", "0.5844625", "0.58226573", "0.5804027", "0.5802371", "0.5798794", "0.57934564", "0.5788343", "0.578528" ]
0.0
-1
TODO: POST ajax query
def change_status # Администратор может поменять статус заявки на любой. Клиент же только на "отменена" if current_user.owner_or_worker?(@organization) || (current_user == @appointment.user_by_phone && %w(cancel_client).include?(params[:state])) @appointment.status = params[:state] respond_to do |wants| if @appointment.save wants.html { redirect_to calendar_path(day: @appointment.start.to_i, worker_id: @appointment.worker_id), notice: 'Статус успешно изменен' } wants.js { render js: refresh_calendar } else wants.html { redirect_to calendar_path(day: @appointment.start.to_i, worker_id: @appointment.worker_id), notice: 'При сохранении произошла ошибка' } wants.js { render js: "alert('при сохранении произошла ошибка'" } end end else redirect_to :back, alert: 'У вас не достаточно прав' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 POST; end", "def post\n request_object.post_query\n end", "def search\n if request.xhr?\n ## Instantiates a new Query object\n query = Query.new(params[:query])\n \n ## Workaround\n # When creating a new Query object by passing the ajax parameters, the\n # empty parameters should be considered nil\n query.from_user = nil if query.from_user == ''\n query.lang = nil if query.lang == ''\n query.q = nil if query.q == ''\n \n #puts query.inspect\n \n ## Query object validation\n if not query.valid?\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n flash.now[:error] = query.errors.full_messages\n page.replace_html('results', :partial => 'error')\n end\n end\n end\n \n ## Verify Query object existance\n else\n sql = \"select * from queries where \"\n\n if not query.q.nil? and not query.q.empty?\n sql << \"q='\" + query.q + \"' \"\n else\n sql << \"q is null \"\n end\n \n if not query.from_user.nil? and not query.from_user.empty?\n sql << \"and from_user='\" + query.from_user + \"' \"\n else\n sql << \"and from_user is null \"\n end\n \n if not query.lang.nil? and not query.lang.empty?\n sql << \"and lang='\" + query.lang + \"' \"\n else\n sql << \"and lang is null \"\n end\n \n sql << \"and rpp='\" + query.rpp.to_s + \"' \" \n \n if not query.since.nil?\n sql << \"and since=STR_TO_DATE('\" + (\"%d,%d,%d\" % [query.since.day, query.since.month, query.since.year]) + \"', '%d,%m,%Y') \"\n else\n sql << \"and since is null \"\n end\n \n sql << \"LIMIT 1;\"\n \n ## If the Query object already exists in the table, update, otherwise\n # save a new entry\n existing_query = Query.find_by_sql(sql)[0]\n if not existing_query.nil?\n query = existing_query\n end\n \n begin\n @tweets = search_twitter(query)\n #puts @tweets.inspect\n \n ## Workaround: as the 'updated_at' is not being automatically\n # updated. Update forced.\n query.updated_at = Time.now\n query.save.to_s\n \n @queries = Query.find(:all, :order => 'updated_at DESC', :limit => 7)\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n flash.now[:notice] = \"no tweets found!\" if @tweets.empty?\n page.replace_html('results', :partial => 'tweets')\n page.replace_html('sidebar_contents', :partial => 'latest_queries')\n if (not params[:from_search].nil?) and (params[:from_search].include?(\"latest\"))\n @query = query#Query.new\n page.replace_html('search', :partial => 'advanced_search')\n end\n end\n end\n end\n rescue\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n @tweets = []\n @queries = Query.find(:all, :order => 'updated_at DESC', :limit => 7)\n flash.now[:error] = \"query failed, try again later! :(\"\n page.replace_html('results', :partial => 'tweets')\n page.replace_html('sidebar_contents', :partial => 'latest_queries')\n end\n end\n end\n end\n \n end\n end\n end", "def index\n @ques = Que.search_names params[:q]\n respond_to do |format|\n format.js\n end\n end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def post_data; end", "def post_request\n\t\turl = request.fullpath.gsub(\"/api\", \"\")\n\t\t@rr = Rr.where(\"url = ?\", url).first\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => rr.response}\n\t\t\tformat.xml { render :xml => @rr.response}\n\t\t\tformat.js { render :js => @rr.response}\n\t\tend\n\tend", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def query ; @request.params ; end", "def post; end", "def ajax_detail\n @eob = Eob.find(params[:id])\n @eob_details = []\n if params[:eob]\n @attributes = params[:eob][:eob_details_attributes]\n @attributes.each do |key, value|\n @eob_details.push @eob.eob_details.build(value)\n end\n end\n @count = @eob.eob_details.count\n @eob_details.push @eob.eob_details.build()\n\n respond_to do |format|\n format.js {render :layout => false }\n end\n end", "def ajaxsearch\n \t#@posts = Post.all\n \t\n \t# a 'dumb test' for further implm of JSONP (..)\n \t@hiThere = 'I like candies!'\n \t\n \t# get the data passed as parameter to the correct url ( ' http://localhost:3000/ajaxsearch?lookingfor= ' )\n \t@searchdata = params[:lookingfor]\n \t\n \t# I guess the 'fully matching title post' is pssible to get from here above\n \t@the_right_post = Post.where(\"title like ?\", params[:lookingfor]) # uses the 'unsplitted' @searchdata ( normally equivalent to 'params[:lookingfor]' )\n \t\n \t@searchdata_array = @searchdata.split(\" \");\n\t\n\t# build the search using the content found in @searchdata_array:\n\t\t# found posts whose titles 'matches' search criterias (..)\n\t\t@matching_titles_posts = Post # define Post\n\t\t@searchdata_array.each do |search_criteria| # loop through all search criterias extracted from the data passed in the url\n\t\t#@searchdata_array.each_index do |search_criteria| # loop through all search criterias extracted from the data passed in the url\n\t\t\t#@fully_matching_titles_posts = @matching_titles_posts.where(\"title like ?\", search_criteria) # aim better the search each loop using the criterias (..) ## this line works when the posts'titles ARE all the criterias\n\t\t\t@matching_titles_posts = @matching_titles_posts.where(\"title like ?\", \"%#{search_criteria}%\") # aim better the search each loop using the criterias (..) ## this line works when the posts'titles CONTAINS the criterias\n\t\tend\n\t\t# found posts whose techs 'matches' search criterias (..)\n\t\t# > will need a link to another table to be usefull (..)\n\t\t\n\t# Tef Edit 14/04/2013 0:00\n\t# get the client IP address\n\t#@server_ip_addr = request.env[\"SERVER_ADDR\"] # null :/\n\t#@server_ip_addr = Socket.gethostname # 'brainApp'\n\t@server_ip_addr = request.host_with_port\n\t@client_ip_addr = request.remote_ip\n\t\n respond_to do |format|\n format.html # ajaxsearch.html.erb\n #format.json { render json: @hiThere } # the URL 'http://stephaneAGmacbookpro.local:3000/ajaxsearch.json?lookingfor=' works fine and displays 'I like candies!'\n format.json { render json: @matching_titles_posts } # the URL 'http://stephaneAGmacbookpro.local:3000/ajaxsearch.json?lookingfor=<stg>' works fine and displays the list of the corresponding entries founs in th db\n # 'by hand' add of JSONP support [> before trying 'rack-jsonp-middleware'] (..)\n format.js do\n #render :json => @matching_titles_posts, :callback => params[:callback] # 'params[:callback]' corresponds to 'http://<server_address>/<(..)>/<rails_route>.js?callback=<local_js_callback_Fcn>'\n \t# wip of 12/04/2013 : adding multiple children in JSONP (..)\n \t# define elements in the JSON\n \t# 'as a hint :/' > respond_with({:ad => @ad, :map => @map, :article => @article}) ( > the following ... WORKS ! [ \"I like to call that 'Experimental Logic' ;D\"] )\n \t#render :json => {:theRightPost => @the_right_post, :criteriasInTitle => @matching_titles_posts}, :callback => params[:callback] # 'params[:callback]' corresponds to 'http://<server_address>/<(..)>/<rails_route>.js?callback=<local_js_callback_Fcn>'\n \trender :json => {:theRightPost => @the_right_post, :criteriasInTitle => @matching_titles_posts, :serverIP => @server_ip_addr, :clientIP => @client_ip_addr}, :callback => params[:callback] # 'params[:callback]' corresponds to 'http://<server_address>/<(..)>/<rails_route>.js?callback=<local_js_callback_Fcn>'\n end\n \n end\n end", "def view_sub_admin\n @sub_admin=Admin.find(params[:sub_admin_id])\n session[:searched_addmin_id]=params[:sub_admin_id]\n session[:updating_using_ajax]=1\n respond_to do |format|\n format.html\n format.js\n format.json\n end\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @servers = Server.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @servers }\n end\n end", "def ajax\n\n uri_string = @params[:uri]\n # uri_string = \"http://www.phase-eight.com#{path_string}\"\n uri = construct_uri_object uri_string\n response = network_response uri\n logger.debug \"XHR response type #{response.content_type}\"\n logger.debug \"XHR response body #{response.body.html_safe}\"\n render text: response.body\n end", "def search_results_ref_num \n query = params[:query].strip if params[:query]\n if query and request.xhr?\n @questions = Admin::Questionbank.find(:all,:order=>'created_at DESC', :conditions => [\"internal_ref_number LIKE ?\", \"%#{query}%\"]) \n render :partial => \"search_results_all\", :layout => false, :locals => {:searchresults => @questions} \n end\n end", "def search_by_que_num \n query = params[:query].strip if params[:query]\n if query and request.xhr?\n @questions = Admin::Questionbank.find(:all,:order=>'created_at DESC', :conditions => [\"question_number LIKE ?\", \"%#{query}%\"]) \n render :partial => \"search_results_all\", :layout => false, :locals => {:searchresults => @questions} \n end\n end", "def results\n send_query\n end", "def ajax_search\n @providers = Provider.search(params[:search])\n\n respond_to do |format|\n format.js {render :layout => false }\n end\n end", "def remark_master\n @entries = RemarkMaster.where(location_id: params[:location]) if request.xhr? \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 post\r\n end", "def ajax_search\n @group = Group.find(params[:group])\n @patients = @group.patients.search(params[:search])\n \n respond_to do |format| \n format.js {render :layout => false }\n end \n end", "def ajax_posts\n @user = User.find_by(user_id: params[:user_id])\n @search = @user.posts.ransack(title_cont: params[:word])\n @posts =\n fetch_paginated_model(\n @search.result,\n setting_model_column(model: :post, action: :show, val: :user_posts_index),\n params[:posts_page]\n )\n end", "def sharerequests\n @group = Group.find(session[:group_id])\n @membership = Membership.find_by(user_id: session[:user_id], group_id: session[:group_id])\n @requests = Request.where(item_id: Item.where(owner_id: @membership)).order('requesting_at DESC')\n authorize @requests, :index?\n respond_to do |format|\n format.js\n format.html\n end\n end", "def ajax_get\n form_tag(@options[:url], :class => 'button_form', :remote =>true) + \n button_image + \n \"</form>\".html_safe\n end", "def xhr?; end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def my_remote_function(options)\n full_query_path = options[:query_path]+\"?\"+options[:query_params].to_param\n form = options[:submit]\n confirm_function = options[:confirm]\n callback = nil\n # callback = %q! function (data, textStatus, xhr){ $(\"#editors\").html(xhr.responseText); }!\n function = \" ajax_post('#{full_query_path}','#{form}','script');return false;\"\n if confirm_function.present?\n function = \"if(confirm_function){#{function}}\"\n end\n function\n end", "def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end", "def render_ajax(event)\n fail \"event/trigger is not found\" unless event[:trigger]\n fail \"event/action is not found\" unless event[:action]\n\n <<-EOS\npost \"/#{event[:id]}\" do\n content_type :json\n response = { _db_errors: {} }\n#{indent(params_rb(event[:trigger][:params]), 1)}\n#{indent(action_rb(event[:action]), 1)}\n response.to_json\nend\n EOS\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @projectionscripts = Projectionscript.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @projectionscripts }\n end\n end", "def index\n @solr = Solr.instance.connect\n callback = params.delete('callback') || 'callback'\n rows = [params.delete('rows').to_i, 100].min\n data = begin\n @solr.get('select', params: params.except(:action, :format, :controller).merge(rows: rows))\n rescue => e\n # RSolr dictates that responses be ruby data structures,\n # but the eval still scares me.\n eval(e.response[:body])\n end\n json = JSON.pretty_generate(data)\n respond_to do |format|\n format.js do\n render text: \"#{callback}(#{json});\",\n status: data['error'] ? 500 : 200\n end\n format.json do\n render text: json,\n status: data['error'] ? 500 : 200\n end\n format.xml do\n render text: data.to_xml,\n status: data['error'] ? 500 : 200\n end\n end\n end", "def ajax_next_patient\n begin\n if params[:commit]\n @ct = params[:patients_groups]\n @patient = Patient.find(@ct[:next_patient])\n set_patient_session(@patient.id, @patient.patient_name)\n else\n @patients_groups = PatientsGroup.find_all_by_group_id(session[:group]) \n @patient = Patient.find_all_by_id(@patients_groups.collect{|c| c.patient_id}, :order => \"last_name ASC, first_name ASC\") \n end\n \n #the get is an ajax call, th post is a redirect to new insurance billing\n respond_to do |format|\n format.html { redirect_to new_insurance_billing_path(:dos => session[:dos]) }\n format.js\n end\n rescue\n respond_to do |format|\n format.html { head :no_content }\n format.js { head :no_content }\n end\n end\n end", "def search\n send_request\n parse_response\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @postinstallscripts = Postinstallscript.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @postinstallscripts }\n end\n end", "def ajax\n\n# Render json data containing the different fields: (For ajax use)\n render :json => { total: Cache.count, \n uploads: Cache.where(source: 'original').count, \n downloads: Cache.where(source: 'collamine').count, \n urls: Cache.desc(:created_at).limit(10).pluck(:url), \n domains: Cache.desc(:created_at).distinct(:domain).take(10)\n }\n end", "def ajax_load_node_edit_info\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n data = {\n :node_id => node.id,\n :node_name => node.name,\n :node_email_template_name => node.email_template_id,\n :node_delay_time => node.delay_time,\n :node_delay_unit => node.delay_unit,\n }\n\n # Return data as JSON\n render json: data\n\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @sites = Site.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @sites }\n end\n end", "def xhr_script; end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @systems = System.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @systems }\n end\n end", "def ajax_report\n @report = Reporting.find(params[:id])\n\n end", "def post\n end", "def search_by_tags \n query = params[:query].strip if params[:query]\n if query and request.xhr?\n @questions = Admin::Questionbank.find(:all,:order=>'created_at DESC', :conditions => [\"tags LIKE ?\", \"%#{query}%\"]) \n render :partial => \"search_results_all\", :layout => false, :locals => {:searchresults => @questions} \n end\n end", "def index \n @client_ip = remote_ip()\n @cars = Car.search(params[:search]) \n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.js # remote: true is sent a js format and sends you to search.js.erb\n end\n end", "def test_find_categories\n @request.env[\"RAW_POST_DATA\"] = \"act\"\n xhr :post, :find_categories, :type => 1, :name => 'genre'\n assert_success\n assert @response.body.include?('add_genre(\\'' + categories(:action).id.to_s + '\\');')\n end", "def surgery_search\n # Search for the speciality names\n @surgeries = find_surgery_term(params[:surgeryterm])\n # respond to rendering the pages\n respond_to do |format|\n format.js\n end\n end", "def ajax_patient\n patient_id = params[:eob][:patient_id]\n # get a list of patients with open claim\n @patient = Patient.find(patient_id)\n @claims_outstanding = InsuranceBilling.processed.where(\"insurance_billings.patient_id = ?\", patient_id)\n\n respond_to do |format|\n format.html {render :nothing => true}\n format.js {render :layout => false }\n end\n end", "def batch\n # conditions => in Url item should be available\n # Url generated from Js script function => getbatch() of _form.html.erb file under Views of different controllers\n @batch = Stock.where('item_name = ? and user_id = ?' , params[:name], current_user.id).distinct.pluck(:batch_number )\n # send batch_number in form of json\n render json: @batch\n end", "def request_data; end", "def select\n @inventory_type = InventoryType.shod(params[:inventory_transfer_inventory_type_id])\n @inventories = @inventory_type.inventories\n @inventory_types = InventoryType.all\n respond_to do |format|\n format.js {render layout: false if request.xhr?}\n # format.js {render :partial => 'search_all' ,:layout => false}\n end\n end", "def get_result\n form_data = params.require(:form).permit(:id)\n\n render json: Form.get_result(form_data[:id], current_user[\"id\"])\n end", "def create_query_html_response(base_query, partial: 'row', locals: {})\n resp_data = ts_ajax_handler.query_data(base_query)\n records = resp_data.delete(:records)\n resp_data[:data] = render_response_html(records, partial: partial, locals: locals)\n\n resp_data\n end", "def zipsearch\n require 'uri'\n require 'net/http'\n require 'iconv'\n\n dong_name = Iconv.iconv('euc-kr', 'utf-8', params[:query])\n res = Net::HTTP.post_form(URI.parse('http://biz.epost.go.kr/KpostPortal/openapi'), {'regkey' => '18132c774fa887e6d1318210963744', 'target' => 'post', 'query' => dong_name})\n new_response_body = Iconv.iconv('UTF-8//IGNORE', 'euc-kr', res.body).join\n @retval = new_response_body\n respond_to do |format|\n format.xml { render :xml => @retval }\n end\n end", "def refresh_selected_data\n entry = extract_entry_by_entry_id(params[:entry_id])\n\n parameter = \"\"\n if entry[:parameter] # Parameter erwähnt (erwartet als Array)\n entry[:parameter].each do |p|\n parameter << \"<div title='#{my_html_escape(p[:title])}'>#{my_html_escape(p[:name])} <input name='#{p[:name]}' size='#{p[:size]}' value='#{p[:default]}' type='text'></div><br/>\"\n end\n end\n respond_to do |format|\n format.js {render :js => \"$('#show_selection_header_area').html('<b>#{j my_html_escape(entry[:name]) }</b>');\n $('#show_selection_hint_area').html('#{j my_html_escape(entry[:desc]) }');\n $('#show_selection_param_area').html('#{j parameter }');\n $('#dragnet_show_selection_do_selection').prop('disabled', #{entry[:sql] ? 'false' : 'true'});\n $('#dragnet_show_selection_show_sql').prop('disabled', #{entry[:sql] ? 'false' : 'true'});\n $('#dragnet_drop_personal_selection_button').#{entry[:personal] ? 'show' : 'hide'}();\n $('#dragnet_hidden_entry_id').val('#{params[:entry_id]}');\n \"\n }\n end\n end", "def autocomplete\n \n @credits = Credit.select([:id, :department, :credit]).where(\"credit ILIKE ? \", \"%#{params[:filter]}%\" ).limit(params[:limit])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @credits }\n format.js\n format.json { render :json => @credits }\n end\n\n\n end", "def searchPubmed \n @params = params.pretty_inspect\n @resultsPerPage = params[:resultsPerPage] \n @resultsPerPage = @resultsPerPage.to_i == 0 ? 20 : @resultsPerPage\n @currentPage = params[:page]\n if (request.xhr?)\n initiateSearch\n end\n respond_to do |result| \n result.html do\n @theTerm = params[:term]\n @triggerAjax = true\n render(:template => \"pubmed/index\")\n end\n result.js do \n result.js \n end\n result.json do\n initiateSearch\n results = @pubLib.map {|result| json_for_results(result) }\n render :json => { :content => results }\n end\n #result.js\n end\n end", "def results\n send_query\n end", "def update_contacts\n # Idea from here: https://github.com/bmarcot/dynamic-select-boxes\n @contacts = Contact.select(:name).where(\"client_id = ?\", params[:client_id])\n respond_to do |format|\n format.js\n format.json { render json: @contacts }\n end\n end", "def mapSearch\n @jardins = Jardin.where(\"(latitud between ? and ?) and (longitud between ? and ?)\",params[:SWLat].to_f, params[:NELat].to_f, params[:SWLng].to_f, params[:NELng].to_f)\n #@post = params\n render :json => @jardins.to_json(:only => [ :id , :nombre, :direccion, :telefono, :latitud, :longitud])\n #respond_to do |format|\n # format.html # mapSearch.html.erb\n # format.xml { render :xml => @jardins }\n #end\n end", "def quest_autocomplete\n render json: Quest.search(params[:query], where: { :group_id => @user.wrapper_group.id})\n end", "def results\n respond_to do |format|\n if params[:search].present?\n @search = CheckSearchForm.new(search_params)\n @search.user = current_user\n if @search.save\n @check_search = @search.check_search\n format.html\n format.js\n else\n format.html\n format.js\n end\n else\n format.html { redirect_to check_index_path }\n end\n end\n end", "def search\n find_dependencias\n respond_to do |format|\n format.html{render :partial=> \"row_index\"}\n format.json { render json: @dependencias }\n format.js { }\n end\n end", "def search_result\n query = search_params.presence && search_params\n results = query.present? ? helpers.search_query(query) :helpers.create_query(current_user)\n render json: {:data => results, :total => results.results.total}\n end", "def ajax_action_call(opts = {})\n form_id = opts[:form_id] || id\n \"#{id}($(\\\"form##{form_id}\\\").serialize(), \\\"form##{form_id}\\\");\"\n end", "def index\n \t@branches = Branch.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 20, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n format.js\n end\n end", "def memberrequests\n @group = Group.find(session[:group_id])\n @membership = Membership.find_by(user_id: session[:user_id], group_id: session[:group_id])\n @requests = Request.where(requestor_id: @membership).order('requesting_at DESC')\n authorize @requests, :index?\n respond_to do |format|\n format.js\n format.html\n end\n end", "def render_ajax\n {:partial => 'shared/flexigrid/ajax', :locals => {:grid => self}}\n end", "def remote_data\n render :json => build_remote_data( params[:document_id] )\n end", "def index\n log_header\n\n @terms_and_conditions = case params[:query].blank?\n when false\n TermsAndCondition\n .where(\"terms_and_conditions ILIKE ? \", \"%#{params[:query]}%\")\n .order(:created_at)\n .page params[:page]\n when true\n TermsAndCondition\n .order(created_at: :desc)\n .page params[:page]\n end\n\n respond_to do |format|\n format.html {}\n format.js { render json: @terms_and_conditions.to_json }\n format.json { render json: @terms_and_conditions.to_json }\n end\n\n end", "def search\n find_nota\n respond_to do |format|\n format.html{render :partial=> \"row_index\"}\n format.json { render json: @dependencias }\n format.js { }\n end\n end", "def show\n @respostum = Respostum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # Ajax CRUD\n end\n end", "def post_request(object)\n end", "def load_query\n if params[:query] && params[:query].squish.present?\n @query = params[:query].squish.humanize + '%'\n else\n render json: { message: 'No Query Parameter' , status: :unprocessable_entity }\n return false\n end\n end", "def raw_post; end", "def render_rb_ajax\n render_code(@rb, :ajax)\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def query\n end", "def autocomplete_clase_nombre \n respond_to do |format|\n @clases = Clase.joins(:partida_parcial => [:partida_principal]).where(\"clases.fecha_de_baja IS NULL AND clases.nombre ILIKE ?\", \"%#{params[:term]}%\").order(\"partidas_principales.codigo\").order(\"partidas_parciales.codigo\").order(\"clases.codigo\").paginate(:page => params[:page], :per_page => 30) \n render :json => @clases.map { |clase| {:id => clase.id, :label => clase.nombre, :value => clase.nombre} } \n format.js { } \n end \n end", "def render_js_ajax\n render_code(@js, :ajax)\n end", "def ajax_illiad_available\n @available_requests = params['requests']&.values.to_a\n render json: { record: render_to_string('_available_requests', layout: false), locals: { available_requests: @available_requests } }\n end", "def render_ajax(event)\n render_event(event, :ajax)\n end", "def add\n active_content_div.button(:text=>\"Add\").click\n wait_for_ajax\n end", "def getdata\r\n\t\titem_name_selected= params[:data_value]\r\n\t\tselected_values=Item.find_by item_name: item_name_selected\r\n\t\trender json: selected_values\r\n\tend", "def ajax_illiad_pending\n @pending_requests = params['requests']&.values.to_a\n render json: { record: render_to_string('_pending_requests', layout: false), locals: { pending_requests: @pending_requests } }\n end", "def submit\n\t\tCardsort.save_results(params[:id], params[:cards], params[:cardsort_id], params[:reviewer_id])\n\t\trespond_to do |form|\n\t\t\tform.js {}\n\t\tend\n\tend", "def new\n @respostum = Respostum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # Ajax CRUD\n end\n end", "def index\n @ajaxes = Ajax.all\n end", "def ajax_get_new_page\n case params[ :type ] \n when \"following\" , \"followers\" \n data = User.fetch_follow( params[ :id ] , current_user , params[ :type ], params[ :page ] ) [ \"data\" ]\n @user_list = data[ \"users\" ] \n @user_agree = data[ \"pending\" ] \n when \"commentlike\" , \"story\"\n query = {\n \"activity_ids[before]\" => params[ :activity ] ,\n \"comment_ids[before]\" => params[ :comment ] ,\n \"like_ids[before]\" => params[ :like ] \n }\n if params[ :type ] == \"story\" \n data = User.fetch_moments( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"moments\" ]\n @user = User.fetch( params[ :id ] , current_user , nil ) [ \"data\" ]\n else \n data = User.fetch_commentlike( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"likes_and_comments\" ]\n end\n @qparams = data[ \"next_query_parameters\" ] \n @qparams[ \"activity_ids\" ] = { \"before\" => params[ :activity ] } if @qparams[ \"activity_ids\" ] .nil?\n @qparams[ \"comment_ids\" ] = { \"before\" => params[ :comment ] } if @qparams[ \"comment_ids\" ] .nil?\n @qparams[ \"like_ids\" ] = { \"before\" => params[ :like ] } if @qparams[ \"like_ids\" ] .nil?\n end\n render :layout => false\n end", "def index\n @ajax_search = params[:ajax_search] == \"true\" ? true : false\n \n @systeminstallscripts = Systeminstallscript.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @systeminstallscripts }\n end\n end" ]
[ "0.6640112", "0.63850844", "0.63821924", "0.6324391", "0.6123822", "0.61008024", "0.599643", "0.5946033", "0.5839651", "0.579824", "0.5796508", "0.57816523", "0.5747491", "0.5737637", "0.5709993", "0.5708591", "0.5704761", "0.5702172", "0.5679744", "0.56621134", "0.56424856", "0.5638237", "0.56330913", "0.5632128", "0.5619621", "0.56167424", "0.5563991", "0.5557811", "0.55574423", "0.5553807", "0.5546", "0.5536765", "0.5529479", "0.55205417", "0.552004", "0.5518655", "0.551641", "0.5497344", "0.549441", "0.54931825", "0.5484721", "0.5473829", "0.5461114", "0.54378575", "0.54258984", "0.5417909", "0.5416011", "0.5397199", "0.53926426", "0.5383162", "0.53771895", "0.5368099", "0.5366946", "0.5365576", "0.5364138", "0.53590804", "0.53559583", "0.5350576", "0.5347772", "0.5342215", "0.5332312", "0.5324589", "0.53206617", "0.53203726", "0.5308571", "0.5306742", "0.5301346", "0.52982736", "0.52949804", "0.529454", "0.5292394", "0.5286216", "0.52808833", "0.5266644", "0.5265875", "0.5265802", "0.5265409", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5260124", "0.5257789", "0.525392", "0.52533585", "0.5253054", "0.5250462", "0.52396196", "0.52388066", "0.52350235", "0.52316535", "0.52305377", "0.5229998", "0.5229651", "0.5226624" ]
0.0
-1
this worker is offset by 1 minute, make sure to account for the spread
def get_prices(timestamp, duration = 31.minutes) price_class = "::#{exchange_name.capitalize}Price".constantize execute_query( price_class.where('timestamp > ?', (timestamp - duration.to_i)).to_sql ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_next_try_at\r\n self.next_try_at = 15.minutes.from_now\r\n end", "def doge_control\r\n @next_queue_time = get_queue_time\r\n end", "def worker_check_interval(interval); end", "def update_worker(start_time,duration)\n queue = Sidekiq::ScheduledSet.new\n queue.each do |job| \n if job.args[0].to_i == self.id\n current_job = Sidekiq::ScheduledSet.new.find_job(job.jid)\n current_job.reschedule (self.date + (duration.strftime(\"%H\").to_i + start_time.to_i)*60*60)\n end \n end \n end", "def calc_next_run\n RunAtPeriodicJob.new(:name => self.name, :job => self.job, :run_at_minutes => self.run_at_minutes)\n end", "def perform_now\n raise(::Mongoid::Errors::Validations, self) unless valid?\n\n worker = RocketJob::Worker.new(inline: true)\n start if may_start?\n # Re-Raise exceptions\n rocket_job_work(worker, true) if running?\n result\n end", "def maybe_start!\n return if started? || entries.where(readied_at: nil).any? || entries.count < 2\n\n update(started_at: Time.now.utc + 20.seconds)\n\n # Schedule ghost splits and finishes\n entries.ghosts.find_each do |entry|\n entry.update(finished_at: started_at + (entry.run.duration(Run::REAL).to_sec))\n Api::V4::RaceBroadcastJob.set(wait_until: started_at + entry.run.duration(Run::REAL).to_sec).perform_later(\n self, 'race_entries_updated', 'A ghost has finished'\n )\n entry.run.segments.with_ends.each do |segment|\n Api::V4::RaceBroadcastJob.set(wait_until: started_at + segment.end(Run::REAL).to_sec).perform_later(\n self, 'race_entries_updated', 'A ghost has split'\n )\n end\n end\n\n # Schedule cleanup job for a started race that was abandoned\n RaceCleanupJob.set(wait_until: started_at + 48.hours).perform_later(self)\n\n Api::V4::RaceBroadcastJob.perform_later(self, 'race_start_scheduled', 'The race is starting soon')\n Api::V4::GlobalRaceUpdateJob.perform_later(self, 'race_start_scheduled', 'A race is starting soon')\n end", "def perform\n scan\n Delayed::Job.enqueue self, 0, Time.now.utc + 20.seconds # requeue for next time\n # todo: save the job id somewhere\n end", "def calc_next_run\n self.next_run_at = nil\n end", "def worker_timeout(timeout); end", "def throttle; end", "def reserve_and_run_one_job; end", "def work\n if @busy && @remaining_job_time > 0\n @remaining_job_time -= 1\n end\n end", "def queue_latency\n created_at - scheduled_at\n end", "def worker_begin(worker)\n end", "def queue_time\n NotImplementedError\n end", "def tock\n @minute += 1\n end", "def work(interval = 5.0)\n end", "def refresh_boundary\n Time.new - refresh_interval\n end", "def min() time[1] end", "def sleep_time\n 60\n end", "def starting(worker)\n end", "def when_to_run\n time - @@REMINDER_TIME\n end", "def planning_work\n self.planned_at = Time.now\n self.unfreeze_request! if self.frozen?\n self.push_msg\n end", "def execute_send\n record_start_time\n queue_attempt\n end", "def schedule_updates\n schedule_update_in(48.hours)\n end", "def watch_interval; end", "def calc_next_run\n nil\n end", "def calc_next_run\n nil\n end", "def run_once\n got_lock = @lock.acquire do\n min_committed_id = Redstream.connection_pool.with do |redis|\n offset_key_names = @consumer_names.map do |consumer_name|\n Redstream.offset_key_name(stream_name: @stream_name, consumer_name: consumer_name)\n end\n\n redis.mget(offset_key_names).map(&:to_s).reject(&:empty?).min\n end\n\n return sleep(@interval) unless min_committed_id\n\n loop do\n messages = Redstream.connection_pool.with do |redis|\n redis.xrange(Redstream.stream_key_name(@stream_name), \"-\", min_committed_id, count: 1_000)\n end\n\n return sleep(@interval) if messages.nil? || messages.empty?\n\n Redstream.connection_pool.with { |redis| redis.xdel Redstream.stream_key_name(@stream_name), messages.map(&:first) }\n\n @logger.debug \"Trimmed #{messages.size} messages from #{@stream_name}\"\n end\n end\n\n sleep(5) unless got_lock\n rescue StandardError => e\n @logger.error e\n\n sleep 5\n\n retry\n end", "def calculate_next_run_at(start_time = Time.zone.now)\n ideal_next_run = ideal_next_run_from(start_time)\n\n if ideal_next_run == cron_worker_next_run_from(start_time)\n ideal_next_run\n else\n cron_worker_next_run_from(ideal_next_run)\n end\n end", "def working!\n @meta[Cworked_at] = Time.now.utc\n put_meta\n end", "def sync_min_stay\n room_type = self.room_type\n property = self.room_type.property\n channel = self.channel\n pool = PropertyChannel.find_by_channel_id_and_property_id(self.channel.id, property.id).pool\n\n logs = Array.new\n loop_date = DateTime.now.in_time_zone.beginning_of_day\n\n # loop until 400th day\n while loop_date <= Constant.maximum_end_date\n channel_min_stay = ChannelMinStay.find_by_date_and_property_id_and_pool_id_and_room_type_id_and_channel_id(loop_date, property.id, pool.id, room_type.id, channel.id)\n\n if !channel_min_stay.blank?\n ChannelMinStayLog.create(:channel_min_stay_id => channel_min_stay.id, :min_stay => channel_min_stay.min_stay)\n end\n\n loop_date = loop_date + 1.day\n end\n ChannelMinStayChangeSet.create_job(logs, pool, channel)\n end", "def next_execute_time\n if (@count > 0 && @count <= @job.run_time) || @interval <= 0\n return nil\n end\n @next_time += @interval\n end", "def wfs_delay\n super + 5\n end", "def up_to_time\n up_to_block.call.to_time\n end", "def sleepy_run; end", "def throttles; end", "def join\n @worker.join(10)\n end", "def histcall\n HardWorker.perform_at(24.hours, 1)\n puts \"Cron job: Stocks being added to db\"\n end", "def worker_pool; end", "def worker_pool; end", "def processing_lag\n time_distance_in_ms(processed_at, scheduled_at)\n end", "def requeue_perform_delay\n 1.0\n end", "def requeue_perform_delay\n 1.0\n end", "def checkpoint\n @remaining -= (now - @started_at)\n end", "def queue_job; end", "def perform(metadata)\n scheduled_at = Time.at(metadata[\"scheduled_at\"])\n minutes = scheduled_at.min\n hours = scheduled_at.hour\n\n # 20 requests / minute\n if (minutes % 2 == 0) # Top 0-19; every 2 minutes\n perform_update(1)\n else # Top 20-99; every 2 minutes, full cycle of 6 minutes\n sub_index = (minutes / 2) % 3\n perform_update(2, sub_index)\n end\n\n # 20 requests / minute\n if minutes % 3 == 0 # Top 100-199; every 3 minutes, full cycle of 15 minutes\n sub_index = (minutes / 3) % 5\n perform_update(3, sub_index)\n elsif minutes % 6 == 1 # Top 200-299; every 6 minutes, full cycle of 30 minutes\n sub_index = (minutes / 6) % 5\n perform_update(4, sub_index)\n elsif minutes % 6 == 2 # Top 300-499; every 6 minutes, full cycle of 60 minutes\n sub_index = (minutes / 6) % 10\n perform_update(5, sub_index)\n end\n\n # 25-30 requests / minute\n if minutes % 12 == 0 # Top 500-749; every 12 minutes, full cycle of 1 hour\n sub_index = (minutes / 12) % 5\n perform_update(6, sub_index)\n end\n two_hour_cycle = hours % 2 * 60 + minutes\n if two_hour_cycle % 12 == 1 # Top 750-999; every 12 minutes, full cycle of 2 hours\n sub_index = (two_hour_cycle / 12) % 10\n perform_update(7, sub_index)\n end\n four_hour_cycle = hours % 4 * 60 + minutes\n if four_hour_cycle % 12 == 2 # Top 1000-1499; every 12 minutes, full cycle of 4 hours\n sub_index = (four_hour_cycle / 12) % 20\n perform_update(8, sub_index)\n end\n # 25 requests / 3 minutes with blank periods due to unknown coin limit\n six_hour_cycle = hours % 6 * 60 + minutes\n if six_hour_cycle % 3 == 1 # Top 1500-4499; every 3 minutes, full cycle of 6 hours\n sub_index = (six_hour_cycle / 3) % 120\n perform_update(9, sub_index)\n end\n end", "def evaulate_schedule\n 5\n end", "def workers(count); end", "def next_time\n\n schedule_info\n end", "def perform args={each_minute: RUN_EVERY}\n # call an other job\n CowsayJob.perform_later # topic: 'ru'\n \n self.class.perform_later wait: args[:each_minute].minute # re-queue\n end", "def enqueue_at(job, precise_timestamp)\n build_worker(job).schedule(time_at: Time.at(precise_timestamp))\n end", "def perform\n @worker.call\n @last_result\n end", "def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend", "def schedule_to_close_timeout; Float::INFINITY; end", "def worker_watchdog_threshold\n 60\n end", "def start_time; end", "def run_job(job)\r\n @log = Logger.new(File.expand_path(\"#{Rails.root}/log/scraper_job.log\", __FILE__))\r\n @log.info(\"Job started\")\r\n \r\n # initial job parameters\r\n region_list = JSON.parse(self.target_region_list)\r\n days_to_gather = self.days_to_gather\r\n size_of_a_day = 86400 # epoch time units (86400 is equal to 24 hours)\r\n size_of_a_time_slice = 10800 # epoch time units (10800 is equal to 3 hours)\r\n \r\n # start gathering from the beginning of the current day\r\n initial_start_time = Time.new(Time.now.year, Time.now.month, Time.now.day).to_i\r\n number_of_time_slices = ((days_to_gather * size_of_a_day) / size_of_a_time_slice).to_i\r\n \r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > #{self.class} started (id:#{self.id})\")\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The Epoch Start Time: #{initial_start_time}\")\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The Formatted Start Time: #{Time.at(initial_start_time).strftime(\"%c\")}\")\r\n job.save\r\n \r\n # iterate each region\r\n region_list.each {|region_name,region_lookup| \r\n #validate a region exists\r\n region = Region.find_by name: region_name\r\n if region\r\n \r\n # run the channel scraper\r\n encoded_uri = URI.encode(\"https://www.foxtel.com.au/webepg/ws/foxtel/channels?regionId=\" + region_lookup)\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The encoded URI for #{region_name} is #{encoded_uri}\")\r\n #job.save\r\n raw_channels_created = 0\r\n raw_channels_skipped = 0\r\n\r\n # access the file and the data_hash\r\n file = URI.parse(encoded_uri)\r\n get_file_count = 0\r\n begin\r\n data_hash = JSON.parse(file.read)\r\n rescue Errno::ECONNRESET => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n rescue OpenSSL::SSL::SSLError => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n end\r\n\r\n # populate an array of times from the data hash\r\n #@log.debug(\"#{data_hash.inspect}\") \r\n data_hash[\"channels\"].each {|channel_hash|\r\n #@log.debug(\"#{channel_hash.inspect}\")\r\n raw_channel = RawChannel.create_from_channel_hash(region, channel_hash)\r\n if raw_channel.new_record?\r\n raw_channels_skipped += 1\r\n else\r\n raw_channels_created += 1\r\n end\r\n }\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Raw Channels Created: #{raw_channels_created}, Skipped: #{raw_channels_skipped}, Total: #{raw_channels_skipped + raw_channels_created} for #{region_name}(#{region_lookup.to_s}).\")\r\n job.save\r\n \r\n # run the program scraper\r\n raw_programs_created = 0\r\n raw_programs_skipped = 0\r\n \r\n number_of_time_slices.times do |i|\r\n start_time = Time.at(initial_start_time + (i* size_of_a_time_slice))\r\n end_time = Time.at(start_time.to_i + size_of_a_time_slice)\r\n encoded_uri = URI.encode(\"https://www.foxtel.com.au/webepg/ws/foxtel/grid/events?startDate=\" + start_time.to_i.to_s + \"000&endDate=\" + end_time.to_i.to_s + \"000&regionId=\" + region_lookup)\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The encoded URI is #{encoded_uri}\")\r\n #job.save\r\n \r\n # access the file and the data_hash\r\n file = URI.parse(encoded_uri)\r\n get_file_count = 0\r\n begin\r\n data_hash = JSON.parse(file.read)\r\n rescue Errno::ECONNRESET => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n rescue OpenSSL::SSL::SSLError => e\r\n get_file_count += 1\r\n retry unless get_file_count > 10\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Tried #{get_file_count} times and couldn't get #{file}: #{e}\")\r\n job.save\r\n @log.error(\"#{e.message}\")\r\n @log.error(\"#{e.backtrace}\")\r\n end\r\n \r\n # populate an array of times from the data hash\r\n #@log.debug(\"#{data_hash.inspect}\")\r\n data_hash[\"channelEventsByTag\"].each {|channel_events|\r\n #@log.debug(\"#{program_array.inspect}\")\r\n channel_tag = channel_events[0]\r\n channel = Channel.find_by_tag(channel_tag)\r\n raw_channel = RawChannel.find_by_channel_tag_and_region_name(channel_tag,region_name)\r\n if channel.nil? and raw_channel.nil?\r\n # no channel or raw channel\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The channel record and raw_channel record for #{channel_tag} in #{region_name} does not exist!\")\r\n job.save\r\n else\r\n # channel is ok\r\n array_of_channel_events = channel_events[1]\r\n #job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Processing #{array_of_channel_events.length} channel events for channel #{channel.name} for #{region_name}.\")\r\n #job.save \r\n array_of_channel_events.each { |channel_event|\r\n raw_program = RawProgram.create_from_channel_event(region, channel_tag, channel_event)\r\n if raw_program.new_record?\r\n raw_programs_skipped += 1\r\n else\r\n raw_programs_created += 1\r\n end \r\n } \r\n end\r\n }\r\n end\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > Raw Programs Created #{raw_programs_created}, Skipped: #{raw_programs_skipped}, Total: #{raw_programs_created + raw_programs_skipped} for #{region_name}(#{region_lookup.to_s}).\")\r\n job.save\r\n else\r\n # no region\r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > The region record for #{region_name} does not exist!\")\r\n job.save\r\n end\r\n }\r\n \r\n job.log.concat(\"\\n#{Time.now.strftime(\"%F %T %Z\")}: > #{self.class} completed (id:#{self.id})\")\r\n job.save\r\n \r\n @log.info(\"#{self.class} completed (id:#{self.id})\")\r\n return true\r\n end", "def snapshot_every_n_requests; end", "def lock_next(worker)\n updates = worker_set\n unless updates.empty?\n #concept copied form delayed_job. If there are a number of \n #different processes working on the queue, the niave approch\n #would result in every instance trying to lock the same record.\n #by shuffleing our results we greatly reduce the chances that\n #multilpe workers try to lock the same process\n updates = updates.to_a.sort_by{rand()}\n updates.each do |u|\n return u if u.lock(worker)\n end\n return nil\n end\n rescue DataObjects::ConnectionError\n sleep 0.1\n retry\n end", "def retry_later\n @meta[Cworked_at] = nil\n @meta[Crt_count] += 1\n @meta[Crt_at] = Time.now.utc + (queue.rt_at_interval * @meta[Crt_count])\n put_meta\n\n rcache.lpush(queue.retries_cache_key, trx_id)\n rcache.lrem(queue.working_cache_key, 0, trx_id)\n end", "def process_second\n @seconds += 1\n assign_nodes\n process_workers\n end", "def sidekiq_enqueue\n ReminderDisplayWorker.perform_at(displayed_at, id)\n end", "def thread()\n #This is a stub, used for indexing\n end", "def interval; end", "def interval; end", "def block_delivery_start_time\n unless delivery_slots_from.blank?\n delivery_slots_from.round_up(60.minutes)\n end\n end", "def throttle(wait, onLast, onFirst, interval, timestamps)\n \nend", "def working!(queue)\n active_at queue, Time.now\n end", "def excess_task_workers\n @task_worker_lock.synchronize do\n @task_worker_size - @task_workers.size - @spawnings\n end\n end", "def register_reaper_process\n redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, nx: true, ex: drift_reaper_interval) }\n end", "def pre_sleep; end", "def requeue_throttled\n Sidekiq.redis { |conn| conn.lpush(QueueName.expand(queue_name), job) }\n end", "def heartbeat\n end", "def push(*args)\n @metric_queue_write.time do\n super(*args)\n end\n end", "def flush\n while [email protected]? || @worker.is_requesting?\n ensure_worker_running\n sleep(0.1)\n end\n end", "def simple_sidekiq_delay_spread(options = {})\n local_opts = options.dup\n\n spread_duration = Utils.extract_option(local_opts, :spread_duration, 1.hour).to_f\n spread_in = Utils.extract_option(local_opts, :spread_in, 0).to_f\n spread_at = Utils.extract_option(local_opts, :spread_at)\n spread_method = Utils.extract_option(local_opts, :spread_method, :rand)\n spread_mod_value = Utils.extract_option(local_opts, :spread_mod_value)\n spread_mod_method = Utils.extract_option(local_opts, :spread_mod_method)\n\n spread_duration = 0 if spread_duration < 0\n spread_in = 0 if spread_in < 0\n\n spread =\n # kick of immediately if the duration is 0\n if spread_duration.zero?\n 0\n else\n case spread_method.to_sym\n when :rand\n Utils.random_number(spread_duration)\n when :mod\n mod_value =\n # The mod value has been supplied\n if !spread_mod_value.nil?\n spread_mod_value\n # Call the supplied method on the target object to get mod value\n elsif !spread_mod_method.nil?\n send(spread_mod_method)\n # Call `spread_mod_method` on target object to get mod value\n elsif respond_to?(:spread_mod_method)\n send(send(:spread_mod_method))\n else\n raise ArgumentError, 'must specify `spread_mod_value` or `spread_mod_method` or taget must respond to `spread_mod_method`'\n end\n\n # calculate the mod based offset\n mod_value % spread_duration\n else\n raise ArgumentError, \"spread_method must :rand or :mod, `#{spread_method} is invalid`\"\n end\n end\n\n t =\n if !spread_at.nil?\n # add spread to a timestamp\n spread_at.to_f + spread\n elsif !spread_in.nil?\n # add spread to no plus constant offset\n Time.now.to_f + spread_in.to_f + spread\n else\n # add spread to current time\n Time.now.to_f + spread\n end\n\n Proxy.new(SimpleDelayedWorker, self, local_opts.merge('at' => t))\n end", "def perform\n # Sidekiq would not be able to get an instance as an argument\n\n\n # Do something later\n puts \"Starting to do something which takes time...\"\n sleep(5)\n puts \"Finished my time-consuming process!\"\n end", "def lead_time\n 0\n end", "def wash\n @last_wash = Time.now\n end", "def initialize\n super\n @limit = Time.now + 60*60*24*7\n\n @available = []\n @errorz = []\n @recent = []\n run()\n end", "def snapshot_every_n_requests=(_arg0); end", "def build_timing; end", "def minimum_interval\n 500\n end", "def clean_activity!\n $redis.zremrangebyscore(activity_key, '-inf', Time.now.to_i - 1.minute)\n end", "def be_worker\n before_work\n super\n end", "def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend", "def connection_pool_ramp_increment\n super\n end", "def refresh; schedule_update end", "def cutoff\n Time.now - (60 * 60 * HOURS)\n end", "def running; end", "def running; end", "def robin; end", "def lock; end", "def lock; end", "def lock; end", "def lock_timeout; end", "def usage_interval\n\n end", "def starter\n @starter = Thread.new do\n sleep_interval(60)\n yield # starter proc in :start \n end\n end", "def shortest_time_remaining\n return 0 if finished_at\n backup_source_jobs.map(&:time_remaining).reject! {|t| t == 0}.min rescue 0\n end" ]
[ "0.6141344", "0.61186355", "0.6080952", "0.60594875", "0.59592414", "0.5805524", "0.5767693", "0.5762605", "0.5662397", "0.5654371", "0.5653106", "0.56367546", "0.5634213", "0.5600469", "0.5586494", "0.5543185", "0.55361706", "0.55317193", "0.5527452", "0.55154186", "0.55062276", "0.5502419", "0.5495625", "0.54952973", "0.54903316", "0.54760444", "0.5472316", "0.5454575", "0.5454575", "0.5448758", "0.54306763", "0.54294354", "0.5405761", "0.5399621", "0.5376527", "0.5376502", "0.53744334", "0.53720963", "0.535391", "0.53445166", "0.53435564", "0.53435564", "0.5339735", "0.5336274", "0.5336274", "0.5335116", "0.53277844", "0.5322329", "0.5320514", "0.53174275", "0.5312762", "0.5312068", "0.530284", "0.5293983", "0.52937394", "0.52934086", "0.5280523", "0.52738017", "0.5273481", "0.5272434", "0.5250293", "0.5243999", "0.524213", "0.52343786", "0.52205104", "0.52070826", "0.52070826", "0.52023906", "0.5200186", "0.51985806", "0.51970017", "0.51874316", "0.5160387", "0.5158883", "0.51548505", "0.5147086", "0.5144", "0.5143885", "0.51429415", "0.51424253", "0.51408863", "0.5132142", "0.5130819", "0.51299584", "0.5128698", "0.51252735", "0.51248693", "0.51244473", "0.51162124", "0.5114555", "0.5107989", "0.50973207", "0.50973207", "0.5094952", "0.50878227", "0.50878227", "0.50878227", "0.50804615", "0.5079436", "0.50778186", "0.50720763" ]
0.0
-1
Unfortuantely pg_dump does not work if datallowcon=false (ie quiesced) so logic needs to be implemented to check if the database can receive connections and if not, turn it back on just before running the pg_dump. At the end of the method, it should put the datallowcon back to the state it was in originally
def backup begin check_if_db_exists is_allowed = @conn.exec("select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'")[0]['datallowconn'] if is_allowed == 'f' # unquiece temporarily set_dataallowcon_to true end # Check to see if the directory for backups exists and if not, create it with parents unless File.exist?(@options[:bkdir]) FileUtils.mkdir_p @options[:bkdir] end filename = "postgresbk_#{@options[:database]}_#{Time.new.strftime("%m%d%y%H%M%S")}.dump" # The below system call assumes you have passwordless access as the user passed into the executable tool # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}` rescue Exception => e raise e ensure if is_allowed == 'f' # re quiesce set_dataallowcon_to false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def psql_db_command__dump psql_db\n psql_db_command__program \"pg_dump\", psql_db\n end", "def run_cmd!\n \"pg_dump #{pg_dump_args} | psql #{new_db_name}\"\n end", "def reexecute_connections?\n return true\n end", "def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end", "def exec__psql_db_batch__cli_or_apply_dumps *args\n psql_db = psql_db__sample_example\n db_dumps = db_dumps__sample_example\n batch = psql_db_batch__cli_or_apply_dumps psql_db, db_dumps, \"ON_ERROR_STOP=off\"\n batch_commands batch\n end", "def restore \n # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump\n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n fn = get_latest_backup_fn\n\n if fn == \"\"\n raise NoBackupsAvailableException.new \"There are no backups available at the specified location or in the default location (/tmp/postgresbk)\"\n end\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def run_after_fork\n @app.restore_db_connections_after_fork\n end", "def stage_over_connection?\n\t\tfalse\n\tend", "def pg_infodump(client, host, user, pass)\n puts\n begin\n infodump=@@outdir + host + '-pgsql_dump.txt'\n f=File.open(infodump, 'w+')\n f.puts \"Host: #{host}\"\n f.puts \"User: #{user}\"\n f.puts \"Pass: #{pass}\"\n connected_db = client.db()\n f.puts \"Connected DB: #{connected_db}\"\n print_good(\"Connected DB: #{connected_db}\")\n dbs=[]\n available_db = client.query(\"SELECT datname FROM pg_database;\")\n available_db.each do |row|\n row.each do |column|\n dbs << column[1]\n end\n end\n f.puts \"Available DB: #{dbs.join(',')}\"\n print_good(\"Available DB: #{dbs.join(',')}\")\n connected_user = client.user()\n version = client.query(\"SELECT version();\")\n f.puts \"Postgres Version: \"\n print_good(\"Postgres Version: \")\n version.each do |row|\n row.each do |column|\n f.puts column[1]\n puts column[1].white\n end\n end\n puts\n f.puts\n privileges = client.query(\"SELECT usename, usecreatedb, usesuper, usecatupd FROM pg_user;\")\n f.puts \"User Privileges:\"\n print_good(\"User Privileges: \")\n privileges.each do |row|\n row.each do |column, value|\n f.puts \" #{column}: #{value}\"\n print_line(\" #{column}: #{value}\")\n end\n puts\n f.puts\n end\n dba_accounts = client.query(\"SELECT usename FROM pg_user WHERE usesuper IS TRUE;\")\n f.puts \"DBA User Accounts: \"\n print_good(\"DBA User Accounts: \")\n dbas=[]\n dba_accounts.each do |row|\n row.each do |column|\n dbas << column[1]\n print_line(\" #{column[1]}\")\n f.puts \" #{column[1]}\"\n end\n end\n puts\n f.puts\n rescue PG::Error => e\n print_error(\"Error dumping basic info!\")\n f.puts \"Error dumping basic info!\"\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n if not dbas.empty? and dbas.include?(connected_user)\n begin\n f.puts \"Postgres Users & Password Dump:\"\n print_good(\"Postgres Users & Password Dump: \")\n passwords = client.query(\"SELECT usename, passwd FROM pg_shadow;\")\n passwords.each do |row|\n row.each do |column, value|\n f.puts \" #{column}: #{value}\"\n print_line(\" #{column}: #{value}\")\n end\n puts\n f.puts\n end\n rescue PG::Error => e\n f.puts \"Error dumping Postgres Users & Password hashes!\"\n print_error(\"Error dumping Postgres Users & Password hashes!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n else\n print_caution(\"User is not a full DBA, skipping password dump......\")\n f.puts \"User is not a full DBA, skipping password dump......\"\n end\n f.close\n end", "def check_connection( conn )\n begin\n @conn.exec(\"SELECT 1\")\n rescue PG::Error => err\n $stderr.puts \"%p while CHECKING TESTING connection: %s\" % [ err.class, err.message ]\n @conn.reset\n puts \"--------- PG CONNECTION RESETED -------------\"\n end\nend", "def database_exception_use_sqlstates?\n false\n end", "def database_exception_use_sqlstates?\n false\n end", "def makeDBConnection()\n\n if ( !@db_conn.nil? && @db_conn.status == PGconn::CONNECTION_OK)\n return\n end\n\n # trying anyway to release the connection just in case\n closeDBConn()\n\n begin\n @db_conn = PGconn.open(\n :host => @db_conf['host'],\n :port => @db_conf['port'],\n :options => @db_conf['options'],\n :tty => @db_conf['tty'],\n :dbname => @db_conf['dbname'],\n :user => @db_conf['user'],\n :password => @db_conf['password']\n )\n\n @db_conn.prepare(\"mypreparedinsert\", @db_conf['queryinsert'])\n # @db_conn.prepare(\"mypreparedupdate\", @db_conf['queryupdate'])\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if @byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{@db_conf['sleep']} seconds and retry\"\n slept = sleep @db_conf['sleep']\n $stderr.puts \"Slept #{slept} seconds\"\n retry\n end\n\n return\n end", "def database_in_recovery?(pg_connection)\n pg_connection.exec(\"SELECT pg_catalog.pg_is_in_recovery()\") do |db_result|\n result = db_result.map_types!(PG::BasicTypeMapForResults.new(pg_connection)).first\n result['pg_is_in_recovery']\n end\n end", "def database_in_recovery?(pg_connection)\n pg_connection.exec(\"SELECT pg_catalog.pg_is_in_recovery()\") do |db_result|\n result = db_result.map_types!(PG::BasicTypeMapForResults.new(pg_connection)).first\n result['pg_is_in_recovery']\n end\n end", "def recon\n !!ActiveRecord::Base.establish_connection\nend", "def hijack_db\n ActiveRecord::Base.establish_connection(\n :adapter => ENV['YAPTESTFE_DBTYPE'],\n :host => ENV['YAPTESTFE_DBIP'],\n :port => ENV['YAPTESTFE_DBPORT'].to_i,\n :username => ENV['YAPTESTFE_DBUSER'],\n :password => ENV['YAPTESTFE_DBPASS'],\n :database => ENV['YAPTESTFE_DBNAME']\n ) \n begin # catch db connection errors\n if not ActiveRecord::Base.connection.active?\n render :template => 'help/dberror', :layout => false\n end\n rescue PGError => msg\n logger.info \"DBERROR: #{msg}\"\n render :template => 'help/dberror', :layout => false\n end\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 psql_db_batch__cli_or_generate_dumps psql_db, db_dump_paths=[nil], options=\"\"\n psql_db = array__from(psql_db)\n db_dump_paths = array__from(db_dump_paths)\n batch = db_dump_paths.map { |db_dump_path|\n cli = psql_db_command__cli psql_db\n pg_dump = psql_db_command__dump psql_db\n program = db_dump_path && pg_dump || cli\n [program, db_dump_path && \" #{options} -f #{quoted_shell_param db_dump_path}\"]\n }\n end", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def pg_dump_args\n ['-x', '-O', if schema_only\n '-s'\n end, conf['database']].compact.join(' ')\n end", "def db\n @connection.pg rescue nil\n end", "def psql_db_dump_replacer__for_psql_db__sample_example\n [\n psql_db__sample_example,\n [\n \"/tmp/psql_db_original_dump\"\n ],\n [\n \"/tmp/database_dump\"\n ],\n \"ON_ERROR_STOP=off\",\n ]\n end", "def healthy_database?\n return true unless Gitlab::Database.postgresql?\n\n !Postgresql::ReplicationSlot.lag_too_great?\n end", "def prepare_db_for_restore\n raise \"restore unimplemented for #{adapter}\" unless (adapter = @db_conf[:adapter]) == 'postgresql'\n query = \"SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n tables = `#{cmd}`\n\n query = \"DROP TABLE #{tables.map(&:chomp).map(&:strip).reject(&:empty?).join(\", \")} CASCADE\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n `#{cmd}`\n end", "def finished_dumping(database)\n %Q{ -- Dumping of #{database} done ...}\n end", "def status\n if @async_command_aborted\n PG::CONNECTION_BAD\n else\n super\n end\n end", "def perform!\n super\n\n lock_database if @lock\n @only_collections.empty? ? dump! : specific_collection_dump!\n\n rescue => err\n raise Errors::Database::MongoDBError.wrap(err, 'Database Dump Failed!')\n ensure\n unlock_database if @lock\n package! unless err\n end", "def connection_pool_replenish_state\n super\n end", "def supports_concurrent_refreshes?\n postgresql_version >= 90400\n end", "def connection\n @pg\n end", "def psql_db_batch__cli_or_apply_dumps psql_db, db_dump_paths=[nil], options=\"\"\n batch = db_dump_paths.map { |db_dump_path|\n cli = psql_db_command__cli psql_db\n [cli, db_dump_path && \" #{options} -f #{quoted_shell_param db_dump_path}\"]\n }\n end", "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 sql_state; end", "def makeDBConnection(conf, dbConn)\n\n if ( !dbConn.nil? && dbConn.status == PGconn::CONNECTION_OK)\n return dbConn\n end\n\n # trying anyway to release the connection just in case\n closeDBConn(dbConn)\n\n begin\n dbConn = PGconn.open(\n :host => conf['airqdb']['host'],\n :port => conf['airqdb']['port'],\n :options => conf['airqdb']['options'],\n :tty => conf['airqdb']['tty'],\n :dbname => conf['airqdb']['dbname'],\n :user => conf['airqdb']['user'],\n :password => conf['airqdb']['password']\n )\n\n dbConn.prepare(\"sensordata\", \"INSERT INTO #{conf['airqdb']['measurestable']} \" +\n \"(id, srv_ts, topic, rssi, temp, pm10, pm25, no2a, no2b, humidity, message) \" +\n \"VALUES ($1::bigint, $2::timestamp with time zone, $3::text, $4::smallint, $5::numeric, \" +\n \"$6::numeric, $7::numeric, $8::numeric, $9::numeric, $10::numeric, $11::text)\")\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if $byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{conf['airqdb']['retry']} seconds and retry\"\n sleep conf['airqdb']['retry']\n retry\n end\n\n return dbConn\nend", "def supports_concurrent_connections?\n !@memory_database\n end", "def without_reconnect(&block); end", "def flushdb\n with_failover { redis.flushdb }\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 pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n 'database' => uri.path[1..-1],\n 'username' => uri.user,\n 'password' => uri.password,\n 'use_ssl' => true,\n 'validate_ssl_cert' => false\n }\n }\n open_jackdb(config)\n end", "def psql\n uri = generate_ingress_uri(\"Connecting\")\n ENV[\"PGPASSWORD\"] = uri.password\n ENV[\"PGSSLMODE\"] = 'require'\n system \"psql -U #{uri.user} -h #{uri.host} -p #{uri.port || 5432} #{uri.path[1..-1]}\"\n end", "def custom_silent_sql(q)\n begin\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n return true\n rescue => e\n if e =~ /MySQL server has gone away/\n print_error(\"Lost MySQL Connection!\")\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq payload.exe\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end", "def prepare_connections(sql_connection, no_sql_connection)\n raise Mongify::SqlConnectionRequired, \"Can only read from Mongify::Database::SqlConnection\" unless sql_connection.is_a?(Mongify::Database::SqlConnection)\n raise Mongify::NoSqlConnectionRequired, \"Can only write to Mongify::Database::NoSqlConnection\" unless no_sql_connection.is_a?(Mongify::Database::NoSqlConnection)\n\n self.sql_connection = sql_connection\n raise SqlConnectionInvalid, \"SQL Connection is not valid\" unless self.sql_connection.valid?\n self.no_sql_connection = no_sql_connection\n raise NoSqlConnectionInvalid, \"noSql Connection is not valid\" unless self.no_sql_connection.valid?\n\n no_sql_connection.ask_to_drop_database if no_sql_connection.forced?\n\n end", "def disconnect\n unless self.open_statements.empty?\n warn \"[RDBI] Open statements during disconnection -- automatically finishing. You should fix this.\"\n self.open_statements.each(&:finish)\n end\n self.open_statements = []\n @connected = false\n end", "def silence_ddl_notices(database)\n if session.configuration.send(database)[:adapter] =~ /postgres/\n old_message_level = session.send(database).\n select_one(\"show client_min_messages\")['client_min_messages']\n session.send(database).execute \"set client_min_messages = warning\"\n end\n yield\n ensure\n if session.configuration.send(database)[:adapter] =~ /postgres/\n session.send(database).execute \"set client_min_messages = #{old_message_level}\"\n end\n end", "def prepared_statements\n false\n end", "def initialize(db)\n @db = db\n @options = {\n symbolize_keys: true,\n cast_booleans: true\n }\n\n db.opts.each do |key, value|\n case (key)\n when :database, :username, :password, :host, :port, :socket, :encoding, :charset, :compress, :timeout\n @options[key] = value\n when :user\n @options[:username] = value\n when :loggers\n if (value and !value.empty?)\n @options[:logging] = true\n @options[:logger] = value.first\n end\n end\n end\n \n @query_queue = [ ]\n\n @connections = { }\n @connection_pool = [ ]\n @connections_active = { }\n \n @connection_limit = db.opts[:connections] || self.class.size\n \n if (EventMachine.reactor_running? and self.class.trace?)\n EventMachine::PeriodicTimer.new(1) do\n dump_file = \"#{self.class.trace}.#{@options[:database]}\"\n \n File.open(dump_file, 'w') do |f|\n f.puts @options[:database]\n\n @connections.each do |c, x|\n next unless (x)\n \n f.puts \"\\t#{c.inspect} -> #{x.inspect}\"\n end\n @connection_pool.each do |c|\n f.puts \"\\t#{c.inspect} (pool)\"\n end\n \n @query_queue.each do |query, callback|\n f.puts \"\\t#{query}\"\n end\n end\n end\n end\n end", "def wait_for_database\n\t\tprint \"Checking for postgres...\\n\"\n\t\tx = 0\n\t\twhile x < 6\n\t\t\tbegin\n\t\t\t\tdb = Sequel.connect('postgres://postgres:postgres@db/clerk')\n\t\t\t\tx = 6\n\t\t\trescue Sequel::DatabaseConnectionError\n\t\t\t\tprint \"Waiting for postgres to come up...\\n\"\n\t\t\t\tprint \"**************************\\n\\n\"\n\t\t\t\tsleep 30\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\t\tprint \"postgres came up\\n\"\n\t\tprint \"**************************\\n\\n\"\n\t\treturn db\n\tend", "def db_connection\n begin\n connection = PG.connect(dbname:'news')\n yield(connection)\n ensure\n connection.close\n end\nend", "def turn_off\n MAX_CONNECTIONS.times do\n connections << Sequel.connect(DATABASE_URL)\n end\n rescue Sequel::DatabaseConnectionError\n end", "def db_connection\n begin\n connection = PG.connect(dbname: \"pet_db\")\n yield(connection)\n ensure\n connection.close\n end\nend", "def squelch!\n @@squelched = true\n end", "def db_connection\n begin\n connection = PG.connect(dbname: 'recipes')\n yield(connection)\n ensure\n connection.close\n end\nend", "def perform!\n log!\n\n begin\n lock_database if @lock.eql?(true)\n if collections_to_dump.is_a?(Array) and not collections_to_dump.empty?\n specific_collection_dump!\n else\n dump!\n end\n unlock_database if @lock.eql?(true)\n rescue => exception\n unlock_database if @lock.eql?(true)\n raise exception\n end\n end", "def db_alive?\n \t@db_alive == true\n end", "def check_nosql_connection\n @configuration.no_sql_connection.valid? && @configuration.no_sql_connection.has_connection?\n end", "def setup_connection(conn)\n conn = super(conn)\n statement(conn) do |stmt|\n connection_pragmas.each{|s| log_connection_yield(s, conn){stmt.execute(s)}}\n end\n conn\n end", "def dump(db = config[\"database\"], data_selection: {})\n file_namer = Postgres::FileNameGenerator.new(working_dir)\n exclude_tables_args = data_selection.keys.map { |table| %Q|--exclude-table-data=\"#{table}\"| }\n\n [\n cli.dump(file_namer.next(db, :schema), db, [exclude_tables_args]),\n *dump_partial_selected_data(db, file_namer, data_selection)\n ]\n end", "def test_connection\n @pool.hold {|conn|}\n true\n end", "def flushdb(options = T.unsafe(nil)); end", "def xDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def dump(database, program_name, file, dump_all: false)\n file.write(\"SET foreign_key_checks = 0;\\n\")\n\n program = Program.find_by_name(program_name)\n\n RdsService::MODELS.each do |model|\n offset = dump_all ? RdsService::TIME_EPOCH : database_offset(model, database)\n records = recent_records(model, offset, database)\n\n last_record_container = OpenStruct.new\n\n # Chunk retrieved records while converting them to JSON at the same time.\n record_chunks = chunk_records(records, RdsService::RECORDS_BATCH_SIZE) do |record|\n last_record_container.record = record\n\n record = serialize_record(record, program)\n record.delete('record_type')\n record\n end\n\n # Convert the chunks to SQL INSERT statements and write them to file\n record_chunks.each do |chunk|\n record_fields = chunk.first.keys\n\n sql_values = chunk.map do |record|\n values = record_fields.map { |field| sql_quote(record[field]) }\n\n \"(#{values.join(', ')})\"\n end\n\n sql_statement = <<~SQL\n REPLACE INTO #{model.table_name} (#{record_fields.join(', ')})\n VALUES #{sql_values.join(', ')};\n SQL\n\n file.write(sql_statement)\n end\n\n next unless last_record_container.record\n\n save_database_offset(model, record_update_time(last_record_container.record), database)\n end\n\n file.write(\"SET foreign_key_checks = 1;\\n\")\nend", "def conn\n unless @conn\n # open the database config file\n db_config = YAML.load(ERB.new(File.read(\"config/ourstage_database.yml\")).result )\n database = db_config[environment]['database']\n @conn = EventMachine::Postgres.new(:database => database)\n @conn.setnonblocking(true) # may not be needed? \n end\n @conn\n end", "def after_restore\n change_ownership(\"postgres\")\n change_permissions($seven_zero_zero)\n create_symlink\n start_postgres\nend", "def begin_savepoint(conn, opts)\n super\n\n unless (read_only = opts[:read_only]).nil?\n log_connection_execute(conn, \"SET TRANSACTION READ #{read_only ? 'ONLY' : 'WRITE'}\")\n end\n end", "def disconnected?; connection_state == :disconnected end", "def capture\n db = resolve_db(:allow_default => true)\n\n from_url = db[:url]\n from_name = db[:name]\n to_url = nil # server will assign\n to_name = \"BACKUP\"\n opts = {:expire => extract_option(\"--expire\")}\n\n backup = transfer!(from_url, from_name, to_url, to_name, opts)\n\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = to_uri.path.empty? ? \"error\" : File.basename(to_uri.path, '.*')\n display \"\\n#{db[:pretty_name]} ----backup---> #{backup_id}\"\n\n backup = poll_transfer!(backup)\n\n if backup[\"error_at\"]\n message = \" ! An error occurred and your backup did not finish.\"\n message += \"\\n ! The database is not yet online. Please try again.\" if backup['log'] =~ /Name or service not known/\n message += \"\\n ! The database credentials are incorrect.\" if backup['log'] =~ /psql: FATAL:/\n abort(message)\n end\n end", "def raw_connection\n with_raw_connection do |conn|\n disable_lazy_transactions!\n @raw_connection_dirty = true\n conn\n end\n end", "def postgres\n @postgres ||= Connections::Postgres.new(options: @postgres_options)\n end", "def with_duplicate_conn\n\t\toriginal_conn = self.conn\n\t\t@conn = original_conn.dup\n\t\tself.log.info \"Executing with %p, a copy of connection %p\" % [ @conn, original_conn ]\n\t\tyield\n\tensure\n\t\tself.log.info \" restoring original connection %p.\" % [ original_conn ]\n\t\t@conn = original_conn\n\tend", "def with_two_connections\n run_without_connection do |original_connection|\n ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))\n begin\n ddl_connection = ActiveRecord::Base.connection_pool.checkout\n begin\n yield original_connection, ddl_connection\n ensure\n ActiveRecord::Base.connection_pool.checkin ddl_connection\n end\n ensure\n ActiveRecord::Base.connection_handler.clear_all_connections!(:all)\n end\n end\n end", "def raw_connection\n disable_lazy_transactions!\n @connection\n end", "def psql_on_app_db(*args)\n psql_on_db(fetch(:pg_database), *args)\n end", "def process_postgres(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/postgresql_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :database => target['database'],\n :port => target['port'],\n :sslMode => target['ssl_mode'].upcase,\n :schema => target['table'].split('.')[0],\n :username => target['username'],\n :password => target['password'],\n :purpose => 'ENRICHED_EVENTS'\n }\n }\nend", "def wDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end", "def on_db_host(host)\n\tend", "def dump_all_databases(num)\n timez = t.strftime(\"%m.%d.%Y\")\n logs = RESULTS + @host\n logdir = logs + '/dumps/'\n Dir.mkdir(logs) unless File.exists?(logs)\n Dir.mkdir(logdir) unless File.exists?(logdir)\n print_status(\"Attempting to dump ALL available databases....\")\n query = @db_connection.query('SHOW DATABASES;')\n query.each do |x|\n # Skip default databases to avoid issues with mysqldump --all-databases in newer clients\n # While longer this helps ensure cleaner DB Dump files as well\n # MYSQLDUMP Error: Couldn't read status information for table general_log (...)\n if not x[0] =~ /^mysql$|^information_schema$|^test$|^database$/i\n print_status(\"Dumping '#{x[0]}'....\")\n if num.to_i == 1\n system(\"`which mysqldump` --host=#{@host} --user=#{@user} --password=#{@pass} #{x[0]} --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick -C --dump-date | gzip -c > #{logdir}#{x[0]}_#{timez}.sql.gz\")\n else\n system(\"`which mysqldump` --host=#{@host} --user=#{@user} --password=#{@pass} #{x[0]} --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick -C --dump-date > #{logdir}#{x[0]}_#{timez}.sql\")\n end\n else\n print_caution(\"Skipping default database '#{x[0]}'...\")\n end\n end\n print_status(\"Database Dumping Completed!\")\n print_status(\"Dump file(s) saved to: #{logdir}\")\n system(\"ls -lua #{logdir} | grep --color -E '.sql.gz|.sql'\")\n end", "def supports_transactional_ddl?\n false\n end", "def server_attach(dbname, mode)\n #This is a stub, used for indexing\n end", "def on_connection(conn)\n @backends.delete_if { |b| b.dead? }\n logger.debug \"Server:on_connection #{conn} backends #{@backends.count} loads #{@backends.map {|x| x.load}.inspect}\" if logger\n raise ::Heroku::Forward::Errors::BackendFailedToStartError.new if @backends.empty?\n # Find the one with the minimum load.\n b = @backends.select {|b| b.ready?}.reduce() { |t,v| t.load <= v.load ? t : v }\n # If there is no connection wait a bit and try again.\n if b\n prev_load = b.load\n if b.connect(conn)\n return\n else\n # This request is already toast. Just ignore, reset load.\n b.load = prev_load\n end\n else\n s = self\n logger.debug \"Server: EM queuing #{conn} because no available backends yet.\" if logger\n EM.next_tick do\n #logger.info \"Server: next_tick #{conn}.\" if logger\n sleep 1\n if @rejection_data\n s.reject_connection(conn)\n else\n s.on_connection(conn)\n end\n end\n end\n end", "def set_bulkcopy (query, dbname, status )\n begin\n unless( query.sql_norow(\"use master\") ) then\n return false\n end\n query.sql(\"exec sp_dboption #{dbname},'select into/bulkcopy',#{status}\")\n return false unless (query.cmd_done? )\n return false if( query.top_status_result != 0 )\n\n unless( query.sql_norow(\"use #{dbname}\") ) then\n return false \n end\n unless( query.sql_norow(\"checkpoint\") ) then\n return false\n end\n rescue\n return false\n else\n return true\n end\nend", "def postgres_plain_connection(ip)\n PG::Connection.new(\n host: ip,\n user: DB_USER,\n dbname: DB_NAME,\n port: DB_PORT,\n password: DB_PASSWORD,\n connect_timeout: \"1\",\n )\nend", "def restore_pg_dump_file(to_db, sections = %w(pre-data data post-data), jobs)\n files = Dir.glob(File.join(working_dir, \"*.schema\"))\n raise \"Expected to have only one pg_dump file, but found these: #{files.inspect}\" if files.size > 1\n\n sections_args = sections.map { |section| \"--section=#{section}\" }\n cli.restore(files.first, to_db, [*sections_args, \"--jobs=#{jobs}\"])\n end", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n $DEBUG && warn(\"Closing pg connection: #{conn.object_id}\")\n conn.close\n end\n @connections = []\n @available.clear\n end\n end", "def flushdb; end", "def dump_pending\n end", "def dump_pending\n end", "def postgres_query(sql=nil,doprint=false)\n ip = datastore['RHOST']\n port = datastore['RPORT']\n postgres_login unless self.postgres_conn\n unless self.postgres_conn\n return {:conn_error => true}\n end\n if self.postgres_conn\n sql ||= datastore['SQL']\n vprint_status \"#{ip}:#{port} Postgres - querying with '#{sql}'\"\n begin\n resp = self.postgres_conn.query(sql)\n rescue RuntimeError => e\n case sql_error_msg = e.to_s.split(\"\\t\")[1] # Deal with some common errors\n when \"C42601\"\n sql_error_msg += \" Invalid SQL Syntax: '#{sql}'\"\n when \"C42P01\"\n sql_error_msg += \" Table does not exist: '#{sql}'\"\n when \"C42703\"\n sql_error_msg += \" Column does not exist: '#{sql}'\"\n when \"C42883\"\n sql_error_msg += \" Function does not exist: '#{sql}'\"\n else # Let the user figure out the rest.\n if e == Timeout::Error\n sql_error_msg = 'Execution expired'\n elsif sql_error_msg.nil?\n sql_error_msg = e.inspect\n else\n sql_error_msg += \" SQL statement '#{sql}' returns #{e.inspect}\"\n end\n end\n return {:sql_error => sql_error_msg}\n end\n postgres_print_reply(resp,sql) if doprint\n return {:complete => resp}\n end\n end", "def print\n $stdout.puts(\"DB #{@context.getDBConnection.toString}\")\n end", "def psql_db_command__cli psql_db\n psql_db_command__program \"psql\", psql_db\n end", "def reload_db_schema?\n false\n end" ]
[ "0.6289234", "0.60187024", "0.59925276", "0.5930819", "0.5867983", "0.5866526", "0.5699605", "0.56190515", "0.56118846", "0.5585545", "0.55830693", "0.55807143", "0.55603784", "0.5556293", "0.5556293", "0.5552273", "0.55461043", "0.55160654", "0.5511669", "0.5508263", "0.5504144", "0.5445418", "0.54373395", "0.5435554", "0.5435397", "0.5418284", "0.54152113", "0.5390628", "0.5342298", "0.53179884", "0.53134537", "0.530277", "0.52953225", "0.52953225", "0.52953225", "0.52953225", "0.52953225", "0.52953225", "0.52953225", "0.5291614", "0.52887976", "0.5283419", "0.52773565", "0.5259927", "0.5238334", "0.52307475", "0.52095157", "0.5205836", "0.51921844", "0.51781833", "0.51717013", "0.51546687", "0.51526296", "0.5149637", "0.5144575", "0.5144527", "0.513121", "0.5130583", "0.51210546", "0.51106656", "0.5108885", "0.510709", "0.51011294", "0.5093922", "0.5075296", "0.50732887", "0.50627863", "0.5060952", "0.50588626", "0.50505006", "0.5035439", "0.50294036", "0.50272924", "0.5022251", "0.5015306", "0.5012955", "0.5009379", "0.50055516", "0.5002696", "0.4997411", "0.49954578", "0.49889603", "0.49872136", "0.4970513", "0.49674284", "0.4956965", "0.49498788", "0.49444258", "0.494393", "0.49431556", "0.49349377", "0.4929023", "0.49222323", "0.4921435", "0.4914365", "0.4914365", "0.49104157", "0.49087653", "0.4906752", "0.49009302" ]
0.6412538
0
Similarly to pg_dump, pg_restore does not work if datallowcon=false (ie quiesced) so logic needs to be implemented to check if the database can receive connections and if not, turn it back on just before running the pg_restore. At the end of the method, it should put the datallowcon back to the state it was in originally
def restore # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump begin check_if_db_exists is_allowed = @conn.exec("select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'")[0]['datallowconn'] if is_allowed == 'f' # unquiece temporarily set_dataallowcon_to true end fn = get_latest_backup_fn if fn == "" raise NoBackupsAvailableException.new "There are no backups available at the specified location or in the default location (/tmp/postgresbk)" end # The below system call assumes you have passwordless access as the user passed into the executable tool # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}` rescue Exception => e raise e ensure if is_allowed == 'f' # re quiesce set_dataallowcon_to false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def psql_db_command__dump psql_db\n psql_db_command__program \"pg_dump\", psql_db\n end", "def prepare_db_for_restore\n raise \"restore unimplemented for #{adapter}\" unless (adapter = @db_conf[:adapter]) == 'postgresql'\n query = \"SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n tables = `#{cmd}`\n\n query = \"DROP TABLE #{tables.map(&:chomp).map(&:strip).reject(&:empty?).join(\", \")} CASCADE\"\n cmd = \"psql #{@db_conf[:database]} -t -c \\\"#{query}\\\"\"\n puts \"Executing: '#{cmd}'\"\n `#{cmd}`\n end", "def run_cmd!\n \"pg_dump #{pg_dump_args} | psql #{new_db_name}\"\n end", "def run_after_fork\n @app.restore_db_connections_after_fork\n end", "def reexecute_connections?\n return true\n end", "def exec__psql_db_batch__cli_or_apply_dumps *args\n psql_db = psql_db__sample_example\n db_dumps = db_dumps__sample_example\n batch = psql_db_batch__cli_or_apply_dumps psql_db, db_dumps, \"ON_ERROR_STOP=off\"\n batch_commands batch\n end", "def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end", "def restore_pg_dump_file(to_db, sections = %w(pre-data data post-data), jobs)\n files = Dir.glob(File.join(working_dir, \"*.schema\"))\n raise \"Expected to have only one pg_dump file, but found these: #{files.inspect}\" if files.size > 1\n\n sections_args = sections.map { |section| \"--section=#{section}\" }\n cli.restore(files.first, to_db, [*sections_args, \"--jobs=#{jobs}\"])\n end", "def database_in_recovery?(pg_connection)\n pg_connection.exec(\"SELECT pg_catalog.pg_is_in_recovery()\") do |db_result|\n result = db_result.map_types!(PG::BasicTypeMapForResults.new(pg_connection)).first\n result['pg_is_in_recovery']\n end\n end", "def database_in_recovery?(pg_connection)\n pg_connection.exec(\"SELECT pg_catalog.pg_is_in_recovery()\") do |db_result|\n result = db_result.map_types!(PG::BasicTypeMapForResults.new(pg_connection)).first\n result['pg_is_in_recovery']\n end\n end", "def after_restore\n change_ownership(\"postgres\")\n change_permissions($seven_zero_zero)\n create_symlink\n start_postgres\nend", "def restore\n\t\tunless (@options && @options[:path] && @options[:dataset] && @options[:target])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'restore'.\"\n\t\tend\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tsource_dir = @options[:path]\n\t\tunless (source_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\tif (what.to_sym == :configuration)\n\t\t\t$log.info \"Configuration is part of the data set; nothing to restore.\"\n\t\t\treturn\n\t\tend\n\t\ttarget = @options[:target]\n\t\tunless (target == \"/\")\n\t\t\traise RuntimeError, \"Databases can only be restored to a running service.\"\n\t\tend\n\n\t\t# Point to the root volume if :path points to the secret restore path.\n\t\tif (source_dir == SECRET_DIR)\n\t\t\tsource_dir = \"\"\n\t\tend\n\n\t\t# Create the log file if it doesn't exist.\n\t\tlog_file = self.logFile\n\t\tif !File.exists?(log_file)\n\t\t\t$log.warn \"Recreating #{log_file}.\"\n\t\t\tFileUtils.touch(log_file)\n\t\tend\n\t\t# Always ensure the permissions & ownership are correct.\n\t\tFileUtils.chmod(0660, log_file)\n\t\t# _postgres has uid of 216; using instead of string in case user db hasn't yet been restored\n\t\tFileUtils.chown(216, \"admin\", log_file)\n\n\t\t# Create the socket directory if it doesn't exist.\n\t\tsocket_dir = self.socketDir\n\t\tif !File.exists?(socket_dir)\n\t\t\t$log.warn \"Recreating #{socket_dir}.\"\n\t\t\tFileUtils.mkdir_p(socket_dir, :mode => 0750)\n\t\t\tFileUtils.chown(216, 216, socket_dir)\n\t\tend\n\n\t\t# Bail if the restore file is not present.\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{source_dir}#{archive_dir}/#{BACKUP_FILE}\"\n\t\t$log.info \"Restoring \\'#{dump_file}\\' to \\'#{target}\\'...\"\n\t\tunless File.file?(dump_file)\n\t\t\traise RuntimeError, \"Backup file not present in source volume! Nothing to restore!\"\n\t\tend\n\n\t\t# Recall if the service was previously enabled\n\t\tdb_dir = self.dataDir\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\") if state\n\t\tif (File.directory?(db_dir))\n\t\t\t$log.info \"...moving aside previous database...\"\n\t\t\tFileUtils.mv(db_dir, \"#{db_dir}.pre-restore-#{Time.now.strftime('%Y-%m-%d_%H:%M:%S_%Z')}\")\n\t\tend\n\t\t$log.info \"...creating an empty database at #{db_dir}...\"\n\t\tFileUtils.mkdir_p(db_dir, :mode => 0700)\n\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\tFile.chown(216, 216, db_dir)\n\t\tself.launch(\"/usr/bin/sudo -u _postgres /usr/bin/initdb --encoding UTF8 -D #{db_dir.shellescape}\")\n\t\tself.launch(\"/usr/sbin/serveradmin start postgres\")\n\t\t$log.info \"...replaying database contents (this may take a while)...\"\n\t\tsystem(\"/usr/bin/gzcat #{dump_file.shellescape} | /usr/bin/sudo -u _postgres /usr/bin/psql postgres\")\n\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\") unless state\n\t\t$log.info \"...Restore succeeded.\"\n\tend", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def recon\n !!ActiveRecord::Base.establish_connection\nend", "def capture\n db = resolve_db(:allow_default => true)\n\n from_url = db[:url]\n from_name = db[:name]\n to_url = nil # server will assign\n to_name = \"BACKUP\"\n opts = {:expire => extract_option(\"--expire\")}\n\n backup = transfer!(from_url, from_name, to_url, to_name, opts)\n\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = to_uri.path.empty? ? \"error\" : File.basename(to_uri.path, '.*')\n display \"\\n#{db[:pretty_name]} ----backup---> #{backup_id}\"\n\n backup = poll_transfer!(backup)\n\n if backup[\"error_at\"]\n message = \" ! An error occurred and your backup did not finish.\"\n message += \"\\n ! The database is not yet online. Please try again.\" if backup['log'] =~ /Name or service not known/\n message += \"\\n ! The database credentials are incorrect.\" if backup['log'] =~ /psql: FATAL:/\n abort(message)\n end\n end", "def revert_database\n ActiveRecord::Base.establish_connection(default_connection)\n end", "def database_exception_use_sqlstates?\n false\n end", "def database_exception_use_sqlstates?\n false\n end", "def psql_db_batch__cli_or_generate_dumps psql_db, db_dump_paths=[nil], options=\"\"\n psql_db = array__from(psql_db)\n db_dump_paths = array__from(db_dump_paths)\n batch = db_dump_paths.map { |db_dump_path|\n cli = psql_db_command__cli psql_db\n pg_dump = psql_db_command__dump psql_db\n program = db_dump_path && pg_dump || cli\n [program, db_dump_path && \" #{options} -f #{quoted_shell_param db_dump_path}\"]\n }\n end", "def pg_dump_args\n ['-x', '-O', if schema_only\n '-s'\n end, conf['database']].compact.join(' ')\n end", "def psql_db_batch__cli_or_apply_dumps psql_db, db_dump_paths=[nil], options=\"\"\n batch = db_dump_paths.map { |db_dump_path|\n cli = psql_db_command__cli psql_db\n [cli, db_dump_path && \" #{options} -f #{quoted_shell_param db_dump_path}\"]\n }\n end", "def pg_infodump(client, host, user, pass)\n puts\n begin\n infodump=@@outdir + host + '-pgsql_dump.txt'\n f=File.open(infodump, 'w+')\n f.puts \"Host: #{host}\"\n f.puts \"User: #{user}\"\n f.puts \"Pass: #{pass}\"\n connected_db = client.db()\n f.puts \"Connected DB: #{connected_db}\"\n print_good(\"Connected DB: #{connected_db}\")\n dbs=[]\n available_db = client.query(\"SELECT datname FROM pg_database;\")\n available_db.each do |row|\n row.each do |column|\n dbs << column[1]\n end\n end\n f.puts \"Available DB: #{dbs.join(',')}\"\n print_good(\"Available DB: #{dbs.join(',')}\")\n connected_user = client.user()\n version = client.query(\"SELECT version();\")\n f.puts \"Postgres Version: \"\n print_good(\"Postgres Version: \")\n version.each do |row|\n row.each do |column|\n f.puts column[1]\n puts column[1].white\n end\n end\n puts\n f.puts\n privileges = client.query(\"SELECT usename, usecreatedb, usesuper, usecatupd FROM pg_user;\")\n f.puts \"User Privileges:\"\n print_good(\"User Privileges: \")\n privileges.each do |row|\n row.each do |column, value|\n f.puts \" #{column}: #{value}\"\n print_line(\" #{column}: #{value}\")\n end\n puts\n f.puts\n end\n dba_accounts = client.query(\"SELECT usename FROM pg_user WHERE usesuper IS TRUE;\")\n f.puts \"DBA User Accounts: \"\n print_good(\"DBA User Accounts: \")\n dbas=[]\n dba_accounts.each do |row|\n row.each do |column|\n dbas << column[1]\n print_line(\" #{column[1]}\")\n f.puts \" #{column[1]}\"\n end\n end\n puts\n f.puts\n rescue PG::Error => e\n print_error(\"Error dumping basic info!\")\n f.puts \"Error dumping basic info!\"\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n if not dbas.empty? and dbas.include?(connected_user)\n begin\n f.puts \"Postgres Users & Password Dump:\"\n print_good(\"Postgres Users & Password Dump: \")\n passwords = client.query(\"SELECT usename, passwd FROM pg_shadow;\")\n passwords.each do |row|\n row.each do |column, value|\n f.puts \" #{column}: #{value}\"\n print_line(\" #{column}: #{value}\")\n end\n puts\n f.puts\n end\n rescue PG::Error => e\n f.puts \"Error dumping Postgres Users & Password hashes!\"\n print_error(\"Error dumping Postgres Users & Password hashes!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n else\n print_caution(\"User is not a full DBA, skipping password dump......\")\n f.puts \"User is not a full DBA, skipping password dump......\"\n end\n f.close\n end", "def flushdb\n with_failover { redis.flushdb }\n end", "def connection_pool_replenish_state\n super\n end", "def psql_db_dump_replacer__for_psql_db__sample_example\n [\n psql_db__sample_example,\n [\n \"/tmp/psql_db_original_dump\"\n ],\n [\n \"/tmp/database_dump\"\n ],\n \"ON_ERROR_STOP=off\",\n ]\n end", "def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n \"DBInstanceClass\" => @opts['db_instance_type'] } )\n rescue Exception => e\n raise MyRDSException.new(\"Error in #{self.class}:restore_db: #{e.class}: #{e}\")\n end\n\n end", "def stage_over_connection?\n\t\tfalse\n\tend", "def before_restore\n stop_postgres\n # Remove symlink to oltp\n FileUtils.rm_r '/data/db/oltp'\n create_directory\n change_ownership(\"barman\")\n change_permissions($seven_five_five)\n edit_backup_info\nend", "def check_connection( conn )\n begin\n @conn.exec(\"SELECT 1\")\n rescue PG::Error => err\n $stderr.puts \"%p while CHECKING TESTING connection: %s\" % [ err.class, err.message ]\n @conn.reset\n puts \"--------- PG CONNECTION RESETED -------------\"\n end\nend", "def with_duplicate_conn\n\t\toriginal_conn = self.conn\n\t\t@conn = original_conn.dup\n\t\tself.log.info \"Executing with %p, a copy of connection %p\" % [ @conn, original_conn ]\n\t\tyield\n\tensure\n\t\tself.log.info \" restoring original connection %p.\" % [ original_conn ]\n\t\t@conn = original_conn\n\tend", "def hijack_db\n ActiveRecord::Base.establish_connection(\n :adapter => ENV['YAPTESTFE_DBTYPE'],\n :host => ENV['YAPTESTFE_DBIP'],\n :port => ENV['YAPTESTFE_DBPORT'].to_i,\n :username => ENV['YAPTESTFE_DBUSER'],\n :password => ENV['YAPTESTFE_DBPASS'],\n :database => ENV['YAPTESTFE_DBNAME']\n ) \n begin # catch db connection errors\n if not ActiveRecord::Base.connection.active?\n render :template => 'help/dberror', :layout => false\n end\n rescue PGError => msg\n logger.info \"DBERROR: #{msg}\"\n render :template => 'help/dberror', :layout => false\n end\n end", "def finished_dumping(database)\n %Q{ -- Dumping of #{database} done ...}\n end", "def dump(database, program_name, file, dump_all: false)\n file.write(\"SET foreign_key_checks = 0;\\n\")\n\n program = Program.find_by_name(program_name)\n\n RdsService::MODELS.each do |model|\n offset = dump_all ? RdsService::TIME_EPOCH : database_offset(model, database)\n records = recent_records(model, offset, database)\n\n last_record_container = OpenStruct.new\n\n # Chunk retrieved records while converting them to JSON at the same time.\n record_chunks = chunk_records(records, RdsService::RECORDS_BATCH_SIZE) do |record|\n last_record_container.record = record\n\n record = serialize_record(record, program)\n record.delete('record_type')\n record\n end\n\n # Convert the chunks to SQL INSERT statements and write them to file\n record_chunks.each do |chunk|\n record_fields = chunk.first.keys\n\n sql_values = chunk.map do |record|\n values = record_fields.map { |field| sql_quote(record[field]) }\n\n \"(#{values.join(', ')})\"\n end\n\n sql_statement = <<~SQL\n REPLACE INTO #{model.table_name} (#{record_fields.join(', ')})\n VALUES #{sql_values.join(', ')};\n SQL\n\n file.write(sql_statement)\n end\n\n next unless last_record_container.record\n\n save_database_offset(model, record_update_time(last_record_container.record), database)\n end\n\n file.write(\"SET foreign_key_checks = 1;\\n\")\nend", "def backup\n\t\tunless (@options && @options[:path] && @options[:dataset])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'backup'.\"\n\t\tend\n\t\t# Only attempt backup if the service is running\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\torig_state = state\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tarchive_dir = @options[:path]\n\t\tunless (archive_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\t# The passed :archive_dir and :what are ignored because the dump is put\n\t\t# on the live data volume\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{archive_dir}/#{BACKUP_FILE}\"\n\t\tdump_file_uncompressed = \"#{archive_dir}/#{BACKUP_FILE_UNCOMPRESSED}\"\n\t\t# Create the backup directory as necessary.\n\t\tunless File.directory?(archive_dir)\n\t\t\tif File.exists?(archive_dir)\n\t\t\t\t$log.info \"Moving aside #{archive_dir}...\\n\"\n\t\t\t\tFileUtils.mv(archive_dir, archive_dir + \".applesaved\")\n\t\t\tend\n\t\t\t$log.info \"Creating backup directory: #{archive_dir}...\\n\"\n\t\t\tFileUtils.mkdir_p(archive_dir, :mode => 0700)\n\t\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\t\tFile.chown(216, 216, archive_dir)\n\t\tend\n\t\t# Backup only once a day\n\t\tmod_time = File.exists?(dump_file) ? File.mtime(dump_file) : Time.at(0)\n\t\tif (Time.now - mod_time) >= (24 * 60 * 60)\n\t\t\t# Attempt to start the service if needed\n\t\t\tif (! state)\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin start postgres\") do |output|\n\t\t\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (! state)\n\t\t\t\t$log.info \"PostgreSQL is not running, skipping database backup\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t$log.info \"Creating dump file \\'#{dump_file}\\'...\"\n\t\t\tsystem(\"/usr/bin/sudo -u _postgres /usr/bin/pg_dumpall > #{dump_file_uncompressed.shellescape}\")\n\t\t\tif ($?.exitstatus != 0)\n\t\t\t\t$log.error \"...Backup failed on pg_dumpall, Status=#{$?.exitstatus}\"\n\t\t\telse\n\t\t\t\tsystem(\"/usr/bin/gzip #{dump_file_uncompressed.shellescape}\")\t\t\t\t\n\t\t\t\tif ($?.exitstatus == 0)\n\t\t\t\t\tFile.chmod(0640, dump_file)\n\t\t\t\t\tFile.chown(216, 216, dump_file)\n\t\t\t\t\t$log.info \"...Backup succeeded.\"\n\t\t\t\telse\n\t\t\t\t\t$log.error \"...Backup failed on gzip! Status=#{$?.exitstatus}\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Restore original service state\n\t\t\tif (! orig_state)\n\t\t\t\t# What if a dependent service was launched while we were backing up? We\n\t\t\t\t# don't want to shut down postgres in that case.\n\t\t\t\twiki_state = false\n\t\t\t\tcalendar_state = false\n\t\t\t\taddressbook_state = false\n\t\t\t\tdevicemgr_state = false\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status wiki\") do |output|\n\t\t\t\t\twiki_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status calendar\") do |output|\n\t\t\t\t\tcalendar_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status addressbook\") do |output|\n\t\t\t\t\taddressbook_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status devicemgr\") do |output|\n\t\t\t\t\tdevicemgr_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tif (! (wiki_state || calendar_state || addressbook_state || devicemgr_state))\n\t\t\t\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t$log.info \"Dump file is less than 24 hours old; skipping.\"\n\t\tend\n\tend", "def load_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n \n Dir.chdir app_config[:backup_path] do\n # find the latest dump and load it in\n dump_file = Dir.glob(\"db/#{app_name}.#{instance_name}_*\").max\n unless dump_file\n dump_file = Dir.glob(\"db/#{app_name}.*\").max\n end\n Kernel.system \"mysql -u#{db_user} -p#{db_pass} #{db_name} < #{dump_file}\"\n end\n end", "def raw_connection\n with_raw_connection do |conn|\n disable_lazy_transactions!\n @raw_connection_dirty = true\n conn\n end\n end", "def sql_state; end", "def without_reconnect(&block); end", "def makeDBConnection()\n\n if ( !@db_conn.nil? && @db_conn.status == PGconn::CONNECTION_OK)\n return\n end\n\n # trying anyway to release the connection just in case\n closeDBConn()\n\n begin\n @db_conn = PGconn.open(\n :host => @db_conf['host'],\n :port => @db_conf['port'],\n :options => @db_conf['options'],\n :tty => @db_conf['tty'],\n :dbname => @db_conf['dbname'],\n :user => @db_conf['user'],\n :password => @db_conf['password']\n )\n\n @db_conn.prepare(\"mypreparedinsert\", @db_conf['queryinsert'])\n # @db_conn.prepare(\"mypreparedupdate\", @db_conf['queryupdate'])\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if @byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{@db_conf['sleep']} seconds and retry\"\n slept = sleep @db_conf['sleep']\n $stderr.puts \"Slept #{slept} seconds\"\n retry\n end\n\n return\n end", "def db\n @connection.pg rescue nil\n end", "def xDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def status\n if @async_command_aborted\n PG::CONNECTION_BAD\n else\n super\n end\n end", "def raw_connection\n disable_lazy_transactions!\n @connection\n end", "def perform!\n super\n\n lock_database if @lock\n @only_collections.empty? ? dump! : specific_collection_dump!\n\n rescue => err\n raise Errors::Database::MongoDBError.wrap(err, 'Database Dump Failed!')\n ensure\n unlock_database if @lock\n package! unless err\n end", "def begin_savepoint(conn, opts)\n super\n\n unless (read_only = opts[:read_only]).nil?\n log_connection_execute(conn, \"SET TRANSACTION READ #{read_only ? 'ONLY' : 'WRITE'}\")\n end\n end", "def with_two_connections\n run_without_connection do |original_connection|\n ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))\n begin\n ddl_connection = ActiveRecord::Base.connection_pool.checkout\n begin\n yield original_connection, ddl_connection\n ensure\n ActiveRecord::Base.connection_pool.checkin ddl_connection\n end\n ensure\n ActiveRecord::Base.connection_handler.clear_all_connections!(:all)\n end\n end\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 psql\n uri = generate_ingress_uri(\"Connecting\")\n ENV[\"PGPASSWORD\"] = uri.password\n ENV[\"PGSSLMODE\"] = 'require'\n system \"psql -U #{uri.user} -h #{uri.host} -p #{uri.port || 5432} #{uri.path[1..-1]}\"\n end", "def makeDBConnection(conf, dbConn)\n\n if ( !dbConn.nil? && dbConn.status == PGconn::CONNECTION_OK)\n return dbConn\n end\n\n # trying anyway to release the connection just in case\n closeDBConn(dbConn)\n\n begin\n dbConn = PGconn.open(\n :host => conf['airqdb']['host'],\n :port => conf['airqdb']['port'],\n :options => conf['airqdb']['options'],\n :tty => conf['airqdb']['tty'],\n :dbname => conf['airqdb']['dbname'],\n :user => conf['airqdb']['user'],\n :password => conf['airqdb']['password']\n )\n\n dbConn.prepare(\"sensordata\", \"INSERT INTO #{conf['airqdb']['measurestable']} \" +\n \"(id, srv_ts, topic, rssi, temp, pm10, pm25, no2a, no2b, humidity, message) \" +\n \"VALUES ($1::bigint, $2::timestamp with time zone, $3::text, $4::smallint, $5::numeric, \" +\n \"$6::numeric, $7::numeric, $8::numeric, $9::numeric, $10::numeric, $11::text)\")\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if $byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{conf['airqdb']['retry']} seconds and retry\"\n sleep conf['airqdb']['retry']\n retry\n end\n\n return dbConn\nend", "def turn_off\n MAX_CONNECTIONS.times do\n connections << Sequel.connect(DATABASE_URL)\n end\n rescue Sequel::DatabaseConnectionError\n end", "def wDumpAllDatabase()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongodump.bat')\n end", "def disconnect_connection(conn)\n conn.RollbackTrans rescue nil\n super\n end", "def disconnect\n unless self.open_statements.empty?\n warn \"[RDBI] Open statements during disconnection -- automatically finishing. You should fix this.\"\n self.open_statements.each(&:finish)\n end\n self.open_statements = []\n @connected = false\n end", "def dump(db = config[\"database\"], data_selection: {})\n file_namer = Postgres::FileNameGenerator.new(working_dir)\n exclude_tables_args = data_selection.keys.map { |table| %Q|--exclude-table-data=\"#{table}\"| }\n\n [\n cli.dump(file_namer.next(db, :schema), db, [exclude_tables_args]),\n *dump_partial_selected_data(db, file_namer, data_selection)\n ]\n end", "def supports_concurrent_refreshes?\n postgresql_version >= 90400\n end", "def mark_as_restored\n @restored = true\n end", "def make_mysql_backup\n if @all_databases\n options = {\n :name => \"--all-databases\",\n :dump_options => \"\",\n :append_name => \"\"\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\n if @databases && [email protected]?\n @databases.each do |db|\n options = {\n :name => db[:name].to_s,\n :dump_options => db[:dump_options].to_s,\n :append_name => db[:append_name].to_s\n }\n file_name = mysqldump(options)\n compress_file(file_name)\n end\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: \"brussels_sprouts_recipes\")\n yield(connection)\n ensure\n connection.close\n end\nend", "def healthy_database?\n return true unless Gitlab::Database.postgresql?\n\n !Postgresql::ReplicationSlot.lag_too_great?\n end", "def connect_to_old_db\n ActiveRecord::Base.establish_connection(\n :adapter => \"postgresql\",\n :host => \"localhost\",\n :username => \"postgres\",\n :password => \"vegpuf\",\n :database => \"affluence_staging_25_june\"\n )\nend", "def prepare_connections(sql_connection, no_sql_connection)\n raise Mongify::SqlConnectionRequired, \"Can only read from Mongify::Database::SqlConnection\" unless sql_connection.is_a?(Mongify::Database::SqlConnection)\n raise Mongify::NoSqlConnectionRequired, \"Can only write to Mongify::Database::NoSqlConnection\" unless no_sql_connection.is_a?(Mongify::Database::NoSqlConnection)\n\n self.sql_connection = sql_connection\n raise SqlConnectionInvalid, \"SQL Connection is not valid\" unless self.sql_connection.valid?\n self.no_sql_connection = no_sql_connection\n raise NoSqlConnectionInvalid, \"noSql Connection is not valid\" unless self.no_sql_connection.valid?\n\n no_sql_connection.ask_to_drop_database if no_sql_connection.forced?\n\n end", "def restore_from_dump!\n @agent_context = ScoutApm::Agent.instance.context\n @recorder = @agent_context.recorder\n @store = @agent_context.store\n end", "def unstarted_db\n @db ||= Neo4j::Core::Database.new\n raise \"database was already started\" if @db.running?\n @db\n end", "def reinitialize_db\n drop_db\n initialize_db\n end", "def set_bulkcopy (query, dbname, status )\n begin\n unless( query.sql_norow(\"use master\") ) then\n return false\n end\n query.sql(\"exec sp_dboption #{dbname},'select into/bulkcopy',#{status}\")\n return false unless (query.cmd_done? )\n return false if( query.top_status_result != 0 )\n\n unless( query.sql_norow(\"use #{dbname}\") ) then\n return false \n end\n unless( query.sql_norow(\"checkpoint\") ) then\n return false\n end\n rescue\n return false\n else\n return true\n end\nend", "def connection\n @pg\n end", "def prep_command\n \"mysqldump #{dump_options} -u #{db_user} --password=#{db_password} #{database} > #{remote_backup_path}\"\n end", "def mysqldump(namespace, database_name = nil)\n puts 'Starting migration...'\n open_database_connection do\n database_uri = build_database_uri(namespace)\n database_name ||= database_uri.path.split('/')[1]\n output_file = \"#{database_name}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.sql\"\n compress_cmd = compress_command(output_file)\n puts '-> Running the mysqldump'\n puts `mysqldump -h #{database_uri.host} -P #{database_uri.port} -u #{database_uri.user} --password=#{database_uri.password} #{database_name} | #{compress_cmd}`\n end\n end", "def pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n 'database' => uri.path[1..-1],\n 'username' => uri.user,\n 'password' => uri.password,\n 'use_ssl' => true,\n 'validate_ssl_cert' => false\n }\n }\n open_jackdb(config)\n end", "def checkpoints\n db_pattern = \"#{sql_connection.escape(@db_backup)}\".gsub(\"_\", \"\\\\_\").gsub(\"%\", \"\\\\%\")\n # TODO: this should be quoted properly.\n result = sql_connection.execute(\"SHOW DATABASES LIKE '#{db_pattern}\\\\_%'\")\n prefix_length = @db_backup.length+1\n sql_connection.normalize_result(result).map {|db| db[prefix_length..-1] }\n end", "def reload_db_schema?\n false\n end", "def reload_db_schema?\n false\n end", "def unstarted_db\n @db ||= Database.new\n raise \"database was already started\" if @db.running?\n @db\n end", "def xRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def restore_state\n\t$log.info(\"Restoring state from database...\")\n\t$redis.list_multis.each do |id_multi, config|\n\t\trestore_multi_state id_multi\n\tend\n\t$log.info(\"Restoration complete.\")\nend", "def seed_from_dump id\n target_path = File.expand_path(\"../../fixtures/trunk-#{id}.dump\", __FILE__)\n raise \"Dump #{id} could not be found.\" unless File.exists? target_path\n \n puts \"Restoring #{ENV['RACK_ENV']} database from #{target_path}\"\n \n # Ensure we're starting from a clean DB.\n system \"dropdb trunk_cocoapods_org_test\"\n system \"createdb trunk_cocoapods_org_test\"\n \n # Restore the DB.\n command = \"pg_restore --no-privileges --clean --no-acl --no-owner -h localhost -d trunk_cocoapods_org_test #{target_path}\"\n puts \"Executing:\"\n puts command\n puts\n result = system command\n if result\n puts \"Database #{ENV['RACK_ENV']} restored from #{target_path}\"\n else\n warn \"Database #{ENV['RACK_ENV']} restored from #{target_path} with some errors.\"\n # exit 1\n end\n end", "def uncache\n DB.disconnect\n system('echo $EXEC | sudo -u postgres /usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data')\n sleep 1\n system('echo $EXEC | sudo sh -c \"sync; echo 3 > /proc/sys/vm/drop_caches\"')\n sleep 1\n system('echo $EXEC | sudo -u postgres /usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -o \"--config-file=/home/bcassell/DDGT/db_configs/maxing_out.conf\"')\n sleep 1\n end", "def database_reset\n @database = nil\n end", "def db_connection\n begin\n connection = PG.connect(dbname: \"movies\")\n yield(connection)\n ensure\n connection.close\n end\nend", "def disconnected?; connection_state == :disconnected end", "def conn\n unless @conn\n # open the database config file\n db_config = YAML.load(ERB.new(File.read(\"config/ourstage_database.yml\")).result )\n database = db_config[environment]['database']\n @conn = EventMachine::Postgres.new(:database => database)\n @conn.setnonblocking(true) # may not be needed? \n end\n @conn\n end", "def silence_ddl_notices(database)\n if session.configuration.send(database)[:adapter] =~ /postgres/\n old_message_level = session.send(database).\n select_one(\"show client_min_messages\")['client_min_messages']\n session.send(database).execute \"set client_min_messages = warning\"\n end\n yield\n ensure\n if session.configuration.send(database)[:adapter] =~ /postgres/\n session.send(database).execute \"set client_min_messages = #{old_message_level}\"\n end\n end", "def connection_mirror_state\n super\n end", "def connection_mirror_state\n super\n end", "def backup\n run_command 'pgbackups:capture', %W(--expire #{database})\n end", "def psql_on_app_db(*args)\n psql_on_db(fetch(:pg_database), *args)\n end", "def import_remote_database env = \"development\"\n settings = database_settings\n if database_settings.empty?\n shell.say \"ERROR: Unable to load database setings for current app. Are you within the root folder of a Rails project?\"\n else\n answer = shell.yes? \"You are about to perminently override all data in the local \\\"#{env}\\\" database. Do you wish to continue (y/n)?\"\n if answer\n begin\n heroku = Heroku::Client.new @heroku_credentials.login, @heroku_credentials.password\n pg = PGBackups::Client.new heroku.config_vars(application)[\"PGBACKUPS_URL\"]\n database = \"latest.dump\"\n shell_with_echo \"curl -o #{database} '#{pg.get_latest_backup[\"public_url\"]}'\"\n shell_with_echo \"pg_restore --verbose --clean --no-acl --no-owner -h #{settings[env]['host']} -U #{settings[env]['username']} -d #{settings[env]['database']} #{database}\"\n shell_with_echo \"rm -f #{database}\"\n rescue URI::InvalidURIError\n shell.say \"ERROR: Invalid database URI. Does the backup exist?\"\n end\n else\n shell.say \"Import aborted.\"\n end\n end\n end", "def wRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def restore_mode; end", "def restore_mode; end", "def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end", "def steal! # :nodoc:\n if in_use?\n if @owner != ActiveSupport::IsolatedExecutionState.context\n pool.send :remove_connection_from_thread_cache, self, @owner\n\n @owner = ActiveSupport::IsolatedExecutionState.context\n end\n else\n raise ActiveRecordError, \"Cannot steal connection, it is not currently leased.\"\n end\n end", "def restore_files_to(to_db, jobs)\n [\n restore_pg_dump_file(to_db, %w(pre-data data), jobs),\n *restore_table_copy_files(to_db),\n restore_pg_dump_file(to_db, %w(post-data), jobs)\n ]\n end" ]
[ "0.66191566", "0.6167767", "0.60580295", "0.60518366", "0.58649886", "0.5774392", "0.57292444", "0.56798965", "0.5666848", "0.55465037", "0.55465037", "0.5533619", "0.55072737", "0.54791415", "0.54324603", "0.542333", "0.53889334", "0.53619266", "0.53598046", "0.5339613", "0.53144425", "0.5259415", "0.5259158", "0.52576905", "0.52467364", "0.5240866", "0.523466", "0.52024114", "0.5200117", "0.5198868", "0.5193711", "0.51902544", "0.5177022", "0.51730335", "0.516987", "0.516194", "0.5141223", "0.5140558", "0.5126927", "0.5109773", "0.5105734", "0.50789046", "0.5070853", "0.5067774", "0.50635713", "0.50587326", "0.5053958", "0.504317", "0.5005783", "0.49867794", "0.4982315", "0.49821085", "0.49787235", "0.49746582", "0.49653596", "0.4961219", "0.4952913", "0.49490717", "0.4923062", "0.4923062", "0.4923062", "0.4923062", "0.4923062", "0.4923062", "0.4923062", "0.49138", "0.490764", "0.49038622", "0.490257", "0.49000874", "0.4894754", "0.48858663", "0.48781896", "0.48751357", "0.4869659", "0.48652577", "0.48544052", "0.48508698", "0.48508698", "0.48414147", "0.4839364", "0.48381665", "0.48370343", "0.48313037", "0.482499", "0.4823383", "0.4814936", "0.48091713", "0.48084185", "0.4806467", "0.4806467", "0.48040608", "0.4800455", "0.47979462", "0.47958794", "0.47955072", "0.47955072", "0.47930333", "0.47873926", "0.4787175" ]
0.7014995
0
GET /service_users GET /service_users.json
def index @service_users = ServiceUser.all render json: @service_users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users\n self.class.get('/users')\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def index\n @users = UserService.all_users\n end", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def users\n get('get_users')\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def show\n render json: @service_user\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def index\n users = User.all\n json_response(users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def list_users(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/user/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def index\n @users = UserService.getAllUserList\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def list\n get('users')['users']\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def get_users(options)\n @client.raw('get', '/config/users', options)\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def get_users(request); end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def index\n json_response(User.all) \n end", "def index\n @services = Service.find_all_by_user_id(current_user.account_id)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @services }\n end\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def users\n puts \"SEARCH USERS\"\n @users = User.search(params[:q])\n puts \"SEARCH USERS COUNT:#{@users.count}\"\n render :json => @users.as_json(:current_user => current_user)\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n r = @api.get_users\n response = JSON.parse(r.body)\n if r.code == 200\n @users = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n end", "def fetch_users\n\n result = CacheManagement::ClientApiCredentials.new([@client_id]).fetch[@client_id]\n return validation_error(\n 'cum_lu_6',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if result.blank?\n\n if is_xhr_request?\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: false\n )\n\n @ost_sdk_obj = ost_sdk.services.users\n\n list_params = {}\n list_params[:page_no] = @page_no unless @page_no.nil?\n list_params[:order_by] = @order_by unless @page_no.nil?\n list_params[:order] = @order unless @page_no.nil?\n list_params[:airdropped] = @airdropped unless @airdropped.nil?\n\n service_response = @ost_sdk_obj.list(list_params)\n\n return service_response unless service_response.success?\n\n @api_response_data = service_response.data\n\n else\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: true\n )\n\n @ost_spec_sdk_obj = ost_sdk.services.users\n api_spec_service_response = @ost_spec_sdk_obj.create({name: \"{{uri_encoded name}}\"})\n\n return api_spec_service_response unless api_spec_service_response.success?\n\n api_spec_service_response.data[:request_uri].gsub!(GlobalConstant::SaasApi.base_url, GlobalConstant::SaasApi.display_only_base_url)\n\n @api_response_data[:api_console_data] = {\n user: {\n create: api_spec_service_response.data\n }\n }\n\n end\n\n success\n\n end", "def index\n @services = Service.all\n @users= User.all\n end", "def list\n render json: User.all\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n users = User.all\n render json: users \n end", "def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n \t@users = UsersService.UserListAll(params[:page])\n end", "def index\n @params = params\n @list = get_list_via_solr('user')\n @api_response = {\n users: @list,\n meta: { pagination: pagination_params }\n }\n render json: @api_response\n end", "def index\n users = User.all \n render json: users \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n \n @users = User.page(params[:page]).per_page(14)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n \n end", "def index\n @users = User.users_only.active # only active users\n @users = @users.search( params[:q] ) unless params[:q].blank? # search for term\n @users = @users.page( params[:page] ).per( params[:per_page] ) # paginate\n\n render json: UsersListSerializer.new(@users), status: :ok\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def get_users_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_users_by_search ...\"\n end\n \n # resource path\n path = \"/Users/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'first_name'] = opts[:'first_name'] if opts[:'first_name']\n query_params[:'last_name'] = opts[:'last_name'] if opts[:'last_name']\n query_params[:'email'] = opts[:'email'] if opts[:'email']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APIUser>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @services = Service.where(:user_id => @user[:id]).all\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def index\n @users = User.all\n render json: {\n messages: \"Request Successfull!\",\n is_success: true,\n data: { users: @users }\n }\n end", "def index\n users = User.order('created_at DESC')\n render json: {status: 200, msg: 'All users list', data: users }\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def user_list\n\t\tres = {}\n\t\tusers = User.where(\"lower(name) ~ ?\",params[:pattern].downcase)\n\t\tif users\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:users] = users.pluck(:name, :email, :image)\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def get\n\t\t\t\tparams.required(:id)\t\n\n\t\t\t\t# Grab the service that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n\t\t\t\t@user = service.users.find params[:id]\n\t\t\tend", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def index \n #Show all users \n @users = User.all\n render json: @users.as_json(only: [:id, :first_name, :last_name, :email, :business_name, :business_verticals, :business_neighborhood, :created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at])\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def list_users()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/users\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end" ]
[ "0.74256253", "0.73730755", "0.72365767", "0.7230674", "0.72009695", "0.7072412", "0.7037225", "0.70040864", "0.694816", "0.693819", "0.69315773", "0.6894944", "0.6894944", "0.68812585", "0.686779", "0.68436503", "0.6835722", "0.6804655", "0.67931384", "0.67915654", "0.6759689", "0.67466074", "0.67463875", "0.67435116", "0.67397934", "0.67323065", "0.670726", "0.6697234", "0.6694599", "0.6687718", "0.6687619", "0.66806805", "0.6661771", "0.66617054", "0.6647957", "0.66460717", "0.6645943", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6639241", "0.6636682", "0.6636682", "0.6636682", "0.6636682", "0.6636682", "0.6636682", "0.6631224", "0.6631224", "0.6631224", "0.6631224", "0.6629829", "0.6616598", "0.66163087", "0.6607422", "0.6605516", "0.65973896", "0.65909964", "0.65872425", "0.6585013", "0.6583351", "0.65808153", "0.6580259", "0.6570098", "0.65670985", "0.65641", "0.6556408", "0.6552171", "0.6544935", "0.65372384", "0.6533346", "0.6532797", "0.6520542", "0.6514558", "0.6511734", "0.6510624", "0.650221", "0.64986235", "0.6492619", "0.64921993", "0.6491058", "0.64664143", "0.64609385", "0.6455269", "0.64549756", "0.645301", "0.6450383", "0.64442474", "0.6435156", "0.6426118", "0.64231807", "0.6420727", "0.6403486", "0.6398106" ]
0.78232
0
GET /service_users/1 GET /service_users/1.json
def show render json: @service_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @service_users = ServiceUser.all\n render json: @service_users\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def list_users\n self.class.get('/users')\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n @users = UserService.all_users\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def get\n\t\t\t\tparams.required(:id)\t\n\n\t\t\t\t# Grab the service that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n\t\t\t\t@user = service.users.find params[:id]\n\t\t\tend", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def get \n render :json => User.find(params[:id])\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def users\n get('get_users')\n end", "def user\n render :json=> User.find(params[:id])\n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\n users = User.all\n json_response(users)\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def index\n json_response(User.all) \n end", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def fetch_users\n\n result = CacheManagement::ClientApiCredentials.new([@client_id]).fetch[@client_id]\n return validation_error(\n 'cum_lu_6',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if result.blank?\n\n if is_xhr_request?\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: false\n )\n\n @ost_sdk_obj = ost_sdk.services.users\n\n list_params = {}\n list_params[:page_no] = @page_no unless @page_no.nil?\n list_params[:order_by] = @order_by unless @page_no.nil?\n list_params[:order] = @order unless @page_no.nil?\n list_params[:airdropped] = @airdropped unless @airdropped.nil?\n\n service_response = @ost_sdk_obj.list(list_params)\n\n return service_response unless service_response.success?\n\n @api_response_data = service_response.data\n\n else\n\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: true\n )\n\n @ost_spec_sdk_obj = ost_sdk.services.users\n api_spec_service_response = @ost_spec_sdk_obj.create({name: \"{{uri_encoded name}}\"})\n\n return api_spec_service_response unless api_spec_service_response.success?\n\n api_spec_service_response.data[:request_uri].gsub!(GlobalConstant::SaasApi.base_url, GlobalConstant::SaasApi.display_only_base_url)\n\n @api_response_data[:api_console_data] = {\n user: {\n create: api_spec_service_response.data\n }\n }\n\n end\n\n success\n\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @services = Service.find_all_by_user_id(current_user.account_id)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @services }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def show\n @user = UserService.getUserById(params[:id])\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end", "def userReponses\n user=User.find(params[:userId])\n render :json=> user.response\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def index\n @users = UserService.getAllUserList\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @services = Service.where(:user_id => @user[:id]).all\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def for_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").get\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def get_users(request); end", "def index\n users = User.all\n render json: users \n end", "def list_users(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/user/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n users = User.all \n render json: users \n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def index\n @services = Service.all\n @users= User.all\n end", "def index\n \n @users = User.page(params[:page]).per_page(14)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n \n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def mf_api_get_user_info\n\n # Get the user from the DB\n user = User.find(params[:user_id])\n\n # If no user, return error response\n unless user\n response = {\n success: false,\n message: 'User not found'\n }\n\n render json: response and return\n end\n\n # Create User Info Response\n response = {\n success: true,\n message: 'User Info successfully retrieved',\n user_id: user.id,\n user_infusionsoft_id: user.clientid,\n user_first_name: user.first_name,\n user_last_name: user.last_name,\n user_email: user.email,\n }\n\n # Return success response\n render json: response\n\n end", "def profile\n \t@user = UsersService.findUserById(params[:id])\n end", "def user\n user_name = User.where(:id => params[:id]).first.try(:name)\n \n user_data = {\n id: params[:id],\n name: user_name\n }\n \n respond_to do |format|\n format.html { redirect_to root_path } # search.html.erb\n format.json { render json: user_data }\n end\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def index\n @params = params\n @list = get_list_via_solr('user')\n @api_response = {\n users: @list,\n meta: { pagination: pagination_params }\n }\n render json: @api_response\n end", "def index\n r = @api.get_users\n response = JSON.parse(r.body)\n if r.code == 200\n @users = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n end", "def list\n render json: User.all\n end", "def index\n \t@users = UsersService.UserListAll(params[:page])\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def get_users_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_users_by_search ...\"\n end\n \n # resource path\n path = \"/Users/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'first_name'] = opts[:'first_name'] if opts[:'first_name']\n query_params[:'last_name'] = opts[:'last_name'] if opts[:'last_name']\n query_params[:'email'] = opts[:'email'] if opts[:'email']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APIUser>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.74731046", "0.7389385", "0.71487534", "0.69709796", "0.69657165", "0.6872706", "0.68179536", "0.6813221", "0.679102", "0.6790224", "0.6753235", "0.6676664", "0.6655953", "0.6611763", "0.6596083", "0.6590129", "0.65832865", "0.6582873", "0.6572825", "0.6553574", "0.6553574", "0.6542845", "0.6532458", "0.6514376", "0.6496089", "0.6489612", "0.6481419", "0.6478173", "0.64775395", "0.6474064", "0.6472448", "0.6464482", "0.64599043", "0.643804", "0.6437351", "0.6435116", "0.64308965", "0.64295036", "0.6426052", "0.64236945", "0.6417838", "0.64176345", "0.64154804", "0.64127964", "0.6407138", "0.640404", "0.63904047", "0.6386118", "0.6366543", "0.6366543", "0.6366543", "0.6366543", "0.63602364", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.63560617", "0.6353319", "0.6353319", "0.6353319", "0.6353319", "0.6353319", "0.6353319", "0.6349547", "0.6340808", "0.6340428", "0.633813", "0.63378346", "0.6337766", "0.63363874", "0.6335791", "0.6331524", "0.63291454", "0.63245815", "0.63228387", "0.63164544", "0.6316048", "0.6297564", "0.62894547", "0.62876475", "0.6286342", "0.6282608", "0.6281127", "0.62797296", "0.6278683", "0.62745404", "0.62696856", "0.62612367", "0.6260345", "0.62562835", "0.6256174", "0.62548894", "0.62437874", "0.6241971" ]
0.693555
5