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
Paste data from clipboard into text_area and update documents in destination database. This action is called twice. First time for displaying text_area field and second time ajax call for processing data.
def paste_clipboard # Only administrators can perform this operation return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin') result = '' respond_to do |format| # just open new window to same url and come back with html request format.html { return render('paste_clipboard', layout: 'cms') } format.json { table, id, ids = nil params[:data].split("\n").each do |line| line.chomp! next if line.size < 5 # empty line. Skip begin if line[0] == '[' # id(s) result << "<br>#{line}" line = line[/\[(.*?)\]/, 1] # just what is between [] table, id, ids = line.split(',') elsif line[0] == '{' # document data result << process_document(line, table, id, ids) end rescue Exception => e result << " Runtime error. #{e.message}\n" break end end } end dc_render_ajax(div: 'result', value: result ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paste_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n result = ''\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.html { return render('paste_clipboard', layout: 'cms') }\r\n format.json {\r\n table, id, ids = nil\r\n params[:data].split(\"\\n\").each do |line|\r\n line.chomp!\r\n next if line.size < 5 # empty line. Skip\r\n\r\n begin\r\n if line[0] == '[' # id(s)\r\n result << \"<br>#{line}\"\r\n line = line[/\\[(.*?)\\]/, 1] # just what is between []\r\n table, id, ids = line.split(',')\r\n elsif line[0] == '{' # document data\r\n result << process_document(line, table, id, ids)\r\n end\r\n rescue Exception => e \r\n result << \" Runtime error. #{e.message}\\n\"\r\n break\r\n end\r\n end\r\n }\r\n end\r\n dc_render_ajax(div: 'result', value: result )\r\nend", "def paste; clipboard_paste; end", "def copy_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n table = CmsHelper.table_param(params)\r\n doc = dc_find_document(table, params[:id], params[:ids])\r\n text = '<style>body {font-family: monospace;}</style><pre>'\r\n text << \"JSON:<br>[#{table},#{params[:id]},#{params[:ids]}]<br>#{doc.as_document.to_json}<br><br>\"\r\n text << \"YAML:<br>#{doc.as_document.to_hash.to_yaml.gsub(\"\\n\", '<br>')}</pre>\"\r\n render plain: text\r\n end\r\n end \r\nend", "def do_clipboard_paste\n dat = if Wx::PLATFORM == \"WXMAC\" \n # XXX i feel dirty\n `pbpaste`\n else\n dobj=RawDataObject.new\n Wx::Clipboard.open {|clip| clip.fetch dobj}\n dobj.raw_data\n end\n\n self.gui_set_value(self.cur_pos, dat) if dat and dat.size > 0\n end", "def copy_clipboard\r\n# Only administrators can perform this operation \r\n return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')\r\n# \r\n respond_to do |format|\r\n# just open new window to same url and come back with html request \r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n doc = dc_find_document(params[:table], params[:id], params[:ids])\r\n text = \"<br><br>[#{params[:table]},#{params[:id]},#{params[:ids]}]<br>\"\r\n render text: text + doc.as_document.to_json\r\n end\r\n \r\n end \r\nend", "def paste\n # no authorization applied as the method must always render\n if @activity.changeable?(current_visitor)\n @original = clipboard_object(params)\n if (@original)\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at], :include => :pages\n if (@component)\n # @component.original = @original\n @container = params[:container] || 'activity_sections_list'\n @component.name = \"copy of #{@component.name}\"\n @component.deep_set_user current_visitor\n @component.activity = @activity\n @component.save\n end\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'section_list_item', :locals => {:section => @component})\n page.sortable :activity_sections_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_sections', :params => {:activity_id => @activity.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def notifyClipboardContentChanged\n updateCommand(Wx::ID_PASTE) do |ioCommand|\n if (@Clipboard_CopyMode == nil)\n # The clipboard has nothing interesting for us\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n # Cancel eventual Copy/Cut pending commands\n notifyCancelCopy\n # Notify everybody\n notifyRegisteredGUIs(:onClipboardContentChanged)\n elsif (@Clipboard_CopyMode == Wx::ID_DELETE)\n # Check that this message is adressed to us for real (if many instances of PBS are running, it is possible that some other instance was cutting things)\n if (@CopiedID == @Clipboard_CopyID)\n # Here we have to take some action:\n # Delete the objects marked as being 'Cut', as we got the acknowledge of pasting it somewhere.\n if (@CopiedMode == Wx::ID_CUT)\n if (!@Clipboard_AlreadyProcessingDelete)\n # Ensure that the loop will not come here again for this item.\n @Clipboard_AlreadyProcessingDelete = true\n executeCommand(Wx::ID_DELETE, {\n :parentWindow => nil,\n :selection => @CopiedSelection,\n :deleteTaggedShortcuts => false,\n :deleteOrphanShortcuts => false\n })\n # Then empty the clipboard.\n Wx::Clipboard.open do |ioClipboard|\n ioClipboard.clear\n end\n # Cancel the Cut pending commands.\n notifyCutPerformed\n notifyRegisteredGUIs(:onClipboardContentChanged)\n @Clipboard_AlreadyProcessingDelete = false\n end\n else\n log_bug 'We have been notified of a clipboard Cut acknowledgement, but no item was marked as to be Cut.'\n end\n end\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n else\n lCopyName = nil\n case @Clipboard_CopyMode\n when Wx::ID_CUT\n lCopyName = 'Move'\n when Wx::ID_COPY\n lCopyName = 'Copy'\n else\n log_bug \"Unsupported copy mode from the clipboard: #{@Clipboard_CopyMode}.\"\n end\n if (@Clipboard_CopyID != @CopiedID)\n # Here, we have another application of PBS that has put data in the clipboard. It is not us anymore.\n notifyCancelCopy\n end\n if (lCopyName != nil)\n # Activate the Paste command with a cool title\n ioCommand[:Enabled] = true\n ioCommand[:Title] = \"Paste #{@Clipboard_SerializedSelection.getDescription} (#{lCopyName})\"\n else\n # Deactivate the Paste command, and explain why\n ioCommand[:Enabled] = false\n ioCommand[:Title] = \"Paste (invalid type #{@Clipboard_CopyMode}) - Bug ?\"\n end\n notifyRegisteredGUIs(:onClipboardContentChanged)\n end\n end\n end", "def paste\n # no authorization applied as the method must always render\n if @section.changeable?(current_visitor)\n @original = clipboard_object(params)\n if @original\n @container = params[:container] || 'section_pages_list'\n if @original.class == Page\n @component = @original.duplicate\n else\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @component.name = \"copy of #{@original.name}\"\n end\n if (@component)\n # @component.original = @original\n @component.section = @section\n @component.save\n end\n @component.deep_set_user current_visitor\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'page_list_item', :locals => {:page => @component})\n page.sortable :section_pages_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_pages', :params => {:section_id => @section.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def paste\n\t\t\t$ruvim.insert $ruvim.buffers[:copy].data\n\t\t\t$ruvim.editor.redraw\n\t\tend", "def pbpaste\n Clipboard.paste\nend", "def do_copy\n @editor.value = @current_copycode\n @editor.focus\n end", "def paste(text)\n can_refresh = false\n # Attempt to insert every character individually\n text.split(\"\").each do |ch|\n break unless @helper.insert(ch)\n can_refresh = true\n end\n # Only refresh if characters were inserted\n self.refresh if can_refresh\n end", "def update\n @document = Document.where(\"user_id = ? and id = ?\",current_user.id,params[:id]).first\n assignment = @document.assignment\n respond_to do |format|\n if assignment.editable?(current_user)\n @document.content = params[:document][:content]\n if @document.save\n @autopreview = @document\n unless params[:autopreview]\n format.js { render \"shared/save_success\" }\n else\n format.js { render \"shared/autopreview\" }\n end\n else\n format.js { render \"shared/save_failed\" }\n end\n else\n format.js { render \"shared/pastdue\" }\n end\n end\n end", "def copy_to_clipboard\n end", "def update\n @paste = Paste.find(params[:id])\n\n respond_to do |format|\n if @paste.update_attributes(params[:paste])\n flash[:notice] = 'Paste was successfully updated.'\n format.html { redirect_to(@paste) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @paste.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n syntax, text, private = request[:syntax, :text, :private]\n private = !!private # force to boolean for sequel\n\n if request.post? and text and $rapaste_syntaxes[syntax]\n paste = Paste.create(:text => text, :syntax => syntax,\n :private => private, :ip => request.ip)\n\n redirect paste.link(:href)\n end\n\n redirect_referrer\n end", "def copyFromClipboard \n \"copyFromClipboard\" \n end", "def show\n @clipboard = find_clipboard\n end", "def update\n @paste = Paste.find_by_id(params[:id])\n @parsers = Parser.all(:order => 'display_name')\n\n respond_to do |format|\n if @paste\n if params[:paste].keys.include?('code') && params[:paste]['code'] == ''\n format.html {\n render :action => \"edit\"\n }\n else\n if @paste.update_attributes(params[:paste])\n format.html { redirect_to(@paste) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n else\n format.html { response_to_missing_id }\n end\n end\n end", "def push_text_in_clipboard(text)\n OpenClipboard.call(0)\n EmptyClipboard.call()\n hmem = GlobalAlloc.call(0x42, text.length)\n mem = GlobalLock.call(hmem)\n Memcpy.call(mem, text, text.length)\n SetClipboardData.call(1, hmem) # Format CF_TEXT = 1\n GlobalFree.call(hmem)\n CloseClipboard.call()\n self\n end", "def save_charttext\n @charttext = Charttext.find(params[:charttext_id])\n assignment = Assignment.find(@task.assignment_id)\n respond_to do |format|\n if assignment.editable?(current_user)\n if @charttext.update_attributes(params[:charttext])\n @autopreview = @charttext\n unless params[:autopreview]\n format.js { render \"shared/save_success\" }\n else\n format.js { render \"shared/autopreview\" }\n end\n else\n format.js {render \"shared/save_failed\"}\n end\n else\n format.js {render \"shared/pastdue\"}\n end\n end\n end", "def paste(str)\n send_command_to_control(\"EditPaste\", str)\n end", "def do_clipboard_cut\n if do_clipboard_copy()\n pos = @selection.first\n self.gui_set_value(nil, '')\n self.cur_pos = pos\n end\n end", "def paste(at: caret)\n editable? and @native.paste_text(at.to_i)\n end", "def govuk_rich_text_area(attribute_name, data: {}, **kwargs, &block)\n data = data.reverse_merge(\n direct_upload_url: @template.katalyst_content.direct_uploads_url,\n controller: \"content--editor--trix\",\n action: \"trix-initialize->content--editor--trix#trixInitialize\",\n )\n super(attribute_name, data:, **kwargs, &block)\n end", "def copy\n expression_to_clone = Expression.find(params[:id])\n\t\t\t \n\t@expression = expression_to_clone.clone\n\t\n\t@expression.expression_title = \"Copy of '#{expression_to_clone.expression_title}'\"\n \n if @expression.expression_title.length > 100\n flash[:error] = \"The new title '#{@expression.expression_title}' is too long.\"\n redirect_to :action => 'edit', :id => expression_to_clone.id\n return\n end\n\t\n\t@expression.status = Status::PENDING # default to 'pending'\n\t\n\t# delete created_at assigned from expression_to_clone created_at value\n\t# as we need created_at be actual time of creating the copy\n\t@expression.created_at = nil\t\n\t\t\n\t# updated by\n\t@expression.updated_by = get_user.login_id\n\t\n\t# languages\n\texpression_to_clone.languages.each do |l|\n\t @expression.languages << Language.find(l.language_id)\n\tend\n\t\t\n\tif @expression.save_with_frbr\n\t \n\t # copying relationships\n\t success = true\n\t \n\t # FIXME do we need to clone access rights???\n\t # it seems that currently there is no UI for entering them???\n\t #expression_to_clone.expression_access_rights.each do |ar|\n\t # expression_access_right = ExpressionAccessRight.new\n\t # expression_access_right = ar.clone\n\t # expression_access_right.expression_id = @expression.id\n\t # \n\t # success = false if !expression_access_right.save\n\t #end\n\t \t \n\t # manifestations - it is requested to do not copy relationships with manifestations\n\t #expression_to_clone.manifestations.each do |m|\n\t #\tsuccess = false if !m.add_expression(@expression)\n\t #end\n\t \n\t # other relationships\n\t expression_to_clone.expression_relationships.each do |ex_relationship|\n\t \tsuccess = false if !RelationshipHelper.copy_frbr_relationships(@expression, ex_relationship, @login)\n\t end\n\t \n\t notice = 'Expression clone was successfully created.'\n\t notice += ' But some of the relationships failed to be copied.' if !success\n\t \n\t flash[:notice] = notice\n\t \n\t redirect_to :action => 'edit', :id => @expression\n\telse\n\t flash[:error] = 'Expression cloning has failed.'\n\t redirect_to :action => 'edit', :id => expression_to_clone.id\n\tend\t\t\t\n end", "def text_area; end", "def set_pasteurizacion\n @pasteurizacion = Pasteurizacion.find(params[:id])\n end", "def create\n @paste = Paste.new(params[:paste])\n\n respond_to do |format|\n if @paste.save\n flash[:notice] = 'Paste was successfully created.'\n format.html { redirect_to(@paste) }\n format.xml { render :xml => @paste, :status => :created, :location => @paste }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @paste.errors, :status => :unprocessable_entity }\n end\n end\n end", "def copy\n out = ''\n\n Selection.each do |dd|\n docu = dd.cite_key.get\n docu.strip!\n out << \"[@#{docu}] \"\n end\n\n pbcopy(out.strip)\n growl(\"#{Selection.size} citation references copied to the clipboard\")\nend", "def update\n @copy_text = CopyText.find(params[:id])\n @page_section = @copy_text.page_section\n \n @page = @page_section.page\n @site_section = @page.site_section\n\n respond_to do |format|\n if @copy_text.update_attributes(params[:copy_text]) and @page_section.update_attributes(params[:page_section])\n flash[:notice] = 'CopyText was successfully updated.'\n format.html { redirect_to site_section_page_url(@site_section, @page) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @copy_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dialog_copy_editor\n assert_privileges(\"dialog_copy_editor\")\n record_to_copy = find_record_with_rbac(Dialog, checked_or_params)\n @record = Dialog.new\n javascript_redirect(:controller => 'miq_ae_customization',\n :action => 'editor',\n :copy => record_to_copy.id,\n :id => @record.id)\n end", "def input_textarea (textareaid,testdata)\n\t\t@textarea = @browser.textarea :id => textareaid\n\t\t@textarea.set testdata\n\tend", "def pbpaste\n a = IO.popen(\"osascript -e 'the clipboard as unicode text' | tr '\\r' '\\n'\", 'r+').read\n a.strip.force_encoding(\"UTF-8\")\nend", "def ajax_book_update\r\n @book = Book.find(params[:id])\r\n @book.isbn = params[:isbn]\r\n @book.title = params[:title]\r\n @book.save\r\n end", "def textcopy(input)\n\tosascript <<-END\n\t\ttell application \"Copied\"\n\t\t\tsave \"#{input}\"\n\t\tend tell\n\tEND\nend", "def pbcopy(text)\n # work around, ' wrecks havoc on command line, but also caused some weird regexp substitution\n rtf = text.index('{\\rtf1')\n File.open(\"/tmp/script.scpt\", 'w') do |f|\n if rtf\n f << text\n else\n f << \"set the clipboard to \\\"#{text}\\\"\"\n end\n end\n if rtf\n `cat /tmp/script.scpt | pbcopy -Prefer rtf`\n else\n `osascript /tmp/script.scpt`\n end\nend", "def create\n @paste = Paste.new(params[:paste])\n @parsers = Parser.all(:order => 'display_name')\n\n respond_to do |format|\n if @paste.code.blank?\n format.html {\n render :action => \"new\"\n }\n else\n if @paste.save\n format.html { redirect_to(@paste) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end\n end", "def do_clipboard_copy\n return nil unless sel=@selection and dat=@data[sel]\n # XXX i feel dirty\n if Wx::PLATFORM == \"WXMAC\"\n IO.popen(\"pbcopy\", \"w\") {|io| io.write dat}\n stat = $?.success?\n else\n dobj = RawDataObject.new(dat)\n stat = Wx::Clipboard.open {|clip| clip.place dobj}\n end\n return stat\n end", "def copyToClipboard _args\n \"copyToClipboard _args;\" \n end", "def to_clipboard\n #prettified = self.pretty_inspect.strip\n prettified = self.to_s\n stringified = self.to_s\n printable = (\n if prettified.length > 80 then\n prettified.slice(0, 80) + '...'\n else\n prettified\n end\n ).inspect\n $clipboard.write(stringified)\n $stderr.puts(\"to_clipboard: wrote #{printable} to clipboard\")\n return nil\n end", "def paste\n `pbpaste`\n end", "def update(context = self)\n # FIXME: log context\n @do_refresh = true\n @ctrl.commands << :render unless @paste_mode\n end", "def apps_block_copy_paste=(value)\n @apps_block_copy_paste = value\n end", "def do_clip(pagename, titletxt, onlytext = false)\n pagepath = (\"#{Wiki_path}/data/pages/#{clean_pagename(pagename)}.txt\").gsub(\":\",\"/\")\n\n curpage = cururl.split(\"/\").last\n sel = has_selection\n\n # format properly if citation\n unless onlytext\n if curpage.index(\"ref:\")\n curpage = \"[@#{curpage.split(':').last.downcase}]\"\n elsif cururl.index(\"localhost/wiki\")\n curpage = \"[[:#{capitalize_word(curpage.gsub(\"_\", \" \"))}]]\"\n else\n title = (titletxt ? titletxt : curtitle)\n curpage =\"[[#{cururl}|#{title}]]\"\n end\n else\n curpage = ''\n end\n\n insert = (sel ? \"#{sel} \" : \" * \" ) # any text, or just a link (bullet list)\n insert.gsubs!( {:all_with=> \"\\n\\n\"}, \"\\n\", \"\\n\\n\\n\" )\n\n if File.exists?(pagepath)\n prevcont = File.read(pagepath)\n\n haslinks = prevcont.match(/\\-\\-\\-(\\n \\*[^\\n]+?)+?\\Z/m) # a \"---\"\" followed by only lines starting with \" * \"\n\n # bullet lists need an extra blank line after them before the \"----\"\n if sel\n divider = (haslinks ? \"\\n\\n----\\n\" : \"\\n----\\n\")\n else\n divider = (haslinks ? \"\\n\" : \"\\n----\\n\")\n end\n\n growltext = \"Selected text added to #{pagename}\"\n else\n prevcont = \"h1. #{capitalize_word(pagename)}\\n\\n\"\n growltext = \"Selected text added to newly created #{pagename}\"\n end\n filetext = [prevcont, divider, insert, curpage].join\n dwpage(pagename, filetext)\n\n growl(\"Text added\", growltext)\nend", "def update\n respond_to do |format|\n if @blog.update(blog_params)\n @blog.short_body = @blog.body_area.to_plain_text.first(250)\n @blog.save!\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(id, params = {})\n self.class.post(\"/paste/#{id}\", :body => params.merge(@base_params)).parsed_response\n end", "def paste link\n clipboard = %w{\n /usr/bin/pbcopy\n /usr/bin/xclip\n }.find { |path| File.exist? path }\n\n if clipboard\n IO.popen clipboard, 'w' do |io| io.write link end\n end\n end", "def copy_text_content_from(brand)\n if !brand.nil?\n brand.text_contents.each do |text|\n tc = text.clone\n tc.brand_id = self.id\n tc.save\n end\n end\n end", "def save_edits\n DATABASE.execute(\"UPDATE boards SET title = '#{@title}', description = '#{@description}' WHERE id = #{@id}\")\n end", "def update\n\n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end\n end", "def in_place_editor(field_id, options = {})\n function = \"new Ajax.InPlaceEditor(\"\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n\n js_options = {}\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['cancelControl'] = options[:cancel_control].inspect if options.has_key?(:cancel_control)\n js_options['okControl'] = options[:save_control].inspect if options.has_key?(:save_control)\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['rows'] = options[:rows] if options[:rows]\n js_options['cols'] = options[:cols] if options[:cols]\n js_options['size'] = options[:size] if options[:size]\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['externalControlOnly'] = \"true\" if options[:external_control_only]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url] \n js_options['ajaxOptions'] = options[:options] if options[:options]\n js_options['evalScripts'] = options[:script] if options[:script]\n js_options['htmlResponse'] = options[:html_response] if options.key?(:html_response)\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n js_options['paramName'] = %('#{options[:param_name]}') if options[:param_name]\n js_options['method'] = %('#{options[:method]}') if options[:method]\n js_options['onEnterHover'] = %('#{options[:on_enter_hover]}') if options[:on_enter_hover]\n js_options['onLeaveHover'] = %('#{options[:on_leave_hover]}') if options[:on_leave_hover]\n js_options['onComplete'] = %('#{options[:on_complete]}') if options[:on_complete]\n js_options['onEnterEditMode'] = options[:on_enter_edit_mode] if options[:on_enter_edit_mode]\n js_options['onLeaveEditMode'] = options[:on_leave_edit_mode] if options[:on_leave_edit_mode]\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n \n function << ')'\n\n javascript_tag(function)\n end", "def do_merge_description(src, dest, delete_after)\n src_name = src.unique_partial_format_name\n src_title = src.format_name\n\n # Doesn't have permission to edit destination.\n if !dest.is_writer?(@user)\n flash_error(:runtime_edit_description_denied.t)\n @description = src\n\n # Conflict: render edit form.\n elsif !perform_merge(src, dest, delete_after)\n flash_warning(:runtime_description_merge_conflict.t)\n @description = dest\n @licenses = License.current_names_and_ids\n merge_description_notes(src, dest)\n @merge = true\n @old_desc_id = src.id\n @delete_after = delete_after\n render(:action => \"edit_#{src.parent.type_tag}_description\")\n\n # Merged successfully.\n else\n desc.parent.log(:log_object_merged_by_user, :user => @user.login,\n :touch => true, :from => src_name,\n :to => dest.unique_partial_format_name)\n flash_notice(:runtime_description_merge_success.\n t(:old => src_title, :new => dest.format_name))\n redirect_to(:action => dest.show_action, :id => dest.id,\n :params => query_params)\n end\n end", "def mercury_update\n campaign = Campaign.find(params[:id])\n document_name = request.referer.split('/').last\n document = {\n :body => params[:content][:page_content][:value],\n :path => 'documents/' + document_name,\n :format => 'html',\n :locale => 'en',\n :handler => 'erb',\n :partial => 'false',\n :campaign_id => campaign.id\n }\n edited_document = SqlTemplate.find_or_create_by(campaign_id: campaign_id)\n edited_document.update(document)\n render text: \"\"\n end", "def save\n if @id\n # run an UPDATE query if it is in the database\n DB[:conn].execute(\"UPDATE notes SET text='#{@text}', is_complete='#{@is_complete}' WHERE id=#{@id}\")\n else\n # INSERT if it's not in the database yet.\n DB[:conn].execute(\"INSERT INTO notes(text) VALUES('#{@text}')\")\n end\n end", "def update\n @blog = Blog.find(params[:id])\n @blog.remove_previous_lead_story(params[:blog][:leadstory])\n\n @blog.update_attributes(params[:blog])\n respond_to do |format|\n unless params[:autopreview]\n format.html {render :show }\n format.js {render \"shared/save_success\"}\n else\n format.html {render :show}\n format.js {render \"autopreview\"}\n end\n end\n end", "def assign_editor_to_uploaded_story\n @story = Story.find_by_id(params[:story_id]) if params[:story_id].present?\n @user = User.find_by_email(params[:editor_email].split(',').first)\n if @story.editor != @user\n if @story.update_attributes(:editor_id => @user.id)\n @story_details = Story.find_by_id(params[:story_id])\n respond_to do |format|\n format.html\n format.js \n end\n end\n end\n end", "def paste_from_clipboard(page_id, element, method, position)\n element_copy = copy(element, :page_id => page_id)\n element_copy.insert_at(position)\n if method == \"move\" && element_copy.valid?\n element.destroy\n end\n element_copy\n end", "def create\n\n\n @text = Text.new(params[:text])\n @text.resource_id = @resource.id\n @text.save\n\n @resource.attachment = @text\n @resource.save\n \n respond_to do |format|\n if @text.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.html { redirect_to edit_course_path(@course), notice: 'Text was successfully updated.' }\n format.js\n end\n end \n end", "def edit(comment)\n comment.gsub!(\"\\n\", \" \")\n self.p(:text=>comment).parent.parent.button(:text=>\"Edit\").click\n wait_for_ajax(2) #wait_until { self.textarea(:title=>\"Edit your comment\").present? }\n end", "def update!(**args)\n @postback = args[:postback] if args.key?(:postback)\n @text = args[:text] if args.key?(:text)\n end", "def update!(**args)\n @postback = args[:postback] if args.key?(:postback)\n @text = args[:text] if args.key?(:text)\n end", "def copy(sender)\n filteredData[tableView.selectedRow].symbol.sendToPasteboard\n end", "def cmd_clip reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding clipboard content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date, \n :add_line, \n :add_line, \n :inject_clipboard\n\n end", "def paste\n `pbpaste`\nend", "def review\n @importdatum = Importdatum.find(params[:id])\n\n importData = @importdatum.data\n\n importData = importData.gsub(\"\\'\", \"\")\n importData = importData.gsub(\"\\\"\", \"\")\n\n @importdatum.data = importData\n\n end", "def update\n respond_to do |format|\n if @copy.update(copy_params)\n format.html { redirect_to @copy, notice: \"Copy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @copy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @copy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_old_data(id1,id2,data)\n render :update do |page|\n page << \"jQuery('##{id1}').hide();jQuery('##{id2}').show();jQuery('##{id1} span input[name]').val('#{data}');\"\n page << \"jQuery('#name').html('<strong>#{data}</strong>')\" if params[:field] == 'name'\n page << \"jQuery('#comment_description').html('<h>#{data}</h>')\" if params[:field] == 'comment'\n page.call \"flash_writter\", \"Blank submission is not possible\" if !params[:name].present?\n end\nend", "def after_create\n self.syntax.increment!(:paste_count)\n end", "def paste(text, options)\n text = text.to_str\n raise ArgumentError, \"text is empty\" if text.empty?\n raise ArgumentError, \"missing required option\" unless options[:lang] &&\n options[:cvt_tabs]\n req = Net::HTTP::Post.new(Server::PATH)\n req.set_form_data options.merge(:text => text)\n req['referer'] = Server::REFERER\n res = Net::HTTP.start(Server::HOST) do |http|\n http.request req\n end\n \"http://\" + Server::HOST + res['location']\n end", "def show\n @copy_text = CopyText.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @copy_text }\n end\n end", "def create\n @copy_text = CopyText.new(params[:copy_text])\n @page_section = @copy_text.build_page_section(params[:page_section])\n \n @page = @page_section.page\n @site_section = @page.site_section\n\n respond_to do |format|\n if @copy_text.save\n flash[:notice] = 'CopyText was successfully created.'\n format.html { redirect_to site_section_page_url(@site_section, @page) }\n format.xml { render :xml => @copy_text, :status => :created, :location => @copy_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @copy_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataclip.update(dataclip_params)\n format.html { redirect_to show_path(:id=>@dataclip.link_token), notice: 'Dataclip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dataclip.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_action_text_fields\n generate('administrate:field rich_text_area')\n copy_file('app/fields/rich_text_area_field.rb', force: true)\n end", "def update\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n respond_to do |format|\n if @oa_sent_document.update(oa_sent_document_params)\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW','发文更新成功!') }\n format.json { render :show, status: :ok, location: @oa_sent_document }\n else\n format.html { render :edit }\n format.json { render json: @oa_sent_document.errors, status: :unprocessable_entity }\n end\n end\n #@oa_sent_document.process.wi_by_user(current_user.username)\n #respond_to do |format|\n # if params[:save]\n # if @oa_sent_document.update_attributes(params[:oa_sent_document])\n # format.html { redirect_to :back, :notice => I18n.t('m.save_success') }\n # else\n # format.html { render action: \"edit\" }\n # end\n # else\n # if update_result(@oa_sent_document, params[:oa_sent_document], wf_params)\n # format.html { redirect_to oa_sent_documents_url, notice: I18n.t('m.save_success') }\n # format.json { head :ok }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @oa_sent_document.errors, status: :unprocessable_entity }\n # end\n # end\n #\n #end\n end", "def textareas; end", "def copy_script\n\n end", "def copy\n ref_kanban = Kanban.find(params[:ref_id])\n ref_kanban_panes = KanbanPane.find_all_by_kanban_id(params[:ref_id])\n ref_workflow = KanbanWorkflow.find_all_by_kanban_id(params[:ref_id])\n\n new_kanban = ref_kanban.dup\n new_kanban.project_id = params[:project_id]\n new_kanban.update_attribute(:is_valid, true)\n new_kanban.save!\n ref_kanban_panes.each do |p|\n new_pane = p.dup\n new_pane.kanban_id = new_kanban.id\n new_pane.save!\n end\n\n ref_workflow.each do |w|\n new_w = w.dup\n new_w.kanban_id = new_kanban.id\n new_w.save!\n end\n redirect_to edit_project_kanban_path(new_kanban.project_id, new_kanban.id, :tab => \"Panes\")\n end", "def create\n @paste_from_clipboard = !params[:paste_from_clipboard].blank?\n @element = Alchemy::Element.new_from_scratch(params[:element])\n put_element_in_cell if @page.can_have_cells?\n @element.container = @page\n if @element.save\n render :action => :create\n else\n render_remote_errors(@element, 'form#new_element button.button')\n end\n end", "def filecopy(input)\n\tosascript <<-END\n\t\tdelay #{@moreimage}\n\t\tset the clipboard to POSIX file (\"#{input}\")\n\t\ttell application \"Copied\"\n\t\t\tsave clipboard\n\t\tend tell\n\tEND\nend", "def adopt_from_inbox\r\n @content = Content.active.find(params[:id])\r\n @inbox = Inbox.active.find(params[:inbox_id])\r\n @album = Album.active.find_by_id(params[:target_id])\r\n @album = nil unless @album && current_actor.is_self_or_owner?(@album.user)\r\n @album ||= current_actor.featured_album if @content.is_a?(ProjectAsContent)\r\n\r\n if @inbox.get_connector(@content).allow_take_to_showcase?\r\n @new_copy = @content.clone_content_from_inbox(@inbox)\r\n @new_copy.assign_to_album(@album) if @album\r\n flash[:success] = \"Copied '%s' to %s\" / [@content.title_long, @album ? @album.title_long : 'your Content'.t]\r\n redirect_to @inbox.user.collection? ? userpage_path(@inbox.user) : content_url(@new_copy)\r\n else\r\n flash[:warning] = \"Error attempting to copy '%s' to your Content\" / [@content.title_long]\r\n redirect_to content_url(@inbox)\r\n end\r\n rescue ActiveRecord::RecordInvalid => e\r\n flash[:warning] = \"Error attempting to copy '%s' to your Content: %s\" / [@content.title_long, e.message]\r\n redirect_to content_url(@inbox)\r\n end", "def check_clipboard\n value = @clipboard.read\n return unless value\n\n links = @parser.parse(value)\n return if links.empty?\n\n @filter.filter(links) do |link|\n $log.debug(\"adding #{link}\")\n entry = LinkTable::Entry.new(link)\n @link_table.add(entry)\n @resolver_manager.add(entry, link)\n end\n end", "def widget\n respond_to do |format|\n format.html { render :inline => <<-EOS\n <html>\n <body>\n <input type=\"textfield\" name=\"the_textfield\" acs_source=\"/acs/jqb/dogs\" id=\"the_textfield\"/>\n \n <input type=\"textfield\" name=\"the_textfield2\" acs_source=\"/acs/jqb/dogs\" id=\"the_textfield2\"/>\n \n <%= javascript_include_tag 'jquery-1.4.2' %>\n \n \n <% javascript_tag do %>\n // Top Level function to bind an Auto-Completer to an HTML element\n // Should eventually extract autocompleter client name from a acs_source like \"/acs/jqb_v2/dogs\"\n // to invoke JqbV2.attach(element)\n jQuery.fn.extend({\n bindAcs:function() {\n this.each(function() {\n var element = jQuery(this);\n Jqb.attach(element);\n })\n }\n });\n \n // A namespace to hold all references to all Autocompleter client bindings\n // on this page\n var Acs = {\n instances:[]\n }\n \n // jQuery Basic Autocompleter for ACS API\n //\n var Jqb = {\n loaded:false,\n \n // This is like the constructor--where all of the base-line behavior associated\n // with a Jqb client can added to the page\n attach:function(element) {\n // Move the \n element.data(\"acs_source\", element.attr('acs_source'));\n element.focus(function(){\n //Do nothing\n }),\n element.keyup(this.handleKeyUp)\n },\n \n handleKeyUp:function(event) {\n var keyupped = event.target;\n console.log('[handleKeyUp] ' + $(keyupped).val());\n \n // Catch arrows, enter, tab\n // pass other stuff through to ajax request\n // should buffer key strokes and wait for the user\n // to finish typing (i think)\n //\n switch (event.keyCode) {\n //Catch/buffer/ depending on the key pressed\n // see here for details: http://unixpapa.com/js/key.html \n }\n \n // Fire off request\n $.getJSON($(keyupped).attr('acs_source'), {q:$(keyupped).val()}, function(json) {\n jQuery.each(json, function() {\n // BIG TODO: <dog> should be dynamic not hard coded...\n console.log(this.dog.name);\n });\n })\n }\n }\n \n \n // Starting point to attach the autocompleter server\n // to all clients on the page\n $(document).ready(function(){\n $(\"input[acs_source]\").bindAcs();\n });\n\n <% end %>\n </body>\n </html> \n EOS\n }\n end\n end", "def edit_comment\n self.button(:text=>\"Edit comment\").click\n wait_for_ajax(2) #wait_until { self.textarea(:title=>\"Edit your comment\").present? == false }\n end", "def edit\n # @data_object is loaded in before_filter :load_data_object\n set_text_data_object_options\n @selected_toc_item = @data_object.toc_items[0]\n @references = @data_object.visible_references.map {|r| r.full_reference}.join(\"\\n\\n\")\n @page_title = I18n.t(:dato_edit_text_title)\n @page_description = I18n.t(:dato_edit_text_page_description)\n end", "def copytermweeksdo(mystartcopyfromdate,\n myendcopyfromdate,\n mycopynumweeks,\n mystartcopytodate,\n myendcopytodate,\n myfirstweekdate)\n flagstream = true\n mydisplay = render_to_string(\"admins/populatetermstream_head.html\",\n :formats => [:html])\n response.stream.write mydisplay if flagstream\n\n @results = Array.new # store detailed feedback to be displayed on user browser.\n if myfirstweekdate < myendcopytodate # next term must be after this term\n #flash[:notice] = \"The next term must begin after this term - cannot copy!!!\"\n if flagstream\n response.stream.write \"<p>The next term must begin after this term - cannot copy!!!</p>\" \n response.stream.close\n end\n return\n end\n\n @options = Hash.new\n @options[:startdate] = mystartcopytodate\n @options[:enddate] = myendcopytodate\n @cal = calendar_read_display1f(@options)\n unless @cal.empty?\n # destination is not empty - show error and return\n #flash[:notice] = \"Destination days are not empty - will not copy!!!\"\n if flagstream\n response.stream.write \"<p>Destination days are not empty - will not copy!!!</p>\"\n response.stream.close\n end\n #redirect_to copytermweeksedit_path(copytermweeks_params)\n return\n end\n @options[:startdate] = mystartcopyfromdate\n @options[:enddate] = myendcopyfromdate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # source is empty - show error and return\n #flash[:notice] = \"Source days are empty - nothing to copy!!!\"\n response.stream.write \"<p>Source days are empty - nothing to copy!!!</p>\"\n response.stream.close\n #redirect_to copytermweeksedit_path(copytermweeks_params)\n return\n end\n if flagstream\n response.stream.write \"<p>Copy from week beginning: \" +\n mystartcopyfromdate.strftime(\" %A %e/%-m/%y \") + \"</p>\"\n response.stream.write \"<p>Building a term containing : \" +\n (mycopynumweeks + 1).to_s + \" weeks</p>\"\n response.stream.write \"<p>And staring first week of next term on : \" +\n myfirstweekdate.strftime(\" %A %e/%-m/%y \") + \" weeks</p>\"\n end\n #--------------------------------------------------------------------\n #---- check that all slots contains a global and allocate lesson ----\n response.stream.write \"<p>Checking all slots contain global and allocate lessons</p>\" if flagstream\n flagAddedLesson = false # track if one has been added.\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n #---- for each row of slots (all days - each row being a lesson timeslot ----\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 # column title \n else\n #---- for each slot in the row - ( one days with one lesson timeslot) ----\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0 # row title\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n #---- processing a valid slot (not just a cell in the table) ----\n #---- check this slot ----\n #---- check existing lessons ----\n # Now to look at each lesson in each slot\n # Also check that each slot has lesson types of 'global' and 'allocate'\n if slot['values'].respond_to?(:each) then\n flagMissingGlobal = flagMissingAllocate = true\n slot['values'].each do |lesson|\n flagMissingGlobal = false if lesson.status == 'global'\n flagMissingAllocate = false if lesson.status == 'allocate'\n end\n end\n # Add lesson if missing global lesson or allocate lesson.\n #result = /^(([A-Z]+\\d+l(\\d+)))/.match(thisslotid)\n #if result \n # slot_dbId = result[3]\n #end\n if flagMissingGlobal\n @lesson_new = Lesson.new(slot_id: thisslotid, status: \"global\")\n @lesson_new.save\n flagAddedLesson = true\n end\n if flagMissingAllocate\n @lesson_new = Lesson.new(slot_id: thisslotid, status: \"allocate\")\n @lesson_new.save\n flagAddedLesson = true\n end\n end\n end \n end\n end\n # if lessons added, then refetch! - should be a rare occurence!\n if flagAddedLesson\n response.stream.write \"<p>Lessons added - refresh source data from database.</p>\" if flagstream\n @cal = calendar_read_display1f(@options) \n end\n #--------------------------------------------------------------------\n #---- copy this week into following weeks ----\n response.stream.write \"<p>copy this week into following weeks.</p>\" if flagstream\n # get to here, we are set up to do a copy\n # @cal contains the info to be copied.\n # First get the number of dayes to advance by ( + or - is valid)\n adddays = mystartcopytodate - mystartcopyfromdate\n adddaysforweekplusone = myfirstweekdate - mystartcopyfromdate\n logger.debug \"adddays: \" + adddays.inspect\n #keep track of all copied entities - slots, lessons, roles, tutroles.\n # Used later - to break block links.\n @allCopiedSlotsIds = Array.new\n @allCopiedLessonsIds = Array.new\n @allCopiedRolesIds = Array.new\n @allCopiedTutrolesIds = Array.new\n #---- for each site ----\n @cal.each do |site, sitevalue| \n response.stream.write \"<p>Copying site #{site}.</p>\" if flagstream\n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n #---- for each row of slots (all days - each row being a lesson timeslot ----\n sitevalue.each_with_index do |bankslots, bankslotindex|\n response.stream.write \"<p>Progressing through bank #{bankslotindex}.</p>\" if flagstream\n if bankslotindex == 0 # column title \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n logger.debug \"siteName: \" + siteName + \" siteDate: \" + siteDate.inspect\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n #---- for each slots in the row - ( one days with one lesson timeslot) ----\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0 # row title\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n #---- processing a valid slot (not just a cell in the table) ----\n @allCopiedSlotsIds.push thisslotid # track all copied slots \n @results.push \"Slotid: #{thisslotid}\"\n #---- copy run this slot ----\n @blockSlots = Array.new\n @blockSlots[0] = Slot.find(thisslotid)\n @blockSlots[0].first = thisslotid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n slotLocation = @blockSlots[0].location \n nextTimeslotTo = @blockSlots[0].timeslot + (adddays.to_i - 7) * 86400\n ### adddaysforweekplusone\n (1..mycopynumweeks+1).each do |i|\n nextTimeslotTo += 7 * 86400\n # cater for the week plus one entries\n nextTimeslotTo = @blockSlots[0].timeslot + adddaysforweekplusone * 86400 if i == mycopynumweeks + 1 \n @blockSlots[i] = Slot.new(timeslot: nextTimeslotTo, \n location: slotLocation,\n first: thisslotid )\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockSlots[i].next = @blockSlots[i+1].id unless i == mycopynumweeks+1 \n if @blockSlots[i].save\n # weekPlusOne (wpo) will have the wpo field set to self\n if i == mycopynumweeks+1 \n @blockSlots[i].wpo = @blockSlots[i].id\n @blockSlots[i].save\n end\n @results.push \"created slot \" + @blockSlots[i].inspect\n else\n @results.push \"FAILED creating slot \" + @blockSlots[i].inspect + \n \"ERROR: \" + @blockSlots[i].errors.messages.inspect\n end\n end\n #---- copy any existing lesson that have the desired status ----\n # Now to look at each lession in each slot\n # Also check that each slot has lesson types of 'global' and 'allocate'\n flagbreak = false\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n #response.stream.write \"<p>Progressing through lessons.</p>\" if flagstream\n if !flagbreak\n response.stream.write \"<p>Progressing through lessons.\" if flagstream\n flagbreak = true\n else\n response.stream.write \".\"\n end\n #logger.debug \"lesson: \" + lesson.inspect\n # is this a valid lesson to copy\n ###next if ['global', 'allocate', 'park'].include?(lesson.status)\n next if ['park'].include?(lesson.status)\n thislessonid = lesson.id\n #---- copy run this lesson ----\n @allCopiedLessonsIds.push thislessonid # track all copied slots \n @blockLessons = Array.new\n @blockLessons[0] = lesson\n @blockLessons[0].first = thislessonid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n ### adddaysforweekplusone\n (1..mycopynumweeks+1).each do |i|\n parentSlotId = @blockSlots[i].id\n # cater for the week plus one entries\n @blockLessons[i] = Lesson.new(slot_id: parentSlotId, \n status: lesson.status,\n first: thislessonid )\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockLessons[i].next = @blockLessons[i+1].id unless i == mycopynumweeks+1 \n if @blockLessons[i].save\n @results.push \"created lesson \" + @blockLessons[i].inspect\n else\n @results.push \"FAILED creating lesson \" + @blockLessons[i].inspect + \n \"ERROR: \" + @blockLessons[i].errors.messages.inspect\n end\n end\n #---- some lessons are copied but not their tutor/student content ----\n # for free lesson, do not copy any tutors or students\n next if lesson.status == 'free'\n # At this point, decision to copy tutors or students depends\n # on their kind and status.\n # Now find all the tutors in this lesson\n #---- copy any existing tutors that have the desired status & kind ----\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n logger.debug \"tutor: \" + tutor.inspect\n #thistutrole = tutor.tutroles.where(lesson_id: lesson.id).first\n @blockTutroles = Array.new\n @blockTutroles[0] = tutor.tutroles.where(lesson_id: lesson.id).first\n # Check if this tutor-lesson should be copied\n flagtutorcopy = false\n flagtutorcopy = true if ['scheduled', 'confirmed', 'notified',\n 'attended', 'away', 'absent'].include?(@blockTutroles[0].status)\n # do not copy certain kinds!\n flagtutorcopy = false if ['called', 'training', 'relief'].include?(@blockTutroles[0].kind)\n #flagtutorcopy = false if @blockTutroles[0].kind == 'called'\n next unless flagtutorcopy\n thistutroleid = @blockTutroles[0].id\n @allCopiedTutrolesIds.push thistutroleid # track all copied slots \n @blockTutroles[0].block = @blockTutroles[0].first = thistutroleid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n (1..mycopynumweeks+1).each do |i|\n parentLessonId = @blockLessons[i].id\n # cater for the week plus one entries\n @blockTutroles[i] = Tutrole.new(lesson_id: parentLessonId,\n tutor_id: tutor.id, \n status: 'scheduled',\n kind: @blockTutroles[0].kind,\n first: thistutroleid,\n block: thistutroleid)\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockTutroles[i].next = @blockTutroles[i+1].id unless i == mycopynumweeks+1 \n if @blockTutroles[i].save\n @results.push \"created tutrole \" + @blockTutroles[i].inspect\n else\n @results.push \"FAILED creating tutrole \" + @blockTutroles[i].inspect + \n \"ERROR: \" + @blockTutroles[i].errors.messages.inspect\n end\n # the last entity in chain is the week + 1 entry. \n # block will be set to self. \n ### This strategy is now changed.\n ### Week Plus One (WPO) is now identified in the slots\n ### Block now picks up all the items in the chain as first\n ### will change often as moves are done. Block is the only way\n ### to pick up all historical entries in the chain.\n ###if i == mycopynumweeks+1\n ### @blockTutroles[i].block = @blockTutroles[i].id \n ### if @blockTutroles[i].save\n ### @results.push \"updated tutrole :block \" + @blockTutroles[i].inspect\n ### else\n ### @results.push \"FAILED updating tutrole block \" + @blockTutroles[i].inspect + \n ### \"ERROR: \" + @blockTutroles[i].errors.messages.inspect\n ### end\n ###end\n end\n end\n end\n #---- copy any existing students that have the desired status & kind ----\n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n logger.debug \"student: \" + student.inspect\n @blockRoles = Array.new\n @blockRoles[0] = student.roles.where(lesson_id: lesson.id).first\n # check if this student should be copied.\n # for some lesson types, students are never copied\n next if ['flexible', 'on_BFL', 'onSetup', 'onCall',\n 'free'].include?(lesson.status)\n # others depend on their student-lesson status/\n flagstudentcopy = false\n # do not copy certain kinds!\n flagstudentcopy = true if ['scheduled', 'attended', 'away',\n 'absent', 'bye'].include?(@blockRoles[0].status)\n flagstudentcopy = false if ['catchup', 'catchupcourtesy', 'bonus', 'free'].include?(@blockRoles[0].kind)\n next unless flagstudentcopy\n # if so, copy this student-lesson\n thisroleid = @blockRoles[0].id\n @allCopiedRolesIds.push thisroleid # track all copied slots \n @blockRoles[0].block = @blockRoles[0].first = thisroleid\n # Now need to copy this to the following mycopynumweeks weeks.\n # we are forming a chain with first = first id in chain &\n # next = the following id in the chain.\n (1..mycopynumweeks+1).each do |i|\n parentLessonId = @blockLessons[i].id\n # cater for the week plus one entries\n @blockRoles[i] = Role.new(lesson_id: parentLessonId,\n student_id: student.id, \n status: 'scheduled',\n kind: @blockRoles[0].kind,\n first: thisroleid,\n block: thisroleid)\n \n #byebug\n if @blockRoles[0].student.status == 'fortnightly'\n if @blockRoles[0].status == 'bye'\n @blockRoles[i].status = i.even? ? 'bye' : 'scheduled' \n else\n @blockRoles[i].status = i.odd? ? 'bye' : 'scheduled' \n end\n end\n logger.debug \"@blockRoles ( \" + i.to_s + \"): \" + @blockRoles[i].inspect\n end\n (0..mycopynumweeks+1).reverse_each do |i|\n # the last entity in chain will have next = nil by default, do not populate.\n @blockRoles[i].next = @blockRoles[i+1].id unless i == mycopynumweeks+1 \n if @blockRoles[i].save\n @results.push \"created role \" + @blockRoles[i].inspect\n else\n @results.push \"FAILED creating role \" + @blockRoles[i].inspect + \n \"ERROR: \" + @blockRoles[i].errors.messages.inspect\n end\n # the last entity in chain is the week + 1 entry. \n # block will be set to self.\n ### This strategy is now changed.\n ### Week Plus One (WPO) is now identified in the slots\n ### Block now picks up all the items in the chain as first\n ### will change often as moves are done. Block is the only way\n ### to pick up all historical entries in the chain.\n ###if i == mycopynumweeks+1\n ### @blockRoles[i].block = @blockRoles[i].id if i == mycopynumweeks+1 \n ### if @blockRoles[i].save\n ### @results.push \"updated role :block \" + @blockTutroles[i].inspect\n ### else\n ### @results.push \"FAILED updating role block \" + @blockTutroles[i].inspect + \n ### \"ERROR: \" + @blockRoles[i].errors.messages.inspect\n ### end\n ###end\n end\n end\n end\n end\n end\n if flagbreak\n response.stream.write \"</p>\" if flagstream\n flagbreak = false\n end\n end\n end \n end\n end\n\n # Now need to break the chains \n # Remember that week + 1 is in the old chain.\n # Need to find previous link in the chain and set entity.next to nil.\n #@allCopiedSlotsIds = Array.new\n #@allCopiedLessonsIds = Array.new\n #@allCopiedRolesIds = Array.new\n #@allCopiedTutrolesIds = Array.new\n response.stream.write \"<p>Breaking chains to disconnect wpo from previous term.</p>\" if flagstream\n Slot.where(next: @allCopiedSlotsIds).update_all(next: nil)\n Lesson.where(next: @allCopiedLessonsIds).update_all(next: nil)\n Role.where(next: @allCopiedRolesIds).update_all(next: nil)\n Tutrole.where(next: @allCopiedTutrolesIds).update_all(next: nil)\n \n # Now remove the wpo flag for this initial wpo\n response.stream.write \"<p>Remove wpo flag from old week plus one.</p>\" if flagstream\n Slot.where(id: @allCopiedSlotsIds).update_all(wpo: nil)\n response.stream.write \"<p>Populate Term COMPLETED.</p>\"\n response.stream.close\n #rescue ActionController::Live::ClientDisconnected\n # logger.info(\"Client disconnected!!!\")\n # flagStream = false\n #ensure\n # response.stream.close\n end", "def set_copy\n @copy = Copy.find(params[:id])\n end", "def set_copy\n @copy = Copy.find(params[:id])\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def notifyInit\n registerGUI(Controller::OptionsListener.new(self))\n # Initialize appearance of many components\n notifyUndoUpdate\n notifyRedoUpdate\n notifyClipboardContentChanged\n notifyCurrentOpenedFileUpdate\n @Commands.each do |iCommandID, iCommandParams|\n updateImpactedAppearance(iCommandID)\n end\n # Notify everybody that we are initializing\n notifyRegisteredGUIs(:onInit)\n # Create the Timer monitoring the clipboard\n # This Timer populates the following variables with the clipboard content in real-time:\n # * @Clipboard_CopyMode\n # * @Clipboard_CopyID\n # * @Clipboard_SerializedSelection\n # Note that we are already in the process of a delete event from the clipboard.\n @Clipboard_AlreadyProcessingDelete = false\n safeTimerEvery(@TimersManager, 500) do\n # Check if the clipboard has some data we can paste\n Wx::Clipboard.open do |iClipboard|\n if (iClipboard.supported?(Tools::DataObjectSelection.getDataFormat))\n # OK, this is data we understand.\n # Get some details to display what we can paste\n lClipboardData = Tools::DataObjectSelection.new\n iClipboard.get_data(lClipboardData)\n lCopyMode, lCopyID, lSerializedSelection = lClipboardData.getData\n # Do not change the state if the content has not changed\n if ((lCopyMode != @Clipboard_CopyMode) or\n (lCopyID != @Clipboard_CopyID))\n # Clipboard's content has changed.\n @Clipboard_CopyMode = lCopyMode\n @Clipboard_CopyID = lCopyID\n @Clipboard_SerializedSelection = lSerializedSelection\n notifyClipboardContentChanged\n # Else, nothing to do, clipboard's state has not changed.\n end\n elsif (@Clipboard_CopyMode != nil)\n # Clipboard has nothing interesting anymore.\n @Clipboard_CopyMode = nil\n @Clipboard_CopyID = nil\n @Clipboard_SerializedSelection = nil\n notifyClipboardContentChanged\n # Else, nothing to do, clipboard's state has not changed.\n end\n end\n end\n end", "def save_new_selection\n save_element.when_visible { save }\n wait_for_ajax\n end", "def load_text(text)\n text = text.dup\n text.sub!(CTRL_V) { Yuki.get_clipboard }\n text.split(//).each do |char|\n if char == BACK\n last_char = @current_text[-1]\n @current_text.chop!\n @on_remove_char&.call(@current_text, last_char)\n elsif char.getbyte(0) >= 32 && @current_text.size < @max_size\n @current_text << char\n @on_new_char&.call(@current_text, char)\n end\n end\n self.text = (@empty_char.size > 0 ? @current_text.ljust(@max_size, @empty_char) : @current_text)\n end", "def create\n @blog = Blog.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n @blog.short_body = @blog.body_area.to_plain_text.first(250)\n @blog.save!\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @copy = Copy.find(params[:id])\n\n respond_to do |format|\n if @copy.update_attributes(params[:copy])\n flash[:notice] = 'Copy was successfully updated.'\n format.html { redirect_to(@copy) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @copy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @document = Document.find(params[:id])\n @oldname = @document.name\n @oldcontent = @document.content\n @space = @document.space\n @edited_content = params[:document][:content]\n @job = Job.where(:wikispace => @space.wiki_name)[0]\n @comments = @space.comments.order('updated_at DESC') \n \n #Check there isn't a newer version in the DB\n #dd = DateTime.parse(t.to_s)\n #tt = Time.parse(d.to_s)\n \n d = @document.updated_at.to_datetime.to_i - params[:document][:updated_at].to_datetime.to_i \n puts \"Document in DB was updated at #{@document.updated_at.to_datetime.to_i}\"\n puts \"My copy was updated at #{params[:document][:updated_at].to_datetime.to_i}\"\n puts \"The diference: #{d}\"\n puts \"Editedt content:\" + @edited_content\n \n if ( d != 0)\n puts \"Conflict\"\n @conflict = true\n @diff = Diffy::Diff.new(@edited_content, @oldcontent).to_s(:html)\n else\n @conflict = false\n \n #Get the diff and set to the user\n diffed = HtmlDiffer.diff(@oldcontent, @edited_content.strip, \"#{current_user.id}\")\n \n #save to a file for debugging in case of finding errors\n# File.open(\"diffdebugtest.log\", \"a+\") do |f|\n# f.puts(\"old = %Q{#{@oldcontent}}\")\n# f.puts(\"new = %Q{#{@edited_content.strip}}\")\n# f.puts(\"result = %Q{#{diffed}}\")\n# end\n \n params[:document][:content] = diffed\n \n @success = @document.update_attributes(params[:document])\n @activity = Activity.find(:all, :conditions => ['user_id = ? and job_id = ? and code = ?', current_user.id, @job.id, 1])\n current_user.activities.create(:job_id => @job.id, :code => 1) unless !@activity[@activity.count-1].nil? && @activity[@activity.count-1].created_at.to_date == Date.today\n current_user.activities.create(:job_id => @job.id, :code => 2)\n end \n \n #If there is no conflict save the document and update the verions\n if @success\n \tparams[:oldcont] = @oldcontent\n \tparams[:newcont] = @document.content\n \tif @oldcontent != @document.content\n\t \tversion_hash = UUIDTools::UUID.timestamp_create.to_s\n\t \t@user = current_user\n\t \t@version = @document.versions.create(:content =>@document.content,:version => version_hash, :user_id=> current_user.id)\n\t \t@version.save\n \tend\n end\n \n respond_to do |format|\n if @success \n format.html { redirect_to \"/spaces/\"+@space.wiki_name+\"/documents/\"+@document.id.to_s, :notice => \"Saved\" }\n format.xml { head :ok }\n elsif @conflict \n #format.html { redirect_to \"/spaces/\"+@space.wiki_name+\"/documents/\"+@document.id.to_s, :notice => \"Conflict\" }\n format.html { render :action => :show , :notice => \"Conflict\"} \n format.xml { head :ok }\n else\n format.html { render :action => :show , :notice => \"Error\"}\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cp(string)\n `echo \"#{string} | pbcopy`\n puts 'copied to clipboard'\nend", "def paste_before()\n clipboard = send_message(\"getClipboardContents\" => [])[\"clipboardContents\"]\n if clipboard[-1].chr == \"\\n\"\n [\"moveToBeginningOfLine:\", \"paste\"] + restore_cursor_position + [\"moveToBeginningOfLine:\"] +\n (is_whitespace?(clipboard[0].chr) ? [\"moveWordForward:\"] : [])\n else\n [\"paste\", \"moveForward:\"]\n end\n end", "def replace_text(text)\n @txt .set_editable(true) # .freeze\n @txt .buffer .set_text(\"\")\n# hdr, value = text .split(\"\\n\\n\", 2)\n# hdr .to_s .each_line{|line|\n# case line\n# when /^Subject:/ ;color = BLUE\n# when /^X-SC-Subject:/ ;color = BLUE\n# when /^From:/ ;color = PURPLE\n# #when /^To:|Cc:/ ;color = ORANGE\n# #when /^Date:/ ;color = GREEN\n# when /^X-SC-(Time|Day):/ ;color = RED\n# else ;color = BLACK\n# end\n# @txt .insert(nil, color, nil, line) if line != ''\n# }\n# @txt .insert(nil, RED, WHITE, hdr .to_s)\n# @txt .insert(nil, BLACK, nil, \"\\n\\n\" + value .to_s)\n\n @txt .buffer .insert(@txt.buffer.start_iter, MhcKconv::todisp(text))\n @txt .set_editable(@text_editable) #.thaw\n end" ]
[ "0.6940014", "0.6300451", "0.62851685", "0.6256926", "0.6134019", "0.60812545", "0.6001184", "0.5991647", "0.59278405", "0.5848881", "0.58273697", "0.57580703", "0.57208323", "0.56754756", "0.5573386", "0.55658126", "0.55145067", "0.5464325", "0.5414632", "0.5395405", "0.5368489", "0.52833843", "0.52414715", "0.5144208", "0.5143248", "0.5120488", "0.51198214", "0.5119448", "0.50664604", "0.49866998", "0.498471", "0.4950437", "0.49303448", "0.49301055", "0.49109313", "0.4898336", "0.4889974", "0.48840183", "0.4871162", "0.48627353", "0.48462617", "0.48432982", "0.48426887", "0.4842639", "0.4821532", "0.48152786", "0.4813846", "0.4805192", "0.47932476", "0.4790395", "0.4755866", "0.47432008", "0.47391158", "0.4732766", "0.47261372", "0.47210634", "0.47209993", "0.4720708", "0.47193265", "0.4711849", "0.4707424", "0.4707059", "0.47048536", "0.47014004", "0.46997443", "0.46994162", "0.4696612", "0.46852002", "0.46610725", "0.46564713", "0.46514934", "0.4645765", "0.46223462", "0.46165428", "0.4614635", "0.46130514", "0.46047124", "0.4594461", "0.45832986", "0.45811832", "0.45718992", "0.45583066", "0.45578766", "0.45543644", "0.45512685", "0.45387504", "0.45376217", "0.45376217", "0.45357907", "0.45357907", "0.45357907", "0.45302427", "0.45259443", "0.45200452", "0.45130217", "0.45052832", "0.4504637", "0.45017752", "0.4500458", "0.4498798" ]
0.69390106
1
Update some anomalies in json data on paste_clipboard action.
def update_json(json, is_update=false) #:nodoc: result = {} json.each do |k,v| if v.class == Hash result[k] = v['$oid'] unless is_update #TODO Double check if unless works as expected elsif v.class == Array result[k] = [] v.each {|e| result[k] << update_json(e, is_update)} else result[k] = v end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_clipboard_paste\n dat = if Wx::PLATFORM == \"WXMAC\" \n # XXX i feel dirty\n `pbpaste`\n else\n dobj=RawDataObject.new\n Wx::Clipboard.open {|clip| clip.fetch dobj}\n dobj.raw_data\n end\n\n self.gui_set_value(self.cur_pos, dat) if dat and dat.size > 0\n end", "def notifyClipboardContentChanged\n updateCommand(Wx::ID_PASTE) do |ioCommand|\n if (@Clipboard_CopyMode == nil)\n # The clipboard has nothing interesting for us\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n # Cancel eventual Copy/Cut pending commands\n notifyCancelCopy\n # Notify everybody\n notifyRegisteredGUIs(:onClipboardContentChanged)\n elsif (@Clipboard_CopyMode == Wx::ID_DELETE)\n # Check that this message is adressed to us for real (if many instances of PBS are running, it is possible that some other instance was cutting things)\n if (@CopiedID == @Clipboard_CopyID)\n # Here we have to take some action:\n # Delete the objects marked as being 'Cut', as we got the acknowledge of pasting it somewhere.\n if (@CopiedMode == Wx::ID_CUT)\n if (!@Clipboard_AlreadyProcessingDelete)\n # Ensure that the loop will not come here again for this item.\n @Clipboard_AlreadyProcessingDelete = true\n executeCommand(Wx::ID_DELETE, {\n :parentWindow => nil,\n :selection => @CopiedSelection,\n :deleteTaggedShortcuts => false,\n :deleteOrphanShortcuts => false\n })\n # Then empty the clipboard.\n Wx::Clipboard.open do |ioClipboard|\n ioClipboard.clear\n end\n # Cancel the Cut pending commands.\n notifyCutPerformed\n notifyRegisteredGUIs(:onClipboardContentChanged)\n @Clipboard_AlreadyProcessingDelete = false\n end\n else\n log_bug 'We have been notified of a clipboard Cut acknowledgement, but no item was marked as to be Cut.'\n end\n end\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n else\n lCopyName = nil\n case @Clipboard_CopyMode\n when Wx::ID_CUT\n lCopyName = 'Move'\n when Wx::ID_COPY\n lCopyName = 'Copy'\n else\n log_bug \"Unsupported copy mode from the clipboard: #{@Clipboard_CopyMode}.\"\n end\n if (@Clipboard_CopyID != @CopiedID)\n # Here, we have another application of PBS that has put data in the clipboard. It is not us anymore.\n notifyCancelCopy\n end\n if (lCopyName != nil)\n # Activate the Paste command with a cool title\n ioCommand[:Enabled] = true\n ioCommand[:Title] = \"Paste #{@Clipboard_SerializedSelection.getDescription} (#{lCopyName})\"\n else\n # Deactivate the Paste command, and explain why\n ioCommand[:Enabled] = false\n ioCommand[:Title] = \"Paste (invalid type #{@Clipboard_CopyMode}) - Bug ?\"\n end\n notifyRegisteredGUIs(:onClipboardContentChanged)\n end\n end\n end", "def paste; clipboard_paste; end", "def paste\n\t\t\t$ruvim.insert $ruvim.buffers[:copy].data\n\t\t\t$ruvim.editor.redraw\n\t\tend", "def paste_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n result = ''\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.html { return render('paste_clipboard', layout: 'cms') }\r\n format.json {\r\n table, id, ids = nil\r\n params[:data].split(\"\\n\").each do |line|\r\n line.chomp!\r\n next if line.size < 5 # empty line. Skip\r\n\r\n begin\r\n if line[0] == '[' # id(s)\r\n result << \"<br>#{line}\"\r\n line = line[/\\[(.*?)\\]/, 1] # just what is between []\r\n table, id, ids = line.split(',')\r\n elsif line[0] == '{' # document data\r\n result << process_document(line, table, id, ids)\r\n end\r\n rescue Exception => e \r\n result << \" Runtime error. #{e.message}\\n\"\r\n break\r\n end\r\n end\r\n }\r\n end\r\n dc_render_ajax(div: 'result', value: result )\r\nend", "def paste_clipboard\r\n# Only administrators can perform this operation \r\n return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')\r\n \r\n result = ''\r\n respond_to do |format|\r\n# just open new window to same url and come back with html request \r\n format.html { return render('paste_clipboard', layout: 'cms') }\r\n format.json {\r\n table, id, ids = nil\r\n params[:data].split(\"\\n\").each do |line|\r\n line.chomp!\r\n next if line.size < 5 # empty line. Skip\r\n begin\r\n if line[0] == '[' # id(s)\r\n result << \"<br>#{line}\"\r\n line = line[/\\[(.*?)\\]/, 1] # just what is between []\r\n table, id, ids = line.split(',')\r\n elsif line[0] == '{' # document data\r\n result << process_document(line, table, id, ids)\r\n end\r\n rescue Exception => e \r\n result << \" Runtime error. #{e.message}\\n\"\r\n break\r\n end\r\n end\r\n }\r\n end\r\n dc_render_ajax(div: 'result', value: result )\r\nend", "def check_clipboard\n value = @clipboard.read\n return unless value\n\n links = @parser.parse(value)\n return if links.empty?\n\n @filter.filter(links) do |link|\n $log.debug(\"adding #{link}\")\n entry = LinkTable::Entry.new(link)\n @link_table.add(entry)\n @resolver_manager.add(entry, link)\n end\n end", "def apps_block_copy_paste=(value)\n @apps_block_copy_paste = value\n end", "def copy_to_clipboard\n end", "def do_clipboard_cut\n if do_clipboard_copy()\n pos = @selection.first\n self.gui_set_value(nil, '')\n self.cur_pos = pos\n end\n end", "def copy(sender)\n filteredData[tableView.selectedRow].symbol.sendToPasteboard\n end", "def pbpaste\n Clipboard.paste\nend", "def do_clipboard_copy\n return nil unless sel=@selection and dat=@data[sel]\n # XXX i feel dirty\n if Wx::PLATFORM == \"WXMAC\"\n IO.popen(\"pbcopy\", \"w\") {|io| io.write dat}\n stat = $?.success?\n else\n dobj = RawDataObject.new(dat)\n stat = Wx::Clipboard.open {|clip| clip.place dobj}\n end\n return stat\n end", "def paste(at: caret)\n editable? and @native.paste_text(at.to_i)\n end", "def paste\n # no authorization applied as the method must always render\n if @activity.changeable?(current_visitor)\n @original = clipboard_object(params)\n if (@original)\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at], :include => :pages\n if (@component)\n # @component.original = @original\n @container = params[:container] || 'activity_sections_list'\n @component.name = \"copy of #{@component.name}\"\n @component.deep_set_user current_visitor\n @component.activity = @activity\n @component.save\n end\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'section_list_item', :locals => {:section => @component})\n page.sortable :activity_sections_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_sections', :params => {:activity_id => @activity.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def to_clipboard\n #prettified = self.pretty_inspect.strip\n prettified = self.to_s\n stringified = self.to_s\n printable = (\n if prettified.length > 80 then\n prettified.slice(0, 80) + '...'\n else\n prettified\n end\n ).inspect\n $clipboard.write(stringified)\n $stderr.puts(\"to_clipboard: wrote #{printable} to clipboard\")\n return nil\n end", "def show\n @clipboard = find_clipboard\n end", "def onCopied(src_item, item)\n @object.copied(import(src_item), import(item));\n end", "def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end", "def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end", "def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end", "def copy_output\n copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\\d+ (.*)/, '\\1')\n \"The session output history has been copied to the clipboard.\"\n end", "def update\n @paste = Paste.find(params[:id])\n\n respond_to do |format|\n if @paste.update_attributes(params[:paste])\n flash[:notice] = 'Paste was successfully updated.'\n format.html { redirect_to(@paste) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @paste.errors, :status => :unprocessable_entity }\n end\n end\n end", "def paste(text)\n can_refresh = false\n # Attempt to insert every character individually\n text.split(\"\").each do |ch|\n break unless @helper.insert(ch)\n can_refresh = true\n end\n # Only refresh if characters were inserted\n self.refresh if can_refresh\n end", "def do_copy\n @editor.value = @current_copycode\n @editor.focus\n end", "def paste\n # no authorization applied as the method must always render\n if @section.changeable?(current_visitor)\n @original = clipboard_object(params)\n if @original\n @container = params[:container] || 'section_pages_list'\n if @original.class == Page\n @component = @original.duplicate\n else\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @component.name = \"copy of #{@original.name}\"\n end\n if (@component)\n # @component.original = @original\n @component.section = @section\n @component.save\n end\n @component.deep_set_user current_visitor\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'page_list_item', :locals => {:page => @component})\n page.sortable :section_pages_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_pages', :params => {:section_id => @section.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def paste\n `pbpaste`\n end", "def paste(str)\n send_command_to_control(\"EditPaste\", str)\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def copy_input\n copy session_history\n \"The session input history has been copied to the clipboard.\"\n end", "def is_paste?\n type == 'PasteMessage'\n end", "def copy_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n table = CmsHelper.table_param(params)\r\n doc = dc_find_document(table, params[:id], params[:ids])\r\n text = '<style>body {font-family: monospace;}</style><pre>'\r\n text << \"JSON:<br>[#{table},#{params[:id]},#{params[:ids]}]<br>#{doc.as_document.to_json}<br><br>\"\r\n text << \"YAML:<br>#{doc.as_document.to_hash.to_yaml.gsub(\"\\n\", '<br>')}</pre>\"\r\n render plain: text\r\n end\r\n end \r\nend", "def copyFromClipboard \n \"copyFromClipboard\" \n end", "def paste_before()\n clipboard = send_message(\"getClipboardContents\" => [])[\"clipboardContents\"]\n if clipboard[-1].chr == \"\\n\"\n [\"moveToBeginningOfLine:\", \"paste\"] + restore_cursor_position + [\"moveToBeginningOfLine:\"] +\n (is_whitespace?(clipboard[0].chr) ? [\"moveWordForward:\"] : [])\n else\n [\"paste\", \"moveForward:\"]\n end\n end", "def paste\n `pbpaste`\nend", "def update\n @paste = Paste.find_by_id(params[:id])\n @parsers = Parser.all(:order => 'display_name')\n\n respond_to do |format|\n if @paste\n if params[:paste].keys.include?('code') && params[:paste]['code'] == ''\n format.html {\n render :action => \"edit\"\n }\n else\n if @paste.update_attributes(params[:paste])\n format.html { redirect_to(@paste) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n else\n format.html { response_to_missing_id }\n end\n end\n end", "def clone_post_copy_hook(_clone_copy_output, _opts = {})\n end", "def paste\n\n # FIXME\n if OperaWatir::Platform.os == :macosx\n keys.send [:command, 'v']\n else\n keys.send [:control, 'v']\n end\n end", "def set_pasteurizacion\n @pasteurizacion = Pasteurizacion.find(params[:id])\n end", "def copy_actions\r\n end", "def pbpaste\n a = IO.popen(\"osascript -e 'the clipboard as unicode text' | tr '\\r' '\\n'\", 'r+').read\n a.strip.force_encoding(\"UTF-8\")\nend", "def paste link\n clipboard = %w{\n /usr/bin/pbcopy\n /usr/bin/xclip\n }.find { |path| File.exist? path }\n\n if clipboard\n IO.popen clipboard, 'w' do |io| io.write link end\n end\n end", "def get_paste(id)\n uri = URI.parse(\"#{BASE_URL}/pastes/#{id}\")\n response = JSON.parse(@client.get(uri).body)\n return Pastee::Paste.new(response['paste']) if response['success']\n\n throw_error(response)\n end", "def paste_from_clipboard(page_id, element, method, position)\n element_copy = copy(element, :page_id => page_id)\n element_copy.insert_at(position)\n if method == \"move\" && element_copy.valid?\n element.destroy\n end\n element_copy\n end", "def copy_timestamp\n data[:copy_timestamp]\n end", "def test_btc\n a = copy(@btc)\n sleep(@sleep)\n b = paste\n clear\n unless a == b\n alarm; puts \"Bitcoin address changed in clipboard!\\n\\n\"\n else\n puts \"Bitcoin pattern - test passed\"\n end\n end", "def after_create\n self.syntax.increment!(:paste_count)\n end", "def stamp_new_rows\n db.query(\"UPDATE #{audit} SET `_copied_at` = NOW() WHERE `_copied_at` IS NULL\")\n end", "def application_guard_block_clipboard_sharing=(value)\n @application_guard_block_clipboard_sharing = value\n end", "def apps_block_copy_paste\n return @apps_block_copy_paste\n end", "def copied(src_item, item)\n end", "def copy_bbcode\n str = EventPrinter::BBcode::head(@event.printed_name)\n str << (@list.map { |e| e.bbcode }).join(\"\\n\")\n str << EventPrinter::BBcode::foot\n Win32API.push_text_in_clipboard(str.to_ascii << \"\\0\")\n end", "def test_email\n a = copy(@email)\n sleep(@sleep)\n b = paste\n clear\n unless a == b\n alarm; puts \"E-mail address changed in clipboard!\\n\\n\"\n else\n puts \"E-mail pattern - test passed\"\n end\n end", "def notifyInit\n registerGUI(Controller::OptionsListener.new(self))\n # Initialize appearance of many components\n notifyUndoUpdate\n notifyRedoUpdate\n notifyClipboardContentChanged\n notifyCurrentOpenedFileUpdate\n @Commands.each do |iCommandID, iCommandParams|\n updateImpactedAppearance(iCommandID)\n end\n # Notify everybody that we are initializing\n notifyRegisteredGUIs(:onInit)\n # Create the Timer monitoring the clipboard\n # This Timer populates the following variables with the clipboard content in real-time:\n # * @Clipboard_CopyMode\n # * @Clipboard_CopyID\n # * @Clipboard_SerializedSelection\n # Note that we are already in the process of a delete event from the clipboard.\n @Clipboard_AlreadyProcessingDelete = false\n safeTimerEvery(@TimersManager, 500) do\n # Check if the clipboard has some data we can paste\n Wx::Clipboard.open do |iClipboard|\n if (iClipboard.supported?(Tools::DataObjectSelection.getDataFormat))\n # OK, this is data we understand.\n # Get some details to display what we can paste\n lClipboardData = Tools::DataObjectSelection.new\n iClipboard.get_data(lClipboardData)\n lCopyMode, lCopyID, lSerializedSelection = lClipboardData.getData\n # Do not change the state if the content has not changed\n if ((lCopyMode != @Clipboard_CopyMode) or\n (lCopyID != @Clipboard_CopyID))\n # Clipboard's content has changed.\n @Clipboard_CopyMode = lCopyMode\n @Clipboard_CopyID = lCopyID\n @Clipboard_SerializedSelection = lSerializedSelection\n notifyClipboardContentChanged\n # Else, nothing to do, clipboard's state has not changed.\n end\n elsif (@Clipboard_CopyMode != nil)\n # Clipboard has nothing interesting anymore.\n @Clipboard_CopyMode = nil\n @Clipboard_CopyID = nil\n @Clipboard_SerializedSelection = nil\n notifyClipboardContentChanged\n # Else, nothing to do, clipboard's state has not changed.\n end\n end\n end\n end", "def notify_on_copy\n @attributes[:notify_on_copy]\n end", "def work_profile_block_cross_profile_copy_paste=(value)\n @work_profile_block_cross_profile_copy_paste = value\n end", "def apps_block_clipboard_sharing=(value)\n @apps_block_clipboard_sharing = value\n end", "def notifyObjectsCopied(iSelection, iCopyID)\n # First notify to uncopy the previous ones\n notifyCancelCopy\n @CopiedSelection = iSelection\n @CopiedMode = Wx::ID_COPY\n @CopiedID = iCopyID\n notifyRegisteredGUIs(:onObjectsCopied, @CopiedSelection)\n end", "def copy_attributes(other, duplicator)\n self.title = other.title\n self.description = other.description\n self.published = duplicator.options[:unpublish_all] ? false : other.published\n self.base_exp = other.base_exp\n self.time_bonus_exp = other.time_bonus_exp\n self.start_at = duplicator.time_shift(other.start_at)\n self.bonus_end_at = duplicator.time_shift(other.bonus_end_at) if other.bonus_end_at\n self.end_at = duplicator.time_shift(other.end_at) if other.end_at\n end", "def notifyCancelCopy\n if (@CopiedSelection != nil)\n notifyRegisteredGUIs(:onCancelCopy, @CopiedSelection)\n @CopiedSelection = nil\n @CopiedMode = nil\n @CopiedID = nil\n end\n end", "def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end", "def copy(item)\n copy_command = darwin? ? \"pbcopy\" : \"xclip -selection clipboard\"\n\n Kernel.system(\"echo '#{item.value.gsub(\"\\'\",\"\\\\'\")}' | tr -d \\\"\\n\\\" | #{copy_command}\")\n\n \"Boom! We just copied #{item.value} to your clipboard.\"\n end", "def push_text_in_clipboard(text)\n OpenClipboard.call(0)\n EmptyClipboard.call()\n hmem = GlobalAlloc.call(0x42, text.length)\n mem = GlobalLock.call(hmem)\n Memcpy.call(mem, text, text.length)\n SetClipboardData.call(1, hmem) # Format CF_TEXT = 1\n GlobalFree.call(hmem)\n CloseClipboard.call()\n self\n end", "def historic_copy_to_history\n historic_record_class.create_history_from_current!(self)\n historic_options[:after].to_proc.call(self) if historic_options[:after]\n end", "def update(context = self)\n # FIXME: log context\n @do_refresh = true\n @ctrl.commands << :render unless @paste_mode\n end", "def update_stored_data(t = Time.now.utc)\n stored_data.delete(stored_data_last_key) unless stored_data.keys.length == 1\n stored_data[t] = showback_event.data\n save\n end", "def copy\n expression_to_clone = Expression.find(params[:id])\n\t\t\t \n\t@expression = expression_to_clone.clone\n\t\n\t@expression.expression_title = \"Copy of '#{expression_to_clone.expression_title}'\"\n \n if @expression.expression_title.length > 100\n flash[:error] = \"The new title '#{@expression.expression_title}' is too long.\"\n redirect_to :action => 'edit', :id => expression_to_clone.id\n return\n end\n\t\n\t@expression.status = Status::PENDING # default to 'pending'\n\t\n\t# delete created_at assigned from expression_to_clone created_at value\n\t# as we need created_at be actual time of creating the copy\n\t@expression.created_at = nil\t\n\t\t\n\t# updated by\n\t@expression.updated_by = get_user.login_id\n\t\n\t# languages\n\texpression_to_clone.languages.each do |l|\n\t @expression.languages << Language.find(l.language_id)\n\tend\n\t\t\n\tif @expression.save_with_frbr\n\t \n\t # copying relationships\n\t success = true\n\t \n\t # FIXME do we need to clone access rights???\n\t # it seems that currently there is no UI for entering them???\n\t #expression_to_clone.expression_access_rights.each do |ar|\n\t # expression_access_right = ExpressionAccessRight.new\n\t # expression_access_right = ar.clone\n\t # expression_access_right.expression_id = @expression.id\n\t # \n\t # success = false if !expression_access_right.save\n\t #end\n\t \t \n\t # manifestations - it is requested to do not copy relationships with manifestations\n\t #expression_to_clone.manifestations.each do |m|\n\t #\tsuccess = false if !m.add_expression(@expression)\n\t #end\n\t \n\t # other relationships\n\t expression_to_clone.expression_relationships.each do |ex_relationship|\n\t \tsuccess = false if !RelationshipHelper.copy_frbr_relationships(@expression, ex_relationship, @login)\n\t end\n\t \n\t notice = 'Expression clone was successfully created.'\n\t notice += ' But some of the relationships failed to be copied.' if !success\n\t \n\t flash[:notice] = notice\n\t \n\t redirect_to :action => 'edit', :id => @expression\n\telse\n\t flash[:error] = 'Expression cloning has failed.'\n\t redirect_to :action => 'edit', :id => expression_to_clone.id\n\tend\t\t\t\n end", "def copy\n create_obj(obj.amoeba_dup)\n build_enabled(obj)\n\n #add (copy) suffix to name/title, etc.\n obj.send(obj.class.columns_for_table[0] + '=', obj.send(obj.class.columns_for_table[0]) + I18n.t('backend.copy_suffix'))\n end", "def edit(id, params = {})\n self.class.post(\"/paste/#{id}\", :body => params.merge(@base_params)).parsed_response\n end", "def notifyCutPerformed\n if (@CopiedSelection != nil)\n notifyRegisteredGUIs(:onCutPerformed, @CopiedSelection)\n @CopiedSelection = nil\n @CopiedMode = nil\n @CopiedID = nil\n end\n end", "def copy_reference\n @copy_reference ||= @data['copy_reference']\n end", "def copy_clipboard\r\n# Only administrators can perform this operation \r\n return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')\r\n# \r\n respond_to do |format|\r\n# just open new window to same url and come back with html request \r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n doc = dc_find_document(params[:table], params[:id], params[:ids])\r\n text = \"<br><br>[#{params[:table]},#{params[:id]},#{params[:ids]}]<br>\"\r\n render text: text + doc.as_document.to_json\r\n end\r\n \r\n end \r\nend", "def copy_missing_attributes_dcopy(in_hsh_copy_to, hsh_copy_from, attr_to_copy_list)\n\t\t\t\thsh_copy_to = deep_copy(in_hsh_copy_to)\n\t\t\t\treturn copy_missing_attributes(hsh_copy_to, hsh_copy_from, attr_to_copy_list)\n\t\t\tend", "def paste_attribute(entity)\n AttributeDialog.new(@@clipboard, entity)\n end", "def update\n respond_to do |format|\n if @copy.update(copy_params)\n format.html { redirect_to @copy, notice: \"Copy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @copy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @copy.errors, status: :unprocessable_entity }\n end\n end\n end", "def copyToClipboard _args\n \"copyToClipboard _args;\" \n end", "def paste\n if @yanked_items\n if current_item.directory?\n FileUtils.cp_r @yanked_items.map(&:path), current_item\n else\n @yanked_items.each do |item|\n if items.include? item\n i = 1\n while i += 1\n new_item = load_item dir: current_dir, name: \"#{item.basename}_#{i}#{item.extname}\", stat: item.stat\n break unless File.exist? new_item.path\n end\n FileUtils.cp_r item, new_item\n else\n FileUtils.cp_r item, current_dir\n end\n end\n end\n ls\n end\n end", "def set_taste\n @taste = Taste.find(params[:id])\n end", "def save_processed_data\n attachment.update(processed_data: json_parser.final_hash)\n end", "def copy_missing_attributes(hsh_copy_to, hsh_copy_from, attr_to_copy_list)\n\t\t\t\tattr_to_copy_list.each do |a_attr_to_copy|\n\t\t\t\t\tif hsh_copy_to[a_attr_to_copy].nil?\n\t\t\t\t\t\thsh_copy_to[a_attr_to_copy] = hsh_copy_from[a_attr_to_copy]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn hsh_copy_to\n\t\t\tend", "def store_in_history\n if current = @history.current\n current.cursor = @info.index('insert')\n current.yview = @info.yview[0]\n end\n end", "def clipboard\n IO.popen('pbcopy', 'w') {|f| f << selected_items.map(&:path).join(' ')} if osx?\n end", "def update\n respond_to do |format|\n if @pasteurizacion.update(pasteurizacion_params)\n format.html { redirect_to @pasteurizacion, notice: 'Pasteurización actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @pasteurizacion }\n else\n format.html { render :edit }\n format.json { render json: @pasteurizacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def keep_data\n new_kept_data = kept << Hanami::Utils::Json.generate({ count: 0, data: _data })\n\n update_kept(new_kept_data)\n end", "def tableViewSelectionDidChange(notification)\n\t puts \"Getting copies for item_id '#{@items_table.selectedRow}'...\" #DEBUG\n\t\tif @items_table.selectedRow < 0\n\t\t @copies = nil\n\t else\n\t\t item_id = @items[@items_table.selectedRow].id\n\t\t @copies = Copy.find_by_item_id(item_id) \n\t\tend\n\t @copies_table.reloadData\n\t puts \"Got copies...\" #DEBUG\n\tend", "def put *items\n clear\n flags = sync\n\n raise Error, 'pasteboard sync error' if (flags & MODIFIED) != 0\n raise Error, 'pasteboard not owned' if (flags & CLIENT_IS_OWNER) == 0\n\n items.each_with_index do |item, id|\n item.each do |flavor, data|\n put_item_flavor id, flavor, data\n end\n end\n\n self\n end", "def _change\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin._change\n @json_dict = @save_mixin.json_dict\n end", "def application_guard_block_clipboard_sharing\n return @application_guard_block_clipboard_sharing\n end", "def copy_attributes(other, duplicator)\n self.course = duplicator.options[:destination_course]\n self.default_reference_time = duplicator.duplicate(other.default_reference_time)\n\n other_reference_times = other.reference_times - [other.default_reference_time]\n self.reference_times = duplicator.duplicate(other_reference_times).unshift(default_reference_time)\n\n self.title = other.title\n self.description = other.description\n self.published = duplicator.options[:unpublish_all] ? false : other.published\n self.base_exp = other.base_exp\n self.time_bonus_exp = other.time_bonus_exp\n end", "def create\n @paste = Paste.new(params[:paste])\n\n respond_to do |format|\n if @paste.save\n flash[:notice] = 'Paste was successfully created.'\n format.html { redirect_to(@paste) }\n format.xml { render :xml => @paste, :status => :created, :location => @paste }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @paste.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index(paste_id = nil)\n if paste_id and paste_id.to_s.match(/\\d+/)\n redirect(R(:view, paste_id))\n end\n @title = \"Recent Pastes\"\n paste_entry_data = PasteEntry.order(:id.desc).filter(\"paste_body is not null and private is false and created_at > now()-'30 days'::text::interval\")\n @paste_entries = paginate(paste_entry_data, :limit => 25)\n end", "def filecopy(input)\n\tosascript <<-END\n\t\tdelay #{@moreimage}\n\t\tset the clipboard to POSIX file (\"#{input}\")\n\t\ttell application \"Copied\"\n\t\t\tsave clipboard\n\t\tend tell\n\tEND\nend", "def pasteLast\n copyFrame(@currentframe-1,@currentframe) if @currentframe>0\n end", "def put_copy_data(buffer, encoder=nil)\n\t\t# sync_put_copy_data does a non-blocking attept to flush data.\n\t\tuntil res=sync_put_copy_data(buffer, encoder)\n\t\t\t# It didn't flush immediately and allocation of more buffering memory failed.\n\t\t\t# Wait for all data sent by doing a blocking flush.\n\t\t\tres = flush\n\t\tend\n\n\t\t# And do a blocking flush every 100 calls.\n\t\t# This is to avoid memory bloat, when sending the data is slower than calls to put_copy_data happen.\n\t\tif (@calls_to_put_copy_data += 1) > 100\n\t\t\t@calls_to_put_copy_data = 0\n\t\t\tres = flush\n\t\tend\n\t\tres\n\tend", "def updated_data; end", "def copy\n out = ''\n\n Selection.each do |dd|\n docu = dd.cite_key.get\n docu.strip!\n out << \"[@#{docu}] \"\n end\n\n pbcopy(out.strip)\n growl(\"#{Selection.size} citation references copied to the clipboard\")\nend", "def cmvc_extract_changed rmap\n\n raise \"oops, not done\"\nend", "def notifyObjectsCut(iSelection, iCopyID)\n # First notify to uncopy the previous\n notifyCancelCopy\n @CopiedSelection = iSelection\n @CopiedMode = Wx::ID_CUT\n @CopiedID = iCopyID\n notifyRegisteredGUIs(:onObjectsCut, @CopiedSelection)\n end", "def copy\n\n # FIXME: #copy, #cut and #paste really shouldn't use platform-\n # dependent keypresses like this. But until DSK-327491 is fixed,\n # this will have to do.\n if OperaWatir::Platform.os == :macosx\n keys.send [:command, 'c']\n else\n keys.send [:control, 'c']\n end\n end", "def pasteLast\r\n copyFrame(@currentframe-1,@currentframe) if @currentframe>0\r\n end" ]
[ "0.6556504", "0.6266512", "0.6260949", "0.6010856", "0.5838971", "0.565641", "0.5603806", "0.5584658", "0.55414116", "0.5447438", "0.5418756", "0.5350992", "0.53120136", "0.5266666", "0.5259538", "0.5197974", "0.5162856", "0.51485205", "0.5080953", "0.5080953", "0.5080953", "0.5080953", "0.50670636", "0.5038375", "0.5001385", "0.49635106", "0.4924273", "0.48825806", "0.48652932", "0.48652932", "0.48652932", "0.4827762", "0.48102507", "0.478738", "0.47571036", "0.475631", "0.47416618", "0.46908298", "0.46728915", "0.4662761", "0.46495578", "0.46451178", "0.46352267", "0.46322796", "0.46133637", "0.460978", "0.4609608", "0.4601339", "0.4576081", "0.45753452", "0.45551774", "0.45349866", "0.45273605", "0.45243692", "0.4520087", "0.45169076", "0.45028067", "0.44207728", "0.4407051", "0.43940854", "0.43882817", "0.43858188", "0.43842334", "0.4379683", "0.43795347", "0.43783772", "0.43707505", "0.43688604", "0.43625805", "0.43604514", "0.43478948", "0.4332149", "0.43200296", "0.4315208", "0.43053687", "0.42985383", "0.42871073", "0.4286511", "0.42806396", "0.42725065", "0.4247156", "0.42418393", "0.42369196", "0.423467", "0.42343068", "0.42306656", "0.4218704", "0.42140993", "0.42048886", "0.4204709", "0.42037457", "0.41987962", "0.41884443", "0.41864043", "0.41772467", "0.41766548", "0.41754642", "0.41708812", "0.4165454", "0.41645968", "0.41618323" ]
0.0
-1
Processes one document. Subroutine of paste_clipboard.
def process_document(line, table, id, ids) if params[:do_update] == '1' doc = dc_find_document(table, id, ids) # document found. Update it and return if doc doc.update( update_json(ActiveSupport::JSON.decode(line), true) ) msg = dc_check_model(doc) return (msg ? " ERROR! #{msg}" : " UPDATE. OK.") end end # document will be added to collection if ids.to_s.size > 5 #TODO Add embedded document " NOT SUPPORTED YET!" else doc = table.classify.constantize.new( update_json(ActiveSupport::JSON.decode(line)) ) doc.save end msg = dc_check_model(doc) msg ? " ERROR! #{msg}" : " NEW. OK." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process!(document); end", "def migrate_document(document, dest)\n index = index_of_document(document)\n return if index.nil? or not dest.is_a? Notebook\n\n drag_stop\n Gtk::grab_remove(self)\n remove_document(document)\n\n dest.instance_eval do\n add_document(document)\n drag_start\n @drag_info.document = document\n @drag_info.motion_handler = signal_connect('motion-notify-event') do\n |widget, event|\n motion_notify_cb(event)\n end\n end\n end", "def paste_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n result = ''\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.html { return render('paste_clipboard', layout: 'cms') }\r\n format.json {\r\n table, id, ids = nil\r\n params[:data].split(\"\\n\").each do |line|\r\n line.chomp!\r\n next if line.size < 5 # empty line. Skip\r\n\r\n begin\r\n if line[0] == '[' # id(s)\r\n result << \"<br>#{line}\"\r\n line = line[/\\[(.*?)\\]/, 1] # just what is between []\r\n table, id, ids = line.split(',')\r\n elsif line[0] == '{' # document data\r\n result << process_document(line, table, id, ids)\r\n end\r\n rescue Exception => e \r\n result << \" Runtime error. #{e.message}\\n\"\r\n break\r\n end\r\n end\r\n }\r\n end\r\n dc_render_ajax(div: 'result', value: result )\r\nend", "def post_process(doc)\n doc\n end", "def assign_current_document!; end", "def receive_document(doc)\n folder.documents << doc\n end", "def paste_clipboard\r\n# Only administrators can perform this operation \r\n return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')\r\n \r\n result = ''\r\n respond_to do |format|\r\n# just open new window to same url and come back with html request \r\n format.html { return render('paste_clipboard', layout: 'cms') }\r\n format.json {\r\n table, id, ids = nil\r\n params[:data].split(\"\\n\").each do |line|\r\n line.chomp!\r\n next if line.size < 5 # empty line. Skip\r\n begin\r\n if line[0] == '[' # id(s)\r\n result << \"<br>#{line}\"\r\n line = line[/\\[(.*?)\\]/, 1] # just what is between []\r\n table, id, ids = line.split(',')\r\n elsif line[0] == '{' # document data\r\n result << process_document(line, table, id, ids)\r\n end\r\n rescue Exception => e \r\n result << \" Runtime error. #{e.message}\\n\"\r\n break\r\n end\r\n end\r\n }\r\n end\r\n dc_render_ajax(div: 'result', value: result )\r\nend", "def do_clipboard_paste\n dat = if Wx::PLATFORM == \"WXMAC\" \n # XXX i feel dirty\n `pbpaste`\n else\n dobj=RawDataObject.new\n Wx::Clipboard.open {|clip| clip.fetch dobj}\n dobj.raw_data\n end\n\n self.gui_set_value(self.cur_pos, dat) if dat and dat.size > 0\n end", "def do_copy\n @editor.value = @current_copycode\n @editor.focus\n end", "def notifyClipboardContentChanged\n updateCommand(Wx::ID_PASTE) do |ioCommand|\n if (@Clipboard_CopyMode == nil)\n # The clipboard has nothing interesting for us\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n # Cancel eventual Copy/Cut pending commands\n notifyCancelCopy\n # Notify everybody\n notifyRegisteredGUIs(:onClipboardContentChanged)\n elsif (@Clipboard_CopyMode == Wx::ID_DELETE)\n # Check that this message is adressed to us for real (if many instances of PBS are running, it is possible that some other instance was cutting things)\n if (@CopiedID == @Clipboard_CopyID)\n # Here we have to take some action:\n # Delete the objects marked as being 'Cut', as we got the acknowledge of pasting it somewhere.\n if (@CopiedMode == Wx::ID_CUT)\n if (!@Clipboard_AlreadyProcessingDelete)\n # Ensure that the loop will not come here again for this item.\n @Clipboard_AlreadyProcessingDelete = true\n executeCommand(Wx::ID_DELETE, {\n :parentWindow => nil,\n :selection => @CopiedSelection,\n :deleteTaggedShortcuts => false,\n :deleteOrphanShortcuts => false\n })\n # Then empty the clipboard.\n Wx::Clipboard.open do |ioClipboard|\n ioClipboard.clear\n end\n # Cancel the Cut pending commands.\n notifyCutPerformed\n notifyRegisteredGUIs(:onClipboardContentChanged)\n @Clipboard_AlreadyProcessingDelete = false\n end\n else\n log_bug 'We have been notified of a clipboard Cut acknowledgement, but no item was marked as to be Cut.'\n end\n end\n # Deactivate the Paste command\n ioCommand[:Enabled] = false\n ioCommand[:Title] = 'Paste'\n else\n lCopyName = nil\n case @Clipboard_CopyMode\n when Wx::ID_CUT\n lCopyName = 'Move'\n when Wx::ID_COPY\n lCopyName = 'Copy'\n else\n log_bug \"Unsupported copy mode from the clipboard: #{@Clipboard_CopyMode}.\"\n end\n if (@Clipboard_CopyID != @CopiedID)\n # Here, we have another application of PBS that has put data in the clipboard. It is not us anymore.\n notifyCancelCopy\n end\n if (lCopyName != nil)\n # Activate the Paste command with a cool title\n ioCommand[:Enabled] = true\n ioCommand[:Title] = \"Paste #{@Clipboard_SerializedSelection.getDescription} (#{lCopyName})\"\n else\n # Deactivate the Paste command, and explain why\n ioCommand[:Enabled] = false\n ioCommand[:Title] = \"Paste (invalid type #{@Clipboard_CopyMode}) - Bug ?\"\n end\n notifyRegisteredGUIs(:onClipboardContentChanged)\n end\n end\n end", "def process\n self.read_layouts\n self.transform_pages\n if options['also_copy']\n self.transform_pages('', options['also_copy'])\n end\n self.write_posts\n end", "def copy\n out = ''\n\n Selection.each do |dd|\n docu = dd.cite_key.get\n docu.strip!\n out << \"[@#{docu}] \"\n end\n\n pbcopy(out.strip)\n growl(\"#{Selection.size} citation references copied to the clipboard\")\nend", "def postprocess(document)\n WRAP.match(document)[1].gsub(P_BREAKS, '<br><br>').delete \"\\n\"\n rescue\n document\n end", "def paste; clipboard_paste; end", "def postprocess(document)\n document.gsub(\"\\n\", ' ').strip\n end", "def do_clip(pagename, titletxt, onlytext = false)\n pagepath = (\"#{Wiki_path}/data/pages/#{clean_pagename(pagename)}.txt\").gsub(\":\",\"/\")\n\n curpage = cururl.split(\"/\").last\n sel = has_selection\n\n # format properly if citation\n unless onlytext\n if curpage.index(\"ref:\")\n curpage = \"[@#{curpage.split(':').last.downcase}]\"\n elsif cururl.index(\"localhost/wiki\")\n curpage = \"[[:#{capitalize_word(curpage.gsub(\"_\", \" \"))}]]\"\n else\n title = (titletxt ? titletxt : curtitle)\n curpage =\"[[#{cururl}|#{title}]]\"\n end\n else\n curpage = ''\n end\n\n insert = (sel ? \"#{sel} \" : \" * \" ) # any text, or just a link (bullet list)\n insert.gsubs!( {:all_with=> \"\\n\\n\"}, \"\\n\", \"\\n\\n\\n\" )\n\n if File.exists?(pagepath)\n prevcont = File.read(pagepath)\n\n haslinks = prevcont.match(/\\-\\-\\-(\\n \\*[^\\n]+?)+?\\Z/m) # a \"---\"\" followed by only lines starting with \" * \"\n\n # bullet lists need an extra blank line after them before the \"----\"\n if sel\n divider = (haslinks ? \"\\n\\n----\\n\" : \"\\n----\\n\")\n else\n divider = (haslinks ? \"\\n\" : \"\\n----\\n\")\n end\n\n growltext = \"Selected text added to #{pagename}\"\n else\n prevcont = \"h1. #{capitalize_word(pagename)}\\n\\n\"\n growltext = \"Selected text added to newly created #{pagename}\"\n end\n filetext = [prevcont, divider, insert, curpage].join\n dwpage(pagename, filetext)\n\n growl(\"Text added\", growltext)\nend", "def process\n begin\n @pdf = document.slug + '.pdf'\n pdf_contents = asset_store.read_pdf document\n File.open(@pdf, 'wb') {|f| f.write(pdf_contents) }\n case input['task']\n when 'text' then process_text\n when 'images' then process_images\n end\n rescue Exception => e\n LifecycleMailer.exception_notification(e,options).deliver_now\n raise e\n end\n document.id\n end", "def copy_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n table = CmsHelper.table_param(params)\r\n doc = dc_find_document(table, params[:id], params[:ids])\r\n text = '<style>body {font-family: monospace;}</style><pre>'\r\n text << \"JSON:<br>[#{table},#{params[:id]},#{params[:ids]}]<br>#{doc.as_document.to_json}<br><br>\"\r\n text << \"YAML:<br>#{doc.as_document.to_hash.to_yaml.gsub(\"\\n\", '<br>')}</pre>\"\r\n render plain: text\r\n end\r\n end \r\nend", "def copy_to_clipboard\n end", "def current_document=(_arg0); end", "def do_clipboard_cut\n if do_clipboard_copy()\n pos = @selection.first\n self.gui_set_value(nil, '')\n self.cur_pos = pos\n end\n end", "def sprint_process_text(doc)\n # there is at least one <pre> with MMS text if text has been included by\n # the user. (note) we'll have to verify that if they attach multiple texts \n # to the MMS then Sprint stacks it up in multiple <pre>'s. The only <pre> \n # tag in the document is for text from the user.\n doc.search(\"/html/body//pre\").each do |pre|\n type = 'text/plain'\n text = pre.inner_html.strip\n next if text.empty?\n type, text = transform_text(type, text)\n type, file = sprint_write_file(type, text.strip)\n add_file(type, file) unless type.nil? || file.nil?\n end\n end", "def pbcopy(text)\n # work around, ' wrecks havoc on command line, but also caused some weird regexp substitution\n rtf = text.index('{\\rtf1')\n File.open(\"/tmp/script.scpt\", 'w') do |f|\n if rtf\n f << text\n else\n f << \"set the clipboard to \\\"#{text}\\\"\"\n end\n end\n if rtf\n `cat /tmp/script.scpt | pbcopy -Prefer rtf`\n else\n `osascript /tmp/script.scpt`\n end\nend", "def paste\n # no authorization applied as the method must always render\n if @section.changeable?(current_visitor)\n @original = clipboard_object(params)\n if @original\n @container = params[:container] || 'section_pages_list'\n if @original.class == Page\n @component = @original.duplicate\n else\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @component.name = \"copy of #{@original.name}\"\n end\n if (@component)\n # @component.original = @original\n @component.section = @section\n @component.save\n end\n @component.deep_set_user current_visitor\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'page_list_item', :locals => {:page => @component})\n page.sortable :section_pages_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_pages', :params => {:section_id => @section.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def clip_again\n a = File.read(\"/tmp/dokuwiki-clip.tmp\")\n page, url, title, onlytext_s = a.split(\"\\n\")\n onlytext = (onlytext_s == 'true' && has_selection)\n\n title = curtitle if (title.strip == \"\") || (url != cururl)\n\n do_clip(page, title, onlytext)\nend", "def do_clipboard_copy\n return nil unless sel=@selection and dat=@data[sel]\n # XXX i feel dirty\n if Wx::PLATFORM == \"WXMAC\"\n IO.popen(\"pbcopy\", \"w\") {|io| io.write dat}\n stat = $?.success?\n else\n dobj = RawDataObject.new(dat)\n stat = Wx::Clipboard.open {|clip| clip.place dobj}\n end\n return stat\n end", "def show\n @clipboard = find_clipboard\n end", "def on_end_document\n end", "def copy_clipboard\r\n# Only administrators can perform this operation \r\n return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')\r\n# \r\n respond_to do |format|\r\n# just open new window to same url and come back with html request \r\n format.json { dc_render_ajax(operation: 'window', url: request.url ) }\r\n \r\n format.html do\r\n doc = dc_find_document(params[:table], params[:id], params[:ids])\r\n text = \"<br><br>[#{params[:table]},#{params[:id]},#{params[:ids]}]<br>\"\r\n render text: text + doc.as_document.to_json\r\n end\r\n \r\n end \r\nend", "def collapse_document(doc); end", "def copyFromClipboard \n \"copyFromClipboard\" \n end", "def paste_from_clipboard(page_id, element, method, position)\n element_copy = copy(element, :page_id => page_id)\n element_copy.insert_at(position)\n if method == \"move\" && element_copy.valid?\n element.destroy\n end\n element_copy\n end", "def copy(content)\n cmd = case true\n when system(\"type pbcopy > /dev/null 2>&1\")\n :pbcopy\n when system(\"type xclip > /dev/null 2>&1\")\n :xclip\n when system(\"type putclip > /dev/null 2>&1\")\n :putclip\n end\n\n if cmd\n IO.popen(cmd.to_s, 'r+') { |clip| clip.print content }\n end\n\n content\n end", "def copy(content)\n cmd = case true\n when system(\"type pbcopy > /dev/null 2>&1\")\n :pbcopy\n when system(\"type xclip > /dev/null 2>&1\")\n :xclip\n when system(\"type putclip > /dev/null 2>&1\")\n :putclip\n end\n\n if cmd\n IO.popen(cmd.to_s, 'r+') { |clip| clip.print content }\n end\n\n content\n end", "def pbpaste\n Clipboard.paste\nend", "def process_html(document)\n\t\t\t\n\t\t\t# Add link and raw HTML to a hash as key/value\n\t\t\t# for later storage in database\n\t\t\tunless @raw_html.has_value?(document)\n\t\t \t\tprint \".\"\n\t\t \t\t@raw_html[@document.base_uri.to_s] = document\n\t\t\tend\n\t\t\t\t\n\t\tend", "def collect_document(input, output)\r\n inputs=input.map{|xx| xx.esc.to_osPath }.join(\" \") # qoute cond combine the inputs\r\n\r\n #now combine the input files\r\n @log.info(\"combining the input files\")\r\n cmd=\"pandoc -s -S -o #{output} --ascii #{inputs}\" # note that inputs is already quoted\r\n system(cmd)\r\n if $?.success? then\r\n PandocBeautifier.new().beautify(output)\r\n end\r\n end", "def accept_document document\n document.parts.each do |item|\n case item\n when RDoc::Markup::Document then # HACK\n accept_document item\n else\n item.accept self\n end\n end\n end", "def on_start_document\n end", "def apply!(document)\n @processors.each do |pn|\n prc = Mdoc.get_processor(pn)\n prc.new.pre_processors.each { |p| document.apply!(p) }\n document.apply!(prc)\n prc.new.post_processors.each { |p| document.apply!(p) }\n end\n\n writer.new.process!(document)\n end", "def on_start_document() end", "def handle_document(response_doc)\n doc_content = extract_content(response_doc)\n doc_id = store_document(doc_content, @link_id) unless doc_content.blank? || doc_content.length < 200\n doc = Nokogiri::HTML(response_doc)\n extract_and_store_links(doc)\n extract_and_store_emails(doc)\n extract_and_store_images(doc)\n return doc_id\n end", "def postprocess(full_document)\n full_document.gsub(/^-(\\*+)/m, '\\1')\n\tend", "def create\n @document = Document.find(params[:document_id])\n #未入力処理\n if params[:content].blank?\n flash[:danger] = \"必ず入力してください。\" \n redirect_to \"/documents_items/new/\"+@document.id.to_s\n else\n @documents = Document.where(memo: @document.memo,randam: @document.randam) #メモの内容 ランダム文字列で判別\n randam = SecureRandom.alphanumeric(10)\n @documents.each do |document|\n record = document.document_items.build(content: params[:content])\n record.randam = randam\n record.document_id = document.id\n record.save\n end\n @document_item = DocumentItem.all.last\n redirect_to \"/documents_selects/new/\"+@document_item.id.to_s\n end \n end", "def document\n capture_args\n capture_return\n super\n end", "def copyToClipboard _args\n \"copyToClipboard _args;\" \n end", "def create\n @document = Document.new()\n @document.process params[:document][:file]\n \n respond_to do |format|\n if @document.save\n format.html { redirect_to :action => :index , notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end", "def cmd_clip reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding clipboard content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date, \n :add_line, \n :add_line, \n :inject_clipboard\n\n end", "def paste\n\t\t\t$ruvim.insert $ruvim.buffers[:copy].data\n\t\t\t$ruvim.editor.redraw\n\t\tend", "def start_document; end", "def start_document; end", "def copy(content)\n case RUBY_PLATFORM\n when /darwin/\n return content if `which pbcopy`.strip == ''\n IO.popen('pbcopy', 'r+') { |clip| clip.print content }\n when /linux/\n return content if `which xclip 2> /dev/null`.strip == ''\n IO.popen('xclip', 'r+') { |clip| clip.print content }\n when /i386-cygwin/\n return content if `which putclip`.strip == ''\n IO.popen('putclip', 'r+') { |clip| clip.print content }\n end\n\n content\n end", "def create\n\t \n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n @document = Document.new(doc_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def end_document; end", "def end_document; end", "def copy(element)\n puts element.text\nend", "def copy(dest)\n raise ArgumentError, \"doc.database required to copy\" unless database\n result = database.copy_doc(self, dest)\n result['ok']\n end", "def process_doc_or_page(doc)\n site_hostname = URI(doc.site.config['url']).host\n\n # TODO: Read anchor_contents from site config\n anchor_contents = \"<i class='fas fa-link'></i>\"\n\n unless doc.respond_to?(:asset_file?) and doc.asset_file?\n if doc.respond_to?(:id)\n if $processed_urls.include? doc.id\n return\n end\n $processed_urls << doc.id\n end\n doc.output = process_content(site_hostname, doc.output, anchor_contents)\n end\nend", "def on_start_document\n STDOUT << \"on_start_document\\n\"\n STDOUT.flush\n end", "def process\n self.queue[self.default] = self.file\n begin\n self.processors.each do |processor|\n processor = Attached::Processor.processor(processor)\n self.styles.each do |style, options|\n self.queue[style] = processor.process(self.queue[style] || self.file, options, self)\n end\n end\n rescue Attached::Processor::Error => error\n self.errors << error.message\n end\n end", "def post_process(doc)\n doc.gsub(\"\\n\",'')\n end", "def display document\n page do |io|\n text = document.accept formatter(io)\n io.write text\n end\n end", "def process_pdi(*args)\n @doc.process_pdi(self, *args)\n end", "def filecopy(input)\n\tosascript <<-END\n\t\tdelay #{@moreimage}\n\t\tset the clipboard to POSIX file (\"#{input}\")\n\t\ttell application \"Copied\"\n\t\t\tsave clipboard\n\t\tend tell\n\tEND\nend", "def document(file, line)\n @doc_extractor = lambda{|cmd, opts|\n text = RubyTools::extract_file_rdoc(file, line, true)\n cmd.instance_eval(\"%Q{#{text}}\", file, line)\n }\n end", "def copy_bbcode(no_page = 0)\n @pages[no_page].copy_bbcode\n end", "def check_clipboard\n value = @clipboard.read\n return unless value\n\n links = @parser.parse(value)\n return if links.empty?\n\n @filter.filter(links) do |link|\n $log.debug(\"adding #{link}\")\n entry = LinkTable::Entry.new(link)\n @link_table.add(entry)\n @resolver_manager.add(entry, link)\n end\n end", "def process_text!\n return if self.processed || self.image.blank?\n\n tesseract_image = RTesseract.new(self.image.path, psm: 4)\n self.box_data = RTesseract::Box.new(self.image.path, psm: 4).words\n self.pdf = File.open(tesseract_image.to_pdf) if File.exist?(tesseract_image.to_pdf)\n self.text = tesseract_image.to_s.downcase\n self.line_count = self.text.split(\"\\n\").size\n\n ReceiptParser.new(self).process\n\n self.processed = true\n self.save!\n end", "def display document\n page do |io|\n f = formatter(io)\n f.width = @width if @width and f.respond_to?(:width)\n text = document.accept f\n\n io.write text\n end\n end", "def textcopy(input)\n\tosascript <<-END\n\t\ttell application \"Copied\"\n\t\t\tsave \"#{input}\"\n\t\tend tell\n\tEND\nend", "def create\n \n forbidden unless current_account_user.create_legal_document\n if params[:transloadit]\n documents = TransloaditDocumentsParser.parse params[:transloadit], @account.id\n if documents\n documents.each do |document|\n \n CatalogsDocuments.where(catalog_id: @catalog.id, document_id: document.id)\n .first_or_create(catalog_id: @catalog.id, document_id: document.id)\n \n DocumentExtractTextWorker.perform_async( document.id )\n end\n end\n end\n redirect_to catalog_account_catalog_documents_path(@account, @catalog)\n \n end", "def process(orig_file)\n end", "def run\n run_newline while @raw_lines.any?\n\n # When we've finished parsing the document,\n # if we were still reading content,\n # read that line into the transcript.\n insert_into_transcript if @line_temp[:reading]\n end", "def render_document; end", "def process_document(line, table, id, ids)\r\n if params[:do_update] == '1' \r\n doc = dc_find_document(table, id, ids)\r\n # document found. Update it and return\r\n if doc\r\n doc.update( update_json(ActiveSupport::JSON.decode(line), true) )\r\n msg = dc_check_model(doc)\r\n return (msg ? \" ERROR! #{msg}\" : \" UPDATE. OK.\")\r\n end\r\n end\r\n # document will be added to collection\r\n if ids.to_s.size > 5\r\n #TODO Add embedded document\r\n \" NOT SUPPORTED YET!\"\r\n else\r\n doc = table.classify.constantize.new( update_json(ActiveSupport::JSON.decode(line)) )\r\n doc.save\r\n end\r\n msg = DrgCms.model_check(doc)\r\n msg ? \" ERROR! #{msg}\" : \" NEW. OK.\" \r\nend", "def postprocess(doc)\n normalise_headings(doc)\n find_short_title(doc)\n link_definitions(doc)\n nest_blocklists(doc)\n\n doc\n end", "def create\n @copy_text = CopyText.new(params[:copy_text])\n @page_section = @copy_text.build_page_section(params[:page_section])\n \n @page = @page_section.page\n @site_section = @page.site_section\n\n respond_to do |format|\n if @copy_text.save\n flash[:notice] = 'CopyText was successfully created.'\n format.html { redirect_to site_section_page_url(@site_section, @page) }\n format.xml { render :xml => @copy_text, :status => :created, :location => @copy_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @copy_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def paste\n # no authorization applied as the method must always render\n if @activity.changeable?(current_visitor)\n @original = clipboard_object(params)\n if (@original)\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at], :include => :pages\n if (@component)\n # @component.original = @original\n @container = params[:container] || 'activity_sections_list'\n @component.name = \"copy of #{@component.name}\"\n @component.deep_set_user current_visitor\n @component.activity = @activity\n @component.save\n end\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'section_list_item', :locals => {:section => @component})\n page.sortable :activity_sections_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_sections', :params => {:activity_id => @activity.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end", "def end_document\n # postprocess @text to remove trailing spaces on lines\n @text = @text.split(\"\\n\").map(&:strip).join(\"\\n\")\n # remove trailing whitespace at end of buffer\n @text.strip!\n end", "def clipboard\n IO.popen('pbcopy', 'w') {|f| f << selected_items.map(&:path).join(' ')} if osx?\n end", "def client_new_doc\n data = params\n cid = current_company.id\n @return_path = data[:return_path]\n @return_path = request.headers['HTTP_REFERER'] if @return_path.blank?\n @matter = Matter.scoped_by_company_id(cid).find(params[:id])\n @document_home = DocumentHome.new\n @document = @document_home.documents.build\n @mapable_id = data[:id]\n @mapable_type = 'Matter'\n @task= MatterTask.scoped_by_company_id(cid).find(data[:task_id] ) if data[:task_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_home }\n end\n end", "def create\n @document = @instruction.documents.build(document_params)\n authorize @document\n disable_primary if @document.primary\n respond_to do |format|\n if @document.save\n format.html { redirect_to @instruction, notice: t('documents.create.success') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end", "def update\n @document = Document.where(\"user_id = ? and id = ?\",current_user.id,params[:id]).first\n assignment = @document.assignment\n respond_to do |format|\n if assignment.editable?(current_user)\n @document.content = params[:document][:content]\n if @document.save\n @autopreview = @document\n unless params[:autopreview]\n format.js { render \"shared/save_success\" }\n else\n format.js { render \"shared/autopreview\" }\n end\n else\n format.js { render \"shared/save_failed\" }\n end\n else\n format.js { render \"shared/pastdue\" }\n end\n end\n end", "def on_end_document\n STDOUT << \"on_end_document\\n\"\n STDOUT.flush\n end", "def assign_current_document!\n payload[\"site\"].current_document = document\n end", "def append(document)\n with_add_callbacks(document, already_related?(document)) do\n _target.push(document)\n characterize_one(document)\n bind_one(document)\n end\n end", "def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend", "def duplicate!(recipient=nil, options={})\n Document.transaction do\n # Clone the document.\n newattrs = attributes.dup.merge({\n :access => PENDING,\n :created_at => Time.now,\n :updated_at => Time.now\n })\n newattrs.delete('id')\n newattrs[:account_id] = recipient.id if recipient\n newattrs[:organization_id] = recipient.organization.id if recipient and not newattrs[:organization_id]\n copy = Document.create!(newattrs.merge({:hit_count => 0, :detected_remote_url => nil}))\n newattrs = {:document_id => copy.id}\n\n # Clone the docdata.\n if docdata and options['include_docdata']\n Docdata.create! document_id: copy_id, data: docdata.data.dup\n end\n\n # Clone the associations.\n associations = [entities, entity_dates, pages]\n associations.push sections if options['include_sections']\n # Copy all notes that are visible by either the document owner or the recipient\n account_context = options['as_owner'] ? self.account : recipient\n associations.push annotations.accessible(account_context) if options['include_annotations']\n # Copy the new document into all of the same projects as the old document\n associations.push project_memberships if options['include_project']\n associations.each do |association|\n association.each do |model|\n model_attrs = model.attributes.dup.merge newattrs\n model_attrs.delete('id')\n model.class.create! model_attrs\n end\n end\n\n # Clone the assets.\n DC::Store::AssetStore.new.copy_assets(self, copy, self.access)\n\n # Reindex, set access.\n copy.index\n copy.set_access access\n\n copy\n end\n end", "def create\n @document = Document.new(document_params)\n @document.document_type_id = get_document_type(params[\"document\"][\"auto_process_type\"])\n respond_to do |format|\n if @document.save\n # download file\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n if params[\"document\"][\"auto_process_type\"] == \"slice\"\n get_gazette_document_type_id #this is maybe a misplaced and useless call to this method, delete later?\n file.download \"tmp/gazette.pdf\"\n slice_gazette @document, Rails.root.join(\"tmp\") + \"gazette.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva gaceta seccionada en Valid! \" + @document.publication_number + \" :scroll:\")\n end\n format.html { redirect_to gazette_path(@document.publication_number), notice: 'La gaceta se ha partido exitósamente.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"process\"\n file.download \"tmp/gazette.pdf\"\n process_gazette @document, Rails.root.join(\"tmp\") + \"gazette.pdf\"\n if $discord_bot\n publication_number = \"\"\n publication_number = @document.publication_number if @document.publication_number\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva gaceta en Valid! \" + publication_number + \" :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido una gaceta.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"judgement\"\n JudgementAuxiliary.create(document_id: @document.id, applicable_laws: \"\")\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido una sentencia.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"seccion\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/seccion_de_gaceta.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"seccion_de_gaceta.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva Sección de Gaceta subida en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Avisos Legales.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"avisos\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/avisos_legales.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"avisos_legales.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevos avisos legales subidos en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Avisos Legales.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"marcas\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/marcas.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"marcas.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevas Marcas de Fábrica subidas en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Marcas de Fábrica.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"autos\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/auto_acordado.pdf\"\n slice_autos_acordados @document, Rails.root.join(\"tmp\") + \"auto_acordado.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevos autos acordados seccionados en Valid! :scroll:\")\n end\n format.html { redirect_to documents_path+\"?autos=true\", notice: 'Autos acordados se han partido exitosamente.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"formats\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/formato.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"formato.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo formato subido a Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un nuevo formato.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"comunicados\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/comunicado.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"comunicado.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo comunicado subido a Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un nuevo comunicado.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"others\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/documento.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"documento.pdf\"\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un documento.' }\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo documento subido a Valid! :scroll:\")\n end\n else\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un documento.' }\n end\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy(group, snippet = nil)\n content = Accio::Parser.read\n matches = content.search(group, snippet)\n matches.each do |match|\n match.snippets.each do |submatch|\n # Copy code to clipboard.\n Clipboard.copy submatch.code.text.gsub(/^$\\n/, '')\n\n # Format the output and display it.\n Accio::Formatter.template(\n match.title, submatch.title, submatch.comment, submatch.code\n )\n end\n end\n puts \"The last found code snippet has been copied to the clipboard\"\n end", "def show\n send_data(@document.file_contents,\n type: @document.content_type,\n filename: @document.filename)\n end", "def copy_bbcode\n str = EventPrinter::BBcode::head(@event.printed_name)\n str << (@list.map { |e| e.bbcode }).join(\"\\n\")\n str << EventPrinter::BBcode::foot\n Win32API.push_text_in_clipboard(str.to_ascii << \"\\0\")\n end", "def ris(document)\n\t\t\tprint \".\"\n\t\t\t# Store raw HTML into local variable\n\t\t\t# Based on MIME type, invoke the proper processing modules\n\t\t\tcase document.content_type\n\t\t\t\twhen \"text/html\"\n\t\t\t\t\tlink_extractor(document)\n\t\t\t\t\tprocess_html(document)\n\t\t\t\t\tpage_meta(document)\n\t\t\t\telse\n\t\t\t\t\tprint \"... not HTML, skipping...\"\n\t\t\tend\n\t\tend", "def show\n Iconv.open('UTF-8//IGNORE', 'UTF-8') do |ic|\n @document[:content] = ic.iconv(File.open(@document.attachment.path, 'r').read)\n end\n end", "def transfer_file_to_repository\n @title = params[:title]\n @committee_id = params[:committee_id]\n @committee = Committee.find(@committee_id)\n @documents = params[:document]\n if @documents != nil\n @documents.each_pair do |document_name, category_type|\n #if no selection, then skip\n next if category_type == \"no selection\"\n @doc = Document.find_by(:title => document_name, :committee_id => @committee_id)\n next if @doc.transfer == true\n \n @category = Category.find_by(:name => category_type)\n @doc.update_attribute(:category, @category)\n @doc.update_attribute :transfer, true\n \n if @doc.mail_record\n @doc.mail_record.update_attributes(:description => \"transfer\", :category => @category)\n else\n @doc.create_mail_record(:description => \"transfer\", :committee => @committee, :category => @category)\n end\n \n if Rails.env.production?\n send_document_transfer_email(@doc)\n end\n \n flash[:notice] = \"Documents were successfully transferred to Document Repository\"\n end\n end\n redirect_to subcommittee_index_path(@committee_id)\n end", "def capture(&block)\n begin\n original_doc = @doc\n @doc = HtmlParts.new\n yield\n raw(@doc.to_s)\n ensure\n @doc = original_doc\n end\n end", "def show\n send_data(@document.file_content,\n type: @document.content_type,\n filename: @document.filename)\n end", "def run\n\t\t\t\tif save_file\n\t\t\t\t\tdoc = Nokogiri::HTML(open(@file,\"r\"))\n\t\t\t\t\tparse_page(doc)\n\t\t\t\t\tflush_page\n\t\t\t save_words\n\t\t\t end\n\t\t\tend" ]
[ "0.6454161", "0.58620805", "0.5738688", "0.5667096", "0.56233996", "0.5582197", "0.55490196", "0.5460744", "0.54331607", "0.54311657", "0.5428034", "0.54224175", "0.5403478", "0.54030055", "0.5364919", "0.53569734", "0.5316535", "0.52958083", "0.52769715", "0.5230709", "0.52306813", "0.52180934", "0.5216151", "0.51909286", "0.5158836", "0.5134388", "0.51305956", "0.5130518", "0.5080296", "0.5073671", "0.5041685", "0.5019784", "0.50100136", "0.50100136", "0.50069106", "0.4989147", "0.49817702", "0.49806088", "0.49787918", "0.4972332", "0.4962423", "0.49323732", "0.49255973", "0.49095312", "0.4908682", "0.49056062", "0.49014363", "0.49000347", "0.48968846", "0.48739463", "0.48444524", "0.48444524", "0.4841717", "0.48395512", "0.4824867", "0.4824867", "0.48170316", "0.48144293", "0.4795072", "0.47771367", "0.47755247", "0.47701734", "0.47672957", "0.4752372", "0.47215837", "0.47168002", "0.471664", "0.47158778", "0.47107556", "0.46849126", "0.4674278", "0.46638533", "0.46530262", "0.46523735", "0.46465233", "0.46449283", "0.46392328", "0.46318993", "0.46276724", "0.462326", "0.4617437", "0.4613835", "0.46070752", "0.46050113", "0.45991886", "0.45965847", "0.4590752", "0.45892242", "0.4587227", "0.45830768", "0.45800358", "0.45715424", "0.45707124", "0.45637363", "0.45633072", "0.45611393", "0.45535415", "0.45425782", "0.45299795", "0.45281953" ]
0.46077505
82
Clears all session data related to login.
def clear_login_data session[:edit_mode] = 0 session[:user_id] = nil session[:user_name] = nil session[:user_roles] = nil cookies.delete :remember_me end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_session\n @session = @login_info = nil\n end", "def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend", "def clear_any_logged_in_session\n if logged_in?\n session[:user] = nil\n session[:user_id] = nil\n current_agent = nil\n end\n end", "def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end", "def clear_session\n\t\tsession.clear\n\tend", "def clear_session\n session.clear\n end", "def clear_session\n session[:timeout] = nil\n session[:user_name] = nil\n session[:real_user_name] = nil\n session[:job_id] = nil\n session[:auth_type] = nil\n cookies.delete :auth_token\n reset_session\n end", "def clear_session\n Mack::SessionStore.expire_all\n end", "def clear_session\n session[:user_id] = nil\n cookies[:user_id] = nil\n cookies[:password_hash] = nil\n end", "def clear_session\n rails_controller_instance.reset_session\n end", "def clear_session\n session[:int_key] = nil\n session[:email] = nil\n session[:password] = nil\n session[:account_id] = nil\n redirect_to root_url\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def reset_session!\n raw_session.clear\n end", "def clear_session\n session[:player_id] = nil\n cookies[:player_id] = nil\n cookies[:password_hash] = nil\n end", "def clear_session\n Rails.logger.debug('SSO: ApplicationController#clear_session', sso_logging_info)\n\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n end", "def clear_session_keys\n ActiveRecord::Base.clear_session_keys\n end", "def logout!\n session.clear\n end", "def sessions_reset\n self.sessions_flush\n @sessions = {}\n end", "def reset_session_variables\n session[:login] = ''\n session[:register_id] = ''\n session[:register_name] = ''\n session[:folio_id] = ''\n session[:folio_image] = ''\n session[:first_folio_id] = ''\n session[:last_folio_id] = ''\n session[:browse_id] = ''\n session[:browse_image] = ''\n end", "def clear_session_keys() #:nodoc:\n @@session_keys.clear\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end", "def clear_sessions\n session.keys.each do |key|\n session.delete(key) if key =~ /ranmemory_/\n end\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end", "def log_out \n session.clear\n @current_user = nil\n end", "def log_out\n session.delete(:username)\n session.delete(:token)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n session.delete(:type)\n @current_user = nil\n end", "def log_out\n session.delete(:seller_id)\n session.delete(:user_id)\n session.delete(:userType)\n session.delete(:viewedID)\n session.delete(:cart_id)\n @current_user = nil\n @usertype = nil\n @CurrentSeller = nil\n end", "def reset_session\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n cookies.delete(Settings.sso.cookie_name, domain: Settings.sso.cookie_domain)\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n super\n end", "def logout\n\t\t\tPicombo::Session.instance.unset('loggedin')\n\t\t\tPicombo::Session.instance.unset('user')\n\t\tend", "def log_out\n session.clear\n cookies.clear\n @current_user = nil\n end", "def logout\n session[:user] = nil\n end", "def logout!\n session.clear\n end", "def logout!\n session.clear\n end", "def log_out\n current_user.reset_session_token!\n session[:session_token] = nil\n end", "def log_out\n\t\tsession[:user_id] = nil\n\tend", "def log_out\n session[:cart] = []\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end", "def log_me_out\n session['user'] = nil\n end", "def log_out\n # current_user.created_lists.where(\"name is null\").delete_all\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n @current_list = nil\n # @current_team = nil\n cookies.signed[:id] = nil\n session[:current_date]=nil\n session[:list_id]=nil\n\n end", "def log_out\n reset_session\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil \n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend", "def logout\n @session[:user] = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def clear_all_reviewer_sessions!\n reviewer_access_sessions.delete_all\n end", "def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user=nil\n end", "def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end", "def logout_user\n session[:current_user_id] = nil\n session[:current_auditor_id] = nil\n session[:company_id] = nil\n session[:name] = nil\n session[:last_login_at] = nil\n session[:plan] = nil\n reset_session\n redirect_to \"http://www.profitbooks.net/logout\"\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def logout\n current_user.reset_session_token!\n session[:session_token] = nil\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t \tsession.delete(:user_id)\n\t \t@current_user =nil\n\t end", "def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n # @current_team = nil\n\n end", "def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end", "def log_out\n forget(current_user)\n session.delete(:session_database)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session[:user_id] = nil\n end", "def log_out\n session.delete(:uid)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end", "def reset\n log_out_and_disconnect\n @imap = nil\n @logged_in = false\n @idling = false\n end", "def clear_current_user_for_request_and_session\n @current_user = nil\n session[:user_id] = nil\n end", "def clear_current_user_for_request_and_session\n @current_user = nil\n session[:user_id] = nil\n end", "def clear_current_user_for_request_and_session\n @current_user = nil\n session[:user_id] = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end", "def logout\n\t\tsession[:user_id] = nil\n\tend", "def reset_session\n if Settings.test_user_dashboard.env == 'staging' && @current_user\n TestUserDashboard::UpdateUser.new(@current_user).call\n TestUserDashboard::AccountMetrics.new(@current_user).checkin\n end\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n clear_session\n super\n end" ]
[ "0.8568118", "0.8056482", "0.78624153", "0.77697676", "0.7748444", "0.76843065", "0.7662799", "0.76477534", "0.7492621", "0.74533963", "0.74317443", "0.74027437", "0.74027437", "0.73829645", "0.7325849", "0.71922666", "0.71912503", "0.71812296", "0.7180784", "0.71724325", "0.7138463", "0.7119704", "0.7095593", "0.70944977", "0.703878", "0.7003736", "0.6998722", "0.69652116", "0.6957058", "0.6928966", "0.6910799", "0.6899878", "0.6893902", "0.6893902", "0.6875291", "0.68492687", "0.6845402", "0.68422717", "0.6826696", "0.6818427", "0.681533", "0.6799716", "0.678897", "0.6788915", "0.67882514", "0.6775223", "0.6775223", "0.6775223", "0.6775223", "0.6775223", "0.67629683", "0.67613494", "0.67459035", "0.6716588", "0.67148256", "0.671345", "0.671345", "0.671345", "0.671345", "0.67129457", "0.6712912", "0.6711613", "0.6707484", "0.67032564", "0.6692518", "0.66862786", "0.66853756", "0.6683707", "0.66829497", "0.6676701", "0.66718477", "0.66718477", "0.66718477", "0.6668621", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66674894", "0.66592234", "0.6640848", "0.663362" ]
0.8069562
1
Fills session with data related to successful login.
def fill_login_data(user, remember_me) session[:user_id] = user.id session[:user_name] = user.name session[:edit_mode] = 0 session[:user_roles] = [] # special for SUPERADMIN sa = DcPolicyRole.find_by(system_name: 'superadmin') if sa and (role = user.dc_user_roles.find_by(dc_policy_role_id: sa.id)) session[:user_roles] << role.dc_policy_role_id session[:edit_mode] = 2 return end # read default policy from site default_policy = dc_get_site().dc_policies.find_by(is_default: true) # load user roles user.dc_user_roles.each do |role| next unless role.active next if role.valid_from and role.valid_from > Time.now.end_of_day.to_date next if role.valid_to and role.valid_to < Time.now.to_date # check if role is active in this site policy_role = default_policy.dc_policy_rules.find_by(dc_policy_role_id: role.dc_policy_role_id) next unless policy_role # set edit_mode # session[:edit_mode] = 1 if policy_role.has_cms_menu session[:edit_mode] = 1 if policy_role.permission > 1 session[:user_roles] << role.dc_policy_role_id end # Add default guest role if no role set # This was previously in dc_user_can. I belive it should be here. #TODO This might not be the best idea. Check in the future. if session[:user_roles].size == 0 guest = DcUserRole.find_by(:system_name => 'guest') session[:user_roles] << guest.id if guest end # Save remember me cookie if not CMS user and remember me is selected if session[:edit_mode] == 0 and remember_me cookies.signed[:remember_me] = { :value => user.id, :expires => 180.days.from_now} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end", "def login\n # delete the session from their last login attempt if still there\n session.delete(:auth) unless session[:auth].nil?\n @login_form = LoginForm.new\n end", "def populate_session(aPlayer)\n\t\tsession[:email] = @player.email\n\t\tsession[:player_id] = @player.id \n\t\tsession[:admin] = @player.admin\n\t\tsession[:login_time] = Time.now.to_i \n\tend", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie'] || @login_results.headers['set-cookie']\n end", "def set_session\n session['token'] = @result['data']['token']\n current_user\n end", "def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def login\n session[:user_id] = nil\n end", "def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def reload\n @session_id = nil\n login\n end", "def set_session user\n session[:user_id] = user.id\n session[:user_fullname] = user.fullname\n session[:user_email] = user.email\n session[:user_access] = user.access\n session[:company_id] = user.company_id\n end", "def handle_successful_login(response)\n Log.success(\"success!\")\n @cookie = /session=[^;]*/.match(response.headers[\"set-cookie\"])[0]\n set_user_info\n end", "def login!\n session[:user_id] = @user.id\n end", "def login\n if params['username'] and params['password']\n user = User.where(name:params['username'], password: params['password']).first \n if user\n session['user_attributes'] = user.attributes\n session['user_attributes']['id'] = user.id\n else\n flash[:error] = \"Login failed\"\n end\n end \n \n if session['user_attributes']\n unless params['redirect_to'].nil?\n redirect_to(\"#{params['redirect_to']}\")\n else\n redirect_to(root_url)\n end\n else\n flash[:redirect_to] = params['redirect_to'] unless flash[:redirect_to]\n end\n end", "def create_session\n self.current_user = authenticate_user(params[:user][:login], params[:user][:password], :trace => true)\n \n # store remember me in token\n if logged_in?\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n render :update do |page|\n # JS code to close modal\n # update page header to show user information\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS\n redirect_back_or_default(authentication_success_url || '/')\n end\n else\n # callback :after_authentication_error\n self.send(:after_authentication_error, self.current_user) if self.respond_to?(:after_authentication_error)\n if !performed? && request.xhr?\n render :update do |page|\n # JS code to re-display login dialog\n end\n elsif !performed?\n flash[:error] = user_class.is_suspended?(params[:user][:login], params[:user][:password]) ? \n \"Login nicht möglich, da Benutzer gesperrt wurde.\" : \n MESSAGE_LOGIN_ERROR\n render :action => 'new'\n end\n end\n end", "def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end", "def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end", "def login!(session)\n session[:user_id] = self.id\n end", "def login_user\n\t @user_session = UserSession.new\t \n\tend", "def require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end", "def login\n @status = 0\n @session = UserSession.new(params[:user_session])\n unless @session.save\n @status = 1\n end\n respond_to do |format|\n format.js\n end\n end", "def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end", "def login!(session) \n session[:user_id] = id \n end", "def do_login\n @login_results = get_organizations\n end", "def set_session\n \n end", "def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end", "def begin_session\n begin\n true if login\n rescue\n false\n end\n end", "def build_session\n # If it's empty assume user doesn't need session attributes.\n @session_attributes = Hash.new if @session_attributes.nil?\n @session = { :sessionAttributes => @session_attributes }\n @session\n end", "def set_env_success( request = nil )\n self['login_count'] ||= 0\n self['login_count'] += 1\n self['last_login_at'] = current_login_at\n self['current_login_at'] = Time.now\n self['last_login_ip'] = current_login_ip\n if( request )\n self['current_login_ip'] = request.env[\"REMOTE_ADDR\"]\n request.env[\"REMOTE_USER\"] = id\n end\n save\n end", "def login!(session)\n session[:user_id] = id\n end", "def login!(session)\n session[:user_id] = id\n end", "def login!(session)\n session[:user_id]=id\n end", "def login!(session)\n\t\tsession[:user_id] = id\n\tend", "def set_user_session\n session[:access_token] = user_credentials.access_token\n session[:refresh_token] = user_credentials.refresh_token\n session[:expires_in] = user_credentials.expires_in\n session[:issued_at] = user_credentials.issued_at\nend", "def refresh\n @session = ::Session.new(user: current_user)\n\n if @session.save\n current_session.destroy\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end", "def auth_login\n\t\tauth_hash = request.env['omniauth.auth']\n\t\tauth_response = Authorization.find_or_create(auth_hash)\n\t\t# Create a session\n\t\tuser = auth_response.user\n\t\tsession[:user_id] = user.id\n\t\tsession[:token] = auth_response.token\n\t\tsession[:secret] = auth_response.secret\n\t\tsession[:user_role] = USER\n\t\tuser_session = UserSession.create(user)\n\t\tuser_session.save\n\t\tflash.keep[:notice] = t(\"general.login_successful\")\n\t\tredirect_to root_url\n end", "def login!(user) #sets congruency between session token of user and session\n @current_user = user\n session[:session_token] = user.session_token\n end", "def login_user\n session[:user_id] = @user.id\n end", "def set_auth_sessions(data)\n session[:authentication_token] = data[\"data\"][\"token\"][\"access_token\"]\n session[:refresh_token] = data[\"data\"][\"token\"][\"refresh_token\"]\n session[:expires_at] = DateTime.now + data[\"data\"][\"token\"][\"expires_in\"].to_i.seconds\n end", "def create\n flybuys_number = params[:session][:flybuys_number]\n\n @session = Session.new(\n flybuys_number: flybuys_number,\n password: params[:session][:password],\n )\n\n validate_login = ValidateLogin.new(@session)\n\n respond_to do |format|\n if validate_login.call\n session[:flybuys_number] = flybuys_number\n\n format.html { redirect_to root_path, notice: 'Login successful' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new, notice: 'Invaild login' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def login_creds\n session_login[\"username\"] = params.permit(:username)[:username]&.strip if allow_assert_username?\n session_login[\"station_id\"] = params.permit(:station_id)[:station_id]&.strip\n\n redirect_to url_for_sso_host(\"/auth/samlva\")\n end", "def log_in(user)\n session[:user_id] \t = user.id\n session[:user_name] = user.name\n session[:user_email] = user.email\n end", "def reset_session_variables\n session[:login] = ''\n session[:register_id] = ''\n session[:register_name] = ''\n session[:folio_id] = ''\n session[:folio_image] = ''\n session[:first_folio_id] = ''\n session[:last_folio_id] = ''\n session[:browse_id] = ''\n session[:browse_image] = ''\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n if @user_session.save\n record_action!(:login, current_user)\n flash[:notice] = \"Login successful!\"\n redirect_back_or_default after_login_url\n else\n @failed = true\n render :action => :new\n end\n end", "def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end", "def set_session_login\n @session_login = SessionLogin.find(params[:id])\n end", "def login(user)\n #assign session_token and give it as a cookie to the client's browser \n session[:session_token] = user.reset_session_token! #a method \n #putting a key-value pair into the session hash \n #session hash is only available in controllers and views \n end", "def handle_login(u)\n session[:person] = u.id\n end", "def get_session\n begin\n if session[:user_id].present? && session[:user_name].present? && current_user.present?\n unless session[:comp_id].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]} \n else\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name] , :comp_id=> session[:comp_id]}\n end \n render :json=>@result\n else \n reset_session \n @result = {flag:false}\n render :json=>@result\n end \n rescue Exception=> e\n reset_session \n @result = {flag:false}\n render :json=>@result\n end\n \n end", "def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end", "def create\n @login = Login.new(params)\n @session = @login.authenticate_user\n\n if not @session\n respond_to do |format|\n handle_create_error(\"Invalid credentials. Please try again!\", format)\n end\n\n return\n end\n\n respond_to do |format|\n if @session.save\n @session.put_in_cookie(cookies)\n flash[:notice] = 'Hello ' + @session.user_name\n format.html { redirect_to(@session) }\n format.xml { render :action => \"show\", :status => :created, :location => @session }\n else\n handle_create_error(\"There was a problem logging in. Please try again.\", format)\n end\n end\n end", "def create\n # respond_to do |format|\n # if @user_session.save\n # format.html { redirect_to @user_session, notice: 'User session was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @user_session }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @user_session.errors, status: :unprocessable_entity }\n # end\n # end\n\n #binding.pry\n user = User.get_user(user_session_params[:username], user_session_params[:password])\n if user != nil\n session = UserSession.login(user)\n response = {\n html: '',\n json: { username: user.username, token: session.key, status: 200 }\n }\n end\n respond_to do |format|\n if user != nil\n cookies[:auth] = {\n value: response[:json],\n expires: 1.year.from_now\n }\n format.html { render text: response[:html] }\n format.json { render json: response[:json] }\n else\n format.html { render text: '', status: :unauthorized }\n format.json { render text: '', status: :unauthorized }\n end\n end\n\n\n end", "def login(user)\n session[:session_token] = user.reset_session_token\n end", "def login!(user)\n session[:session_token] = user.reset_session_token!\n end", "def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end", "def login\n response = @session.create\n @auth_token = response[\"token\"]\n @rest.default_headers = { 'Content-Type' => 'application/json', 'Auth-Token' => @auth_token }\n response\n end", "def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n format.html { redirect_to(:home, :notice => 'Login successful.') }\n format.json { render :json => @user_session, :status => :created, :location => @user_session }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @session_login = current_user.session_logins.build(session_login_params)\n respond_to do |format|\n if @session_login.save\n format.html { redirect_to @session_login, notice: \"Session login was successfully created.\" }\n format.json { render :show, status: :created, location: @session_login }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @session_login.errors, status: :unprocessable_entity }\n end\n end\n end", "def login!(session)\n session[:pd_user_id] = self.id\n end", "def login(username = 'josh.starcher@example.com')\n @request.session[:user] = User.find(:first, :conditions => {:username => username}).id\n @request.session[:ministry_id] = 1\n end", "def login(params={})\n params = {:session => {}}\n \n # if both username and password given as parameters or instance variables\n if ((@username && @password) || (params[:username] && params[:password]))\n params[:session][:username] = params[:username] || @username\n params[:session][:password] = params[:password] || @password\n end\n params[:session][:app_name] = @app_name || APP_CONFIG.asi_app_name\n params[:session][:app_password] = @app_password || APP_CONFIG.asi_app_password\n\n resp = RestHelper.make_request(:post, @@session_uri, params , nil, true)\n\n #@headers[\"Cookie\"] = resp[1].headers[:set_cookie].to_s\n @cookie = resp[1].cookies\n @person_id = resp[0][\"entry\"][\"user_id\"]\n end", "def store_session(res)\n end", "def login!(user)\n @current_user = user\n session[:session_token] = user.session_token\n end", "def initialize_session\n response = @savon.call :initialize_session\n # Without ActiveSupport\n # 1.hour.from_now is 3600 seconds from Time.now\n @session_expiry_time = Time.now + 3600\n @session_id = response.body[:initialize_session_response][:initialize_session_result]\n end", "def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end", "def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end", "def set_session\n @session = session[:user_id]\n end", "def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end", "def login_attempt\n authorized_user = User.authenticate(params[:username_or_email],\n params[:login_password])\n puts('authorized_user')\n\n puts(authorized_user)\n puts('authorized_user')\n\n if authorized_user\n puts 'session[:user_id]'\n puts session[:user_id]\n session[:user_id] = authorized_user.id\n flash[:notice] = \"Välkommen åter, #{authorized_user.username}.\"\n # redirect_to(:action => 'home')\n redirect_to(controller: 'questionnaires', action: 'index')\n #render json: authorized_user\n\n else\n flash[:notice] = 'Felaktigt användarnamn eller lösenord.'\n flash[:color] = 'invalid'\n render json: authorized_user\n end\n\n # redirect_to(:controller => 'sessions', :action => 'home')\n # return false\n end", "def session\n end", "def complete_session_authentication\n raise 'No authentication in session' unless session[:pending_authentication_id]\n @user = User.new(params[:user])\n if @user.save\n @user.authentications << Authentication.find(session[:pending_authentication_id])\n session[:pending_authentication_id] = nil #nix the id in session after successful assoc\n sign_in_and_redirect_back_or_default(@user, user_path(@user))\n else\n render :action=>\"incomplete_authorization\"\n end\n end", "def login(user)\n session[:session_token] = user.reset_session_token!\n end", "def login_data\n tbcreds = UserTestbedCredential.where(:user_id => user.id, :testbed_id => testbed.id).first\n logindata = {\n \"authenticationData\" => [\n {\n \"urnPrefix\" => tbcreds.testbed.urn_prefix_list,\n \"username\" => tbcreds.username,\n \"password\" => tbcreds.password\n }\n ]\n }\n logindata\n end", "def save_login_state\n if session[:user_id]\n redirect_to(:controller => 'catalog', :action => 'index')\n else\n end\n end", "def login\n @user = User.find_by_email(params[:email])\n if @user.password == params[:password]\n session[:id] = @user.id\n session[:visit] = 0\n redirect \"users/#{@user.id}/feed\"\n else\n redirect '/'\n end\nend", "def login user\n session[:user_id] = user.id\n end", "def call\n # Can not be both unrecognised and incorrect\n session[SESSION_KEY] = session[SESSION_KEY].except('unrecognised')\n add_fields(incorrect: true)\n end", "def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end", "def set_user_session\n @user_session = UserSession.find\n end", "def save_login_state\n if session[:user_id]\n redirect_to requests_path\n return false\n else\n return true\n end\n end", "def login\n session[:id] = nil\n if request.post?\n\t\t\tperson = Person.find_by_login_and_password(params[:login], params[:password])\n if person\n \tsession[:id] = person.id\n\t\t\t\tsession[:firstname] = person.firstname\n\t\t\t\tsession[:name] = person.name\n session[:login] = person.login\n session[:password] = person.password\n \n\t\t\t\trespond_to do |format|\n\t\t\t\t\tflash[:notice] = \"Authentication is successful !\"\n format.html { redirect_to(posts_path) }\n \t\tformat.json { render :json => @person} \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend \n else\n person = nil\n params[:password] = nil\n\n respond_to do |format|\n\t\t\t\t\tflash[:error] = \"Authentication error !\"\n \tformat.html { redirect_to(posts_path) }\n \tformat.json { render :json => @person.errors } \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend\n end\n end\n end", "def create\n @user_session = UserSession.new(user_session_params.to_h)\n if @user_session.save\n flash[:notice] = \"Login successfully!\"\n redirect_back_or root_path\n else\n redirect_to login_path,\n alert: \"A problem's occured while logging in, please try again.\"\n end\n end", "def valid_session\n\t\t{}\n\tend", "def valid_session\n\t\t{}\n\tend", "def update\n return unless @session\n @session.data = @data\n @session.save\n end", "def login\n session_update(:current_state, nil)\n #first, check the current user is student or admin\n # byebug\n\n if params[:session][:user] == 'admin'\n #check if the uin of admin is valid\n # @cur_user = Admin.where(\"email ='#{params[:session][:email]}' and password ='#{params[:session][:password]}'\")\n @cur_user = Admin.where(\"email = '#{params[:session][:email]}'\")\n if @cur_user[0].nil?\n # flash[:warning] = \"Your Email or Password is Incorrect.\"\n flash[:warning] = \"The admin account doesn't exist\"\n redirect_to root_path\n else\n # puts \"User password: #{@cur_user[0].password}\"\n # puts \"Given password: #{params[:session][:password]}\"\n if @cur_user[0].password == Digest::MD5.hexdigest(params[:session][:password])\n #update the session value which could be used in other pages\n session_update(:name, @cur_user[0][:name])\n #:current_state could indicate the current user is admin or student\n session_update(:current_state, \"admin\")\n session_update(:uin, @cur_user[0][:uin])\n redirect_to student_requests_adminview_path\n else\n flash[:warning] = \"Your Email or Password is Incorrect\"\n redirect_to root_path\n end\n end\n elsif params[:session][:user] == 'student'\n #check if the uin of student is valid\n @user = Student.where(\"email = '#{params[:session][:email]}'\")\n if @user[0].nil?#the user doesn't sign up\n flash[:warning] = \"The account doesn't exist. Please sign up first.\"\n redirect_to root_path\n return#tricky\n else\n ##puts \"User password: #{@user[0].password}\"\n # puts \"Given password: #{params[:session][:password]}\"\n\n if @user[0].password == Digest::MD5.hexdigest(params[:session][:password])\n if @user[0].email_confirmed\n #update the session value which could be used in other pages\n session_update(:name, @user[0][:name])\n session_update(:current_state, \"student\")\n session_update(:uin, @user[0][:uin])\n redirect_to students_show_path\n else\n flash[:warning] = \"The account has not been activated. Please check your email to activate your account!\"\n redirect_to root_path\n end\n else\n flash[:warning] = \"Entered Email and Password didn't match. Try again.\"\n redirect_to root_path\n end\n end\n end\n end", "def valid_session\r\n {}\r\n end", "def login\n return if generate_blank\n @user = User.new(params[:user])\n if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])\n session[:user].logged_in_at = Time.now\n session[:user].save\n flash[:notice] = 'Login successful'\n redirect_to_stored_or_default :action => 'home'\n else\n @login = params[:user][:login]\n flash.now[:warning] = 'Login unsuccessful'\n end\n end", "def finalize\n shopify_session = ShopifyAPI::Session.new(params[:shop], params[:t], params)\n\n if shopify_session.valid?\n session[:shopify] = shopify_session\n flash[:notice] = 'Logged in to shopify store.'\n\n Shop.find_or_create_by_name_and_api_url(params[:shop], shopify_session.site)\n\n redirect_to return_address\n session[:return_to] = nil\n else\n flash[:error] = 'Could not log in to Shopify store.'\n redirect_to :action => 'index'\n end\n end", "def login_from_session\n self.current_ma_user = MA[:user].find_with_conditions(:id => session[MA[:single_resource]]) if session[MA[:single_resource]]\n end", "def create\n\n logger.debug \"### Processing new login details\"\n user = User.authenticate(params[:email], params[:password])\n\n if user\n\n logger.debug \"### Login details matched - creating login session\"\n session[:user_id] = user.id\n flash[:notice] = \"Logged in!\"\n redirect_to(session[:return_to] || home_index_path) \n session.delete(:return_to)\n else\n logger.debug \"### User details didn't match - login denied\"\n flash[:error] = \"Invalid email or password\"\n render \"new\"\n end\n\n end", "def create\n user = User.where(:username => params[:session][:username].downcase).first\n \n if user && user.authenticate(params[:session][:password])\n log_in user\n user['last_login'] = Time.now.to_datetime\n user.save\n flash[:success] = \"Welcome back #{user.username}!\"\n redirect_to home_path\n else\n # Otherwise, keep them on the login page.\n flash.now[:danger] = 'Invalid username or password'\n render 'new'\n end\n end", "def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def login(username, password)\n open_session do |sess|\n# If we want to emulate https\n# sess.https!\n sess.post_via_redirect \"/sessions\", \"session[login_name]\" => username, \"session[password]\" => password\n assert_equal '/', sess.path\n assert_equal Constants::LOGGED_IN_NOTICE, sess.flash[:notice]\n# Unemulate https\n# sess.https!(false)\n end\n end", "def create\n @user_session = UserSession.new(user_session_params.to_h)\n if @user_session.save\n # flash[:notice] = I18n.t('user_session.login_successful')\n redirect_to surveys_path\n else\n flash[:notice] = I18n.t('user_session.invalid_login')\n render :action => :new\n end\n end" ]
[ "0.7181392", "0.682048", "0.6730298", "0.6672402", "0.6672402", "0.6549236", "0.64867586", "0.64846075", "0.6483432", "0.64822835", "0.64597243", "0.6448087", "0.6446174", "0.64352417", "0.63875884", "0.63813376", "0.6333131", "0.6320547", "0.6310362", "0.6299219", "0.6297992", "0.6295002", "0.6291594", "0.6285926", "0.6281858", "0.6265555", "0.6260935", "0.62392414", "0.6233908", "0.62326396", "0.62309504", "0.62309504", "0.6207978", "0.61942506", "0.61932576", "0.61616224", "0.61489767", "0.61481285", "0.6147933", "0.6136614", "0.6131848", "0.61283743", "0.61249644", "0.6120904", "0.6116126", "0.61156166", "0.6083422", "0.6078918", "0.6074252", "0.6071805", "0.6071523", "0.6063182", "0.60560733", "0.6050575", "0.6041922", "0.6039395", "0.6017282", "0.60171926", "0.60168445", "0.60165083", "0.6011801", "0.60043967", "0.6004115", "0.60000193", "0.5992722", "0.5985425", "0.5985363", "0.5976331", "0.59711874", "0.59702086", "0.597012", "0.5966003", "0.5964547", "0.59622306", "0.59597427", "0.59589136", "0.5944052", "0.5942441", "0.59352493", "0.593481", "0.5934346", "0.5932739", "0.5930219", "0.5924518", "0.59212095", "0.59212095", "0.5909167", "0.59090644", "0.5893295", "0.58931124", "0.5892029", "0.58877116", "0.58870435", "0.5881781", "0.58813334", "0.58716404", "0.58716404", "0.58716404", "0.58716404", "0.58674085", "0.5863493" ]
0.0
-1
Initializes various variables when a new Crawler object is instantiated
def initialize(site) puts "Rcrawl Version #{VERSION} initializing..." @links_to_visit = Array.new @visited_links = Array.new @external_links = Array.new @raw_html = Hash.new @rules = RobotRules.new('Rcrawl') @user_agent = "Rcrawl/#{VERSION} (http://rubyforge.org/projects/rcrawl/)" @sites = Hash.new @errors = Hash.new @meta = Hash.new @site = URI.parse(site) || raise("You didn't give me a site to crawl") @links_to_visit << site puts "Ready to crawl #{site}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(title, url) # from first scrape data initialize == Lifecycle method in Ruby\n @title = title\n @url = url\n @@all << self if @@all.none?(self)\n end", "def initialize (params = {})\t\t\n\t\t@verbose=params.fetch(:verbose, false)\n\t\t@http_timeout=params.fetch(:http_timeout, 5000)\n\t\t@crawl_depth=params.fetch(:crawl_depth, 4)\n\t\t@crawl_page_limit=params.fetch(:crawl_page_limit, 1000)\n\t\t@max_parallel=params.fetch(:max_parallel, 40)\n\t\t# Discovered data store\t\t\n\t\t@discovered_urls_by_crawler=Hash.new\n\t\t@visited_urls_by_crawler=Hash.new\n\t\t@crawl_start=Hash.new\n\t\t@crawl_done=Hash.new\n\t\t@log_file=File.dirname(__FILE__)+\"../../logs/crawler.log\"\n\tend", "def initialize \n @root =\"http://web.archive.org/web/20030820233527/\" +\n \"http://bytravelers.com/journal/entry\" # Initialize the variables. The root of the URL to the cached copy of the site is here. \n @agent = Mechanize.new\n end", "def setup_managers\n\t\t@crawler_op = Crawler_Operator.new(self)\n\tend", "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 setup\n @requests = setup[:requests]\n @response = setup[:response]\n @vos = setup[:vos]\n @related_scrapers = setup[:related_scrapers] || {}\n @is_root = setup[:is_root] \n @pager = setup[:pager] || {}\n @scrapers = setup[:scrapers] || {}\n @name = setup[:name]\n \n # load in a named helper for this scraper, or the base one\n if @name && Helper.const_defined?(@name)\n @helper = Helper.const_get(@name).new\n else \n @helper = Helper::Base.new\n end\n \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 initialize\n raise NotImplementedError, 'need to implement #intialize and set @url'\n end", "def initialize\n super # required for creating logger and directory\n # define @mechanize = Mechanize.new { |agent| agent.open_timeout...} if you need add some options to mechanize agent\n # your code here\n end", "def initialize(db)\n @db = db\n #initialize the scraper with a database\n end", "def initialize(url)\n download = open(url) # goes to the site and grabs stuff to be stored in download\n # Nokogiri is a class, here we're going insite it as if it was a folder # no @ because we're not saving it\n @html = Nokogiri::HTML(download) # translates the html so ruby can understand it, @ beccause we're saving it \n end", "def initialize(item) \n\t\t\t@url = item.url\n @doc = Nokogiri::HTML(item.html)\n end", "def initialize(username , limit)\n @username = username\n @limit = limit\n #pass only the username into methods so we generate the urls we need as we scrape them\n #dont call the next method here, use the object created in its place of creaton\n #to call further scraping methods class methods\n end", "def post_init\n @current = nil\n @requests = []\n @pending = []\n @parser = Http::Parser.new(self)\n end", "def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n @all_selectors = []\n @all_mixins = []\n @all_includes = []\n @all_properties = []\n end", "def initialize #hash. Initializes them at nil if not provided\n @http_referers = nil\n @has_cookie = nil\n @session_duration = nil\n end", "def initialize(attrs = {})\n agent\n @urls = []\n @handlers = {}\n @results = []\n @proxies = []\n @current_proxy = 0\n self.class.start_urls.each { |url| handle url, *self.class.handlers[url] }\n @request_interval = attrs[:request_interval] || DEFAULT_REQUEST_INTERVAL\n @proxy_port = attrs[:proxy_port]\n @proxy_addr = attrs[:proxy_addr]\n\n # When set to true Spidey will automatically retrieve Proxy Server details from via proxynova\n # Proxy IPs will be automatically rotated when each `handle` method is called\n @random_proxy = attrs[:random_proxy]\n if @random_proxy == true\n @proxies = Proxynova.get_list\n @total_proxies = @proxies.count\n end\n end", "def initialize(url = BASE_URL)\n @agent = Mechanize.new\n @current_page = @agent.get url\n end", "def initialize(url)\n self.url = url\n self\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\n @links = []\n @passwords = []\n @category = \"various\"\n @comment = \"\"\n end", "def initialize(url=nil)\n @url = url\n @@all << self\n end", "def initialize()\n print 'Base URL: ', @@base_url\n end", "def initialize(url)\n @url = url\n # Create our mechanized instance\n @mechanize_instance = SharedMechanize.instance\n end", "def initialize( title, description, url)\n #storing inside instance variables so they can be used anywhere else in the class.\n @title = title\n @description = description\n @url = url\n end", "def initialize(*args)\n\t\t\t\tsuper\n\t\t\t\t#super called in order to call the same method from the parent class and then adding our thing (next line)\n\t\t\t\t@cleverbot = ::Cleverbot::Client.new #:: means look not at this namespace but at the very top and search down.\n\t\t\tend", "def initialize(url, referer_url = nil)\n @url = url.to_s\n @referer_url = referer_url&.to_s\n @urls = [@url, @referer_url].select(&:present?)\n\n @parsed_url = Addressable::URI.heuristic_parse(url) rescue nil\n @parsed_referer = Addressable::URI.heuristic_parse(referer_url) rescue nil\n @parsed_urls = [parsed_url, parsed_referer].select(&:present?)\n end", "def initialize\n @browsers = []\n @selenium_port = 4444\n @selenium_timeout = 4000\n @url = \"http://www.google.com\"\n @hooks = {:before => {}, :after =>{}}\n end", "def setup\n @url_str = 'http://www.google.co.uk'\n @bad_url_str = 'my_server'\n @link = '/about.html'\n @url_str_link = \"#{@url_str}#{@link}\"\n @url_str_anchor = \"#{@url_str_link}#about-us\"\n @url_str_query = \"#{@url_str_link}?foo=bar\"\n @iri = 'https://www.über.com/about#top'\n @time_stamp = Time.new\n @mongo_doc_dup = {\n 'url' => @url_str,\n 'crawled' => true,\n 'date_crawled' => @time_stamp\n }\n end", "def initialize\n load_site\n load_creds\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()\n # Load the site from the config.\n parser = ParseConfig.new(CONFIG_FILE)\n @site = parser['site']\n \n # Prepare the object with nil values.\n @user = nil\n @password = nil\n @error = nil\n @logged_in = false\n @is_admin = false\n\n User.site = @site\n User.logger = LOGGER\n\n Broadcast.site = @site\n Broadcast.logger = LOGGER\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(url)\n @url = url\n end", "def initialize(referer: '', num_results: 50, start_results: 0, cache_client: nil)\n @referer = referer\n @start_results = start_results\n @num_results = num_results\n\n if cache_client && cache_client.respond_to?(:get) && cache_client.respond_to?(:set)\n @cache_client = cache_client\n end\n end", "def initialize\n # Define instance variables\n @log = nil\n @config = nil\n @robot = nil\n @socket = nil\n # Initialize those that should be done now.\n parse_arguments()\n setup_logger()\n # Call the block if necessary.\n yield(self) if block_given?\n end", "def initialize\n @agent = Mechanize.new\n @agent.set_defaults if @agent.respond_to?(:set_defaults)\n @agent.user_agent = @@user_agent ||= \"bahn.rb\"\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def crawler_data\n @crawler_data ||= Nokogiri::HTML(crawler_page, nil, 'utf-8')\n end", "def initialize( opts = Options.instance )\n @opts = opts\n\n @sitemap = {}\n @redirects = []\n @paths = []\n @visited = Set.new\n\n @on_each_page_blocks = []\n @on_each_response_blocks = []\n @on_complete_blocks = []\n\n @pass_pages = true\n @pending_requests = 0\n\n seed_paths\n end", "def initialize\n init\n end", "def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end", "def initialize ## initializing 3 variables that come with Twitter Trends info. Am I doing something wrong?\n @name= nil\n @query_trend= nil\n @promoted_content= nil\n end", "def initialize( url = \"http://www.reddit.com\", useragent = \"Snoo ruby reddit api wrapper v#{VERSION}\" )\n @baseurl = url\n self.class.base_uri url\n @headers = {'User-Agent' => useragent }\n self.class.headers @headers\n @cookies = nil\n @modhash = nil\n end", "def initialize(address, parent=NIL, parentRank=NIL)\n @page = Nokogiri::HTML(open(address)) do |config|\n\t\t\tconfig.strict.noblanks\n\t\tend\n\t\t@address = address\n\t\t@inboundLinks = Array.new\n\t\t@lines = Array.new\n\t\t@index = Hash.new\n\t\t@lineCount = 0\n\t\t@wordCount = 0\n\t\t\n\t\tif parent == NIL \n\t\t\t#puts(\"no parent\")\n\t\t\t@rank = 0.25\n\t\telse \n\t\t\tinboundLinks.push(parent)\n\t\t\t@rank = 0.25 + parentRank\n\t\tend\n\t\t@title = @page.css('title')[0].text\n\t\tself.getLinks()\n\t\t@rawText = @page.css('body', 'p').text\n\t\tself.processLines()\n end", "def initialize(site, base, name); end", "def initialize(connection_name = 'mechanize')\n @agent = Mechanize::HTTP::Agent.new(connection_name)\n @agent.context = self\n @log = nil\n\n # attr_accessors\n @agent.user_agent = AGENT_ALIASES['Mechanize']\n @watch_for_set = nil\n @history_added = nil\n\n # attr_readers\n @pluggable_parser = PluggableParser.new\n\n @keep_alive_time = 0\n\n # Proxy\n @proxy_addr = nil\n @proxy_port = nil\n @proxy_user = nil\n @proxy_pass = nil\n\n @html_parser = self.class.html_parser\n\n @default_encoding = nil\n @force_default_encoding = false\n\n # defaults\n @agent.max_history = 50\n\n yield self if block_given?\n\n @agent.set_proxy @proxy_addr, @proxy_port, @proxy_user, @proxy_pass\n end", "def initialize(linkfinder,baseURI)\r\n @results={\r\n :uris404=>[],\r\n :uris200=>[],\r\n :urisUnknown=>[],\r\n :checked=>{},\r\n :urisNonHTTP=>[]\r\n }\r\n @linkfinder=linkfinder\r\n @baseURI=baseURI\r\n end", "def initialize_agent(agent = Mechanize.new)\r\n @agent = (agent.nil? ? Mechanize.new : agent)\r\n @agent.log = Logger.new(\"#{Rails.root}/log/scrapers/mechanize.log\")\r\n @agent.log.formatter = Utf8LogFormatter.new\r\n @agent.user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'\r\n # @agent.max_history = 1\r\n end", "def initialize node, page\n @node = node\n @page = page\n @mech = page.mech\n end", "def initialize(url)\n @url = url\n end", "def initialize(title, link)\n @title = title\n @link = link\n @@all << self\n end", "def initialize\n # Set some default values.\n # We're running `varnishlog` on localhost.\n default_http_hostname = 'http://localhost'\n default_http_port = '80'\n default_request_uri = '/'\n \n @uri = URI.parse(\"#{default_http_hostname}:#{default_http_port}#{default_request_uri}\")\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @request_headers = {\n 'Host' => 'www.example.com',\n 'User-Agent' => 'shellac'\n }\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end", "def initialize(attrs = {})\n @appspider_url = attrs['appspider_url']\n @username = attrs['username']\n @password = attrs['password']\n @config_name = attrs['config_name']\n @startscan = attrs['startscan']\n end", "def initialize\n @preloader = Rendering::NoopPreloader\n @pretty = true\n @cache_templates = false\n @lookup_context = nil\n @using = []\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(url, &block)\n super(url)\n @handlers = {}\n instance_eval(&block)\n end", "def start_crawling\n begin\n if @params[:url]\n page = @agent.get(@params[:url])\n else\n @pre_middlewares.each { |mw| mw.call(@params) }\n page = @params[:page]\n raise 'internal error' if page.nil?\n end\n rescue => _\n raise CrawlingException::InitializationError.new\n end\n\n # starting from Depth 0\n process(page, 0)\n end", "def initialize\n @agent = Mechanize.new\n @agent.agent.set_socks('localhost', 9050) # use Tor\n @agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @login_form = login_form\n @consumer_page = consumer_page\n @account_page = account_page\n @balance_page = balance_page\n @usage_page = usage_page\n end", "def initialize() end", "def init; end", "def init; end", "def init; end", "def init; 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()\n end", "def initialize()\n @user_agent_flags = {}\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize(settings)\n @origin_url = settings[:origin_url]\n @known_urls = settings[:ignored_urls]\n @domains = settings[:domains].map {|domain| URI.parse(domain)}\n @depth_to_explore = settings[:depth_to_explore]\n @links_we_want_to_explore = settings[:links_to_explore]\n @trace = settings[:trace]\n end", "def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n\t \t# loading or not loading should be the key here.\n end", "def initialize(options)\n @title = options[:title] ||= nil\n @javascripts = options[:javascripts] ||= nil\n @stylesheets = options[:stylesheets] ||= nil\n @active_link = options[:active_link] ||= nil\n @sub_active_link = options[:sub_active_link] ||= nil\n end", "def initialize(opts={})\n @url = opts[:url].strip\n\n s = RecipeDocument.read_document(opts)\n\n @options = DEFAULT_OPTIONS.merge(opts)\n # remove hardspaces &nbsp with a simple space.\n s.gsub!('&nbsp;', ' ')\n @doc = Nokogiri::HTML(s)\n\n\n @trimmed_doc = Nokogiri::HTML(s)\n\n @trimmed_doc.css(\"object, embed\").each do |elem|\n elem.remove\n end\n\n remove_unlikely_candidates!\n remove_divs_with_high_link_density!\n\n @title = @doc.xpath(\"//title\").text.lstrip.rstrip.gsub(/[\\n]+/, \" \")\n end", "def initialize\n\t\tself.article_search_keywords = [] \n\t\tself.view_articles_start_index = 0\n\t\t# self.option_one_first_time = true # don't need if write new search method\n\t\tArticle.clear_all #these should be empty upon instantiation A new object knows nothing.\n Snippet.clear_all #potentially each cli needs a relationship with Article and snippet, and Visa Vi. So you could ask the cli instance what articles it knows about. Hopefully only the ones that were created during the cli's existence.\n # A new search method would allow you to not have to build those relationships.\n\tend", "def initialize(self)\n self.objects = []\n self.agents = []\n end", "def initialize(url)\n @url = url\n freeze\n end", "def initialize(user,pw, opts = nil)\n @user = user\n @pw = pw\n @blog = nil\n \n @max_blog_entries = nil #as specified in scrape\n @curr_blog_entries = 1 #local loop variable\n \n @completed = false #stop scraping if @completed\n @options = opts #options which get filled in by templates \n \n @doc = nil #Hpricot document representing the xml file\n \n @comment_id = 1 #represents fixed comment id, increased for each comment\n @comment_hash = Hash.new #how we store hierarchical comments\n # [key in xanga] => @comment_id\n\n #for now, just set options to default\n set_default_options if @options == nil \n \n @agent = WWW::Mechanize.new{ |agent|\n # refreshes after login\n agent.follow_meta_refresh = true\n }\n end", "def initialize(scroll_model, parsed_registry, force=false, dev=false, url=@@URL)\n @url = url\n @force = force\n @dev = dev\n @scroll_model_class = scroll_model\n @parsed_registry_class = parsed_registry\n end", "def initialize\n @metadata = {}\n @comment = ''\n @parent = nil\n @parent_name = nil # for loading\n @parent_class = nil # for loading\n @section = nil\n @section_title = nil # for loading\n @file = nil\n @full_name = nil\n @store = nil\n @track_visibility = true\n\n initialize_visibility\n end", "def initialize(base_url)\n @base_url = base_url\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\n\t\t\n\tend", "def initialize(conf)\n self.linked_data_url = conf[\"linked_data_url\"]\n self.namespaces = conf[\"namespaces\"]\n self.search = conf[\"search\"]\n self.pretty_name = conf[\"prettyNames\"]\n self.stylesheet_portal = conf[\"stylesheet_portal\"]\n end", "def initialize\r\n\r\n end", "def initialize()\n\t\tend", "def init_page_variables\n @title = String(nil)\n @text = String(nil)\n @index = nil\n end", "def initialize(url)\n @url = url\n end", "def initialize(url)\n self.url = url\n end", "def initialize!\n return if params[:id] == 'ping'\n\n key = \"/#{self.class.route_root}/#{params[:id]}\"\n test_params = Internal::Controller.cache_read(key)\n\n @component_name = test_params[0]\n @component_params = test_params[1]\n @html_block = test_params[2]\n @render_params = test_params[3]\n @render_on = @render_params.delete(:render_on) || :client_only\n @_mock_time = @render_params.delete(:mock_time)\n @style_sheet = @render_params.delete(:style_sheet)\n @javascript = @render_params.delete(:javascript)\n @code = @render_params.delete(:code)\n\n @page = ['<body>']\n end", "def initialize\n self.title = nil\n self.url = nil\n self.comments_url = nil\n self.created_at = nil\n self.author = nil\n self.categories = []\n self.content = nil\n self.medias = []\n end", "def prepare\n super\n\n self.fetch_site\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(url, username, password, ba_username = nil, ba_password = nil)\n @agent = WWW::Mechanize.new\n if ba_username != nil\n @agent.auth(ba_username, ba_password)\n end\n @url = url\n @username = username\n @password = password\n @log = Logger.new(STDOUT)\n @log.progname = self.class.to_s\n @log.level = Logger::DEBUG\n @dummy =false\n end", "def set_crawler\n @crawler = Crawler.find(params[:id])\n end", "def set_crawler\n @crawler = Crawler.find(params[:id])\n end" ]
[ "0.7178817", "0.71490777", "0.709987", "0.6904131", "0.67465186", "0.66765857", "0.6645099", "0.6625878", "0.656214", "0.653998", "0.65359765", "0.65270984", "0.6518336", "0.65163743", "0.65112466", "0.6502881", "0.64959514", "0.6487032", "0.6482146", "0.64784795", "0.6458494", "0.6420315", "0.64174694", "0.63957644", "0.6380012", "0.63660014", "0.6337286", "0.63353384", "0.63264847", "0.6322243", "0.631357", "0.63102484", "0.62884897", "0.62847364", "0.6277224", "0.62579477", "0.6254901", "0.6249524", "0.6249524", "0.624921", "0.62436724", "0.6225604", "0.6218531", "0.6204995", "0.6204555", "0.6204466", "0.6194593", "0.61919415", "0.6190228", "0.6183943", "0.61831015", "0.6182418", "0.6180911", "0.61750036", "0.6166363", "0.61578625", "0.6157556", "0.6144585", "0.6137089", "0.6134608", "0.6132538", "0.6123831", "0.6123831", "0.6123831", "0.6123831", "0.61152405", "0.6109663", "0.6108022", "0.6106992", "0.6106992", "0.6106992", "0.61041707", "0.6098495", "0.6097502", "0.6097502", "0.6092297", "0.6091265", "0.60884726", "0.6086009", "0.60782343", "0.6077796", "0.60715514", "0.60662293", "0.6063219", "0.6061397", "0.60607624", "0.6057603", "0.60560983", "0.6055419", "0.60526294", "0.6052614", "0.60519856", "0.6047787", "0.60428286", "0.6037688", "0.60220796", "0.6020232", "0.60188437", "0.6018388", "0.6018388" ]
0.72382843
0
Coordinates the whole crawling process
def crawl until @links_to_visit.empty? do begin # Get link url_server next unless robot_safe? @url if @url.include? '#' print "... Anchor link found, skipping..." next end # Parse robots.txt, then download document if robot_safe fetch_http(@url) # Store raw HTML in variable to read/reread as needed # Then call any processing modules you need for the current document ris(@document) rescue puts "" puts "I died on #{@url}" $stderr.puts $! @errors[@url] = $! next ensure # Stuff you want to make sure gets printed out puts " done!" end end puts "Visited #{@visited_links.size} links." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crawl\n recursive_explore([@origin_url],1)\n end", "def run\n getPage\n getLocations\n printLocations\n end", "def crawl\n if not @crawling\n @completed = false\n @located_products = []\n \n @thread = Thread.new { \n traverse(@base_url) \n @crawling = false\n @completed = true\n }\n\n @crawling = true\n else\n raise \"Already crawling. Stop current crawl job before starting another.\"\n end\n end", "def scrape\n end", "def crawl\n $list.regions.each do |r|\n url = \"http://\" << r.name << :query\n puts r.name\n peel(url)\n end\n end", "def crawl\n pages.destroy_all\n self.update_attribute(:start_time, Time.now)\n cs = CrawlingStack.new\n\n Crawl.new(self.id, root_page, 0, cs, nil,\n :links_normalizer => {},\n :links_filter => {})\n self.update_attribute(:finish_time, Time.now)\n end", "def crawlAllPages\n page = 1\n loop do\n puts \"Path: #{@basePath}#{page.to_s}\"\n path \"#{@basePath}#{page.to_s}\"\n\n response = crawl\n @dbm.insertCrawlerBlob response[\"beers\"]\n\n break if response[\"more\"].nil?\n page += 1\n end\n end", "def perform\n if perform_crawl?\n if get_page\n store_page\n normalize_links\n filter_links\n continue_crawl\n end\n else\n # puts \"Depth limit reached for #{@url}\"\n end\n end", "def run\n super\n\n uri = _get_entity_attribute \"name\"\n\n # Scanner options\n @opt_threads = _get_option(\"threads\").to_i\n @opt_max_pages = _get_option(\"max_pages\").to_i\n #@opt_user_agent = _get_option \"user_agent\"\n @opt_extract_uris = _get_option \"extract_uris\" # create an object for each page\n @opt_extract_dns_records = _get_option \"extract_dns_records\" # create an object for each dns_record\n @opt_extract_file_metadata = _get_option \"extract_file_metadata\" # create a Uri object for each page\n @opt_extract_patterns = _get_option(\"extract_patterns\").split(\",\") # only extract entities withthe following patterns\n\n crawl_and_extract(uri)\n\n end", "def scrape_it\n \n end", "def start_crawling\n begin\n if @params[:url]\n page = @agent.get(@params[:url])\n else\n @pre_middlewares.each { |mw| mw.call(@params) }\n page = @params[:page]\n raise 'internal error' if page.nil?\n end\n rescue => _\n raise CrawlingException::InitializationError.new\n end\n\n # starting from Depth 0\n process(page, 0)\n end", "def process_page page_url\n page = SuperCrawler::Scrap.new(page_url) # Scrap the current page\n\n current_page_links = page.get_links # Get current page internal links\n new_links = current_page_links - @links # Select new links\n\n new_links.each { |link| @links_queue.push(link) } # Add new links to the queue\n @links += new_links # Add new links to the links list\n @crawl_results << { # Provide current page crawl result as a hash\n url: page.url, # The crawled page\n links: current_page_links, # Its internal links\n assets: page.get_assets # Its assets\n }\n\n SuperCrawler::Render.log_status( page_url, @crawl_results.length, @links.length ) if @option_debug # Display site crawling status\n end", "def continue_crawl\n # puts \"I am on #{@url} (#{@links.size} links)-> I want to navigate to #{@links.map{|l| l['href']}}\" #links - Array\n\n @links.each_with_index do |link, i|\n href = link[\"href\"]\n next if href.blank? or (href.split('/').last && href.split('/').last.starts_with?(\"#\"))\n if not href.starts_with?(\"htt\")\n href = href[1..-1] if href.starts_with?('/')\n href = @stored_page.domain + '/' + href\n end\n if page_found = Page.find_by_address_and_crawler_id(href, @crwlr.id)\n #puts \"Loop for #{href}\"\n if @stored_page #Page\n @stored_page.pages << page_found\n end\n else\n #puts \"Adding job for CID: #{@crwlr.id} HREF: #{href} SPID: #{@stored_page.id} #{} #{} #{}\"\n @stack.enqueue Crawl.new(@crwlr.id, href, @depth+1, @stack, @stored_page.id, @options)\n end\n end\n end", "def crawl(url = base_url)\n document = Crawler::Document.new(url)\n index.consume_document url.sub(base_url, ''), document\n\n paths_queue = index.get_paths_to_visit\n next_path = paths_queue[0]\n\n print \" Pages remaing - #{paths_queue.count} \\r\"\n crawl \"#{base_url}#{next_path}\" if next_path\n end", "def scrape(url)\n\t\n $log.info \"START #{__FILE__}.#{__method__}\"\n\t\n \n def initialize \n super ARGV[0],\"groupon\"\n end\n \n begin\n html = open(url)\n doc = Nokogiri::HTML(html.read)\n doc.encoding = \"utf-8\"\n $log.info \"Open url : #{url}\"\n\n $log.info \"Fetching from : #{url}\"\n \n title \t\t= doc.at_xpath($deal_config[$site_name][\"title\"])\n deal_url\t= URI.parse(url)\n price \t\t= doc.at_xpath($deal_config[$site_name][\"price\"])\n location \t= doc.at_xpath($deal_config[$site_name][\"location\"])\n sold \t\t= doc.at_xpath($deal_config[$site_name][\"sold\"])\n items\t\t= doc.at_xpath($deal_config[$site_name][\"items\"])\n category\t= doc.at_xpath($deal_config[$site_name][\"category\"])\n deal_thumb\t= doc.at_xpath($deal_config[$site_name][\"deal_thumb\"])['src']\n description = doc.at_xpath($deal_config[$site_name][\"description\"]) \n discount = doc.at_xpath($deal_config[$site_name][\"discount\"])\n expiry = doc.at_xpath($deal_config[$site_name][\"expiry\"])['value'] \n city = doc.at_xpath($deal_config[$site_name][\"location_city\"])\n\n # check if there is an imagemap\n # if so, insert latitude and longitude\n # else try geocoding\n image_map = doc.at_xpath($deal_config[$site_name][\"image_map\"])\n lat = nil\n long = nil\n if !image_map.nil? && image_map.to_s != \"\"\n uri = URI.parse(URI.encode(image_map['src']))\n uri_params = CGI.parse(uri.query)\n if !uri_params[\"center\"].nil?\n lat, long = uri_params[\"center\"][0].chomp.split(',')\n end\n \n else\n # geocode address\n loc=GeoKit::Geocoders::MultiGeocoder.geocode(location.content.to_s.strip) \n if !loc.success\n #if loc.lat.nil?\n lat = nil \n long = nil\n elsif loc.success\n lat = loc.lat\n long = loc.lng\n end\n end\n \t\t\n $arr_deals << Deal.new(title, deal_url, deal_thumb, price, location, sold, items, category, description, lat, long, discount)\n \n # set the following to site name\n $arr_deals[-1].author = $deal_config[$site_name][\"author\"]\n \n # specialized code for expiry\n time = Time.now + expiry.to_i/1000\n $arr_deals[-1].expiry = time.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n # add city to location 20120328\n cit = city.content.to_s.strip\n $arr_deals[-1].location += \", #{cit}\"\n # puts $arr_deals[-1].location\n \n # print ...\n #\t\tputs \"#{$arr_deals[-1].title} \\n\"\n #\t\tputs \"#{$arr_deals[-1].price} \\n\"\n #\t\tputs \"#{$arr_deals[-1].sold} \\n\"\n # \tputs \"#{$arr_deals[-1].items} \\n\"\n #\t\tputs \"#{$arr_deals[-1].location} \\n\"\n #\t\tputs \"#{$arr_deals[-1].deal_url} \\n\"\n #\t\tputs \"#{$arr_deals[-1].deal_thumb} \\n\"\n #\t\tputs \"#{$arr_deals[-1].category} \\n\"\n #\t\tputs \"#{$arr_deals[-1].description} \\n\"\n #\t\tputs \"#{$arr_deals[-1].latitude} \\n\"\n #\t\tputs \"#{$arr_deals[-1].longitude} \\n\"\n #\t\tputs \"#{$arr_deals[-1].discount} \\n\"\n\n $insert_number += 1\n puts \"inserting deal #{$insert_number}...\"\n $db.insert_deal($arr_deals[-1])\n \n $log.info \"Successfully retrieved data : #{url}\"\n\n rescue Exception=>e\n\t\n print \"Could not retrieve values. Maybe the site has changed?\"\n $log.error e.to_s\n puts e.to_s\n\t\t\n end\n\t\n $log.info \"END #{__FILE__}.#{__method__}\"\n\t\n end", "def parser_engine\n\n\t\tjob_start_time = Time.now\n\n\t\tputs \"Parsing locations...\"\n\t\tlinks = parse_locations\n\n\t\tputs \"Finished finding all locations' pages\"\n\t\tputs \"Total Time: #{Time.now - job_start_time} seconds\"\n\n\t\tputs \"Scraping Data from Each Location...\"\n\n\t\t# Spin up a cloud browser to execute JS with (Mac desktop with Chrome)\n\t\t# browser = get_saucy\n\n\t\t# Spin up browser locally\n\t\tbrowser = run_browser_locally\n\n\t\t# Parse all pages on the returned pages\n\t\tfound_details = links.collect do |location_link|\n\t\t\tparse_location_page(location_link, browser)\n\t\tend\n\n\t\t# Close browser session on saucelabs\n\t\tbrowser.close\n\n\t\t# Remove any nil values from the returned array then flatten array of hashes to one-dimensional array of hashes\n\t\tdetails = found_details.compact.flatten\n\n\t\tputs \"Finished Scrapping All Locations' Data.\"\n\t\tputs \"Total Time to Scrape All Data: #{((Time.now - job_start_time)/60).to_i} minutes\"\n\n\t\t# Uses CSV from Ruby Core lib, this data has no owner so won't interact with our DB.\n\t\tCSV.open(\"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\", \"wb\") do |row|\n\t\t\t#Headers for reference, uncomment if you need headers. Each website doesn't need them.\n\t\t\t#row << [ \"name\", \"url\", \"rating\", \"address\", \"total_reviews\", \"cuisine\", \"price\", \"neighborhood\", \"website\", \"email\", \"phone\", \"review_rating\", \"review_description\", \"review_dine_date\", \"marketing_url\", \"marketing_id\" ]\n\t\t\t\n\t\t\tdetails.each do |location|\n\t\t\t\tnext if location[:email].empty? #skip adding rows if no email is present\n\t\t\t\trow << [ location[:name], \n\t\t\t\t\t\t location[:url], \n\t\t\t\t\t\t location[:rating], \n\t\t\t\t\t\t location[:address],\n\t\t\t\t\t\t location[:total_reviews], \n\t\t\t\t\t\t location[:cuisine], \n\t\t\t\t\t\t location[:price], \n\t\t\t\t\t\t location[:neighborhood], \n\t\t\t\t\t\t location[:website], \n\t\t\t\t\t\t location[:email], \n\t\t\t\t\t\t location[:phone], \n\t\t\t\t\t\t location[:review_rating], \n\t\t\t\t\t\t location[:review_description], \n\t\t\t\t\t\t location[:review_dine_date],\n\t\t\t\t\t\t location[:marketing_url],\n\t\t\t\t\t\t location[:marketing_id] ]\n\t\t\tend\n\t\tend\n\t\tputs \"File outputted as '#{@source}_#{@directory_listing}.csv'\"\n\t\texported_csv = \"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\"\n\t\texported_csv\n\tend", "def craw_result_page_urls\n start_time = Time.now\n agent = touch_and_customize_cookies\n \n detail_urls = []\n page_indexes = (0..245)\n\n Parallel.each(page_indexes, :in_threads => 2, :in_processes => 2) do |page_index|\n # (0..245).each do |page_index|\n url = \"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=#{page_index}&spectext=\" \n search_results = agent.post(url)\n search_results.search(\".displayTabledata a\").each do |link|\n COLL.insert(:url => link.attribute(\"href\").value)\n end\n end\n p Time.now - start_time\nend", "def craw_result_page_urls\n start_time = Time.now\n agent = touch_and_customize_cookies\n \n detail_urls = []\n page_indexes = (0..245)\n\n Parallel.each(page_indexes, :in_threads => 2, :in_processes => 2) do |page_index|\n # (0..245).each do |page_index|\n url = \"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=#{page_index}&spectext=\" \n search_results = agent.post(url)\n search_results.search(\".displayTabledata a\").each do |link|\n COLL.insert(:url => link.attribute(\"href\").value)\n end\n end\n p Time.now - start_time\nend", "def scrape\n request = BoundingBox.new(\n :term => keyword,\n :sw_latitude => sw_lat,\n :sw_longitude => sw_long,\n :ne_latitude => ne_lat,\n :ne_longitude => ne_long,\n :sort => 2)\n\n request2 = BoundingBox.new(\n :term => keyword,\n :sw_latitude => sw_lat,\n :sw_longitude => sw_long,\n :ne_latitude => ne_lat,\n :ne_longitude => ne_long,\n :sort => 2,\n :limit => 20,\n :offset => 20)\n\n\n [ client.search(request), client.search(request2) ]\n end", "def explore(pos)\n end", "def parser_engine\n\n\t\tjob_start_time = Time.now\n\n\t\tputs \"Parsing locations...\"\n\t\tlinks = parse_locations\n\n\t\tputs \"Finished finding all locations' pages\"\n\t\tputs \"Total Time: #{Time.now - job_start_time} seconds\"\n\n\t\tputs \"Scraping Data from Each Location...\"\n\n\t\t# Spin up a cloud browser to execute JS with (Mac desktop with Chrome)\n\t\t# browser = get_saucy\n\n\t\t# Spin up browser locally\n\t\tbrowser = run_browser_locally\n\n\t\t# Parse all pages on the returned pages\n\t\tfound_details = links.collect do |location_link|\n\t\t\tparse_location_page(location_link, browser)\n\t\tend\n\n\t\t# Close browser session on saucelabs\n\t\tbrowser.close\n\n\t\t# Remove any nil values from the returned array then flatten array of hashes to one-dimensional array of hashes\n\t\tdetails = found_details.compact.flatten\n\n\t\tputs \"Finished Scrapping All Locations' Data.\"\n\t\tputs \"Total Time to Scrape All Data: #{((Time.now - job_start_time)/60).to_i} minutes\"\n\n\t\t# Uses CSV from Ruby Core lib, this data has no owner so won't interact with our DB.\n\t\tCSV.open(\"#{Rails.root}/lib/exported_lists/#{@source}_#{@directory_listing}.csv\", \"wb\") do |row|\n\t\t\t#Headers for reference, uncomment if you need headers. Each website doesn't need them.\n\t\t\trow << [ \"Location Name\", \"City\", \"Review Count\", \"Total Reviews\", \"Rating\", \"OT URL\", \"Phone\", \"Email\" ]\n\t\t\t\n\t\t\tdetails.each do |location|\n\t\t\t\tnext if location[:total_reviews] < 11\n\t\t\t\trow << [ location[:location_name], \n\t\t\t\t\t\t location[:location_city], \n\t\t\t\t\t\t location[:review_count],\n\t\t\t\t\t\t location[:total_reviews],\n\t\t\t\t\t\t location[:rating],\n\t\t\t\t\t\t location[:url],\n\t\t\t\t\t\t location[:phone],\n\t\t\t\t\t\t location[:email] ]\n\t\t\tend\n\t\tend\n\t\tputs \"File outputted as 'ot_#{@directory_listing}_last30daysreviewcount.csv'\"\n\t\texported_csv = \"#{Rails.root}/lib/stats/ot_#{@directory_listing}_last30daysreviewcount.csv\"\n\t\texported_csv\n\tend", "def crawl\n completed = {}\n to_crawl = [Spidey::Page.new(@initial_url)]\n\n while page = to_crawl.shift do\n break if page.depth == @max_depth\n\n if !completed.has_key?(page.uri.to_s)\n STDERR.puts \"Fetching #{page.uri.to_s}\" if Spidey.log_requests\n page.scan.links.each do |link|\n to_crawl << Spidey::Page.new(@initial_url.merge(link), page.depth + 1)\n end\n completed[page.uri.to_s] = page\n end\n end\n\n completed\n end", "def crawl\n event_ids = []\n\n url = \"https://www.residentadvisor.net/events.aspx?ai=#{@city_id}&v=day&mn=#{@date.month}&yr=#{@date.year}&dy=#{@date.day}\"\n doc = Nokogiri::HTML(open(url))\n doc.search('.bbox').each do |link|\n event_id = link.at(\"h1 a[href]\").to_s.scan(/(\\d\\d\\d\\d\\d\\d)/).flatten.first\n event_ids << event_id unless event_id.blank?\n end\n\n event_ids.map do |event_id|\n \"https://www.residentadvisor.net/event.aspx?#{event_id}\"\n end\n end", "def scrape()\n scrapeForCurrentData\n end", "def get_position_info\n initial_page = @page\n job_array = get_position_single_page\n # Loop until there is no next page\n while link = next_page\n @page = link.click\n job_array += get_position_single_page\n end\n # restores page to initial page\n @page = initial_page\n job_array\n end", "def crawl_parser(results)\n\t\tputs \"[\".light_green + \"*\".white + \"] OK\".light_green + \", \".white + \"running parser on\".light_green + \": #{results}\".white\n\t\timportant = File.open(results, \"r\") #place our found links in variable to manipulate and search as needed\n\t\trezDir = \"#{$results}#{@zsite}/\" #Our results dir for this site which has been already created in first function cycles\n\n\t\t# placeholder arrays for sorting and finding unique testable links\n\t\tspreadsheetz=[]; executablez=[]; no_params=[]; test_keys=[]; noparamz=[]; archivez=[]; testlink=[]; opendocz=[]; outlookz=[]; paramz=[]; imagez=[];\n\t\taudioz=[]; videoz=[]; flashz=[]; multi=[]; vcardz=[]; bkupz=[]; jsz=[]; confz=[]; wordz=[]; xmlz=[]; pazz=[]; pdfz=[]; txtz=[]; pptz=[]; dbz=[];\n\n\t\tmcount=0 #Multi Parameter Links Count\n\t\tscount=0 #Single Parameter Links Count\n\t\tnocount=0 #No Parameter Links Count\n\n\t\t#loop through content of crawler.links file line by line...\n\t\timportant.each do |line|\n\t\t\tbegin\n\t\t\t\t#parse out parameters if they are present, if not will error NoMethodError and be handled there with rescue\n\t\t\t\tparam = URI.parse(line).query\n\n\t\t\t\t#break paramaters into hash [ \"@key\" => \"@value\" ] formatting held in storage for easier manipulation\n\t\t\t\tparamsHash = Hash[URI.parse(line).query.split('&').map{ |q| q.split('=') }] \n\n\t\t\t\t# Parse according to the number of parameters in link\t\t\n\t\t\t\t###### Handle Single Parameter links ######\n\t\t\t\tif paramsHash.length == 1\n\t\t\t\t\tscount += 1\n\t\t\t\t\tparamz << line\n\t\t\t\t\tparamsHash.each do |key, value|\n\t\t\t\t\t\tif value =~ /\\d+/ #if value is numerical replace with number and then we unique ;)\n\t\t\t\t\t\t\ttestlink << line.sub(/#{value}/, '1') \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttestlink << line #keep strings since they can be funky sometimes\n\t\t\t\t\t\tend\n\t\t\t\t\tend #finish cycle\n\n\t\t\t\telsif \"#{paramsHash.length}\".to_i > 1\n\t\t\t\t\t###### Handle Multi Parameter links ######\n\t\t\t\t\tmcount += 1\n\t\t\t\t\tparamz << line\n\t\t\t\t\t#Test each link and see if the parameter key has been logged or not, this way we only get unique paramter links ;)\n\t\t\t\t\tparamsHash.keys.each do |key|\n\t\t\t\t\t\tif test_keys.include?(key)\n\t\t\t\t\t\t\t#Do Nothing, its already included in our test_keys array!\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#Unique paramter, include key in test_key array and URL link in multi array for injector tests l8r\n\t\t\t\t\t\t\ttest_keys << key #so we dont catch anymore links with this parameter\n\t\t\t\t\t\t\tmulti << line.chomp #so we note the link for injection tests\n\t\t\t\t\t\tend\n\t\t\t\t\tend#end hash.key cycle\n\t\t\t\tend # parameter check looping\n\n\t\t\t###### Handle NO Parameter links ######\n\t\t\trescue NoMethodError\n\t\t\t\t# We really only need to check a few links without params to see if they throw errors (URL re-write type stuff hiding)\n\t\t\t\tnocount += 1\n\t\t\t\tif nocount < 10 # gives us up to 15 no parameter links to check, more than enough\n\t\t\t\t\tno_params << line\n\t\t\t\tend\n\n\t\t\t\t#Parse over links we're ditching & sort into appropriate results files (in case that info is needed for follow up l8r)\n\t\t\t\tif /\\/.+\\.pdf/i.match(line)\n\t\t\t\t\tpdfz << line.chomp\n\t\t\t\telsif /\\/.+\\.doc/i.match(line)\n\t\t\t\t\twordz << line.chomp\n\t\t\t\telsif /\\/.+\\.js|\\/.+\\.javascript/i.match(line)\n\t\t\t\t\tjsz << line.chomp\n\t\t\t\telsif /\\/.+\\.txt|\\/.+\\.rtf/i.match(line)\n\t\t\t\t\ttxtz << line.chomp\n\t\t\t\telsif /\\/.+\\.png|\\/.+\\.jpg|\\/.+\\.jpeg|\\/.+\\.gif|\\/.+\\.bmp|\\/.+\\.exif|\\/.+\\.tiff/i.match(line)\n\t\t\t\t\timagez << line.chomp\n\t\t\t\telsif /\\/.+\\.msg/i.match(line)\n\t\t\t\t\toutlookz << line.chomp\n\t\t\t\telsif /\\/.+\\.odt/i.match(line)\n\t\t\t\t\topendocz << line.chomp\n\t\t\t\telsif /\\/.+\\.csv|\\/.+\\.xlr|\\/.+\\.xls/i.match(line)\n\t\t\t\t\tspreadsheetz << line.chomp\n\t\t\t\telsif /\\/.+\\.pps|\\/.+\\.ppt/i.match(line)\n\t\t\t\t\tpptz << line.chomp\n\t\t\t\telsif /\\/.+\\.tar|\\/.+\\.zip|\\/.+\\.7z|\\/.+\\.cbr|\\/.+\\.deb|\\/.+\\.gz|\\/.+\\.bz|\\/.+\\.pkg|\\/.+\\.rar|\\/.+\\.rpm|\\/.+\\.sit/i.match(line)\n\t\t\t\t\tarchivez << line.chomp\n\t\t\t\telsif /\\/.+\\.vcf/i.match(line)\n\t\t\t\t\tvcardz << line.chomp\n\t\t\t\telsif /\\/.+\\.xml/i.match(line)\n\t\t\t\t\txmlz << line.chomp\n\t\t\t\telsif /\\/.+\\.m3u|\\/.+\\.m4a|\\/.+\\.mp3|\\/.+\\.mpa|\\/.+\\.wav|\\/.+\\.wma/i.match(line)\n\t\t\t\t\taudioz << line.chomp\n\t\t\t\telsif /\\/.+\\.avi|\\/.+\\.mov|\\/.+\\.mp4|\\/.+\\.mpg|\\/.+\\.srt|\\/.+\\.vob|\\/.+\\.wmv/i.match(line)\n\t\t\t\t\tvideoz << line.chomp\n\t\t\t\telsif /\\/.+\\.swf|\\/.+\\.flv/i.match(line)\n\t\t\t\t\tflashz << line.chomp\n\t\t\t\telsif /\\/.+\\.sql|\\/.+\\.accdb|\\/.+\\.db|\\/.+\\.mdb|\\/.+\\.pdb/i.match(line)\n\t\t\t\t\tdbz << line.chomp\n\t\t\t\telsif /\\/.+\\.apk|\\/.+\\.app|\\/.+\\.bat|\\/.+\\.cgi|\\/.+\\.exe|\\/.+\\.gadget|\\/.+\\.jar|\\/.+\\.pif|\\/.+\\.vbs|\\/.+\\.wsf/i.match(line)\n\t\t\t\t\texecutablez << line.chomp\n\t\t\t\telsif /\\/.+\\.bak|\\/.+\\.tmp|\\/.+\\.bk/i.match(line)\n\t\t\t\t\tbkupz << line.chomp\n\t\t\t\telsif /\\/.+\\.conf/i.match(line)\n\t\t\t\t\tconfz << line.chomp\n\t\t\t\telsif /\\/.+\\.passwd|\\/.+\\.htpasswd/i.match(line)\n\t\t\t\t\tpazz << line.chomp\n\t\t\t\telse\n\t\t\t\t\tnoparamz << line\n\t\t\t\tend\n\t\t\tend #End begin/rescue block\n\t\tend\n\n\t\t#make sure we dont have duplicates\n\t\tno_params = no_params.uniq\n\t\ttest_keys = test_keys.uniq\n\t\ttestlink = testlink.uniq\n\t\tmulti = multi.uniq\n\t\tinjtestlinks=[]\n\n\t\tputs \"[\".light_green + \"*\".white + \"] Crawler Results\".light_green + \": \".white\n\t\t#Write found NO parameter links to their own file just like everything else, just these dont fall into any group\n\t\tcount=0\n\t\tif not noparamz.empty?\n\t\t\tzfile=\"NO_paramaters\"\n\t\t\tnoparamz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\") #Open our file handle in write mode\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\") #Open our file handle in append mode\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\" #write the hits to file \n\t\t\t\tlostANDfound.close #close our file handle we opened a minute ago\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{noparamz.length} Links in total with NO paramaters in them\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not paramz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"paramater\"\n\t\t\tparamz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links in total with paramaters in them\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not jsz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"JS\"\n\t\t\tjsz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for JS Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not pdfz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"PDF\"\n\t\t\tpdfz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for PDF Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not wordz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"MS_WORD\"\n\t\t\twordz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for MS Word Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not txtz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"TEXT\"\n\t\t\ttxtz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for TEXT Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not outlookz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"OUTLOOK-MSG\"\n\t\t\toutlookz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for OUTLOOK-MSG Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not opendocz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"OpenDoc\"\n\t\t\topendocz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for OpenDoc Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not spreadsheetz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"SpreadSheet\"\n\t\t\tspreadsheetz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for SpreadSheet Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not pptz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"PowerPoint\"\n\t\t\tpptz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for PowerPoint Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not archivez.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"ARCHIVE\"\n\t\t\tarchivez.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for ARCHIVE Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not vcardz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"vCard\"\n\t\t\tvcardz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for vCard Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not xmlz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"XML\"\n\t\t\txmlz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for XML Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not audioz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"AUDIO\"\n\t\t\taudioz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for AUDIO Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not videoz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"VIDEO\"\n\t\t\tvideoz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for VIDEO Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not flashz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"FLASH\"\n\t\t\tflashz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for FLASH Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not dbz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"DATABASE\"\n\t\t\tdbz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for DATABASE Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not executablez.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"EXECUTABLES\"\n\t\t\texecutablez.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for EXECUTABLES Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not bkupz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"BackUp\"\n\t\t\tbkupz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for BackUp Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not confz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"CONFIG\"\n\t\t\tconfz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for CONFIG Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not pazz.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"PASSWORDS\"\n\t\t\tpazz.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for PASSWORDS Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tif not imagez.empty?\n\t\t\tcount=0\n\t\t\tzfile=\"IMAGE\"\n\t\t\timagez.each do |line|\n\t\t\t\tif count.to_i < 1\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"w+\")\n\t\t\t\t\tcount = count.to_i + 1\n\t\t\t\telse\n\t\t\t\t\tlostANDfound = File.new(\"#{rezDir}#{zfile}.links\", \"a+\")\n\t\t\t\tend\n\t\t\t\tlostANDfound.puts \"#{line.chomp}\"\n\t\t\t\tlostANDfound.close\n\t\t\tend\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{paramz.length} Links for IMAGE Files\".light_green + \": #{rezDir}#{zfile}.links\".white\n\t\tend\n\t\tputs \"[\".light_green + \"*\".white + \"] Other Info\".light_green + \".....\".white\n\t\tif not test_keys.empty?\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{test_keys.length} Testable Parameters\".light_green + \": \".white\n\t\t\tputs \"[\".light_green + \"*\".white + \"] \".light_green + \"#{test_keys.join(', ').to_s}\".white\n\t\tend\n\t\tif not testlink.empty?\n\t\t\t#print single parameter links we will test\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{testlink.length} Unique Single Parameter Links (out of #{scount} total)\".light_green + \": \".white\n\t\t\ttestlink.each do |line|\n\t\t\t\tputs \"\\t#{line.chomp}\".white\n\t\t\t\tinjtestlinks << line\n\t\t\tend\n\t\tend\n\t\tif not multi.empty?\n\t\t\t#print multi parameter links we will test\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{multi.length} Unique Multi Parameter Links (out of #{mcount} total)\".light_green + \":\".white\n\t\t\tmulti.each do |line|\n\t\t\t\tputs \"\\t#{line.chomp}\".white\n\t\t\t\tinjtestlinks << line\n\t\t\tend\n\t\tend\n\t\tif not no_params.empty?\n\t\t\tif no_params.length < 9\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Found the following NO Parameter links\".light_green + \": \".white\n\t\t\t\tnopam = no_params\n\t\t\telse\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] 10 random No Parameter Links (out of #{nocount} total)\".light_green + \": \".white\n\t\t\t\tnopam = no_params.sort_by{rand}[0..9]\n\t\t\tend\n\t\t\t#print no parameter links we will test\n\t\t\tnopam.each do |line|\n\t\t\t\tputs \"\\t#{line.chomp}\".white\n\t\t\t\tinjtestlinks << line\n\t\t\tend\n\t\tend\n\t\tif not injtestlinks.empty?\n\t\t\t#Write the suggested testable links to their own file for use with other tools\n\t\t\tf = File.new(\"#{rezDir}testable.links\", \"w+\")\n\t\t\tinjtestlinks.each do |link|\n\t\t\t\tf.puts link\n\t\t\tend\n\t\t\tf.close\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Suggested Testable Links\".light_green + \": #{rezDir}testable.links\".white\n\t\tend\n\t\t#Display the emails found now....\n\t\tif not @emails_array.empty?\n\t\t\t@emails_array.uniq!\n\t\t\tf=File.open(\"#{rezDir}temp.emails\", 'w+')\n\t\t\t@emails_array.each do |email|\n\t\t\t\tf.puts email\n\t\t\tend\n\t\t\tf.close\n\t\t\t#Because Ruby built-in uniq function doesn't seem to be fully doing the job we use some OS magic to make sure it is unique emails only....\n\t\t\tsystem(\"cat #{rezDir}temp.emails | sort -u > #{rezDir}emails.txt\")\n\t\t\tcount=`wc -l #{rezDir}emails.txt | cut -d' ' -f1`\n\t\t\tFileUtils.rm(\"#{rezDir}temp.emails\")\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Found #{count} emails while crawling\".light_green + \"....\".white\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Find them here\".light_green + \": #{rezDir}emails.txt\".white\n\t\tend\n\tend", "def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty?\n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then\n uri = URI.parse(page)\n host = &quot;#{uri.scheme}://#{uri.host}&quot;\n open(page, &quot;User-Agent&quot; =&gt; USER_AGENT) { |s|\n (Hpricot(s)/&quot;a&quot;).each { |a|\n url = scrub(a.attributes['href'], host)\n newfound_pages &lt;&lt; url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n }\n end\n rescue =&gt; e\n print &quot;\\n** Error encountered crawling - #{page} - #{e.to_s}&quot;\n rescue Timeout::Error =&gt; e\n print &quot;\\n** Timeout encountered - #{page} - #{e.to_s}&quot;\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end", "def crawler_page\n open(crawler_url)\n end", "def crawl\n update_all_feeds\n fetch_and_store_articles\n end", "def run( pass_pages_to_block = true, &block )\n return if !@opts.crawl?\n\n # options could have changed so reseed\n seed_paths\n\n if block_given?\n pass_pages_to_block ? on_each_page( &block ) : on_each_response( &block )\n end\n\n while !done?\n wait_if_paused\n while !done? && url = @paths.shift\n wait_if_paused\n\n visit( url ) do |res|\n obj = if pass_pages_to_block\n Page.from_response( res, @opts )\n else\n Parser.new( res, @opts )\n end\n\n if @on_each_response_blocks.any?\n call_on_each_response_blocks( res )\n end\n\n if @on_each_page_blocks.any?\n call_on_each_page_blocks( pass_pages_to_block ? obj : Page.from_response( res, @opts ) )\n end\n\n push( obj.paths )\n end\n end\n\n http.run\n end\n\n http.run\n\n call_on_complete_blocks\n\n sitemap\n end", "def go(uri)\n\n foaf='http://xmlns.com/foaf/0.1/' \n contact=\"http://www.w3.org/2000/10/swap/pim/contact#\" \n air= 'http://www.megginson.com/exp/ns/airports#'\n\n ayf = SimpleScutter.new uri\n\n pagecount=0\n # a code block to output basic info about each RDF page encountered\n # \n page_summary = Proc.new do |crawler,page| \n puts \"RDFDOC: count='#{pagecount}': uri:#{crawler.uri} gave RDF graph #{page} \\\n\twith #{page.size} triples\\n\" \n pagecount=pagecount+1\n end\n\n # a code block to see if some page provides nearestAirport information: \n #\n # <contact:nearestAirport><wn:Airport air:icao=\"EGGD\" air:iata=\"BRS\"/>...\n #\n airports = Proc.new do |crawler,page| \n\n #page.reg_xmlns 'http://www.megginson.com/exp/ns/airports#', 'air'\n \n rs = page.ask Statement.new(nil, air+\"iata\", nil)\n rs.objects.each do |a|\n a.graph=page\n puts \"AIRPORT: #{a} got airport code in #{crawler.uri})\" if (a.to_s =~ /\\S/) \n end\t\t\t\t\t# the 'if' is fix for parser bug\n end\n\n\n # the mugshots and htmler blocks are related, and share some state:\n report=\"\"\n seenpic=Hash.new(0) \t# counter\n\n # basic image metadata harvesting\n #\n mugshots = Proc.new do |crawler,page|\n images=[]\n img = page.ask Statement.new(nil, foaf+'img', nil)\n img.objects.each {|a| images.push a.to_s }\n img = page.ask Statement.new(nil, foaf+'depiction',nil)\n img.objects.each {|a| images.push a.to_s }\n\t\t # todo: store this state locally instead of inside crawler\n images.each do |pic|\n next if (!pic =~ /\\S/) #bug in Liber RDF parser.\n if seenpic[pic]==0 ### how to do this as a Proc? fixme\n report += \"<img src='#{pic}' width='128' height='128' />\" \n report += \"<!-- linked at: #{crawler.uri} -->\\n\\n\"\n end\n seenpic[pic]=seenpic[pic]+1\n end\n end\n\n # a code block that writes an html page based on the crawler's .out property \n #\n htmler = Proc.new do |crawler,page|\n html = \"<html><head><title>all your foaf depictions...</title></head>\\n<body>\\n\"\n html += \"<h1>AllYourFoaf Image Index</h1>\\n\" \n html += \"<p><strong>stats:</strong>: left.size=#{crawler.left.size} \\\n\tseen.size=#{crawler.seen.size} seenpic.size=#{seenpic.size} current:#{crawler.uri} </p> \"\n html += \"<hr />\\n\\n\" + report\n html += \"</body></html>\\n\\n\"\n SimpleScutter.writefile(crawler.outfile,html)\n end\n\n # stats to be output at start of each loop \n #\n loopstats = Proc.new do |s|\n puts \"INIT: s.left.size=#{s.left.size} s.seen.size=#{s.seen.size} current: #{s.uri}\"\n end\n\n error_logger = Proc.new {|e| puts \"ERROR: #{e}\" }\n\n # register some handlers:\n ayf.pagehandlers.push page_summary, airports, mugshots, htmler\n ayf.inithandlers.push loopstats\n ayf.errorhandlers.push error_logger \n ayf.run # set crawler running!\nend", "def testCrawler()\r\n\t#since no start page is defined it defaults to IU\r\n\tc = Crawler.new(100, \"https://en.wikipedia.org/wiki/Main_Page/\")\r\n\tputs(c)\r\n\tc.hello()\r\n\tputs(c.currentHTMLPage.page.class)\r\n\tputs(c.currentHTMLPage.to_s)\r\n\t#c.savePage()\r\n\t#puts(c.currentHTMLPage.links)\r\n\t#puts(c.currentHTMLPage.lines)\r\n\t#puts(c.currentHTMLPage.rawText)\r\n\t#c.getPage(\"https://www.wikipedia.org/\" , c.currentHTMLPage.address, (c.currentHTMLPage.rank / c.currentHTMLPage.links.size))\r\n\t#puts(c.currentHTMLPage.to_s)\r\n\t#puts(c.currentHTMLPage.index)\r\n\t#testLoad = Crawler.loadCrawledPage()\r\n\tputs(c.pageLimit.to_s)\r\n\tc.crawlPages()\r\nend", "def crawl(seed, options = {})\n f = Frontier.new(seed, :max_allowed_to_pass => options[:max_pages], :allow_ssl => options[:include_ssl], :filter => options[:filter])\n bad_uris = []\n\n while crawl_uri = f.dequeue\n uri = crawl_uri.uri\n parent_uri = crawl_uri.parent_uri\n \n start_time = Time.now\n page_links = fetch_page_links(uri)\n duration = Time.now - start_time\n\n if page_links\n page_links.each do |link|\n begin\n result = f.process link, :parent_uri => uri\n #if !result\n # puts \"\\x1B[33mProcessed #{link}: #{result}\\x1B[0m\"\n #end\n rescue Exception => ex\n log \"[An unknown error occurred]\"\n raise\n end\n end\n log \"#{f.passed.count} - #{parent_uri || 'root'} -> #{uri} (#{sprintf('%.2f',duration)} sec; queued: #{f.count})\"\n else\n bad_uris << uri\n log \"#{f.passed.count} - #{parent_uri || 'root'} -> #{uri} (#{sprintf('%.2f',duration)} sec; queued: #{f.count}) [Error fetching links]\"\n end\n\n sleep options[:crawl_rate] || 1\n end\n\n log \"Done.\"\n\n generate_sitemap(options[:generate_sitemap], f.passed - bad_uris) if options[:generate_sitemap]\n end", "def scrape_job_listings\n queries = [\"Rails+Developer\", \"front+end+Developer\", \"ruby+developer\", \"junior+web+Developer\", \"javascript+Developer\"]\n locations = [\"San+Francisco\"]\n\n locations.each do |location|\n queries.each do |query|\n scrape_indeed(query, location)\n scrape_github(query, location)\n # scrape_glassdoor(query, location)\n ; scrape_careerbuilder(query, location)\n end\n end\nend", "def crawler_items\n crawler_data.css('.sresult')\n end", "def crawl(&blk)\r\n while crawlNext(&blk)\r\n end\r\n end", "def pos()\n #This is a stub, used for indexing\n end", "def pos()\n #This is a stub, used for indexing\n end", "def search_for_selectors(search, expectedCount)\n # get all links for current page\n links = get_position_links\n # count used to put all information for 1 position in 1 array\n count = 1\n # link_index used to add the appropriate links to array\n link_index= 0\n # Sub array that will hold the information of 1 position\n job_content = []\n # Super array that holds information of all positions\n job_array = []\n @page.search(search).each do |selector|\n job_content << selector.text.strip\n if count % expectedCount == 0\n job_content << links[link_index]\n link_index += 1\n job_array << job_content\n job_content = []\n end\n count += 1\n end\n # Return super array\n job_array\n end", "def start_crawling(url, &block)\n Grell.logger.info \"GRELL Started crawling\"\n @collection = PageCollection.new(@add_match_block)\n @collection.create_page(url, nil)\n\n while !@collection.discovered_pages.empty?\n crawl(@collection.next_page, block)\n @manager.check_periodic_restart(@collection)\n end\n\n Grell.logger.info \"GRELL finished crawling\"\n end", "def crawl_worker(url0)\n\t\tputs \"Please be aware that it may take a while to crawl #{url0}, depending on the site's responsiveness and the amount of contents.\" \t\n\t\tbegin\n\t\t\t# Input URL sanity check first\n\t\t\tif is_url?(url0)\n\t\t\t\thost=url_2_host(url0)\n\t\t\t\tip=host_2_ip(host).to_s\n\t\t\t\traise \"Invalid IP address: #{url0}\" if ip.nil?\n\t\t\t\tport=url_2_port(url0).to_s\n\t\t\t\traise \"Invalid port number: #{url0}\" if port.nil?\n\t\t\telse\n\t\t\t\traise \"Invalid URL: #{url0}. Please check it out with your browser again.\"\n\t\t\tend\n\t\t\tlog_info=Hash.new\n\t\t\tlog_info[1]=\"Start working on #{url0}\"\n\t\t\turl_stores=Hash.new\n\t\t\turl_stores[url0]=true unless url_stores.key?(url0)\n\t\t\t@discovered_urls_by_crawler[url0]=true unless @discovered_urls_by_crawler.key?(url0)\n\t\t\t@crawl_start[url0]=true unless @crawl_start.key?(url0)\n#\t\t\t$discovered_urls[url0]=true unless $discovered_urls.key?(url0)\n\t\t\t@crawl_depth.times do\n\t\t\t\turl_stores.keys.each do |url|\n\t\t\t\t\t# 10/01/2013 add logic to avoid unnecessary crawling within the same child instance\n\t\t\t\t\tnext if @visited_urls_by_crawler.key?(url)\n\t\t\t\t\turl_object = open_url(url)\n\t\t\t\t\tnext if url_object == nil\n\t\t\t\t\turl = update_url_if_redirected(url, url_object)\n\t\t\t\t\turl_body = read_url(url)\n\t\t\t\t\t# Protection code - to avoid parsing failure on the empty or nil object\n\t\t\t\t\tnext if url_body.nil? or url_body.empty?\t\t\t\t\t\n\t\t\t\t\turl_stores[url]=true unless url_stores.key?(url)\n\t\t\t\t\t@discovered_urls_by_crawler[url]=true unless @discovered_urls_by_crawler.key?(url)\n#\t\t\t\t\t$discovered_urls[url]=true unless $discovered_urls.key?(url)\n\t\t\t\t\tdoc = parse_html(url_body)\n\t\t\t\t\tnext if doc == nil\n\t\t\t\t\tif url_stores.size >= @crawl_page_limit\n\t\t\t\t\t\t#@visited_urls_by_crawler.merge!(url_stores)\n\t\t\t\t\t\t@discovered_urls_by_crawler.merge!(url_stores)\n#\t\t\t\t\t\t$discovered_urls.merge!(url_stores)\n\t\t\t\t\t\tputs \"Finish web crawling the url: #{url0}\"\n\t\t\t\t\t\treturn url_stores\n\t\t\t\t\tend\n\t\t\t\t\tpage_urls = find_urls_on_page(doc, url)\n\t\t\t\t\tpage_urls.uniq!\n\t\t\t\t\tpage_urls.map do |y|\n\t\t\t\t\t\ty=normalize_url(y)\n\t\t\t\t\t\turl_stores[y]=true unless url_stores.key?(y)\n\t\t\t\t\t\t@discovered_urls_by_crawler[y]=true unless @discovered_urls_by_crawler.key?(y)\n#\t\t\t\t\t\t$discovered_urls[y]=true unless $discovered_urls.key?(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Finish web crawling on: #{url0}\"\n\t\t\tlog_info[2]=\"Finish working on: #{url0}\"\n\t\t\twlog(log_info, @log_file)\n\t\t\t@crawl_done[url0]=true unless @crawl_done.key?(url0)\n\t\t\treturn url_stores\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for URL #{url0}: #{ee}\" if @verbose\n\t\t\tlog_info[3]=\"Exception on #{url0}\"\n\t\t\twlog(log_info,@log_file)\n\t\t\treturn url_stores\n\t\tend\n\tend", "def scrap_trip_pages\n \n mp_trip_pages.each do |mp, trip_page|\n printf \"mp - #{mp}\\n\"\n doc = utf_page(trip_page)\n t = Time.now\n komandiruotes = (doc/\"//a[text()='Komandiruotės']\").first\n mp_business_trip(mp, denormalize( komandiruotes.attributes['href'] ) ) if komandiruotes\n printf \"Laikas: #{Time.now - t}\\n\"\n #sleep 3\n end\n \n end", "def main()\n print_logo()\n print_author_info() \n print_version_info()\n print_all_magazines_info()\n break_option = get_break_option()\n choose_specific_magazine_option = get_choose_specific_magazine_option()\n magazine_number = get_magazine_number(choose_specific_magazine_option)\n\n magazines_to_crawl = Hash.new\n\n if choose_specific_magazine_option and magazine_number > 0 then\n print \"Iniciando procedimento para UMA REVISTA ESPECÍFICA... \"\n selected_magazine_name, select_magazine_url = select_magazine_info(magazine_number - 1)\n magazines_to_crawl[selected_magazine_name] = select_magazine_url\n print \"OK.\\n\".green\n else \n print \"Iniciando procedimento para TODAS AS REVISTAS... \"\n magazines_to_crawl = $magazines_urls\n print \"OK.\\n\".green\n end\n\n magazines_to_crawl.each do |mag_name, mag_url|\n show_magazine_info(mag_name)\n mag_index_pages = get_mag_index_pages(mag_url)\n puts \"Total de páginas com edições: \" + mag_index_pages.length.to_s.blue\n mag_index_pages.each_with_index do |index_url, i|\n puts \"=+=+=+=+=\", \"Interpretando página \" + (i+1).to_s.light_blue\n # the function has scielo treatment\n edition_urls, is_scielo = get_edition_urls(index_url)\n edition_urls.each_with_index do |ed_url, index|\n puts \"-*-*-*-*-\"\n puts \"Interpretando \" + ((index+1).to_s + \"ª\").blue + \" edição...\" \n articles_urls_list = get_articles_links_from_edition_url(ed_url, is_scielo)\n # there's an intermediate page. Try to put '/showToc' in url\n # and execute again\n if articles_urls_list.length < 1 then\n ed_url = ed_url + \"/showToc\"\n articles_urls_list = get_articles_links_from_edition_url(ed_url, is_scielo)\n end\n articles_urls_list.each do |a_url|\n article_data = get_article_data_from_article_url(a_url)\n article_object = Article.new(article_data)\n print_article_info(article_object)\n begin\n save_article_object_to_db(article_object)\n rescue => e\n chew_error_and_print_message(e)\n end\n end \n end\n end\n end\n puts \"Fim \" + \";\".blue + \")\".red\n puts \"========================\"\nend", "def prepare_search\n # puts \"prepare_search called\"\n @current_point = @start_vector\n @interval_index = 0\n @path = [@start_vector]\n @initial_run = true\n \n @current_cost = get_cost @current_point\n end", "def pos()\n #This is a stub, used for indexing\n end", "def crawl #TODO: (base, source, query, exclusion[])\n folders = get_folders\n links = get_links(folders)\n filtered_links = filter_links(links) #TODO: add exclusion array\n download_files(filtered_links)\n end", "def get_crawling_result()\n return @crawling_result\n end", "def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty? \n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then \n uri = URI.parse(page)\n host = \"#{uri.scheme}://#{uri.host}\"\n open(page, \"User-Agent\" => USER_AGENT) { |s|\n (Hpricot(s)/\"a\").each { |a| \n url = scrub(a.attributes['href'], host)\n newfound_pages << url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n } \n end\n rescue => e \n print \"\\n** Error encountered crawling - #{page} - #{e.to_s}\"\n rescue Timeout::Error => e\n print \"\\n** Timeout encountered - #{page} - #{e.to_s}\"\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end \n end", "def findPositions(count)\n\tcount += 1\n\tif count < 50\n\t\telements = $driver.find_elements(:tag_name,'a')\n\t\telements.each do |x|\n\t\t\ttxt = x.text.downcase\n\t\t\t# Less than 13 tend to not be descriptive and or internal nav links\n\t\t\tif txt.length > 13\n\t\t\t\tif txt.include?(\"ruby\")||txt.include?(\"rails\")\n\t\t\t\t\t$ruby +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"python\")\n\t\t\t\t\t$python +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"php\")\n\t\t\t\t\t$php +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"mobile\") || txt.include?(\"android\") || txt.include?(\"ios\")\n\t\t\t\t\t$mobile +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"c#\") || txt.include?(\".net\")\n\t\t\t\t\t$csharp +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"java\") && !txt.include?(\"javascript\")\n\t\t\t\t\t$java += 1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"javascript\") || txt.include?(\"front-end\") || txt.include?(\"angular\") || txt.include?(\"backbone\") || txt.include?(\"node\")\n\t\t\t\t\t$javascript +=1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"senior\") || txt.include?(\"sr.\")\n\t\t\t\t\t$senior += 1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"junior\") || txt.include?(\"jr.\")\n\t\t\t\t\t$junior += 1\n\t\t\t\tend\n\t\t\t\tif txt.include?(\"qa\") || txt.include?(\"sdet\")\n\t\t\t\t\t$qa += 1\n\t\t\t\tend\t\n\t\t\t\tif txt.include?(\"c++\")\n\t\t\t\t\t$clang +=1\n\t\t\t\tend\t\t\n\t\t\t\tif txt.include?(\"web\")\n\t\t\t\t\t$web +=1\n\t\t\t\tend\t\t\n\t\t\t\tif txt.include?(\"data\")\n\t\t\t\t\t$data +=1\n\t\t\t\tend\t\n\t\t\t\tif txt.include?(\"front-end\") || txt.include?(\"frontend\")\n\t\t\t\t\t$front +=1\n\t\t\t\tend\t\n\t\t\t\tif txt.include?(\"back-end\") || txt.include?(\"backend\")\n\t\t\t\t\t$back +=1\n\t\t\t\tend\t\n\t\t\tend\n\t\t\tend\n\t\tend\n\t\tbegin\n\t\t\twait = Selenium::WebDriver::Wait.new(:timeout => 3)\n\t\t\t# date loads with entries -- wait for date\n\t\t\twait.until {$driver.find_element(:class, \"date\")}\n\t\trescue Selenium::WebDriver::Error::TimeOutError\n\t\t\tsummary()\n\t\tend\n\t\t# Search the next page\n\t\tbegin\n\t\t\telement = $driver.find_element(:link_text, \"next >\")\n\t\trescue Selenium::WebDriver::Error::NoSuchElementError\n\t\t\tsummary()\n\t\tend\n\n\t\tif element.enabled?\n\t\t\telement.click\n\t\t\tfindPositions(count)\n\t\tend\nend", "def start!\n\t\t\n\t\t@skippy.print_location #prints initial location (i.e., (0,0))\n\t\twhile !@skippy.at_home? do\n\t\t\t@skippy.hop!\n\t\t\t@skippy.print_location #print location after each hop (don't need a method for final_location)\n\t\t\t@hops += 1\n\t\tend\n\t\t\n\tend", "def locator\n benchmark 'Locator Action Wrap' do\n # we replaced a normal page model by a controller action, but we still need data from the model to describe this \"page\"\n @page = Page.find_by_title 'Self Storage' unless request.xhr?\n @location = @search.location\n \n benchmark 'Calling @search.results' do\n @listings = @search.results params[:strict_order] # this calls the Listing model\n end\n \n benchmark 'Calling listings.paginate and putting @map_data together' do\n @listings = @listings.paginate :page => params[:page], :per_page => (params[:per_page] || @listings_per_page)\n @map_data = { :center => { :lat => @location.lat, :lng => @location.lng, :zoom => 12 }, :maps => @listings.collect { |listing| @template.map_data_for(listing, :request => request) } }\n end\n \n benchmark 'calling Listing.delay.update_stats' do\n # updates the impressions only for listings on current page if the search has changed\n Listing.delay.update_stats(@listings, :impressions, simple_request_obj, current_user) if @diff_search\n end\n \n benchmark 'respond_to block wrap' do\n respond_to do |format|\n format.html {}\n format.js do\n if params[:auto_search]\n render :json => { :success => true, :data => { :results => render_to_string(:action => 'locator', :layout => false), :maps_data => @map_data, :query => @search.city_state_and_zip } }\n else\n # implementing this ajax response for the search results 'Show More Results' button\n render :json => { :success => !@listings.blank?, :data => { :listings => _get_listing_partials(@listings), :maps_data => @map_data } }\n end\n end\n end\n end\n end\n end", "def map_words_on_page\n fetcher = FetchUrl.new\n page_content = fetcher.fetch(self[:url]).body\n\n processor = PageProcessor.new\n processor.process_page page_content\n end", "def scrape_crossword_home\n\t\turl = \"https://www.nytimes.com/crosswords\"\n\t\tresponse = RestClient.get(url, headers = self.get_headers)\n\n\t\tdoc = Nokogiri::HTML(response.body)\n\t\t@puzzle_ids = extract_puzzle_ids(doc)\n\tend", "def initialize (params = {})\t\t\n\t\t@verbose=params.fetch(:verbose, false)\n\t\t@http_timeout=params.fetch(:http_timeout, 5000)\n\t\t@crawl_depth=params.fetch(:crawl_depth, 4)\n\t\t@crawl_page_limit=params.fetch(:crawl_page_limit, 1000)\n\t\t@max_parallel=params.fetch(:max_parallel, 40)\n\t\t# Discovered data store\t\t\n\t\t@discovered_urls_by_crawler=Hash.new\n\t\t@visited_urls_by_crawler=Hash.new\n\t\t@crawl_start=Hash.new\n\t\t@crawl_done=Hash.new\n\t\t@log_file=File.dirname(__FILE__)+\"../../logs/crawler.log\"\n\tend", "def scrap\n target_url = CGI.unescape(params[:target_url])\n css_selector = CGI.unescape(params[:css_selector])\n @element_id = params[:ele_id]\n\n @scrapped_text = QuickScrapper.scrap(target_url, css_selector)\n first_word_index = params[:first_word_index] || 0\n last_word_index = params[:last_word_index] || -1\n\n @scrapped_text = @scrapped_text.split[first_word_index..last_word_index].join(\" \")\n render :text => \"jQuery('#{@element_id}').html('#{@scrapped_text}');\"\n end", "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def queue_processing\n WebPageLocateWorker.perform_async(self.uuid)\n WebPageColorWorker.perform_async(self.uuid)\n end", "def run\n reset!\n\n pages.each do |page|\n log.puts\n\n if page.respond_to?(:read)\n html = page.read\n elsif page.respond_to?(:call)\n result = instance_eval(&page)\n\n html = case result\n when String\n result\n else\n @agent.page.body\n end\n else\n begin\n html = fetch(page)\n rescue FetchError => e\n log.puts(e.message.red)\n next\n end\n end\n\n process!(html)\n end\n\n report\n\n selectors_to_review\n end", "def process_contents\n @img_tags = @contents.xpath( '//img[@src]' )\n @img_tags.each do |tag|\n download_resource(File.join('http://wiki.dublincore.org', tag[:src]), File.join(@image_dir, File.basename(tag[:src])))\n end\n find_links\n end", "def scrape_text\n\n end", "def crawl\n Offer.fetch_offers\n redirect_to offers_path\n end", "def get_position_links\n # Get all links that have the text: \"View Details\"\n links = @page.links_with(:text => /View Details/)\n href_links = []\n # convert all links into an appropriate html link\n links.each { |link| href_links << 'https://www.jobsatosu.com' + link.href }\n href_links\n end", "def fetch_page_nodes\n (1..12).each do |file_name|\n body = File.open(\"#{Rails.root}/lib/wayfair_batch/#{file_name}.html\")\n @page_nodes.push(Nokogiri::HTML(body))\n end\n end", "def do_after_crawl_blocks\n @after_crawl_blocks.each {|b| b.call(@pages)}\n end", "def at_xpath(*args); end", "def at_xpath(*args); end", "def crawl_url stylesheet_path, entity_type, url\n site = Site.new stylesheet_path\n details = site.style[entity_type].attributes\n details.url = url\n job = Job.new(entity_type, details, site.style, site.context) \n job.perform()\nend", "def crawl\n #cols.map do |col|\n # let's grab each column and the data for that column\n # heading = (document/col.heading_selector).inner_html\n # data = (document/col.column_selector).map { |row| row.inner_html }\n # [heading, data]\n #end.transpose.tap do |dm|\n # let's transpose the matrix and grab the headers\n # @headers = dm.slice(0)\n #end.slice(1..-1).each do |row|\n # and the we take all the data and we yield each row as\n # a hash of headers matched with their column value for this row\n # yield Hash[*@headers.zip(row)]\n #end\n end", "def crawlOne(uri)\r\n @crawled[uri]=true\r\n req = retrievePage(uri)\r\n newURIs = yield(uri,req)\r\n newURIs.each{|link|\r\n if @crawled[link] == nil\r\n @toCrawl << link\r\n end\r\n }\r\n end", "def perform\n @page_source = search_google\n @links = count_links\n @results = search_stats\n @ad_words = ad_words_count\n @html = html_source\n @page_source.quit # quits the webdriver.\n\n self # returns the self object with readable attribures.\n end", "def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end", "def fetch\n hydra = Typhoeus::Hydra.new(:max_concurrency => @threads)\n page, pages = nil, []\n\n @urls.each do |url|\n request = Typhoeus::Request.new(url, :timeout => @timeout, :followlocation => false, :headers => {\"Accept\" => \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\", \"Cache-Control\" => \"no-cache\", \"Pragma\" => \"no-cache\", \"User-Agent\" => UserAgents.random})\n request.on_complete do |response|\n uri = URI(url)\n if response.success?\n puts \"fetching #{url}\".green.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n crawled_time: (Time.now.to_f*1000).to_i)\n elsif (300..307).include?(response.code)\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### redirect to #{response.headers['Location']}\".white.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n redirect_url: response.headers['Location'])\n elsif 404 == response.code\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### not found #{url}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n else\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### failed #{url}\".magenta.on_black\n puts \"### Time: #{response.time} ### #{response.return_message}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n end\n pages << page\n end\n hydra.queue(request)\n end\n hydra.run\n return pages\n end", "def run(search_opts)\r\n\r\n # We need to close the processors if user presses ctrl-c.\r\n trap(\"INT\") do \r\n puts \"\\n**Interrupt received**\\n***Closing processors...\\n\"\r\n close_processors(search_opts.processor_instances)\r\n Process.exit\r\n end\r\n\r\n Anemone.crawl(search_opts.url, :user_agent => search_opts.user_agent, :verbose => true) do |anemone|\r\n anemone.skip_links_like(search_opts.skip_patterns || [])\r\n\r\n # At least one search processor must be specified.\r\n anemone.on_every_page do |page|\r\n search_opts.processor_instances.each do |processor|\r\n processor.process_page(page, anemone.pages)\r\n end\r\n end\r\n\r\n # Close callback on all processors.\r\n anemone.after_crawl do |pages|\r\n close_processors(search_opts.processor_instances)\r\n end\r\n\r\n end\r\n end", "def start threads_count = 10\n\n SuperCrawler::Render.crawling_start_notice( @start_url, threads_count ) if @option_debug # Show message on what will happen\n\n threads = [] # Will contain our n-threads\n @links_queue = Queue.new # Will contain the links queue that the threads will use\n @links = [@start_url] # Re-init the links list\n @crawl_results = [] # Re-init the crawling results\n\n start_time = Time.now if @option_debug # Start the timer\n\n # Let's populate our queue with links and resources from source url\n process_page( @start_url )\n\n # Create threads to handle new links\n threads_count.times do # Create threads_count threads\n\n threads << Thread.new do # Instantiate a new threads\n begin\n while current_link = @links_queue.pop(true) # Pop one link after another\n process_page( current_link ) # Get links and assets of the popped link\n end\n rescue ThreadError # Stop when empty links queue\n end\n end\n\n end\n\n threads.map(&:join) # Activate the threads\n SuperCrawler::Render.crawling_summary_notice(Time.now - start_time, threads_count, @links.count) if @option_debug # Display crawling summary\n\n return true\n end", "def scrap\n\t\turl = 'https://sg.carousell.com/search/products/?query=' + @input\n \tpage = @agent.get(url)\n\t\t@searchData = Nokogiri::HTML(page.body)\n\tend", "def locate\n x = mouse_x + @viewport.ox\n approx = x * value.length / @sprite.bitmap.width\n match = approach(approx, x)\n @text.cursor_jump(match)\n @viewport.ox -= 10 if mouse_x < 0\n @viewport.ox += 10 if (self.width - mouse_x) < 0\n end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def linkReturn(url)\n data = Nokogiri::HTML(open(url))\n links = data.css('.zone_B_with_ads')\n allUrl = links.css('div.tile__content a.tile__read_more').map { |var| var['href'] }\n allUrl.each do |i|\n puts scraper(i)\n puts ''\n #puts i\n end\nend", "def index\n @map_bounds = [20, 20]\n @current_position = [0,0]\n @map = []\n @spots_around = [[-1, 0], [1, 0], [0, -1], [0, 1]]\n create_initial_map\n generate_map\n end", "def explore\n end", "def explore\n end", "def explore\n end", "def explore\n end", "def explore\n end", "def draw_page_index\n self.contents.gradient_fill_rect(0,0,contents.width, line_height, sc1, sc2, true)\n contents.clear_rect(0,0,1,1)\n contents.clear_rect(contents.width-1, 0,1,1)\n contents.clear_rect(0,line_height-1,1,1)\n contents.clear_rect(contents.width-1,line_height-1,1,1)\n draw_page_state\n end", "def process(url, depth)\n @urls_indexed[url] = true\n\n page = agent.get(url)\n\n # Do not handle images etc.\n return unless page.instance_of?(Mechanize::Page)\n\n # Do the actual indexing / analytics\n @callback.call(page, url)\n\n # Process all the links\n page.links.each do |link|\n index link.href, depth + 1\n end\n end", "def crawl\n cnt = 0\n rows = @page.search(\"//table/tr\")\n rows.each do |row|\n cnt = cnt + 1\n data = row.search(\"td\")\n if cnt > 2\n song_url = \"http://p.eagate.573.jp\" + data.search('a/@href').text.strip\n /mid=(.*)/ =~ song_url\n mid = Regexp.last_match[1].to_s.strip\n song_name = data.search('a').text.strip\n ext = row.search('td[5]').text.strip\n adv = row.search('td[4]').text.strip\n bas = row.search('td[3]').text.strip\n\n if ext != '-'\n @ext_total = @ext_total + ext.to_i\n @ext_num = @ext_num + 1\n end\n\n if adv != '-'\n @adv_total = @adv_total + adv.to_i\n @adv_num = @adv_num + 1\n end\n\n if bas != '-'\n @bas_total = @bas_total + bas.to_i\n @bas_num = @bas_num + 1\n end\n\n #update song's scores\n if song = @user.songs.find_by(mid: mid)\n song.bas_score = bas\n song.adv_score = adv\n song.ext_score = ext\n song.save\n else\n # get song's level\n @test = @agent.get song_url\n seqs = @test.search(\"div.seq\")\n tmp = seqs[0].search(\"tr.head\").text.strip\n /LEVEL : (.*)/ =~ tmp\n bas_lv = Regexp.last_match[1].strip\n tmp = seqs[1].search(\"tr.head\").text.strip\n /LEVEL : (.*)/ =~ tmp\n adv_lv = Regexp.last_match[1].strip\n tmp = seqs[2].search(\"tr.head\").text.strip\n /LEVEL : (.*)/ =~ tmp\n ext_lv = Regexp.last_match[1].strip\n\n @user.songs.create!(name: song_name, bas_score: bas, adv_score: adv, ext_score: ext, bas_lv: bas_lv, adv_lv: adv_lv, ext_lv: ext_lv, mid: mid)\n end\n\n puts \"#{ song_name } \".colorize(:cyan) + \"紅譜:#{ ext } \".colorize(:red) + \"黃譜:#{ adv } \".colorize(:yellow) + \"綠譜:#{ bas }\".colorize(:green)\n end\n end\n end", "def scrape\n scraped_articles=[]\n scraped_articles=scrape_articles(false)\n # Iterate through the API List\n scraped_articles['response']['docs'].each do |item|\n process_item (item)\n end\n end", "def initialize page, options = {}\n options = {:start_type => :address, :target_type => :address, :include_coords => true}.merge(options)\n @do_load = options[:include_coords]\n self.start_type = options[:start_type]\n self.target_type = options[:target_type]\n self.notes = Array.new\n\n #summary_time = page.search(\"//div[contains(@class, 'querysummary2')]\").text.strip\n summary_time = page.search(\"//*[@class='querysummary2']\").text.strip\n\n \n # parse (warning) notes regarding the route from several html\n # classes of the html document\n \n # parse (general) notes from html class /haupt rline/\n includes = [\"Einfache Fahrt\", \"Preisinformationen\", \"Weitere Informationen\", \n \"Start/Ziel mit äquivalentem Bahnhof ersetzt\", \"Reiseprofil ändern\"]\n start_with = [\"Reiseprofil\", \"Hinweis\", \"Aktuelle Informationen\"]\n prepare_notes = page.search(\"//div[contains(@class, 'haupt rline')]\").map(&:text).map(&:strip) \n prepare_notes = prepare_notes.map { |n| n.gsub(\"\\n\", \" \").strip.split.join(\" \") } - [\"\"]\n prepare_notes = prepare_notes.delete_if { |n| includes.any?{ |s| n.match(s) } }\n self.notes.concat(prepare_notes)\n\n # parse (important) notes from html class /red bold haupt/\n notes = Array.new\n notes << page.search(\"//div[contains(@class, 'red bold haupt')]\").map(&:text).map(&:strip)\n notes.each do |note|\n self.notes << note if note.size > 0\n end\n\n self.price = parse_price(page.search(\"//div[contains(@class, 'formular')]\").map(&:text).map(&:strip))\n change = page.search(\"//div[contains(@class, 'routeStart')]\")\n name = station_to_name change\n last_lines = get_lines(change)\n\n part = RoutePart.new\n part.type = parse_transport_medium(page.search(\"//div[contains(@class, 'routeStart')]/following::*[1]\"))\n part.start_time = parse_date(summary_time.split(\"\\n\")[0...2].join(\" \"))\n part.start_time -= last_lines.last.to_i.minutes if options[:start_type] == :address\n part.start_delay = parse_delay(summary_time.split(\"\\n\")[0...2].join(\" \"))\n part.start = Station.new({\"value\" => name, :load => options[:start_type] == :address ? :foot : :station, :do_load => @do_load})\n part.platform_start = parse_platform(last_lines.last)\n\n @parts = [part]\n \n page.search(\"//div[contains(@class, 'routeChange')]\").each_with_index do |change, idx|\n part = RoutePart.new\n name = station_to_name change\n lines = change.text.split(\"\\n\")\n\n part.type = parse_transport_medium(page.search(\"//div[contains(@class, 'routeChange')][#{idx+1}]/following::*[1]\"))\n part.start = Station.new({\"value\" => name, :load => :station, :do_load => @do_load})\n \n lines = get_lines(change)\n if lines.last.start_with?(\"ab\")\n part.start_time = parse_date(lines.last)\n part.start_delay = parse_delay(lines.last)\n part.platform_start = parse_platform(lines.last)\n unless lines.first.starts_with?(\"an\")\n @parts.last.end_time = @parts.last.start_time + last_lines.last.to_i.minutes\n end\n end\n \n if lines.first.starts_with?(\"an\")\n @parts.last.end_time = parse_date(lines.first)\n @parts.last.target_delay = parse_delay(lines.first)\n @parts.last.platform_target = parse_platform(lines.first)\n unless lines.last.start_with?(\"ab\")\n # Fußweg for part\n part.start_time = @parts.last.end_time\n end\n end\n \n last_lines = lines\n \n @parts.last.target = part.start\n @parts << part #unless @parts.last.start == part.start\n end\n \n \n change = page.search(\"//div[contains(@class, 'routeEnd')]\")\n name = station_to_name change\n @parts.last.target = Station.new({\"value\" => name, :load => options[:target_type] == :address ? :foot : :station, :do_load => @do_load})\n lines = get_lines(change)\n\n if lines.first.starts_with?(\"an\")\n @parts.last.end_time = parse_date(lines.first)\n @parts.last.target_delay = parse_delay(lines.first)\n @parts.last.platform_target = parse_platform(lines.first)\n else\n @parts.last.end_time = @parts.last.start_time + last_lines.last.to_i.minutes\n end\n\n \n end", "def do_after_crawl_blocks\n @after_crawl_blocks.each { |block| block.call(@pages) }\n end", "def traverse_links(seed_url, max_pages, output_dir, algo, spam_path, nonspam_path)\n spamCalc = SpamCalculator.new(spam_path, nonspam_path)\n #contains [link, spamScore] arrays for the sake of bestfirst\n links_to_visit = []\n links_to_visit.push([seed_url, 0])\n pages_visited = 0\n time_of_last_get = Time.now.to_f\n while (links_to_visit.length != 0 && pages_visited < max_pages)\n time_difference = Time.now.to_f - time_of_last_get\n if time_difference < 1\n sleep(1-time_difference)\n end\n time_of_last_get = Time.now.to_i\n link = links_to_visit.pop[0]\n puts \"link: \" + link\n if $index[link]\n next\n end\n process_results = process_link(link, output_dir, spamCalc, pages_visited)\n if !process_results\n puts \"error retrieving page at \" + link\n next\n end\n currentPage = process_results[0]\n currentScore = process_results[1]\n pages_visited += 1\n puts \"size: \" + $index.size.to_s\n links = find_links(process_results[0])\n for link in links\n if !link.is_a?(\"\".class)\n abort \"Non-string in link queue\"\n end\n if $index.has_key?(link) || links_to_visit.include?(link)\n next\n end\n if (algo == 'dfs' || algo == 'bestfirst')\n links_to_visit.push([link, currentScore])\n elsif (algo == 'bfs')\n links_to_visit.unshift([link, currentScore])\n else\n abort \"Not a valid algorithm name\"\n end\n end\n if (algo == 'bestfirst')\n links_to_visit.sort_by!{|item| -item[1]}\n end\n end\n path_to_index_file = File.join(output_dir + '../index.dat').to_s\n puts path_to_index_file\n output = File.new(path_to_index_file, \"w+\")\n for key in $index.keys\n scoreAndFilename = $index[key]\n output_line = scoreAndFilename[1] + \"\\t\" + scoreAndFilename[0].to_s + \"\\t\" + key + \"\\n\"\n output.write(output_line)\n end\n output.close\nend" ]
[ "0.62187535", "0.60555804", "0.60081893", "0.5854296", "0.5789269", "0.576842", "0.57567817", "0.57545316", "0.56965464", "0.5645524", "0.5638336", "0.56190753", "0.5605434", "0.5588099", "0.55690336", "0.55631924", "0.5541345", "0.5541345", "0.54846895", "0.5465554", "0.54406774", "0.54270095", "0.5402025", "0.5380639", "0.5359764", "0.5343849", "0.53322315", "0.5331692", "0.5310821", "0.5272744", "0.52673227", "0.525614", "0.5251111", "0.5249939", "0.524202", "0.5224508", "0.5216072", "0.5216072", "0.5206599", "0.51947844", "0.5170591", "0.513537", "0.51323026", "0.5125088", "0.5122557", "0.5103355", "0.50955856", "0.5082342", "0.5079597", "0.5075423", "0.5066606", "0.5066221", "0.50581974", "0.5037256", "0.5035724", "0.50300634", "0.5029589", "0.5029589", "0.5029589", "0.5029589", "0.50165933", "0.50159526", "0.49856263", "0.49839276", "0.4978794", "0.49705905", "0.4949368", "0.49456507", "0.49447036", "0.49447036", "0.49383247", "0.4928515", "0.4925349", "0.49200568", "0.49182677", "0.49157634", "0.49137935", "0.48997274", "0.4879052", "0.4877953", "0.48769626", "0.48769626", "0.48769626", "0.48769626", "0.48769626", "0.48769626", "0.48745912", "0.4874535", "0.48726732", "0.48726732", "0.48726732", "0.48726732", "0.48726732", "0.4871471", "0.487132", "0.48566315", "0.48557672", "0.4852049", "0.4851467", "0.48442364" ]
0.5527353
18
Authoritative list of URLs to be processed by Rcrawl
def url_server unless @links_to_visit.empty? @url = @links_to_visit.pop end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urls\n (url.split(\",\") rescue []) + [cran_url]\n end", "def urls\n @urls ||= extract_urls('url')\n end", "def urls\n each_url.to_set\n end", "def urls\n @urls ||= all_urls(sitemap)\n end", "def all_urls\n urls = NG_URL.all.collect {|n| n.url}\n urls.sort!\n end", "def urls\n @@urls\n end", "def urls(text)\n scan(text, URL, :url)\n end", "def getScrapingURLs(shared)\n\tFile.open(\"urls.txt\").each do |line|\n\t\tshared.pushurl(line.chomp)\n\tend\nend", "def get_links(url)\n # catch 404 error from host\n\n doc = Nokogiri::HTML(open(url))\n # find internal links on page\n doc.css('#tagCloud a').each do |link|\n link = link.attr('href')\n # If link correspond to a recipe we add it to recipe to scraw\n if link.include?(ALLOWED_URLS[@host]) && !@crawled_urls.include?(url)\n @to_crawl_urls << link\n end\n end\n @to_crawl_urls.delete url\n @crawled_urls << url\n @to_crawl_urls.uniq!\n rescue OpenURI::HTTPError\n @to_crawl_urls.delete url\n warn \"#{url} cannot be reached\"\n end", "def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end", "def get_urls()\n generate_thread(@@source_url)\n end", "def get_urls(page)\n doc = Nokogiri::XML(open_url(page))\n urls = []\n\n doc.search('nodes > node').each do |node|\n url = nil\n node.search('URL').each do |t|\n url = t.inner_text\n end\n if url\n urls << url\n end\n end\n\n urls\n end", "def urls(env)\n begin\n page = env[:page]\n agent = env[:agent]\n follower_url = page.search(FLAG)[1].attributes['href'].value\n follower_page = agent.get(follower_url)\n tables = follower_page.search(FOLLOWER_FLAG)\n tables.map{|table| get_url_from_table(table)}\n rescue => err\n CrawlingService.log(err.message)\n CrawlingService.log(err.backtrace)\n []\n end\n\n end", "def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(URLS_COLLECTION, query,\n sort: sort, limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end", "def sitemap_urls\n each_sitemap_url.to_a\n end", "def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(:urls, query,\n sort: sort, projection: {},\n limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end", "def all_urls_external\n ngurls = NG_URL.all(:a_hrefs_external => { :$not => { :$size => 0}})\n urls_external = []\n ngurls.each {|n| urls_external += n.a_hrefs_external }\n urls_external.uniq!.sort!\n end", "def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\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 contract_urls\n Scrapers::ContractUrlExtractor.new(report.url).urls\n end", "def urls\n URI.extract(self.script)\n end", "def find_links(url)\n # This should return an array of all links at the given URL\nend", "def get_all_new_urls(results)\n all_urls = results.map { |result| result.absolute_linked_resources }.flatten\n all_urls.uniq!\n #TODO: handle any other url parsing error\n all_urls.delete_if { |url| !a_domain_we_care_about?(url)}\n all_urls.delete_if { |url| i_have_seen_this_url_before?(url)}\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def get_hrefs\n # this will grab all the html from the url that\n # the user created the scraper with\n url_to_scrape = HTTParty.get(self.url)\n # nokogiri turns everything from HTTParty into nodes.\n nodes = Nokogiri::HTML(url_to_scrape)\n nodes.css('a').each do |a|\n self.hrefs << a['href']\n end\n self.hrefs\n end", "def crawl_urls(urls = @urls, &block)\n raise 'No urls to crawl' unless urls\n\n @docs = []\n doc = nil\n Wgit::Utils.each(urls) { |url| doc = handle_crawl_block(url, &block) }\n doc || @docs.last\n end", "def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end", "def all_list_page_urls\n LIST_PAGE_URLS.each_with_index do |list_page_url, i|\n begin\n puts \"-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --\"\n yield(list_page_url)\n rescue => e\n puts \"Failed to crawl list_page_url:#{e.message}\"; next\n end\n end\n end", "def all_list_page_urls\n LIST_PAGE_URLS.each_with_index do |list_page_url, i|\n begin\n puts \"-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --\"\n yield(list_page_url)\n rescue => e\n puts \"Failed to crawl list_page_url:#{e.message}\"; next\n end\n end\n end", "def urls\n keys\n end", "def urls\n @sets.collect(&:keys).flatten\n end", "def get_urls()\n if (! ENV['names'])\n # We have no hosts to check, let's bail\n exit 1\n end\n urls = []\n i = 1\n ENV['names'].split(\" \").each do |cururl|\n thisurl = {}\n # Label and url are required.\n thisurl[:label] = ENV[\"label_#{cururl}\"]\n thisurl[:url] = ENV[\"url_#{cururl}\"]\n thisurl[:name] = cururl\n # optional parameters\n thisurl[:warning] = (ENV[\"warning_#{cururl}\"].nil?)? 0 : ENV[\"warning_#{cururl}\"]\n thisurl[:critical] = (ENV[\"critical_#{cururl}\"].nil?)? 0 : ENV[\"critical_#{cururl}\"]\n thisurl[:max] = (ENV[\"max\"].nil?)? DEFAULT_MAX : ENV[\"max\"]\n thisurl[:port] = (ENV[\"port_#{cururl}\"].nil?)? nil : ENV[\"port_#{cururl}\"]\n thisurl[:path] = (ENV[\"path_#{cururl}\"].nil?)? nil : ENV[\"path_#{cururl}\"]\n thisurl[:wget_post_data] = (ENV[\"wget_post_data_#{cururl}\"].nil?)? nil : ENV[\"wget_post_data_#{cururl}\"]\n thisurl[:error_value] = (ENV[\"error_value_#{cururl}\"].nil?)? nil : ENV[\"error_value_#{cururl}\"]\n thisurl[:regex_error_value] = (ENV[\"regex_error_value_#{cururl}\"].nil?)? nil : ENV[\"regex_error_value_#{cururl}\"]\n thisurl[:regex_header_1] = (ENV[\"regex_header_1_#{cururl}\"].nil?)? nil : ENV[\"regex_header_1_#{cururl}\"]\n thisurl[:grep_opts] = (ENV[\"grep_opts_#{cururl}\"].nil?)? nil : ENV[\"grep_opts_#{cururl}\"]\n thisurl[:wget_opts] = (ENV[\"wget_opts_#{cururl}\"].nil?)? nil : ENV[\"wget_opts_#{cururl}\"]\n thisurl[:join_lines] = (ENV[\"join_lines_#{cururl}\"].nil?)? nil : ENV[\"join_lines_#{cururl}\"]\n thisurl[:index] = i\n thisurl[:wget_output_file] = DATA_DIR + \"/tmp/wget_output_\"+cururl\n urls[i-1] = thisurl\n i+=1\n end\n return urls\nend", "def perform\n get_all_the_urls_of_val_doise_townhalls\n end", "def urls\n \n # Go through the 3 urls in the record and retrieve the urls and associated \n # text for the caller\n references = []\n 1.upto(3) do |i|\n \n url = self.send(\"url#{i}\")\n break if url == ''\n \n url_text = self.send(\"url#{i}_name\")\n url_text = 'Reference' if url_text == ''\n references.push({ :text => url_text, :url => url })\n \n end\n \n references\n \n end", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend", "def relevant_links\n ['libproxy.mit.edu', 'library.mit.edu', 'sfx.mit.edu', 'owens.mit.edu',\n 'libraries.mit.edu', 'content.ebscohost.com']\n end", "def post_urls\n arr_hrefs = []\n collect_post_elements.each do |element|\n # there should only be one headline link per post\n if link = element.search( headline_element ).first \n uri = URI.parse link['href']\n uri.fragment = nil\n arr_hrefs << uri.to_s \n end\n end\n\n return arr_hrefs\n end", "def crawls\n\t\t\t\t@url_collection.select{|k,v| v.crawled?}\n\t\t\tend", "def links\n @links ||= parsed_links.map{ |l| absolutify_url(unrelativize_url(l)) }.compact.uniq\n end", "def crawler(url)\n result = []\n doc = Nokogiri::HTML.parse(open(url))\n row = doc.xpath(\"//tr[4]\").first\n while(row)do\n row_doc = Nokogiri::HTML(row.to_s)\n link = row_doc.xpath(\"//a\").first\n if(link)then\n href = url + link.attribute(\"href\").value\n if(href =~ /\\/$/)then\n result = result + crawler(href)\n else\n result << href\n end\n end\n row = row.next\n end\n return result\n end", "def crawler(url)\n result = []\n doc = Nokogiri::HTML.parse(open(url))\n row = doc.xpath(\"//tr[4]\").first\n while(row)do\n row_doc = Nokogiri::HTML(row.to_s)\n link = row_doc.xpath(\"//a\").first\n if(link)then\n href = url + link.attribute(\"href\").value\n if(href =~ /\\/$/)then\n result = result + crawler(href)\n else\n result << href\n end\n end\n row = row.next\n end\n return result\n end", "def links()\n links = Nokogiri::HTML(RedCloth.new(self.body).to_html).css(\"a\").map do |link|\n if (href = link.attr(\"href\")) && href.match(/^https?:/)\n href\n end\n end.compact\n uris = []\n links.each do |link|\n puts link\n uris.push(URI.parse(link))\n end\n return uris\n end", "def get_urls_for_client_jars(existing, urls)\n []\n end", "def get_urls_for_client_jars(existing, urls)\n []\n end", "def exec_request\n @urls.map { |url| fetch(url) }\n end", "def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end", "def crawled_urls(limit: 0, skip: 0, &block)\n urls(crawled: true, limit: limit, skip: skip, &block)\n end", "def crawled_urls(limit: 0, skip: 0, &block)\n urls(crawled: true, limit: limit, skip: skip, &block)\n end", "def extract_urls(node_name)\n return document.to_s.each_line.map(&:strip) if plain_document?\n\n urls = []\n document.root.elements.each(\"#{node_name}/loc\") do |element|\n urls << element.text\n end\n urls\n end", "def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend", "def crawl_site(url, allow_paths: nil, disallow_paths: nil, &block)\n doc = crawl_url(url, &block)\n return nil if doc.nil?\n\n path_opts = { allow_paths: allow_paths, disallow_paths: disallow_paths }\n alt_url = url.end_with?('/') ? url.chop : url + '/'\n\n crawled = Set.new([url, alt_url])\n externals = Set.new(doc.external_links)\n internals = Set.new(get_internal_links(doc, path_opts))\n\n return externals.to_a if internals.empty?\n\n loop do\n links = internals - crawled\n break if links.empty?\n\n links.each do |link|\n orig_link = link.dup\n doc = crawl_url(link, follow_redirects: :host, &block)\n\n crawled += [orig_link, link] # Push both links in case of redirects.\n next if doc.nil?\n\n internals += get_internal_links(doc, path_opts)\n externals += doc.external_links\n end\n end\n\n externals.to_a\n end", "def crawl\n recursive_explore([@origin_url],1)\n end", "def paths_from_urls\n urls = []\n parsed_urls.each do |url|\n path = URI(url).path.sub(/^(http(s)?(:)?(\\/)+?(:)?)?((\\/)?www.)?gov.uk/, \"\")\n urls << (path.start_with?(\"/\") ? path : \"/#{path}\")\n end\n urls.uniq\n end", "def get_all_urls\r\n val_d_oise = \"http://annuaire-des-mairies.com/val-d-oise.html\"\r\n page = Nokogiri::HTML(URI.open(val_d_oise))\r\n links = page.xpath('//*[@class=\"lientxt\"]').map{|anchor| anchor[\"href\"]}\r\n return links\r\nend", "def city_list(url)\n\troot = Nokogiri::HTML(open(url))\n list = root.css(\"a\").map do |link|\n\n\t\t# This makes sure that we only store actual links, then stores the text & link for each valid link in an array.\n\n if link[:href] =~ /http/ \n [link.text, link[:href]] \n end \n end\n\n\t# This cleans up the array and gets rid of nil elements\n\n\tlist = list.reject {|x| x.nil?} \n\t\t\n\t## Here we have various sections of CL that we can search in for various gigs. \n\t## If you wanted to see more software development stuff, you may search in /sof and /eng\n\t\n\t\t\n\t# list.map! {|f,l| [f, l + \"/cpg/\"]}\n\t# list.map! {|f,l| [f, l + \"/web/\"]}\n\tlist.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\"]}\t\n\t# list.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\", l + \"/eng/\", l + \"/sof/\", l + \"/sad/\"]}\n\t\nend", "def get_urls\n\n url_array = []\n top_five = 0\n\n while top_five < 5\n url_array << @news_instance[\"response\"][\"docs\"][top_five][\"web_url\"]\n top_five += 1\n end\n\n # returns the array\n return url_array\n\n end", "def get_townhall_urls(url)\n page = Nokogiri::HTML(open(url))\n cities_url = page.xpath('//a[@class=\"lientxt\"]').to_a\n links = (cities_url.map {|url| url[\"href\"][1..-1]}).to_a\n #puts links\n return links\nend", "def unknown_urls\n\t\treturn [] if @setup.secure or @setup['no_cache'] or not FileTest::exist?( @setup['cache_path'] )\n\n\t\tr = Array.new\n\t\tdb = DispRef2PStore.new( @setup['cache_path'] )\n\t\tdb.transaction( true ) do\n\t\t\tbegin\n\t\t\t\tdb[Root_DispRef2URL].each_pair do |url, data|\n\t\t\t\t\tnext if DispRef2String::url_match?( url, @setup.no_referer )\n\t\t\t\t\tnext if DispRef2String::url_match?( url, @setup['reflist.ignore_urls'] )\n\t\t\t\t\tr << url if DispRef2URL::Unknown == data[0] or @setup['normal-unknown.title.regexp'] =~ data[2]\n\t\t\t\tend\n\t\t\trescue PStore::Error\n\t\t\tend\n\t\tend\n\t\tdb = nil\n\t\tr\n\tend", "def links; end", "def links; end", "def visit_urls\n @url_rules.accept\n end", "def crawl_site(url = @urls.first, &block)\n assert_type(url, Wgit::Url)\n\n doc = crawl_url(url, &block)\n return nil if doc.nil?\n\n host = url.to_base\n alt_url = url.end_with?('/') ? url.chop : url + '/'\n crawled = [url, alt_url]\n externals = doc.external_links\n internals = get_internal_links(doc)\n\n return doc.external_links.uniq if internals.empty?\n\n loop do\n crawled.uniq!\n internals.uniq!\n\n links = internals - crawled\n break if links.empty?\n\n links.each do |link|\n orig_link = link.dup\n doc = crawl_url(\n link, follow_external_redirects: false, host: host, &block\n )\n\n crawled.push(orig_link, link) # Push both in case of redirects.\n next if doc.nil?\n\n internals.concat(get_internal_links(doc))\n externals.concat(doc.external_links)\n end\n end\n\n externals.uniq\n end", "def pet_urls_from_doc(doc)\n doc.xpath(\"//h3[@class='catItemTitle']/a/@href\").map do |href|\n \"https://www.strayrescue.org#{href}\"\n end\n end", "def get_all_the_urls_of_val_doise_townhalls\n urls = []\n\n directory = Nokogiri::HTML(open('http://annuaire-des-mairies.com/val-d-oise.html'))\n directory.css('a[class = lientxt]').each do |element|\n # element => <a class=\"lientxt\" href=\"./95/nom-de-la-ville.html\">NOM DE LA VILLE</a>\n link = element['href']\n link[0] = ''\n urls << \"http://annuaire-des-mairies.com#{link}\"\n end\n\n urls\nend", "def all\n @all ||= raw.map { |link| URL.absolutify(link, base_url) }.compact.uniq\n end", "def links\n @links ||= parsed_links.map{ |l| URL.absolutify(URL.unrelativize(l, scheme), base_url) }.compact.uniq\n end", "def sitemap_index_urls\n each_sitemap_index_url.to_a\n end", "def links\n links = []\n result = self.perform\n links = result.ft_links\n end", "def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n url = result['href']\n query = URI.parse(url).query\n result_url = CGI.parse(query)['q'].first\n result_url = url if result_url.nil?\n urls << result_url\n end\n return urls\n end", "def url_whitelist; end", "def get_redirection_urls\n\t\tputs \"getter to retrieve all the redirection URLs from the site store.\" if @verbose\n\t\turls=Array.new\n\t\t@known_sites.keys.map do |key|\n\t\t\tunless @known_sites[key]['redirection'].nil?\n\t\t\t\turls.push(@known_sites[key]['redirection'])\n\t\t\tend\n\t\tend\n\t\turls.sort!\n\t\treturn urls\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend", "def unknown_urls\n\t\tr = Array.new\n\t\tself.latest( @conf.latest_limit ) do |diary|\n\t\t\trefs = DispRef2Refs.new( diary, @setup )\n\t\t\th = refs.urls( DispRef2URL::Antenna )\n\t\t\th.each_key do |url|\n\t\t\t\tnext unless @setup['normal-unknown.title.regexp'] =~ h[url][2]\n\t\t\t\tnext if DispRef2String::url_match?( url, @setup.no_referer )\n\t\t\t\tnext if DispRef2String::url_match?( url, @setup['reflist.ignore_urls'] )\n\t\t\t\tr << url\n\t\t\tend\n\t\t\th = nil\n\t\t\trefs.urls( DispRef2URL::Unknown ).each_key do |url|\n\t\t\t\tnext if DispRef2String::url_match?( url, @setup.no_referer )\n\t\t\t\tnext if DispRef2String::url_match?( url, @setup['reflist.ignore_urls'] )\n\t\t\t\tr << url\n\t\t\tend\n\t\tend\n\t\tr.uniq\n\tend", "def feed_urls\n nil\n end", "def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend", "def get_townhall_urls(url)\n\n page = Nokogiri::HTML(URI.open(url)) \n #townhall_url = page.xpath(\"//a/@href\").map {|x| x.value}\n townhall_urls_array_incomplete = page.css('a[href].lientxt').map {|x| x[\"href\"]}\n #remove the dot at the beginning of the url\n townhall_urls_array_incomplete = townhall_urls_array_incomplete.map {|x| x[2..]}\n townhall_urls_array = townhall_urls_array_incomplete.map {|x| \"http://annuaire-des-mairies.com/\" + x}\n return townhall_urls_array\n\nend", "def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend", "def process_links(host_url)\n file = open(url)\n links = Nokogiri::HTML(file).search('a')\n protocol = url.split('://').first\n links = links.map { |link| [link.text.strip, link['href']] }.to_h\n create_report(links, protocol, host_url)\n rescue StandardError => error\n puts \"Error Encountered : #{error}\"\n end", "def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end", "def urls\n @gapi.source_uris\n end", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def object_url_list(baseurl)\n object_url_list = []\n raw_html = open(baseurl, :read_timeout => 60)\n parsed_html = Nokogiri::HTML(raw_html)\n\n # Get all object works elements and return them as an array of urls\n parsed_html.css(\".oe-drawer-list li\").each do |link|\n url = link.at(\"a @href\").to_s\n # Only get list of objects\n if url.include?(\"art-object-page\")\n object_url_list << url\n end\n end\n\n puts \"#{object_url_list.count} objects to download.\"\n\n # Discard first result for \"all paintings\"\n object_url_list.slice!(0)\n\n return object_url_list\nend", "def urls_of_val_doise_townhalls\n\turl_parent = \"http://annuaire-des-mairies.com/\" # The parent page url which list the town hall pages url\n\tpage = Nokogiri::HTML(open(url_parent+\"/val-d-oise.html\")) # url from the page and the specific town link\n\turls_array = page.xpath('//a[@class = \"lientxt\"]').map { |node| url_parent + node.attributes[\"href\"].value[1..-1] }\n\treturn urls_array # urls sheet\nend", "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 visited_spots_urls(user_id=self.username)\n connection.get(\"/users/#{user_id}/visited_spots_urls\").body.urls\n end", "def get_townhall_urls(townhall_list)\n page = Nokogiri::HTML(URI.open(townhall_list))\n annuaire = []\n page.xpath('//a[@class=\"lientxt\"]/@href').each do |link|\n annuaire << link.text\n end\n annuaire.map!{ |x| [\"https://www.annuaire-des-mairies.com\", x.reverse.chop.reverse].join}\n return annuaire\nend", "def external_links\n return [] if @links.empty?\n\n links = @links\n .reject { |link| link.relative_link?(host: @url.to_base) }\n .map(&:without_trailing_slash)\n\n Wgit::Utils.process_arr(links)\n end", "def url_whitelist=(_arg0); end", "def get_all_the_urls_of_val_doise_townhalls()\n urls_town = []\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n doc.css('a.lientxt').each do |x|\n lien_page_mairie = x['href']\n lien_page_mairie.slice!(0)\n lien_page_mairie = \"http://annuaire-des-mairies.com\" + lien_page_mairie\n urls_town.push(lien_page_mairie)\n end\n return urls_town\nend", "def get_urls(proxy=nil)\n query = SETTINGS.extract_query!\n payloads = SETTINGS.create_payloads(PAYLOAD_TEMPLATE_PATH)\n File.read(\"#{QUERY_BLACKLIST_PATH}\").each_line do |black| # check if the search query is black listed\n if query == black\n FORMAT.warning(\"Query: #{query} is blacklisted, defaulting to random query\")\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample # Retry if it is\n end\n end\n\n FORMAT.info(\"I'm searching for possible SQL vulnerable sites, using search query #{query.chomp}\")\n agent = Mechanize.new\n if proxy\n agent.set_proxy(proxy.split(\":\").first, proxy.split(\":\").last) # Set your proxy if used\n end\n correct_agent = SETTINGS.random_agent?\n agent.user_agent = correct_agent\n\n correct_agent == DEFAULT_USER_AGENT ? FORMAT.info(\"Using default user agent\") :\n FORMAT.info(\"Grabbed random agent from #{RAND_AGENT_PATH}\")\n\n google_page = agent.get(\"http://google.com\")\n google_form = google_page.form('f')\n\n FORMAT.info(\"Verifying search query...\")\n unless SETTINGS.test_query(query, correct_agent, proxy)\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample\n LOGGER.info(\"Query changed to: #{query}\")\n end\n\n google_form.q = \"#{query}\" # Search Google for the query\n url = agent.submit(google_form, google_form.buttons.first)\n\n url.links.each do |link|\n if link.href.to_s =~ /url.q/ # Pull the links from the search\n str = link.href.to_s\n str_list = str.split(%r{=|&})\n urls = str_list[1]\n if urls.split(\"/\")[2].start_with?(*SKIP) # Skip all the bad URLs\n next\n end\n urls_to_log = URI.decode(urls)\n FORMAT.success(\"Site found: #{urls_to_log}\")\n sleep(0.3)\n payloads.each { |payload|\n File.open(\"#{SITES_TO_CHECK_PATH}\", \"a+\") { |to_check| to_check.puts(\"#{urls_to_log}#{payload}\")}\n }\n end\n end\n FORMAT.info(\"I've dumped possible vulnerable sites into #{SITES_TO_CHECK_PATH}\")\n end", "def links\n @links ||= begin\n if doc\n # get a list of distinct links on the page, in absolute url form\n links = doc.css('a[href]').inject([]) do |list, link|\n href = link.attributes['href'].content\n href.strip! if href\n \n unless skip_link?(href)\n begin\n url = to_absolute(href)\n rescue URI::InvalidURIError\n $stderr.puts \"ERROR: bad URI #{href.inspect} on page #{self.url.to_s.inspect}\"\n else\n list << url if url.scheme =~ /^https?$/\n end\n end\n list\n end\n \n links.uniq!\n links\n else\n []\n end\n end\n end", "def queue_urls\n @queue_urls ||= init_urls\n end", "def to_urls!\n map! { |element| process_url_element(element) }\n end", "def python_hard_way_urls\n urls = ['http://learnpythonthehardway.org/book/intro.html']\n (0..52).each do |val|\n urls << 'http://learnpythonthehardway.org/book/ex' + val.to_s + '.html'\n end\n urls << 'http://learnpythonthehardway.org/book/next.html'\n urls << 'http://learnpythonthehardway.org/book/advice.html'\n urls\nend", "def links\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n\n doc.search(\"//a[@href]\").each do |a|\n next if a['data-method'] && a['data-method'] != 'get'\n u = a['href']\n next if u.nil? or u.empty?\n abs = to_absolute(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end", "def linkCollector(pageName)\n\turls = Array.new\n\tstr = \"http://www.usm.edu\"\n\n\t# Collects links from page\n\tbegin\n\t\tcurrentPage = Nokogiri::HTML(open(pageName, 'User-Agent' => 'ruby', :allow_redirections => :safe))\n\trescue OpenURI::HTTPError => e\n \tputs \"Can't access #{ pageName }\"\n \tputs e.message\n\t\tputs\n end\n $visitedCounter += 1\n\tlinks = currentPage.css(\"a\")\n\tlinks.each do |link|\n\t\tif link['href'] =~ /science-technology/ and link['href'] !~ /staff|faculty|jpg|pdf/\n\t\t\tif link['href'] !~ /www.usm.edu/\n\t\t\t\turls.push(str + link['href'])\n\t\t\telse\n\t\t\t\turls.push(link['href'])\n\t\t\tend\n\t\tend\n\tend\n\treturn urls\nend", "def urls() @urls ||= Flickr::Urls.new(self) end", "def mirror_urls\n Array(self.get_with_key('/mirrors.xml')['Mirrors']['Mirror']['mirrorpath'])\n end", "def get_townhall_urls\r\n\r\n # Scrapping de toutes les URLs\r\n page = Nokogiri::HTML(URI.open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\r\n\turls = page.xpath('//*[@class=\"lientxt\"]/@href') # toutes les URLs appartiennent à la classe lientxt\r\n\r\n #stockage des URLs scrappées dans une array\r\n\turl_array = []\r\n urls.each do |url| # pour chaque URLs récupérées, il faut leur indiquer l'url parent \"http://annuaire-des-mairies.com\"\r\n\t\turl = \"http://annuaire-des-mairies.com\" + url.text[1..-1] # A l'url parent, on ajoute les urls récupérées du deuxième caractère au dernier caractère, car on veut se débarasser du point devant.\r\n\t\turl_array << url\r\n end\r\n\r\n puts \" ⏳ URLs scrapping in process...3️, 2️, 1️\" \r\n sleep 3\r\n puts \"⭐⭐⭐ BINGOOOOOO ⭐⭐⭐\" #https://emojipedia.org/\r\n sleep 1\r\n return url_array \r\nend", "def get_queued_links()\n\t\thydra.queued_requests.map do |req|\n\t\t\treq.url\n\t\tend\n\tend", "def getCompanyURLs(relativeURL)\n\tdoc = Nokogiri::HTML(open(@baseURL + relativeURL))\n\treturn doc.css('div.left.company_info a:not([onclick])').map { |a| a['href'] }\nend" ]
[ "0.753609", "0.7512041", "0.7365178", "0.7319558", "0.70718795", "0.69079643", "0.6902058", "0.6862422", "0.68256235", "0.6758606", "0.6742965", "0.6725288", "0.6719128", "0.6669686", "0.66685915", "0.6663371", "0.6606148", "0.6563594", "0.6552189", "0.6527387", "0.6510926", "0.65016246", "0.6495526", "0.6476761", "0.6467884", "0.6463578", "0.64483774", "0.64456147", "0.64456147", "0.6421735", "0.64199793", "0.63925916", "0.6366879", "0.63552696", "0.6353228", "0.6342991", "0.632456", "0.631928", "0.63152486", "0.62915444", "0.62915444", "0.6289809", "0.6276381", "0.6276381", "0.6274823", "0.62727803", "0.62591624", "0.62591624", "0.6224569", "0.62146765", "0.6213578", "0.6212445", "0.620272", "0.6198351", "0.6197832", "0.61756843", "0.6174545", "0.6168466", "0.6164049", "0.6164049", "0.615665", "0.6153595", "0.6132906", "0.613262", "0.61313903", "0.6123488", "0.6120019", "0.6116783", "0.6106718", "0.6105813", "0.60892904", "0.6072106", "0.60603124", "0.6058268", "0.60537434", "0.605067", "0.6044365", "0.60421133", "0.60363305", "0.6036036", "0.6036036", "0.60351485", "0.6034607", "0.6029133", "0.60160273", "0.6014207", "0.5990182", "0.59864014", "0.59837836", "0.59788", "0.5977689", "0.59724873", "0.59692013", "0.5968724", "0.5966749", "0.5964419", "0.5962475", "0.5959388", "0.595233", "0.5950988", "0.59483004" ]
0.0
-1
Rewind Input Stream, for storing and reading of raw HTML
def ris(document) print "." # Store raw HTML into local variable # Based on MIME type, invoke the proper processing modules case document.content_type when "text/html" link_extractor(document) process_html(document) page_meta(document) else print "... not HTML, skipping..." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewind!\n io.rewind\n end", "def rewind\n io.rewind\n end", "def rewind\n file_handle.rewind\n file_handle.gets # skip past header\n nil\n end", "def rewind\n r = @io.rewind\n @buffer = ''\n r\n end", "def read(input)\n Extractor.input_cache(input)\n # if unxml\n # txt.gsub(/\\<(.*?)\\>/, '')\n # else\n # txt\n # end\n end", "def reset\n @buffer.string = @buffer.read; nil\n end", "def read\n clean content.send(@opts[:read])\n end", "def rewind() end", "def rewind() end", "def rewind() end", "def rewind() end", "def read_stream\n str = io.read\n unless(str.empty?)\n buffer << inflator.inflate(str)\n end\n end", "def rewind\n @sio_pos = 0\n @_st_lineNumber = 0\n end", "def reopen\n @mutex.synchronize {\n if defined? @io and @io\n flush\n @io.close rescue nil\n end\n @io = @sio = StringIO.new\n @sio.extend IoToS\n @pos = 0\n }\n super\n self\n end", "def update_io\n io = create_tempfile\n rewind\n @io = (io << @io.read; io)\n __setobj__(@io)\n @in_memory = false\n nil\n end", "def rewind\n raise ArgumentError, \"no stream to rewind\" unless __advance!\n @_st_stream.rewind\n @_st_lineno = 0\n end", "def rewind\n self.signature = initial_signature\n self.finished = false\n body.rewind\n end", "def read\n data = @data\n @data = ''\n data\n end", "def rewind\n @read_index = -1\n end", "def rewind; end", "def rewind; end", "def rewind; end", "def read() end", "def prepare\n self[:in].read\n end", "def rewind\n @headers = nil\n @lineno = 0\n\n @io.rewind\n end", "def rewind\n select_io_from_pos(0)\n end", "def input_stream; end", "def rewind; begin!; self end", "def rewind\n r = @stream.rewind\n @firsttime_flag = true\n r\n end", "def get_input_stream(&block); end", "def reset\n @io = StringIO.new(String.new) # A StringIO with ASCII-8BIT encoding\n\n self\n end", "def stream!\n @scratch.open(\"original\") { |file| yield file }\n end", "def rewind\n end", "def read!(str)\n clear\n read(str)\n end", "def read\n @io.rewind\n @io.read\n end", "def feed_stdin(str)\n old_stdin = $stdin\n $stdin = StringIO.new str\n\n yield\nensure\n $stdin = old_stdin\nend", "def rewind\n\t\t\t\tif @body and @body.respond_to? :rewind\n\t\t\t\t\t# If the body is not rewindable, this will fail.\n\t\t\t\t\t@body.rewind\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\t@finished = false\n\t\t\t\t\t\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn false\n\t\t\tend", "def rewind\n raise NotImplementedError\n end", "def rewind\n end", "def rewind\n end", "def rewind\n end", "def rewind\n end", "def ungets(str)\n @buffer = str + @buffer\n nil\n end", "def rewind\n unless Archive::Tar::Minitar.seekable?(@io, :pos=)\n raise Archive::Tar::Minitar::NonSeekableStream\n end\n @io.pos = @orig_pos\n @read = 0\n end", "def reverse_readline\n raise BOFError.new(\"beginning of file reached\") if pos == 0\n\n seek_backwards_to(\"\\n\", 512, -2)\n new_pos = pos\n data = readline\n seek(new_pos)\n data\n end", "def edit_with_rexml\n require 'rexml/document'\n doc = REXML::Document.new(read)\n yield doc if block_given?\n self.content = doc.to_s\n save\n end", "def rewind\n seek(0)\n end", "def rewind\n seek(0)\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 rewind\n @pos = @startpos\n @eof = false\n end", "def rewind\n @pos = 0\n end", "def rewind\n @pos = 0\n end", "def preprocess!\n input_html\n nil\n end", "def io(i)\n i.rewind\n i.read\n end", "def peek\r\n @buffer ||= @io.gets\r\n @buffer\r\n end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def replay\n buf = read\n @size += @format.parse(buf, &@emit)\n end", "def rewind()\n #This is a stub, used for indexing\n end", "def get\n pop or\n unless @eof then\n last = @last\n begin\n unless chunk = @src.gets then\n @eof = true\n @last = nil\n return last\n #unshift last # to be popped after reverse!\n #last = nil\n #break\n end\n # negative lookahead: < or >< or >>\n # so don't consume those (but split leaving them always at the\n # end of chunks)\n # consume (>) and split on >\n a = chunk.split(/(?=<|>[<>])|>/, -1)\n if last then\n unless /\\A[<>]/ =~ a.first then\n a[0] = last << (a.first || '')\n else\n push last\n end\n end\n raise \"size #{size}\" if size > 1\n concat a\n last = pop\n end while empty?\n @last = last\n reverse!\n pop\n end\n end", "def rewind()\n #This is a stub, used for indexing\n end", "def flush\n buffer = @input\n reset\n buffer\n end", "def read( ioin=$ioin )\n super\n self\n end", "def read( ioin=$ioin )\n super\n self\n end", "def read( ioin=$ioin )\n super\n self\n end", "def read( ioin=$ioin )\n super\n self\n end", "def read( ioin=$ioin )\n super\n self\n end", "def to_html(stream)\n until @strscan.eos?\n stream << generate_html\n end\n\n stream\n end", "def close_read() end", "def close_read() end", "def close_read() end", "def read characters\n forward characters\n end", "def flush_buffer; self.input_buffer = \"AAAA\"; end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def read\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbuffer = @body.join\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn buffer\n\t\t\t\t\tend\n\t\t\t\tend", "def read_input\n begin\n @in.flush\n chars = @in.sysread(255)\n rescue EOFError, IOError, Errno::ECONNRESET, Errno::ENOTSOCK\n chars = nil\n end\n if chars.nil?\n stop\n else\n mutex.synchronize { @buffer.concat chars }\n changed\n notify_observers self\n end\n end", "def pretend_user_input(input:)\n pretend_user_input = StringIO.new\n pretend_user_input.puts input\n pretend_user_input.rewind\n \n $stdin = pretend_user_input\n return $stdin\nend", "def prepare!\n @io.seek(@position)\n end", "def request_body\n # rewind in case anything in the past has left this un-rewound \n request.body.rewind\n request.body.read.tap do\n # rewind in case anything in the future expects this to have been left rewound \n request.body.rewind\n end\n end", "def capture\n old_io = io\n self.io = StringIO.new\n yield\n io.string\n ensure\n self.io = old_io\n end", "def raw_source=(input); end", "def rewind\n @offset = 0\n end", "def rewind()\n @ole.Rewind()\n end", "def reset_buffer(new_buf = '')\n @buf.replace Bytes.force_binary_encoding(new_buf)\n @index = 0\n end", "def rewind\n @file.rewind\n end", "def seek(pos)\n io.seek(pos)\n @buffer_io = StringIO.new\n @payload_size = 0\n end", "def rewind(f)\r\n f.seek(0)\r\nend", "def rewind(f)\r\n f.seek(0)\r\nend", "def flush_next_in\n\t\t@in_pos = @input_buffer.length\n\t\t@finished = true\n\t\tret = @input_buffer.pack(\"c*\")\n\t\t@input_buffer = []\n\t\tret\n\tend", "def rewind (f)\n f.seek(0)\nend", "def rewind\n raise(IOError, \"closed stream\") if @closed\n @pos = 0\n @buffer = nil\n @stream_fiber = Fiber.new do\n @fedora_file.stream.each do |chunk|\n Fiber.yield chunk\n end\n @stream_fiber = nil\n # last value from Fiber is the return value of the block which should be nil\n end\n 0\n end", "def parse_stream()\r\n #puts \"parse_stream\"\r\n REXML::Document.parse_stream(@pipe, self)\r\n end", "def rewind(f)\r\n\tf.seek(0)\r\nend", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "def rewind\n @pos = 0\n self\n end", "def load_html(input) # :nodoc:\n thing = nil\n\n # TODO: duplicate options\n if @options[:with_html_string] or @options[:inline] or input.respond_to?(:read)\n thing = input\n elsif @is_local_file\n @base_dir = File.dirname(input)\n thing = File.open(input, 'r')\n else\n thing = open(input)\n end\n\n if thing.respond_to?(:read)\n thing = thing.read\n end\n\n return nil unless thing\n doc = nil\n\n # Handle HTML entities\n if @options[:replace_html_entities] == true and thing.is_a?(String)\n HTML_ENTITIES.map do |entity, replacement|\n thing.gsub! entity, replacement\n end\n end\n # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74\n # However, we really don't want to hardcode this. ASCII-8BIG should be the default, but not the only option.\n if thing.is_a?(String) and RUBY_VERSION =~ /1.9/\n thing = thing.force_encoding(@options[:input_encoding]).encode!\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding]) {|c| c.recover }\n else\n default_encoding = RUBY_PLATFORM == 'java' ? nil : 'BINARY'\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding] || default_encoding) {|c| c.recover }\n end\n\n # Fix for removing any CDATA tags from both style and script tags inserted per\n # https://github.com/sparklemotion/nokogiri/issues/311 and\n # https://github.com/premailer/premailer/issues/199\n %w(style script).each do |tag|\n doc.search(tag).children.each do |child|\n child.swap(child.text()) if child.cdata?\n end\n end\n\n doc\n end" ]
[ "0.62076455", "0.6198451", "0.6188288", "0.6146501", "0.5969952", "0.5936916", "0.5858021", "0.5824216", "0.5824216", "0.5824216", "0.5824216", "0.580384", "0.5760445", "0.57491976", "0.57135445", "0.57079893", "0.5705736", "0.5704819", "0.56996053", "0.56901866", "0.56901866", "0.56901866", "0.567561", "0.56735504", "0.562074", "0.5619698", "0.5616808", "0.5603786", "0.55891836", "0.55623436", "0.55359435", "0.5527637", "0.5512582", "0.55054456", "0.5504678", "0.54812086", "0.54566824", "0.5434044", "0.5420957", "0.5420957", "0.5420957", "0.5420957", "0.5418693", "0.541557", "0.53621763", "0.53601396", "0.5343455", "0.5327273", "0.5278476", "0.52778536", "0.5275004", "0.5275004", "0.5272419", "0.5259418", "0.5258463", "0.52581906", "0.52581906", "0.52581906", "0.52581906", "0.52581906", "0.52581906", "0.52581906", "0.5231415", "0.52312046", "0.5214772", "0.5208908", "0.52079743", "0.5207063", "0.5207063", "0.5207063", "0.5207063", "0.5207063", "0.5206189", "0.52034837", "0.52034837", "0.52034837", "0.5195383", "0.51812047", "0.51598924", "0.51446486", "0.5144145", "0.5142814", "0.5140653", "0.5140568", "0.51402074", "0.51368546", "0.51285213", "0.51259714", "0.5125932", "0.51191515", "0.51081014", "0.51038665", "0.51038665", "0.50936764", "0.50929403", "0.5088975", "0.50843626", "0.5083019", "0.5079879", "0.5074556", "0.5073229" ]
0.0
-1
HTML processing module for extracting links
def link_extractor(document) print "." # Parse all links from HTML into an array # Set up the scrAPI (http://labnotes.org) links = Scraper.define do array :urls process "a[href]", :urls => "@href" result :urls end urls = links.scrape(document) urls.each { |url| uri = URI.parse(url) # Derelativeize links if necessary if uri.relative? url = @site.merge(url).to_s uri = URI.parse(url) end # Check domain, if in same domain, keep link, else trash it if uri.host != @site.host @external_links << url @external_links.uniq! next end # Find out if we've seen this link already if (@visited_links.include? url) || (@links_to_visit.include? url) next end @links_to_visit << url } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_anchor_tags(html)\n content = Nokogiri::HTML::DocumentFragment.parse(html)\n anchors = content.css(\"a[href]\")\n anchors.each do |item|\n if processable_link?(item)\n add_target_blank_attribute(item)\n add_rel_attributes(item)\n add_css_classes_if_required(item)\n end\n next\n end\n content.to_html\n end", "def extract_links(doc)\n (doc/'a').map { |link|\n href = link['href']\n CGI.unescapeHTML(href) if href && href !~ /^#/\n }.compact\n end", "def parse_link; end", "def strip_links(html); end", "def strip_links(html); end", "def strip_links(html); end", "def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") {|s| s.read} \n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n } \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\") } \n end", "def text_parse_links\n text.gsub(/((\\w+\\.){1,3}\\w+\\/\\w+[^\\s]+)/) {|x| is_tld?(x) ? \"<a href='http://#{x}'>#{x}</a>\" : x}\n end", "def convert_links\n\n # fetch leaf content\n c = self.content\n\n # regexps\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n tag_regex = /( |^)#(\\w+)( |$)/\n user_regex = /( |^)@(\\w+)( |$)/\n \n #TODO: make sure no one is typing javascript into the field **IMPORTANT**\n\n #replace #tags with links to that tag search\n while c =~ tag_regex\n c.gsub! \"##{$2}\", \"<a href='/leaves?tagged=#{$2}'>##{$2}</a>\"\n self.has_tags = true\n end\n\n #replace @usernames with links to that user, if user exists\n while c =~ user_regex\n user = $2\n if User.find(user)\n c.sub! \"@#{$2}\", \"<a href='/users/#{$2}'>@#{$2}</a>\"\n end\n end\n\n #replace urls with links\n #while c =~ url\n #name = $2\n #c.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n #end\n\n self.content = c\n\n end", "def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") { |s| s.read }\n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n }\n \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| \n self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\")\n }\n\n end", "def parse_content\n doc = Nokogiri::HTML(open(url.source))\n doc.css('a', 'h1', 'h2', 'h3').map do |link|\n UrlContent.new do |urlc|\n content = link.content.strip.force_encoding(\"utf-8\")\n if link.node_name == 'a'\n content = link.get_attribute(\"href\")\n if not (content.present? and (content.starts_with?(\"http\") or content.starts_with?(\"www\")))\n content = url.source+content.to_s\n end\n end\n urlc.content = content\n urlc.content_type = link.node_name\n urlc.url = self.url\n end\n end\n end", "def collect_links(html)\n Hash[Nokogiri::HTML(html).css('a').collect {|node| [node.text.strip, node.attributes['href'].to_s]}]\n end", "def parse_links(content)\n\t\treturn content.gsub(/\\[\\[(.+?)\\]\\]/m) do\n\t\t\tname = $1\n\t\t\tpermalink = name.downcase.gsub(' ', '_')\n \n\t\t\tif @wiki.page(permalink)\n\t\t\t\t\"<a class=\\\"internal\\\" href=\\\"/#{permalink}\\\">\" + name + '</a>'\n\t\t\telse \n\t\t\t\t\"<a class=\\\"internal new\\\" href=\\\"/#{permalink}\\\">\" + name + '</a>'\n\t\t\tend\n\t\tend.to_s\n\tend", "def auto_link_urls(text, html_options = {})\n extra_options = Mash.new(html_options).to_html_attributes\n extra_options = \" #{extra_options}\" unless extra_options.blank?\n\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end", "def parse_links\n @body.scan(@@link_re) do |x|\n m = Regexp.last_match\n type = 'link'\n from = self\n text = m['text_or_to']\n to = @twine.passage_from_name(m['to'] ? m['to'] : m['text_or_to'])\n @links << Link.new(from, to, text, type)\n end\n end", "def extractLinks(page)\n\tbase_wiki_url = \"https://en.wikipedia.org\"\n\tlinks = page.search(\"//a\")\n\tlinks = links.map{|item| item[\"href\"]}\n\n\t#Appending with base_wiki_page to make it full fledged page.\n\tlinks = links.map{|link| base_wiki_url+link.to_s}\n\n\treturn stripUnwantedLinksBasedOnCondition(links)\nend", "def html_filter_manual_reference_links\n return if index.nil?\n\n name_pattern = '[0-9A-Za-z_:.+=@~-]+'\n\n # Convert \"name(section)\" by traversing text nodes searching for\n # text that fits the pattern. This is the original implementation.\n @html.search('.//text() | text()').each do |node|\n next unless node.content.include?(')')\n next if %w[pre code h1 h2 h3].include?(node.parent.name)\n next if child_of?(node, 'a')\n node.swap(node.content.gsub(/(#{name_pattern})(\\(\\d+\\w*\\))/) do\n html_build_manual_reference_link($1, $2)\n end)\n end\n\n # Convert \"<code>name</code>(section)\" by traversing <code> nodes.\n # For each one that contains exactly an acceptable manual page name,\n # the next sibling is checked and must be a text node beginning\n # with a valid section in parentheses.\n @html.search('code').each do |node|\n next if %w[pre code h1 h2 h3].include?(node.parent.name)\n next if child_of?(node, 'a')\n next unless node.inner_text =~ /^#{name_pattern}$/\n sibling = node.next\n next unless sibling\n next unless sibling.text?\n next unless sibling.content =~ /^\\((\\d+\\w*)\\)/\n node.swap(html_build_manual_reference_link(node, \"(#{$1})\"))\n sibling.content = sibling.content.gsub(/^\\(\\d+\\w*\\)/, '')\n end\n end", "def process_links!(source)\r\n links.each{ |l| source.gsub!(\"[[#{l}]]\", link(l)) }\r\n end", "def _resolve_links(text)\n text.gsub(/L\\((\\w+)\\)/) { _link($1) }\nend", "def process_links(host_url)\n file = open(url)\n links = Nokogiri::HTML(file).search('a')\n protocol = url.split('://').first\n links = links.map { |link| [link.text.strip, link['href']] }.to_h\n create_report(links, protocol, host_url)\n rescue StandardError => error\n puts \"Error Encountered : #{error}\"\n end", "def parse_links(content)\n\t\treturn content.gsub(/\\[\\[(.+?)\\]\\]/m) do\n\t\t\tname = $1\n\t\t\tpermalink = name.downcase.gsub(' ', '_')\n\t\t\t\n\t\t\tif @wiki.page(permalink)\n\t\t\t\t\"<a class=\\\"internal\\\" href=\\\"/#{permalink}\\\">\" + name + '</a>'\n\t\t\telse \n\t\t\t\t\"<a class=\\\"internal new\\\" href=\\\"/#{permalink}\\\">\" + name + '</a>'\n\t\t\tend\n\t\tend.to_s\n\tend", "def convert_urls_to_links(text)\n # url = /(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp):\\/\\/)|(www\\.))+(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(\\/[a-zA-Z0-9\\&amp;%_\\.\\/-~-]*)?/\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n\n # while text =~ url\n # name = $2\n # text.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n # end\n\n Rinku.auto_link(text)\n end", "def text_parse(str)\r\n\tp2 = \"\"\r\n str = str.gsub(/[\\n]/, ' <br/> ') \r\n str.split(' ').each do |t|\r\n t11 = t.gsub(/^#/,\"\")\r\n t12 = t11.gsub(/[áäà]/i, \"a\")\r\n t12 = t11.gsub(/[éëè]/i, \"e\")\r\n t12 = t11.gsub(/[íïì]/i, \"i\")\r\n t12 = t11.gsub(/[óöò]/i, \"o\")\r\n t12 = t11.gsub(/[úüù]/i, \"u\")\r\n t12 = t11.gsub(/[^a-zA-Z0-9ñÑçÇ\\']/i, \"\")\r\n\t p = t.gsub(/^#.+/) { link_to \"##{t11} \", \"/post/tag/#{t12}\", :class => \"linkRemote\" }\r\n\r\n t21 = t.gsub(/^@/, \"\")\r\n p1 = p.gsub(/^@.+/) { link_to \"@#{t21} \", \"/post/user/#{t21}\", :class => \"linkRemote\" }\r\n\r\n t30 = t.scan(/(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix)\r\n\t p2 << \"\\n\" + p1.gsub(/(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix) {link_to \"#{$1[0..39]}... \", \"#{$1}\", :target => \"_blank\"}\r\n end\r\n\treturn p2\r\nend", "def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\n end", "def each_hyperlink # :yields: text\n links = []\n each_hyperlink_attribute {|elem, attr, hyperlink|\n yield hyperlink\n }\n end", "def find_links(html)\n i = 0\n while i < html.length\n\n # If we get to an opening carrat, we want to return a Node object for quicker\n # parsing\n # We also want to keep track of the indentation level\n if html[i] == \"<\"\n\n # We will skip ahead to the closing carat, and then analyze that node object\n find_closing_carat\n\n else\n next\n end\n end\n end", "def parse_link\n start_line_number = @src.current_line_number\n result = @src.scan(LINK_START)\n cur_pos = @src.pos\n saved_pos = @src.save_pos\n\n link_type = (result =~ /^!/ ? :img : :a)\n\n # no nested links allowed\n if link_type == :a && (@tree.type == :img || @tree.type == :a ||\n @stack.any? {|t, _| t && (t.type == :img || t.type == :a) })\n add_text(result)\n return\n end\n el = Element.new(link_type, nil, nil, location: start_line_number)\n\n count = 1\n found = parse_spans(el, LINK_BRACKET_STOP_RE) do\n count += (@src[1] ? -1 : 1)\n count - el.children.select {|c| c.type == :img }.size == 0\n end\n unless found\n @src.revert_pos(saved_pos)\n add_text(result)\n return\n end\n alt_text = extract_string(cur_pos...@src.pos, @src).gsub(ESCAPED_CHARS, '\\1')\n @src.scan(LINK_BRACKET_STOP_RE)\n\n # reference style link or no link url\n if @src.scan(LINK_INLINE_ID_RE) || !@src.check(/\\(/)\n emit_warning = !@src[1]\n link_id = normalize_link_id(@src[1] || alt_text)\n if @link_defs.key?(link_id)\n link_def = @link_defs[link_id]\n add_link(el, link_def[0], link_def[1], alt_text,\n link_def[2] && link_def[2].options[:ial])\n else\n if emit_warning\n warning(\"No link definition for link ID '#{link_id}' found on line #{start_line_number}\")\n end\n @src.revert_pos(saved_pos)\n add_text(result)\n end\n return\n end\n\n # link url in parentheses\n if @src.scan(/\\(<(.*?)>/)\n link_url = @src[1]\n if @src.scan(/\\)/)\n add_link(el, link_url, nil, alt_text)\n return\n end\n else\n link_url = +''\n nr_of_brackets = 0\n while (temp = @src.scan_until(LINK_PAREN_STOP_RE))\n link_url << temp\n if @src[2]\n nr_of_brackets -= 1\n break if nr_of_brackets == 0\n elsif @src[1]\n nr_of_brackets += 1\n else\n break\n end\n end\n link_url = link_url[1..-2]\n link_url.strip!\n\n if nr_of_brackets == 0\n add_link(el, link_url, nil, alt_text)\n return\n end\n end\n\n if @src.scan(LINK_INLINE_TITLE_RE)\n add_link(el, link_url, @src[2], alt_text)\n else\n @src.revert_pos(saved_pos)\n add_text(result)\n end\n end", "def linkify( text )\n s = text.to_s\n s.gsub!( @generic_URL_regexp, '\\1<a href=\"\\2\">\\2</a>' )\n s.gsub!( @starts_with_www_regexp, '\\1<a href=\"http://\\2\">\\2</a>' )\n s.gsub!( @starts_with_ftp_regexp, '\\1<a href=\"ftp://\\2\">\\2</a>' )\n s.gsub!( @email_regexp, '\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>' )\n s\nend", "def links\n @data.links ||= parsed_document.search(\"//a\") \\\n .map {|link| link.attributes[\"href\"] \\\n .to_s.strip}.uniq rescue nil\n end", "def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end", "def unwrap_links(elements); end", "def parse_redmine_links(text, project, obj, attr, only_path, options)\n text\n end", "def extract_group_links\n # this one works to extract the group node container:\n #\n # group_list_node = mahara_dashboard_page.css('#groups').each do |node|\n # ...\n # end\n #\n # However, I decided to go the easy way here with some knowledge on how the url must look like\n\n return @mahara_dashboard_page.links_with(:href => /mahara\\/group\\/view/)\n end", "def search_links(page,content)\n page.links_with( :text => Regexp.new(content, true))\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n #link_text = sanitize(link_text)\n #href = sanitize(href)\n end\n #content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('')\n \"<a href=#{href} target='_blank'>#{link_text}</a>\"\n end\n end\n end", "def scrape_links(parsed_page, core_path)\n links = []\n \n parsed_page.css('#class-index').css('.entries').css('a').each do |link|\n link_data = Hash.new\n \n link_data[:title] = link.text\n link_data[:path] = core_path + link.attributes['href'].value\n \n links << link_data\n end\n \n links\nend", "def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend", "def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend", "def href_parse\n href_elems = @parsed_page.css('a[href]')\n href_elems.map do |elem|\n elem.attributes['href'].value\n end\n end", "def doublelink_each_link(html)\n Nokogiri::HTML(html).css('.double-link').each do |doublelink|\n title_link = doublelink.css('.media__bd__header').text.strip\n subtitle_link = doublelink.css('.media__bd__subheader').text.strip\n\n yield(title_link, subtitle_link)\n end\n end", "def parse_autolink; end", "def parse_links(links)\n links.split(/,/).reduce({}) do |acc, x|\n matches = x.strip.match(/<(.*)>; rel=\\\"(.*)\\\"/)\n acc[matches[2]] = matches[1]\n acc\n end\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n trailing_gt = \"\"\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/\\-=;]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n # don't include trailing &gt; entities as part of the URL\n trailing_gt = $& if href.sub!(/&gt;$/, '')\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('') + trailing_gt.html_safe\n end\n end\n end", "def get_links\n links = @doc.search(\"//a[@class='title ']\")\n links.map! { |link| \"#{link['href']}\" } \n save_files(links)\n end", "def link_scrap(page)\n webpage = Nokogiri::HTML(open(page_params))\n webpage.css('a').each do |link| \n @link_obj = Link.new(text: link.text.strip, href: link['href'])\n page.links << @link_obj\n end\n end", "def handle_regexp_HYPERLINK(target)\n url = target.text\n\n gen_url url, url\n end", "def update_links(string)\n article = string.dup\n link_matches_1 = article.scan(%r{<a target=\"_blank\" href=\"(.[^>]*)\">(.[^<]*)</a>})\n link_matches_1.each do |link, text|\n article.gsub!(\"<a target=\\\"_blank\\\" href=\\\"#{link}\\\">#{text}</a>\", \"[#{text}](#{link})\")\n end\n link_matches_2 = article.scan(%r{<a href=\"(.*)\" target=\"_blank\">(.[^<]*)</a>})\n link_matches_2.each do |link, text|\n article.gsub!(\"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{text}</a>\", \"[#{text}](#{link})\")\n end\n link_matches_3 = article.scan(%r{<a href=\"/(.*)\">(.[^<]*)</a>})\n link_matches_3.each do |link, text|\n article.gsub!(\"<a href=\\\"\\/#{link}\\\">#{text}</a>\", \"[#{text}](https://adventofcode.com/#{link})\")\n end\n article\nend", "def process_page_link_tag(tag)\n parts = tag.split(' ')\n\n url, *descp = parts\n title = descp.join(\" \")\n\n alternatives = Repos.alternatives(*url.split(\"/\"))\n\n base_link, add_links = [], []\n\n extern_url = url =~ /^https?:/\n\n url = \"/#{url}\" if not url[0..0] == \"/\" and not extern_url\n title = url if title.empty?\n\n if extern_url\n return %Q{<a href=\"#{url}\">#{title}</a>}\n elsif tag =~ /^mailto:/\n return %Q{<a href=\"#{tag}\">#{tag.split(\":\")[1..-1]}</a>}\n end\n\n if not alternatives.empty?\n alternatives.each_pair do |ext, file|\n if ext == defext # find page with default extension\n\n base_url =\n if alternatives.size > 1\n # add extension for base_url unless given\n url !~ /\\.#{ext}$/ ? \"#{url}.#{ext}\" : url\n else url end\n\n base_link << [base_url, file]\n else\n add_links << [\"#{url}.#{ext}\", file]\n end\n end\n else\n # not existing page\n base_link << [url, nil]\n end\n\n # sort links by extension\n add_links = add_links.sort_by{|link, file| File.extname(file) }\n\n if base_link.empty?\n base_link << add_links.shift\n end\n\n title = title[1..-1] if title[0..0] == \"/\"\n base_link.map!{|url, _| mk_link(url, (alternatives.empty? ? \"o\" : \"x\"), title) }\n add_links.map!{|url, _| mk_link(url, 'alt', nil) }\n\n ret = base_link.join\n unless add_links.empty?\n ret << \" <span class='alts'><sup>(%s)</sup></span>\" % add_links.join(\", \")\n end\n ret\n end", "def extract_all_links(html, base)\n base_url = URI.parse(base)\n doc = Nokogiri::HTML(html)\n links = []\n doc.css(\"a\").each do |node|\n \n begin\n uri = URI(node['href'])\n if uri.absolute? and uri.scheme != \"javascript\" \n links << uri.to_s\n elsif uri.path.start_with?(\"/\")\n uri = base_url + uri\n end\n rescue\n # don't do anything\n end\n end \n links.uniq\n end", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^\\w\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href,'target' => \"_blank\"), !!options[:sanitize]) + punctuation.reverse.join('')\n end\n end\n end", "def get_hrefs\n # this will grab all the html from the url that\n # the user created the scraper with\n url_to_scrape = HTTParty.get(self.url)\n # nokogiri turns everything from HTTParty into nodes.\n nodes = Nokogiri::HTML(url_to_scrape)\n nodes.css('a').each do |a|\n self.hrefs << a['href']\n end\n self.hrefs\n end", "def parse_link_definition; end", "def each_hyperlink # :yields: text\n each_hyperlink_attribute {|elem, attr, hyperlink|\n yield hyperlink\n }\n end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end", "def process_html(document)\n\t\t\t\n\t\t\t# Add link and raw HTML to a hash as key/value\n\t\t\t# for later storage in database\n\t\t\tunless @raw_html.has_value?(document)\n\t\t \t\tprint \".\"\n\t\t \t\t@raw_html[@document.base_uri.to_s] = document\n\t\t\tend\n\t\t\t\t\n\t\tend", "def extracthref(serps)\n split_array=[]\n #go through the serps NodeList one by one and extract the href attribute of the anchor tags\n (0..serps.length-1).each {|i|\n serps_url = serps[i]['href']\n #remove junk that Google appends before and after the end of the returned search result pages\n #using a funky regular expression and push it into a new array\n split_array.push(serps_url.split(/(http.*?)(?=&)/))\n }\n #delete the junk in the array before the element we need\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(0)\n }\n #delete the junk in the array after the element we need (note all elements have moved index by one)\n #due to the last function\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(1)\n }\n split_array\nend", "def trans_all_title(html)\n a_re=%r|(<a\\s+[^<>]*?href=\"?)([^\"><]+)(\"?[^<>]*>)([^<>]*)</a>|iu\n return html.gsub(a_re) do |a,b,c,d|\n m=a_re.match(a)\n if m\n url=CGI::unescapeHTML m[2]\n next a unless HTTP_RE=~url #skip relative path url\n begin\n title,url=fetch_title url\n rescue Exception=>e\n $stderr.puts 'Request Error:'+url,e.message\n title=''\n end\n title=CGI::escapeHTML(url) if title.empty?\n next m[1]+CGI::escapeHTML(url)+m[3]+title+'</a>'\n else\n next a\n end\n end\nend", "def convert_tags_to_html_links(separator = nil, container = nil, opts = { multiword: true }, &block)\n TagExtractor::HTMLExtractor.new(self).convert_tags_to_html_links(separator, container, opts, &block)\n end", "def find_links(url)\n # This should return an array of all links at the given URL\n # Can be done using Nokogiri's css OR xpath methods\n #links = page.xpath('//a[@href]').map\n #links = page.xpath('//@href').map(&:value)\n links = []\n doc = Nokogiri::HTML(open(url))\n doc.css('a').each do |a_tag| #doc.css('a') is Nokogiri::XML::NodeSet\n href_str = String(a_tag['href']) # converting to String in case if it is NilClass type\n if href_str.include? \"http\"\n links.push(a_tag['href'])\n end \n end\n links\nend", "def get_links(url)\n @driver.get(url)\n data = @driver.execute_script(\"return document.getElementsByTagName('html')[0].innerHTML\")\n\n Nokogiri::HTML(data).css(\"a\").map do |link|\n if (href = link.attr(\"href\"))\n res = Link.new\n\n begin\n res.href = self.build_careers_page_url(url, href.strip).to_s\n rescue\n res.href = nil\n end\n res.text = link.text\n res\n end\n end.compact.reject do |link|\n link.href.nil?\n end.uniq\n end", "def h text\n # Link links\n out = text.gsub( %r{http(s)?://[^\\s<]+} ) { |url| \"<a href='#{url}'>#{url}</a>\" }\n\n # Link Twitter Handles\n out = out.gsub(/@(\\w+)/) {|a| \"<a href=\\\"http://twitter.com/#{a[1..-1]}\\\"/>#{a}</a>\" }\n\n # Link Hash tags\n out = out.gsub(/#(\\w+)/) {|hash| link_to hash, url(:hash, hash[1..-1]) }\n\n return out\n end", "def extract_links\n content.css('a').map { |a| a['href'] unless a['href'] == '#' }.compact.uniq\n end", "def link_urls(tweet)\n tweet.gsub(/([A-Z]+:\\/\\/[^\\s]+)/i, '<a href=\"\\1\">\\1</a>')\n end", "def links\n return @links if (defined?(@links) && !@links.nil?)\n @links = Nokogiri::HTML.parse(@html).css('a')\n @links = @links.map {|link| link.attribute('href').to_s}\n @links = @links.delete_if{ |link| (link.nil? || link.to_s == '') }\n\n # remove non-HTTP links\n @links = @links.delete_if{|x| x if !x.match(\"http\")}\n\n # handle HTTP redirect links\n # i.e. 'http://www.google.com/?=http://www.cats.com'\n @links = @links.map{|x| \"http\" + x.split(\"http\").last}.compact\n\n # Remove URL params from links\n @links = @links.map{|x| x.split(/\\?|\\&/).first}.compact\n\n # Sanitize links\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n\n # Remove link proxies(i.e. from Google) & decode URI again\n if url.match(/google\\.com/i)\n @links = @links.map{|x| x.split(\"%2b\").first}.compact\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n end\n\n return @links.uniq\n end", "def get_names_and_urls(page)\n names_and_urls = []\n for _a in page.xpath('.//a[@href]')\n names_and_urls << _a if ((_a['href'] =~ %r{^/\\w+/$}))\n end\n names_and_urls.map{ |_a| [ _a['href'], _a.content.strip ] }\nend", "def html_link\n @params['links']['html']\n end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n href = $&\n punctuation = ''\n left, right = $`, $'\n # detect already linked URLs and URLs in the middle of a tag\n if left =~ /<[^>]+$/ && right =~ /^[^>]*>/\n # do not change string; URL is alreay linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n if href.sub!(/[^\\w\\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation]\n if href.scan(opening).size > href.scan(punctuation).size\n href << punctuation\n punctuation = ''\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless href.index('http') == 0\n\n %Q(<a href=\"#{href}\">#{link_text}</a>)\n end\n end\n end", "def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end", "def scrape_page(url) \r\n puts \"Scraping \" + url + \".\"\r\n elements = []\r\n \r\n begin\r\n doc = Nokogiri::HTML(open(url))\r\n elements = doc.xpath(\"//a[@href]\")\r\n rescue RuntimeError\r\n #puts \"Runtime error caught\"\r\n rescue OpenURI::HTTPError\r\n #puts \"OpenURI error caught\"\r\n rescue OpenURI::HTTPRedirect \r\n #puts \"OpenURI redir error caught\"\r\n rescue SocketError\r\n #puts \"SocketError caught\"\r\n end\r\n \r\n puts \"Number of href elements found: \" + elements.length.to_s\r\n results = []\r\n elements.each do |link|\r\n #link = (link.first.to_s.scan(/.+?href=\".*\"/)) # Replaced by URI::extract!!\r\n urls = URI::extract(link.to_s) # extract URL\r\n if !urls.empty?\r\n urls.each do |u| \r\n if u.include?(\"http\") # don't store links which aren't prefixed with \"http\"\r\n results << (u.to_s) # store link\r\n end\r\n end\r\n end\r\n end\r\n \r\n if results.empty? then puts \"No links found in \" + url + \".\" end\r\n \r\n results.compact.uniq # avoid nils and duplicates\r\n \r\nend", "def highlight_links(text)\n text = '' if text.nil?\n begin\n new_text = text.dup\n while new_text =~ /([\\s\\r\\n]+|^)[^\"]*(http[s]{0,1}:\\/\\/[^\\s\\r\\n<]*)/u\n link = $2\n new_text.gsub!(link, \"<a href=\\\"#{link}\\\" rel=\\\"nofollow\\\" target=\\\"_blank\\\">#{link}</a>\")\n end\n new_text\n rescue\n text\n end\n end", "def prep(text)\n text = text.gsub /(http[s]?:\\/\\/[^ \\t]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"\\\\1\\\">\\\\1</a> \"\n text = text.gsub /#([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://search.twitter.com/search?tag=\\\\1\\\">#\\\\1</a> \"\n text = text.gsub /@([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://twitter.com/\\\\1\\\">@\\\\1</a> \"\n end", "def extract_pagelinks(text)\n\tpagelinks = text.scan(/(?<=\\[\\[)[^a-z*:|File:][^\\]|#]*(?=\\|)|(?<=\\[\\[)[^a-z*:|File:][^\\]|#]*(?=\\]\\])/)\n\tpagelinks = pagelinks.uniq unless pagelinks.uniq.nil?\nend", "def unlink!\n parse \n @tags.each do |tag|\n @doc.xpath(\"//a[ends_with(@href,'#{tag}')]\", EndsWithFilter.new).each do |element|\n element.swap(element.children)\n end\n end\n output = @doc.xpath(\"/#{@wrap_tag}/body/p\").inner_html\n output = @doc.xpath(\"/#{@wrap_tag}/body\").inner_html if output == \"\"\n output\n end", "def get_raw_links\n @doc.xpath(LINKS_XPATH).map { |link| link['href'] }\n end", "def links\n construct_html(self.items)\n end", "def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n node.set_attribute('data-bare-link', 'true')\n end\n end", "def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end", "def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end", "def split_and_clean_link(link)\n raw_url, rel = link.split(\";\").map(&:strip)\n\n raw_url = raw_url.gsub(/<|>/, \"\")\n rel = rel.gsub(/(rel=)?\"/, \"\")\n url = URI.parse(raw_url)\n page = CGI.parse(url.query)[\"page\"].first\n\n [url, rel, page]\n end", "def _find_links_in_markdown_tree markdown_tree_node\n case markdown_tree_node.type\n when :a\n links = [markdown_tree_node.attr['href']]\n when :img\n links = [markdown_tree_node.attr['src']]\n else\n links = []\n end\n markdown_tree_node.children.each { |child| links.concat _find_links_in_markdown_tree child }\n return links\nend", "def parse_links(comment)\n auto_link(comment, html: {target: '_blank'}) do |text|\n URI.parse(text).host\n end\n end", "def filter_links(html_string)\n\thash = {}\n\t# Get links from HTML content\n\tlink_regex = /<a href=\"\\/wiki[^>]*?>/\n\thtml_string.each_line { |line|\n\t\tmatches = line.scan(link_regex)\n\t\tmatches.each { |link|\n\t\t\t# Remove special links\n\t\t\tif link !~ /\\/wiki\\/(Book|Book_talk|Category|File|Forum|Help|Portal|Portal_talk|Special|Talk|Template|Thread|User|User_blog|User_talk|Wikipedia|Wikipedia_talk):/\n\t\t\t\t# Remove ?redirect=no links\n\t\t\t\tif link !~ /\\?redirect=no/\n\t\t\t\t\t# Remove links without title=\"...\"\n\t\t\t\t\tif link =~ /title=\".*?\"/\n\t\t\t\t\t\t# Remove any fragments\n\t\t\t\t\t\tif link =~ /(.*)#.*?(\".*)/\n\t\t\t\t\t\t\tlink = $1 + $2\n\t\t\t\t\t\tend\n\t\t\t\t\t\tlink = link.to_sym\n\t\t\t\t\t\tif !hash.has_key?(link)\n\t\t\t\t\t\t\thash[link] = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\t}\n\treturn hash\nend", "def get_position_links\n # Get all links that have the text: \"View Details\"\n links = @page.links_with(:text => /View Details/)\n href_links = []\n # convert all links into an appropriate html link\n links.each { |link| href_links << 'https://www.jobsatosu.com' + link.href }\n href_links\n end", "def parse_links(html, ttl)\n doc = Nokogiri::HTML(html)\n doc.css('a').each do |a|\n if a.attribute('name')\n next\n end\n my_ttl = ttl\n href = a.attribute('href').to_s\n # Use URI.join to dispose of nasty relative hrefs\n href = URI.join(@base_url, href).to_s\n\n match = href.match(/(\\w+):/)\n proto = match.captures[0]\n\n if my_ttl > 0\n # Are we http(s)?\n if proto.downcase.start_with?('http')\n # http(s) found so decrement TTL\n my_ttl -= 1\n else\n # not http(s) so add with a ttl of 0\n my_ttl = 0\n end\n end\n # Link parsed so add it to the list\n @links.push({'href' => href, 'ttl' => my_ttl})\n end\n end", "def prepare_links!\n links_def = find_links_definition or return\n \n links_def.rel2block.each do |link|\n links.update_link(Feature::Hypermedia::Hyperlink.new.tap do |hyperlink| # create Hyperlink representer.\n hyperlink.rel = link[:rel]\n hyperlink.href = run_link_block(link[:block])\n end)\n end\n end", "def raw\n @raw ||= cleanup(parsed.search('//a/@href')).compact.uniq\n end", "def links\n @links ||= begin\n if doc\n # get a list of distinct links on the page, in absolute url form\n links = doc.css('a[href]').inject([]) do |list, link|\n href = link.attributes['href'].content\n href.strip! if href\n \n unless skip_link?(href)\n begin\n url = to_absolute(href)\n rescue URI::InvalidURIError\n $stderr.puts \"ERROR: bad URI #{href.inspect} on page #{self.url.to_s.inspect}\"\n else\n list << url if url.scheme =~ /^https?$/\n end\n end\n list\n end\n \n links.uniq!\n links\n else\n []\n end\n end\n end", "def auto_link_urls(text, options = {}, &block)\n auto_link_entities(text, Extractor.extract_urls_with_indices(text, :extract_url_without_protocol => false), options, &block)\n end", "def get_urls(target)\n trail_urls = []\n i = 24\n while i < 162\n search_page_hike_url = target[i].to_s\n search_page_hike_url = search_page_hike_url.gsub(\"&amp;\", \"&\")\n search_page_hike_url = search_page_hike_url.gsub(/\\<a href=\"/, \"\")\n search_page_hike_url = search_page_hike_url.gsub(/\" .*/, \"\")\n trail_urls << search_page_hike_url\n i+=1\n end\n trail_urls\nend", "def links; end", "def links; end", "def linkReturn(url)\n data = Nokogiri::HTML(open(url))\n links = data.css('.zone_B_with_ads')\n allUrl = links.css('div.tile__content a.tile__read_more').map { |var| var['href'] }\n allUrl.each do |i|\n puts scraper(i)\n puts ''\n #puts i\n end\nend", "def process_page_link_tag(tag)\n parts = tag.split('|')\n parts.reverse! if @format == :mediawiki\n\n name, page_name = *parts.compact.map(&:strip)\n cname = @wiki.page_class.cname(page_name || name)\n\n if name =~ %r{^https?://} && page_name.nil?\n %{<a href=\"#{name}\">#{name}</a>}\n else\n presence = \"absent\"\n link_name = cname\n page, extra = find_page_from_name(cname)\n if page\n link_name = @wiki.page_class.cname(page.name)\n presence = \"present\"\n end\n link = ::File.join(@wiki.base_path, CGI.escape(link_name))\n %{<a class=\"internal #{presence}\" href=\"#{link}#{extra}\">#{name}</a>}\n end\n end", "def process_content(site_hostname, content, anchor_contents)\n content = Nokogiri::HTML(content)\n content.css('main h2[id], main h3[id], main h4[id], main h5[id]').each do |el|\n html_id = el.get_attribute('id')\n el.inner_html = \"#{el.inner_html}<a class='anchor-link' href='./##{html_id}'>#{anchor_contents}</a>\"\n end\n return content.to_s\nend", "def href_regexp\n %r{\\[image-link-to:\\s+(?<url>.*?)\\]}\n end", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def extract_link(tweet)\n if tweet\n text = tweet['text']\n start = text.index('http') if text\n if start\n stop = text.index(' ', start) || 0\n text[start..stop-1]\n end\n end\n end" ]
[ "0.74354184", "0.74105966", "0.73053753", "0.727113", "0.727113", "0.727113", "0.702365", "0.70177704", "0.70006067", "0.69689614", "0.69501626", "0.6882448", "0.6838537", "0.6778576", "0.6771203", "0.67581487", "0.6747276", "0.6723644", "0.66953576", "0.66859794", "0.66670674", "0.66346586", "0.6619995", "0.6617369", "0.66105855", "0.65822995", "0.6568097", "0.65595245", "0.652208", "0.6519681", "0.64869964", "0.6484968", "0.6483189", "0.64801544", "0.64628106", "0.64544076", "0.644404", "0.644404", "0.64430225", "0.6429778", "0.6429597", "0.6418576", "0.6416329", "0.6412621", "0.6384318", "0.63814884", "0.6380883", "0.6377732", "0.6359058", "0.635819", "0.635819", "0.6354117", "0.63233227", "0.63134205", "0.63092536", "0.6297096", "0.62949896", "0.6289965", "0.6284319", "0.62828374", "0.6278929", "0.6268131", "0.6261098", "0.6240424", "0.6239075", "0.6238699", "0.6237129", "0.6198817", "0.61979973", "0.6191714", "0.6190677", "0.61895996", "0.61838484", "0.61748767", "0.61658746", "0.615991", "0.6153905", "0.615149", "0.6149519", "0.6149519", "0.6142917", "0.6140912", "0.6136845", "0.6131467", "0.6126898", "0.6124814", "0.61182314", "0.6118021", "0.61148924", "0.6113081", "0.6109137", "0.61070573", "0.61070573", "0.60948104", "0.6088031", "0.60868776", "0.60854906", "0.6082239", "0.6082239", "0.6081202" ]
0.6877886
12
HTML processing module for raw HTML storage
def process_html(document) # Add link and raw HTML to a hash as key/value # for later storage in database unless @raw_html.has_value?(document) print "." @raw_html[@document.base_uri.to_s] = document end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_parser; end", "def html_markup_html(text); end", "def html_markup_textile(text); end", "def preprocess!\n input_html\n nil\n end", "def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsub! regex, 'DUMMY-STRING'\n [pre_list, html]\n end\n\n def add_domain(html, domain)\n html.gsub! /a href=\\\"(\\/.*?\\\")/, \"a href=\\\"#{domain}\\\\1\"\n html.gsub! /img src=\\\"(\\/.*?\\\")/, \"img src=\\\"#{domain}\\\\1\"\n html\n end\n\n def add_pre(html, pre_list)\n pre_list.each do |p|\n html.sub!('DUMMY-STRING', p)\n end\n html\n end\n \n pre_list, replaced = extract_pre_from html\n params = { :tags => %w[div span p a b i pre h1 h2 h3 h4 h5 h6 strong small em\n blockquote ul ol li img],\n :attributes => %w[href src] }\n html = HtmlPress.press Readability::Document.new(replaced, params).content\n domain = domain_of url\n output = add_pre(add_domain(html, domain), pre_list)\n output = sanitize_with_img output\n output.gsub /<img /, \"<img onError=\\\"this.style.display='none';\\\" \"\n \n end", "def parse_raw_html(el, &block); end", "def html\n @html ||= process_html!\n end", "def process_markup()\n [title,content].each do |text|\n next if !text\n clear_webpage(text).scan(PTN_MARKUP).map{|e|e[0].split(PTN_ELEMENT_SEP)}.flatten.each do |element|\n #debug \"[process_markup] element: \"+element.inspect\n next if !element\n ptn = element.scan(PTN_METADATA)\n #debug \"[process_markup] ptn: \"+ptn.inspect\n if ptn.size > 0\n m[ptn[0][0].to_sym] = parse_value(ptn[0][1])\n else\n create_and_link(element, 'tag' , \"t\")\n #add_tags(element, \"m\")\n end\n end#scan\n end#each\n end", "def html=(b); end", "def parse_block_html; end", "def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end", "def to_html( *rules )\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n textile_rules = [:block_textile_table, :block_textile_lists,\n :block_textile_prefix, :inline_textile_image, :inline_textile_link,\n :inline_textile_code, :inline_textile_span, :glyphs_textile]\n markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,\n :block_markdown_bq, :block_markdown_lists, \n :inline_markdown_reflink, :inline_markdown_link]\n @rules = rules.collect do |rule|\n case rule\n when :markdown\n markdown_rules\n when :textile\n textile_rules\n else\n rule\n end\n end.flatten\n\n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n rip_offtags text\n no_textile text\n escape_html_tags text\n hard_break text \n unless @lite_mode\n refs text\n # need to do this before text is split by #blocks\n block_textile_quotes text\n blocks text\n end\n inline text\n smooth_offtags text\n\n retrieve text\n\n text.gsub!( /<\\/?notextile>/, '' )\n text.gsub!( /x%x%/, '&#38;' )\n clean_html text if filter_html\n text.strip!\n text\n\n end", "def html_markup_text(text); end", "def html_postprocess(field,html)\n html\n end", "def preprocessMarkdownForHTML(markdown)\n output = \"\"\n inInstructions = false\n \n markdown.split(\"\\n\").each do |line|\n # parse an instructions list\n # use a dummy HTML tag so our final regex doesn't get stuck in an infinite loop replacing itself\n instructionsMatch = line.match(/^>>\\s*(.*?)$/)\n if instructionsMatch\n if not inInstructions\n output += \"<instructions>\\n\"\n end\n output += instructionsMatch[1] + \"\\n\"\n inInstructions = true\n next # don't try to parse anything else\n elsif inInstructions\n output += \"</instructions>\\n\"\n inInstructions = false\n end\n\n # parse headers and page IDs\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length.to_s\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n node = nodeWithID(headerID, $doc.toc.rootNode)\n if not node\n puts \"ERROR: Couldn't find node with ID #{headerID}\"\n exit 1\n end\n output += \"<h#{headerLevel}><a name=\\\"#{headerID}\\\">#{node.levelPrefix} #{headerTitle}</a></h#{headerLevel}>\\n\"\n next\n end\n \n # parse links to page IDs and replace with links to the real .htm file\n while 1\n linkMatch = line.match(/\\[.*?\\]\\((@@(.*?))\\)/)\n if linkMatch\n linkID = linkMatch[2]\n linkValue = linkToPageIDFrom(linkID, \"_PAGE_\") # use dummy value\n if not linkValue\n puts \"ERROR: Invalid link ID \\\"#{linkID}\\\"\"\n exit 1\n end\n line[linkMatch[1]] = linkValue\n else\n break\n end\n end\n \n # parse image and label combo\n imgLabelMatch = line.match(/!!\\[(.*?)\\]\\((.*?)\\)/)\n if imgLabelMatch\n label = imgLabelMatch[1]\n imgPath = imgLabelMatch[2]\n \n # read the image and width height to force the size on images for better loading\n # when viewing the files in the boot DVD. there are some issues where anchor jump\n # links don't always jump to the right place on the boot DVD and apparently forcing\n # the image sizes allows the pages to jump properly.\n \t\timgWidth = 0\n \t\timgHeight = 1\n \t\tbegin\n \t\t data = nil\n \t\t if (imgPath =~ /.png$/)\n \t\t data = IO.read($pagesDir + \"/\" + imgPath, 8, 16).unpack('NN')\n\t\t else\n\t\t puts \"ERROR: Unsupported image type: #{imgPath}\"\n\t\t exit 1\n\t end\n \t\t if (data)\n \t\t imgWidth = data[0]\n \t\t imgHeight = data[1]\n\t\t end\n\t\t rescue\n\t end\n imgWidthHeightAttrs = \"\"\n if imgWidth != 0 and imgHeight != 0\n imgWidthHeightAttrs = \" width=\\\"#{imgWidth}\\\" height=\\\"#{imgHeight}\\\"\"\n end\n\n output += \"<p class=\\\"imageAndLabel\\\"><img src=\\\"#{imgPath}\\\" alt=\\\"\" + CGI::escapeHTML(label) + \"\\\"#{imgWidthHeightAttrs}/><br/><em>\" + CGI::escapeHTML(label) + \"</em></p>\\n\"\n next\n end\n \n # parse warning paragraphs\n warningMatch = line.match(/^!!\\s+(.*?)$/)\n if warningMatch\n output += \"<warning>\\n\" + warningMatch[1] + \"\\n<\\/warning>\\n\"\n next\n end\n \n output += line + \"\\n\"\n end\n \n # close off an open instructions div\n if inInstructions\n output += \"</instructions>\\n\"\n end\n \n # Markdown doesn't allow processing of markup within block-level tags such as <div>, so we have to manually process the markup.\n # We call preprocessMarkdownForHTML() to properly process our custom markup within these custom block elements.\n # An extra newline is added to force a paragraph\n while 1\n instructionsMatch = output.match(/(<instructions>)(.*?)(<\\/instructions>)/m)\n if instructionsMatch\n output[instructionsMatch[1]] = \"<div class=\\\"instructions\\\">\"\n output[instructionsMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+instructionsMatch[2]))\n output[instructionsMatch[3]] = \"</div>\"\n else\n break\n end\n end\n \n while 1\n warningMatch = output.match(/(<warning>)\\s*(.*?)(<\\/warning>)/m)\n if warningMatch\n output[warningMatch[1]] = \"<div class=\\\"warning\\\"><div class=\\\"warningBody\\\"><div class=\\\"warningImg\\\"></div><div class=\\\"warningContent\\\">\"\n output[warningMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+warningMatch[2]))\n output[warningMatch[3]] = \"</div></div></div>\"\n else\n break\n end\n end\n \n return output\nend", "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "def html(text)\n scan(text, HTML, :html)\n end", "def handle_raw_html_tag(name); end", "def prepare_html(content , page_type = 'N')\n #header\n 1.upto 5 do |no| content.gsub! /^(={#{no}}) (.*) (={#{no}})/ ,\"\\nh#{no+1}. \\\\2\\n\" end\n 1.upto 5 do |no| content.gsub! /^(={#{no}}) (.*)/ ,\"\\nh#{no+1}. \\\\2\\n\" end\n\n #list\n 1.upto 5 do |no| content.gsub! /^([ ]{#{no}})(\\*) ?(.*)/ ,\"#{'*'*no} \\\\3\" end\n 1.upto 5 do |no| content.gsub! /^([ ]{#{no}})(#) ?(.*)/ ,\"#{'#'*no} \\\\3\" end\n #content.gsub! /(\\*) v (.*)/ , \"\\\\1 -\\\\2-\"\n \n #block\n content.gsub! /^\\{\\{\\{/ , \"<pre>\" ; content.gsub! /^\\}\\}\\}/ , \"</pre>\"\n content.gsub! /^\\{\\{\\\"/ , \"<blockquote>\" ; content.gsub! /^\\\"\\}\\}/ , \"</blockquote>\"\n content.gsub! /^\\{\\{\\[/ , \"<math>\" ; content.gsub! /^\\]\\}\\}/ , \"</math>\"\n \n #concept & property\n content.gsub! /\\[\\[(.*?):=(.*?)\\]\\]/ , '\\1(\\2)'\n #content.gsub! /\\[\\[(.*?)[<>=].*?\\]\\]/ , \\\"\\\\1\\\":#{APP_ROOT}/page/\\\\1\" \n content.gsub! /\\[\\[(.*?)\\]\\]/ , \"\\\"\\\\1\\\":#{APP_ROOT}/entry/\\\\1\" if defined?(APP_ROOT)\n\n #comment\n content.gsub! PTN_COMMENT , \"\\\\1\"\n content.gsub! PTN_COMMENT_MULTILINE , \"\"\n if defined? SystemConfig\n SystemConfig.site_info.each do |e|\n content.gsub! /(\\s)#{e[1]}:/ , \"\\\\1#{e[2]}\"\n end\n content.gsub! SystemConfig.ptn_url_unnamed , \"\\\\1\\\"\\\\2\\\":\\\\2\"\n content.gsub! \"%ROOT%\" , APP_ROOT\n end\n \n #Process by page_type\n case page_type\n when 'N'\n math_list = content.scan( PTN_MATH ) ; math_list.each do |m|\n #content.gsub! \"$#{m[0]}$\" , latex_render(m[0])\n content.gsub! \"$#{m[0]}$\" , get_math_img(m[0])\n end\n math_block_list = content.scan( PTN_MATH_BLOCK ) ; math_block_list.each do |m|\n #content.gsub! \"#{m[0]}\" , latex_render(m[0])\n content.gsub! \"#{m[0]}\" , get_math_img(m[0])\n end\n when 'S'\n menu_list = content.scan( PTN_MENU ) ; menu_list.each do |m|\n menu_title = m[0] ; menu_target = m[1] ; menu_str = \"M{{#{menu_title}|#{menu_target}}}\"\n #$lgr.info \"#{menu_title} / #{menu_target}\"\n result = link_to_remote(menu_title , :url => { :action => 'menu' , :query => CGI.escape(menu_target) })\n content.gsub! menu_str , result\n end\n end\n #$lgr.info \"[prepare_html] \"+content\n query_list = content.scan( PTN_QUERY ) ; query_list.each do |q|\n query_type = q[0] ; query_content = q[1] ; query_str = \"#{query_type}{{#{query_content}}}\"\n case query_type\n when 'P'\n result = eval(\"find_page :display=>'|@title|@tags|@created_at|' ,\" + query_content )\n result = result.join(\"\\n\") if result.class == Array\n result = \"|_.Title|_.Tag|_.CreatedAt|\\n\"+result if query_content.scan(/:display/).size == 0\n #$lgr.info \"[prepare_html] Query : #{query_str} , #{result}\"\n content.gsub! query_str , result\n end\n end\n #content.gsub! SystemConfig.ptn_url , \"\\\"\\\\0\\\":\\\\0\"\n #???content.gsub!(SystemConfig.ptn_site) \"\\\"#{ApplicationController.SystemConfig(\\\\0)}\\\":\\\\0\"\n content\n end", "def process_html(content)\n head, opener, tail = content.output.partition(OPENING_BODY_TAG_REGEX)\n body_content, *rest = tail.partition(\"</body>\")\n\n processed_markup = process_anchor_tags(body_content)\n\n content.output = String.new(head) << opener << processed_markup << rest.join\n end", "def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end", "def html_markup_org(text); end", "def read_html\n array = nodes.to_a\n array.each_with_index do |node, index|\n header = (index.modulo(10) == 0) ? \"<h2>!!!!!SLOW DOWN AND ENUNCIATE!!!!!</h2>\" : \"\"\n anchor = \"<a id=section_#{index} href=/pages/#{self.id}/edit?section=#{index}>#{index}</a>\"\n type = nodes.at(index).name\n array[index]=nodes.at(index).replace \"#{header}<#{type}>#{anchor} #{nodes.at(index).inner_html}</#{type}>\"\n end\n array.map(&:to_html).join\n end", "def substitute_markdown_inside_raw_html\n each_element(:raw_html) do |e|\n html = e.parsed_html\n next unless html\n\n html.process_markdown_inside_elements(self)\n end\n end", "def html\n return @html if defined? @html\n\n @html = Henkei.read :html, data\n end", "def markup_file_contents(contents); end", "def TeX2htm(text,state=:normal,fname=\"\",sec=\"\")\n sp=proc{|s| $trads[$key.succ!]=s; \"\\\\#{$key} \"}\n mathdisplay=proc{|s|\n sp[TeX2htm(s,:math).h(\"I\").h(\"td\").h(\"tr\").h(\"table\").h(\"center\")]}\n text=text.gsub(/([^\\\\]|^)%.*/){m=$~;m[1]} # suppress tex comments\n unless state==:math\n text.gsub!(/\\\\$/,\"\\\\ \")\n vb=/\\|'\\\\\\|'\\|/ # a | in verbatim\n vb2=/\\|\\s*\\{\\s*\\\\tt\\s*\\\\\\|\\s*\\}\\s*\\|/ # another way for | in verbatim\n vbb=/(?:#{vb2}|#{vb})/o\n text.gsub!(/([^\\\\]|^|\\\\\\\\)\\|((?:[^|]|#{vbb})*)\\|/om){ m=$~\n if m[2]=~/\\n/\n m[1]+sp[m[2].gsub(vbb,\"|\").lines.map{|l| v=l.split(\"#\");\n\tv[0].gsub!(/&/,\"#\");v[0].gsub!(/</,\"&lt;\");\n\tif v[1] then v[1]=TeX2htm(v[1]); v.join(\"#\")\n\telse v[0]\n\tend}.join.h(\"pre\")]\n else m[1]+sp[m[2].gsub(vbb,\"|\").gsub(/&/,\"#\").gsub(/</,\"&lt;\").clean.h(\"code\")]\n end\n }\n text.gsub!(/\\$\\$(.*?)\\$\\$/m){m=$~; mathdisplay[m[1]]}\n text.gsub!(/\\\\\\[(.*?)\\\\\\]/m){m=$~; mathdisplay[m[1]]}\n text.gsub!(/([^\\\\]|^)\\$(.*?)\\$/m){m=$~\n m[1]+sp[TeX2htm(m[2],:math).h(\"I\")]}\n text.gsub!(/([^\\\\]|^)\\*([^*]*)([^\\\\])\\*/){m=$~;\n m[1]+sp[(m[2]+m[3]).h(\"strong\")]}\n end\n text.gsub!(/\\\\\\\\/){\"\\\\cr\"}\n text.gsub!(/([^\\\\])<([^>]*)>/m){m=$~;m[1]+sp[TeX2htm(m[2]).h(\"var\")]}\n text.gsub!(/([^\\\\]|^)'((?:[^']|\\\\')*)([^\\\\])'/m){m=$~;\n m[1]+sp[(m[2]+m[3]).clean.h(\"code\")]}\n text.gsub!(/([^\\\\]|^)\\\\([*{}|': <>;,#~-])/){m=$~;m[1]+sp[OneChar[m[2]]]}\n text.gsub!(/([^\\\\]|^)\\\\([*{}|': <>;,#~-])/){m=$~;m[1]+sp[OneChar[m[2]]]}\n unless state==:math\n text.gsub!(/^\\s*$/,\"\\\\par\")\n text.gsub!(/^\\s*\\\\vspace\\{[^}]*\\}\\s*$/,\"\\\\par\")\n text.gsub!(/^([^:\\n]*)([^\\\\]):(.*?)(?=\\\\par)/m){m=$~\n sp[\"<DL><DT>#{TeX2htm(m[1]+m[2])}:<DD>\"]+\"#{m[3]}\"+sp[\"</DL>\"]}\n text.gsub!(/\\\\cr/){sp[\"<BR>\"]}\n # characters that can appear in a cross reference\n text.gsub!(/([^\\\\]|^)\"([\\w\\s.$-]*)\"/m){m=$~;\n m[1]+sp[\"<a href=\\\"#{name2fn m[2]}\\\">#{m[2]}</a>\"]}\n text.gsub!(/\\\\\"/){sp['\"']}\n text.gsub!(/\\\\cite(?:\\[([^\\]\\[]*)\\])?\\s*\\{\\s*((?:\\w|,)+)\\s*\\}/m) { m=$~\n r=\"<A href=\\\"biblio.htm##{m[2].split(\",\")[0]}\\\">#{m[2].h(\"cite\")}</a>\"\n r<< \", \"+m[1] if m[1]\n sp[r] }\n text.gsub!(/\\\\accent\\s*([0-9]*)\\s*([a-zA-Z])/m){m=$~\n a=Accents[m[1]+m[2]]\n if a then a\n else $err.print \"** unhandled accent #{fname}:#{sec} #{m[0]}\\n\"\n end}\n text.gsub!(/\\\\psubsection\\s*\\{(.*?)\\}/m){m=$~; m[1].h(\"h3\")}\n text.gsub!(/\\\\psection\\s*\\{(.*?)\\}/m){m=$~;m[1].h(\"h1\").style(\"color:#ff0000\")}\n text.gsub!(/\\\\index\\s*\\{(.*?)\\}/m){m=$~\n $indexcount+=1 # emit an anchor and remember the index keys for later\n r=m[1].gsub(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n $index[r]=$index[r].push([\"#{fname}#I#{$indexcount}\",\"#{sec.chapnum}.#{sec.secnum}\"])\n \"<A name = \\\"I#{$indexcount}\\\"></a>\\n\"\n }\n text.gsub!(/\\\\begin\\{([^}]*)\\}(.*?)\\\\end\\{\\1\\}/m){m=$~\n case m[1]\n when \"displaymath\",\"equation\" then mathdisplay[m[2]]\n when \"center\" then m[2].h(\"center\")\n when \"itemize\",\"enumerate\" then m[2]\n else \"{beg-\"+m[1]+\"}\".h(\"s\")+m[2]+\"{end-\"+m[1]+\"}\".h(\"s\")\n end}\n text.gsub!(/~/,\" \")\n end\n# nestedbraces=// # can define but not recognized inside another regexp\n# text.gsub!(/\\\\(\\s)/){m=$~;m[1]}\n text.gsub!(/\\{\\s*\\\\(?:sl|it)([^}]*)\\}/m){m=$~;\n sp[TeX2htm(m[1],state).h(\"I\")]}\n text.gsub!(/\\{\\s*\\\\cal([^}]*\\{[^}]*\\}[^}]*)\\}/m){sp[$~[1].style(\"font-family: cursive\")]}\n text.gsub!(/\\{\\s*\\\\cal([^}]*)\\}/m){sp[$~[1].style(\"font-family: cursive\")]}\n text.gsub!(/\\{\\s*\\\\tt([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"code\")]}\n text.gsub!(/\\{\\s*\\\\tt([^}]*)\\}/m){m=$~;sp[m[1].h(\"code\")]}\n text.gsub!(/\\{\\s*\\\\bf([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"strong\")]}\n text.gsub!(/\\{\\s*\\\\bf([^}]*)\\}/m){m=$~;sp[m[1].h(\"strong\")]}\n text.gsub!(/\\{\\s*\\\\em([^}]*\\{[^}]*\\}[^}]*)\\}/m){m=$~;sp[m[1].h(\"em\")]}\n text.gsub!(/\\{\\s*\\\\em([^}]*)\\}/m){m=$~;sp[m[1].h(\"em\")]}\n if state==:math\n text.gsub!(/</){sp[\"&lt;\"]}\n text.gsub!(/>/){sp[\"&gt;\"]}\n texarg=/([^{\\\\]|\\{(?:(?:[^{}]|\\{[^{}]*\\})*)\\}|\\\\[a-zA-Z]+)/\n text.gsub!(/\\^\\\\prime/om){sp[\"'\"]}\n text.gsub!(/\\^\\{\\\\prime\\\\prime\\}/om){sp[\"''\"]}\n text.gsub!(/\\\\not\\s*\\\\equiv/om){sp[\"&#8802;\"]}\n text.gsub!(/\\\\(?:text|mbox|hbox)\\{([^{}]*)\\}/){m=$~;\n sp[TeX2htm(m[1]).h(\"/i\")]}\n text.gsub!(/\\^\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"sup\")]}\n text.gsub!(/_\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"sub\")]}\n text.gsub!(/\\\\underline\\s*#{texarg}/om){m=$~;sp[TeX2htm(m[1],:math).h(\"u\")]}\n text.gsub!(/\\\\overline\\s*#{texarg}/om){m=$~;\n sp['<span style=\"text-decoration: overline\">'+\n TeX2htm(m[1],:math)+\"<\\/span>\"]}\n text.gsub!(/\\{\\s*\\\\rm([^}]*)\\}/m){m=$~;sp[m[1].h(\"I\")]}\n text.gsub!(/\\{\\s*\\\\mathcal([^}]*)\\}/m){m=$~;sp[m[1].h(\"u\")]}\n text.gsub!(/\\\\frac#{texarg}#{texarg}/om){m=$~;\n n=TeX2htm(m[1],'math'); d=TeX2htm(m[2],'math')\n n=\"(#{n})\" if n.length>1\n d=\"(#{d})\" if n.length>1\n \"#{n}/#{d}\"}\n text.gsub!(/\\\\not\\s*\\\\in/){sp[\"&notin;\"]}\n text.gsub!(/\\\\not\\s*=/){sp[\"&ne;\"]}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~;\n if MathMacs[m[1]] then sp[MathMacs[m[1]]] else m[0] end}\n text.gsub!(/\\\\pmod\\s*#{texarg}/){m=$~;sp[\"(</i>mod<i> #{TeX2htm(m[1],:math)})\"]}\n text.gsub!(/\\\\begin\\{([^}]*)\\}(.*?)\\\\end\\{\\1\\}/m){m=$~\n case m[1]\n when \"array\",\"pmatrix\" then \n if m[1]==\"array\" then r=m[2].sub(/\\{[cl]*\\}/,\"\") else r=m[2] end\n r=r.split(\"\\\\cr\").map{|l| l.split(\"&\").map{|i| \n i.h(\"I\").h(\"td\")}.join(\"\").h(\"tr\")}.join.h('table style=\"display:inline-table;\"').h(\"td\").h(\"/td\")\n if m[1]==\"pmatrix\" then \"(\"+r+\")\" else r end\n else \"{beg-\"+m[1]+\"}\".h(\"s\")+m[2]+\"{end-\"+m[1]+\"}\".h(\"s\")\n end\n }\n end\n text.gsub!(/\\\\(?:text|mbox|hbox)\\{([^{}]*)\\}/){m=$~;\n sp[TeX2htm(m[1]).h(\"/i\")]}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~;AlwaysMacs[m[1]] || m[0]}\n text.gsub!(/\\{([^{}]*)\\}/){m=$~; m[1]}\n text.gsub!(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n text.gsub!(/\\\\([a-zA-Z]+) /){m=$~; $trads[m[1]] || \"\\\\#{m[1]} \"}\n text.gsub!(/\\\\([a-zA-Z]+)/){m=$~; $trads[m[1]] || \"\\\\#{m[1]}\"}\n text.scan(/\\\\([a-zA-Z]+)/){|m| $err.print \"!!!!! #{m.inspect} state=#{state}\\n\"}\n text\nend", "def wrap(html); end", "def wrap(html); end", "def convert_html(html)\n # Sanitize the html and surround in a <span> tag to make it work with htmltolatex better\n html = \"<span>\" + sanitize(html, :tags => %w(em i sup sub)) + \"</span>\"\n\n # Create the temp files and output the html source to the first one\n raw = Tempfile.new('htmltolatex_html')\n output = Tempfile.new('htmltolatex_tex')\n raw << html; raw.flush\n \n # Run htmltolatex on the source\n path = File.join(RAILS_ROOT, \"lib\", \"htmltolatex\")\n `cd #{path} && #{File.join(path, \"htmltolatex\")} -input #{raw.path} -output #{output.path}`\n\n # Read in the results\n converted = File.open(output.path, \"rb\") { |f| f.read }\n \n # Close and unlink the files\n raw.close!\n output.close!\n \n # Return the results\n converted\n end", "def convert_html(text)\n auto_html text do\n html_escape :map => {\n '&' => '&amp;',\n '>' => '&gt;',\n '<' => '&lt;',\n '\"' => '\"'\n }\n image\n youtube :width => 510, :height => 332\n vimeo :width => 510, :height => 332\n link :target => :_blank\n redcarpet :target => :_blank\n end\n end", "def html(include_ocr: false)\n return @html if defined? @html\n\n @html = Henkei.read :html, data, include_ocr: include_ocr\n end", "def process_html(html)\r\n html = email_process(html)\r\n process_menu(html)\r\n end", "def html_parser=(_arg0); end", "def html_parser=(_arg0); end", "def standard_html( state, encoding = nil, &body_filller )\n html(:language => state.fetch(\"request.language\"), :direction => state.fetch(\"html.direction\", \"ltr\") do\n head do\n meta :charset => @parameters.fetch(:encoding, Encoding.default_internal)\n state.fetch(\"html.headscripts\").each do |script|\n fail_todo \"what now?\"\n end\n state.fetch(\"html.css\").each do |css|\n fail_todo \"what now?\"\n end\n end\n body do\n capture(&body_filler)\n \n state.fetch(\"html.tailscripts\").each do |script|\n fail_todo \"what now?\"\n end\n end\n end\n end\n\n\n #\n # Starts an HTML stream.\n \n def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end\n\n\n #\n # Outputs raw text to the stream.\n \n def raw( text )\n @buffer << text\n end", "def escape_once(html); end", "def sanitize(html)\n doc = Nokogiri::HTML::DocumentFragment.parse(html)\n if Mako.config.sanitize_images\n doc.css('img').each do |n|\n begin\n n.name = 'a'\n n.content = n['alt'] ? \"📷 #{n['alt']}\" : '📷 Image'\n n['href'] = URI.parse(n['src']).absolutize!(uri)\n rescue URI::InvalidURIError\n # if there's a problem, just ignore it\n next\n end\n end\n end\n doc.css('h1,h2,h3,h4,h5,h6').each { |n| n.name = 'p'; n.set_attribute('class', 'bold') }\n doc.to_s\n end", "def process_html\n benchmark \"Process HTML for #{self.url}\" do\n doc = Readability::Document.new(self.html)\n html = doc.html\n self.title = content_for_open_graph_tag('og:title', html) || doc.title\n self.description =\n content_for_open_graph_tag('og:description', html) ||\n content_for_meta_tag('name=\"description\"', html) ||\n html.xpath('//head/meta/@description', html).first.try(:content)\n image_url = content_for_open_graph_tag('og:image', html) || doc.images.first\n self.image_url = image_url if image_url =~ URI.regexp\n self.site_name = content_for_open_graph_tag('og:site_name', html) || get_url_domain.try(:humanize)\n self.content_html = doc.content.encode_from_charset!(doc.html.encoding)\n self.content = Nokogiri::HTML(self.content_html).text\n end\n self\n end", "def update_html\n # need to filter HTML first... remove <script> and chunks and the like...\n self.html = RedCloth.new(strip_tags(self.redcloth.to_s),\n [ :no_span_caps ]).to_html(\n # no link references. messes up lines starting with [[WikiWord]]\n :block_textile_table, :block_textile_lists, :block_textile_prefix,\n :inline_textile_image, :inline_textile_link, :inline_textile_code,\n :inline_textile_span, :glyphs_textile)\n end", "def html_markup_pre(text); end", "def inline_html(text)\n # process simple inlines\n for inline in INLINES_HTML\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\n end\n # process link inlines\n if text.match(LINKS_REGEXP)\n text.gsub!(LINKS_REGEXP) do |string|\n match = string.match(LINKS_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n parts = body.split(' ')\n if parts.length > 1\n url = parts.first\n link = parts[1..-1].join(' ')\n else\n url = body\n link = body\n end\n \"#{before}<a href='#{url}'>#{link}</a>#{after}\"\n end\n end\n # process note inlines\n if text.match(NOTES_REGEXP)\n text.gsub!(NOTES_REGEXP) do |string|\n match = string.match(NOTES_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n @document.notes << body\n index = @document.notes.length\n \"#{before}<a href='#note#{index}' name='source#{index}'>\"+\n \"[#{index}]</a>#{after}\"\n end\n end\n # process escapes (that is \\x is replaced with x)\n text.gsub!(/\\\\(.)/, \"\\\\1\") if text.match(/\\\\(.)/)\n text\n end", "def html_markup_asciidoc(text); end", "def load_html(input) # :nodoc:\n thing = nil\n\n # TODO: duplicate options\n if @options[:with_html_string] or @options[:inline] or input.respond_to?(:read)\n thing = input\n elsif @is_local_file\n @base_dir = File.dirname(input)\n thing = File.open(input, 'r')\n else\n thing = open(input)\n end\n\n if thing.respond_to?(:read)\n thing = thing.read\n end\n\n return nil unless thing\n doc = nil\n\n # Handle HTML entities\n if @options[:replace_html_entities] == true and thing.is_a?(String)\n HTML_ENTITIES.map do |entity, replacement|\n thing.gsub! entity, replacement\n end\n end\n # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74\n # However, we really don't want to hardcode this. ASCII-8BIG should be the default, but not the only option.\n if thing.is_a?(String) and RUBY_VERSION =~ /1.9/\n thing = thing.force_encoding(@options[:input_encoding]).encode!\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding]) {|c| c.recover }\n else\n default_encoding = RUBY_PLATFORM == 'java' ? nil : 'BINARY'\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding] || default_encoding) {|c| c.recover }\n end\n\n # Fix for removing any CDATA tags from both style and script tags inserted per\n # https://github.com/sparklemotion/nokogiri/issues/311 and\n # https://github.com/premailer/premailer/issues/199\n %w(style script).each do |tag|\n doc.search(tag).children.each do |child|\n child.swap(child.text()) if child.cdata?\n end\n end\n\n doc\n end", "def parse_html\n return nil_elem if @word.line.match(TRANSLATED)\n return nil_elem if @word.tail.join(\" \")[/^{{.*}}$/]\n\n body = @word.tail.join(\" \")\n body, tagged_with_equals = SlimKeyfy::Transformer::Whitespacer.convert_nbsp(body, @word.head)\n\n tagged_with_equals = \"|\" if tagged_with_equals == \"=\"\n\n if body.match(LINK_TO) != nil\n body = link_tos(body)\n end\n\n translation_key = update_hashes(body)\n normalize_translation(\"#{tagged_with_equals} #{translation_key}\")\n end", "def parse_markup\n @html = PARSER.parse(@markup, :base_heading_level => 1)\n end", "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def htmlClean(html)\n html\nend", "def htmlify(text, markup = T.unsafe(nil)); end", "def purify_html\n doc= Nokogiri::XML::DocumentFragment.parse(self.to_s)\n doc.search(\".//strong\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h4\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h3\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h2\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h1\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n\n doc.search(\".//em\").each do |e|\n e.swap \"<i>#{e.inner_html}</i>\"\n end\n\n doc.search(\".//ul\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//ol\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//li\").each do |e|\n e.swap \"<p>#{e.inner_html}</p>\"\n end\n doc.search(\".//span\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n\n doc.to_xml(:encoding => \"UTF-8\").gsub(/\\n/,\" \").gsub(/\\s+/,\" \")\n end", "def markup_manipulation(html_fragment)\n html_doc = Nokogiri::HTML html_fragment\n html_doc = link_manipulations html_doc\n html_doc = image_manipulations html_doc\n return html_doc.css('body').children.to_s\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def html_content\n\t\t\treturn \"\" if content.blank? \n\t\t\tstr = content.gsub(/<(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\#{$1}>\" }\n\t\t\tstr = str.gsub(/<\\/(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\/>\" }\n\t\t\tstr = str.gsub(/\\r\\n/, \"<br/>\") \n\t\t\tstr = str.gsub(/(\\s)/, \"&nbsp;\")\n\t\t\tstr = str.gsub(/\\[bold\\]/, \"<b>\")\n\t\t\tstr = str.gsub(/\\[-bold\\]/, \"</b>\")\n\t\t\tstr = str.gsub(/\\[italic\\]/, \"<i>\")\n\t\t\tstr = str.gsub(/\\[-italic\\]/, \"</i>\")\n\t\t\tstr = str.gsub(/\\[color:(#.{6})\\]/){ |s| \"<span style=\\\"color:#{$1}\\\">\" }\n\t\t\tstr = str.gsub(/\\[-color\\]/, \"</span>\")\n\t\t\tstr = str.gsub(/\\[(\\w+)\\]/) do |s|\n\t\t\t\temotion = EMOTIONS.index($1)\n\t\t\t\temotion.nil? ? \"[#{$1}]\": \"<img src=\\\"/assets/emotions/#{emotion}.gif\\\" />\" \n\t\t\tend\n\t\t\treturn str\n\t\tend", "def setup\n @html = <<-TEXTILE\n<h1>Give RedCloth a try!</h1>\n<p>A <strong>simple</strong> paragraph with<br />\na line break, some <em>emphasis</em> and a <a href=\"http://redcloth.org\">link</a></p>\n<ul>\n\t<li>an item</li>\n\t<li>and another</li>\n</ul>\n<ol>\n\t<li>one</li>\n\t<li>two</li>\n</ol>\nTEXTILE\n \n end", "def process_nodes(html_nodes, properties); end", "def render(no_follow = false)\n sanitize = no_follow ?\n @wiki.history_sanitizer :\n @wiki.sanitizer\n\n data = extract_tex(@data.dup)\n data = extract_code(data)\n data = extract_tags(data)\n begin\n data = GitHub::Markup.render(@name, data)\n if data.nil?\n raise \"There was an error converting #{@name} to HTML.\"\n end\n rescue Object => e\n data = %{<p class=\"gollum-error\">#{e.message}</p>}\n end\n data = process_tags(data)\n data = process_code(data)\n if sanitize || block_given?\n doc = Nokogiri::HTML::DocumentFragment.parse(data)\n doc = sanitize.clean_node!(doc) if sanitize\n yield doc if block_given?\n data = doc_to_html(doc)\n end\n data = process_tex(data)\n data.gsub!(/<p><\\/p>/, '')\n data\n end", "def initialize_html_tags; end", "def html raw_text\n EscapeUtils.escape_html(decode_html(raw_text))\n end", "def as_html_deprecated #use TextEncoder.convert_to_html instead.\n return self if self.blank?\n mytext = self\n #mytext = CGI.escapeHTML(mytext)\n mytext.gsub!(NpbConstants::URL_DETECTION){|web_link| %{ <a href=\"#{web_link.strip}\">#{web_link.strip}</a> }}\n #mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{\\1<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{#{$1}<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(/\\A +/) {|l_spaces| (\"&nbsp;\"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\"&nbsp;\"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end", "def to_html text\n html = (''.encode text.encoding).dup\n\n encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]\n\n s = StringScanner.new text\n insquotes = false\n indquotes = false\n after_word = nil\n\n until s.eos? do\n case\n when s.scan(/<(tt|code)>.*?<\\/\\1>/) then # skip contents of tt\n html << s.matched.gsub('\\\\\\\\', '\\\\')\n when s.scan(/<(tt|code)>.*?/) then\n warn \"mismatched <#{s[1]}> tag\" # TODO signal file/line\n html << s.matched\n when s.scan(/<[^>]+\\/?s*>/) then # skip HTML tags\n html << s.matched\n when s.scan(/\\\\(\\S)/) then # unhandled suppressed crossref\n html << s[1]\n after_word = nil\n when s.scan(/\\.\\.\\.(\\.?)/) then\n html << s[1] << encoded[:ellipsis]\n after_word = nil\n when s.scan(/\\(c\\)/i) then\n html << encoded[:copyright]\n after_word = nil\n when s.scan(/\\(r\\)/i) then\n html << encoded[:trademark]\n after_word = nil\n when s.scan(/---/) then\n html << encoded[:em_dash]\n after_word = nil\n when s.scan(/--/) then\n html << encoded[:en_dash]\n after_word = nil\n when s.scan(/&quot;|\"/) then\n html << encoded[indquotes ? :close_dquote : :open_dquote]\n indquotes = !indquotes\n after_word = nil\n when s.scan(/``/) then # backtick double quote\n html << encoded[:open_dquote]\n after_word = nil\n when s.scan(/(?:&#39;|'){2}/) then # tick double quote\n html << encoded[:close_dquote]\n after_word = nil\n when s.scan(/`/) then # backtick\n if insquotes or after_word\n html << '`'\n after_word = false\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n when s.scan(/&#39;|'/) then # single quote\n if insquotes\n html << encoded[:close_squote]\n insquotes = false\n elsif after_word\n # Mary's dog, my parents' house: do not start paired quotes\n html << encoded[:close_squote]\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n\n after_word = nil\n else # advance to the next potentially significant character\n match = s.scan(/.+?(?=[<\\\\.(\"'`&-])/) #\"\n\n if match then\n html << match\n after_word = match =~ /\\w$/\n else\n html << s.rest\n break\n end\n end\n end\n\n html\n end", "def html_markup_rdoc(text); end", "def text_wikimedia_html page\n html = @client.text_wikimedia_html page\n # normalize html by removing <!-- html comments -->\n doc = Nokogiri.HTML html\n (doc.xpath '//comment()').remove\n doc.inner_html\n end", "def processed_content\n self.read_attribute(:processed_content).html_safe\n end", "def process_oldstyle_html contents\n\tdoc = Nokogiri::HTML(contents)\n\n\t# the HIB page keeps each entry in a div with class 'row'\n\t# plus a name based on the game name.\n\tdoc.css('div.row').each do |div|\n\t\tname = div['class'].sub(/\\s*row\\s*/,'')\n\t\troot = get_root name\n\t\tdiv.css('.downloads').each do |dd|\n\t\t\ttype = dd['class'].gsub(/\\s*(downloads|show)\\s*/,'')\n\t\t\tdd.css('.download').each do |dl|\n\t\t\t\taa = dl.css('a.a').first\n\t\t\t\tlink = aa['href']\n\t\t\t\tbtlink = aa['data-bt']\n\t\t\t\tif btlink.empty?\n\t\t\t\t\tbtlink = nil\n\t\t\t\tend\n\t\t\t\tmd5 = dl.css('a.dlmd5').first['href'].sub(/^#/,'') rescue nil\n\t\t\t\tts = dl.css('a.dldate').first['data-timestamp'] rescue nil\n\t\t\t\tsavepath = File.join(root, type)\n\n\t\t\t\tdl = true\n\n\t\t\t\tif link[-1] == '/'\n\t\t\t\t\tSTDERR.puts \"# No automatic downloads for #{savepath}, go to #{link}\"\n\t\t\t\t\tdl = false\n\t\t\t\tend\n\n\t\t\t\t$dirs << savepath\n\t\t\t\tif dl\n\t\t\t\t\tfname = get_filename link\n\t\t\t\t\tfkey = fname.intern\n\t\t\t\t\t$files[fkey] << Game.new(fname, md5, savepath, link, btlink)#, ts)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def html_open; \"<html>\"; end", "def html_reducer(html_doc)\n html_doc_chars = html_doc.strip.split(\"\")\n\n self_closing_tags = [\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\",\"command\",\"keygen\",\"menuitem\"]\n reopenable_tags = [\"b\",\"i\",\"a\",\"font\",\"em\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"pre\",\"strong\",\"u\"]\n nestable_tags = [\"div\"]\n\n element_stack = [] # stack of open elements\n reduction = [] # results array\n buffer = \"\"\n\n while html_doc_chars.length > 0\n buffer << html_doc_chars.shift # get another char\n\n closing_script_regex = /<\\/script\\s*>\\z/i\n closing_script_match = buffer.match(closing_script_regex)\n\n closing_style_regex = /<\\/style\\s*>\\z/i\n closing_style_match = buffer.match(closing_style_regex)\n\n self_closing_tag_regex = /<[a-z][^>]*\\/\\s*>\\z/i\n self_closing_tag_match = buffer.match(self_closing_tag_regex)\n\n tag_regex = /<[a-z][^>]*>\\z/i\n tag_match = buffer.match(tag_regex)\n\n closing_tag_regex = /<\\/[a-z][^>]*>\\z/i\n closing_tag_match = buffer.match(closing_tag_regex)\n\n doctype_regex = /<!doctype\\s*[^>]*>\\z/i\n doctype_match = buffer.match(doctype_regex)\n\n comment_regex = /<!--.*?-->\\z/\n comment_match = buffer.match(comment_regex)\n\n # closing script tag\n if closing_script_match\n text = buffer.split(closing_script_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # closing style tag\n elsif closing_style_match\n text = buffer.split(closing_style_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # comment\n elsif comment_match\n contents = (element_stack.last&.contents) || reduction\n text = buffer.split(comment_regex).first.to_s.strip\n if text != \"\"\n contents << text\n end\n contents << comment_match.to_s\n\n buffer = \"\"\n\n # inside a script\n elsif tag_in_stack(element_stack,\"script\")\n # do nothing\n\n elsif tag_in_stack(element_stack,\"style\")\n # do nothing\n\n elsif buffer.include?(\"<!--\")\n # do nothing\n\n # self closing tag containing /> (doesn't get pushed to the stack)\n elsif self_closing_tag_match\n text = buffer.split(self_closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n contents << HTML_element.from_string(self_closing_tag_match.to_s)\n buffer = \"\"\n \n # tag\n elsif tag_match\n text = buffer.split(tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n elem = HTML_element.from_string(tag_match.to_s)\n\n if !self_closing_tags.include?(elem.tag) # push to the stack\n # check whether nesting is possible\n if tag_in_stack(element_stack,elem.tag) && !nestable_tags.include?(elem.tag)\n tmp_stack = []\n while tag_in_stack(element_stack,elem.tag)\n tmp = element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != elem.tag)\n tmp_stack << tmp\n end\n end\n \n contents << elem\n element_stack.push(elem)\n contents = (element_stack.last&.contents) || reduction\n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n else\n contents << elem\n element_stack.push(elem)\n end\n else\n contents << elem\n end\n\n buffer = \"\"\n\n # closing tag\n elsif closing_tag_match\n text = buffer.split(closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n tag = HTML_element.tag_from_string(closing_tag_match.to_s)\n if tag_in_stack(element_stack, tag)\n tmp_stack = []\n until element_stack.last.tag == tag\n tmp = element_stack.pop\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != tag)\n tmp_stack << tmp\n end\n end\n element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n \n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n end\n buffer = \"\"\n\n # doctype (stack must be empty)\n elsif doctype_match\n text = buffer.split(doctype_regex).first.to_s.strip\n if text != \"\"\n reduction << text\n end\n reduction << doctype_match.to_s\n buffer = \"\"\n end\n end\n\n contents = (element_stack.last&.contents) || reduction\n contents << buffer\n\n reduction\nend", "def html_markup_textile_strict(text); end", "def html\n _search_parts_keys(/html/i)\n end", "def get_html_contents(url)\n\turl_string=\"\"\n\t# Open page and store contents\n\topen(url) { |data| \n\t\turl_string = data.read\n\t}\n\n\t# Remove \"not to be confused with\" links\n\thatnote_regex = /<div class=\"hatnote\">.*?<\\/div>/m\n\thtml_string = url_string.gsub(hatnote_regex,\"\")\n\n\treturn html_string\nend", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def parse_html(source)\n Nokogiri::HTML(open(source))\n end", "def text_to_html (text, args = {})\n args = { emotes: false, map_headings: 1 }.merge args\n \n html = Moredown.text_to_html(text, args)\n html.gsub!('src=\"media/', 'src=\"/media/')\n html.gsub!(/<pre><code>#! (.*?)\\n([^<]*?)<\\/code><\\/pre>/) { |match| \"<pre><code class=\\\"#{$1.downcase.strip}\\\">#{$2.strip}</code></pre>\" }\n \n html\n end", "def ris(document)\n\t\t\tprint \".\"\n\t\t\t# Store raw HTML into local variable\n\t\t\t# Based on MIME type, invoke the proper processing modules\n\t\t\tcase document.content_type\n\t\t\t\twhen \"text/html\"\n\t\t\t\t\tlink_extractor(document)\n\t\t\t\t\tprocess_html(document)\n\t\t\t\t\tpage_meta(document)\n\t\t\t\telse\n\t\t\t\t\tprint \"... not HTML, skipping...\"\n\t\t\tend\n\t\tend", "def clean(html)\n return unless html\n\n # Make a whitelist of acceptable elements and attributes.\n sanitize_options = {\n elements: %w{div span p a ul ol li h1 h2 h3 h4\n pre em sup table tbody thead tr td img code strong\n blockquote small br section aside},\n remove_contents: %w{script},\n attributes: {\n 'div' => %w{id class data-tralics-id data-number data-chapter},\n 'a' => %w{id class href target rel},\n 'span' => %w{id class style},\n 'ol' => %w{id class},\n 'ul' => %w{id class},\n 'li' => %w{id class},\n 'sup' => %w{id class},\n 'h1' => %w{id class},\n 'h2' => %w{id class},\n 'h3' => %w{id class},\n 'h4' => %w{id class},\n 'img' => %w{id class src alt},\n 'em' => %w{id class},\n 'code' => %w{id class},\n 'section' => %w{id class},\n 'aside' => %w{id class},\n 'blockquote' => %w{id class},\n 'br' => %w{id class},\n 'strong' => %w{id class},\n 'table' => %w{id class},\n 'tbody' => %w{id class},\n 'tr' => %w{id class},\n 'td' => %w{id class colspan}\n },\n css: {\n properties: %w{color height width}\n },\n protocols: {\n 'a' => {'href' => [:relative, 'http', 'https', 'mailto']},\n 'img' => {'src' => [:relative, 'http', 'https']}\n },\n output: :xhtml\n }\n\n Sanitize.clean(html.force_encoding(\"UTF-8\"), sanitize_options)\n end", "def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&amp;').gsub('<', '&lt;').gsub('>', '&gt;')\n \n # blockquote tag support\n s.gsub!(/\\n?&lt;blockquote&gt;\\n*(.+?)\\n*&lt;\\/blockquote&gt;/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('&lt;(' + x + ')&gt;(.+?)&lt;/('+x+')&gt;',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/&lt;a.+?href\\s*=\\s*['\"](.+?)[\"'].*?&gt;(.+?)&lt;\\/a&gt;/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end", "def ae_some_html(s)\n return '' if s.nil? \n \n # converting newlines\n s.gsub!(/\\r\\n?/, \"\\n\")\n \n # escaping HTML to entities\n s = s.to_s.gsub('&', '&amp;').gsub('<', '&lt;').gsub('>', '&gt;')\n \n # blockquote tag support\n s.gsub!(/\\n?&lt;blockquote&gt;\\n*(.+?)\\n*&lt;\\/blockquote&gt;/im, \"<blockquote>\\\\1</blockquote>\")\n \n # other tags: b, i, em, strong, u\n %w(b i em strong u).each { |x|\n s.gsub!(Regexp.new('&lt;(' + x + ')&gt;(.+?)&lt;/('+x+')&gt;',\n Regexp::MULTILINE|Regexp::IGNORECASE), \n \"<\\\\1>\\\\2</\\\\1>\")\n }\n \n # A tag support\n # href=\"\" attribute auto-adds http://\n s = s.gsub(/&lt;a.+?href\\s*=\\s*['\"](.+?)[\"'].*?&gt;(.+?)&lt;\\/a&gt;/im) { |x|\n '<a href=\"' + ($1.index('://') ? $1 : 'http://'+$1) + \"\\\">\" + $2 + \"</a>\"\n }\n \n # replacing newlines to <br> ans <p> tags\n # wrapping text into paragraph\n s = \"<p>\" + s.gsub(/\\n\\n+/, \"</p>\\n\\n<p>\").\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') + \"</p>\"\n \n s \n end", "def clean_html\n HTML::WhiteListSanitizer.allowed_protocols << 'data'\n self.content = ActionController::Base.helpers.sanitize(self.body, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES)\n end", "def html!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n type = HTML\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 319:7: 'html'\n match( \"html\" )\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__, 1 )\n\n end", "def parse_codeblocks(html); end", "def html= html\n native.load_html_string html, nil\n end", "def parse_html(string)\n t = Tag.new\n tag = string.match(TAG_R).captures.to_s #returns an array\n t.type = tag[0]\n str_class = string.match(CLASS_R).captures #already an array\n t.classes = str_class.join.split(\" \")\n t.id = string.match(ID_R).captures[0]\n t.name = string.match(NAME_R).captures[0]\n t\n end", "def dumpAsHTML\n\t\tmarkup = \"\"\n\t\t@LoadString.each_line do |line|\n\t\t\tmarkup += \"#{CGI.escapeHTML(line.chomp)}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend", "def strip_tags(html); end", "def strip_tags(html); end", "def strip_tags(html); end", "def bend_html\n\t\t@bendable_html = Nokogiri::HTML(@unbendable_html.body)\n\tend", "def parse_html(user,parent_dagr)\n url = \"\"\n url += parent_dagr.storage_path + \"/\" + parent_dagr.name\n puts url\n page = Nokogiri::HTML(open(url))\n \n return_string = \"\"\n #add all video and adeo files\n page.css(\"source\").each do |element|\n file_name = element[\"src\"]\n file_name = add_element(user,parent_dagr,file_name,parent_dagr.storage_path,nil)\n return_string += file_name + \", \"\n end\n \n #add all images\n page.css(\"img\").each do |element|\n file_name = element[\"src\"]\n file_name = add_element(user,parent_dagr,file_name,parent_dagr.storage_path,nil)\n return_string += file_name + \", \"\n end\n \n #add all javascript\n page.css(\"script\").each do |element|\n file_name = element[\"src\"]\n if file_name\n file_name = add_element(user,parent_dagr,file_name,parent_dagr.storage_path,nil)\n return_string += file_name + \", \"\n end\n end\n \n #add all html documents\n page.css(\"a\").each do |element|\n puts element.text\n url = element[\"href\"]\n # if url pointed to html document\n #if /.html\\z/ =~ url \n file_name = add_element(user,parent_dagr,url,parent_dagr.storage_path,element.text)\n return_string += file_name + \", \" \n #end\n end\n \n return return_string\n end", "def text_parse(str)\r\n\tp2 = \"\"\r\n str = str.gsub(/[\\n]/, ' <br/> ') \r\n str.split(' ').each do |t|\r\n t11 = t.gsub(/^#/,\"\")\r\n t12 = t11.gsub(/[áäà]/i, \"a\")\r\n t12 = t11.gsub(/[éëè]/i, \"e\")\r\n t12 = t11.gsub(/[íïì]/i, \"i\")\r\n t12 = t11.gsub(/[óöò]/i, \"o\")\r\n t12 = t11.gsub(/[úüù]/i, \"u\")\r\n t12 = t11.gsub(/[^a-zA-Z0-9ñÑçÇ\\']/i, \"\")\r\n\t p = t.gsub(/^#.+/) { link_to \"##{t11} \", \"/post/tag/#{t12}\", :class => \"linkRemote\" }\r\n\r\n t21 = t.gsub(/^@/, \"\")\r\n p1 = p.gsub(/^@.+/) { link_to \"@#{t21} \", \"/post/user/#{t21}\", :class => \"linkRemote\" }\r\n\r\n t30 = t.scan(/(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix)\r\n\t p2 << \"\\n\" + p1.gsub(/(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix) {link_to \"#{$1[0..39]}... \", \"#{$1}\", :target => \"_blank\"}\r\n end\r\n\treturn p2\r\nend", "def parse_html_entity; end", "def g\n link = params[:link]\n @cont = Cont.where(:link => link)\n\t@cont = @cont.first\n\tif @cont.nil?\n\t p 'extracting .............'\n\t error_type = 0 #success\n\t content = ''\n\t html = ''\n\t error_msg = ''\n\t title = ''\n\t #st = Time.now\n\t begin\n a = open(link); p \"header charset: #{a.charset}\"\n text = a.read; p \"text encoding: #{text.encoding.to_s}\"\n\t #p \"get raw html time: #{Time.now - st}\"\n\t\tenc = a.meta['content-encoding']\n\t\tif enc == 'gzip' || enc == 'inflate'\n\t\t text = uncompress(text, enc)\n cs = get_charset(text); p \"ziped charset: #{cs}\"\n\t\t text = text.force_encoding(cs).encode('UTF-8')\n text = text.sub(cs, 'UTF-8')\n\t\tend\n cs = get_charset(text); p \"charset: #{cs}\"\n\t\thtml = text\n\t\tif \"iso-8859-1\".casecmp(cs) == 0 || \"utf-8\".casecmp(text.encoding.to_s) !=0\n\t\t if \"utf-8\".casecmp(cs) != 0 && \"utf-8\".casecmp(text.encoding.to_s) !=0\n\t\t p 'wrong charset, change'\n\t\t html = text.force_encoding('GBK').encode('UTF-8')\n\t\t end\n\t\tend\n\t\thtml = html.force_encoding('utf-8')\n html = html.sub(cs, 'UTF-8')\n\t rescue => e\n\t error_type = 1 #HTML error\n\t\terror_msg = e.message.to_s\n\t\tp e.message\n\t\tp e.backtrace\n\t end\n\t #p \"get html time: #{Time.now - st}\"\n\n st = Time.now\t \n\t if error_type == 0\n\t begin \n# doc = Readability::Document.new(html, :debug=>true)\n doc = Readability::Document.new(html)\n content = doc.content\n\t\t title = trim_title(doc.html.title)\n rescue => e\n\t\t error_type = 2 # READABILITY ERROR\n\t\t error_msg = e.message.to_s\n\t\t p e.message\n\t\t p e.backtrace\n\t\tend\n\t end\n\t p \"get readability time: #{Time.now - st}\"\n\n @cont = Cont.new(\n\t :link => link,\n\t :html => '', #html,\n\t :content => content,\n\t\t:title => title,\n\t :error_type => error_type,\n\t :error_msg => error_msg\n\t )\n @cont.save\n\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cont }\n end\n end", "def parse_html(pdoc, data)\n src = ::Nokogiri::HTML(data)\n pdoc.properties[:title] = src.title\n extract_plaintext(src.root, pdoc)\n\n # css, js, images\n src.xpath('//link[@rel=\"stylesheet\"]').each do |t|\n pdoc.add_ext_ref(t[:href], PlanR::ParsedDocument::REF_STYLE)\n end\n\n src.xpath('//script[@src]').each do |t|\n pdoc.add_ext_ref(t[:src], PlanR::ParsedDocument::REF_SCRIPT)\n end\n\n src.xpath('//img[@src]').each do |t|\n pdoc.add_ext_ref(t[:src], PlanR::ParsedDocument::REF_IMAGE)\n end\n\n # links\n src.xpath('//a[@href]').each do |t|\n next if (t[:href].start_with? '#')\n next if (t[:href].start_with? 'mailto:')\n pdoc.add_ext_ref(t[:href], PlanR::ParsedDocument::REF_DOC)\n end\n\n # metadata\n meta = {}\n src.xpath('//meta').each do |t|\n last_name = name = value = nil\n t.attributes.each do |key, attr|\n if attr.name == 'content'\n value = attr.value\n elsif attr.name == 'name'\n name = attr.value\n else\n last_name = attr.value\n end\n end\n name = last_name if not name\n meta[name.downcase] = value if name && value\n end\n meta.fetch('keywords', '').split(',').each do |keyword|\n pdoc.keywords << keyword\n end\n pdoc.properties[:content_type] = meta.fetch('content-type', '')\n pdoc.properties[:description] = meta.fetch('description', '')\n end", "def to_html\n case @markup\n when 'markdown'\n @data_for_output.collect! {|line| BlueCloth.new(line).to_html}\n when 'textile'\n @data_for_output.collect! {|line| RedCloth.new(line).to_html}\n when 'bbcode'\n @data_for_output.collect! {|line| line.bbcode_to_html}\n end\n end", "def HTML4(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end", "def parse_page\n @doc = Nokogiri::HTML(@html)\n end", "def do_adhoc(str)\n str.gsub!(/^\\\\cleardoublepage$/, \"\")\n str.gsub!(/^\\\\plainifnotempty$/, \"\")\n str.gsub!(/^\\\\small$/, \"\")\n str.gsub!(/^\\\\normalsize$/, \"\")\n str.gsub!(/^\\\\centering$/, \"\")\n\n # URL\n str.gsub!(/\\\\verb\\|(.+?)\\|/) do |m|\n s = $1\n if s =~ URI.regexp\n s\n else\n m\n end\n end\n\n text_pairs = {\n %! \\\\vspace*{-0.1\\\\Cvs}! => \"\",\n %!$10^{12} = 1 \\\\mathrm{TB}$! => %!@<raw>#{LBRACE}|html|10<sup>12</sup>#{RBRACE}=1TB!,\n %!$\\\\exists, \\\\forall$! => %!@<raw>#{LBRACE}|html|&exist;, &forall;#{RBRACE}!,\n %!$\\\\lnot,\\\\land,\\\\lor$! => %!@<raw>#{LBRACE}|html|&not;,&and;,&or;#{RBRACE}!,\n %!$>$! => %!@<raw>#{LBRACE}|html|&gt;#{RBRACE}!,\n %!$<$! => %!@<raw>#{LBRACE}|html|&lt;#{RBRACE}!,\n %!B$^+$! => %!@<raw>#{LBRACE}|html|B<sup>+</sup>#{RBRACE}!,\n %!\\\\paragraph{Step 4.} \\\\ ! => %!\\\\paragraph{Step 4.}!,\n %!\\\\verb|http://s2k-ftp.cs.berkeley.edu/ingres/|! => %!http://s2k-ftp.cs.berkeley.edu/ingres/!,\n %!\\\\verb|pc<code.size()|! => %!@<tt>#{LBRACE}pc<code.size()#{RBRACE}!,\n %!\\\\verb|c|! => %!@<tt>#{LBRACE}c#{RBRACE}!,\n %!\\\\verb|m|! => %!@<tt>#{LBRACE}m#{RBRACE}!,\n %!\\\\verb|z|! => %!@<tt>#{LBRACE}z#{RBRACE}!,\n %!$n$! => %!n!,\n %!$\\\\mathrm{O}(1)$! => %!O(1)!,\n %!$\\\\mathrm{O}(n)$! => %!O(n)!,\n %!$\\\\beta$! => %!@<raw>#{LBRACE}|html|&beta;#{RBRACE}!,\n %!$t$! => %!t!,\n %![$^{11}$C]! => %!@<raw>#{LBRACE}|html|[<sup>11</sup>C]#{RBRACE}!,\n }\n\n text_pairs.each do |k,v|\n regex = Regexp.compile(Regexp.quote(k))\n str.gsub!(regex, v)\n end\n\n str.gsub!(/^\\s*\\\\begin\\{lstlisting\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{lstlisting\\}\\n/) do |m|\n \"//emlist{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{quote\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{quote\\}\\n/) do |m|\n \"//quote{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\(begin|end)\\{(minipage|center|figure)\\}.*$/, \"\")\n\n img_refs = Hash.new\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}[\\s\\n]*\\\\label\\{(.+?)\\}/) do |m|\n imgfile = $1.strip\n caps = $2.strip\n label = $3.strip\n if imgfile =~ /\\.eps\\Z/\n imgfile = File.basename(imgfile, \".eps\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n elsif imgfile =~ /\\.pdf\\Z/\n imgfile = File.basename(imgfile, \".pdf\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n else\n m\n end\n end\n\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}/) do |m|\n imgfile = File.basename($1.strip)\n caps = $2.strip\n imgfile.gsub!(/\\.\\w+\\Z/, \"\")\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n end\n\n str.gsub!(/図\\s*\\\\ref\\{([^\\}]*)\\}/) do |m|\n \"@<img>#{LBRACE}#{img_refs[$1.strip] || $1.strip}#{RBRACE}\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{enumerate\\}((?:.|\\n)*)\\s*\\\\end\\{enumerate\\}/) do |m|\n block = $1\n idx = 0\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" \" + (idx += 1).to_s + \". \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n str.gsub!(/^\\s*\\\\begin\\{itemize\\}((?:.|\\n)*)\\s*\\\\end\\{itemize\\}/) do |m|\n block = $1\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" * \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n # brainfuck\n str.gsub!(/\\\\verb\\|([-+><,\\.\\[\\] ]+)\\|/) do |m|\n %!@<tt>#{LBRACE}#{$1}#{RBRACE}!\n end\n\n # file url in hoge.tex\n str.gsub!(/\\{\\\\scriptsize((?:.|\\n)+?)\\}/) do |m|\n s = $~[1].strip\n if s.strip =~ URI.regexp && s == $~[0]\n s\n else\n m\n end\n end\n\n str\nend", "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! /&nbsp;/ , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end", "def parse_span_html; end", "def parse_html(html)\n doc = Nokogiri::HTML(html)\n\n # Removing style and script tag content such as Javascript tags in order to get rid of JUNK text\n doc.xpath(\"//script\").remove\n doc.xpath(\"//style\").remove\n begin\n text = doc.at('body').inner_text\n rescue NoMethodError\n puts \"NoMethodError\"\n # puts file_name\n #title = nil\n end\n\n return text\nend", "def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy = ldr_last + m.post_match # portion following the first printing character\n \n cln_ldr = ldr.gsub(/<p/mi, \"<span\")\n cln_ldr = cln_ldr.gsub(/<\\/p/mi, \"</span\")\n cln_ldr = cln_ldr.gsub(/<br(.*?)>/mi, \"\")\n \n m = bdy.match(/(\\A.*?)<p/mi)\n if !m\n bdy = bdy.sub(/<\\/p/mi, \"</span\") # change first closing </p> from an open <p> remaining from ldr\n else\n l = m.post_match\n f_cln = m[0].gsub(/<\\/p/mi, \"</span\") # change any closing </p> from and open <p> remaining from ldr\n bdy = f_cln + l \n end\n return cln_ldr + bdy \n end", "def to_html(content)\n case @parser\n when :kramdown, 'kramdown'\n require 'kramdown'\n Kramdown::Document.new(content).to_html\n when :redcarpet, 'redcarpet'\n require 'redcarpet'\n markdown = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n smart: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n autolink: true,\n tables: true,\n with_toc_data: true\n )\n\n # add smartypants support\n Redcarpet::Render::SmartyPants.render markdown.render(content)\n when :rdiscount, 'rdiscount'\n require 'rdiscount'\n RDiscount.new(content).to_html\n when :gfm, :github, :github_markdown, 'gfm', 'github_markdown'\n require 'github/markdown'\n GitHub::Markdown.render(content)\n end\n end" ]
[ "0.72275674", "0.7037976", "0.6898776", "0.6856065", "0.6822643", "0.67134655", "0.67065716", "0.66989154", "0.66362983", "0.6617293", "0.66110164", "0.65809214", "0.65735453", "0.6573088", "0.65580565", "0.65563947", "0.65555423", "0.65246415", "0.65094733", "0.6453285", "0.6416595", "0.6406776", "0.6384085", "0.6377826", "0.63725895", "0.63644874", "0.6339083", "0.631768", "0.631768", "0.6317587", "0.6295299", "0.6289924", "0.6273405", "0.6255514", "0.6255514", "0.62336934", "0.6233438", "0.6229634", "0.622752", "0.6221889", "0.6210675", "0.62070477", "0.6200832", "0.6195964", "0.61867857", "0.61867386", "0.6161608", "0.6149264", "0.61374056", "0.61363405", "0.61280924", "0.6127952", "0.6126021", "0.61257327", "0.61133343", "0.6092555", "0.6085855", "0.60824025", "0.60761505", "0.60353404", "0.6019329", "0.60100114", "0.5977419", "0.59749305", "0.5965542", "0.5961051", "0.59446806", "0.59331554", "0.5928733", "0.5926619", "0.5923636", "0.59202224", "0.5919712", "0.5919691", "0.59082186", "0.59082186", "0.58971334", "0.58948505", "0.58915687", "0.58904177", "0.58800095", "0.5877107", "0.58741164", "0.58741164", "0.58741164", "0.5872632", "0.5865606", "0.5858325", "0.5852378", "0.5851344", "0.58297604", "0.5820436", "0.58143437", "0.5811521", "0.58075094", "0.58005166", "0.57956797", "0.5792538", "0.5785657", "0.5784301" ]
0.7170976
1
we need a place to store some metadata, it needed for :apply_once and versioning
def marks_dir dir "/tmp/marks" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata=(_); end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata\n @metadata ||= {}\n end", "def metadata=(_arg0); end", "def metadata\n @metadata ||= {}\n end", "def metadata_file; end", "def metadata_file; end", "def metadata\n @metadata ||= Mash.new\n end", "def live_metadata\n metadatas[full_path] ||= build_metadata\n end", "def write_metadata; end", "def metadata\n @metadata ||= Metadata.new(self)\n end", "def meta_information\n @meta_hash ||= {}\n end", "def metadata\n self[:metadata] || {}\n end", "def metadata\n @metadata ||= lambda { read_metadata }.call\n end", "def metadata\n @metadata ||= lambda { read_metadata }.call\n end", "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def metadata\n self.class.metadata[__name__] || {}\n end", "def extract_metadata; end", "def metadata\n @meta_data\n end", "def metadata\n @metadata.tap do |h|\n # This represents the minimal set of attribute methods that should be available in every subclass.\n h[:mime_type] = mime_type if mime_type\n h[:filename] = filename if filename\n h[:digest] = digest if digest\n h[:size] = size if size\n h[:last_modified] = last_modified if last_modified\n end\n end", "def meta\n {}\n end", "def build_metadata_output\n metadata[:csv_file] = add_file_metadata\n metadata[:data_manipulations] = add_data_manipulations\n metadata[:csv_headers] = add_header_metadata\n # Add SQL data to metadata only if databases option is set.\n unless databases.nil?\n metadata[:sql] = add_sql_data\n end\n end", "def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end", "def metadata\n @metadata.clone.freeze\n end", "def build_system_metadata\n self.parsed_metadata['id'] = hyrax_record.id\n self.parsed_metadata[source_identifier] = hyrax_record.send(work_identifier)\n self.parsed_metadata[key_for_export('model')] = hyrax_record.has_model.first\n end", "def metadata\n hash.inject([]){ |list, data| list << MetaData.new(data[0], data[1][0]) }\n end", "def metadata\n Metadata.new(self)\n end", "def metadata\n # TODO Move into {NRSER::Props::Metadata}?\n # \n unless NRSER::Props::Metadata.has_metadata? self\n instance_variable_set \\\n NRSER::Props::Metadata::VARIABLE_NAME,\n NRSER::Props::Metadata.new( self )\n end\n \n NRSER::Props::Metadata.metadata_for self\n end", "def generate_metadata\n data = Hash.new\n data['id'] = self.id\n data['title'] = self.title\n data['author'] = self.author\n data['updated_at'] = self.updated_at\n return data\n end", "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end", "def read_metadata; end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end", "def metadata_info\n @metadata = Chef::Cookbook::Metadata.new\n @metadata.from_file(File.join(@opts[:path], 'metadata.rb'))\n end", "def stored_data; end", "def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end", "def update_initial_metadata(metadata)\n end", "def metadata\n @metadata\n end", "def initialize_metas_storage\n Thread.current[:metas] ||= {}\n end", "def save_meta_data(type)\n FileUtils.mkdir_p File.dirname(meta_file_path(type))\n File.open(meta_file_path(type), 'w') { |f| f.print self[type].to_yaml }\n if Mist.commit_meta_data\n Mist.repository.add meta_file_path(type)\n Mist.repository.commit '%s meta changes to %s' % [type, table_name]\n end\n\n # we must force meta to be reloaded because otherwise it could get out of sync with filesystem\n @meta = nil\n end", "def site_meta\n end", "def site_meta\n end", "def add_metadata(meta={})\n @local_metadata.deep_merge!(meta.dup)\n end", "def metadata\n result = store.metadata_for_path(path).dup\n\n file_meta = store.metadata_for_file(source_file).dup\n result.deep_merge!(file_meta)\n\n local_meta = @local_metadata.dup\n result.deep_merge!(local_meta)\n\n result\n end", "def build_metadata\n require 'json'\n require 'tempfile'\n\n metadata = {\n \"description\" => DESCRIPTION,\n \"short_description\" => DESCRIPTION,\n \"name\" => \"manageiq/master\",\n \"versions\" => map_releases\n }\n\n metadata_file = Tempfile.new\n metadata_file.write metadata.to_json\n metadata_file.close\n\n metadata_file\n end", "def store_meta_data\n img = ::MiniMagick::Image.open(file.file)\n\n model.format = img.type\n model.height = img.height\n model.width = img.width\n\n if img.exif.present?\n exif_date = img.exif[\"DateTimeOriginal\"].split(\" \")\n exif_date.first.gsub!(\":\", \"-\")\n\n model.taken_at = DateTime.parse exif_date.join(\",\")\n end\n end", "def extract_meta\n end", "def metadata\n configuration.metadata\n end", "def meta\n meta = {}\n set_meta(meta)\n return meta\n end", "def metadata\n self.class.metadata\n end", "def metadata\n return unless self[:metadata]\n\n self[:metadata].deep_symbolize_keys\n end", "def custom_meta_data\n end", "def metadata\n { \"name\" => name,\n \"description\" => description,\n \"license\" => license,\n \"source\" => datasource.title,\n \"url\" => datasource.url,\n \"publish_date\" => published_at,\n \"default\" => default_dim,\n \"units\" => {}, \n \"indvars\" => datacolumns.independent.map(&:name),\n \"depvars\" => datacolumns.dependent.map(&:name)\n }\n end", "def initialize()\n @metadata = Hash.new()\n return self\n end", "def fetch_metadata\n self.user_id ||= biblio_commons.user_id\n self.title ||= biblio_commons.name\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n end", "def meta(meta_data)\n @_meta = meta_data\n end", "def metadata\n return \"\"\n end", "def create_image_metadata\n {}\n end", "def metadata_table\n\t\t@store.metadata_table metadata\n\tend", "def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end", "def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end", "def store_metadata\n html = HTMLParse.new(url)\n self.meta_title = html.title\n self.meta_desc = html.desc\n end", "def metadata\n @data[:metadata]\n end", "def metadata(_=nil)\n if !_.nil?\n warn \"[DEPRECATION] The parameter of `metadata` is ignored and will be removed in 2.0. \" \\\n \"(called from #{caller.first})\"\n end\n remote_metadata.merge(local_metadata).freeze\n end", "def set_meta\n puts 'meta'\n end", "def metadata\n case object.package_type\n when 'composer'\n object.composer_metadatum\n when 'conan'\n object.conan_metadatum\n when 'maven'\n object.maven_metadatum\n when 'nuget'\n object.nuget_metadatum\n when 'pypi'\n object.pypi_metadatum\n else\n nil\n end\n end", "def load_metadata\n begin\n load RAILS_ROOT + '/app/metadata/' + self.name.to_s.underscore + '.rb'\n rescue MissingSourceFile\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def create_meta(file_name, uid, uname, user_address)\n hist_dir = history_dir(storage_path(file_name, user_address)) # get the path to the file history\n\n # write user name, user uid and the creation time to the json object\n json = {\n :created => Time.now.to_formatted_s(:db),\n :uid => uid,\n :uname => uname\n }\n\n # write file meta information to the createdInfo.json file\n File.open(File.join(hist_dir, \"createdInfo.json\"), 'wb') do |file|\n file.write(json.to_json)\n end\n end", "def fetch_metadata\n self.title ||= biblio_commons.title\n self.thumbnail ||= RemoteImage.new(:url => biblio_commons.thumbnail_url)\n self.format ||= biblio_commons.format\n end", "def storage; end", "def meta_data( name )\n fd = new name, 'r'\n fd.meta_data\n ensure\n fd.close unless fd.nil?\n end", "def metadata\n\t\tif @meta.nil?\n\t\t\t@meta = @store.metadata @metric_id\n\t\t\t@meta = @source.metaadd @meta\n\t\tend\n\t\treturn @meta\n\tend", "def meta_data\n #object = instance_variable_get('@'+controller_name.singularize)\n object = instance_variable_get('@resource')\n meta = {}\n\n if object.kind_of? ActiveRecord::Base\n meta[:keywords] = object.meta_keywords if object[:meta_keywords].present?\n meta[:description] = object.meta_description if object[:meta_description].present?\n end\n\n #if meta[:description].blank? && object.kind_of?(Spree::Product)\n # meta[:description] = strip_tags(truncate(object.description, length: 160, separator: ' '))\n #end\n\n meta.reverse_merge!({\n keywords: current_store.meta_keywords,\n description: current_store.meta_description,\n }) if meta[:keywords].blank? or meta[:description].blank?\n meta\n end", "def meta_data\n return nil unless success?\n\n @meta_data\n end", "def structured_data record\n metatags(record)\n return unless @metatags.present?\n\n @structured_data ||= Rails.cache.fetch \"#{record&.cache_key_with_version}/metadata\" do\n ([\n build_page_metadata(record, @metatags),\n build_event_metadata(record, @metatags),\n build_video_metadata(record, @metatags),\n build_listing_metadata(record, @metatags),\n build_breadcrumbs_metadata(record, @metatags),\n ] + build_content_metadata(record, @metatags)).compact\n end\n end", "def cache_version_data\n {}\n end", "def metadata\n {\n Title: 'Maestrano Monthly Invoice',\n Author: 'Maestrano',\n Subject: 'Maestrano Monthly Invoice',\n Producer: 'Maestrano',\n CreationDate: Time.now\n }\n end", "def prepare metadata\n ssh = @export_obj.ssh_to_source\n metadata.ssh = ssh\n end", "def metadata_path\n File.join(Rake.original_dir, 'metadata.rb')\nend", "def metadata\n @metadata ||= Metaforce::Metadata::Client.new(@options)\n end", "def metadata_for(db, model, from)\n if (v = metadata(db, model))\n return v\n end\n\n metadata = Ribs::MetaData.new\n define_ribs(model, :db => db, :metadata => metadata, :from => from)\n metadata\n end", "def metadata\n return sync { \"#@name #@last #@first y\" }\n end", "def sync_exif_data\n self.title = self.image_title if self.title.blank?\n self.caption = self.image_description if self.caption.blank?\n self.owner = self.image_copyright if self.owner.blank?\n end", "def metadata_start\n 2\n end", "def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end", "def metadata=(value)\n @metadata = value\n end", "def metadata=(value)\n @metadata = value\n end", "def apply_base_metadata\n\t\tdc_ds = self.dc\n\t\tdesc_ds = self.descMetadata\n\n\t \t#Here's where we call specific additional metadata changes...\n\t\tif self.respond_to?(:apply_specific_base_metadata)\n self.apply_specific_base_metadata\n end\t\n\n #Add the dc required elements\n\t\tdc_ds.update_indexed_attributes([:dc_identifier]=> self.pid) unless dc_ds.nil?\n\t\tdc_ds.update_indexed_attributes([:dc_genre]=>self.get_values_from_datastream(\"descMetadata\", [:genre], {}).to_s) unless dc_ds.nil?\n\t\n\t\t#Add the descMetadata required elements\n\t\tdesc_ds.update_indexed_attributes([:identifier]=> self.pid) unless desc_ds.nil?\n\t\tdesc_ds.update_indexed_attributes([:location, :primary_display]=> \"http://hydra.hull.ac.uk/resources/\" + self.pid) unless desc_ds.nil?\n\t return true\n end", "def metas_storage\n Thread.current[:metas]\n end", "def meta\n self.class.instance_variable_get(:@__meta)\n end", "def metadata\n {\n title: flickr_title,\n description: description\n }\n end", "def metadata=(metadata)\n @metadata = metadata\n end" ]
[ "0.7778093", "0.7708252", "0.7708252", "0.7708252", "0.7708252", "0.7708252", "0.7708252", "0.7708252", "0.7504455", "0.7282838", "0.7217583", "0.71995866", "0.71995866", "0.7145831", "0.6879168", "0.68028706", "0.6786339", "0.6771308", "0.6762995", "0.6750898", "0.6750898", "0.6716673", "0.6690947", "0.6581623", "0.6575386", "0.6558474", "0.65316385", "0.65176183", "0.6500582", "0.64668196", "0.64253277", "0.6407384", "0.6395524", "0.6391829", "0.6386002", "0.6344625", "0.633778", "0.6319128", "0.6319128", "0.63090247", "0.6233333", "0.62176085", "0.62131655", "0.61965334", "0.61871177", "0.61828256", "0.61593163", "0.6145846", "0.6145846", "0.6144181", "0.61151785", "0.6108981", "0.61044925", "0.6103211", "0.6078226", "0.60643995", "0.6059672", "0.6048421", "0.60420424", "0.6039444", "0.6035565", "0.60327", "0.6028387", "0.6026385", "0.6023145", "0.6018113", "0.6016501", "0.6016501", "0.6008828", "0.6004144", "0.5993514", "0.5986297", "0.5982598", "0.5965031", "0.5955989", "0.5955989", "0.5955629", "0.5952598", "0.59284765", "0.59165394", "0.5904262", "0.59021515", "0.5896125", "0.5874644", "0.5867893", "0.58625305", "0.58423567", "0.5840915", "0.58370227", "0.58340687", "0.58291614", "0.58284074", "0.58260113", "0.5825006", "0.5823267", "0.5823267", "0.5819518", "0.5818711", "0.5813987", "0.58067274", "0.58054954" ]
0.0
-1
find_followers method is a way of getting an array of all the followers to use in other methods
def find_followers bloodoath_cults = BloodOath.all.select do |bloodoath_instance| bloodoath_instance.cult == self end bloodoath_cults.map do |cult| cult.follower end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def followers\n list = service.find_followers(user).map {|data| build_object(data)}\n followers = list.map {|follower| follower.login}\n end", "def get_all_followers\n followers = []\n self.follower_ids.each do |id|\n unless Person.find_by_twitter_id(id).nil?\n followers << Person.find_by_twitter_id(id) \n end \n end\n return followers\n end", "def return_list_of_followers\n @followers = []\n #Find the list of users following the current user by searching the followed_user_id\n #We need to add each user to the array - otherwise we return an array of object Follow\n Follow.find(:all, :conditions => {:follow_user_id => self.id}).each {|f| @followers << f.user}\n @followers\n end", "def followers\n @followers ||= get(\"/user/show/#{login}/followers\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def followers\n rels = Relationship.where(followed_id: self.id)\n followers = []\n rels.each do |rel|\n followers << User.find(rel.follower_id)\n end\n followers\n end", "def followers\n follower_ids = Following.where(:followed_id => self.id).order(:follower_id).pluck(:follower_id)\n ret_val = []\n follower_ids.each do |follower_id|\n ret_val << User.find(follower_id)\n end\n ret_val\n end", "def followees\n list = service.find_user_follows(user).map {|data| build_object(data)}\n followees = list.map {|followee| followee.login}\n end", "def followers\n result = connection.get(\n \"/users/#{CGI.escape(login)}/followers\"\n )\n\n result.map do |follower|\n self.class.new(follower, connection)\n end\n end", "def followers\n\t Friendship.findFriends(self,\"follow\",\"from\")\n end", "def followers(options={})\n self.followings.unblocked.approved.includes(:follower).\n apply_finder_options(options, true).\n to_a.collect{|f| f.follower}\n end", "def followers\n scrape_for(:followers, :get_followers)\n end", "def followers\n @followers = Follower.where(:friend_id => @current_user.id)\n end", "def followers(options={})\n options = {\n :count => 1000,\n :offset => 0,\n :fields => \"screen_name\"\n }.merge(options)\n\n fetch_all_method_items(:fetch_followers, options)\n end", "def followers\n user_ids = $redis.smembers(self.redis_key(:followers))\n User.where(:id => user_ids)\n end", "def followers\n QuestionFollower.followers_for_question_id(@id)\n end", "def followers\n user_ids = $redis.smembers(self.redis_key(:followers))\n User.where(:id => user_ids)\n end", "def find_followers(user, options = {})\r\n Relationship.find_followers(user, [self.relationshiptype_id], options)\r\n end", "def followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end", "def all_followers\n cult = Bloodoath.all.select{|bo| bo.cult == self}\n followers = cult.map{|cult| cult.follower}\n end", "def get_followers(auth = auth_http())\n TwBot.followers_of(auth)\n end", "def followers\n if @activity.user_type == 'User' && @activity.key == 'vote.create'\n ids = (@actor.followers_ids.union(@activity.recipient.voters_ids) - [@activity.recipient_user.id.to_s])\n elsif @activity.user_type == 'School'\n ids = (@actor.followers_ids.union(@activity.recipient.followers_ids) + @actor.users.pluck(:id).map(&:to_s) - [@activity.recipient_user.id.to_s])\n else\n ids = (@actor.followers_ids.members - [@activity.recipient_user.id.to_s])\n end\n User.find(ids.uniq)\n end", "def user_followers\n self.followers.map{ |f| User.find(f.follower_id) }\n end", "def followers\n\t\t@unique_followers_set = Set.new\n\n\t\tself.comments.each do |c|\n\t\t\tnext if c.user == c.commentable.user\n\t\t\t@unique_followers_set << c.user\n\t\tend\n\n\t\tself.offers.each do |o|\n\t\t\t@unique_followers_set << o.user\n\t\tend\n\n\t\tif @unique_followers_set.empty? == true\n\t\t\treturn nil\n\t\tend\n\n\t\treturn @unique_followers_set\n\tend", "def followers(page=1)\n return get(\"/statuses/followers.json?page=#{page}\") if page == 1\n ids = []\n cursor = \"-1\"\n page.times do \n return [] if cursor == 0 \n json = get(\"/statuses/followers.json?cursor=#{cursor}\")\n cursor = json[\"next_cursor\"]\n ids = json[\"ids\"]\n end\n ids\n end", "def followers\n @followers ||= refresh_followers\n end", "def return_list_of_followed_users\n @followees = []\n #We need to add each user to the array - otherwise we return an array of object Follow\n self.follows.each {|f| @followees << f.followed_user}\n @followees\n end", "def followers\n follower_ids = Follow.where(following_id: id).pluck(:user_id)\n User.where(id: follower_ids)\n end", "def get_followers_ids(auth = auth_http())\n TwBot.followers_ids(auth)\n end", "def followers(user=nil)\n\t\tcursor = -1\n\t\tpage = 0\n\t\tfollowers = []\n\t\tbegin\n\t\t\tfollowerspage = followers_by_cursor( user, cursor )\n\t\t\tpage += 1\n\t\t\tputs \"page #{page}/cursor #{cursor} - found #{followerspage[\"users\"].size} followers. Next cursor: #{followerspage[\"next_cursor\"]}\"\n\t\t\tfollowers += followerspage[\"users\"] if followerspage[\"users\"]\n\t\t\tcursor = followerspage[\"next_cursor\"]\n\t\tend until cursor == 0\n\t\tfollowers\n\trescue => err\n\t\tputs \"Exception in followers: #{err}\"\n\t\traise err\n\tend", "def followers(options={})\n options = {\n :include => [:follower]\n }.merge(options)\n self.followings.unblocked.all(options).collect{|f| f.follower}\n end", "def followers \r\n\tlovers = []\r\n\tself.likes.each do |l|\r\n\t\tlovers << l.user\r\n\tend\r\n\tself.feature_groups.each do |fg|\r\n\t\tfg.features.each do |f|\r\n\t\t\tf.likes.each do |l|\r\n\t\t\t\tlovers << l.user\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn lovers.unique\r\n end", "def followers\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @users = @user.follow_by_users.fields_for_list.order(\"actions.id asc\").offset(params[:offset]).limit(params[:limit])\n end", "def followers(num)\n last_followers = @client.followers\n\n end", "def followers\n Following.where(:followed_id => self).includes(:follower).map(&:follower)\n end", "def followers(options={})\n # Not avaiable since 30.04.2015\n return []\n\n limit = options[:limit] || 5000\n fetch_all = options[:fetch_all] || false\n iteration = 0\n\n _followers = collection = user.subscribers(:limit => limit)\n max_iteration = _followers.total_count / limit + 1\n\n if fetch_all\n while iteration < max_iteration\n iteration += 1\n collection = collection.next\n _followers += collection\n end\n end\n\n _followers\n end", "def followers\n config = create_or_find_config\n \n puts\n Twitter::Base.new(config['email'], config['password']).followers.each do |u|\n puts \"#{u.name} (#{u.screen_name})\"\n puts \"#{u.status.text} at #{u.status.created_at}\" unless u.status.nil?\n end\n end", "def show_all_followers\n \n # Get the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n \n # Pass through the set of users that are following the specified user\n @followers = @user.followers\n end", "def followers\n fids = followers_ids\n fids.count < 1 ? [] : User.where('id IN (?)', fids)\n # fids.count < 1 ? [] : User.where('id IN (?)', fids)\n end", "def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end", "def follower_ids\n follows.try(:[], 'followers') || []\n end", "def follower_ids(options={})\n perform_get(\"followers/ids.#{Twitter.format}\", options)\n end", "def followers(id, page_options = default_paging_options, scope = Amico.default_scope_key)\n members(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\", page_options)\n end", "def followers\n @followers = @user.followers.order(created_at: :desc) # order the followers(the people that follows current_user) according to when they follow current_user, with the most recent follower at the top.\n end", "def followers\n Follow.where(\"following_id = ?\", self.id)\n end", "def get_followees(ids)\n followees_resp = twitter_user.request(:get, configatron.api_call_url + \"users/lookup.json?user_id=#{ids.join(',')}\")\n \n if followees_resp.is_a?(Net::HTTPSuccess)\n get_nicknames_and_names(JSON.parse(followees_resp.body))\n end\n end", "def followers(user_id = nil)\n twitter_request do\n logger.info \"Get followers of #{user_id || 'me'}\"\n client.follower_ids(user_id).take(5000)\n end\n end", "def list_followers(id)\n get(\"lists/#{id}/followers\").followers\n end", "def all_followers(username = false)\n users = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/statuses/followers#{username ? \"/#{username}\" : ''}.json?cursor=#{cursor}\")\n cursor = json[\"next_cursor\"]\n users += json[\"users\"]\n end\n users\n end", "def followers\n project.source.followers\n end", "def followers\n @followers = current_user.followers.order(\"username\").page(params[:page]).per(10)\n end", "def followings\n b=BeFollow.scoped_by_follower_id(self.id)\n user_ids=b.map do |a|\n a.user.id\n end\n User.find_all_by_id(user_ids)\n end", "def get_followers\n HTTParty.post(\"#{@api_path}/users/followers/#{@handle}/#{@password}\")\n end", "def followers(action=nil)\n my.followers(action)\n end", "def followers_usernames\n url = [PUBLIC_BASE_URL, 'user/show', self.login, 'followers'].join('/')\n JSON.parse(open(url).read)['users']\n end", "def all_follower_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/followers/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end", "def followers\n @followers = @other_user.followers.paginate(:page => params[:page], :per_page => 20)\n end", "def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end", "def followers\n @client.followers.ids?\n end", "def followers_ids\n Following.where(followed_id: self.id).pluck(:follower_id)\n end", "def followers\n # First, get all of this cult's blood oaths and then for each one, return the follower that blood oath belongs to\n self.blood_oaths.map { |blood_oath| blood_oath.follower }\n end", "def followers\n client = Twitter::Client.new.configure do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.oauth_token = ENV['OAUTH_TOKEN']\n config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']\n end\n\n client.user(@login).followers_count\n end", "def follower_ids\n followers.map(&:id)\n end", "def followers(user=nil)\n\t\tself.twitagent.followers(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get followers via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting followers)\"\n\t\treturn\n\tend", "def followers\n self.blood_oaths.map{|bloodoath_instance| bloodoath_instance.follower}.uniq\n end", "def followers(id)\n perform_request_with_collection(:get,\n \"/api/v1/accounts/#{id}/followers\",\n {}, Mastodon::Account)\n end", "def followers\n blood_oath.map{|blood_oath| blood_oath.follower}\n end", "def cur_followers\n self.cur_oaths.map {|bloodoath| bloodoath.follower}\n end", "def fetch_api_followers\n client = api_client\n\n next_cursor = nil\n api_followers = Hash[1.step(self.followers_count,20).inject([]) do |acc, a|\n options = {count: 20}\n {cursor: next_cursor}.merge!(options) if next_cursor\n response = client.user_followed_by(self.uid, options)\n next_cursor = response.fetch('pagination', {}).fetch('next_cursor', nil)\n acc + response['data'].map {|u| [u['id'], u]}\n end]\n end", "def yammer_followers(yammer_user, client = self.yammer_client, fetch_email = true)\n return [] unless client.authenticated?\n Rails.logger.debug {\"#{Time.now.to_formatted_s(:db)} - Fetching yammer followers for user(#{self.log_label})\"}\n\n set = client.users_following(yammer_user.id).users.try(:collect) do |u|\n User.from_yammer(u)\n end\n\n return set || []\n rescue YammerClient::Unauthorized => e\n return [] \n end", "def followers(pr_id)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where pr.user_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :num_followers)\n end", "def followers(blog_name, options = {})\n validate_options([:limit, :offset], options)\n get(blog_path(blog_name, 'followers'), options)\n end", "def followers\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followers = @interviewee.followers\n @current_user.refresh_notifications(\"new_followers_count\")\n end", "def my_followers\n cult_blood_oaths = BloodOath.all.select {|b_o_instance| b_o_instance.cult == self}\n cult_followers = cult_blood_oaths.map {|b_o_instance| b_o_instance.follower}\n cult_followers.uniq\n end", "def followers_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('followers/ids', args), params_from_args(params)\n end", "def number_of_followers\n return_list_of_followers.size\n end", "def followers_count\n follow_count_for_a(:follower)\n end", "def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @usersList = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def followers(followable, klass, opts = {})\n rel = Socialization::RedisCache::Follow.followers(followable, klass, opts)\n rel = super(followable, klass, opts) if rel.blank?\n rel\n end", "def followee_ids(user)\n expect! user => [Integer, String]\n \n benchmark :warn, \"Fetching followee_ids\" do |bm|\n r = client.friend_ids(user).all\n bm.message = \"Fetching #{r.length} followee_ids\"\n r\n end\n rescue StandardError\n $!.log \"TwitterAPI.followee_ids\"\n []\n end", "def get_followees_ids(page)\n page ||= 0\n # To get friend ids, we need to supply a cursor which starts at -1 and has bucket size of 5000 (https://dev.twitter.com/docs/api/1/get/friends/ids)\n cursor = (((page*configatron.page_size)+configatron.page_size) / 5000).floor - 1\n \n followees_ids_resp = twitter_user.request(:get, configatron.api_call_url + \"friends/ids.json\", { 'cursor' => cursor.to_s })\n \n ids = JSON.parse(followees_ids_resp.body) if followees_ids_resp.is_a?(Net::HTTPSuccess)\n return ids['ids'] if ids\n end", "def followers\n User.where(\"following @> ARRAY[#{id}]\").to_a\n end", "def followers\n @title = 'Followers'\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def followers\n begin\n @followers = current_user.twitter.get(\"/statuses/followers?page=#{params[:page] || 1}\")\n rescue TwitterAuth::Dispatcher::Error\n @followers = []\n end\n\n status = @followers.empty? ? 404 : 200\n\n respond_to do |format|\n format.html { render(:action => 'followers', :status => status) }\n format.json { render(:json => @followers.to_json, :status => status) }\n end\n end", "def followers\n if user.followers == \"[]\"\n [\"You have no followers LOSER!\"]\n else\n user.followers.gsub(\"\\\"\",\"\").split(\", \").map do |r|\n r.gsub(\"[\",\"\").gsub(\"]\",\"\")\n end\n end\n end", "def fetch_follower_id_array\n\t\tfollower_ids = hit_twitter { @client.follower_ids.to_a }\n\t\treturn follower_ids\n\tend", "def show_all_followees\n \n # Get the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n \n # Pass through the set of users that are being followed by the specified \n # user\n @followees = @user.followees\n end", "def followers_ids\n followers.pluck('users.id')\n end", "def get_user_followers(params) # :yields: JSON\n uri=URI.parse(@uri_builder.get_user_contents(Api_options::USER::FOLLOWERS,username:params[:username], token:@@app_token))\n http=HttpHandler.initiate_http(uri)\n begin\n if @@app_token == nil\n raise \"Authentication not provided\"\n end\n response=HttpHandler.get_response(http,uri)\n rescue ArgumentError\n puts \"Request failed with code: #{response.code}\"\n else\n @response_status=true\n return response\n end\n end", "def followers_info\n followers = []\n self.followers.each do |follower|\n followers << follower.attributes.merge(avatar: follower.avatar.url)\n end\n response = {\n message: \"Successfully fetch #{ self.username } followers\",\n relations: followers\n }\n end", "def user_followers(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/followers\", params)\n end", "def collect_followers twitter_id\n while @@client.application.rate_limit_status?.resources.followers.send(\"/followers/ids\").remaining == 0\n puts \"collect friends waiting...\"\n sleep(60) \n end\n \n begin\n puts \"COLLECTING Follower IDS OF #{twitter_id}\"\n result = @@client.followers.ids? :id => twitter_id, :cursor => -1\n follower_ids = result.ids\n old_cursor = 0\n next_cursor = result.next_cursor\n while old_cursor != next_cursor and next_cursor != 0\n old_cursor = next_cursor\n result = @@client.followers.ids? :id => twitter_id, :cursor => next_cursor\n follower_ids += result.ids\n next_cursor = result.next_cursor\n end \n rescue\n follower_ids = []\n tmp_person = @@client.users.show? :id => twitter_id\n SystemMessage.add_message(\"error\", \"Collect Followers\", \"Followers of Person with twitter id: \" + tmp_person.screen_name + \" could be not found.\") \n end\n if follower_ids != [] \n follower_ids_hash = Hash.new(0)\n store = PStore.new(FOLLOWER_IDS_PATH + twitter_id.to_s)\n store.transaction{store[twitter_id] = follower_ids_hash} #empty store if updating\n follower_ids.each do |follower_id|\n follower_ids_hash[follower_id] = 1 \n end\n store.transaction{store[twitter_id] = follower_ids_hash} #store values\n end\n end", "def followers\n user = load_user\n\n expose user\n .followers\n .includes(:following, :favorite_restaurants)\n .paginate(page: params[:page], per_page: params[:per_page]),\n each_serializer: UserRelationshipSerializer\n end", "def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def get_followers(user1)\n $redis2.fetch(\"followers/#{user1.cache_key}\") do\n ids = Follow.where(following: user1).pluck(:user_id)\n User.where(id: ids)\n end\n end", "def get_follower_ids(id)\n\t\tids = $redis.get(\"#{id}/follower\")\n\t\tif ids.nil?\n\t\t\tfollowees = Follow.where(followee_id: id)\n\t\t\tids = []\n\t\t\tfollowees.each do |f|\n\t\t\t\tids << f[\"follower_id\"]\n\t\t\tend\n\t\t\t$redis.set(\"#{id}/follower\", ids.uniq)\n\t\t\t# Expire the cache, every 15 minutes\n\t\t\t$redis.expire(\"#{id}/follower\", 15.minute.to_i)\n\t\telse\n\t\t\tids = JSON.parse(ids)\n\t\tend\n\t\tids\n\tend", "def followers(pr)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where prh.actor_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:num_followers]\n end", "def show_followers\n @followers = Follower.followers(session[:user_id])\nend", "def follower_ids\n self.follower_ids_hash.keys rescue []\n end", "def followed_users\n cached_followed_users\n end", "def followers(blog_name, options={})\n if valid_options([:limit, :offset], options)\n get(\"v2/blog/#{blog_name}/followers\", options)\n end\n end" ]
[ "0.84282106", "0.8039795", "0.79742193", "0.7815741", "0.77850556", "0.77472174", "0.77142555", "0.7689529", "0.7676293", "0.76397306", "0.76339966", "0.7622467", "0.7615512", "0.75408906", "0.75274915", "0.75239307", "0.7515676", "0.7493646", "0.7436206", "0.7430507", "0.74209976", "0.73948", "0.7384127", "0.73826206", "0.7349669", "0.7317562", "0.7316643", "0.729924", "0.7295503", "0.72698903", "0.72639465", "0.72517526", "0.7246559", "0.7216696", "0.721446", "0.721411", "0.71927834", "0.7189122", "0.71827966", "0.71770966", "0.7175957", "0.7159692", "0.71558416", "0.71457696", "0.71349895", "0.7128069", "0.71208274", "0.70808846", "0.7070877", "0.7061616", "0.7021699", "0.70201385", "0.70002824", "0.6987347", "0.69809985", "0.6954857", "0.6934539", "0.6905584", "0.6889976", "0.68884146", "0.6883735", "0.6881944", "0.68814564", "0.68237114", "0.682299", "0.6807173", "0.6804987", "0.6780114", "0.6777356", "0.6776422", "0.6727928", "0.6723685", "0.6711776", "0.67030835", "0.66956174", "0.66750133", "0.66694456", "0.66603804", "0.66602963", "0.6650225", "0.6643224", "0.6621369", "0.66208714", "0.6615174", "0.66132724", "0.6608086", "0.6604189", "0.6604164", "0.65940475", "0.6592194", "0.6588463", "0.6587935", "0.6583832", "0.6581566", "0.6580504", "0.65670294", "0.65443844", "0.6528668", "0.6517073", "0.6513032" ]
0.684728
63
GET /resource Lists all records for an invoice.
def index filter_params = params["#{model.name.underscore}_filter"].try(:first) @records = process_filters(model, filter_params) # page resources if the request is for html. For JSON and XML we will # return the entire recordset @records = @records.page(get_page) respond_with(@records) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def all_invoices\n @gateway.get_invoices.invoices\n end", "def index\n @invoicedetails = Invoicedetail.limit(100).all\n end", "def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})\n fetch_collection(Quickeebooks::Online::Model::Invoice, filters, page, per_page, sort, options)\n end", "def invoices\n Invoice.where(email: email)\n end", "def index\n @customer_invoices = CustomerInvoice.all\n end", "def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end", "def records(_options = {})\n if defined?(_resource_klass.records)\n _resource_klass.records(_options)\n else\n _resource_klass._model_class.all\n end\n end", "def index\n @invoice_line_items = InvoiceLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice_line_items }\n end\n end", "def index\n @invoice_items = @invoice.invoice_items\n end", "def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {invoices: @invoices, total_pages: @invoices.total_pages, current_page: @invoices.current_page}\n end", "def index\n @invoice_data_items = InvoiceDataItem.all\n end", "def index\n @invoices = User.find(current_user.id).invoices\n end", "def index\n @user_invoices = UserInvoice.all\n end", "def index\n respond_with(invoices)\n end", "def index\n @incominginvoices = Incominginvoice.all\n end", "def invoices\n return Xero.get_invoices(self)\n end", "def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end", "def url\n '/api/invoices'\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end", "def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end", "def index\n @page_name = 'Invoice History'\n @invoices = Invoice.all\n end", "def index\n @invoice = Invoice.new\n @customers = Customer.all\n @invoices = Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice }\n end\n end", "def index\n @service_invoices = ServiceInvoice.all\n end", "def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end", "def index\n @order_invoices = OrderInvoice.all\n end", "def show\n @breadcrumb = 'read'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n @items = @supplier_invoice.supplier_invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @approvals = @supplier_invoice.supplier_invoice_approvals.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_invoice }\n end\n end", "def invoices\n ChargeBee::Invoice.invoices_for_customer(chargebee_id).map(&:invoice)\n end", "def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @invoices=@project.invoices\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end", "def invoices\n result = Invoice.where(created_at: params[:start_date]..(params[:end_date]))\n .order(created_at: :desc)\n .map{ |x| filter_invoice(x)}\n render json: result\n end", "def index\n @raw_material_invoice_items = RawMaterialInvoiceItem.all\n end", "def all(options = {})\n query = {}\n query[:status] = options[:status] if options[:status]\n query[:page] = options[:page] if options[:page]\n query[:updated_since] = options[:updated_since] if options[:updated_since]\n if options[:timeframe]\n query[:from] = options[:timeframe][:from]\n query[:to] = options[:timeframe][:to]\n end\n\n response = request(:get, credentials, \"/invoices\", :query => query)\n api_model.parse(response.parsed_response)\n end", "def index\n start_time, end_time = normalize_start_and_end_time(params[:start_time], params[:end_time])\n authorize! :read, PaymentInvoice\n if !set_customer\n return #Already rendered errors json\n end\n @payment_invoices = @customer.payment_invoices.where(receipt_date: start_time..end_time)\n render json: @payment_invoices\n end", "def all(space_id, invoice_id, opts = {})\n data, _status_code, _headers = all_with_http_info(space_id, invoice_id, opts)\n return data\n end", "def index\n @invoice_services = InvoiceService.all\n end", "def show\n @invoice = Invoice.find(params[:id])\n end", "def get_invoices(opts = {})\n data, _status_code, _headers = get_invoices_with_http_info(opts)\n data\n end", "def index\n # Apply pagination\n @invoices = @invoices.page(params[:page])\n respond_with @organization, @invoices\n end", "def invoice_list\n @list_result=ChargeBee::Invoice.invoices_for_subscription(@subscription_id,\n { :limit => 20 })\n end", "def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end", "def index\n @invoices = Invoice.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end", "def index\n @invoices = @account_invoices.where(invoices: { created_at: @start_date...@end_date })\n end", "def invoice\n SalesEngine::Invoice.find_by_id(self.invoice_id)\n end", "def index\n @loads = Load.all\n # @inv = Stripe::Invoice.retrieve(Load.find(9).invoice_id)\n end", "def index\n @resources = Resource.all\n end", "def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def all\n PaginatedResource.new(self)\n end", "def index\n @invoice_headers = InvoiceHeader.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoice_headers }\n end\n end", "def index\n @invoices = current_organization.invoices.paginate(:all, :order => 'number DESC', :page => params[:page])\n end", "def sales_invoice(id)\n get \"sales_invoices/#{id}\"\n end", "def index\n @invoice_histories = InvoiceHistory.all\n end", "def index\n if current_user.has_role?('administrator')\n @invoices = Invoice.find(:all)\n else \n @invoices = current_user.invoices\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end", "def show\n \n respond_with(@invoice, @invoice_items)\n end", "def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end", "def invoice\n @invoice ||= Invoice.find(params[:id])\n end", "def index\n @resources = Resource.all\n end", "def index\n @resources = Resource.all\n end", "def index\n @resources = Resource.all\n end", "def index\n @receipts = current_account.receipts.all\n end", "def index\n @invoice_types = InvoiceType.all\n end", "def index\n if current_user&.admin?\n @invoices = Invoice.page(params[:page]).order('id DESC')\n elsif current_user\n @invoices = current_user.invoices.page(params[:page]).order('id DESC')\n else\n redirect_to login_path\n end\n end", "def index\n @proforma_invoices = ProformaInvoice.all.paginate(page: params[:page], per_page: 15)\n end", "def index\n \n @inquiries = Inquiry.all(:order => 'id desc').paginate(:page => params[:page], :per_page=>15)\n\n respond_to do |format|\n format.html { render 'index' }\n format.xml { render :xml => @inquiries }\n end\n end", "def index\n @inquiries = Inquiry.all\n end", "def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end", "def index\n defaults = {:filter => {:rentable_id => nil, :include_paid => 1, :include_non_paid => 1},\n :date => {:month => Date.today.month, :year => Date.today.year}}\n params.replace(defaults.merge(params))\n\n queryParams = {}\n if params[:filter][:include_paid] != params[:filter][:include_non_paid]\n queryParams[:paid]=params[:filter][:include_paid].to_i == 1 ? TRUE : FALSE\n end\n if params[:filter][:rentable_id].to_i != 0\n queryParams[:rentable_id]=params[:filter][:rentable_id].to_i\n end\n\n list = params[:date][:month]!='' ? [params[:date][:month]] : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n @invoices = Invoice.where(queryParams).where('extract(month from due) in (?) AND extract(year from due) = ?', list, params[:date][:year])\n end", "def show\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def index\n @add_to_invoice_clients = AddToInvoiceClient.all\n end", "def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invoice }\n end\n end", "def invoice\n params['invoice']\n end", "def invoice\n params['invoice']\n end", "def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end", "def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def index\n @current_customer = sticky_param(:customer_id)\n @current_status = sticky_param(:status)\n if params[:search].present?\n @invoices = Invoice.quick_find(params[:search])\n else\n @invoices = Invoice.paginate_with_filters({\n :customer_id => @current_customer,\n :status => @current_status\n }, {:page => params[:page], :order=>'date desc,number'})\n end\n respond_to do |format|\n format.html {\n @customers = Customer.find_invoiced\n }\n format.xml { render :xml => @invoices.to_xml }\n end\n end", "def index\n @hours = Hour.where(user_id: current_user.id).to_a\n @clients = Client.where(user_id: current_user.id).to_a\n invoices_hid = @hours.uniq.pluck(:invoice_id)\n @invoices = Invoice.where(id: invoices_hid)\n end", "def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end" ]
[ "0.6929624", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.67074436", "0.6649003", "0.6635887", "0.659044", "0.64210886", "0.638531", "0.63782907", "0.63680494", "0.63589543", "0.6334913", "0.630763", "0.630254", "0.6292626", "0.62706894", "0.6248382", "0.62398064", "0.6228904", "0.6218809", "0.62095135", "0.61917317", "0.6188129", "0.6183833", "0.61658007", "0.61463785", "0.61266166", "0.6107234", "0.6091015", "0.60893977", "0.60707474", "0.6042193", "0.6040843", "0.60389674", "0.6033453", "0.6022474", "0.6014014", "0.6009277", "0.60014796", "0.5991745", "0.5986115", "0.596514", "0.59569615", "0.59476316", "0.59387493", "0.5936457", "0.59337467", "0.59053886", "0.59032005", "0.58970296", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.58937436", "0.5893412", "0.58929604", "0.5881924", "0.5870692", "0.5869769", "0.58632725", "0.5862659", "0.584717", "0.5833961", "0.5833961", "0.5833961", "0.58255386", "0.5816499", "0.5811897", "0.5810036", "0.5800473", "0.57942325", "0.57750064", "0.5747234", "0.574227", "0.57279646", "0.571608", "0.5689395", "0.5675262", "0.5675262", "0.5663801", "0.5657432", "0.56476283", "0.56320316", "0.56303936", "0.56253177", "0.56253177", "0.56253177", "0.5621505" ]
0.0
-1
GET /resource/new Renders new form for a given resource.
def new @record = model.new # call before actions created in the DSL if resource.before_actions[:new] resource.before_actions[:new].call(@record) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def new_resource\n controller_class.new(new_resource_params)\n end", "def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end", "def new\n @resource = Resource.new\n end", "def new\n resource = build_resource({})\n respond_with resource\n end", "def new\n authorize! :new, resource\n yield if block_given? # after_new\n respond_with resource\n end", "def new\n @resource_file = ResourceFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_file }\n end\n end", "def new\n set_resource model_class.unscoped.new\n respond_with resource\n end", "def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end", "def new\n @q_resource = QResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @q_resource }\n end\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n build_resource\n yield resource if block_given?\n end", "def new\n @projectresource = Projectresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectresource }\n end\n end", "def new\n self.resource = resource_class.new\n @resource = self.resource\n respond_to do |format|\n format.html\n format.js\n end\n end", "def new\n build_resource\n yield resource if block_given?\n respond_with resource\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def new\n render 'new'\n end", "def new\n # render(:new) => this whole action could also be implicit\n end", "def new\n render \"new\"\n end", "def new\n render \"new\"\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\n end\n end", "def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def new\n @resource = Resource.new\n @resource_groups = ResourceGroup.alphabetical.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @tiny_resource = TinyResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiny_resource }\n end\n end", "def new\n render :new\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n @resources_data = ResourcesData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resources_data }\n end\n end", "def new\n @mostsmallresource = Mostsmallresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def new\n @fundamental_resource_pool = Fundamental::ResourcePool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_resource_pool }\n end\n end", "def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource_view = ResourceView.new\n @part = Part.find_by_id(params[:current_part_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_view }\n end\n end", "def new\r\n build_resource({})\r\n resource.build_patient\r\n set_minimum_password_length\r\n yield resource if block_given?\r\n respond_with self.resource\r\n end", "def new\n @person = Person.new #will create a blank person in memory but it will not have an id nor will it save it in memory\n @term = 'Add Person'\n render partial: 'form' #this will send it to the form page\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new\n render\n end", "def new\n render\n end", "def new\n render\n end", "def new\n render\n end", "def new\n @permission_resource = PermissionResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @permission_resource }\n end\n end", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def new\n @page_title = \"New Recipe\"\n @recipe = current_user.recipes.build\n @btnText = \"Create Recipe\"\n @obj = @recipe\n render 'shared/form'\n end", "def new\n @entity = resource_class.new\n end", "def new\n render(\n :new,\n layout: false,\n locals: local_vars.merge(\n all_clinics: Renalware::Pathology::Clinic.for_algorithm,\n all_consultants: Renalware::Pathology::Consultant.ordered,\n all_templates: Renalware::Pathology::Requests::Request::TEMPLATES\n )\n )\n end", "def new\n @licserver = Licserver.new\n\n respond_to do |format|\n format.html { render :partial => 'form', :locals => { :licserver => nil } }\n\t\t\tformat.template { render :partial => 'form.html', :locals => { :licserver => nil } }\n format.json { render json: @licserver }\n end\n end", "def new\n @object = @model_class.new\n respond_to do |format|\n format.html { render :template => views_directory + '/form' }\n format.xml { render :xml => @object }\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n \n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @formulary = Formulary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulary }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def new\n\t\t@student = Student.new\n\t\tnew_setup()\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\tend\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n\n if @resource.save\n flash[:notice] = 'Resource was successfully created.'\n redirect_to @resource\n else\n render :action => \"new\"\n end\n end", "def new\n @resources_and_link = ResourcesAndLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n # Define a new question to properly generate a form\n @question = Question.new\n end", "def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n\n end", "def new\n\n end", "def new\n @thing = Thing.new\n render :layout => \"form\"\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @resource = Resource.new\n @type = 'file' if params[:type] == 'file'\n respond_to do |format|\n format.html{}\n end\n end", "def new\n @regform = Regform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regform }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @user_resource = @user.user_resource.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_resource }\n end\n end", "def new\n respond_to do |format|\n format.html\n end\n end", "def new\n @label = Label.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @label }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "def new\n @input = Input.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @input }\n end\n end", "def new\n @label = Label.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @label }\n end\n end", "def new\n @label = Label.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @label }\n end\n end", "def new\n @resource = Resource.new(params[:resource])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource }\n end\n end", "def new\n # Using the render method is not necessary if\n # there is a view in `views/questions` with the\n # same name as the action `new`\n @question = Question.new\n end", "def new\n end" ]
[ "0.83946455", "0.8377171", "0.83353156", "0.83353156", "0.83353156", "0.8201608", "0.8201608", "0.80742204", "0.7988833", "0.7868805", "0.7811344", "0.78016216", "0.77994597", "0.76069725", "0.75253797", "0.7460319", "0.7458082", "0.740963", "0.73679894", "0.7352423", "0.7352423", "0.7352423", "0.7352423", "0.73505515", "0.73442304", "0.7296658", "0.7274677", "0.7274133", "0.7274133", "0.7268325", "0.72561324", "0.7232693", "0.7232693", "0.72219056", "0.7143618", "0.7143618", "0.7132861", "0.71313804", "0.71188056", "0.7108277", "0.7106655", "0.7104785", "0.70942795", "0.7067783", "0.7042906", "0.7012096", "0.69979256", "0.69938374", "0.6990191", "0.6990191", "0.696787", "0.696787", "0.696787", "0.696787", "0.69595665", "0.69569457", "0.69569457", "0.6949228", "0.6939671", "0.69382304", "0.6930653", "0.6927761", "0.69272846", "0.6925138", "0.6925017", "0.6924579", "0.69226813", "0.69182533", "0.6913195", "0.6913195", "0.6913195", "0.6913195", "0.6913195", "0.6913195", "0.6912197", "0.6909098", "0.69051844", "0.69051844", "0.69051844", "0.69051844", "0.69051844", "0.6900917", "0.6900917", "0.6899406", "0.68893343", "0.68780035", "0.687563", "0.68724996", "0.68724996", "0.68724996", "0.68724996", "0.68713945", "0.68628645", "0.68583524", "0.68538636", "0.684946", "0.68487763", "0.68487763", "0.68467313", "0.6842913", "0.6842118" ]
0.0
-1
POST /resource Creates a new resource record if valid, renders new form if not.
def create @record = model.new(record_params) # call before actions created in the DSL if resource.before_actions[:create] resource.before_actions[:create].call(@record) end if @record.save redirect_to polymorphic_path([app_kit, @record]) else puts @record.errors.full_messages.inspect render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @resource = Resource.new(params[:resource])\n\n if @resource.save\n flash[:notice] = 'Resource was successfully created.'\n redirect_to @resource\n else\n render :action => \"new\"\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n \n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n flash[:notice] = 'Resource was successfully created.'\n format.html { redirect_to(@resource) }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n flash[:success] = 'Resource was successfully created.'\n format.html { redirect_to admin_resource_path(@resource.id) }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end", "def create\n resource = model_class.new(permitted_resource_params)\n ensure_current_store(resource)\n\n if resource.save\n render_serialized_payload(201) { serialize_resource(resource) }\n else\n render_error_payload(resource.errors)\n end\n end", "def create\n existing_resource = Resource.find_by_url(params[:resource][:url])\n if existing_resource\n flash[:notice] = \"That resource has already been added, but please give it a review!\"\n redirect_to resource_path(existing_resource) and return\n end\n @resource = Resource.new(params[:resource])\n @resource.contributor = current_user\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to(@resource, :notice => 'Resource was successfully created.') }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n instance_variable_set(resource, @model.new(resource_params))\n\n yield if block_given?\n\n respond_to do |format|\n if instance_variable_get(resource).save\n format.html { redirect_to action: :index, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: resource_location }\n after_create\n else\n format.html { render :new }\n format.json do\n render json: instance_variable_get(resource).errors.as_json(full_messages: true),\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @post = new_resource_post\n \n respond_to do |format|\n if @post.save\n flash[:success] = 'Post created'\n format.html { redirect_to post_url }\n else\n format.html { render :action => resource_template(\"new\") }\n end\n end\n end", "def create\n created_resource = create_resource(new_resource, resource_params)\n if created_resource.errors.blank?\n render json: serialize(created_resource),\n status: :created\n else\n render json: serialize_invalid_attributes(created_resource.errors),\n status: :unprocessable_entity\n end\n end", "def create\n self.resource = new_resource\n\n respond_to do |format|\n if resource.save\n flash[:notice] = \"#{resource_name.humanize} was successfully created.\"\n format.html { redirect_to resource_url }\n format.xml do\n header_attrs = {:location => resource_url}\n header_attrs.merge!(:key => resource.key) if resource.respond_to?(:key)\n head :created, header_attrs\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => resource.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def create\n self.resource = new_resource\n \n respond_to do |format|\n if resource.save\n format.html do\n flash[:notice] = \"#{resource_name.humanize} was successfully created.\"\n redirect_to challenge_url(resource)\n end\n format.js\n format.xml { render :xml => resource, :status => :created, :location => resource_url }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => \"new\" }\n format.xml { render :xml => resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @resource = current_admin.resources.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n self.resource = new_resource\n \n respond_to do |format|\n if resource.save\n format.html do\n flash[:notice] = \"#{resource_name.humanize} was successfully created.\"\n redirect_to edit_challenge_attempt_path(resource.challenge, resource)\n end\n format.js\n format.xml { render :xml => resource, :status => :created, :location => resource_url }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => \"new\" }\n format.xml { render :xml => resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n validate_save_and_respond(change_set_class.new(resource_class.new), :new)\n end", "def create\n @resource = Resource.new(resource_params)\n @resource.active = true\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(resource_params)\n\n handle_extra_data\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to edit_project_path(@resource.project), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = current_user.resources.build(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def create\n model = model_class.new\n action = action_class.new(model, current_user)\n\n respond_with(action.create(resource_attributes))\n end", "def create\n @asset = Resource.new(resource_params)\n \n if @asset.save\n redirect_to admin_resource_path(@asset), notice: 'Resource was successfully created.'\n else\n render action: 'new'\n end\n end", "def create\n begin\n @resource = Entity.new(params[:entity])\n @resource.save!\n render :response => :POST\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def create\n self.resource = new_resource\n \n respond_to do |format|\n if resource.save\n format.html do\n flash[:notice] = \"#{resource_name.humanize} was successfully created.\"\n redirect_to paypal_challenge_attempt_url(resource.attempt.challenge, resource.attempt)\n end\n format.js\n format.xml { render :xml => resource, :status => :created, :location => resource_url }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => \"new\" }\n format.xml { render :xml => resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n self.resource = resource_class.new(params_for_create.to_hash.merge({created_by: current_user}))\n\n respond_to do |format|\n if resource.save\n format.html { redirect_to resource, notice: \"#{resource_class_name} was successfully created.\" }\n format.json { render :show, status: :created, location: resource }\n else\n format.html { render :new }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n @resource.status = User.find_by_id(session[:user_id]) ? \"reviewed\" : \"draft\"\n\n respond_to do |format|\n if @resource.save\n if User.find_by_id(session[:user_id])\n flash[:notice] = 'Resource was successfully created.'\n else\n notify_resource_added(@resource, request)\n flash[:notice] = 'Thank you for adding the resource. It will appear in the resource list after we have reviewed it.'\n end\n format.html { redirect_to(@resource) }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n resource = build_resource({})\n respond_with resource\n end", "def new\n @resource = Resource.new\n end", "def create\n respond_to do |format|\n if @resource.save\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_resource_response(resource)\n respond_to do |format|\n if resource.save\n format.html { redirect_to resource, notice: \"#{resource.class.name.titlecase} was successfully created.\" }\n format.json { render action: 'show', status: :created, location: resource }\n else\n resource_response_error(resource, :new, format)\n end\n end\n end", "def create\n authorize! :create, resource\n current_model_service.create resource, params\n yield if block_given? # after_create\n respond_with resource, location: helpers.show_path(resource)\n end", "def create\n @item = @resource.new(params[@object_name])\n\n set_attributes_on_create\n\n respond_to do |format|\n if @item.save\n format.html do\n params[:resource] ? create_with_back_to : redirect_on_success\n end\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 create\n @resource = Resource.new(params[:resource])\n respond_to do |format|\n if @resource.save\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n get_resource_types\n format.html { render action: :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def create\n params[:id] = resource.id if resource.save\n respond_with resource\n end", "def new_resource\n controller_class.new(new_resource_params)\n end", "def create\n @resource = Resource.new(params[:resource])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, :notice => 'Resource was successfully created.' }\n format.json { render :json => @resource, :status => :created, :location => @resource }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n set_resource model_class.unscoped.new\n respond_with resource\n end", "def create\n add_breadcrumb I18n.t('integral.navigation.create')\n @resource = resource_klass.new(resource_params)\n\n yield if block_given?\n\n if @resource.save\n respond_successfully(notification_message('creation_success'), edit_backend_resource_url(@resource))\n else\n respond_failure(notification_message('creation_failure'), :new)\n end\n end", "def create\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: \"Event was successfully created.\" }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_resource = AdminResource.new(admin_resource_params)\n\n respond_to do |format|\n if @admin_resource.save\n format.html { redirect_to @admin_resource, notice: 'Admin resource was successfully created.' }\n format.json { render :show, status: :created, location: @admin_resource }\n else\n format.html { render :new }\n format.json { render json: @admin_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_submit\n # Checks for parameters to see if Resource has been submitted\n unless params[:name] == nil\n unless Resource.where(:name => params[:name], :address => params[:address], :town => params[:city], :zip_code => params[:zip], :county_id => params[:post][:county_id], :phone => params[:phone], :category_id => params[:post][:category_id]).blank?\n flash.alert = 'Duplicate entry!'\n else\n @resource = Resource.create(:name=> params[:name], :address => params[:address], :town => params[:city], :zip_code => params[:zip], :county_id => params[:post][:county_id], :phone => params[:phone], :category_id => params[:post][:category_id])\n if @resource.save\n # redirect_to root_path, notice: 'Resource added!'\n flash.notice = 'Resource added!'\n else\n # redirect_to root_path, alert: 'Could not save resource.'\n flash.alert = 'Could not save resource.'\n end\n end\n end\n # Refreshes the page as this was a huge problem, code used from: https://stackoverflow.com/questions/7465259/how-can-i-reload-the-current-page-in-ruby-on-rails\n respond_to do |format|\n format.js {render inline: \"location.reload();\"}\n end\n end", "def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def create_action\n if has_errors?\n render :new, options\n else\n redirect_to resource_location\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def create(resource, format=@default_format)\n options = { resource: resource.class, format: format }\n reply = post resource_url(options), resource, fhir_headers(options)\n if [200,201].include? reply.code\n type = reply.response[:headers][:content_type]\n if !type.nil?\n if type.include?('xml') && !reply.body.empty?\n reply.resource = resource.class.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n reply.resource = resource.class.from_fhir_json(reply.body)\n else\n reply.resource = resource # just send back the submitted resource\n end\n else\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n reply.resource = resource # just send back the submitted resource\n end\n reply.resource_class = resource.class\n reply\n end", "def create\n if @current_user\n @resource = Resource.create(resource_params)\n render json: @resource, status: 200\n else\n render json: {}, status: 401\n end \n end", "def create\n super do |format|\n redirect_to collection_url and return if resource.valid?\n end\n end", "def create\n super do |format|\n redirect_to collection_url and return if resource.valid?\n end\n end", "def create\n super do |format|\n redirect_to collection_url and return if resource.valid?\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def create\n\t\t@resource_type = ResourceType.new(resource_type_params)\n\n\t\tif @resource_type.save\n\t\t\trender \"show\", :status => :created\n\t\telse\n\t\t\tinvalid_response(@resource_type)\n\t\tend\t\t\n\tend", "def create\n @resources_data = ResourcesData.new(params[:resources_data])\n\n respond_to do |format|\n if @resources_data.save\n format.html { redirect_to(@resources_data, :notice => 'ResourcesData was successfully created.') }\n format.xml { render :xml => @resources_data, :status => :created, :location => @resources_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resources_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @temp_resource = TempResource.new(temp_resource_params)\n\n respond_to do |format|\n if @temp_resource.save\n format.html { redirect_to @temp_resource, notice: 'Temp resource was successfully created.' }\n format.json { render :show, status: :created, location: @temp_resource }\n else\n format.html { render :new }\n format.json { render json: @temp_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end", "def post\n resource.post(request, response)\n end", "def create\n @challenge = Challenge.find(params[:challenge_id])\n @resource = @challenge.resources.build(resource_params)\n respond_to do |format|\n if @resource.save\n format.html { redirect_to challenge_resources_path(@challenge.id), notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n build_resource({})\r\n resource.build_patient\r\n set_minimum_password_length\r\n yield resource if block_given?\r\n respond_with self.resource\r\n end", "def create\r\n super do |format|\r\n redirect_to collection_url and return if resource.valid?\r\n end\r\n end", "def create\r\n super do |format|\r\n redirect_to collection_url and return if resource.valid?\r\n end\r\n end", "def create\r\n super do |format|\r\n redirect_to collection_url and return if resource.valid?\r\n end\r\n end", "def create\r\n super do |format|\r\n redirect_to collection_url and return if resource.valid?\r\n end\r\n end", "def create\n if params[:publisher][:resource_name]\n params[:resource_name] = params[:publisher].delete(:resource_name)\n end\n @publisher = Publisher.new(params[:publisher])\n if (params[:resource_name]) #HTML form\n @publisher.resource = Resource.find_by_name(params[:resource_name])\n end\n \n respond_to do |format|\n if @publisher.save\n format.html { redirect_to @publisher, :notice => 'Publisher was successfully created.' }\n format.json { render :json => @publisher, :status => :created, :location => @publisher }\n format.xml { render :xml => @publisher, :status => :created, :location => @publisher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @publisher.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n add_breadcrumb I18n.t('integral.navigation.create'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new(resource_params)\n\n yield if block_given?\n\n if @resource.save\n respond_successfully(notification_message('creation_success'), send(\"edit_backend_#{controller_name.singularize}_path\", @resource.id))\n else\n respond_failure(notification_message('creation_failure'), :new)\n end\n end", "def create\n build_resource(sign_up_params)\n\n resource.save\n render_resource(resource)\n end", "def create\n @resource_file = ResourceFile.new(params[:resource_file])\n\n respond_to do |format|\n if @resource_file.save\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully created.' }\n format.json { render json: @resource_file, status: :created, location: @resource_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n build_resource\n yield resource if block_given?\n respond_with resource\n end", "def create\n @resource_item = ResourceItem.new(resource_item_params)\n\n respond_to do |format|\n if @resource_item.save\n format.html { redirect_to @resource_item, notice: '资源添加成功.' }\n format.json { render action: 'show', status: :created, location: @resource_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @resource_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(resource_params)\n subject = Subject.find(params[:resource][:subject])\n @resource.subject = subject\n @resource.user_id = current_user.id\n if @resource.save\n flash[:success] = \"Successfully created resource\"\n subject.resource_count = subject.resource_count + 1\n subject.save\n redirect_to subject_url(subject)\n else\n flash[:danger] = \"Failed to create resource\"\n redirect_to new_resource_url\n end\n end", "def create\n @resource = Resource.new(resource_params)\n subject = Subject.find(params[:resource][:subject])\n @resource.subject = subject\n @resource.user_id = current_user.id\n if @resource.save\n flash[:success] = \"Successfully created resource\"\n subject.resource_count = subject.resource_count + 1\n subject.save\n redirect_to subject_url(subject)\n else\n flash[:danger] = \"Failed to create resource\"\n redirect_to new_resource_url\n end\n end", "def render_create_success\n render json: @resource, status: :created\n end", "def create\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n status_bad_request && return if contents.nil? || !contents.valid?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n # Construct a Sara Alert Patient\n resource = Patient.new(Patient.from_fhir(contents))\n\n # Responder is self\n resource.responder = resource\n\n # Creator is authenticated user\n resource.creator = current_resource_owner\n\n # Jurisdiction is the authenticated user's jurisdiction\n resource.jurisdiction = current_resource_owner.jurisdiction\n\n # Generate a submission token for the new monitoree\n resource.submission_token = SecureRandom.hex(20) # 160 bits\n end\n\n status_bad_request && return if resource.nil?\n\n status_bad_request && return unless resource.save\n\n if resource_type == 'patient'\n # Send enrollment notification\n resource.send_enrollment_notification\n\n # Create a history for the enrollment\n History.enrollment(patient: resource, created_by: current_resource_owner.email, comment: 'User enrolled monitoree via API.')\n end\n status_created(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end", "def create\n @projectresource = Projectresource.new(params[:projectresource])\n\n respond_to do |format|\n if @projectresource.save\n format.html { redirect_to @projectresource, notice: 'Projectresource was successfully created.' }\n format.json { render json: @projectresource, status: :created, location: @projectresource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projectresource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n event = Connection::Events::Create.from_jsonapi(params, self)\n result = event.handle\n render_resource_created_event result[:validation], result[:result]\n end", "def new\n self.resource = resource_class.new\n @resource = self.resource\n respond_to do |format|\n format.html\n format.js\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n if current_user\n @resource.resourceable_type = current_user.class.name\n @resource.resourceable_id = current_user.id\n else\n @resource.resourceable_type = current_instructor.class.name\n @resource.resourceable_id = current_instructor.id\n end\n \n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mostsmallresource = Mostsmallresource.new(params[:mostsmallresource])\n\n respond_to do |format|\n if @mostsmallresource.save\n format.html { redirect_to @mostsmallresource, notice: 'Mostsmallresource was successfully created.' }\n format.json { render json: @mostsmallresource, status: :created, location: @mostsmallresource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallresource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(context)\n context.request.body.rewind # in case someone already read it\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n begin\n instance_variable_set(:\"@#{resource_name}\", resource_name.classify.constantize.new(permitted_params))\n\n if instance_variable_get(:\"@#{resource_name}\").save\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end", "def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end", "def create_resource object\n object.save\n end", "def create\n @link_resource = LinkResource.new(link_resource_params)\n\n respond_to do |format|\n if @link_resource.save\n format.html { redirect_to @lab, notice: 'Link resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource_file = ResourceFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_file }\n end\n end", "def create\n Neo4j::Transaction.run do\n @q_resource = QResource.new(params[:q_resource])\n @q_resource.save!\n respond_to do |format|\n if @q_resource.save\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully created.' }\n format.json { render :json => @q_resource, :status => :created, :location => @q_resource }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to polymorphic_path(complex_namespace_helper + [@resource]), notice: \"#{@resource_class} was successfully created.\" }\n format.json { render action: 'show', status: :created, location: @resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n authorize! :new, resource\n yield if block_given? # after_new\n respond_with resource\n end", "def create\n @therm_resource = ThermResource.new(therm_resource_params)\n\n respond_to do |format|\n if @therm_resource.save\n format.html { redirect_to @therm_resource, notice: 'Therm resource was successfully created.' }\n format.json { render :show, status: :created, location: @therm_resource }\n else\n format.html { render :new }\n format.json { render json: @therm_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Resource.new(params[:resource])\n @terms = Term.all_iit_subjects\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_resource = Api::V1::Resource.new(api_v1_resource_params)\n\n respond_to do |format|\n if @api_v1_resource.save\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_resource }\n else\n format.html { render :new }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_post()\n make_response(201, \"New resource created\")\nend", "def create\n @resource = @project.resources.new(resource_params)\n \n respond_to do |format|\n if @resource.save\n format.json {render json: @resource.to_json(only: :id), status: :created, location: [@project, @resource]}\n else\n format.json {render json: @resource.errors, status: :unprocessable_entity}\n end\n format.js\n end\n\n end", "def create_resource(new_resource, attributes)\n new_resource.attributes = attributes\n new_resource.save\n new_resource\n end", "def create\n @chef_resource = ChefResource.new(chef_resource_params)\n\n respond_to do |format|\n if @chef_resource.save\n format.html { redirect_to @chef_resource, notice: 'Chef resource was successfully created.' }\n format.json { render :show, status: :created, location: @chef_resource }\n else\n format.html { render :new }\n format.json { render json: @chef_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource_view = ResourceView.new(params[:resource_view])\n\n respond_to do |format|\n if @resource_view.save\n format.html { redirect_to new_resource_view_path(:current_part_id => @resource_view.part_id), notice: 'Resource view was successfully created.' }\n format.json { render json: @resource_view, status: :created, location: @resource_view }\n else\n format.html { redirect_to new_resource_view_path(:current_part_id => @resource_view.part_id), notice: \"Didn't work!!! Did you enter in a URL?\" }\n format.json { render json: @resource_view.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #init object with params from form\n @record = Record.new(record_params)\n if @record.save\n redirect_to(records_path) #redirect back to index\n else\n render('new') #renders the form template for resubmission\n end\n end", "def create\n __log_activity\n __debug_route\n @item = create_record(no_raise: true)\n errors = @item&.errors || 'Not created' # TODO: I18n\n user_authorize!\n respond_to do |format|\n if errors.blank?\n format.html { redirect_success(__method__) }\n format.json { render :show, location: @item, status: :created }\n else\n format.html { redirect_failure(__method__, error: errors) }\n format.json { render json: errors, status: :unprocessable_entity }\n end\n end\n rescue Record::SubmitError => error\n post_response(:conflict, error)\n rescue => error\n post_response(error)\n end", "def new\n build_resource\n yield resource if block_given?\n end" ]
[ "0.8001278", "0.7871537", "0.77772963", "0.77472854", "0.7677641", "0.751872", "0.7480964", "0.74090236", "0.7389203", "0.73819405", "0.73690444", "0.7322071", "0.7269238", "0.72418463", "0.72392714", "0.722324", "0.71908724", "0.71668154", "0.7114352", "0.70960605", "0.70873374", "0.70873374", "0.70873374", "0.7081818", "0.7074459", "0.70663905", "0.7057811", "0.70574737", "0.704484", "0.7028995", "0.6977204", "0.6966645", "0.69515425", "0.69454575", "0.693511", "0.69106203", "0.6902403", "0.6896249", "0.6896249", "0.68957853", "0.6890202", "0.6855709", "0.6853612", "0.6837963", "0.68041986", "0.67942286", "0.6787442", "0.6739909", "0.6733907", "0.6729772", "0.67238224", "0.6722582", "0.67185265", "0.67185265", "0.67185265", "0.67159027", "0.6712586", "0.67044973", "0.66860896", "0.66707814", "0.66601527", "0.66529727", "0.6647494", "0.66430515", "0.66430515", "0.66430515", "0.66430515", "0.6639949", "0.6636394", "0.6633458", "0.65658754", "0.65605783", "0.6559774", "0.6553259", "0.6553259", "0.6523027", "0.6521642", "0.65197515", "0.6519721", "0.651888", "0.6510927", "0.6499133", "0.64986545", "0.6496725", "0.6489452", "0.64871836", "0.6482912", "0.6481492", "0.6458898", "0.64567393", "0.64107996", "0.6408453", "0.6389372", "0.6387463", "0.6383103", "0.6382122", "0.6373948", "0.6364199", "0.63633215", "0.6353419", "0.63454473" ]
0.0
-1
GET /resource/:id Shows the details of a given resource.
def show instance_exec(&resource.before_actions[:show]) if resource.before_actions[:show] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @resource = Resource.find(params[:id])\n end", "def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def get(resource, id)\n Api.new.get(resource, id)\n end", "def show\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def show\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_info }\n end\n end", "def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end", "def show\n @resource = Resource.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html{}\n end\n\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def resource\n resource_model.find(params[:id])\n end", "def get_details(resource, id, **params)\n ops_hash = {\n id: id\n }\n ops_hash.merge! params\n resp = _make_request(resource, ops_hash)\n ComicVine::Resource.create_resource(resp['results'])\n end", "def show\n @resource = find_resource\n end", "def show\n @resource_view = ResourceView.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_view }\n end\n end", "def show\n begin\n @resource = Entity.find params[:id]\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def detail(resource_id)\n @do_resource_mixin.detail(resource_id)\n end", "def show\n render json: serialize(read_resource(resource), options), status: :ok\n end", "def show\n resource = find_resource(params[:id])\n\n respond_with(resource)\n rescue ApiError => e\n render e.as_response\n end", "def show\n respond_with resource\n end", "def get_resource\n execute(resource_path, method: :get)\n end", "def resource(path, params={})\n r = Resource.process_detailed(self, *do_get(path, params))\n\n # note that process_detailed will make a best-effort to return an already\n # detailed resource or array of detailed resources but there may still be\n # legacy cases where #show is still needed. calling #show on an already\n # detailed resource is a no-op.\n r.respond_to?(:show) ? r.show : r\n end", "def show\n @user_resource = UserResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_resource }\n end\n end", "def show\n begin\n @resource = Account.find(params[:id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def detail_url(resource_id)\n \"#{@path}#{resource_id}/\"\n end", "def find_resource\n @resource = resource_class.find(params[:id])\n end", "def show(id, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/#{id}\")\n end", "def show(id, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/#{id}\")\n end", "def show\n @q_resource = QResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @q_resource }\n end\n end", "def show\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_file }\n end\n end", "def show\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def get_resource(id)\n raise 'To be implemented in child classes'\n end", "def get(id)\n Basuco::Resource.get(id)\n end", "def find_resource\n get params[:resource_path]\n end", "def show\n respond_with client, resource\n end", "def show\n account = resource\n if params[:id].present?\n account = User.find_by_id(params[:id])\n end\n render json: account, status: 200\n end", "def show(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :get)\n end", "def show\n respond_with resource\n end", "def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend", "def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def show\n @resource = @lode.resource\n end", "def show\n @id = params[:id]\n @resource = ActiveFedora::Base.find(@id)\n\n raise ActiveFedora::ObjectNotFoundError if not @resource\n\n authorize! :edit, @resource\n\n raise \"Resource doesn't support DOI functionality\" if not @resource.respond_to? :doi\n\n @metadata_errors = @resource.validate_doi_metadata\n\n if @resource.is_a? Collection\n @presenter = Sufia::CollectionPresenter.new @resource\n @model_class = \"collection\"\n else\n @presenter = Sufia::GenericFilePresenter.new @resource\n @model_class = \"generic_file\"\n end\n end", "def show\n @resources_data = ResourcesData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resources_data }\n end\n end", "def find_resource(resource_id)\n query_service.find_by(id: Valkyrie::ID.new(resource_id))\n end", "def get(resource, options = nil)\n params = options\n url = \"/#{resource}\"\n get_response(url, params)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def show\n respond_with Recipe.find(params[\"id\"])\n end", "def fetch(resource,identifier,params={})\n uri = '/api/' + resource.to_s + '/' + identifier\n http_get(uri,params)\n end", "def show\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectresource }\n end\n end", "def [](resource_id, options = {})\n response = client.get(\"#{base_uri}/#{resource_id}\", options)\n if response.success?\n object_class.new(response.body, client)\n else\n raise Kippt::APIError.new(\"Resource could not be loaded: #{response.body[\"message\"]}\")\n end\n end", "def show\n @id = Id.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @id }\n end\n end", "def get(resource, **params)\n\n execute(Net::HTTP::Get, 'GET', resource, **params)\n\n end", "def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def get(resource_id)\n url = build_url(resource_id)\n response = rest_get(url)\n Diagnostic.new(JSON.parse(response))\n end", "def show_resource(resource, opts)\n debug \"i m in show resource\"\n unless about = opts[:req].path\n throw \"Missing 'path' declaration in request\"\n end\n path = opts[:path] || about\n\n case opts[:format]\n when 'xml'\n show_resources_xml(resource, path, opts)\n when 'ttl'\n self.class.omn_response_json(resource, opts)\n else\n show_resources_json(resource, path, opts)\n end\n end", "def show(context)\n set_resource(context)\n\n instance_variable_get(:\"@#{resource_name}\").to_json\n end", "def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def get(resource)\n puts construct_url(@mode, resource)\n @agent.get construct_url(@mode, resource)\n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def resource\n instance_variable_get(resource_name) || params[:id] && set_resource(controller_model.find(params[:id]))\n end", "def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end", "def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end", "def show\n render json: Record.find(params[\"id\"])\n end", "def find(id)\n code, data = @session.get(element_path(id) + '.json')\n if code == 200\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session =>@session))\n elsif code == 404\n raise ResourceNotFound\n end\n end", "def get(id)\n @service.get(id)\n end", "def show\n @permission_resource = PermissionResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission_resource }\n end\n end", "def method_missing(id, *args, &block)\n # Figure out what kind of resource we're trying to get.\n klass = Scrumy::Models.const_get(id.to_s.capitalize.singularize)\n # Special case for handling id=:current - this really only applies to Sprint resources\n # but if other resources specified the `current` sub-resources then it should still work.\n if klass.current_url and args.first==:current\n @url = format(klass.current_url, :current)\n else\n # TODO\n # Figure out a better way of determining if the resource is singular or plural\n \n # The only argument that resources ever take is an ID, so pass the first arg as the ID.\n @url = format((id.to_s =~ /s$/ ? klass.list_url : klass.show_url), args.first)\n end\n\n # Here we request the resource using the singular of the resource name as the root\n # to extract from the returned JSON hash.\n response = get(@url, id.to_s.singularize)\n \n # Responses are of two types, either arrays of hashes or a single hash\n if response.kind_of? Array\n # If it's array collect a new array by constructing objects based on the resource\n # name capitalized and singularized.\n response.collect do |obj| \n klass.new(obj, self)\n end\n else\n # Otherwise create a single new object of the correct type.\n klass.new(response, self)\n end\n end", "def show\n @stock_resource = StockResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_resource }\n end\n end", "def find_resource\n if !params[:format].nil? && params[:format] == \"json\"\n begin\n p \"i came in\"\n p params[:id]\n Product.find_by_id(params[:id])\n rescue Exception => e\n error = error_response_method($e2)\n render :json => error\n end\n else\n Product.find_by_permalink!(params[:id])\n end\n end", "def get(project_id, id, options)\n @_client.get(\"#{resource_root(project_id)}/#{id}\", options)\n end", "def show(options = {}, &block)\n object = get_resource_ivar || find_resource\n\n respond_with(object, options, &block) if stale?(object)\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def show\n Rails.logger.debug \"======== Enter RecordsController::show ========\"\n\n # Each of these calls to get resources can result in a redirection for \n # authorization. Don't continue if we redirect - we'll get called again \n # later after authorization is complete.\n\n query = \"?patient=\" + params[:id]\n\n success = get_resource(\"patient/@\" + params[:id])\n\n success &&= get_resource(\"condition\" + query) if success\n success &&= get_resource(\"medication\" + query) if success\n success &&= get_resource(\"encounter\" + query) if success\n success &&= get_resource(\"observation\" + query) if success\n end", "def show\n @resource_fields = Field.where(\"resource_type_id = ?\", params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_type }\n end\n end", "def resource\n @resource\n end", "def resource\n @resource\n end", "def show\n @title = \"Show Resources Periods\"\n @resource_period = ResourcePeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def show\n @breadcrumb = 'read'\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def resource\n @resource\n end", "def ar_retrieve_resource(opts = {})\n @resource_relation ||= ar_model\n @resource_relation = ar_model.includes(ar_model.interfaces[:rest].eager_loading_hints(:view => ar_view)) if ar_model\n\n run_callbacks :ar_retrieve_resource do\n tid = opts[:id] || params[:id]\n opts.delete(:id)\n\n @resource = @resource_relation.find(tid)\n end\n\n #ar_authorize_action if !opts[:skip_authorization]\n\n @resource\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end", "def desc\n @desc ||= \"Get #{this_resource.downcase} by ID\"\n end", "def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end", "def read(resource_type, id)\n unless RESOURCES.include?(resource_type)\n raise Common::Exceptions::InvalidFieldValue.new('resource_type', resource_type)\n end\n\n perform(:get, \"#{resource_type}/#{id}\", nil)\n end", "def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end", "def show\n begin\n @resource = get_relation(params[:id], params[:entity_id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => @error\n end\n \n \n\n end", "def find_resource\n set_resource_ivar class_name.find(params[:id])\n end", "def url\n \"/#{self.class.rest_name}s/#{id}\"\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 get_resource(resource_id, opts = {})\n get_resource_with_http_info(resource_id, opts)\n nil\n end", "def show\n @rest_object = RestObject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @rest_object }\n end\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def show\n @data_dictionary_field = find_resource(params[:id])\n end", "def show\n\t\t\"I'd love to show you object with id: #{params[:id]}\"\n\tend", "def resource\n get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_find, params[:id]))\n end", "def show\n @child_resource = ChildResource.find(params[:id])\n # require view permissions on this object\n require_privilege(Alberich::Privilege::VIEW, @child_resource)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child_resource }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n @resource.campaign_id = session[:campaign_id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @resource }\n end\n end" ]
[ "0.8344011", "0.8089747", "0.7892635", "0.7892635", "0.7863478", "0.7803588", "0.77688307", "0.7751274", "0.77166134", "0.7705468", "0.75930876", "0.75930876", "0.75930876", "0.75930876", "0.7563204", "0.75505793", "0.74804467", "0.73774374", "0.73635393", "0.7337798", "0.7213843", "0.71755534", "0.71520364", "0.7135237", "0.7109474", "0.705574", "0.70284724", "0.7016277", "0.70045114", "0.697447", "0.697447", "0.6934195", "0.69278514", "0.6923195", "0.6895371", "0.6891994", "0.6866197", "0.68457466", "0.68347454", "0.68324524", "0.67477614", "0.6742738", "0.6722412", "0.6718488", "0.6709414", "0.6684144", "0.66836333", "0.66683364", "0.66660684", "0.6665317", "0.66444", "0.66270673", "0.6626644", "0.6625233", "0.6625134", "0.6621582", "0.6619754", "0.66173947", "0.6593464", "0.6591499", "0.6590455", "0.65799206", "0.6578142", "0.6574214", "0.65738213", "0.65722966", "0.65262145", "0.6506799", "0.65011585", "0.65003633", "0.64948756", "0.6485147", "0.6474279", "0.6470065", "0.6451513", "0.6437719", "0.64350283", "0.642058", "0.64140177", "0.64140177", "0.64016944", "0.6398656", "0.6389962", "0.6387046", "0.638587", "0.63844603", "0.6375728", "0.636408", "0.63633806", "0.6356337", "0.63551164", "0.6350796", "0.6346015", "0.63449234", "0.63426083", "0.63369477", "0.63326275", "0.6328371", "0.6320795", "0.63169336", "0.6310574" ]
0.0
-1
GET /resource/:id/edit Shows the edit form for a given resource.
def edit resource.before_actions[:edit].call(@record) if resource.before_actions[:edit] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n respond_with(resource)\n end", "def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def edit\n @resource = Admin.find(params[:id])\n end", "def edit\n # Renders the edit form\n end", "def edit(options = {}, &block)\n object = get_resource_ivar || find_resource\n\n respond_with(object, options, &block)\n end", "def edit\n authorize! :edit, resource\n yield if block_given? # after_edit\n respond_with resource\n end", "def edit\n new\n end", "def edit\n @user = User.find(params[:id])\n # just show me the form\nend", "def edit_resource_path(*args)\n options = args.extract_options!\n options.merge! :action => :edit\n\n super_path(with_chain(args.first || resource), options)\n end", "def edit\n\n end", "def edit\n add_breadcrumb I18n.t('integral.actions.view'), backend_resource_url(@resource)\n add_breadcrumb I18n.t('integral.actions.edit')\n end", "def edit\n @employee = Employee.find(params[:id])\n end", "def edit\n @record = Record.find(params[:id])\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit\n\n end", "def edit\n @person = Person.find(params[:id])\n end", "def edit\n @person = Person.find(params[:id])\n end", "def edit\n @person = Person.find(params[:id])\n end", "def edit\r\n render :edit\r\n end", "def edit\n @question = Question.find(params[:id])\n end", "def edit\n @question = Question.find(params[:id])\n end", "def edit\n render action: 'new'\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n @employee = Employee.find(params[:id])\n @url = { controller: '/employees', action: :update }\n render :form\n end", "def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end", "def edit\n\t @task = Task.find(params[:id])\n\t authorize! :edit, @task\n\t render :show_form\n\tend", "def edit(params = {})\n http_helper.send_post_request(\"#{@url_prefix}/edit\", params)\n end", "def edit # Showing edit form\n @post = Post.find(params[:id])\n end", "def edit\n @contact = Contact.find(params[:id])\n end", "def edit\r\n end", "def edit\n respond_to do |format|\n format.html # edit.html.erb\n end\n end", "def link_to_edit(resource, options = {})\n name = (\"<i class='icon-white icon-edit'></i>\").html_safe\n attributes = {\n :class => \"mr-xs btn btn-mini btn-inverse edit-link\",\n }.merge(options)\n link_to name, resource, attributes\n end", "def edit(id)\n @post = flash[:form_data] || Post[id]\n\n # Make sure the post is valid\n if @post.nil?\n flash[:error] = 'The specified post is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@post.title}\"\n\n render_view(:form)\n end", "def edit\n render partial: \"form\"\n end", "def edit\n @user = User.find(params[:id])\n\t case params[:form]\n\t when \"email\"\n\t render 'email'\n\t when \"password\"\n\t render 'password'\n\t else\n\t render :action => :edit\n\t end\n\tend", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end" ]
[ "0.81530017", "0.80632085", "0.7988659", "0.76717377", "0.7587856", "0.74893147", "0.734522", "0.73220915", "0.70905155", "0.7080319", "0.7054478", "0.7025939", "0.70181113", "0.7002776", "0.6987925", "0.6958665", "0.6958578", "0.6944532", "0.6944532", "0.6944532", "0.6943242", "0.6925256", "0.6925256", "0.69104075", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6896308", "0.6884525", "0.6874743", "0.6871857", "0.68584114", "0.6854274", "0.68422335", "0.6842192", "0.68357986", "0.6835194", "0.6828786", "0.6828591", "0.68248844", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076", "0.682076" ]
0.7123236
8
PATCH /resource/:id Updates a given resource if valid, renders the edit form if not.
def update flash[:success] = "Record updated successfully." # call before actions created in the DSL if resource.before_actions[:update] resource.before_actions[:update].call(@record) end if @record.update(record_params) redirect_to polymorphic_path([app_kit, @record]) else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully updated.') }\n format.xml { head :ok }\n else\n get_resource_info\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n redirect_to @resource\n else\n render :action => \"edit\"\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:success] = 'Resource was successfully updated.'\n format.html { redirect_to admin_resource_path(@resource.id) }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end", "def update\n if @resource.update(resource_params)\n flash[:notice] = notification_message('edit_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('edit_failure') }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if instance_variable_get(resource).update(resource_params)\n format.html { redirect_to action: :index, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: resource_location }\n after_update\n else\n format.html { render :edit }\n format.json do\n render json: instance_variable_get(resource).errors.as_json(full_messages: true),\n status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html {\n if request.xhr?\n render :text => params[:resource].values.first\n else\n redirect_to(@resource, :notice => 'Resource was successfully updated.')\n end\n }\n format.xml { head :ok }\n else\n format.html {\n if request.xhr?\n render :text => @resource[params[:resource].keys.first]\n else\n render :action => \"edit\"\n end\n }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n @resource.saved_by(current_admin)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if resource.update(params_for_update)\n format.html { redirect_to resource, notice: \"#{resource_class_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: resource }\n else\n format.html { render :edit }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :index, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end", "def edit\n respond_with(resource)\n end", "def update\n @resource_info = ResourceInfo.find(params[:id])\n\n respond_to do |format|\n if @resource_info.update_attributes(params[:resource_info])\n format.html { redirect_to @resource_info, notice: 'Resource info was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! params[:entity]\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update\n if @resource.update(resource_params)\n respond_successfully(notification_message('edit_success'), send(\"edit_backend_#{controller_name.singularize}_path\", @resource.id))\n else\n respond_failure(notification_message('edit_failure'), :edit)\n end\n end", "def update\n if @resource.update(resource_params)\n respond_successfully(notification_message('edit_success'), send(\"edit_backend_#{controller_name.singularize}_path\", @resource.id))\n else\n respond_failure(notification_message('edit_failure'), :edit)\n end\n end", "def update\n updated_resource = update_resource(resource, resource_params)\n if updated_resource.errors.blank?\n head :no_content\n else\n render json: serialize_invalid_attributes(updated_resource.errors),\n status: :unprocessable_entity\n end\n end", "def update\n self.resource = find_resource\n \n respond_to do |format|\n if resource.update_attributes(params[resource_name])\n format.html do\n flash[:notice] = \"#{resource_name.humanize} was successfully updated.\"\n redirect_to challenge_attempt_path(resource.challenge, resource)\n end\n format.js\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource = Event.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(resource_params)\n format.html { redirect_to @resource, notice: \"Event was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource.host, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource.host }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:id])\n\n respond_to do |format|\n if @form.update_attributes(params[:form])\n format.html { redirect_to @form, notice: 'Form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:id])\n\n respond_to do |format|\n if @form.update_attributes(params[:form])\n format.html { redirect_to @form, notice: 'Form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n if @resource_file.update_attributes(params[:resource_file])\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to [@project, @resource], notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end", "def update\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n flash[:notice] = 'Entry was successfully updated.'\n format.html { redirect_to_resource }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_action\n if has_errors?\n render :edit, options\n else\n redirect_to resource_location\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, resource\n current_model_service.update resource, params\n yield if block_given? # after_update\n respond_with resource, location: helpers.show_path(resource)\n end", "def update\n @resource_view = ResourceView.find(params[:id])\n\n respond_to do |format|\n if @resource_view.update_attributes(params[:resource_view])\n format.html { redirect_to new_resource_view_path(:current_part_id => @resource_view.part_id), notice: 'Resource view was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_view.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to referential_resource_path(@referential, @resource), notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to polymorphic_path(complex_namespace_helper + [@resource]), notice: \"#{@resource_class} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @resource.update_attributes(safe_parameters)\n redirect_to(action: :index, notice: l(\"#{snake_case_model_name}_edit_success_message\"))\n else\n render action: 'edit'\n end\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n authorize! :edit, resource\n yield if block_given? # after_edit\n respond_with resource\n end", "def update\n @resources_data = ResourcesData.find(params[:id])\n\n respond_to do |format|\n if @resources_data.update_attributes(params[:resources_data])\n format.html { redirect_to(@resources_data, :notice => 'ResourcesData was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resources_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reel = Reel.find(params[:id])\n\n respond_to do |format|\n if @reel.update_attributes(params[:reel])\n format.html { redirect_to @reel, notice: 'Reel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reel.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @asset = Resource.find(params[:id])\n if @asset.update(resource_params)\n redirect_to admin_resource_path(@asset), notice: 'Resource was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def update\n @update = Update.find(params[:id])\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @update, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @id.update(id_params)\n format.html { redirect_to @id, notice: 'Id was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @id.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @id = Id.find(params[:id])\n\n respond_to do |format|\n if @id.update_attributes(params[:id])\n format.html { redirect_to @id, :notice => 'Id was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @id.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @update = Update.find(params[:id])\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @update, :notice => 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @update.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.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 @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(resource, id, format = nil)\n base_update(resource, id, nil, format)\n end", "def update\n @contact = Contact.find(params[:id])\n \n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to(@resource, :notice => 'Contact was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @update = Update.find(params[:id])\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to updates_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_resource.update(admin_resource_params)\n format.html { redirect_to @admin_resource, notice: 'Admin resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_resource }\n else\n format.html { render :edit }\n format.json { render json: @admin_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @foo = Foo.find(params[:id])\n\n respond_to do |format|\n if @foo.update_attributes(params[:foo])\n format.html { redirect_to @foo, notice: 'Foo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @foobar = Foobar.find(params[:id])\n\n respond_to do |format|\n if @foobar.update_attributes(params[:foobar])\n format.html { redirect_to @foobar, notice: 'Foobar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foobar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @edit.update(edit_params)\n format.html { redirect_to @edit, notice: 'Edit was successfully updated.' }\n format.json { render :show, status: :ok, location: @edit }\n else\n format.html { render :edit }\n format.json { render json: @edit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resources_table = ResourcesTable.find(params[:resources_table_id])\n @resources_field = ResourcesField.find(params[:id])\n\n respond_to do |format|\n if @resources_field.update_attributes(params[:resources_field])\n format.html { redirect_to(@resources_table, :notice => 'ResourcesField was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resources_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n get_resource_types\n format.html { render action: :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_resource = UserResource.find(params[:id])\n\n respond_to do |format|\n if @user_resource.update_attributes(params[:user_resource])\n format.html { redirect_to user_preferences_path(@user), notice: 'User resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n if @projectresource.update_attributes(params[:projectresource])\n format.html { redirect_to @projectresource, notice: 'Projectresource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @projectresource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n if @remito.update_attributes(params[:remito])\n format.html { redirect_to @remito, notice: 'Remito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @resubmit = Resubmit.find(params[:id])\n\n respond_to do |format|\n if @resubmit.update_attributes(params[:resubmit])\n format.html { redirect_to @resubmit, notice: 'Resubmit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resubmit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reprogramacion = Reprogramacion.find(params[:id])\n\n respond_to do |format|\n if @reprogramacion.update_attributes(params[:reprogramacion])\n format.html { redirect_to @reprogramacion, notice: 'Reprogramacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reprogramacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n if @entity.update_attributes(params[:entity])\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n begin\n @resource = Account.find(params[:id])\n @resource.update_attributes!(params[:account])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n validate_save_and_respond(update_change_set, :edit)\n end", "def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @obj = Obj.find(params[:id])\n\n respond_to do |format|\n if @obj.update_attributes(params[:obj])\n format.html { redirect_to @obj, notice: 'Obj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\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.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit(options = {}, &block)\n object = get_resource_ivar || find_resource\n\n respond_with(object, options, &block)\n end", "def update(resource, id, format=@default_format)\n options = { resource: resource.class, id: id, format: format }\n reply = put resource_url(options), resource, fhir_headers(options)\n reply.resource = parse_reply(resource.class, format, reply)\n reply.resource_class = resource.class\n reply\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\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 @update.update(update_params)\n format.html { redirect_to @update, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\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" ]
[ "0.7944114", "0.7944114", "0.77376175", "0.7732011", "0.7689528", "0.7689528", "0.7688384", "0.7648771", "0.7583841", "0.7541427", "0.75396734", "0.7493346", "0.74921936", "0.74921936", "0.7474121", "0.74263287", "0.73892045", "0.7380047", "0.73798347", "0.73692834", "0.7260091", "0.7174786", "0.7174786", "0.71663755", "0.71520543", "0.7106084", "0.7099419", "0.7098093", "0.7098093", "0.7091181", "0.70863277", "0.7084273", "0.7060738", "0.70478415", "0.70384", "0.69550467", "0.6946475", "0.6940768", "0.69295627", "0.69250286", "0.6915669", "0.69048786", "0.6882073", "0.6861202", "0.6856285", "0.684184", "0.6828181", "0.6826586", "0.68097", "0.6807747", "0.68047315", "0.67934173", "0.67871976", "0.6775199", "0.67498624", "0.67459106", "0.6743854", "0.6737893", "0.67374027", "0.6732305", "0.6726421", "0.67215335", "0.67167485", "0.6713065", "0.67051995", "0.67051995", "0.67051995", "0.66981894", "0.6697782", "0.6692808", "0.66849273", "0.6681792", "0.6681493", "0.6679642", "0.66759044", "0.66583055", "0.66573715", "0.66546", "0.6653572", "0.6651162", "0.6651162", "0.6651162", "0.6650272", "0.66477376", "0.66453695", "0.6641135", "0.66387695", "0.66372126", "0.6634246", "0.6624124", "0.6613909", "0.6613909", "0.6613909", "0.6613909", "0.6613909", "0.6613909", "0.6613909", "0.6613909", "0.661029", "0.6606869", "0.66068006" ]
0.0
-1
DELETE /resource/:id Deletes a given resource and redirects to index.
def destroy if @record.destroy flash[:success] = "Record deleted successfully." redirect_to polymorphic_path([app_kit, model]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n flash[:notice] = 'Resource was successfully deleted.'\n redirect_to resources_url\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n destroy_resource(resource)\n head :no_content\n end", "def delete\n @resource.delete\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n \n respond_to do |format|\n format.html { redirect_to(resources_url) }\n format.xml { head :ok }\n format.js\n end\n end", "def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end", "def delete!\n @resource.delete!\n end", "def destroy\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.destroy\n flash[:success] = 'Resource was removed'\n format.html { redirect_to admin_resources_path }\n format.json { head :ok }\n else\n flash[:error] = @resource.errors.full_messages.join('')\n format.html { redirect_to admin_resources_path(@resource.id) }\n format.json { render json: @resource.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry = @resource_finder.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to_resources }\n format.xml { head :ok }\n end\n end", "def destroy\n @resource_info = ResourceInfo.find(params[:id])\n @resource_info.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_infos_url }\n format.json { head :ok }\n end\n end", "def undestroy\n @resource = resource_proxy(true).find(params[:id])\n set_resource_instance\n\n @resource.deleted_at = nil\n @resource.save\n\n respond_with(@resource, location: { action: :index })\n\n # flash[:notice] = \"#{resource_name} has been undeleted\"\n # redirect_to action: :index\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to resources_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to @resource.host, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_action\n redirect_to resource_location\n end", "def delete(id)\n # The call is wrapped in a begin/rescue block so any errors can be handled\n # properly. Without this the user would bump into a nasty stack trace and\n # probably would have no clue as to what's going on.\n begin\n Post.filter(:id => id).destroy\n flash[:success] = 'The specified post has been removed'\n rescue => e\n Ramaze::Log.error(e.message)\n flash[:error] = 'The specified post could not be removed'\n end\n\n redirect(Posts.r(:index))\n end", "def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end", "def destroy\n authorize! :destroy, resource\n current_model_service.destroy resource, params\n yield if block_given? # after_destroy\n respond_with resource, location: helpers.index_path(current_model_class)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n resource.destroy\n respond_to do |format|\n format.html { redirect_to self.send(\"#{resource_class_name.pluralize.underscore}_url\"), notice: \"#{resource_class_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(resource_id)\n @delete_resource_mixin.delete(resource_id)\n end", "def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end", "def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end", "def delete\n\t\tHra.find(params[:id]).destroy\n\t\tredirect_to :action => 'list'\n\tend", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def delete(resource)\n finder_or_run(:delete, resource)\n end", "def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n\t_destroy( params[:id] )\n\n respond_to do |format|\n format.html { redirect_to({:action=>:index}, notice: t(\"helpers.notice.update\")) }\n end\n end", "def destroy\n @id.destroy\n respond_to do |format|\n format.html { redirect_to ids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to referential_resources_path(@referential), notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n after_destroy if instance_variable_get(resource).destroy\n\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(resource)\n unless id = @mappings[:id][:get].call(resource)\n raise ArgumentError, \"Attempted to delete a record without an ID\"\n end\n\n raw.delete(id)\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_url }\n format.json { head :no_content }\n end\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def destroy\n @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallresource = Mostsmallresource.find(params[:id])\n @mostsmallresource.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallresources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_resource.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @index = Indice.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.deactivate!\n\n respond_to do |format|\n format.html { redirect_to(edit_admin_resource_url(@resource)) }\n format.xml { head :ok }\n end\n end", "def delete\n @record = find_if_allowed(params[:id], :destroy)\n render :action => 'delete'\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @id = Id.find(params[:id])\n @id.destroy\n\n respond_to do |format|\n format.html { redirect_to ids_url }\n format.json { head :ok }\n end\n end", "def destroy\n resource.destroy\n respond_with resource\n end", "def destroy\n resource.destroy\n respond_with resource\n end", "def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end", "def destroy\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy_resource(resource_name, resource_id)\n must_support! resource_name.to_s.pluralize\n result = connection.delete(\n api_uri([resource_name.to_s.pluralize, resource_id].join('/'))\n )\n result.status.is_no_content?\n end", "def destroy\n head :forbidden\n # @action = Action.find(params[:id])\n # @action.destroy\n\n # head :no_content\n end", "def delete(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :delete, resource_path: resource_path, headers: headers, prefix: prefix)\n end", "def destroy\n User.delete(params[:id])\n redirect_to '/users'\nend", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to challenge_resources_url(@resource.challenge_id), notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\t\t\t\"delete called - deleting object #{params[:id]}\"\n\t\tend", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def remove(resource)\n resource.delete\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def destroy\n @resources_data = ResourcesData.find(params[:id])\n @resources_data.destroy\n\n respond_to do |format|\n format.html { redirect_to(resources_datas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to(patients_url) }\n format.xml { head :ok }\n end\n end", "def delete_resource_action(type, id = nil, data = nil)\n api_resource(type, id, \"Detaching\") do |resource|\n delete_resource_main_action(type, resource, data)\n end\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @patient = Patient.find(params[:id])\r\n @patient.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(patients_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to(things_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @permission_resource = PermissionResource.find(params[:id])\n @permission_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to permission_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n head :no_content\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to( :action => 'index' ) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n head :no_content\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @post = Post.find(params[:id]) #get the post from the id\n @post.destroy #removes the post\n\n redirect_to posts_path #returns to the index page, posts_path => index page\n end", "def delete(id)\n call(:delete, path(id))\n end", "def destroy\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to catalogs_locations_url, flash: {warning: t('notices.destroyed') }}\n format.json { head :no_content }\n end\n end", "def delete(id)\n begin\n User.filter(:id => id).destroy\n flash[:success] = 'The specified user has been removed'\n rescue => e\n Ramaze::Log.error(e)\n flash[:error] = 'The specified user could not be removed'\n end\n\n redirect_referrer\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.787997", "0.787997", "0.787997", "0.787997", "0.78293556", "0.7810878", "0.7810878", "0.7810878", "0.77103215", "0.756483", "0.75303745", "0.7520097", "0.7520097", "0.7463083", "0.74271554", "0.7335851", "0.7293264", "0.7270342", "0.7270342", "0.7270342", "0.7270342", "0.7196714", "0.71562934", "0.71544033", "0.7138715", "0.7137411", "0.71172905", "0.709612", "0.7090236", "0.7066892", "0.70631117", "0.70379555", "0.7028446", "0.70130056", "0.6979647", "0.69589007", "0.6939821", "0.6911832", "0.6907454", "0.6895757", "0.68695605", "0.6867241", "0.6861559", "0.6859288", "0.6851489", "0.68480134", "0.6842863", "0.6842863", "0.6827257", "0.6825987", "0.68239224", "0.6823253", "0.6810008", "0.68063635", "0.6767632", "0.6765428", "0.676243", "0.67506295", "0.6747167", "0.6747167", "0.6743856", "0.6734199", "0.67337734", "0.67249453", "0.6706677", "0.67029554", "0.6701909", "0.6700341", "0.669974", "0.66963845", "0.6692933", "0.66879755", "0.6681468", "0.6681468", "0.6681468", "0.6681468", "0.6673761", "0.6673761", "0.6673761", "0.6672793", "0.6665995", "0.66593593", "0.6651158", "0.6643218", "0.6637349", "0.6637349", "0.663477", "0.663477", "0.66322553", "0.66239315", "0.66176933", "0.661607", "0.66095185", "0.6609324", "0.6608695", "0.66066945", "0.6603342", "0.66016024", "0.65962696", "0.65953314", "0.65940744" ]
0.0
-1
GET /resource/:id/:action_name A catchall action for any custom actions defined in the DSL. The action name is passed by the route as a param and a block given in the DSL is called (with the record instance). Actions can be defined using blocks are a symbol name of a method in the model.
def perform_action action_name = params[:action_name].to_sym action = resource.member_actions[action_name] if action.is_method_action? @record.send(action.method_name) end if action.is_block_action? action.block.call(@record) end return redirect_to([app_kit, @record]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action(name, &block)\n action = Moonrope::Action.new(@controller, name)\n action.dsl.instance_eval(&block) if block_given?\n @controller.actions[name] = action\n action\n end", "def action(method, route, &block)\n @actions << [method.to_s, build_route(@with * \"/\" + route), block]\n end", "def action(name, method = nil, &block)\n d = describe \"\\##{name}\" do\n do_action name, method\n end\n\n d.instance_eval(&block)\n d\n end", "def action(&block)\n @action = block\n end", "def action(name, &blk)\n name = name.to_s\n\n klass = Class.new do\n def initialize(action, name)\n @action, @name = action, name\n end\n\n def control_flow(sym, name, mods, options={})\n @action.control_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def data_flow(sym, name, mods, options={})\n @action.data_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def flyweight(sym, name, mods, options={})\n @action.flyweight(sym, name, mods, options.merge({action: @name}))\n end\n\n def action(name, &blk)\n @action.action(\"#{@name}:#{name}\", &blk)\n end\n end\n\n blk.call klass.new(self, name)\n end", "def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end", "def action(&block)\n @actions << block\n end", "def create_action(name, &block)\n action = proc { actions << lambda { block.call(current_location) } }\n metaclass.send :define_method, name, &action\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def method_for_action(action_name); end", "def action(*args,&block)\n name, options = _parse_name_and_options(args)\n command.action({:name=>name}.merge(options),&block)\n end", "def execute(&block)\n\t\t\t\t@controller.refined_http_methods\n\t\t\t\t\t.each do |action, (http_method, action_path)|\n\t\t\t\t\t\tsend(http_method, action_path, action)\n\t\t\t\t\tend\n\t\t\t\tinstance_exec(&block) if block\n\t\t\t\tdefaults\n\t\t\tend", "def action &block\n if block.nil?\n raise RuntimeError, 'expected a block but none given'\n end\n @actions << block\n end", "def action(name)\n action_method = \"action_#{name}\"\n return Actions.send(action_method) if Actions.respond_to?(action_method)\n nil\n end", "def run_action\n raise \"Action for resource #{self.class} is nil!\" if @action.nil?\n\t\t\tif (self.respond_to? @action)\n\t\t\t\tself.send(@action)\n\t\t\tend\n\t\tend", "def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action(name)\n # Attempt to get the action method from the Action class if it\n # exists, otherwise return nil to show that we don't support the\n # given action.\n action_method = \"action_#{name}\"\n return Action.send(action_method) if Action.respond_to?(action_method)\n nil\n end", "def routes_block\n identifier = resource.singular ? 'resource' : 'resources'\n name = resource.name.to_sym\n namespace = resource.namespace.to_sym\n resource_call = -> { send(identifier, name) }\n\n lambda do\n if namespace.present?\n send(:namespace, namespace) do\n instance_exec(&resource_call)\n end\n else\n instance_exec(&resource_call)\n end\n end\n end", "def route(name=nil, &block)\n if name\n @named_routes[name] = block\n else\n super(&block)\n end\n end", "def action!(name)\n action = action(name)\n\n unless action\n raise ActionNotFound, \"#{self.class.keyword} '#{_attributes_[:name]}' does not have the action '#{name}'\"\n end\n\n action\n end", "def define_action(name, opts = {}, &blk)\n actions << name\n\n create_method(name) do |*args, &block|\n hargs = blk ? blk.call(*args) : args\n method = opts[:delegate_to] || name\n with_handler.send(method, *hargs, &block)\n end\n\n alias_method opts[:alias], name if opts[:alias]\n end", "def resource_action(resource)\n resource.action if resource.respond_to?(:action)\n end", "def method_for_action(action_name)\n if action_method?(action_name) then action_name\n elsif respond_to?(:action_missing, true) then \"_handle_action_missing\"\n end\n end", "def define_actions_from_routes\n (effective_resource.member_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { member_action(action) }\n end\n\n (effective_resource.collection_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { collection_action(action) }\n end\n end", "def action inflict, filter\n raw \"get\", { \"Action\" => inflict }.merge(filter)\n end", "def member_action(action)\n define_method(action) do\n self.resource ||= resource_scope.find(params[:id])\n\n EffectiveResources.authorize!(self, action, resource)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource}\"\n\n member_post_action(action) unless request.get?\n end\n end", "def action(name)\n\t\t\t\t# Attrmpt to get the action method from the Action class if it \n\t\t\t\t# exists, otherwise return nil to show that we don't support the\n\t\t\t\t# given action\n\t\t\t\taction_method = \"action_#{name}\"\n\t\t\t\treturn Action.send(action_method) if Action.respond_to?(action_method)\n\t\t\t\tnil\n\t\t\tend", "def process_action_link_action(render_action = :action_update, crud_type_or_security_options = nil)\n if request.get? || request.head?\n # someone has disabled javascript, we have to show confirmation form first\n @record = find_if_allowed(params[:id], :read) if params[:id]\n respond_to_action(:action_confirmation)\n else\n @action_link = active_scaffold_config.action_links[action_name]\n if params[:id]\n crud_type_or_security_options ||= {:crud_type => request.post? || request.put? ? :update : :delete, :action => action_name}\n get_row(crud_type_or_security_options)\n if @record.nil?\n self.successful = false\n flash[:error] = as_(:no_authorization_for_action, :action => action_name)\n else\n yield @record\n end\n else\n if @action_link && respond_to?(@action_link.security_method, true) && !send(@action_link.security_method)\n raise ActiveScaffold::ActionNotAllowed\n end\n yield\n end\n respond_to_action(render_action)\n end\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def document_method(method_name, &block)\n document do |document|\n documented_action = ApiCanon::DocumentedAction.new method_name, controller_path, controller_name\n documented_action.instance_eval &block if block_given?\n document.add_action documented_action\n end\n end", "def collection_action(action)\n define_method(action) do\n if params[:ids].present?\n self.resources ||= resource_scope.where(id: params[:ids])\n end\n\n if effective_resource.scope?(action)\n self.resources ||= resource_scope.public_send(action)\n end\n\n self.resources ||= resource_scope.all\n\n EffectiveResources.authorize!(self, action, resource_klass)\n\n @page_title ||= \"#{action.to_s.titleize} #{resource_plural_name.titleize}\"\n\n collection_post_action(action) unless request.get?\n end\n end", "def add_action(path, &block)\n unless path.start_with? \"/\"\n path = \"#{base_path}/#{path}\"\n end\n if @swagger_path_node_map[path]\n @swagger_path_node_map[path].instance_eval(&block)\n else\n swagger_path path, &block\n end\n end", "def invoke_action(name)\n self.send(name)\n #Rails Magic: Default calls render on appropriate method even if the programmer doesn't :\n render(name) unless already_rendered?\n end", "def invoke_action(name)\n check_authenticity_token unless req.request_method == 'GET'\n self.send(name)\n self.render(name.to_s) unless already_built_response?\n end", "def process_action_link_action(render_action = :action_update)\n if request.get?\n # someone has disabled javascript, we have to show confirmation form first\n @record = find_if_allowed(params[:id], :read) if params[:id] && params[:id] && params[:id].to_i > 0\n respond_to_action(:action_confirmation)\n else\n begin\n if params[:id] && params[:id] && params[:id].to_i > 0\n @record = find_if_allowed(params[:id], (request.post? || request.put?) ? :update : :delete)\n unless @record.nil?\n yield @record\n else\n self.successful = false\n flash[:error] = as_(:no_authorization_for_action, :action => action_name)\n end\n else\n yield\n end\n rescue ActiveRecord::RecordInvalid\n rescue ActiveRecord::StaleObjectError\n @record.errors.add(:base, as_(:version_inconsistency)) unless @record.nil?\n self.successful=false\n rescue ActiveRecord::RecordNotSaved\n @record.errors.add(:base, as_(:record_not_saved)) if !@record.nil? && @record.errors.empty?\n self.successful = false\n end\n respond_to_action(render_action)\n end\n end", "def _call_action(action)\n send(action)\n end", "def action_missing(name, *args)\n if name == action_name\n perform\n else\n raise AbstractController::ActionNotFound\n end\n end", "def action(name)\n nil\n end", "def register_action(&block)\n uuid = Hammer::Core.generate_id\n @actions[uuid] = Hammer::Core::Action.new(uuid, self, block)\n context.register_action(uuid, self)\n return uuid\n end", "def trigger(resource_type_identifier, action)\n # TODO: not tested\n if @model.kinds.select { |kind| kind.term == resource_type }.any?\n type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier\n\n location = @model.get_by_id(type_identifier).location\n resource_type_identifier = @endpoint + location\n end\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unknown resource identifier! #{resource_type_identifier}\" unless resource_type_identifier.start_with? @endpoint\n\n # encapsulate the acion in a collection\n collection = Occi::Collection.new\n scheme, term = action.split(' #')\n collection.actions << Occi::Core::Action.new(scheme + '#', term)\n\n # make the request\n path = sanitize_resource_link(resource_type_identifier) + '?action=' + term\n post path, collection\n end", "def action_for route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n action = @prefix[-1]\n action = PARAM_ROUTES[route[:method]] if self.action_mode == :param\n action = RESOURCE_ROUTES[route[:method]] if self.route_mode == :resource && self.action_mode == :collection\n action\n end", "def action(name)\n actions.find { |action| action.name == name }\n end", "def invoke_action(path)\n controller(path).send(action_name)\n end", "def action_item(name, options = {}, &block)\n config.add_action_item(name, options, &block)\n end", "def resource(name, path, *args, &block)\n controller name, path, *args do\n expand_within(:resource, &block)\n end\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def do_action(action_name, method = nil, params = Hash.new, &block)\n # Locking in the arguments with closures\n define_method(\"action_method\") do\n method || infer_method(action_name)\n end\n\n define_method(\"action_name\") do\n action_name\n end\n\n define_method(\"shared_params\") do\n return instance_eval(&block) if block\n return Hash.new\n end\n\n define_method(\"action_params\") do\n params\n end\n\n # Now the methods we really want to use\n class_eval do\n include Doa::InstanceMethods\n end\n end", "def resource(*args,&block)\n command(*args) do |cmd|\n # add resource actions\n # TODO: Figure out override/mod/new default action...\n cmd.action(:name=>:sample,:default=>true) { (load_data||[]).sample }\n cmd.action(:name=>:list) { (load_data||[]).map{|l| l.to_s}.join(\"\\n\")}\n cmd.action(:name=>[:add,'+'],:required=>:d) {|msg,d| save_data( (load_data||[]) | [d] )}\n cmd.action(:name=>[:delete,:del,:-],:required=>:d) {|msg,d| debug(\"RESOURCE: - #{load_data.inspect} d: #{d.inspect}\"); save_data( (load_data||[]) - [d] )}\n\n # now run as normal\n block.call(cmd) if block\n end\n end", "def _handle_action_missing(*args)\n action_missing(@_action_name, *args)\n end", "def method_for_action(action_name)\n if action_method?(action_name)\n action_name\n elsif respond_to?(:action_missing, true)\n \"_handle_action_missing\"\n end\n end", "def invoke_action(name)\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def call_action(kind, *args, &block)\n GenSpec::Matchers::GenerationMethodMatcher.for_method(kind, *args, &block)\n end", "def any(path, &block)\n route 'GET', path, &block\n route 'POST', path, &block\n end", "def find_resource_action(name)\n resource_actions.detect { |action| action.name.to_sym == name.to_sym }\n end", "def do_restful_action(action, model, &block)\n begin\n # do block\n response = yield\n return parse_response(response)\n\n rescue RestClient::NotAcceptable => u\n # we might be able to glean errors from HTML in response\n logger.debug(\"Nagyo.#{action}:#{model}: #{u}\")\n error = parse_response(u.response)\n raise Exception.new([Exception.new(error), u]) if self.raise_errors\n rescue Exception => e\n logger.error(\"Nagyo.#{action}:#{model}: #{e}\")\n raise e if self.raise_errors\n end\n end", "def method_missing(id, *args, &blk)\n if @resource.respond_to?(id, true)\n @resource.send(id, *args, &blk)\n else\n super\n end\n end", "def enqueue_action_single_resource(action, type, id)\n raise BadRequestError, \"Must specify an id for changing a #{type} resource\" unless id\n\n physical_switch = resource_search(id, type, collection_class(type))\n\n api_action(type, id) do\n begin\n desc = \"Performing #{action} for #{physical_switch_ident(physical_switch)}\"\n api_log_info(desc)\n task_id = queue_object_action(physical_switch, desc, :method_name => action, :role => :ems_operations)\n action_result(true, desc, :task_id => task_id)\n rescue StandardError => err\n action_result(false, err.to_s)\n end\n end\n end", "def process_action(...)\n send_action(...)\n end", "def action\n action_name.to_sym\n end", "def get(name,&block)\n build_resource(name, :get, &block)\n end", "def shared_action(name, &block)\n @base.shared_actions[name] = block\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def _one_item_action(func, resource_id, action, data = nil)\n url = detail_action_url(resource_id, action)\n @api_request.send(\n func,\n url,\n data,\n nil,\n self,\n resource_id\n )\n end", "def hit\n action = params[:req]\n name = params[:name] || params[:id]\n render api_not_supported action, name\n end", "def invoke_action(name)\n # debugger\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end", "def general_action(action_name)\n case action_name\n when 'resource_status'\n if record.onsite_monitoring\n record.resource_status || :not_available\n else\n nil\n end\n when 'stop'\n set_state(:terminating)\n @record.clean_up_database!\n nil\n when 'restart'\n @record.clean_up_database!\n nil\n else\n nil\n end\n end", "def action\n end", "def invoke_action(name)\n self.send(name)\n render unless self.already_built_response?\n\n end", "def lookup_action; end", "def action(identifier, _options = {}, &block)\n Object.class.class_eval do\n command \"#{identifier}\" do |c|\n c.syntax = \"brief #{identifier}\"\n c.description = \"run the #{identifier} command\"\n\n c.action do |args, opts|\n briefcase = Brief.case\n\n path_args = args.select { |arg| arg.is_a?(String) && arg.match(/\\.md$/) }\n\n path_args.select! do |arg|\n path = briefcase.repository.root.join(arg)\n path.exist?\n end\n\n path_args.map! { |p| briefcase.repository.root.join(p) }\n\n models = path_args.map { |path| Brief::Document.new(path) }.map(&:to_model)\n\n block.call(Brief.case, models, opts)\n end\n end rescue nil\n end\n end", "def action_list(action_id, fields = \"all\")\n action_resource action_id, \"list\", fields: fields\n end", "def route(name=nil, namespace=nil, &block)\n if name\n routes = opts[:namespaced_routes][namespace] ||= {}\n routes[name] = define_roda_method(routes[name] || \"multi_route_#{namespace}_#{name}\", 1, &convert_route_block(block))\n self::RodaRequest.clear_named_route_regexp!(namespace)\n else\n super(&block)\n end\n end", "def send_action &block\n @actions[:send] = block\n end", "def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end", "def action(id, type)\n res = self.class.post(\"/rest/items/#{id}/actions/#{type}/invoke\", :headers => {\"Content-Type\" => \"application/json\"}, :basic_auth => @auth)\n return res.parsed_response[\"attributes\"][0][\"value\"]\n end", "def get(path, &block)\n route 'GET', path, &block\n end", "def call_action(action, structure)\n if action.present? and structure.present?\n self.send(action, structure)\n else\n nil\n end\n end", "def action\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def action_step(*action_name, &block)\n\n # Instantiate a ViewStep object if symbol or string received\n action_name.each do |name|\n \n step = WebFlow::ActionStep.new(name.to_s)\n \n # Register this step in the flow repository\n register name.to_s, step\n \n # Execute the config block\n step.instance_eval(&block) if block_given?\n \n end\n\n end", "def actions(options = {}, &block)\n options = { :defaults => true }.merge(options)\n @default_actions = options[:defaults]\n @other_actions = block\n end", "def post(name,&block)\n build_resource(name, :post, &block)\n end", "def method_missing(action, *args, &block)\n return nil\n end", "def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end", "def actions *actions\n options = actions.extract_options!\n return if actions.blank?\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each do |action|\n action_link(action.to_sym, options)\n end\n nil\n end", "def routes(&block); end", "def routes(&block); end", "def run_action(action_name, *args, current_intention: nil)\n action = get_action(action_name)\n raise ::Demiurge::Errors::NoSuchActionError.new(\"No such action as #{action_name.inspect} for #{@name.inspect}!\",\n \"item\" => self.name, \"action\" => action_name,\n execution_context: @engine.execution_context) unless action\n block = action[\"block\"]\n raise ::Demiurge::Errors::NoSuchActionError.new(\"Action was never defined for #{action_name.inspect} of object #{@name.inspect}!\",\n \"item\" => self.name, \"action\" => action_name,\n execution_context: @engine.execution_context) unless block\n\n runner_constructor_args = {}\n if action[\"engine_code\"]\n block_runner_type = ActionItemInternal::EngineBlockRunner\n elsif self.agent?\n block_runner_type = ActionItemInternal::AgentBlockRunner\n runner_constructor_args[:current_intention] = current_intention\n else\n block_runner_type = ActionItemInternal::ActionItemBlockRunner\n runner_constructor_args[:current_intention] = current_intention\n end\n # TODO: can we save block runners between actions?\n block_runner = block_runner_type.new(self, **runner_constructor_args)\n begin\n @engine.push_context(\"running_action\" => action_name, \"running_action_item\" => @name) do\n block_runner.instance_exec(*args, &block)\n end\n rescue\n #STDERR.puts \"#{$!.message}\\n#{$!.backtrace.join(\"\\n\")}\"\n raise ::Demiurge::Errors::BadScriptError.new(\"Script error of type #{$!.class} with message: #{$!.message}\",\n { \"runner type\": block_runner_type.to_s, \"action\" => action_name, },\n execution_context: @engine.execution_context);\n end\n nil\n end", "def after_action verb = nil, &block\n playbook.after_action verb, &block\n end", "def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end" ]
[ "0.71991855", "0.67685616", "0.65737814", "0.65059793", "0.64639795", "0.6398905", "0.6396041", "0.6387927", "0.62770796", "0.62770796", "0.62753904", "0.6228625", "0.61968166", "0.61686945", "0.6122601", "0.61145", "0.60955393", "0.6072529", "0.6015088", "0.6015088", "0.6015088", "0.6015088", "0.6015088", "0.6015088", "0.5956225", "0.5900225", "0.5891436", "0.58833176", "0.58663076", "0.5764293", "0.5763926", "0.57616466", "0.57614547", "0.57581127", "0.5748967", "0.5746292", "0.5742552", "0.5742542", "0.5735272", "0.5721639", "0.57187915", "0.5716851", "0.5700511", "0.57001764", "0.56882286", "0.56708574", "0.564296", "0.56373376", "0.5635423", "0.5634133", "0.56318706", "0.56310797", "0.5627304", "0.5613933", "0.5613676", "0.5601149", "0.5599", "0.5597924", "0.5597037", "0.5594467", "0.55860126", "0.55838835", "0.55765265", "0.5556114", "0.55502665", "0.55370075", "0.55297107", "0.5504982", "0.54926634", "0.5491829", "0.5491829", "0.5469507", "0.5458404", "0.54563355", "0.54482895", "0.54468685", "0.54441684", "0.54189974", "0.5418525", "0.5409386", "0.5403537", "0.5401472", "0.53996634", "0.53887796", "0.5384708", "0.5379398", "0.53767335", "0.53757274", "0.5366007", "0.53579575", "0.5332932", "0.5330165", "0.532916", "0.53223634", "0.53182745", "0.5317533", "0.5317533", "0.5316445", "0.5309151", "0.53079605" ]
0.6447129
5
Whitelisting for all fields marked as +editable+ in the dsl.
def record_params fields = resource.editable_fields.map(&:name) params.require(model.model_name.param_key.underscore.to_sym).permit(fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields_need_editing(obj) \n \teditable_fields(obj).select {|k,v| v == true }\n end", "def editable_fields(obj)\n \tobj.attributes.select {|key| key.start_with? \"need_to_edit_\"}\n end", "def ensure_editable; return false unless editable? end", "def is_not_editable!\n update_attribute :is_editable, false\n end", "def is_editable\n not is_default_cash_gift\n end", "def is_editable?\n is_public\n end", "def editable!\n editable(true)\n end", "def prevent_edit\n !can_edit?\n end", "def editable?\n admin?\n end", "def editable! \n elements.each { |e|\n e.editable! \n }\n end", "def editable?\n false\n end", "def editable?\n true\n end", "def editable?\n true\n end", "def editable?\n true\n end", "def build_editable_fields(actions, guardian, args)\n end", "def can_edit?(object)\n false\n end", "def is_editable!\n update_attribute :is_editable, true\n end", "def simple_fields\n fields.select(&:filterable?)\n end", "def attr_accessor_only_if_editable(*args)\n args.each do |attr_name|\n attr_name = attr_name.to_s\n\n #getter\n self.class_eval %Q{\n def #{attr_name}\n @#{attr_name}\n end\n }\n\n #setter\n self.class_eval %Q{\n def #{attr_name}=(val)\n fail \"Not editable!\" unless self.editable?\n\n # set the value itself\n @#{attr_name}=val\n end\n }\n end\n end", "def allowed_fields\n @allowed_fields.dup\n end", "def writable(*fields)\n added_fields = add_fields(@write_mask,\"writable\",fields)\n allow(*fields)\n @write_mask = added_fields if(@write_mask.eql?(WILDCARD))\n added_fields\n end", "def register_editable(editable)\n @context.registers[:editables] << editable unless @context.registers[:editables].include?(editable)\n end", "def readonly! \n elements.each { |e|\n e.readonly! \n }\n end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def attributes_editable?(user=User.current)\n user_permission?(user, :edit_pulls)\n end", "def editable?(user=User.current)\n ! broken? && attributes_editable?(user)\n end", "def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end", "def valid_edit_check(_traversal_env)\n Result::DENY\n end", "def showable_attributes\n return attributes if permitted_to?(WriteAllPrivilege)\n attributes.reject do |k,v|\n !allowed?(:read, k, true)\n end\n end", "def can_edit_field?( field, work )\n\n # not if they are not defined as editable\n return false if Work::EDITABLE.include?( field ) == false\n\n # if we are not published them some fields cannot be edited\n if is_published( work ) == false\n return false if [ 'published_date' ].include?( field )\n end\n\n return true\n end", "def filter_editable_elements(list)\n list.map do |attributes|\n type = attributes['type']\n attributes.keep_if { |k, _| %w(_id block slug content).include?(k) }.tap do |hash|\n unless hash['content'].blank?\n if type == 'EditableFile'\n hash['content'] = self.add_content_asset(hash['content'], '/samples/pages')\n else\n self.mounting_point.content_assets.each do |path, asset|\n hash['content'].gsub!(/(http:\\/\\/[^\\/]*)?#{path}/, asset.local_filepath)\n end\n end\n end\n end\n end\n end", "def editable_custom_field_values(user=nil)\n user_real = user || User.current\n custom_field_values.select do |value|\n value.custom_field.editable_by?(project, user_real)\n end\n end", "def authorized_to_edit_records\n scope.none\n end", "def editable_check(_traversal_env)\n Result::DENY\n end", "def ensure_editable\n errors.add(:base, I18n.t('settler.errors.editable', :default => 'Setting cannot be changed')) if changed? && !editable?\n end", "def editable(value = true)\n cursor(true) if Vedeu::Boolean.coerce(value)\n\n model.editable = Vedeu::Boolean.coerce(value)\n end", "def is_editable?(key)\n (@options[:editable] || {})[key.to_sym] || true\n end", "def can_edit?(item)\n item.editable_by?(self)\n end", "def can_edit?(item)\r\n item.editable_by?(self)\r\n end", "def allow(*fields)\n added_fields = add_fields(@allowed_fields,\"allow\",fields)\n @allowed_fields = added_fields if(@allowed_fields.eql?(WILDCARD))\n added_fields\n end", "def editable_by?(user)\n return true unless has_limited_editors?\n\n (editor_roles & user.alchemy_roles).any?\n end", "def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end", "def public_fields\n fields.select{ |field_name| field_name[0] != '_' }\n end", "def writable_attributes\n return attributes if permitted_to?(WriteAllPrivilege)\n attributes.reject do |k,v|\n !allowed?(:write, k)\n end\n end", "def editable?\n !self.disabled? &&\n self.locales.include?(::Mongoid::Fields::I18n.locale.to_s) &&\n (!self.fixed? || !self.from_parent?) &&\n !self.destroyed?\n end", "def can_modify\n\t\tself.changed_attributes.each do |attr|\n\n\t\t\tif attr.to_s == \"reports\"\n\t\t\t\tself.reports.each do |r|\n\t\t\t\t\tunless r.changed_attributes.blank?\n\t\t\t\t\t\tif r.owner_ids.include? self.created_by_user_id\n\t\t\t\t\t\telsif r.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.errors.add(:reports,\"You cannot edit #{attr.name.to_s}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\n\t\t\telsif attr.to_s == \"recipients\"\n\t\t\t\trecipients_changed\n\t\t\telsif attr.to_s == \"payments\"\n\t\t\t\told_payment_not_deleted\n\t\t\telse\n\t\t\t\t## only in case of \n\t\t\t\tif self.owner_ids.include? self.created_by_user.id.to_s\n\t\t\t\telsif self.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\telse\n\t\t\t\t\tself.errors.add(:owner_ids,\"You cannot edit the field: #{attr.to_s}\")\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\tend", "def can_edit?\n object.editable_by?(current_user)\n end", "def read_only?; end", "def read_only?; end", "def readable(*fields)\n added_fields = add_fields(@read_mask,\"readable\",fields)\n allow(*fields)\n @read_mask = added_fields if(@read_mask.eql?(WILDCARD))\n added_fields\n end", "def updatable?(fields=false)\n modifiable? :update, fields\n end", "def is_column_editable?(col)\n editable?\n end", "def editable_by?(user)\n !shipped? && !delivered?\n end", "def editable?\n (status == STATUS_NOT_SUBMITTED || status == STATUS_DELETED)\n end", "def partial_locked?\n !(to_editable? && from_editable?)\n end", "def can_edit?\n !published_at\n end", "def restrict_fields\n\n allowed_fields=User.new.attributes.keys\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n if @fields.present?\n @users=@users.select(@fields) \n else\n @fields=allowed_fields\n end \n end", "def ignore_non_read_or_write_attributes\n ['title', 'email', 'expertise_list', 'tool_list', 'mbox_sha1sum']\n end", "def nullify_fields_if_these_are_admin_mode_settings\n # if mission_id is nil, that means we're in admin mode\n if mission_id.nil?\n (attributes.keys - ADMIN_MODE_KEYS - %w(id created_at updated_at mission_id)).each { |a| self.send(\"#{a}=\", nil) }\n end\n end", "def allowed_filterables\n %i[created_at updated_at name].freeze\n end", "def must_have_edit_permission!(name)\n must_be_creator!(name)\n must_be_only_editor!(name)\n must_own_all_descriptions!(name)\n must_own_all_observations!(name)\n must_own_all_namings!(name)\n end", "def editable?\n new_record? || !user_id.nil?\n end", "def field_for_select\n candidate_fields = [primary_field, list_view_fields, fields].flatten.compact\n candidate_fields.reject(&:restricted?).find(&:human_readable?)\n end", "def save_only_columns_for_draft\n if self.class.draftsman_options[:only].any?\n only_changes = {}\n only_changed_attributes = self.attributes.keys - self.class.draftsman_options[:only]\n\n only_changed_attributes.each do |key|\n only_changes[key] = send(key) if changed.include?(key)\n end\n\n self.update_columns(only_changes) if only_changes.any?\n end\n end", "def set_allowed_attrs\n allowed_attrs = %i[id]\n fields = settings(\"views.#{params[:component]}.new\", fatal_exception: true)\n fields.each do |field|\n allowed_attrs.append(node_name(field).to_sym)\n end\n allowed_attrs\n end", "def custom_fields_allowed?\n true\n end", "def check_exclude_fields\n=begin\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n exc= exclude_fields.send(key)\n next if exc # Leave user options if given.\n \n # By default, the foreign key of the parents are assigned on nested resources,\n # so i remove the from the default columns of new\n exclude_fields.send(\"#{key}=\", parent_ids) if key == :for_new && !parent_ids.empty?\n end\n=end\n # Because a single resource can have multiple resource parents,\n # this check is going to be done on \"runtime\" (ie remove the field for the \n # current parent, not all parents' fields)\n end", "def can_edit?(user)\n\n end", "def all_sheet_editable_projects\n Project.current.editable_by_user(self)\n end", "def editable_by?(user)\n user && self.user_id == user.id\n end", "def editable_by?(user)\n user && self.user_id == user.id\n end", "def custom_fields_safe_attributes\n self.custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\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 set_readonly(*field_names)\n field_names.each { |field|\n @element_map[field.to_s].readonly!\n }\n end", "def filter_illegal_changes\n return unless params[:description].is_a?(ActionController::Parameters)\n\n root = in_admin_mode?\n admin = @description.is_admin?(@user)\n author = @description.author?(@user)\n\n params[:description].delete(:source_type) unless root\n unless root ||\n ((admin || author) &&\n # originally was\n # (desc.source_type != \"project\" &&\n # desc.source_type != \"project\"))\n # see https://www.pivotaltracker.com/story/show/174566300\n @description.source_type != \"project\")\n params[:description].delete(:source_name)\n end\n params[:description].delete(:license_id) unless root || admin || author\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def request_is_readonly?\n true\n end", "def editable_by?(usr)\n if wiki.project &&\n wiki.project.module_enabled?('wiki') &&\n wiki.project.module_enabled?('redmine_advanced_wiki_permissions')\n !protected? || usr.wiki_allowed_to?(self, :protect_wiki_pages)\n else\n !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project)\n end\n end", "def ok_to_edit?\n can_edit_dev? and can_edit_stp? and can_edit_title_or_description? and not_all_blank?\n end", "def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\", \"remote_#{rule['name']}_url\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def restrict_fields\n allowed_fields=Location.new.attributes.keys+[\"top_left_coordinate_str\", \"bottom_right_coordinate_str\"]-[\"top_left_coordinate_id\", \"bottom_right_coordinate_id\"]\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n \n if @fields.present?\n @locations=@locations.select(@fields) \n else\n @fields=allowed_fields\n end \n\n end", "def can_edit?\n head(:forbidden) unless current_user.review_space_admin? || @space.editable_by?(current_user)\n end", "def admin_only\n false\n end", "def permitted_attributes_for_update\n return permitted_attributes if record.user_id == user.id\n permitted_attributes.reject do |attr|\n [:start_date, :due_date, :estimated_time].include? attr\n end\n end", "def allow_and_deny_fields(action_name)\n compute_allow_and_deny(action_name).then do\n\n result = [@__allow_fields, @__deny_fields]\n\n clear_allow_and_deny\n\n result\n end\n end", "def has_editable kind\n case kind\n when :children\n false\n else\n true\n end\n end", "def soyEdificable\n false\n end", "def read_only\n @attributes[:read_only]\n end", "def editable\n if scope && scope[:user_id] && object.user_id == scope[:user_id]\n return true\n else\n return false\n end\n end", "def editable\n if scope && scope[:user_id] && object.user_id == scope[:user_id]\n return true\n else\n return false\n end\n end", "def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def shipment_params\n params.permit(Shipment.editable_attributes)\n end", "def restrict_columns\n columns_whitelist = @user_key.columns.restrict_to(@resource).to_a.map{|c| c.name}\n for item in @items\n for column in item.keys\n item.delete(column) unless columns_whitelist.include?(column)\n end\n end\n end", "def read_only\n true\n end", "def can_edit\n return @can_edit\n end" ]
[ "0.7276025", "0.7209332", "0.6696453", "0.64862096", "0.6436252", "0.6381625", "0.62937015", "0.6201889", "0.6183682", "0.6165825", "0.6144892", "0.6139132", "0.6139132", "0.6139132", "0.60667497", "0.6063348", "0.6060603", "0.6007224", "0.59708637", "0.5936698", "0.5869888", "0.58510196", "0.5842408", "0.5799429", "0.5799429", "0.5799429", "0.5797323", "0.5797036", "0.57847214", "0.57770926", "0.57586807", "0.5736547", "0.57084674", "0.5702898", "0.5667101", "0.56540376", "0.56522596", "0.5645261", "0.5638534", "0.5635089", "0.56005394", "0.55965483", "0.55684555", "0.55462784", "0.5520927", "0.5513633", "0.55129427", "0.5503344", "0.5501923", "0.54641086", "0.54641086", "0.54546905", "0.5450994", "0.5428194", "0.5423995", "0.54103595", "0.5404438", "0.54010165", "0.53974384", "0.5382934", "0.53773886", "0.5362532", "0.5339144", "0.5332927", "0.53299", "0.5326988", "0.53224754", "0.5302139", "0.5293228", "0.52905273", "0.52860296", "0.528475", "0.528475", "0.5284262", "0.527833", "0.5268745", "0.5254701", "0.52329785", "0.52329785", "0.52329785", "0.5228163", "0.5222436", "0.5221514", "0.5219547", "0.5216542", "0.5207046", "0.5195512", "0.5194879", "0.51838493", "0.5183327", "0.5181993", "0.5178593", "0.5176199", "0.51755756", "0.51755756", "0.51725316", "0.5169996", "0.5169151", "0.5166201", "0.51561654", "0.515437" ]
0.0
-1
A generic before_action method to set an instance variable for the current record.
def find_record @record ||= model.find_by_id(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_controller_object context\n if action_name == 'edit' || action_name == 'destroy' || action_name == 'update'\n super\n else\n @student ||= begin\n id = params[find_first_parent.is_a?(Student) ? :student_id : :id ]\n Student.find(id)\n end\n @test_score = TestScore.new({student_id: @student.id}, as: current_role)\n end\n end", "def set_my_foo\n @my_foo = MyFoo.find(params[:id])\n end", "def set_record\n @record = Record.find(current_user.record.id)\n end", "def set_action_object\n @action_object = ActionObject.find(params[:id])\n end", "def show #Variable @model_instance is already being set inside the setter method: set_model_instance\n authorize! :show, params[:controller]\n end", "def set_my_action\n @my_action = MyAction.find(params[:id])\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def set_foo\n @foo = Foo.find(params[:id])\n end", "def set_foo\n @foo = Foo.find(params[:id])\n end", "def set_student_action\n @student_action = StudentAction.find(params[:id])\n end", "def set_action\n @action = Action.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def set_instance\n @instance = Instance.find(params[:id])\n end", "def initialize(*args)\n super\n @action = :set\nend", "def set_pre\n @pre = Pre.find(params[:id])\n end", "def instance=(instance)\n @controller.instance_variable_set(:\"@#{instance_name}\", instance)\n end", "def set_action_item\n @action_item = ActionItem.find(params[:id])\n end", "def before_embedded(record, action); end", "def set_foobar\n @foobar = Foobar.find(params[:id])\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_player_action\n @player_action = PlayerAction.find(params[:id])\n end", "def set_initial_value\n @initial_value = InitialValue.find(params[:id])\n end", "def before_save\n # boolean fields cannot be NULL at database level\n self.is_active = 0 if self.is_active.nil?\n end", "def set_action_state\n @action_state = ActionState.find(params[:id])\n end", "def set_test_record\n @test_record = TestRecord.find(params[:id])\n end", "def set_test_record\n @test_record = TestRecord.find(params[:id])\n end", "def controller_timelog_edit_before_save(context={})\n if context[:params][:action] == 'create'\n # get the user id submitted by the form\n user_id = context[:params][:user][:user_id]\n begin\n selected_user = User.find(user_id.to_i)\n\n # get the time_entry given by the hook\n time_entry = context[:time_entry]\n\n # set the user\n time_entry.attributes = { :user => selected_user }\n rescue\n # don't do anything. The hook caller will have set the user\n # with User.current\n end\n end\n end", "def set_resource\n instance_variable_set(resource, @model.find(params[:id]))\n end", "def set_arbitrary_record\n @arbitrary_record = ArbitraryRecord.find(params[:id])\n end", "def set_object\n set_model_instance(MODEL_CLASS.find(params[:id]))\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_action_log\n @action_log = ActionLog.find(params[:id])\n end", "def set_student\n @student = Student.find(current_student.id)\n end", "def set_instance\n @instance = @workflow.instances.find(params[:instance_id])\n end", "def initialize(*args)\r\n super\r\n @action = :assign\r\nend", "def set_prevision\n @prevision = Prevision.find(params[:id])\n end", "def set_on_stage\n @on_stage = OnStage.find(params[:id])\n end", "def before(action, &block)\n before_actions[action] = block if block_given?\n end", "def set_record\n @record = current_user.records.find(params[:id])\n end", "def set_record\n @record = current_user.records.find(params[:id])\n end", "def persist\n @before_run = true\n super\n end", "def before_action \n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_record\n @record = Record.find(params[:id])\n end", "def set_voteaction\n @voteaction = Voteaction.find(params[:id])\n end", "def set_current_attributes(current, action)\n case action\n when :create, :delete\n @cron_empty = false # using ivar because there's no need to expose this to log unlike `current.cron_exists`.\n load_current_resource(current)\n else\n raise NotImplementedError, \"unhandled action: '#{action}'\"\n end\n end", "def before(controller)\n self.controller = controller\n\n # set history_group_id to group history tracks if given otherwise set to current time with minutes precision\n # user can customize history group identifier by added history_group_id method to the controller\n @history_group_id = \n controller.methods.include?(:history_group_id) ? controller.history_group_id : Time.now.utc.strftime('%Y%m%d%H%M')\n \n true\n end", "def set_student_record\n @student_record = StudentRecord.find(params[:id])\n end", "def before(&proc)\n @before = proc if proc\n @before\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup\n # Just like other controllers, grab the parent objects\n @list = List.find(params[:list_id])\n @item = @list.items.find(params[:item_id])\n\n # Look for an existing vote by this person so we don't create multiple\n @vote = @item.votes.where(user_id: current_user.id).first\n end", "def set_ncco_record_action\n @ncco_record_action = NccoRecordAction.find(params[:id])\n end", "def before(&block)\n block ? @before = block : @before\n end", "def set_kaction\n @kaction = Kaction.find(params[:id])\n end", "def before\n @before\n end", "def set_resource_ivar(resource)\n instance_variable_set(\"@#{self.controller_name.singularize}\", resource)\n end", "def set_student\n @student = Student.find(current_student.id)\n end", "def set_student\n @student = Student.find(session[:student_id])\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def set_activity_record\n @activity_record = ActivityRecord.find(params[:id])\n end", "def set_chef\n #We should define this line for SHOW, EDIT, UPDATE, but we will call it from this method using BEFORE_ACTION at the beginning of this controller\n @chef = Chef.find(params[:id])\n end", "def controller_issues_edit_before_save(context={})\r\n issue = context[:issue]\r\n end", "def set_single_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__')}\", @resource)\n end", "def set_single_instance\n instance_variable_set(:\"@#{model_type.to_s.gsub('/', '__')}\", @resource)\n end", "def set_record_object\n @record_object = RecordObject.find(params[:id])\n end", "def set_good_action\n @good_action = GoodAction.find(params[:id])\n end", "def set_resource\n @model || set_model # Why?\n instance_variable_set(resource, @model.find(params[:id])) if @model\n end", "def before_step(step)\n @current_step = step\n end", "def set_initial\n @initial = Initial.find(params[:id])\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end", "def set_some_thing\n @some_thing = SomeThing.find(params[:id])\n end", "def before_proc(&block)\n @before_proc = block\n end", "def set_active_workflow_step\n @active_workflow_step = ActiveWorkflowStep.find(params[:id])\n end", "def set_entity\n @entity = Entity.find_by(key: params[:id])\n @entity ||= Entity.find_by(id: params[:id])\n @entity ||= Entity.find_by(key: params[:entity_key])\n raise ActiveRecord::RecordNotFound if @entity.blank?\n entity_check()\n end", "def set_acted_in\n @acted_in = ActedIn.find(params[:id])\n end", "def set_activist_front\n @activist_front = ActivistFront.find(params[:id])\n end" ]
[ "0.6095011", "0.6002556", "0.58737755", "0.58520097", "0.5793733", "0.5775685", "0.5732505", "0.57300466", "0.57300466", "0.5727094", "0.5672847", "0.5664108", "0.5664108", "0.5664108", "0.5664108", "0.5664108", "0.5664108", "0.56483215", "0.55832434", "0.5570724", "0.55616456", "0.5551614", "0.5516011", "0.54843736", "0.54843736", "0.5475386", "0.5471169", "0.5471094", "0.54596806", "0.54482126", "0.54482126", "0.5442114", "0.54289514", "0.5423589", "0.5409445", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5403429", "0.5402237", "0.53950614", "0.5393355", "0.5390933", "0.53850025", "0.5382954", "0.5377679", "0.5373999", "0.5373999", "0.5364553", "0.5364545", "0.5361206", "0.5361206", "0.53600407", "0.5350896", "0.5332587", "0.5331108", "0.53293306", "0.5325255", "0.5324038", "0.53202856", "0.5317732", "0.53170824", "0.5315286", "0.53133816", "0.530594", "0.53057307", "0.5300222", "0.52954704", "0.52919644", "0.52910763", "0.5288405", "0.5287749", "0.5287749", "0.5285613", "0.52809167", "0.526851", "0.52641445", "0.52633864", "0.52598506", "0.52598506", "0.5258282", "0.5258178", "0.5254366", "0.5252926", "0.52503", "0.5250196" ]
0.0
-1
A helper method that returns the AppKit::Resource object tied to the current controller.
def resource self.class.resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_to_use\n return @resources.first\n end", "def resource\n instance_variable_get(resource_name) || params[:id] && set_resource(controller_model.find(params[:id]))\n end", "def current_resource\n @current_resource ||= @item\n end", "def resource\n return @resource\n end", "def resource\n return @resource\n end", "def resource\n return @resource\n end", "def resource\n return @resource\n end", "def resource\n return @resource\n end", "def resource\n return @resource\n end", "def resource\n self\n end", "def resource\n @resource ||= resource_klass.new object\n end", "def resource\n @resource\n end", "def resource\n @resource\n end", "def get_resource_ivar\n instance_variable_get(\"@#{self.controller_name.singularize}\")\n end", "def load_current_resource; end", "def resource\n @resource ||= Resource.new(self)\n end", "def resource_class\n name = controller.controller_name\n return \"active\" if name == \"resources\"\n end", "def resource\n (@nested_resource || @root_resource)\n end", "def resource_class\n @resource_class ||= self.controller_name.singularize.classify.constantize\n end", "def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end", "def resource\n @resource ||= begin\n resource_constant.new(attributes)\n end\n end", "def resource_application\n return @resource_application\n end", "def resource\n @resource\n end", "def current_resource\n nil\n end", "def controller_for(resource)\n return resource if resource.is_a?(Class) && resource.ancestors.include?(ActionController::Base)\n \"#{resource.to_s.underscore}_controller\".classify.constantize\n rescue NameError\n raise ResourceFull::ResourceNotFound, \"not found: #{resource}\"\n end", "def current_resource\n nil\n end", "def resource\n resource_model.find(params[:id])\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def current_resource\n @current_resource ||= KwkOrder.find_by(guid: params[:guid])\n end", "def current_resource_owner\n raise \"Your ApplicationController needs to implement current_resource_owner!\"\n end", "def controller\n return @controller\n end", "def resource\n @resource ||= begin\n resource_query\n .new(relation: resource_scope)\n .find_for_show(find_by_conditions: find_by_conditions)\n end\n end", "def get_resource\n execute(resource_path, method: :get)\n end", "def load_resource\n current_site\n end", "def default_controller\n Wallaby.configuration.mapping.resources_controller\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "def current_resource(resource)\n send(\"current_#{resource.class.name.underscore.downcase}\")\n end", "def find_resource\n get params[:resource_path]\n end", "def controller\n @controller ||= ApplicationController.new\n end", "def read_resource(resource)\n resource\n end", "def read_resource(resource)\n resource\n end", "def controller_resource\n Iteration\n end", "def find_resource\n @resource = resource_class.find(params[:id])\n end", "def resource\n return Object unless resource_type\n return resource_type.constantize unless resource_id\n return _resource\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def current_resource\n @current_resource ||= BroOrder.find_by(guid: params[:guid])\n end", "def resource_base\n @resource_base ||= model_of_controller.respond_to?(:authorized) ?\n model_of_controller.authorized(current_permission) :\n model_of_controller.scoped\n end", "def resource_for(klass)\n resources[klass]\n end", "def resource\n get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_find, params[:id]))\n end", "def controller_resource\n Question\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def active_admin_resource_for(klass)\n if respond_to? :active_admin_namespace\n active_admin_namespace.resource_for klass\n end\n end", "def current_resource\n @current_resource ||= Subscriber.find( params[:id] ) if params[:id]\n end", "def resource\n @resource ||= resource_set.createResource(uri)\n end", "def get_resource\n\t\t\t\tinstance_variable_get(\"@#{resource_name}\")\n\t\t\tend", "def controller\n self::Controller\n end", "def resource_model\n \"::#{resource_name}\".constantize\n end", "def controller\n self\n end", "def default_controller(params)\n params[:resources_controller] || Wallaby.configuration.mapping.resources_controller\n end", "def current\n Thread.current[:CURRENT_CONTROLLER]\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource\n\n end", "def resource_class\n @resource_class ||= resource_class_name.constantize\n end", "def load_current_resource\n @current_resource ||= Chef::Resource::Civilize.new(r.name)\n @current_resource\n end", "def compete_controller\n @kernel.resources.controllers.compete\n end", "def load_current_resource\n @current_resource ||= Chef::Resource::Partial.new(new_resource.name)\n @current_resource\n end", "def show\n @resource = find_resource\n end", "def controller_resource\n ProjectEvaluation\n end", "def set_resource\n resource_class_name = controller_name.classify\n resource = \"@#{ resource_class_name.underscore }\"\n instance_variable_set(resource, resource_class_name.constantize.find(params[:id]))\n end", "def resource_model\n resource = \"#{resource_param}\".constantize\n end", "def controller client\n client.env[CONTROLLER_NAME]\n end", "def resource_name\n @resource_name ||= controller_name.singularize\n end", "def resource_class\n class_name\n end", "def enclosing_resource\n self.resource_tuple[-2]\n end", "def load_current_resource\n @current_resource ||= Resource::Dropbox.new(new_resource.name)\n end", "def resources_name\n controller_name\n end", "def get_resource_ivar #:nodoc:\n instance_variable_get(\"@#{resource_instance_name}\")\n end", "def controller_resource\n PeerAssessment\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def get_resource_name\n \tself.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_class\n \t@resource_class ||= get_resource_class\n end", "def resource_name\n @@resource_name ||= self.class.to_s.split('::').last.gsub('Controller', '').singularize.underscore\n end", "def current_resource\n return nil unless current_path\n sitemap.find_resource_by_destination_path(current_path)\n end", "def resource\n @current_page ||= Page.find_by_identifier(Page::Identifiers::ADMIN_HELP)\n end", "def resource\n @document.resource\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end" ]
[ "0.70348805", "0.6945915", "0.6910271", "0.67771924", "0.67771924", "0.67771924", "0.67771924", "0.67771924", "0.67771924", "0.67329735", "0.6724415", "0.6724227", "0.6724227", "0.6724013", "0.67166543", "0.66663843", "0.66630954", "0.6624227", "0.6596519", "0.6590118", "0.6581895", "0.6579961", "0.65667", "0.6524315", "0.6512603", "0.6499277", "0.6494646", "0.64941293", "0.64941293", "0.6479529", "0.6464674", "0.6464674", "0.6464674", "0.64193505", "0.6413383", "0.640858", "0.6408386", "0.63932145", "0.6384738", "0.6382681", "0.6377642", "0.6376227", "0.6376227", "0.6364267", "0.634517", "0.63145494", "0.62759846", "0.62759846", "0.6261658", "0.6243392", "0.62417614", "0.62408763", "0.62408763", "0.62408763", "0.62408763", "0.6229783", "0.62223375", "0.6192305", "0.6191957", "0.61810076", "0.6177474", "0.61581564", "0.6138147", "0.61309", "0.6125772", "0.6123289", "0.608533", "0.6070665", "0.6047475", "0.6042236", "0.6040581", "0.6040581", "0.6040581", "0.60402894", "0.60232204", "0.60230047", "0.6010097", "0.60053974", "0.5993745", "0.5991862", "0.5978087", "0.59450215", "0.59428155", "0.5940155", "0.592632", "0.59231794", "0.5922556", "0.59188235", "0.5915031", "0.59149706", "0.5914029", "0.5914029", "0.59123766", "0.5903672", "0.59024084", "0.58928925", "0.58894944", "0.58891714", "0.5888324", "0.5887512" ]
0.6864856
3
A helper method to retrieve the model classs based on the current controller's class name.
def model @model ||= resource.model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_class\n @model_class ||= controller_path.classify.constantize\n end", "def model\n\t\tObject.const_get(controller_name.classify)\n\tend", "def model\n controller_name.classify.constantize\n end", "def model_klass\n controller_name.classify.constantize\n end", "def model_class(model_or_controller_name)\n # site settings isn't a model so it isn't defined\n @model_class = model_or_controller_name.singular.camelcase.constantize rescue nil\n end", "def model_class(model_or_controller_name)\n # site settings isn't a model so it isn't defined\n @model_class = model_or_controller_name.singular.camelcase.constantize rescue nil\n end", "def model\n self.controller_name.classify.constantize\n end", "def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end", "def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end", "def current_model\n Object.const_get(params[:model].classify)\n end", "def controller_model_class\n c = controller_name.to_s.pluralize.singularize.camelize.constantize\n if c.respond_to? :new\n c # looks like we've got a real class\n else\n nil # TODO throw error?\n end\n end", "def class_for_controller_name\n controller_model\n end", "def model_class\n @controller.model_class\n end", "def model_class\n @model_class ||= model_name.camelize.constantize\n end", "def class_from_name\n if model_name.to_s.include? \"_\"\n ns, *klass = model_name.to_s.split(\"_\").collect(&:camelize)\n begin\n \"#{ns}::#{klass.join(\"\")}\".constantize\n rescue NameError\n \"#{ns}#{klass.join(\"\")}\".constantize\n end\n else\n model_name.to_s.camelize.constantize\n end\n end", "def controller_model\n @controller_model ||= begin\n controller_name.singularize.camelize.constantize\n rescue\n nil\n end\n end", "def model_class\n @class_name.constantize\n end", "def controlled_model_class\n controller_path.classify.constantize\n end", "def set_model\n @model_class = self.class.name.gsub(/Controller$/, '').singularize.constantize\n end", "def to_class(model_name)\r\n Kernel.const_get(model_name.to_s.camelize)\r\n end", "def model\n begin\n return controller_name.classify.constantize\n rescue\n return ('SlashAdmin::' + controller_name.classify).constantize\n end\n end", "def model_name\n self.class.name[/(.*)Controller/,1].singularize.underscore\n end", "def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end", "def get_models\n eval \"@#{controller_name} = #{controller_name.singular.camelcase}.all\"\n end", "def model_name\n @model_class ? @model_class.name.demodulize.underscore : self.controller_name.singularize\n end", "def getKlass #:doc:\n @Klass = self.controller_name.classify.constantize\n @Klass\n end", "def model_class\n class_name.constantize\n end", "def model_class\n self.class.const_get('MODEL')\n end", "def model_class\n @model_class ||= derived_model_class_name.constantize\n end", "def class_at_path(path)\n if path\n begin\n # remove the _ and then singularize\n if path.last == :[]\n index = -2\n else\n index = -1\n end\n\n klass_name = path[index].singularize.camelize\n\n klass = $page.model_classes[klass_name] || Model\n rescue NameError => e\n # Ignore exception, just means the model isn't defined\n klass = Model\n end\n else\n klass = Model\n end\n\n return klass\n end", "def model_class\n return @model_class || self.class.model_class\n end", "def model_name\n params[:controller].sub(\"Controller\", \"\").underscore.split('/').last.singularize\n end", "def find_model_class_by(params)\n model_class = Map.model_class_map params[:resources]\n return model_class unless MODEL_ACTIONS.include? params[:action].to_sym\n raise ModelNotFound, params[:resources] unless model_class\n unless Map.mode_map[model_class]\n raise UnprocessableEntity, Locale.t('errors.unprocessable_entity.model', model: model_class)\n end\n\n model_class\n end", "def model(name)\n name.gsub(/\\W+/, '_').classify.constantize\n end", "def model\n @_model ||=\n if self.class == Edgarj::EdgarjController\n # dummy model for 'top' action:\n Edgarj::Sssn\n else\n self.class.name.gsub(/Controller$/, '').singularize.constantize\n end\n end", "def model_class\n self.class_name.constantize\n end", "def use_with_class_names\n (\n DynamicModel.model_names +\n ExternalIdentifier.model_names +\n ActivityLog.model_names +\n Master::PrimaryAssociations\n )\n .map { |m| m.to_s.singularize }\n .select { |m| m != 'master' }\n end", "def model_param\n # model_class is defined by derived controllers for the individual search\n # types we support\n model_class.to_s.demodulize.underscore\n end", "def model_class\n @model_class ||= mapping.to\n end", "def controller_for_model(klass)\n model = ui_base_model(klass)\n if klass <= VmOrTemplate\n controller_for_vm(klass)\n elsif model.respond_to?(:db_name)\n model.db_name.underscore\n else\n model.name.underscore\n end\n end", "def classes_for_main\n controller.controller_name + '-' + controller.action_name\n end", "def model_controller(model)\n model.class.name.downcase.pluralize\n end", "def to_model_class\n to_model_name.classify.constantize\n end", "def model_classes\n @opts[:models]\n end", "def model\n self.klass.constantize.name.demodulize.tableize.singularize.downcase\n end", "def model_name\n params[:controller].split('/').last.singularize\n end", "def models\n @models ||= self.model_names.map {|x| x.constantize}\n end", "def get_model(from_get_recordset: false)\n return @model if instance_variable_defined?(:@model) && @model\n return (@model = self.class.model) if self.class.model\n\n # Delegate to the recordset's model, if it's defined.\n unless from_get_recordset # prevent infinite recursion\n if (recordset = self.get_recordset)\n return @model = recordset.klass\n end\n end\n\n # Try to determine model from controller name.\n begin\n return (@model = self.class.name.demodulize.match(/(.*)Controller/)[1].singularize.constantize)\n rescue NameError\n end\n\n return nil\n end", "def current_model\n unless self.controller.respond_to? :current_model\n raise ArgumentError, \"#{self.controller} expected to define current_model. Example: UsersController.current_model should return the User class\"\n end\n self.controller.send(:current_model)\n end", "def model_controller(model)\n model.class.name.underscore.pluralize\n end", "def model_class_name(name=nil)\n @model_class_name = name if name\n @model_class_name ||= guess_model_class_name\n end", "def thing\n controller_name.classify.constantize\n end", "def model_name\n self.class.name.underscore.split('_').first.singularize\n end", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def fetch_model\n model_name.camelize.constantize.find( params[:id] )\n end", "def associated_class_string\n controller_name.classify\n end", "def model_class_for_sym(model_sym)\n begin\n model_sym.to_s.classify.constantize\n rescue NameError\n raise NameError, \"Cannot convert :#{model_sym} to a valid model class\"\n end\n end", "def get_model_name\n @model_name ||= self.class_simple_name.underscore[0..-12].singularize\n end", "def klass_name\n \"#{params[:klass_name].classify}\"\n end", "def model_class\n self.class.models[implementation_model_name]\n end", "def model_name(model)\n model.class.to_s.downcase\n end", "def class\n @model.class\n end", "def model_class\n resource_class = @options[:resource]\n if resource_class.nil?\n @name.to_s.camelize.constantize\n elsif resource_class.kind_of? String\n resource_class.constantize\n else\n resource_class # could be a symbol\n end\n end", "def dynamic_model_class_name\n dynamic_model.implementation_class.name\n end", "def model\n @model ||= if self.class.path_to_model\n m = eval(self.class.path_to_model)\n if m\n if m.respond_to?(:_controller=)\n m.send(:_controller=, self)\n end\n else\n fail \"No model object found at path: #{self.class.path_to_model}\"\n end\n m\n end\n end", "def controllers\n base_controller_class.constantize.descendants\n end", "def model_class_name\n implementation_model_name.ns_camelize\n end", "def model\n self.class.const_get(:MODEL)\n end", "def model_classes\n ModelClassCollector.new(configuration, mode_map.keys).collect\n end", "def sanitize_model_class( model )\n model.name.split(\"::\").last\n end", "def get_content_model(model_name)\n model_hash = content_types.select{|x| x[:name] == model_name}.first\n return model_hash[:class_name].nil? ? model_name.constantize : model_hash[:class_name].constantize\n end", "def fetch_model_list\n if parent_model\n return parent_model.send(\"#{model_name.pluralize.downcase}\")\n else\n return model_name.camelize.constantize.find(:all)\n end\n end", "def primary_model\n return @primary_model if @primary_model\n\n @primary_model = if class_parent_name != 'Object'\n \"#{class_parent_name}::#{object_name.camelize}\".constantize\n else\n controller_name.classify.constantize\n end\n end", "def model_name(object)\n object.present? ? object.class.name : object.to_s.classify\n end", "def set_content_model\n @content_model_class_name = self.class.name.gsub(/Controller/,'').singularize.constantize\n end", "def model_name\n self.class.model_name\n end", "def get_class type\n case type\n when Class\n type\n when BaseModel\n type.my_class\n when String, Symbol\n return get_class send(\"#{type}_model\") if [:subject, :object, :join].include?(type.to_sym)\n type.to_s.constantize\n else\n raise \"Can't determine a class from: #{type}\"\n end \n end", "def model_name\n self.class\n end", "def model(name=nil)\n @model ||= VCAP::CloudController.const_get(model_class_name(name))\n end", "def scoped_model\n if @is_top_widget || @selector_for\n Object.const_get @resource.classify\n else\n parent.record.send(@resource.pluralize) rescue Object.const_get @resource.classify\n end\n end", "def controller_name\n self.class.name.downcase.pluralize\n end", "def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end", "def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end", "def view_model_class_for model\n specific_view_model_class_for(model) || default_view_model_class_for(model)\n end", "def to_class(item)\n return item if item.nil? || item.is_a?(Class)\n name = item.is_a?(Symbol) ? item.to_s : item\n name = name.class.to_s unless name.is_a?(String)\n name.underscore.delete_suffix('_controller').classify.safe_constantize or\n Log.warn { \"#{__method__}: invalid: #{item.inspect}\" }\n end", "def model_to_controller(record)\n record.class.base_model.name.underscore\n end", "def model_name\n @model.name.demodulize.downcase # ex: posts\n end", "def requested_models(requested_model)\n case requested_model\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n base_model = $1.classify.constantize\n scopes = $2.split(',')\n models = base_model\n\n scopes.each do |scope|\n models = models.send(scope.strip)\n end\n\n models.all\n\n when String #is name\n requested_model.singularize.constantize.all\n else\n requested_model.all\n end\nend", "def object_name\n self.class.name.underscore.split('/').last.sub(/_controller$/, '').singularize\n end", "def get_model\n return model_classes[item_type].new()\n end", "def get_model\n self.class.name.gsub(/Test/, \"\").constantize\n end", "def class_with_model_name # :nodoc:\n self.class_without_model_name.tap do |c|\n c.instance_variable_set('@_model_name', @model_name)\n (class << c; self; end).send(:define_method,:model_name) do\n model_namer = Struct.new(:name).new(self.instance_variable_get('@_model_name'))\n ActiveModel::Name.new(model_namer)\n end\n end\n end", "def model_name\n self.class\n end", "def find_model(name)\n @models[name.to_s.downcase.to_sym]\n end", "def klass\n object_name.classify.constantize\n end", "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end", "def current_class_name\n @klass.to_s\n end", "def model_class\n table_name.classify.constantize\n end", "def model( resource = nil )\n resource ||= self.class.basename.snake_case\n app::Models[ resource ]\n end", "def models\n work_classes + collection_classes\n end", "def findClassModelByPluginName(plugName)\n for cls in @classes\n if cls.plugName == plugName\n return cls\n end\n end\n\n return nil\n end" ]
[ "0.7949385", "0.78231573", "0.7802869", "0.7772767", "0.7616944", "0.76159006", "0.747919", "0.74691695", "0.74691695", "0.7464456", "0.7413922", "0.74115515", "0.73858213", "0.73046136", "0.7235639", "0.721952", "0.7215014", "0.7201145", "0.71951294", "0.71559626", "0.7148073", "0.7131176", "0.7109391", "0.7107075", "0.70147705", "0.7014109", "0.69843173", "0.6964843", "0.696132", "0.69061166", "0.6858862", "0.68447095", "0.6780615", "0.6773605", "0.67666787", "0.67226255", "0.670988", "0.667193", "0.6648202", "0.66452515", "0.664097", "0.6631003", "0.6630991", "0.6618142", "0.66043085", "0.65934265", "0.65776795", "0.6519014", "0.6500812", "0.6498427", "0.64940596", "0.6476263", "0.64736044", "0.64730966", "0.64518446", "0.6450512", "0.644468", "0.64370537", "0.6423896", "0.6379136", "0.6378539", "0.637552", "0.635424", "0.63428503", "0.6331187", "0.63175184", "0.6317482", "0.6314851", "0.6292399", "0.6285812", "0.6265945", "0.6257098", "0.62566847", "0.622711", "0.6222875", "0.62177885", "0.62141305", "0.62012184", "0.6200414", "0.61969185", "0.6192882", "0.6187057", "0.61819184", "0.6166835", "0.61639524", "0.6162309", "0.61567044", "0.61505187", "0.6141309", "0.61363447", "0.6132128", "0.61314416", "0.61285", "0.6125555", "0.61215115", "0.6117028", "0.6113882", "0.6111966", "0.61099684", "0.61062014", "0.6090138" ]
0.0
-1
helper method to resolve the url for forms, between edit and new
def form_url(record) if has_namespace? [app_kit, model.name.deconstantize.underscore.to_sym, record] else [app_kit, record] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_form_url\n if params[:firm_id]\n @information[:form_url] = firm_trade_path(@parent, @trade)\n @information[:back_path] = firm_path(@parent)\n elsif params[:product_id]\n @information[:form_url] = product_trade_path(@parent, @trade)\n @information[:back_path] = product_path(@parent)\n end\n end", "def url_edit\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_edit&#{cname}_id=#{self.id}\"\n end", "def form_url\n URL\n end", "def admin_form_url\n ['', controller_path, object_instance.id].join('/')\n end", "def get_content_form_url(parent, content)\n if content.new_record?\n polymorphic_url([parent, content])\n else\n # HACK there should be a way to force polymorphic_url to use an id instead of to_param\n polymorphic_url([@parent, @content]).gsub(@content.to_param, \"#{@content.id}\") # force the id. The slugs can cause problems during edit\n end\n end", "def new_form_url\n if params[:firm_id]\n @information[:form_url] = firm_trades_path(@parent, trade_type: params[:trade_type])\n @information[:back_path] = firm_path(@parent)\n @information[:subtitle] = if params[:trade_type] == 'sells'\n t('view.trades.new_trade_sold_by_firm_title', firm: @parent.name)\n elsif params[:trade_type] == 'buys'\n t('view.trades.new_trade_sold_to_firm_title', firm: @parent.name)\n end\n elsif params[:product_id]\n @information[:form_url] = product_trades_path(@parent, trade_type: params[:trade_type])\n @information[:back_path] = product_path(@parent)\n @information[:subtitle] = if params[:trade_type] == 'sells'\n t('view.trades.new_product_traded_by_title', product: @parent.name)\n elsif params[:trade_type] == 'buys'\n t('view.trades.new_product_traded_to_title', product: @parent.name)\n end\n end\n end", "def edit_path model\n case model\n when HouseholdMember\n edit_applicant_household_member_path(@applicant, model)\n when Residence\n edit_applicant_residence_path(@applicant, model)\n when Income\n edit_applicant_income_path(@applicant, model)\n when Employment\n edit_applicant_employment_path(@applicant, model)\n when CriminalHistory\n edit_applicant_criminal_history_path(@applicant, model)\n when Contact\n edit_applicant_contact_path(@applicant, model)\n else\n \"#\"\n end\n end", "def resource_form_path\n resource.new_record? ? collection_path : resource_path\n end", "def profile_form_url\n if (page? 'users', 'edit') || (page? 'users', 'update')\n user_path(@user)\n else\n registration_path(@user)\n end\n end", "def edit_url(receiver)\n show_url(receiver)\n end", "def form_path\n @form_path ||= create_assignment_path(assign_to_type)\n end", "def edit_path(path)\n url('/e/' + path)\n end", "def form_path\n @form_path ||= admin_create_assignment_path(\n assignee_type, assignee_id, assign_to_type)\n end", "def edit\n resource.prepare_links\n\n super\n end", "def edit\n new\n end", "def edit_link(obj)\n \tcase obj.class.to_s\n \t when \"Tenant\"\n \t edit_tenant_path(obj)\n \t when \"Semester\"\n \t edit_semester_path(obj)\n \t when \"Department\"\n \t edit_department_path(obj)\n \t when \"Subject\"\n \t edit_subject_path(obj) \t \n \t when \"Faculty\"\n \t edit_faculty_path(obj)\n \t when \"Exam\"\n \t edit_exam_path(obj)\n \t when \"Batch\"\n \t edit_batch_path(obj) \t \t \t \n \t when \"SchoolType\"\n \t edit_school_type_path(obj) \t \n \t when \"Student\"\n \t edit_student_path(obj) \t \t\n \t when \"Section\"\n \t edit_section_path(obj)\n \t when \"BloodGroup\"\n \t edit_blood_group_path(obj)\n \t when \"Resource\"\n \t edit_resource_path(obj)\n \t when \"Role\"\n \t edit_role_path(obj) \t \t \t\n \t when \"UserProfile\"\n \t edit_user_profile_path(obj) \n \t when \"Grade\"\n \t edit_grade_path(obj) \t \t \t \t \t \t \n \t when nil\n \t nil\n end\n end", "def edit_template_url\r\n url = @cobrand.params.find_by_key 'store_news_and_events_template_url'\r\n @template_url = url.value if url\r\n end", "def edit_form\n 'common_templates/edit_form'\n end", "def current_url(new_params)\n url_for params: params.permit!.merge(new_params) # allow all params already passed\n end", "def edit_resource_url(object)\n send route_prefix_to_method_name(\"edit_#{class_name.model_name.singular_route_key}_url\"),\n object\n end", "def edit_path\n \"/answers/#{object.id}/edit\"\n end", "def virtual_form_path(form)\n unless form.scope.blank? || form.target_id.blank?\n model = model_class(form.scope).find(form.target_id) if model_class(form.scope).exists?(form.target_id)\n model_path model\n else\n form.controller.singular.to_sym\n end\n end", "def new_question_url\n view_context.new_question_url\n end", "def edit\n @employee = Employee.find(params[:id])\n @url = { controller: '/employees', action: :update }\n render :form\n end", "def edit\n \tredirect_to action: \"show\"\n end", "def redirect_to_edit\n redirect_to edit_polymorphic_path([:admin, resource])\n end", "def auto_url_for(resource)\n\n\n\n config = active_admin_resource_for(resource.class)\n\n\n\n return unless config\n\n\n\n\n\n\n\n if config.controller.action_methods.include?(\"show\") &&\n\n\n\n authorized?(ActiveAdmin::Auth::READ, resource)\n\n\n\n url_for config.route_instance_path resource\n\n\n\n elsif config.controller.action_methods.include?(\"edit\") &&\n\n\n\n authorized?(ActiveAdmin::Auth::UPDATE, resource)\n\n\n\n url_for config.route_edit_instance_path resource\n\n\n\n end\n\n\n\n end", "def to_partial_path\n \"forms/default\"\n end", "def edit\n redirect_to root_url\n end", "def form_mode\n {:new => :new, :create => :new, :edit => :edit, :update => :edit, :show => :show}[controller.action_name.to_sym]\n end", "def mokio_preview_link_in_edit_page\n self.path\n end", "def get_form\n \"#{controller.controller_name}/form\"\n end", "def edit\n redirect_to \"/\"\n end", "def edit\n redirect_to :root\n end", "def new\n @employee = Employee.new\n @url = { controller: '/employees', action: :create }\n render :form\n end", "def after_update_path_for(_)\n edit_user_registration_path\n end", "def new_resource_url\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_url\")\n end", "def edit\n session[:return_to] ||= request.referer\n @Urlmaster = Urlmaster.find(params[:id])\n end", "def url_for options = {}\n return \"/#{options[:controller].downcase}/#{options[:action]}/#{options[:id]}\" if options[:id].present?\n \"/#{options[:controller.downcase]}/#{options[:action]}\"\nend", "def default_path\n @default_path ||= h.can?(:update, object) ? h.edit_form_path(object) : h.form_path(object)\n end", "def new_or_edit_survey_path(study)\n study.survey_id ? edit_survey_path(study.survey_id) : new_survey_path(study_id: study.id)\n end", "def user_new\n \"/users/new\"\nend", "def webform_settings_url\n '/admin/config/content/webform'\n end", "def success_url\n url_for(:controller => 'repositories', :action => 'edit', :id => @repository.id)\n end", "def auto_url_for(resource)\n config = active_admin_resource_for(resource.class)\n return unless config\n\n if config.controller.action_methods.include?(\"show\") &&\n authorized?(ActiveAdmin::Auth::READ, resource)\n url_for config.route_instance_path resource, url_options\n elsif config.controller.action_methods.include?(\"edit\") &&\n authorized?(ActiveAdmin::Auth::EDIT, resource)\n url_for config.route_edit_instance_path resource, url_options\n end\n end", "def form_view\n 'capital_project_search_form'\n end", "def edit\n render action: 'new'\n end", "def search_url_picker\n current_page?(\"/advanced\") ? search_catalog_url : search_action_url\n end", "def link_to_edit(path)\n link_to 'Edit', path, class: 'btn btn-default btn-xs'\n end", "def form_view\n end", "def new_path_for(form, transient_registration)\n send(\"new_#{form}_path\", transient_registration.token)\n end", "def show\n redirect_to action: \"edit\"\n end", "def update_url\n case params[:for].to_sym\n when :msie then \"http://www.microsoft.com/ie\"\n when :firefox then \"http://www.mozilla.org/firefox\"\n when :chrome then \"http://www.google.com/chrome\"\n when :safari then \"http://www.apple.com/safari\"\n when :opera then \"http://www.opera.com/\"\n end\n end", "def edit\n # Renders the edit form\n end", "def path_for_edit(role_id)\n home_path\n end", "def new_thing_path(model)\n send(:\"new_admin_#{undersingularize(model)}_path\")\n end", "def active_scaffold_input_url(column, options)\n active_scaffold_text_input :url_field, column, options\n end", "def edit\n redirect_to action: 'edit_profile'\n end", "def show\n redirect_to action: 'edit'\n end", "def show\n redirect_to action: 'edit'\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end", "def update_issue_form_path(project, issue)\n options = {:format => 'js'}\n if issue.new_record?\n if project\n new_project_issue_path(project, options)\n else\n new_issue_path(options)\n end\n else\n edit_issue_path(issue, options)\n end\n end", "def new\n redirect_to posting_types_path\n end", "def new\n redirect_to edit_page_path(find_or_create_page)\n end", "def edit \n\t@post=Post.find(params[:id])# URL is used to get de post id to find, @post gets assigned a post object, if a form is created for it, it will map such object properties \n end", "def edit\n load_formats_and_domains\n end", "def employee_post\n if params[\"new\"] \n redirect_to \"/employee/new\" and return\n else\n redirect_to \"/employee/#{params[\"edit\"]}\" and return\n end\n end", "def edit\n redirect_to '/say/hello/new'\n\n end", "def form_search(route_for_new, route_for_search, title)\n route_for_new = route_for_new unless route_for_new.nil?\n title = title unless title.nil?\n render 'admin/shared/form_search', :route_for_new => route_for_new, :route_for_search => route_for_search, :title => title\n end", "def set_edit_form_information\n @information[:subtitle] = t('view.permissions.edit_title')\n @information[:form_url] = [@parent, 'permission', no_firm: @no_firm]\n end", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def edit\n\tend", "def action_url\n view_context.url_for(question)\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end" ]
[ "0.7248085", "0.6922437", "0.6794932", "0.6480749", "0.6380478", "0.6303315", "0.62862873", "0.6261315", "0.6220261", "0.62176377", "0.62161535", "0.61732805", "0.61220753", "0.6101607", "0.60459787", "0.59946734", "0.59738326", "0.59689283", "0.5966618", "0.59653884", "0.5947639", "0.5909847", "0.5887919", "0.58878636", "0.58419454", "0.58333975", "0.58041793", "0.5792277", "0.5785067", "0.5756838", "0.5750494", "0.5736546", "0.5724623", "0.57087255", "0.5687831", "0.56823254", "0.56760406", "0.5671609", "0.56622845", "0.564121", "0.55937916", "0.55829823", "0.55330414", "0.5526518", "0.55120265", "0.55107427", "0.55080175", "0.55018115", "0.5501623", "0.5500837", "0.5498782", "0.54978365", "0.5497549", "0.54854184", "0.54673314", "0.54560244", "0.5454376", "0.5442937", "0.5438788", "0.5438788", "0.5430721", "0.5430721", "0.5428191", "0.54182833", "0.54118663", "0.5398294", "0.5387246", "0.5353823", "0.53434086", "0.533605", "0.53347975", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5331771", "0.5328188", "0.5325386", "0.53185403", "0.53185403", "0.53185403", "0.53185403", "0.53185403", "0.53185403", "0.53185403", "0.53185403", "0.53185403" ]
0.6226147
8
A helper method to display the current resource name.
def resource_name controller_name.humanize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_name\n current_definition.resource_name\n end", "def resource_name\n @resource_name ||= plural_name\n end", "def resource_name\n @resource_name ||= get_resource_name\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n @resource_name ||= singular_resource_name.pluralize\n end", "def resource_name\n @resource_name ||= Inflection.plural(singular_resource_name)\n end", "def resource_name\n @resource_name ||= self.class.to_s.underscore.gsub(%r{.*/([^/]+)\\z}, '\\1')\n end", "def resource_label\n resource_name.translate count: 1,\n default: resource_name.to_s.gsub(\"::\", \" \").titleize\n end", "def resource_name\n\t\t\t\t@resource_name ||= self.controller_name.singularize\n\t\t\tend", "def resource_name\n \"#{self.class.to_s.split(\"::\").last.downcase}s\"\n end", "def resource_name\n @resource_name ||= plural_resource_name.singularize\n end", "def name\n @resource.name\n end", "def resource_text_from_controller\n internationalized_resource_name(controller_name.singularize.camelize, false)\n end", "def resource_text_from_controller\n internationalized_resource_name(controller_name.singularize.camelize, false)\n end", "def resource_name\n resource[:name].gsub(/\\s/, '_').downcase.singularize\n end", "def resource_name\n @resource_name ||= controller_name.singularize\n end", "def resource_name\n @resource_name ||= controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n resource_class.resource_name\n end", "def resource_item_name\n current_definition.resource_item_name\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= model_name.element.pluralize\n end", "def resource_name\n @@resource_name ||= self.class.to_s.split('::').last.gsub('Controller', '').singularize.underscore\n end", "def resource_name\n name.ns_underscore.pluralize\n end", "def resource_name\n resource.name.singularize.underscore\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def current_resource(resource)\n send(\"current_#{resource.class.name.underscore.downcase}\")\n end", "def display_name\n @_context[:display_name]\n end", "def resource_title\n if resourceful? && resource\n resource.respond_to?(:name) ? resource.name.humanize : resource.id\n else\n 'show'\n end\n end", "def to_resource_name\n singularize.underscore\n end", "def resource_name\n @resource_name ||= controller_name.singularize\n end", "def resource_human_name\n resource_class.model_name.human\n end", "def display_resource(project)\n project.name\n end", "def resource_name\n @resource_name\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def pretty_resource_name\n Heroics.pretty_name(resource_name)\n end", "def resource_name\n resource_specification.name\n end", "def resource_name\n resource_class.slice(0,1).downcase + resource_class.slice(1,resource_class.length)\n end", "def enclosing_resource_name\n enclosing_resource.class.name.underscore\n end", "def resource_name\n name.to_s.chomp('Controller').demodulize.singularize\n end", "def qualified_resource_name\n @qualified_resource_name ||=\n begin\n @resource_class.name.split('::').map do |str|\n tools.string.underscore(str)\n end.join('-')\n end # name\n end", "def resource_name name=nil\n if name\n @resource_name = name\n end\n @resource_name || default_resource_name\n end", "def get_resource_name\n\t\t@name + '_' + @hot.resources_list.length.to_s unless @name.empty?\n\tend", "def display_resource(region)\n \"#{region.name}\"\n end", "def resource_item_name\n resource_name.to_s.singularize.to_sym\n end", "def resource_name\n resources_name.singularize\n end", "def name\n\t\t\traise \"Resource#name must be overriden!\"\n\t\tend", "def name\n @name ||= new_resource.name[-1] == '.' ? new_resource.name : \"#{new_resource.name}.\"\n end", "def published_resource_name\n @published_resource_name ||= plural_resource_name.singularize\n end", "def resource_name\n self.class.name.ns_underscore.pluralize\n end", "def resource_name\n resource_module.to_s.demodulize\n end", "def name\n record.resource_id\n end", "def variable_name(resource)\n name = controller.instance_variables.index { |var| controller.instance_variable_get(var) === resources.first }\n name = controller.instance_variables[name].to_s.gsub(/@/, '') if name\n name.to_s\n end", "def resource_name=(value)\n @resource_name = value\n end", "def resource_name=(value)\n @resource_name = value\n end", "def resource_name=(value)\n @resource_name = value\n end", "def resource_item_name\n resource_name.to_s.singularize.to_sym\n end", "def menu_item_name\n menu_options[:label] || plural_resource_name_alias.html_safe\n end", "def display_resource(user)\n user.display_name\n end", "def display_resource(skatepark)\n skatepark.name.titleize\n end", "def display_resource(event)\n event.name\n end", "def short_name\n @context.name\n end", "def get_resource_name\n \tself.controller_name.singularize\n end", "def display_resource(user)\n user.full_name\n end", "def display_resource(section)\n section.name\n end", "def display_resource(user)\n user.name\n end", "def name\n @name ||= [action, resource.name, resource.type].compact.map(&:to_s).join('_').underscore\n end", "def name_display\n self.name[I18n.locale]\n end", "def display_name\n display_name = @current_profile.display_name\n end", "def screen_name\n controller_name = t(\"controllers.#{params[:controller]}\").upcase\n action_name = t(\"actions.controllers.#{params[:action]}\").upcase\n \"#{controller_name} / #{action_name}\"\n end", "def singular_resource_name\n @singular_resource_name ||= ZendeskAPI::Helpers.snakecase_string(to_s.split(\"::\").last)\n end", "def display_name\n NAME\n end", "def display_name\n NAME\n end", "def plural_resource_name\n @plural_resource_name ||= controller_name\n end", "def title\n current_localization.name\n end", "def plural_resource_name\n @plural_resource_name ||= resource_name.pluralize\n end", "def resources_name\n self.class.resources_name\n end", "def root_resource_name\n components.keys.first.to_s\n end", "def resource\n self.class.to_s.split('::').last.downcase\n end", "def hyphenated_name\n resource_name.ns_hyphenate\n end", "def localized_resource_class_name(resource)\n resource_class = ::Link2::Support.find_resource_class(resource)\n resource_name = ::Link2::Support.human_name_for(resource_class) rescue resource_class.to_s.humanize\n resource_name.underscore\n end", "def resources_name\n @resources_name ||= resource_specification.name.pluralize\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def display_resource(product)\n \"#{product.english_title}\"\n end", "def resource_template(name)\n \"#{resource}_#{name}\"\n end", "def human_name(options = {})\n defaults = self_and_descendants_from_active_resource.map {|klass| :\"#{klass.name.underscore}\" }\n defaults << self.name.humanize\n I18n.translate(defaults.shift, {:scope => [:activeresource, :models], :count => 1, :default => defaults}.merge(options))\n end", "def plural_published_resource_name\n @plural_published_resource_name ||= controller_name\n end", "def display_resource(recipe)\n recipe.name\n end", "def display_resource(recipe)\n recipe.name\n end", "def display_name\n name\n end", "def displayname\n path\n end", "def parent_resource_name(params)\n parent_resource_param(params).to_s.gsub(/\\_id/, '').pluralize\n end" ]
[ "0.7829923", "0.7779805", "0.7727322", "0.762417", "0.762417", "0.762417", "0.7577831", "0.75712234", "0.7522107", "0.7501367", "0.74937254", "0.7473984", "0.7470612", "0.7434005", "0.7431524", "0.7431524", "0.7400592", "0.73914146", "0.73914146", "0.7386099", "0.7386099", "0.7379975", "0.7344543", "0.732286", "0.732286", "0.73154175", "0.7307983", "0.7280996", "0.72726667", "0.72690547", "0.72126967", "0.7192382", "0.7170413", "0.71493506", "0.7101336", "0.70963126", "0.7095311", "0.70859325", "0.7048871", "0.7048871", "0.7048871", "0.70314604", "0.69775724", "0.69707847", "0.69567513", "0.6925673", "0.6918713", "0.6912346", "0.6868728", "0.6860129", "0.68536896", "0.6851817", "0.6839282", "0.6835203", "0.6826177", "0.682001", "0.6815688", "0.6740315", "0.67118007", "0.6706983", "0.6706983", "0.6706983", "0.67046183", "0.6703266", "0.67027134", "0.6698218", "0.6687164", "0.66726315", "0.6650909", "0.6650233", "0.66452104", "0.66345286", "0.66263974", "0.6624815", "0.66196626", "0.66161317", "0.6604451", "0.6601855", "0.6601855", "0.6599409", "0.65678734", "0.65578467", "0.6556666", "0.65524846", "0.6549172", "0.6532264", "0.6513967", "0.6513463", "0.6491394", "0.6491394", "0.6491394", "0.64798456", "0.6479753", "0.64629906", "0.6457318", "0.64406556", "0.64406556", "0.64384985", "0.6427822", "0.64258623" ]
0.7400736
16
handles record filtering passed by the filter panel
def process_filters(records,filter_params) return records unless filter_params filter_params.each do |field,filter_param| if filter_param.has_key?("value") value = filter_param["value"] next unless value.present? condition = filter_param["condition"] || 'eq' case condition when "eq" value = true if value == 'true' value = [false, nil] if value == 'false' records = records.where(field.to_sym => value) when "cont" records = records.where("#{field} LIKE '%#{value}%'") when "ncont" records = records.where("#{field} NOT LIKE '%#{value}%'") when "gt" records = records.where("#{field} > ?", value) when "lt" records = records.where("#{field} < ?", value) end end end return records end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(record)\n true\n end", "def filter\n end", "def apply_filter\n end", "def filters\n end", "def filters; end", "def filters; end", "def Filter=(arg0)", "def filter\n @filter\n end", "def filter; end", "def filter; end", "def filter; end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def add_filter\n @filter = true \n end", "def entry_filter; end", "def filter(filter)\n current_widget.filter filter\n end", "def filter\n super\n end", "def filter\n params['filter_field'] || '*'\n end", "def filter_parameters; end", "def filter_parameters; end", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def filtered_entries; end", "def filter\n @filter = params[:q]\n end", "def _set_filter\n if param(:catid)\n catsplit = param(:catid).split('__')\n parmfilter = catsplit[0]\n # category_not_clicked = false\n else\n parmfilter = param(:filter)\n # category_not_clicked = true\n end\n new_filter = @filters.assoc(parmfilter) ? parmfilter : (@filter || @filters.first[0])\n filter_unchanged = (@filter == new_filter)\n @filter = new_filter\n # For now I am just accepting the subfilter as-is, I am pretty sure it is validated elsewhere\n @subfilter = param(:subfilter) || {}\n # @subfilter = param(:subfilter)\n # puts \"FILTER FILTER FILTER: Init? #{(param(:init) ? 'YES' : 'NO)')}, Category not clicked? #{(category_not_clicked ? 'YES' : 'NO')}, Unchanged? #{(filter_unchanged ? 'YES' : 'NO')}, subfilter: #{@subfilter.inspect}\"\n # puts \"FILTER FILTER FILTER UPDATED UPDATED UPDATED. filter \" + @filter.inspect + ' ** SUBFILTER ** ' + @subfilter.inspect\n # Redraw the filter if the top filter changed, or on init\n redraw_filter = (param(:init) || !filter_unchanged) ? js_redraw_filter : ''\n # Update the results unless on init, or unless the filter was unchanged even though category was clicked\n # update_results = (param(:init) || (filter_unchanged && !category_not_clicked)) ? '' : update_recordset_js(false)\n update_results = (param(:init) || filter_unchanged) ? '' : update_recordset_js(false)\n clear_checkboxes = (filter_unchanged) ? '' : <<-JS\n jQuery('##{@jqgrid_id}_#{@filter}_filter_form').find('input[type=checkbox]').attr('checked',false);\n JS\n # clear_checkboxes = (filter_unchanged && category_not_clicked) ? '' : <<-JS\n # jQuery('##{@jqgrid_id}_#{@filter}_filter_form').find('input[type=checkbox]').attr('checked',false);\n # JS\n render :js => redraw_filter + clear_checkboxes + update_results\n end", "def records_filtered\n records\n @config[:records_filtered]\n end", "def filter\n\t\treturn @filter\n\tend", "def filter_index\n filter\n end", "def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end", "def update_filter\n @screen = session.active_screen\n field_report_filter_id = params[:id]\n \n if field_report_filter_id =~ /_/\n # Create\n @field_report_filter = FieldReportFilter.create(\n :reference_screen_index => params[:reference_screen_index],\n :field_id => params[:field_id],\n :report_id => params[:report_id],\n :value => params[:value])\n else\n @field_report_filter = FieldReportFilter.find(field_report_filter_id.to_i)\n \n if params.has_key?(:destroy)\n # Delete\n @field_report_filter.destroy\n else\n # Update\n @field_report_filter.value = params[:value]\n @field_report_filter.save\n end\n end\n @set_field_filters = {\n @field_report_filter.reference_screen_index => { @field_report_filter.field_id => @field_report_filter }\n }\n @available_field_filters = @field_report_filter.report.fields_for_filters\n\n respond_to do |format|\n format.html # edit_format.html.erb\n format.xml { render :xml => @field_report_filter }\n end\n end", "def updateFilter(sender)\n NSLog @searchField.stringValue\n\n end", "def sub_filter(iter)\n filter = default_filter(iter)\n if iter.parent[0] == SELECT_RECORDS\n filter += \"AND records.rrecord=#{iter[3].split(\"@@@\")[1]}\" # Extract rrecord from the sort column\n end\n return filter\n end", "def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end", "def add_filters(filters); end", "def filter_records\n return unless @master_objects\n return @master_objects if @master_objects.is_a? Array\n\n @filtered_ids = @master_objects\n .select { |i| i.option_type_config&.calc_if(:showable_if, i) }\n .map(&:id)\n @master_objects = @master_objects.where(id: @filtered_ids)\n filter_requested_ids\n limit_results\n end", "def filter!; end", "def filters_field_changed\n assert_privileges('my_settings_default_filters')\n return unless load_edit(\"config_edit__ui3\", \"configuration\")\n\n id = params[:id].split('-').last.to_i\n @edit[:new].find { |x| x[:id] == id }[:search_key] = params[:check] == '1' ? nil : '_hidden_'\n @edit[:current].each_with_index do |arr, i| # needed to compare each array element's attributes to find out if something has changed\n next if @edit[:new][i][:search_key] == arr[:search_key]\n\n @changed = true\n break\n end\n @changed ||= false\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n end\n end", "def check_filter_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n model = @tables.first[0]\r\n session[table_name] ||= {}\r\n# process page\r\n session[table_name][:page] = params[:page] if params[:page]\r\n# new filter is applied\r\n if params[:filter]\r\n set_session_filter(table_name)\r\n session[table_name][:page] = 1\r\n end\r\n# if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n# dont't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') or dc_user_can(DcPermission::CAN_ADMIN)\r\n# \r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = if site_id\r\n model.where(dc_site_id: site_id)\r\n else\r\n model\r\n end\r\n end\r\n=begin \r\n# TODO Use only fields requested. Higly experimental but necessary in some scenarios\r\n if (columns = @form['result_set']['columns'])\r\n cols = []\r\n columns.each { |k,v| cols << v['name'] }\r\n p '*',cols,'*'\r\n @records = @records.only(cols)\r\n end\r\n=end \r\n# pagination if required\r\n per_page = (@form['result_set']['per_page'] || 30).to_i\r\n if per_page > 0\r\n @records = @records.page(session[table_name][:page]).per(per_page)\r\n end\r\nend", "def filter(params)\n\n\t self.log << \"Started filtering cases\"\n\n\t\t@selected.each do |adrc_case|\n\n\t\t self.log << {:message => \"packing #{adrc_case[:subject_id]}\"}\n\t\t vgroup = Vgroup.joins(\"LEFT JOIN enrollment_vgroup_memberships ON vgroups.id = enrollment_vgroup_memberships.vgroup_id\")\n\t\t \t\t\t\t.joins(\"LEFT JOIN scan_procedures_vgroups ON scan_procedures_vgroups.vgroup_id = vgroups.id\")\n\t\t \t\t\t\t.where(\"enrollment_vgroup_memberships.enrollment_id = ?\",Enrollment.where(:enumber => adrc_case[:enumber]).first.id)\n\t\t \t\t\t\t.where(\"scan_procedures_vgroups.scan_procedure_id = ?\",adrc_case[:scan_procedure].id)\n\t\t \t\t\t\t.first\n\n\n\t\t #does this vgroup have the right image datasets?\n\t\t visits = Visit.where(:appointment_id => vgroup.appointments.select{|item| item.appointment_type == 'mri'}.map(&:id))\n\t\t images = Jobs::NaccUpload::ImageDataset.where(:visit_id => visits.map(&:id)).select{|item| (@sdm_filter.map{|x| x.series_description.downcase}.include? item.series_description.downcase) and (item.series_description != 'DTI whole brain 2mm FATSAT ASSET')}\n\t\t ppt = vgroup.enrollments.first.participant\n\n\t # if we only have 2 different scan types, or the status flag for this case is 'R', fail the case\n\t series_description_counts = images.each_with_object(Hash.new(0)){|item,hash| hash[@sdm_filter.select{|sdm| sdm.series_description.downcase == item.series_description.downcase}.first.series_description_type_id] += 1}\n\t if series_description_counts.keys.count < 2\n\t \tself.exclusions << {:protocol => adrc_case[:scan_procedure].codename, :subject => adrc_case[:enumber], :message => \"too few scan types\"}\n\t \tnext\n\t end\n\n\t if adrc_case[:status_flag] == 'R'\n\t \tself.exclusions << {:protocol => adrc_case[:scan_procedure].codename, :subject => adrc_case[:enumber], :message => \"status is 'R' for this case\"}\n\t \tnext\n\t end\n\n\t #this case passes, so let's set it up for prep\n\n\t\t adrc_case[:case_dir] = \"#{adrc_case[:subject_id]}_#{vgroup.vgroup_date.strftime(\"%Y%m%d\")}_wisc\"\n\t\t adrc_case[:subject_dir] = \"#{params[:target_dir]}/#{adrc_case[:case_dir]}\"\n\t\t adrc_case[:participant] = ppt\n\n\t\t if !File.directory?(adrc_case[:subject_dir])\n\t\t Dir.mkdir(adrc_case[:subject_dir])\n\t\t end\n\n\t\t subject_subdirs = []\n\t adrc_case[:images] = []\n\n\t\t images.each do |image|\n\n\t\t \t#check that there's nothing rated \"severe\" or \"incomplete\" on the IQC checks for this image\n\t\t \tif image.passed_iqc?\n\n\t\t\t \tpath_parts = image.path.split(\"/\")\n\t\t\t \timage_target_dir = \"#{adrc_case[:subject_dir]}/#{path_parts.last}\"\n\n\t\t\t \tif subject_subdirs.include? image_target_dir\n\t\t\t \t\t#tack something on the end so that we don't overwrite\n\t\t\t \t\timage_target_dir = \"#{image_target_dir}_#{subject_subdirs.count}}\"\n\t\t\t \tend\n\n\t\t\t \tsubject_subdirs << image_target_dir\n\t\t \t\tadrc_case[:images] << {:path => File.realpath(image.path), :target_dir => image_target_dir}\n\t\t \tend\n\t\t end\n\n\t\t @driver << adrc_case\n\n\t\tend\n\n\t\tself.log << \"Filtering cases complete (#{@driver.count} new cases, #{self.exclusions.count} exclusions from processing)\"\n\tend", "def updateFilter(sender)\n search_string = search_bar.stringValue\n search_regexp = Regexp.new(search_string, Regexp::IGNORECASE)\n if search_string.empty?\n parent.display_files = parent.files\n end\n\n parent.display_files = parent.files.find_all do |file|\n file[:artist] =~ search_regexp || file[:song] =~ search_regexp\n end\n parent.update_display_filenames\n parent.songs_view.reloadData\n end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def filter\n params[:filter] ? params[:filter] : \"active\"\n end", "def select_filters\n @screen = session.active_screen\n @report = Report.find(params[:id])\n @available_field_filters = @report.fields_for_filters\n @set_field_filters = {}\n @report.field_report_filters.each{|frf|\n @set_field_filters[frf.reference_screen_index] ||= {}\n @set_field_filters[frf.reference_screen_index][frf.field_id] = frf\n }\n\n respond_to do |format|\n format.html # formats.html.erb\n format.xml { render :xml => @report }\n end\n end", "def filterable?; @filterable; end", "def super_search\n @browse_state.attributes=(params)\n @search_filter1 = @browse_state.make_search_filter\n \n ## Condition - when to include or exlude romance from the search list.\n if params[:search_filter].nil? || (!params[:search_filter].nil? && params[:search_filter][:romance] == \"19\") \n cond = params[:search_filter][:romance].to_i if !params[:search_filter].nil? && !params[:search_filter][:romance].nil?\n cond = 19 if !params[:search_filter].nil? && params[:search_filter][:romance].nil?\n cond = 19 if params[:search_filter].nil?\n else\n cond = 0\n end\n \n ## Month validation as it should not be greater than 12.\n if !params[:search_filter].nil? && ( !params[:search_filter][:start_time].nil? || !params[:search_filter][:end_time].nil?) \n if params[:search_filter][:start_time] && params[:search_filter][:start_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:start_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:start_time] = Time.now.utc\n end\n end\n \n if params[:search_filter][:end_time] && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:end_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:end_time] = Time.now.utc\n end\n end\n end\n \n ## Condition for getting activity id range.\n if !params[:search_filter].nil? && !params[:search_filter][:purpose_id].blank? \n p_id = params[:search_filter][:purpose_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:purpose_id].blank?\n p_id = 1..21\n end \n \n ## Condition for getting purpose id range.\n if !params[:search_filter].nil? && !params[:search_filter][:activity_id].blank? \n a_id = params[:search_filter][:activity_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:activity_id].blank?\n a_id = 1..14\n end \n \n ## Condition for getting zip codes in the given radius.\n if params[:checked_locat] == \"1\"\n if params[:search_filter][:city] == \"Atlanta\" or params[:search_filter][:city] == \"atlanta\" or params[:search_filter][:city] == \"ATLANTA\"\n st = \"GA\"\n elsif params[:search_filter][:city] == \"Boulder\" or params[:search_filter][:city] == \"boulder\" or params[:search_filter][:city] == \"BOULDER\"\n st = \"CO\"\n elsif params[:search_filter][:city] == \"San Diego\" or params[:search_filter][:city] == \"san diego\" or params[:search_filter][:city] == \"SAN DIEGO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Dallas\" or params[:search_filter][:city] == \"dallas\" or params[:search_filter][:city] == \"DALLAS\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Houston\" or params[:search_filter][:city] == \"houston\" or params[:search_filter][:city] == \"HOUSTON\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Miami\" or params[:search_filter][:city] == \"miami\" or params[:search_filter][:city] == \"MIAMI\"\n st = \"FL\"\n elsif params[:search_filter][:city] == \"San Francisco\" or params[:search_filter][:city] == \"san francisco\" or params[:search_filter][:city] == \"SAN FRANCISCO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Portland\" or params[:search_filter][:city] == \"portland\" or params[:search_filter][:city] == \"PORTLAND\"\n st = \"OR\"\n elsif params[:search_filter][:city] == \"San Jose\" or params[:search_filter][:city] == \"san jose\" or params[:search_filter][:city] == \"SAN JOSE\"\n st = \"CA\"\n end\n \n if !params[:search_filter].nil? && (!params[:search_filter][:zip].blank? || !params[:search_filter][:city].blank?)\n if st != \"\"\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or (city = '#{params[:search_filter][:city]}' and state = '#{st}')\",params[:search_filter][:zip]])\n else\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or city = ?\",params[:search_filter][:zip],params[:search_filter][:city]])\n end\n rad = params[:search_filter][:radius].to_i\n if !r.nil?\n sql = \"SELECT dest.id,dest.zip,3956 * 2 * ASIN(SQRT( POWER(SIN((orig.latitude - dest.latitude) * pi()/180 / 2), 2) + COS(orig.latitude * pi()/180) * COS(dest.latitude * pi()/180) * POWER(SIN((orig.longitude -dest.longitude) * pi()/180 / 2), 2) )) as distance FROM zip_codes dest, zip_codes orig WHERE dest.id = orig.id and dest.longitude between #{r.longitude}-#{rad}/abs(cos(radians(#{r.latitude}))*69) and #{r.longitude}+#{rad}/abs(cos(radians(#{r.latitude}))*69) and dest.latitude between #{r.latitude}-(#{rad}/69) and #{r.latitude}+(#{rad}/69) LIMIT 4096\"\n z = ZipCode.find_by_sql(sql)\n zcids = z.collect(&:id)\n end\n else\n zcids = \"\"\n end\n end\n \n zcids = \"\" if r.nil?\n \n params[:search_filter] ||= params[\"amp;search_filter\"] # Hack to stop a malformed feed url from causing an exception - dave\n if params[:search_filter].nil?\n @search_filter = SearchFilter.new\n else\n @search_filter = SearchFilter.new(params[:search_filter])\n end\n \n if !params[:search_filter].nil?\n if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = Time.now.utc\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time\n elsif params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:end_time].to_date.to_time\n @search_filter.end_time = nil\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n if params[:search_filter][:start_time].nil? && !params[:search_filter][:start_date].nil?\n params[:search_filter][:start_time] = params[:search_filter][:start_date]\n end\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time if !params[:format] && !params[:search_filter][:start_time].nil?\n @search_filter.start_time = Time.now.utc if !params[:format] && params[:search_filter][:start_time].nil?\n @search_filter.end_time = params[:search_filter][:end_time].to_date.to_time if !params[:search_filter][:end_time].nil? \n end\n end\n \n if !params[:search_filter].nil?\n location = params[:search_filter][:location] ? params[:search_filter][:location] : ''\n terms = params[:search_filter][:terms] ? params[:search_filter][:terms] : ''\n person = params[:search_filter][:person] ? params[:search_filter][:person] : ''\n state = params[:search_filter][:state] ? params[:search_filter][:state] : ''\n country = params[:search_filter][:country] ? params[:search_filter][:country] : ''\n airport_id = params[:search_filter][:airport_id] ? params[:search_filter][:airport_id] : ''\n param_string = \"posted #{country} #{state} #{location} #{terms} #{person} #{airport_id}\" if !private_mw?\n param_string = \"posted #{state} #{location} #{terms} #{person} #{airport_id}\" if private_mw?\n if params[:search_filter][:virtual_f] == \"0\" && params[:checked_locat] == \"1\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n elsif params[:search_filter][:virtual_f] == \"v_flag\" && (params[:checked_locat] == \"0\" || params[:checked_locat] == \"\")\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n else\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && !params[:search_filter][:end_time].nil? && !params[:format]\n\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_date].to_date.to_time..params[:search_filter][:start_date].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && params[:format]\n end\n else\n @search_filter.start_time = Time.now.utc\n @invitations = Invitation.search \"posted\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n end\n @feed_params = @search_filter.to_rss_params \n if params[:format]\n handle_rss()\n else\n render :action => \"new_super_search\", :layout => 'new_super_search' unless check_render_facebook('super_search')\n end\n end", "def index\n @received_filter = FilterPresenter.new(['true', 'false'], 'all')\n @received_filter.current = params[:received]\n @graded_filter = FilterPresenter.new(['true', 'false'], 'all')\n @graded_filter.current = params[:graded]\n @patient = if patient_signed_in?\n current_patient\n elsif params[:patient_id]\n Patient.find(params[:patient_id])\n end\n\tgraded_flag = (@graded_filter.active == 'true')\n\treceived_flag = (@received_filter.active == 'true')\n\n\tif @graded_filter.active == 'all' and @received_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).order('created_at DESC')#.page(params[:page])\n\telsif @graded_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(received: received_flag).order('created_at DESC')#.page(params[:page])\n\telsif @received_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(graded: graded_flag).order('created_at DESC')#.page(params[:page])\n\telse\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(graded: graded_flag, received: received_flag).order('created_at DESC')#.page(params[:page])\n\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n render json: @records.to_json(\n include: {\n grade: {\n only: [:grade, :comment]\n }\n },\n only: [:id, :device, :comment, :status, :patient_id,\n :created_at, :updated_at, :meta, :pill_time_at, :received],\n methods: [:is_excuse?])\n end\n format.csv\n end\n end", "def filter_argument; end", "def index\n @selected_filters = Hash.new\n @events = Event.all\n if params[:filter]\n if params[:filter][:my]\n @events = @events.user_events current_user\n @selected_filters[:my] = 1\n end\n if params[:filter][:all]\n @selected_filters[:all] = 1 \n else\n @selected_filters[:recent] = 1 \n @events = @events.after\n end \n else\n @events = @events.after\n end\n end", "def filter\n conditions = [\"isEstimate = ?\"]\n values = [ 0 ]\n if(params[:filter])\n session[:filter] = params[:filter]\n end\n if(session[:filter])\n if(session[:filter][:date_max])\n conditions << \"moment <= ?\"\n values << session[:filter][:date_max]\n end\n if(session[:filter][:date_min])\n conditions << \"moment >= ?\"\n values << session[:filter][:date_min]\n end\n if(session[:filter][:name] && session[:filter][:name] != \"\") \n conditions << \"name LIKE ?\"\n values << \"%\" + session[:filter][:name] + \"%\"\n end\n end\n conditions = values.insert(0, conditions.join(\" AND \"))\n\n \n session[:event_results] = getResults(conditions, params[:event_page])\n conditions[1] = 1\n session[:estimate_results] = getResults(conditions, params[:estimate_page])\n \n session[:event_time] = Time.now.to_f\n #raise session[:event_time].to_s + \" \" + Event.last_update.to_s\n end", "def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end", "def filter(editable_payload, level, event_name)\n raise NotImplementedError,\n 'You must implement the method filter(editable_payload, level, event_name)'\n end", "def prepare_orm_filters\n filters = [[]]\n date_format = I18n.t(:\"date.formats.default\", {:locale => I18n.locale })\n self.data_grid.columns.each_with_index do |col, col_index|\n if col.filter and !col.filter_value.blank?\n case col.filter\n when :boolean\n filters[0] << \"#{col.filter_by} = ?\"\n filters << (col.filter_value == '1') ? true : false\n when :auto\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value\n when :text\n filters[0] << \"#{col.filter_by} #{ActiveRecord::Base.connection.adapter_name.downcase.to_sym == :postgresql ? 'ILIKE' : 'LIKE'} ?\"\n filters << \"%#{col.filter_value}%\"\n when :number\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value.to_i\n when :range\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n\n when :date\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n end\n end\n end\n \n filters[0] = filters[0].join(' AND ')\n filters\n end", "def typus_fields_for(filter); end", "def filter\n @exams = @patient.exams\n @exams = @exams.by_exam_description(params[:filter]) unless params[:filter].blank?\n Exam.filter_cancelled(@exams) unless params[:show_cancelled].blank?\n render :partial => \"exams/results\", :locals => {:exams => @exams, :patient => @patient}\n end", "def data_grid_filter(data_grid, column)\n hidden_submit_input = '<input type=\"submit\" value=\"\" style=\"width:0px; height: 0px; border: none; padding: 0px; font-size: 0px\">'.html_safe\n output = ''\n col_index = data_grid.columns.index(column)\n case column.filter\n when :boolean\n filter_select_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_select_name => nil))\n output = select_tag(filter_select_name,\n options_for_select([[I18n.t('data_grid.all_options'), ''], [I18n.t('data_grid.option_true'), '1'], [I18n.t('data_grid.option_false'), '0']], column.filter_value),\n :onchange => \"window.location.href='#{base_url}#{(base_url.include?('?')) ? '&' : '?' }#{filter_select_name}=' + this.value\")\n when :auto\n filter_select_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_select_name => nil))\n output = select_tag(filter_select_name,\n options_for_select([[I18n.t('data_grid.all_options'), '']] + column.filter_data.map{|fd| [column.auto_filter_hash.nil? ? fd : column.auto_filter_hash[fd.to_s.to_sym], fd]}, column.filter_value),\n :onchange => \"window.location.href='#{base_url}#{(base_url.include?('?')) ? '&' : '?' }#{filter_select_name}=' + this.value\")\n \n when :text\n filter_input_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_input_name => nil))\n output = form_tag(base_url, :method => 'GET') do\n text_field_tag(filter_input_name, column.filter_value) + \n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name]) + \n hidden_submit_input\n end\n when :number\n filter_input_name = \"filter_#{data_grid.name}_#{col_index}\"\n base_url = url_for(data_grid.params.merge(filter_input_name => nil))\n output = form_tag(base_url, :method => 'GET') do\n text_field_tag(filter_input_name, column.filter_value, :class => 'data_grid_filter_input') + \n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name]) + \n hidden_submit_input\n end\n when :range\n filter_input_name_from = \"filter_#{data_grid.name}_#{col_index}_from\"\n filter_input_name_to = \"filter_#{data_grid.name}_#{col_index}_to\"\n base_url = url_for(data_grid.params.merge(filter_input_name_from => nil, filter_input_name_to => nil))\n output = form_tag(base_url, :method => 'GET') do\n data_grid_dump_as_hidden_fields(data_grid, [filter_input_name_from, filter_input_name_to]) + \n text_field_tag(filter_input_name_from, column.filter_value.to_s.split(DataGrid.range_separator)[0], :class => 'data_grid_filter_input') + \n ' - ' + \n text_field_tag(filter_input_name_to, column.filter_value.to_s.split(DataGrid.range_separator)[1], :class => 'data_grid_filter_input') +\n hidden_submit_input\n end\n \n when :date \n date_format = I18n.t(:\"date.formats.default\", {:locale => I18n.locale })\n filter_input_name_from = \"filter_#{data_grid.name}_#{col_index}_from\"\n filter_input_name_to = \"filter_#{data_grid.name}_#{col_index}_to\"\n form_id = \"filter_#{data_grid.name}_#{col_index}_form\"\n \n base_url = url_for(data_grid.params.merge(filter_input_name_from => nil, filter_input_name_to => nil))\n output = \"<form method='get' action='#{base_url}' id='#{form_id}'>\"\n output << data_grid_dump_as_hidden_fields(data_grid, [filter_input_name_from, filter_input_name_to])\n \n date_picker, datepicker_placeholder_id, trigger_id, dom_id, date_span_id = select_date_datetime_common(\n {:id => \"filter_#{data_grid.name}_#{col_index}_from\", :name => filter_input_name_from}, data_grid.params[filter_input_name_from], form_id)\n\n output << \"#{I18n.t('data_grid.filter_date_from')}: <span id=\\\"#{datepicker_placeholder_id}\\\">#{date_picker}</span>\"\n output << %(<script type=\"text/javascript\">\\n)\n output << %( Calendar.setup\\({\\n)\n output << %( button : \"#{trigger_id}\",\\n )\n output << %( ifFormat : \"#{date_format}\",\\n )\n output << %( inputField : \"#{dom_id}\",\\n )\n output << %( include_blank : true,\\n )\n output << %( singleClick : true,\\n)\n output << %( onClose : function(cal){handleCalendarClose(cal, \"#{dom_id}\", \"#{form_id}\");}\\n)\n output << %( }\\);\\n)\n output << %(</script><br />\\n)\n \n date_picker, datepicker_placeholder_id, trigger_id, dom_id, date_span_id = select_date_datetime_common(\n {:id => \"filter_#{data_grid.name}_#{col_index}_to\", :name => filter_input_name_to}, data_grid.params[filter_input_name_to], form_id)\n\n output << \"#{I18n.t('data_grid.filter_date_to')}: <span id=\\\"#{datepicker_placeholder_id}\\\">#{date_picker}</span>\"\n output << %(<script type=\"text/javascript\">\\n)\n output << %( Calendar.setup\\({\\n)\n output << %( button : \"#{trigger_id}\",\\n )\n output << %( ifFormat : \"#{date_format}\",\\n )\n output << %( inputField : \"#{dom_id}\",\\n )\n output << %( include_blank : true,\\n )\n output << %( singleClick : true,\\n)\n output << %( onClose : function(cal){handleCalendarClose(cal, \"#{dom_id}\", \"#{form_id}\");}\\n)\n output << %( }\\);\\n)\n output << %(</script>\\n)\n \n output << hidden_submit_input\n output << '</form>'\n \n else\n output = '&nbsp;'\n end\n\n raw output\n end", "def filtering_params\n params.slice(:country, :data_source, :vaccine,\n :date_updated_start_date, :date_updated_end_date,\n :first_vaccine_date_start, :first_vaccine_date_end)\n end", "def filter_for(item)\n self.class.filter_for filter, item\n end", "def record_filter_params\n permitted_params = [\n :name,\n :record_created_by,\n :is_destroyed,\n :record_created_on,\n :record_created_after,\n :record_created_before,\n :filename,\n :file_content_type,\n :file_size,\n :file_size_less_than,\n :file_size_greater_than,\n :file_md5hashsum,\n project_affiliation_filter_term_attributes: [:id, :project_id, :_destroy],\n annotation_filter_terms_attributes: [:id, :created_by, :term, :context, :_destroy]\n ]\n params.require(:record_filter).permit(permitted_params)\n end", "def filter\n @filter_params.each do |key, val|\n # Strip empty values from the array if the given value is an array.\n val.select!{ |val| !val.to_s.empty? } if val.is_a?(Array)\n\n # Convert key if it starts with a column name.\n key = key.slice(@model_method_name.length + 1, key.length) if key.start_with?(\"#{@model_method_name}_\")\n\n if @force_filter_for && @force_filter_for.include?(key)\n ret = @args[:filter].call(:key => key, :val => val, :query => @query)\n @query = ret if ret\n elsif @model.column_names.include?(key)\n if val.is_a?(Array) && val.empty?\n # Ignore.\n else\n @query = @query.where(key => val)\n end\n elsif match = key.to_s.match(/^(.+)_like$/) and @model.column_names.include?(match[1])\n next if val.blank?\n table = @model.arel_table\n \n val.to_s.strip.split(/\\s+/).each do |str|\n @query = @query.where(table[match[1].to_sym].matches(\"%#{escape(str)}%\"))\n end\n elsif @args[:filter]\n ret = @args[:filter].call(:key => key, :val => val, :query => @query)\n @query = ret if ret\n else\n raise \"Dont know what to do regarding filter with key: '#{key}'.\"\n end\n end\n end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def execute()\n filters = prepare_filters\n return_filtered_model(filters)\n end", "def autofilter\n true\n end", "def filter_callback=(value)\r\n @filter = value\r\n end", "def filtering_params(params)\n\t\t params.slice(:name, :category_id, :trademark)\n\t\tend", "def filter\n setup_instance_variables\n render 'index'\n end", "def apply_filter(filter)\n return if !filter\n\n # It can be the artist id or an array of ids\n @artist_id = filter[:artistid] if filter[:artistid]\n @artist_id = @artist_id.is_a?(Array) ? @artist_id.map { |x| x.to_i } : @artist_id.to_i\n\n set_song_ids( filter[:songid] )\n set_play_list_song_ids( filter[:play_list_song_ids] )\n\n @album_id = filter[:album_id].to_i if filter[:album_id]\n @album_name = filter[:album_name] if filter[:album_name]\n @text = filter[:text] if filter[:text]\n end", "def filter_data\n case params[:filter][:info]\n when 'Public'\n @tag = Tag.find_by(tag: 'Public')\n when 'Basketball Courts'\n @tag = Tag.find_by(tag: 'Basketball Courts')\n when 'Book Store'\n @tag = Tag.find_by(tag: 'Book Store')\n end\n\n @joins = Tagtoilet.where('tag_id = ?', @tag.id)\n @toilets = @joins.map{|join| Toilet.find(join.toilet_id)}\n @toilets.to_json\n end", "def filter\n query = build_query()\n @lancamentos = query\n\n\n render :layout => nil\n end", "def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend", "def filter (data)\n # leave the data untouched if we don't support the required filter\n return data if @filter.nil?\n\n # decode the data\n self.send(@filter, data)\n end", "def check_filter_options #:nodoc:\r\n table_name = CmsHelper.table_param(params).strip.split(';').first.underscore\r\n model = table_name.classify.constantize\r\n session[table_name] ||= {}\r\n # page is set\r\n session[table_name][:page] = params[:page] if params[:page]\r\n # if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n\r\n # don't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') || dc_user_can(DcPermission::CAN_ADMIN)\r\n site_id = nil if session[table_name][:filter].to_s.match('dc_site_id')\r\n\r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = site_id ? model.where(dc_site_id: site_id) : model\r\n end\r\n process_select_and_deny_fields\r\n # pagination if required\r\n per_page = (@form['result_set']['per_page'] || 25).to_i\r\n @records = @records.page(session[table_name][:page]).per(per_page) if per_page > 0\r\nend", "def store_obj_filter(obj_id, col) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x0046 # Bytes to follow\n\n obj_type = 0x0014 # Object type (combo box).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x2101\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')\n data = [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftSbs Scroll bar subobject\n sub_record = 0x000C # ftSbs\n sub_length = 0x0014\n sub_data = ['0000000000000000640001000A00000010000100'].pack('H*')\n data = data + [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftLbsData (List box data) subobject\n sub_record = 0x0013 # ftLbsData\n sub_length = 0x1FEE # Special case (undocumented).\n\n # If the filter is active we set one of the undocumented flags.\n\n if @filter_cols[col]\n sub_data = ['000000000100010300000A0008005700'].pack('H*')\n else\n sub_data = ['00000000010001030000020008005700'].pack('H*')\n end\n\n data = data + [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data = data + [sub_record, sub_length].pack('vv')\n\n # Pack the record.\n header = [record, length].pack('vv')\n\n append(header, data)\n end", "def filter_params\n params.require(:filter).permit(:title, :department, :user, :commit)\n end", "def filter(options={})\n super\n end", "def filter\n filter_type = params[:filter][:type]\n case filter_type\n when \"last_seven\", \"weekly\"\n @filter = \"Weekly\"\n @filtered_runs = current_user.runs.in_the_last_week\n when \"last_thirty\", \"monthly\"\n @filter = \"Monthly\"\n @filtered_runs = current_user.runs.in_the_last_thirty_days\n when \"year\", \"yearly\"\n @filter = \"Yearly\"\n @filtered_runs = current_user.runs.in_the_last_year\n when \"lifetime\"\n @filter = \"Lifetime\"\n @filtered_runs = current_user.runs.most_recent_by_date\n end\n\n respond_to do |format|\n format.js\n end\n\n end", "def autofilter\r\n\t\tfalse\r\n\tend", "def autofilter\r\n\t\tfalse\r\n\tend", "def autofilter\r\n\t\tfalse\r\n\tend", "def autofilter\r\n\t\tfalse\r\n\tend", "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 named_filter; end", "def apply_filter(data, filter_model)\n filter_type = filter_model.filter_type\n variable_name = filter_model.variable_name;\n value1 = filter_model.value1\n value2 = filter_model.value2\n\n case filter_type\n when 'equals'\n filter_hash = Hash.new\n filter_hash[variable_name] = value1\n data = data.where(filter_hash)\n\n when 'not_equals'\n filter_hash = Hash.new\n filter_hash[variable_name] = value1\n data = data.where.not(filter_hash)\n\n when 'greater_than'\n data = data.where(\"#{variable_name} > ?\", value1)\n\n when 'greater_than_or_equal'\n data = data.where(\"#{variable_name} >= ?\", value1)\n\n when 'less_than'\n data = data.where(\"#{variable_name} < ?\", value1)\n\n when 'less_than_or_equal'\n data = data.where(\"#{variable_name} <= ?\", value1)\n\n when 'from_to'\n data = data.where(\"#{variable_name} >= ? AND #{variable_name} <= ?\", value1, value2)\n\n else\n data\n end\n end", "def index\n # Get the user's records\n @records = user_records\n # Filter by the specified content type if given\n @records = @records.where(content_type: view_context.filter_params[:content_type]) if view_context.filter_params[:content_type]\n # Filter by the specified tag if given\n @records = @records.tagged_with(double_escape_quotes(view_context.filter_params[:tag])) if current_user && view_context.filter_params[:tag]\n # Get the selected id(s) if given\n @records = @records.where(id: params[:id]) if params[:id]\n # Get the relevant page unless all is specified\n @records = (view_context.filter_params[:per].eql? \"all\") ?\n @records.page(1).per(user_records.count) : @records.page(view_context.filter_params[:page]).per(view_context.filter_params[:per])\n respond_with(@records) unless performed?\n end", "def set_filter\n @filter = Filter.friendly.find(params[:id])\n end", "def criteria\r\n model = controller_name.singularize.camelize.constantize\r\n locals = {}\r\n\r\n case params[:id]\r\n when \"activate_filters\"\r\n action = \"acts_as_criteria/activate_filter\"\r\n when \"activate_simple\"\r\n action = \"acts_as_criteria/activate_simple\"\r\n when \"new_filter_row\"\r\n unless params[:col_name].blank?\r\n col_name = params[:col_name]\r\n @filter = { :col_name => col_name, :col_text => model.criteria_options[:filter][:columns][:\"#{col_name}\"][:text] || col_name,:col_subtype => model.col_subtype(col_name), :col_options => model.criteria_options[:filter][:columns][:\"#{col_name}\"] }\r\n action = \"acts_as_criteria/new_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"destroy_filter_row\"\r\n unless params[:col_name].blank?\r\n locals = { :col_name => params[:col_name] }\r\n action = \"acts_as_criteria/destroy_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"clear_filters\"\r\n instance_variable_set(\"@current_query\", nil)\r\n unless model.criteria_options[:mantain_current_query].blank?\r\n model.criteria_options[:mantain_current_query].call(nil, controller_name, session)\r\n end \r\n action = \"acts_as_criteria/clear_filters\"\r\n when \"save_filters\"\r\n if params[:criteria_select_filter].blank?\r\n filter = UserFilter.new(:user_id => params[:user_id], :assigned_to => params[:user_id], :name => params[:filter_name], :description => params[:filter_description], :criteria => criteria_hash_to_query_string, :asset => controller_name)\r\n else\r\n if model.criteria_options[:restrict].blank?\r\n filter = UserFilter.find(:first, :conditions => { :user_id => @current_user.id, :id => params[:criteria_select_filter] })\r\n else\r\n restrict = model.criteria_options[:restrict]\r\n filter = UserFilter.send(:\"#{restrict[:method]}\", @current_user).find(:first, :conditions => { :id => params[:criteria_select_filter] })\r\n end\r\n filter.criteria = criteria_hash_to_query_string\r\n end\r\n \r\n if filter.save\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_successful_saved_filter\") : \"Succefully saved filter\"\r\n flash[:notice] = message\r\n else\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_failed_save_filter\") : \"The filter can't be saved\"\r\n flash[:error] = message\r\n end\r\n action = \"acts_as_criteria/save_filters\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n \r\n respond_to do |format|\r\n format.js { render :template => action, :locals => locals }\r\n end \r\n end", "def filtering_params(params)\n params.slice(:user, :minprice, :maxprice, :status, :sortby, :pricesort, :datesort)\n end", "def filtro_particular(conscaso, params_filtro)\n return conscaso\n end", "def filter_params\n params.require(:filter).permit(:name, :brand, :description, :notes)\n end", "def filter\n @events = Event.filter(filter_params).paginate(page: params[:page], per_page: 18)\n if @events.blank?\n flash.now[:warning] = 'Извините, ничего не найдено по вашему запросу :('\n end\n render 'index'\n end", "def filtering_params(params)\n \tparams.slice(:make, :color, :drive, :has_keys, :year, :state, :lot_number, :buy_now_price, :auction)\n\tend", "def update_filters\n @pipeline_course_filter = PipelineCourseFilter.find_by_service_learning_course_id params[:id]\n \n @pipeline_course_filter.filters = params[\"search\"]\n @pipeline_course_filter.save\n \n @service_learning_course = @pipeline_course_filter.service_learning_course\n \n @filters = @pipeline_course_filter.filters\n \n filter_search\n \n respond_to do |format|\n format.js\n format.html { redirect_to(service_learning_course_path(@unit, @quarter, @service_learning_course)) }\n end\n end", "def prepare_data_for_filters\n self.data_grid.columns.each do |col|\n next if col.filter.nil? # if no filter\n\n # Prepare auto filters\n if col.filter == :auto\n self.data_grid.in_data.each do |d|\n if col.sort_by.class == Symbol\n col.filter_data << d.send(col.sort_by)\n else\n # Call lambda\n col.filter_data << col.field.call(d, self.data_grid)\n end\n end\n\n col.filter_data.uniq!\n col.filter_data.sort!\n end\n end\n end", "def filter=(val)\n set_filter(val)\n val\n end", "def extra_search_actions(items, extra_filters = [], kind = nil)\n (extra_filters || []).each do |filter|\n case filter\n when 'my_country'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.where(country: current_user.country)\n when 'churches', 'groups'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'contents'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'events'\n items = items.joins('inner join user_groups on user_groups.id = events.eventable_id and events.eventable_type = \\'UserGroup\\' inner join users on users.id = user_groups.user_id').where('users.country = ?', current_user.country)\n \n # TODO\n end\n when 'my_groups'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.joins(:user_groups).where(user_groups: {id: current_user.user_groups.pluck(:id)})\n when 'churches', 'groups'\n items = items.where(id: current_user.user_groups.select(:id))\n when 'contents'\n items = items.where(user_id: current_user.user_groups_members.select(:id))\n when 'events'\n items = items.where(id: current_user.user_groups_events.select(:id))\n end\n end\n end\n items\n end", "def apply_filter(rel)\n if filter.present?\n Response.do_search(rel, filter, :mission => mission)\n else\n rel\n end\n end", "def filter\n do_authorize_class\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.dataset_items(current_user, dataset_id: params[:dataset_id]),\n DatasetItem,\n DatasetItem.filter_settings(:reverse_order)\n )\n\n respond_filter(filter_response, opts)\n end", "def process_select_and_deny_fields\r\n only = @form['result_set']['select_fields'] || @form['result_set']['only']\r\n @records = @records.only( separated_to_symbols(only) ) if only\r\n\r\n without = @form['result_set']['deny_fields'] || @form['result_set']['without']\r\n @records = @records.without( separated_to_symbols(without) ) if without\r\nend", "def filtering_params(params)\n params.slice(:selecteduser, :weekstart, :weekend, :jobnumber)\nend" ]
[ "0.7283907", "0.7018895", "0.6920807", "0.6869866", "0.67705315", "0.67705315", "0.6573756", "0.6464857", "0.645357", "0.645357", "0.645357", "0.6358367", "0.6358367", "0.62640107", "0.622986", "0.6165329", "0.614962", "0.61202306", "0.61147594", "0.61147594", "0.61136955", "0.6106566", "0.6104808", "0.6097762", "0.6091704", "0.6090965", "0.60811967", "0.6037671", "0.5999337", "0.59628", "0.59387296", "0.5932165", "0.59040785", "0.58927673", "0.5891754", "0.5880771", "0.58472174", "0.5824028", "0.57955384", "0.57698715", "0.57698715", "0.5749282", "0.5744493", "0.57383865", "0.5729006", "0.57266706", "0.57244515", "0.57210606", "0.5717377", "0.5710597", "0.57104284", "0.56920296", "0.5682706", "0.56778646", "0.56762725", "0.5670765", "0.5668454", "0.5668369", "0.56681216", "0.5662094", "0.5662094", "0.5662094", "0.56594354", "0.5654012", "0.5643719", "0.56378555", "0.56300527", "0.5628394", "0.56262773", "0.5614582", "0.56143874", "0.560439", "0.5603395", "0.5601422", "0.5597031", "0.5572318", "0.55722845", "0.5565481", "0.5565481", "0.5565481", "0.5565481", "0.55648863", "0.5558787", "0.55584896", "0.5555733", "0.55495495", "0.5548043", "0.5548025", "0.55395496", "0.5535161", "0.55337876", "0.55257106", "0.5524178", "0.55140424", "0.55108386", "0.5500546", "0.54981107", "0.54960227", "0.5495928", "0.5493759" ]
0.6388001
11
METHODE SUR LA PYRAMIDE
def full_pyramid #On salut notre visiteur puts "Salut, bienvenue dans ma super pyramide ! Combien d'etages veux-tu ?" print "> " #On demande le nombre d'étages steps = gets.chomp.to_i #On affiche la pyramide puts "Voici la pyramide :" steps.times do |i| puts " " * (steps - ( i + 1 )) + "#" * ( 2 * i + 1) + " " * (steps - ( i + 1 )) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def omega() \r\n # delta_equinox()[ 3 ]\r\n Celes.faom03(@ta) \r\n end", "def bradypode_paracephalus()\n end", "def mo_Earth() \r\n# [ -0.0000000434, -0.000000576, 0.00200340, \r\n# -0.0001831, -46.836769, 84381.406 ].inject(0.0) {|p, a| p * @ta + a} * DAS2R\r\n Celes.obl06(@ajd, 0)\r\n end", "def compute_Delta(_T)\n #equation 13\n #kPa/C\n _Delta = 4098.0 * (0.6108 * Math.exp(17.27 * _T / (_T + 237.3))) / (_T + 237.3) ** 2\nend", "def jpd_noon\r\n $jpd_2000 + jpd_cycle - local_angle\r\nend", "def determinant\n end", "def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend", "def ma_Sun()\r\n @ta = ( @ajd - DJ00 ) / DJC \r\n# @ma = delta_equinox()[2]\r\n @ma = Celes.falp03(@ta) \r\n end", "def radial_basis(x)\n\t\tMath::E ** ( - (x**2) )\t\t\n\tend", "def degree; end", "def cosine_omega\r\n lat_r = @latitude * @d2r\r\n dec_r = declination * @d2r\r\n sin(-0.8333 * @d2r) - sin(lat_r) * sin(dec_r) /\r\n cos(lat_r) * cos(dec_r)\r\nend", "def dy() 0 end", "def compute_es(_T)\n #equation 11\n #t units are celsius, es units are kPa\n es = 0.6108 * Math.exp((17.27 * _T) / (_T + 237.3))\nend", "def derivata2(t)\n y=6*t-6\n return y\nend", "def matz; end", "def test_b()\n mx = Itk::Maxima.new() ;\n x = [[1.0,2,3,4],[4,1,2,3],[3,1,4,2],[1,2,1,3]] ;\n pp x ;\n pp mx.determinant(x) ;\n pp mx.invert(x) ;\n end", "def imc \n\t\t@peso/(@talla*@talla)\n\tend", "def energy(state)\n\n\t\tt1, t1p = state[0]\n\t\tt2, t2p = state[1]\n\n\t\tt1 += 1.5 * PI\n\n\t\tk = 0.5 * M1 * (LC1 ** 2.0) * (t1p ** 2.0) + 0.5 * I1 * (t1p ** 2.0) + 0.5 * M2 * (L1 ** 2.0) * (t1p ** 2.0) +\n\t\t\t 0.5 * M2 * (LC2 ** 2.0) * ((t1p ** 2.0) + 2.0 * t1p * t2p + (t2p ** 2.0)) +\n\t\t\tM2 * L1 * LC2 * ((t1p ** 2.0) + t1p * t2p) * cos(t2) +\n\t\t\t0.5 * I2 * ((t1p ** 2.0) + 2.0 * t1p * t2p + (t2p ** 2.0))\n\n\t\tu = M1 * G * LC1 * sin(t1) + M2 * G * L1 * sin(t1) + M2 * G * LC2 * sin(t1 + t2)\n#\t\tu = M1 * G * LC1 * sin(t1) + M2 * G * LC2 * sin(t1 + t2)\n\n\t\t$stderr << \"debug energy k #{k} u #{u}\"\n\n\t\tk + u\n\tend", "def dv; end", "def mapee i=0\n dist[i][0]\n end", "def deltaT2( rPlanetoid1 )\n rPlanetoid2 = rPlanetoid1 / 2\n m1 = massFromRadius( rPlanetoid1 )\n m2 = massFromRadius( rPlanetoid2 )\n\n return (((2 * G * m1) / rPlanetoid1) * m2) / (2 * C * m1)\nend", "def y\n r * Math.sin(theta)\n end", "def calculated_determinant\n # A arrondir à digit puis à mettre sous forme fractionnelle \n @equat.determinant.round(2)\n end", "def phi_ij(omicron, core, point)\n dis2 = 0.0;\n DIMENSION_CNT.times {|i|\n dis2 += (core[i] - point[i]) ** 2;\n }\n Math.exp(dis2 / (-2 * omicron ** 2));\nend", "def angle_delta_psi() \r\n Celes.nut06a(@ajd, 0)[ 0 ]\r\n end", "def eagle_view(m, t)\n return (EVALUE**((t*t)/m));\nend", "def symmetry\n ang_moment.symmetry\n end", "def nano\n big_self * NANO\n end", "def cur_omega\n MSPhysics::Newton::Hinge.get_cur_omega(@address)\n end", "def angle_delta_epsilon() \r\n Celes.nut06a(@ajd, 0)[ 1 ]\r\n end", "def den()\n @den\n end", "def angle_delta_orbit() \r\n -1.0 * eqc( @ma, @ta ) \r\n end", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def degree\n self.in_degree + self.out_degree\n end", "def proton_mass\r\n mass(HYDROGEN) - mass(ELECTRON)\r\n end", "def gecos=(p0) end", "def y()\n val = @b;\n @n.times {|i|\n val += @wn[i] * @xn[i];\n }\n return val;\n end", "def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend", "def operating_temperature; end", "def topsman_periphacitis_urosteon()\n end", "def eccentricity_Earth()\r\n # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}\r\n eoe(@ta) \r\n end", "def cur_twist_omega\n MSPhysics::Newton::BallAndSocket.get_cur_twist_omega(@address)\n end", "def max_orbit_phi\n PI / 2 - declination_rad\n end", "def eq_of_equinox() \r\n cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]\r\n end", "def sin; end", "def curve\n end", "def curve\n end", "def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end", "def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend", "def sin\n math :sin\n end", "def secondderivativemeanmotion\n (@line1[44...50].to_f/100000.0) * (10.0**@line1[50...52].to_i)\n end", "def gml_Sun() \r\n #total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,\r\n #\t\t 0.0003032028, 36000.76982779, 280.4664567 ] \r\n # mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R\r\n ml(@ta)\r\n end", "def min_orbit_phi\n -max_orbit_phi\n end", "def zetta\n big_self * ZETTA\n end", "def solar_declination(t)\n\te = obliquity_corr(t)\n\tlambda = sun_apparent_lon(t)\n\tMath.asin(Math.sin(e)*Math.sin(lambda))\nend", "def basis\n return @basis\n end", "def f(phase, var)\n A + (B * Math.sin(phase + (D * var)))\nend", "def tan\n math :tan\n end", "def initialize(num, den) # Inicializamos las variables y las reducimos a su minima expresion\n\t\taux = mcd(num,den)\n\t\t@num = num / aux\n\t\t@den = den / aux\n\tend", "def binding_energy\n nm = 217\n kinetic_energy = 2.0*10**-19\n\n meters = nm / 10**9\n\n puts \"meters is: #{meters} \"\n photon_energy = ($H * $C) / meters\n binding_energy = photon_energy - kinetic_energy\n puts \"photon_energy is: #{photon_energy} \"\n puts \"binding_energy is: #{binding_energy} \"\nend", "def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end", "def rm_edgy_x() (ppu_x * reg_radius).round + 5 end", "def factor eot\r\n eot.ajd = Date.parse(\"2000-01-01\").jd \r\n tlaa = eot.tl_Aries()\r\n eot.ajd = eot.ajd + 1\r\n tlab = eot.tl_Aries()\r\n dif = (tlab - tlaa) * Eot::R2D \r\n f1 = dif / 360.0 + 1 \r\n 1 / f1\r\nend", "def diameter\n rim + (tire * 2)\n end", "def cos\n pass\nend", "def debuterHypothese\n\t\t0.upto(@n-1) do|x| \n\t\t\t0.upto(@n-1) {|y| \n\t\t\t\t@hypothese[x][y] = @plateauJoueur[x][y].couleur\n\t\t\t}\n\t\tend\n\tend", "def vec \n\t\t\tODE::Vector::new( @elem[0..2] )\n\t\tend", "def formal_derivative\n GCMPoly.new (0...@a.size-1).map { |i| i.odd? ? GCMField.zero : @a[i+1] }\n end", "def earth_orbit_eccentricity(t)\n\t0.016708634 -t*(0.000042037 +t*0.0000001267)\nend", "def energy\n (Matrix.row_vector(current) * net.weights).row(0).inner_product current\n end", "def denom()\n @denominador\n end", "def dj_dp0(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += (p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end", "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "def mne(y, md)\n meq?(y, md) ? ZERO : ONE\n end", "def test_determinant\n f = YaleSparseMatrixFactory.new()\n c = f.Create([1,2,3,4,5],[0,0,2,4,5],[0,2,1,1,1],[3,4,5,9,9],[2,5,6,7,8])\n result = c.determinant()\n assert_equal(result,15)\n # assert_equal(result , )\n\n\n end", "def inertia\n 150\n end", "def matricula\n end", "def cur_tangent\n MSPhysics::Newton::CurvySlider.get_cur_tangent(@address)\n end", "def determinant_by_elimination_euclidian#_new\n m = dup\n det = ground.unity\n each_j do |d|\n if i = (d...size).find{|i| !m[i, d].zero?}\n if i != d\n m.sswap_r!(d, i)\n det = -det\n end\n (d+1...size).each do |i0|\n r = m.row!(i0)\n q = m[i0, d] / m[d, d]\n (d...size).each do |j0|; r[j0] -= q * m[d, j0]; end\n unless m[i0, d].zero?\n m.sswap_r!(d, i0)\n det = -det\n redo\n end\n end\n det *= m[d, d]\n else\n return ground.zero\n end\n end\n det\n end", "def phase(dt = nil)\n dt = DateTime.now.to_time.utc.to_datetime unless dt\n pdate = dt.ajd\n\n # Calculation of the Sun's position.\n\n day = pdate - EPOCH\t# date within epoch\n n = ((360 / 365.2422) * day) % 360.0\n m = (n + ELONGE - ELONGP) % 360.0\t# convert from perigee\n # co-ordinates to epoch 1980.0\n ec = kepler(m, ECCENT)\t# solve equation of Kepler\n ec = Math.sqrt((1 + ECCENT) / (1 - ECCENT)) * Math.tan(ec / 2)\n ec = 2 * todeg(Math.atan(ec))\t# true anomaly\n lambdasun = (ec + ELONGP) % 360.0\t# Sun's geocentric ecliptic\n # longitude\n # Orbital distance factor.\n f = ((1 + ECCENT * Math.cos(torad(ec))) / (1 - ECCENT * ECCENT))\n sundist = SUNSMAX / f\t# distance to Sun in km\n sunang = f * SUNANGSIZ\t# Sun's angular size in degrees\n\n # Calculation of the Moon's position.\n\n # Moon's mean longitude.\n ml = (13.1763966 * day + MMLONG) % 360.0\n\n # Moon's mean anomaly.\n mm = (ml - 0.1114041 * day - MMLONGP) % 360.0\n\n # Moon's ascending node mean longitude.\n mn = (MLNODE - 0.0529539 * day) % 360.0\n\n # Evection.\n ev = 1.2739 * Math.sin(torad(2 * (ml - lambdasun) - mm))\n\n # Annual equation.\n ae = 0.1858 * Math.sin(torad(m))\n\n # Correction term.\n a3 = 0.37 * Math.sin(torad(m))\n\n # Corrected anomaly.\n mmp = mm + ev - ae - a3\n\n # Correction for the equation of the centre.\n mec = 6.2886 * Math.sin(torad(mmp))\n\n # Another correction term.\n a4 = 0.214 * Math.sin(torad(2 * mmp))\n\n # Corrected longitude.\n lp = ml + ev + mec - ae + a4\n\n # Variation.\n v = 0.6583 * Math.sin(torad(2 * (lp - lambdasun)))\n\n # True longitude.\n lpp = lp + v\n\n # Corrected longitude of the node.\n np = mn - 0.16 * Math.sin(torad(m))\n\n # Y inclination coordinate.\n y = Math.sin(torad(lpp - np)) * Math.cos(torad(MINC))\n\n # X inclination coordinate.\n x = Math.cos(torad(lpp - np))\n\n # Ecliptic longitude.\n lambdamoon = todeg(Math.atan2(y, x))\n lambdamoon += np\n\n # Ecliptic latitude.\n betam = todeg(Math.asin(Math.sin(torad(lpp - np)) *\n Math.sin(torad(MINC))))\n\n # Calculation of the phase of the Moon.\n\n # Age of the Moon in degrees.\n moonage = lpp - lambdasun\n\n # Phase of the Moon.\n moonphase = (1 - Math.cos(torad(moonage))) / 2\n\n # Calculate distance of moon from the centre of the Earth.\n\n moondist = (MSMAX * (1 - MECC * MECC)) /\n (1 + MECC * Math.cos(torad(mmp + mec)))\n\n # Calculate Moon's angular diameter.\n\n moondfrac = moondist / MSMAX\n moonang = MANGSIZ / moondfrac\n\n # Calculate Moon's parallax.\n\n moonpar = MPARALLAX / moondfrac\n\n pphase = moonphase\n mpfrac = (moonage % 360) / 360.0\n mage = SYNMONTH * mpfrac\n dist = moondist\n angdia = moonang\n sudist = sundist\n suangdia = sunang\n Phase.new(mpfrac, pphase, mage, dist, angdia, sudist, suangdia)\n end", "def gecos(*) end", "def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[10], @fields[11])\n end", "def double\n return self if infinity?\n gamma = field.mod((3 * x * x + @group.param_a) * field.inverse(2 * y))\n new_x = field.mod(gamma * gamma - 2 * x)\n new_y = field.mod(gamma * (x - new_x) - y)\n self.class.new(group, new_x, new_y)\n end", "def accelerometerX; end", "def deltaT( rPlanetoid1 )\n rPlanetoid2 = rPlanetoid1 / 2\n m1 = massFromRadius( rPlanetoid1 )\n m2 = massFromRadius( rPlanetoid2 )\n v = escapeVel( rPlanetoid1 )\n\n return 0.5 * v**2/C * m2/m1\nend", "def double; end", "def ein; end", "def magnetic_deviation_degrees\n self.class.nsew_signed_float(@fields[5], @fields[6])\n end", "def flotante()\n\t\tflotante = @num/@den.to_f\n\t\treturn flotante\n\tend", "def tanh\n math :tanh\n end", "def denom()\n\t\treturn @den\n\tend", "def dec_Sun() \r\n asin( sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)) * \r\n sin( al(@ma, @ta, Celes.faom03(@ta)))) \r\n end", "def energy\n return @data.inject(0.0){|sum,x| sum + (x * x)}\n end", "def distance_measurement; end", "def degree(vertex)\n\tend", "def get_y; \t\t@y \t\t\tend", "def ml_Aries() \r\n # jd = @ta * DJC # convert first term back to jdn - J2000\r\n # old terms \t\r\n # angle = (36000.770053608 / DJC + 360) * jd # 36000.770053608 = 0.9856473662862 * DJC\r\n # total = [ -1.0/3.8710000e7, 3.87930e-4, 0, 100.460618375 ].inject(0.0) {|p, a| p * ta[0] + a} + 180 + angle \r\n # newer terms seem to be in arcseconds / 15.0\r\n # 0.0000013, - 0.0000062, 0.0931118, 307.4771600, 8639877.3173760, 24110.5493771\r\n # angle = (35999.4888224 / DJC + 360) * jd \r\n # total = angle + 280.460622404583 +\r\n # @ta[ 0 ] * 1.281154833333 +\r\n # @ta[ 1 ] * 3.87965833333e-4 +\r\n # @ta[ 2 ] * -2.58333333333e-8 +\r\n # @ta[ 3 ] * 5.41666666666e-9\r\n # total = [5.41666666666e-9, -2.58333333333e-8, 3.87965833333e-4, 1.281154833333, 280.460622404583].inject(0.0) {|p, a| p * @ta + a} \r\n # mod_360( angle + total ) * D2R\r\n dt = 67.184 \r\n tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)\r\n Celes.gmst06(@ajd, 0, tt, 0) \r\n end", "def alg; end", "def melting_temperature(nucleotide_string)\n #`oligotm -tp 1 -sc 1 -n 0.8 -d 500 -mv 0 -dv 50 '#{nucleotide_string}'`.to_f\n `oligotm -tp 1 -sc 1 -n 0.2 -d 2 -mv 1 '#{nucleotide_string}'`.to_f\n end", "def fcn(flag,pars,derivs)\n chi2 = 0.0;\n @data_pts.each{|pt| \n val = @min_block.call(pt.vars,pars)\n chi2 += ((pt.value - val)/pt.error)**2\n } \n return chi2\n end", "def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[4], @fields[5])\n end" ]
[ "0.6433862", "0.63774604", "0.611768", "0.59624994", "0.58883876", "0.5875904", "0.5850625", "0.57859325", "0.57650757", "0.5754465", "0.5752421", "0.5748166", "0.5733992", "0.57115173", "0.5692534", "0.5646327", "0.5612971", "0.5604526", "0.5581214", "0.55786115", "0.55446583", "0.55325073", "0.55256754", "0.5525348", "0.5502403", "0.5451346", "0.5446357", "0.5425392", "0.5402101", "0.5363726", "0.536266", "0.5353177", "0.5347805", "0.5343228", "0.53366303", "0.53262985", "0.53255075", "0.5315912", "0.5313573", "0.5306691", "0.52971274", "0.52958983", "0.5284559", "0.5272168", "0.52696186", "0.5267717", "0.5267717", "0.5258018", "0.5253262", "0.5253181", "0.5247824", "0.52247983", "0.52240556", "0.52218187", "0.5208684", "0.5206959", "0.5203233", "0.52000946", "0.5199509", "0.51966476", "0.5192676", "0.5190111", "0.51895535", "0.51891446", "0.5181611", "0.51790804", "0.5178183", "0.5172625", "0.5165549", "0.5155064", "0.515316", "0.5151045", "0.5148777", "0.51482266", "0.51340276", "0.5132091", "0.5130414", "0.51257074", "0.51231235", "0.51224965", "0.51196504", "0.5118818", "0.5117525", "0.5113023", "0.5109394", "0.5102965", "0.5100626", "0.5096422", "0.509197", "0.5090827", "0.50769347", "0.50765914", "0.50744545", "0.5070194", "0.50631016", "0.50613415", "0.5060144", "0.5049132", "0.50467926", "0.50413793", "0.50343466" ]
0.0
-1
METHODE SUR LE LOSANGE
def wtf_pyramid #On salut notre visiteur puts "Salut, bienvenue dans ma super pyramide ! Combien d'etages veux-tu ?" print "> " #On demande le nombre d'étages steps = gets.chomp.to_i #On teste si le nombre est pair if steps % 2 != 0 #S'il est impair, on affiche la pyramide puts "Voici la pyramide :" steps.times do |i| #Partie haute du losange if i < steps / 2 puts " " * (steps - ( i + 1 )) + "#" * ( 2 * i + 1) + " " * (steps - ( i + 1 )) #Partie basse du losange else puts " " * i + "#" * (2 *steps - (2 *i + 1)) + " " * i end end #S'il est pair, on envoie l'utilisateur bouler else puts "NON NON! Tu dois saisir un nombre impair, donc tu dégages et tu relances le programme !" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gml_Sun() \r\n #total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,\r\n #\t\t 0.0003032028, 36000.76982779, 280.4664567 ] \r\n # mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R\r\n ml(@ta)\r\n end", "def omega() \r\n # delta_equinox()[ 3 ]\r\n Celes.faom03(@ta) \r\n end", "def radial_basis(x)\n\t\tMath::E ** ( - (x**2) )\t\t\n\tend", "def compute_Delta(_T)\n #equation 13\n #kPa/C\n _Delta = 4098.0 * (0.6108 * Math.exp(17.27 * _T / (_T + 237.3))) / (_T + 237.3) ** 2\nend", "def determinant\n end", "def mo_Earth() \r\n# [ -0.0000000434, -0.000000576, 0.00200340, \r\n# -0.0001831, -46.836769, 84381.406 ].inject(0.0) {|p, a| p * @ta + a} * DAS2R\r\n Celes.obl06(@ajd, 0)\r\n end", "def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend", "def get_variance\n\t\tif @eleves.length == 0 \n\t\t\treturn -1\n\t\tend\n\t\tsomme = 0\n\t\tmean = self.get_mean\n\t\t@eleves.each do |e|\n\t\t\tsomme += (e.moyenne.to_i - mean)**2\n\t\tend\n\t\tsomme/=@eleves.length \n\tend", "def coordinate_delta_max\n one_side_terms(:left).map { |term| term.conc / term.count }.min\n end", "def step_divisor\n 10 + features_sum(:anger_mantain)\n end", "def geomean x\n sum = 0.0\n x.each{ |v| sum += Math.log(v) }\n sum /= x.size\n Math.exp sum\n end", "def angle_delta_epsilon() \r\n Celes.nut06a(@ajd, 0)[ 1 ]\r\n end", "def energy\n (lat = l3_miss_latencies @o).inject{ |a,l| a+=l }/lat.size.to_f\n end", "def convergence\n variance\n end", "def formal_derivative\n GCMPoly.new (0...@a.size-1).map { |i| i.odd? ? GCMField.zero : @a[i+1] }\n end", "def derivata2(t)\n y=6*t-6\n return y\nend", "def lms(x, l, m, s)\n (((x / m) ** l) - 1) / (l * s)\n end", "def degree\n self.in_degree + self.out_degree\n end", "def calculated_determinant\n # A arrondir à digit puis à mettre sous forme fractionnelle \n @equat.determinant.round(2)\n end", "def coordinate_delta_min\n one_side_terms(:right).map { |term| -term.conc / term.count }.max \n end", "def bradypode_paracephalus()\n end", "def variance\n central_moment(2)\n end", "def angle_delta_orbit() \r\n -1.0 * eqc( @ma, @ta ) \r\n end", "def coeficiente(p1,p2)\n return p2.abs.subPoint(p1.abs)\n end", "def dlng\n @_dlng ||= _safe_sqrt(ssq_lng/weight - (sum_lng/weight)**2)\n end", "def degree; end", "def eccentricity_Earth()\r\n # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}\r\n eoe(@ta) \r\n end", "def energy(state)\n\n\t\tt1, t1p = state[0]\n\t\tt2, t2p = state[1]\n\n\t\tt1 += 1.5 * PI\n\n\t\tk = 0.5 * M1 * (LC1 ** 2.0) * (t1p ** 2.0) + 0.5 * I1 * (t1p ** 2.0) + 0.5 * M2 * (L1 ** 2.0) * (t1p ** 2.0) +\n\t\t\t 0.5 * M2 * (LC2 ** 2.0) * ((t1p ** 2.0) + 2.0 * t1p * t2p + (t2p ** 2.0)) +\n\t\t\tM2 * L1 * LC2 * ((t1p ** 2.0) + t1p * t2p) * cos(t2) +\n\t\t\t0.5 * I2 * ((t1p ** 2.0) + 2.0 * t1p * t2p + (t2p ** 2.0))\n\n\t\tu = M1 * G * LC1 * sin(t1) + M2 * G * L1 * sin(t1) + M2 * G * LC2 * sin(t1 + t2)\n#\t\tu = M1 * G * LC1 * sin(t1) + M2 * G * LC2 * sin(t1 + t2)\n\n\t\t$stderr << \"debug energy k #{k} u #{u}\"\n\n\t\tk + u\n\tend", "def deltaT2( rPlanetoid1 )\n rPlanetoid2 = rPlanetoid1 / 2\n m1 = massFromRadius( rPlanetoid1 )\n m2 = massFromRadius( rPlanetoid2 )\n\n return (((2 * G * m1) / rPlanetoid1) * m2) / (2 * C * m1)\nend", "def ld_standard_deviation\n ld_variance.map { |e| Math.sqrt(e) }\n end", "def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend", "def d(x)\n 2 * ( l(x) + h(x) ) - 1\n end", "def ml_Aries() \r\n # jd = @ta * DJC # convert first term back to jdn - J2000\r\n # old terms \t\r\n # angle = (36000.770053608 / DJC + 360) * jd # 36000.770053608 = 0.9856473662862 * DJC\r\n # total = [ -1.0/3.8710000e7, 3.87930e-4, 0, 100.460618375 ].inject(0.0) {|p, a| p * ta[0] + a} + 180 + angle \r\n # newer terms seem to be in arcseconds / 15.0\r\n # 0.0000013, - 0.0000062, 0.0931118, 307.4771600, 8639877.3173760, 24110.5493771\r\n # angle = (35999.4888224 / DJC + 360) * jd \r\n # total = angle + 280.460622404583 +\r\n # @ta[ 0 ] * 1.281154833333 +\r\n # @ta[ 1 ] * 3.87965833333e-4 +\r\n # @ta[ 2 ] * -2.58333333333e-8 +\r\n # @ta[ 3 ] * 5.41666666666e-9\r\n # total = [5.41666666666e-9, -2.58333333333e-8, 3.87965833333e-4, 1.281154833333, 280.460622404583].inject(0.0) {|p, a| p * @ta + a} \r\n # mod_360( angle + total ) * D2R\r\n dt = 67.184 \r\n tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)\r\n Celes.gmst06(@ajd, 0, tt, 0) \r\n end", "def gecos(*) end", "def pnormal___x(y); pnormalxXX_(1.0 - y); end", "def pnormal__X_(y); pnormalxXX_(y + 0.5); end", "def dlat\n @_dlat ||= _safe_sqrt(ssq_lat/weight - (sum_lat/weight)**2)\n end", "def nterm_series(delta, charge)\r\n ladder.collect {|m| (m + delta)/charge }\r\n end", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def energy\n return @data.inject(0.0){|sum,x| sum + (x * x)}\n end", "def get_mean\n\t\tif @eleves.length == 0 \n\t\t\treturn -1\n\t\tend\n\t\tsomme = 0\n\t\t@eleves.each do |e|\n\t\t\tsomme += e.moyenne.to_i\n\t\tend\n\t\tsomme/=@eleves.length \n\tend", "def secondderivativemeanmotion\n (@line1[44...50].to_f/100000.0) * (10.0**@line1[50...52].to_i)\n end", "def angle_delta_psi() \r\n Celes.nut06a(@ajd, 0)[ 0 ]\r\n end", "def lngamm(z) \n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def compute_es(_T)\n #equation 11\n #t units are celsius, es units are kPa\n es = 0.6108 * Math.exp((17.27 * _T) / (_T + 237.3))\nend", "def gecos=(p0) end", "def min_orbit_phi\n -max_orbit_phi\n end", "def ma_Sun()\r\n @ta = ( @ajd - DJ00 ) / DJC \r\n# @ma = delta_equinox()[2]\r\n @ma = Celes.falp03(@ta) \r\n end", "def test_b()\n mx = Itk::Maxima.new() ;\n x = [[1.0,2,3,4],[4,1,2,3],[3,1,4,2],[1,2,1,3]] ;\n pp x ;\n pp mx.determinant(x) ;\n pp mx.invert(x) ;\n end", "def cosine_omega\r\n lat_r = @latitude * @d2r\r\n dec_r = declination * @d2r\r\n sin(-0.8333 * @d2r) - sin(lat_r) * sin(dec_r) /\r\n cos(lat_r) * cos(dec_r)\r\nend", "def cal_log_ml\n lml = 0\n\n # log p(c^d | \\alpha)\n for d in 0..@d-1\n lml += cal_log_Z(@c[d], @a)\n end\n\n # log p(A | c, \\beta)\n @Ce.keys.each do |ckey|\n lml += cal_log_Z(@Ce[ckey], @b)\n end\n lml -= @Ce.size * cal_log_Z(Array.new(@v){|v| 0}, @b)\n\n lml\n end", "def resta (other)\n\t\tres=Fraccion.new(0,0)\n\t\tif @y == other.y # igual denominador\n\t\t\tres.x= @x - other.x\t\t\n\t\t\tres.y= @y\t\n\t\telse\t\t # distinto denominador\n\t\t\t\n\t\t\tres.y=mcm(@y, other.y)\t\t\n\t\t\tres.x=((@x *res.y)/@y)-((other.x * res.y)/other.y) \n\t\tend\n\treturn res\n\tend", "def dj_dp0(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += (p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end", "def dy() 0 end", "def firstderivativmeanmotion\n @line1[33...43].to_f\n end", "def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end", "def cur_omega\n MSPhysics::Newton::Hinge.get_cur_omega(@address)\n end", "def mse()\r\n mse = 0\r\n \r\n @training_dataset.length.times do |i|\r\n u = net(@training_dataset[i][0], @training_dataset[i][1])\r\n mse += (@training_dataset[i][2] - logistica(u))**2\r\n end\r\n mse = (mse.to_f/@training_dataset.length)\r\n\r\n mse\r\n end", "def pnormalx__x(y); pnormalxXX_(1.0 - y/2.0); end", "def lax_wendroff\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n 0.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| @u[n][j]-0.5*alpha*(@u[n][j+1]-@u[n][j-1])+0.5*(alpha**2)*(u[n][j+1]-2*u[n][j]+u[n][j-1]) }\n @u[n+1].unshift @u[n][0]-0.5*alpha*(@u[n][1]-@u[n][@mx-2])+0.5*(alpha**2)*(u[n][1]-2*u[n][0]+u[n][@mx-2]) # u(0,t)\n @u[n+1].push @u[n][@mx-2]-0.5*alpha*(@u[n][0]-@u[n][@mx-3])+0.5*(alpha**2)*(u[n][0]-2*u[n][@mx-2]+u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "def lsin(x)\n\n ret = 0.0\n i = $TRIG_ITER\n \n while i > 1\n \n i -= 1.0\n\tret += pow(-1, i) * pow(x, (2 * i) + 1) / fact((2 * i) + 1)\n\t\t\n end\n\t\n return ret\n \nend", "def var\n m = self.mean\n sum = self.inject(0.0){|accum, i| accum +(i-m)**2 }\n sum/self.length\n end", "def lngamm(z)\n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def energy\n (Matrix.row_vector(current) * net.weights).row(0).inner_product current\n end", "def y()\n val = @b;\n @n.times {|i|\n val += @wn[i] * @xn[i];\n }\n return val;\n end", "def kinetic_energy\n\t\t@vel[0].abs + @vel[1].abs + @vel[2].abs\n\tend", "def rm_edgy_x() (ppu_x * reg_radius).round + 5 end", "def norm\r\n (@real * @real) + @axis.modulus\r\n end", "def factor eot\r\n eot.ajd = Date.parse(\"2000-01-01\").jd \r\n tlaa = eot.tl_Aries()\r\n eot.ajd = eot.ajd + 1\r\n tlab = eot.tl_Aries()\r\n dif = (tlab - tlaa) * Eot::R2D \r\n f1 = dif / 360.0 + 1 \r\n 1 / f1\r\nend", "def gradient(point1,point2)\n ((point1[1] - point2[1]).to_f/(point1[0] - point2[0]))\nend", "def latbc(phi)\n=begin\n # not so good\n pi2 = Math::PI/2\n eps = 0.1\n xs = phi[0..1].val \n xe = phi[-2..-1].val\n if (pi2-xs[0].abs) / (xs[0]-xs[1]).abs < eps and\n (pi2-xe[-1].abs) / (xe[-1]-xe[-2]).abs < eps \n GPhys::Derivative::MIRROR_B\n else\n GPhys::Derivative::LINEAR_EXT\n end\n=end\n GPhys::Derivative::LINEAR_EXT\n end", "def inertia\n 150\n end", "def fcn(flag,pars,derivs)\n chi2 = 0.0;\n @data_pts.each{|pt| \n val = @min_block.call(pt.vars,pars)\n chi2 += ((pt.value - val)/pt.error)**2\n } \n return chi2\n end", "def var\n raise 'Length must be greater than 1' if length < 2\n mu = mean\n map { |v| (v**2 - mu**2) }.sum.to_f / (length - 1)\n end", "def denom()\n\t\treturn @den\n\tend", "def mag\n Math.sqrt(@x*@x + @y*@y)\n end", "def estDouble()\n return @estDouble\n end", "def nrm2 incx=1, n=nil\n self.twoDMat.getFrobeniusNorm()\n end", "def jpd_noon\r\n $jpd_2000 + jpd_cycle - local_angle\r\nend", "def s_radius\n modulus\n end", "def lax_friedrichs\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n 0.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| 0.5*(@u[n][j+1]+u[n][j-1])-0.5*alpha*(@u[n][j+1]-@u[n][j-1]) }\n @u[n+1].unshift 0.5*(@u[n][1]+u[n][@mx-2])-0.5*alpha*(@u[n][1]-@u[n][@mx-2]) # u(0,t)\n @u[n+1].push 0.5*(@u[n][0]+u[n][@mx-3])-0.5*alpha*(@u[n][0]-@u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "def normal(p)\n return (p - @centre).unit\n end", "def den()\n @den\n end", "def lcm(p0) end", "def eagle_view(m, t)\n return (EVALUE**((t*t)/m));\nend", "def ld\n jd - LD_JD\n end", "def tx__x(n, x); 2.0 - tdist(n, x) * 2.0; end", "def double\n return self if infinity?\n gamma = field.mod((3 * x * x + @group.param_a) * field.inverse(2 * y))\n new_x = field.mod(gamma * gamma - 2 * x)\n new_y = field.mod(gamma * (x - new_x) - y)\n self.class.new(group, new_x, new_y)\n end", "def normalx__x(z); 2.0 - normaldist(z) * 2.0; end", "def flotante()\n\t\tflotante = @num/@den.to_f\n\t\treturn flotante\n\tend", "def basis\n return @basis\n end", "def CalculatePentagonal (input)\n\treturn (input * (3*input - 1) / 2)\nend", "def solar_declination(t)\n\te = obliquity_corr(t)\n\tlambda = sun_apparent_lon(t)\n\tMath.asin(Math.sin(e)*Math.sin(lambda))\nend", "def t\n return @L if a < 0\n round ((t1 / @P) +@L)\n end", "def mle_via_newton(logLikelihood,initial_parameter_value,tolerance=0.001)\n # Your code goes here.\nend", "def normal__X_(z); normaldist(z) - 0.5; end", "def earth_orbit_eccentricity(t)\n\t0.016708634 -t*(0.000042037 +t*0.0000001267)\nend", "def determinant_by_elimination_euclidian#_new\n m = dup\n det = ground.unity\n each_j do |d|\n if i = (d...size).find{|i| !m[i, d].zero?}\n if i != d\n m.sswap_r!(d, i)\n det = -det\n end\n (d+1...size).each do |i0|\n r = m.row!(i0)\n q = m[i0, d] / m[d, d]\n (d...size).each do |j0|; r[j0] -= q * m[d, j0]; end\n unless m[i0, d].zero?\n m.sswap_r!(d, i0)\n det = -det\n redo\n end\n end\n det *= m[d, d]\n else\n return ground.zero\n end\n end\n det\n end", "def lcs\n setup\n compute_matrix\n @matrix.last.last\n end", "def ln_rek(x,n)\r\n\r\nend", "def max_orbit_phi\n PI / 2 - declination_rad\n end" ]
[ "0.62021905", "0.6001425", "0.599777", "0.575671", "0.57272774", "0.5725249", "0.57087594", "0.5695702", "0.56768763", "0.56428194", "0.5630614", "0.55977595", "0.5592741", "0.55814606", "0.555696", "0.5552175", "0.55311406", "0.5514243", "0.55119264", "0.5494177", "0.5484732", "0.547969", "0.54774386", "0.5471368", "0.5466942", "0.5462295", "0.5449078", "0.5442949", "0.54074156", "0.5400784", "0.5394011", "0.53880113", "0.5372276", "0.5369738", "0.53651685", "0.536478", "0.53597385", "0.53535247", "0.53513074", "0.5349454", "0.53470045", "0.53407735", "0.5335421", "0.53326315", "0.5330918", "0.5325298", "0.5325245", "0.5325025", "0.53209984", "0.53148633", "0.5297017", "0.52956223", "0.52877355", "0.5277733", "0.52765757", "0.5273489", "0.5271237", "0.52622855", "0.526068", "0.5249178", "0.52489555", "0.5248783", "0.52460766", "0.5243897", "0.5241998", "0.5236693", "0.5236402", "0.5232802", "0.5232709", "0.52222085", "0.5219622", "0.52146876", "0.52110046", "0.520218", "0.51985455", "0.5196531", "0.51956946", "0.51838434", "0.51837516", "0.5178449", "0.5175643", "0.5172788", "0.51617235", "0.51586986", "0.515297", "0.51508623", "0.5143086", "0.5141436", "0.5133946", "0.5127342", "0.5112143", "0.5110945", "0.5110831", "0.510215", "0.51017195", "0.50949216", "0.5089978", "0.5089284", "0.5086772", "0.5076618", "0.50745547" ]
0.0
-1
this function check if user didn't complete his profile and show a red warning on the top of the page exept in the edit user page and adding details page rubocop:disable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
def checkaccount(user) return unless user link = user.service if (link == 'Both' && !user.sel_detail && !current_page?('/both_details/new') && !current_page?("/users/edit.#{user.id}")) || (link == 'customer' && !user.cus_detail && !current_page?('/cus_details/new') && !current_page?("/users/edit.#{user.id}")) render 'layouts/checkaccount' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completed_profile\n if user_signed_in?\n if (current_user.soi_number.blank? || current_user.phone_number.blank? || current_user.diploma.blank?)\n redirect_to edit_user_path(current_user), alert: \"Votre profil doit être complété\"\n end\n end\n end", "def confirm!\n # add if else here in case user already existed and is updating/changing data (email etc),\n # shouldn't add_profile again if profile already exists. can determine with a user db 'nil' value...\n unless self.profile\n add_profile\n end\n super\n end", "def profile_must_completed\n\t\t\tif current_student\n\t\t\t\tuser = current_student\n\n\t\t\t\tif user.profile.nil? || user.profile.is_empty?\n\t\t\t\t\tredirect_to profile_index_path, \n\t\t\t\t\t\talert: \"Please fill in your profile before joining events.\"\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def require_complete_user\n redirect_to(edit_user_path, notice: t('application_controller.complete_profile')) and return if (user_signed_in? && !current_user.complete?)\n end", "def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end", "def correct_user_for_profile\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Log in as correct user.\"\n redirect_to(root_url)\n end \n end", "def manage_profile\n begin\n @has_link_access = true\n if @actor.is_fan? # in case of fan profile login\n @user = @actor\n @additional_info = current_user.additional_info\n get_user_associated_objects\n render :template =>\"/fan/manage_profile\" and return\n elsif @actor.is_artist? # in case of artist profile login\n @user = current_user\n @artist = @actor\n @artist_user = ArtistUser.for_user_and_artist(current_user, @artist).first || ArtistUser.new\n get_artist_objects_for_right_column(@artist)\n render :template =>\"/artist/edit\" and return\n elsif @actor.is_venue? # in case of venue profile login\n @user = current_user\n @venue = @actor\n @venue_user = VenueUser.for_user_and_venue(current_user, @venue).first || VenueUser.new\n get_venue_objects_for_right_column(@venue)\n render :template =>\"/venue/edit\" and return\n end\n rescue =>exp\n logger.error \"Error in User#ManageProfile :=> #{exp.message}\"\n render :nothing => true and return\n end\n respond_to do |format|\n format.js\n format.html\n end\n end", "def user_signup_finished?\n unless is_guest?\n if current_user == User.friendly.find(params[:id])\n @user = current_user\n if @user.valid? == false # If user's attributes are missing, sends them to 'Finish Profile Page'\n flash[:alert] = \"Please finish signing up for Ossemble by entering your First Name, Last Name, Birth Date, Address, and ensuring your location is correct.\"\n redirect_to edit_user_registration_path # Finish Profile Page Setup with form\n end\n end\n end\n end", "def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end", "def profile_complete?\n\t\t!self.fname.blank? and !self.lname.blank? and !self.email.blank? and !self.company_name.blank? and !self.country.blank? and !self.locale.blank?\n\tend", "def is_correct_user?\n # Set user variable from params passed through link\n @user = User.find(params[:id])\n # Comparison\n if !current_user?(@user)\n redirect_to home_path\n flash[:danger] = \"This is not your profile\"\n end\n end", "def check_profile_enabled(u)\n fn = u.first_name\n ln = u.last_name\n un = u.username\n e = u.email\n visit user_path(u)\n assert page.has_css?('title', text: full_title(\"User: #{fn} #{ln}\"),\n visible: false)\n assert page.has_css?('h1', text: \"User: #{fn} #{ln}\",\n visible: false)\n assert page.has_text?(\"Username: #{un}\")\n assert page.has_text?(\"Email: #{e}\")\n end", "def user_update\n \t saveupdateProfile = UsersService.updateProfile(user_profile_params)\n \t if saveupdateProfile \n \t \tredirect_to users_path, notice: \"Successfully Updated!!!.\"\n \t else\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n \t \trender :edit_profile\n \t end\n end", "def profile\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = current_user;\n end\n end", "def authorize_user\n @profile = current_user.profile\n return if @profile\n flash[:alert] = \"You can only edit your own profile\"\n redirect_to profile_path\n end", "def update_user_profile(profile_form)\n isUpdateProfile = UserService.updateProfile(profile_form)\n if isUpdateProfile\n redirect_to users_path\n else\n asdasd\n render :edit_profile\n end\n end", "def owned_profile\n @user = User.find_by(user_name: params[:user_name])\n unless current_user == @user\n flash[:alert] = \"That profile does not belong to you!\"\n redirect_to root_path\n end\n end", "def require_same_user\n @profile = Profile.find(params[:id])\n if @profile.user_id != current_user.id\n flash[:danger] = \"You are not right User to made this changes\"\n redirect_to root_path\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash.now[:alert] = 'You cannot access this area because this is not your profile'\n redirect_to(root_url)\n end\n end", "def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end", "def set_profile\n @profile = Profile.friendly.find(params[:id])\n if !(@profile \n (session[:type_user]==\"SimpleUser\" and current_user.profile.family.id==@profile.family.id ) or \n (session[:type_user]==\"Miembro\" and @profile.family and current_user.profile.member.comunity.id==@profile.family.comunity.id) or\n (session[:type_user]==\"Administrador\"))\n redirect_to(root_path,alert: \"Lo sentimos, no tiene permisos para acceder a esta seccion\") \n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash.now[:danger] = \"You can only change your own profile.\"\n redirect_to signin_url\n end\n end", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "def update\n if conditionally_update\n handle_successful_update\n redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: \"Your profile has been updated\"\n else\n redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages\n end\n end", "def profile_complete?\n\t\tself.contact_phone && self.bio && self.first_name\n\tend", "def check_user_status\n if current_user.is_a?(User) && (current_user.suspended? || current_user.banned?)\n if current_user.suspended? \n flash[:error] = t('suspension_notice', :default => \"Your account has been suspended. You may not add or edit content until your suspension has been resolved. Please contact us for more information.\")\n else\n flash[:error] = t('ban_notice', :default => \"Your account has been banned. You are not permitted to add or edit archive content. Please contact us for more information.\")\n end\n redirect_to current_user\n end\n end", "def edit\n @user.build_user_profile unless @user.user_profile\n end", "def index\n\n\t\t@user=current_user\n\n\t\t# We need to tell the view what to do with the profile\n\t\t# If a profile exists then display some profile information\n\t\t# If a profile doesn't exist then display a message saying to click the edit button to add a new profile\n\n\t\t# Does a valid profile exist on the user?\n\t\t@valid_profile = Profile.exists?(user_id: @user.id)\n\n\t\t# Valid profile exists\n\t\tif @valid_profile\n\n\t\t\t@user_profile = Profile.find_by(user_id: @user.id)\n\n\t\telse\n\n\t\t\t# No valid profile exists\n\t\t\t# The user can either create a new profile or request an existing one\n\t\t\t#@user_profile_requests = @user.profile_requests\n\n\t\t\t# if !current_user.profile_requests.approved(false).empty? %>\n\n\t\t\t# Create a list of user profile requests that are not set yet\n\t\t\t@user_profile_requests_not_set = @user.profile_requests.status_not_set\n\n\t\t\tif @user_profile_requests_not_set.blank?\n\n\t\t\t\t@available_profiles_collection = Profile.where(user_id: nil).order(:lastname)\n\n\t\t\tend\n\n\t\t\t# Create a list of user profile requests that are denied\n\t\t\t@user_profile_requests_denied = @user.profile_requests.status_denied\n\n\t\tend\n\n\n\n\n\tend", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def appctrl_ensure_user_is_valid\n edit_user = if @current_user.try( :invalid? )\n view_context.apphelp_flash( :error, :provide_account_details, ApplicationController )\n true\n elsif @current_user.try( :must_reset_password? )\n view_context.apphelp_flash( :warning, :must_reset_password, ApplicationController )\n true\n end\n\n redirect_to( edit_user_path( @current_user ) ) if ( edit_user )\n end", "def check_user_info_initialized\n exists = UserInfo.exists?(current_user.id)\n create = controller_name == 'user_infos' && %w(new create).include?(action_name)\n if exists && create\n redirect_to(user_info_path)\n elsif !exists && !create\n flash[:notice] = \"Page will be available after filling in your information.\"\n redirect_to(new_user_info_path)\n end\n end", "def edit\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n end", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def admin_user_profile\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !@app.is_admin or @app.is_admin === 0\n redirect_to '/error_page'\n end\n\n # Get User from DB\n @user = User.find(params[:user_id])\n\n # Get Apps for that user\n @user_apps = App.where(user_id: @user.id)\n\n # Get Subs Remaining\n @subs_left = MailFunnelsUser.get_remaining_subs(@user.clientid)\n\n end", "def profile_completed?\n first_name && last_name && specialty && address && phone && sex && min_nb_consult && duration_consult && cardnumber\n end", "def confirm_own_classes_page\n if (Profile.find(params[:profile].to_i).user_id != session[:user_id])\n flash[:notice] = \"You cannot take courses for other users!\"\n if session[:admin]\n redirect_to admin_path\n else\n redirect_to(user_path( :id => session[:user_id]))\n end\n end\n end", "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Business\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "def set_profile_completeness\n self.public = (self.bio.present? && self.avatar.present? && self.category.present?)\n end", "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Business\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "def has_profile\n if current_user && current_user.is_caterer? && CatererInformation.find_by(user_id: current_user.id) == nil\n redirect_to new_caterer_information_path, notice: \"Must create a Profile first\"\n end\n end", "def creator_info\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n @user.errors.add(:avatar, \"is required\") if @user.avatar_missing?\n @user.errors.add(:tagline, \"is required\") if @user.tagline.blank?\n redirect_to creator_payment_path(@user) and return unless @user.avatar_missing? || @user.tagline.blank?\n end\n @nav = \"signup\"\n end", "def check_if_user\n render text: \"Fuck you user\", status: 403 unless current_user.id == @book.user_id || current_user.rank_id == 2\n end", "def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end", "def force_update_profile!\n return unless current_user && !current_user.email?\n return if protected_controllers?\n\n redirect_to edit_user_registration_url\n end", "def checkUser\n if validUser\n return true\n else\n flash[:alert] = \"Unauthorized Access!!\"\n redirect_to profile_path(current_user)\n end\n end", "def check_user_status\n user = current_user\n if user && user.status != 2\n redirect_to signupcode_settings_path\n end\n end", "def profile_completed?\n !self.name.blank? and !self.country.blank? and !self.contact_number.blank?\n end", "def update\n if not params[:id]\n redirect_to root_path\n end\n user = User.find(params[:id])\n # update fields\n user.first_name = user_params[:first_name]\n user.last_name = user_params[:last_name]\n user.age = user_params[:age]\n user.education = user_params[:education]\n user.school = user_params[:school]\n user.expertise = user_params[:expertise]\n user.description = user_params[:description]\n user.availability = user_params[:availability]\n user.save\n \n # update complete flag\n if not user.complete\n all_fields_filled = true\n user_params.each do |k, v|\n if v.blank?\n all_fields_filled = false\n end\n end\n if all_fields_filled \n user.complete = true\n user.save\n else\n flash[:warning] = \"Some profile information is still missing. Please fill out the missing fields so that we can determine the best projects for you!\"\n end\n\n if not flash[:warning]\n flash[:notice] = \"Profile was successfully updated.\"\n end\n end\n\n redirect_to user_path(params[:id])\n end", "def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end", "def update_profile\n @status_update = false;\n user_info ={}\n user_info[\"first_name\"] = params[\"first_name\"]\n user_info[\"last_name\"] = params[\"last_name\"]\n user_info[\"email\"] = params[\"email\"]\n user_info[\"password\"] = params[\"password\"] unless params[\"password\"].blank?\n @existed_user = User.find_by_id(params[\"hidden_user_id\"])\n if @existed_user.id == current_user.id\n @existed_user.organization.update_attributes(:language => params[\"language\"],:time_zone => params[\"time_zone\"])\n @status_update = @existed_user.update_attributes(user_info)\n sign_in(@existed_user,:bypass => true)\n\n @full_name = @existed_user.first_name + \" \" + @existed_user.last_name \n end\n respond_to do |format|\n format.js\n end\n end", "def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end", "def update\n unless current_user == @user.user\n respond_to do |format|\n format.html { redirect_to profiles_path, alert: 'You have improper permissions to edit this profile.' }\n format.json { head :no_content }\n end\n return\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_credentials\n return false unless (current_user.access_level.user_level >= 100) && (current_user.id == @profile.user_id)\n true\n end", "def verify_user_for_changes!\n\n unless @item.editable_by_user?(auth_user)\n status_error = @item.errors[:status].present? ? @item.errors[:status].join(' ') : nil\n flash[:error] = status_error || \"You do not have permission to the item.\"\n redirect_back(items_path) && return\n\n else\n if ItemPhoto.over_the_limit?(@item)\n flash[:notice] = \"The images over the limit will be discarded.\"\n end\n end\n\n end", "def update\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n @profile.approved_by = \"#{current_user.first_name} #{current_user.last_name}\"\n else\n @profile.approved_by = \"\"\n end\n\n if profile_params[:status] == \"Pending\" # This condition sends an email if profile status is set to pending\n NotificationMailer.new_pending(@profile).deliver_now\n end\n\n respond_to do |format|\n if @profile.update(profile_params)\n if profile_params[:status] == \"Approved\"\n format.html { redirect_to profiles_url, notice: '*Profile was successfully approved.' }\n elsif profile_params[:status] == \"Rejected\"\n format.html { redirect_to profiles_url, notice: '*Profile was rejected.' }\n else\n format.html { redirect_to @profile, notice: '*Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n end\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n NotificationMailer.new_response(@profile).deliver_now\n end\n else\n @sections = Section.all\n @projects = Project.where(user_id: current_user.id)\n @employment = Employment.where(user_id: current_user.id)\n @education = Education.where(user_id: current_user.id)\n @certifications = Certification.where(user_id: current_user.id)\n @customs = Custom.where(user_id: current_user.id)\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_info\n u_id= params[:user_id].present? ? params[:user_id].to_i : current_user.id\n @profile= Profile.find_by_user_id u_id\n export_btn=false\n if !@profile.present?\n response = {\n status: 'error',\n type: 'custom'\n }\n message = \"User not found\"\n render json: {status: \"error\", code: 422, message: message}\n \n else\n is_user_confirm = @profile.user.confirmed?\n request_button=false;\n edit_rights=false\n if current_user.member.present?\n export_btn= current_user.member.show_export\n end\n if u_id!=current_user.id\n edit_rights=UserRole.my_regional_admin(current_user,@profile.user.region)\n else\n edit_rights=true\n end\n\n if (!request_button)\n @photo = Photo.where(:user_id => @profile.user_id,:active=>true) \n else\n @photo = Photo.where(:user_id => @profile.user_id,:active=>true) #,:private_pic=>false\n end\n \n @partner_preferences = PartnerPreference.find_by_user_id u_id \n if @partner_preferences.present?\n @deal_breaker = DealBreaker.find_by_partner_preference_id @partner_preferences.id \n else\n @partner_preferences = PartnerPreference.new\n @deal_breaker = DealBreaker.new\n end\n @interest = Interest.select(Arel.star).where(\n Interest.arel_table[:user_id].eq(u_id).and(Interest.arel_table[:user_to].eq(current_user.id)).or(\n Interest.arel_table[:user_id].eq(current_user.id).and(Interest.arel_table[:user_to].eq(u_id))\n )\n )\n \n render json: {\n status: 200,\n message: true,\n profile:@profile,\n photo:@photo,\n user:@profile.user,\n partner_preferences:@partner_preferences,\n deal_breakers:@deal_breaker,\n request_button:request_button,\n edit_rights: edit_rights,\n interest: @interest.first, \n export_feature: export_btn,\n is_user_confirm: is_user_confirm\n }.to_json\n end\n #MANAGING MEMBER PROFILE FOR ADMIN\n # @optionbtn=false\n # if Profile.privilige(current_user,@profile.user)\n # @optionbtn=true\n # if(@profile.profile_state=='awaiting_review')\n # @profile.review!\n # end\n # else\n # @optionbtn=false\n # end\n end", "def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end", "def verify_user!\n @profile = current_user.profile\n end", "def verify_user!\n @profile = current_user.profile\n end", "def update_profile\n if @user.update(user_params)\n flash[:success] = \"Update user profile succesfully!\"\n redirect_back(fallback_location: root_path)\n else\n @user.errors.full_messages.each do |message|\n flash[:error] = message\n end\n render :profile\n end\n end", "def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end", "def profiel\n if request.post? and params[:user]\n\n if @me.update_attributes(params[:user])\n # website stuff!\n if params[:user][:profile_website]\n if params[:user][:profile_website][0..6] != \"http://\" and !params[:user][:profile_website].blank?\n @me.update_attribute('profile_website', 'http://' + params[:user][:profile_website])\n end\n end\n flash.now[:notice] = \"Profiel gewijzigd\"\n end\n end\n \n end", "def edit\n @help = PageContent.find_by_name(\"profile-help\") # \"What to include in profile\" Content\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n end\n #displays current profile information for editing \n if !@presenter_profile.bio_edit.nil?\n if @presenter_profile.approved? && @presenter_profile.bio_edit.empty?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n else\n if @presenter_profile.approved?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n end\n end", "def users(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Users\" page.\n begin\n @ff.link(:text, 'Users').click\n self.msg(rule_name, :info, 'users', 'Reached page \\'Users\\'.')\n rescue\n self.msg(rule_name, :error, 'users', 'Did not reach \\'Users\\' page')\n return\n end\n\n if (info.has_key?('Delete User'))\n\tsTable = false\n\t@ff.tables.each do |t|\n\t if (t.text.include? 'Full Name') and\n\t (not t.text.include? 'The Users page provides') and\n\t (t.row_count > 2) then\n\t sTable = t\n\t break\n\t end\n\tend\n\tif sTable == false\n # Wrong here\n\t self.msg(rule_name,:error,'Delete User','Did NOT find the target table.')\n\t return\n\tend\n\tsTable.each do |row|\n\t if (row[2].to_s == info['Delete User'])\n\t\trow.link(:name,'remove').click\n\t\tif @ff.text.include? 'Attention'\n\t\t @ff.link(:text,'Apply').click\n\t\tend\n\t\tif @ff.text.include? 'Input Errors'\n\t\t sTable = false\n\t\t @ff.tables.each do |t|\n\t\t\tif ( t.text.include? ':' and \n\t\t\t\t( not t.text.include? 'Input Errors') and\n\t\t\t\t( not t.text.include? 'Cancel') and\n\t\t\t\tt.row_count >= 1 )then\n\t\t\t\t\tsTable = t\n\t\t\t\tbreak\n\t\t\tend\n\t\t end\n \n\t\t if sTable == false\n\t\t\tself.msg(rule_name,:error,'Users','Did NOT find the target table.')\n\t\t\treturn\n\t\t end\n \n\t\t sTable.each do |row|\n \n\t\t\tif row[1] == \"\" or row[2] == nil\n\t\t\t next\n\t\t\tend\n \n\t\t\tself.msg(rule_name,:error,row[1],row[2])\n \n\t\t end\n \n\t\t # Click the \"cancel\"\n\t\t @ff.link(:text,'Cancel').click\n\t\t return\n \n \n\t\tend\n\t\tself.msg(rule_name,:info,'Delete User','Delete ' + row[3].to_s + ' User Success')\n\t end\n\tend\n\treturn\t\n end\n\n if (info.has_key?('Edit User'))\n\tsTable = false\n\t@ff.tables.each do |t|\n\t if (t.text.include? 'Full Name') and\n\t (not t.text.include? 'The Users page provides') and\n\t (t.row_count > 2) then\n\t sTable = t\n\t break\n\t end\n\tend\n\tif sTable == false\n # Wrong here\n\t self.msg(rule_name,:error,'Edit User','Did NOT find the target table.')\n\t return\n\tend\n\tsTable.each do |row|\n\t if (row[2].to_s == info['Edit User'])\n\t\trow.link(:name,'edit').click\n\t\tself.msg(rule_name,:info,'Edit User','start to edit user')\n\t end\n\tend\n end\n \n # Check the key.\n if ( not info.has_key?('Edit User'))\n if ( info.has_key?('Full Name') &&\n info.has_key?('User Name') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'users','Some key NOT found.')\n return\n end\n \n # Parse the json file\n \n # Add a user here.\n @ff.link(:text,\"New User\").click\n \n end\n # Enter the user's information\n \n # Full Name\n @ff.text_field(:name,'fullname').value = info['Full Name']\n self.msg(rule_name,:info,'fullname',info['Full Name'])\n \n # User Name\n @ff.text_field(:name,'username').value = info['User Name']\n self.msg(rule_name,:info,'username',info['User Name'])\n \n # New Password & Retype New Password\n @ff.text_field(:index,3).set(info['New Password']) \n @ff.text_field(:index,4).set(info['Retype New Password'])\n self.msg(rule_name,:info,'Password',info['New Password'])\n \n # Permission\n case info['Permission']\n \n when 'Administrator'\n @ff.select_list(:name,'user_level').select(\"Administrator\")\n self.msg(rule_name,:info,'Permissions','Administrator')\n when 'Limited'\n @ff.select_list(:name,'user_level').select(\"Limited\")\n self.msg(rule_name,:info,'Permissions','Limited')\n else\n # Wrong here\n self.msg(rule_name,:error,'Permissions','Wrong Permissions')\n return\n end \n \n # Notification Address\n if info.has_key?('Notification Address')\n @ff.text_field(:name,'email').set(info['Notification Address'])\n self.msg(rule_name,:info,'Notification Address',info['Notification Address'])\n end\n \n # System Notify Level\n case info['System Notify Level']\n when 'None' \n @ff.select_list(:name,'email_system_notify_level').set_value(\"15\")\n when 'Error'\n @ff.select_list(:name,'email_system_notify_level').set_value(\"3\")\n when 'Warning'\n @ff.select_list(:name,'email_system_notify_level').set_value(\"4\")\n when 'Information'\n @ff.select_list(:name,'email_system_notify_level').set_value(\"6\")\n else\n # Wrong here\n self.msg(rule_name,:error,'users','Some key NOT found in System Notify Level.')\n return \n end\n \n # System Notify Level\n case info['Security Notify Level']\n when 'None' \n @ff.select_list(:name,'email_security_notify_level').set_value(\"15\")\n when 'Error'\n @ff.select_list(:name,'email_security_notify_level').set_value(\"3\")\n when 'Warning'\n @ff.select_list(:name,'email_security_notify_level').set_value(\"4\")\n when 'Information'\n @ff.select_list(:name,'email_security_notify_level').set_value(\"6\")\n else\n # Wrong here\n self.msg(rule_name,:error,'users','Some key NOT found in System Notify Level.')\n return \n end\n \n # Apply the new user.\n @ff.link(:text,'Apply').click\n \n # Jump out an \"attention\" message?\n if @ff.text.include? 'Attention'\n @ff.link(:text,'Apply').click\n end\n\n if @ff.text.include? 'Input Errors'\n self.msg(rule_name,:error,'Input Errors','Input Errors')\t\n @ff.link(:text,'Cancel').click\n end\n\n \n # Close\n if @ff.text.include? 'Close'\n @ff.link(:text,'Close').click\n end\n \n self.msg(rule_name,:info,'Users','SUCCESS')\n \n return \n \n end", "def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(user)\n end\n end", "def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend", "def edit\n if @user != current_user\n flash[:error] = \"You cannot do that\"\n redirect_to users_path\n end\n end", "def only_your_profile_page\n @admin = Admin.find(params[:admin_id])\n\n if current_admin != @admin\n redirect_to sectors_path, notice: \"Access denied! You can only view your own profile page.\"\n end\n end", "def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end", "def users_edit_crumbs(crumb_options)\n # No crumbs for editing own profile. Only backlink to Profile page.\n if crumb_options[:first_visit]\n @no_crumbs = true\n else\n pluraized_role = crumb_options[:user].is_mentor? ? _Mentors : _Mentees\n add_crumb pluraized_role, users_path(:view => pluraized_role)\n add_crumb crumb_options[:user].name, user_path(crumb_options[:user])\n add_crumb \"Edit Profile\"\n end\n end", "def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend", "def user_check(id)\n check_user = User.find(id)\n if check_user != current_user\n flash[:notice] = \"You can only modify your own user information.\"\n redirect_to user_path(check_user)\n end\n end", "def show\n op = present User::Show\n redirect_to edit_user_profile_path(current_user, op.model.profile) && return if op.new_profile?\n redirect_to user_profile_path(current_user, op.model.profile)\n end", "def user_profile_edit\n\n\n end", "def check_users\n dups = valids = invalid_format = total = 0\n @summary = '<ol>'\n each_user_line(params[:users_to_add]) do |line|\n total += 1\n (status, email, first_name, last_name) = check_new_user(line)\n case status\n when 'already_exists'\n line_out = \"email: #{email} already exists in the system, won't be added, but may add new roles.\"\n dups += 1\n when 'invalid_format'\n line_out = \"#{line} Unrecognized format, won't be added\"\n invalid_format += 1\n when 'good'\n line_out = \"email-(#{email}) first_name-(#{first_name}) last_name-(#{last_name})\"\n valids += 1\n end\n\t\n @summary += '<li>' + line_out + '</li>'\n end\n @summary += '</ol>'\n \n @summary = \"<p>Out of #{total} users to add: #{valids} are valid, #{dups} already exist, and #{invalid_format} are in the wrong format.</p>\" + @summary\n render :update do |page|\n page.replace_html :summary, \"<h2>Summary</h2>\" + @summary\n end\n\n end", "def atest_ID_25835_edit_profile_desc\n login_as_user1\n go_to_edit_profile_page\n verify_elements_on_edit_profile \"test_ID_25835_edit_profile_desc\"\n end", "def update\n #first we find the user edited in the partial form.\n @user = User.find(params[:id])\n #than we update the user based on the params received from the partial form.\n if @user.update_attributes(params[:user])\n #if attributes updated display confirmation.\n flash[:success] = \"User details updated!\"\n #if logged user is admin redirect to the INDEX (users_path).\n if current_user.admin?\n redirect_to users_path\n #if logged user isn't admin redirect to application INDEX (store_path).\n else\n redirect_to user_path\n end\n #if it user is not saved, the reason will be displayed (please see partial form for details)\n # and render the EDIT action, so the partial form can be changed to pass the validations.\n else\n render 'edit'\n end\n end", "def update_profile_store_owner\n @status_update = false;\n user_info ={}\n error_type = \"\"\n org_name = params[\"business_name\"]\n user_info[\"first_name\"] = params[\"first_name\"]\n user_info[\"last_name\"] = params[\"last_name\"]\n user_info[\"email\"] = params[\"email\"]\n user_info[\"password\"] = params[\"password\"] unless params[\"password\"].blank?\n @existed_user = User.find_by_id(params[\"hidden_user_id\"])\n if @existed_user.id == current_user.id\n @status_update = @existed_user.update_attributes(user_info)\n @existed_user.organization.update_attributes(:name =>params[\"business_name\"])\n sign_in(@existed_user,:bypass => true)\n @full_name = @existed_user.first_name + \" \" + @existed_user.last_name \n end\n respond_to do |format|\n format.js\n end\n #render :js => \"update_success(#{@status_update}, #{@full_name})\"\n end", "def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end", "def must_be_current_users_page_to_destroy_post\n\n unless (Post.find_by(id: params[:post_id]).user.id == current_user.id)\n flash[:danger] = \"This is not your profile page. Please log in if this is your account\"\n redirect_to home_path\n end\nend", "def user_details_complete(user)\n\n user_details_fields_presence = []\n\n user_details_fields_presence.push(user.name.present?)\n user_details_fields_presence.push(user.date_of_birth.present?)\n user_details_fields_presence.push(\n (\n user.line1.present? &&\n user.townCity.present? &&\n user.county.present? &&\n user.postcode.present?\n )\n )\n\n user_details_fields_presence.all?\n\n end", "def edit\n @user.build_profile if @user.profile.blank?\n end", "def check_user\n if !auth_user.is_a?(Parent) || auth_user.account_confirmed\n logger.info \" --> #{auth_user.class} (account_confirmed? #{auth_user.try(:account_confirmed)}) redirecting away from acount conf.\"\n ::Users::Notifications::NeedsAccountConfirm.sent_to(auth_user).delete_all if auth_user && auth_user.account_confirmed\n return redirect_to notifications_path\n end\n\n if auth_user.primary_user_location && (user_location_h = params.delete(:user_location) )\n new_user_location = ::Users::UserLocation.new(user_location_h)\n unless auth_user.primary_user_location.is_eq?(new_user_location)\n new_user_location.user_id = auth_user.id\n new_user_location.reviewed = false\n new_user_location.save\n end\n end\n end", "def confirm_own_account_page\n #\t unless ((@user_id == session[:user_id])||(session[:admin]))\n # \t\tflash[:notice] = \"That URL is not for your account!\"\n #\t\t redirect_to(user_path( :id => session[:user_id]))\n #\t end\n end", "def is_accessing_self?\n if session[:user_id] != params[:id].to_i\n flash[:error] = \"You do not have access to this profile\"\n custom_redirect_back\n end\n end", "def show\n @user = User.find_by_id(params[:id]) || User.find_by_id(@current_logged_in_user.id)\n \n if @user.disabled\n @user = nil\n flash[:warning] = \"The specified user could not be found.\"\n redirect_to :controller => :bodysize\n return\n end\n \n end", "def update\n if @current_user.id == params[:id].to_i && \\\n @current_user.update_attributes(params[:user])\n flash[:success] = \"profile was successfully updated\"\n redirect_to individual_path(@current_user.id)\n else\n flash[:error] = \"update error, please try again\"\n @user = @current_user\n render(:action => \"edit\")\n end\n end", "def profile\r\n\t\tif User.exists?(id: params[:id])\r\n\t\t\t@user = User.where(id: params[:id])\r\n\t\t\t@name = @user[0].username\r\n\t\t\t@member_since = @user[0].member_since\r\n\t\t\t@email = @user[0].email\r\n\t\t\t@xp = @user[0].xp\r\n\t\t\t@answercount = @user[0].no_comment\r\n\t\t\t@postcount = @user[0].no_thread\r\n\t\t\t\r\n\t\t\t#add achievements\r\n\t\t\tif @u_id == params[:id].to_i\r\n\t\t\t\t@achievements = Achievement.find(:all)\r\n\t\t\t\t@achievements.each do |a|\r\n\t\t\t\t\tif @xp >= a.condition\r\n\t\t\t\t\t\tif UserAchievement.where(user_id: @u_id, achievement_id: a.id).empty?\r\n\t\t\t\t\t\t\t@ua = UserAchievement.new(:user_id => @u_id, :achievement_id => a.id)\r\n\t\t\t\t\t\t\t@ua.save\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t# retrieves achievements to be displayed\r\n\t\t\t@achievement = UserAchievement.where(user_id: params[:id])\r\n\t\t\t\r\n\t\telse\r\n\t\t\tredirect_to root_path\r\n\t\tend\r\n\tend", "def update\n @user = User.find(params[:id])\n @profile = Profile.find @user.profile.id\n\n if @user.mooveit? && !params[:is_admin].nil?\n @user.role = Role.find_by_name Role::ADMIN_ROLE\n end\n\n if @user.admin? && params[:is_admin].nil?\n @user.role = Role.find_by_name Role::MOOVEIT_ROLE\n end\n\n\n respond_to do |format|\n if @user.update_without_password(params[:user]) && @profile.update_attributes(params[:profile])\n #format.html { redirect_to @user, notice: 'User was successfully updated.' }\n #format.json { head :no_content }\n @users = User.all\n format.js { render action: \"index\" }\n else\n #format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_allowed\n unless $allowed_users.include?(current_user.email)\n flash[:alert] = \"That information is not available.\"\n redirect_to :action => 'welcome', :controller => 'info'\n end\n end", "def update\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n \n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n else\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n if !new_profile.has_key?(:picture_edit)\n new_profile[:picture_edit] = nil\n end\n #submit for approval\n if params[:submit]\n if @presenter_profile.update(new_profile)\n #checks profile has been changed\n if @presenter_profile.bio != @presenter_profile.bio_edit || @presenter_profile.picture_edit_stored?\n if current_user.user_type == \"admin\"\n @presenter_profile.update_attribute(:status, :pending_presenter)\n flash[:info] = \"Profile changes submitted to presenter for approval\"\n Notification.send_message(@presenter.user, \"You have pending profile changes to review from an Admin\", presenter_profile_path(@presenter), :system)\n redirect_to admin_path\n else #current user is profile owner\n @presenter_profile.update_attribute(:status, :pending_admin)\n flash[:info] = \"Profile changes submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n end\n else # No changes were made\n @presenter_profile.bio_edit = ''\n @presenter_profile.picture_edit = nil\n flash[:warning] = 'No changes were made, please make changes before pressing submit'\n redirect_to edit_presenter_profile_path(@presenter)\n end\n else\n render 'edit'\n end\n #save draft\n elsif params[:save]\n if @presenter_profile.update(new_profile)\n if current_user.presenter?\n @presenter_profile.update_attribute(:status, :draft_presenter)\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to presenters_path\n else #current_user.admin?\n @presenter_profile.update_attribute(:status, :draft_admin)\n flash[:info] = \"Profile draft saved for #{@presenter.first_name}'s profile.\"\n redirect_to admin_path\n end\n else\n render 'edit'\n end\n end\n end\n end", "def check_necessity\n User.any? and redirect_to root_path\n end", "def correct_user\n @user = User.find(params[:id])\n #render :json => { :updated? => false, :status => 200, :message => \"You are not allowed edit other users.\" } unless @user == current_user\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"僅能修改自己的資料\"\n redirect_to root_url\n end\n end", "def notify_profile_moderator\n\t\tif @profile.errors.empty? && !current_user.profile_editor?\n\t\t\tAdminMailer.on_update_alert(@profile).deliver_now\n\t\tend\n\tend", "def update\n respond_to do |format|\n @user = User.find(params[:id])\n if @user.update(user_params) \n if params[:user][:country_of_residence_code]\n country_reside = @user.country_of_residence\n resideArr = country_reside.split(\",\")\n make_decision(@user, resideArr, 1)\n end\n if params[:user][:country_visited]\n #we need to accumulate the country_visited somehow\n visited = params[:user][:country_visited] \n visitedArr = visited.split(\",\")\n visitedArr = country_code_convert(visitedArr)\n visitedArr = visitedArr.uniq\n if country_check(visitedArr)\n make_decision(@user, visitedArr, 2)\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n if params[:user][:country_to_visit]\n tovisit = params[:user][:country_to_visit] \n tovisitArr = tovisit.split(\",\")\n tovisitArr = tovisitArr.uniq\n if country_check(tovisitArr)\n make_decision(@user, tovisitArr, 3)\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n flash[:success] = \"Profile was successfully updated.\"\n format.html { redirect_to @user }\n format.json { render :show, status: :ok, location: @user }\n else\n flash[:danger] = \"Profile was not updated.\"\n @user_traveled_list = @user.has_been_to\n @user_to_travel_to = @user.wants_to_go_to\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @role = Role.find(:all)\n @current_object = Profile.find(params[:id])\n #respond_to do |format|\n @current_object.full_name_separation(params[:profile_full_name]) \n \n \n \n if @current_object.update_attributes!(params[:profile])\n\t\t\t\t@current_object.create_profile_workspace if @current_object.profile_workspace.nil?\n\t\t\t\tif user = @current_object.user\n\t\t\t\t\tuser.email = @current_object.email_address\n\t\t\t\t\tuser.system_role_id = params[:system_role_id] if params[:system_role_id]\n\t\t\t\t\tuser.save\n\t\t\t\tend\n # flash[:notice] = 'Profile was successfully updated.'\n # if format.xhr?\n \n # else\n # format.html {} #{ redirect_to admin_profile_path(@current_object.id) }\n # end\n # format.xml { head :ok }\n # p \"sssssssssssssssssss\"\n # else\n # p \"wwwwwwwwwwww\"\n # flash[:notice] = \"Problem in saving the profile \"+@current_object.errors.first[1]\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n # end\n \n end\n render :update do |page|\n page['fragment-1'].replace_html(:partial => 'user_information') \n # page[\"show_message_details\"].replace_html(:partial =>'message_sent_detail', :object =>@message)\n end\n \n \n end", "def update\n @profile = Profile.find_by_user_id params[:user_id]\n\n if @profile.update_attributes(params[:profile])\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/edit\"\n end\n\n end" ]
[ "0.73241484", "0.7171193", "0.70734787", "0.69517475", "0.6765289", "0.6620307", "0.65615195", "0.6508264", "0.648597", "0.6478431", "0.6460957", "0.64560604", "0.6445923", "0.64417803", "0.64356035", "0.6406159", "0.6400417", "0.6363789", "0.63624805", "0.63624364", "0.63567704", "0.634027", "0.63390154", "0.63320094", "0.63235885", "0.6315087", "0.6307272", "0.6306358", "0.62824976", "0.62824434", "0.6271666", "0.6267751", "0.62574804", "0.62450004", "0.62333834", "0.6230701", "0.6221481", "0.619184", "0.61893296", "0.6184194", "0.6180563", "0.6178532", "0.61612236", "0.6149843", "0.61492324", "0.61295867", "0.61286527", "0.61281776", "0.6127816", "0.61206967", "0.61149687", "0.6114248", "0.61008894", "0.6097235", "0.60908693", "0.6087345", "0.60872406", "0.608437", "0.6080393", "0.6080393", "0.6073616", "0.6052772", "0.60461444", "0.60453707", "0.60319155", "0.60307664", "0.6030337", "0.6028898", "0.60213643", "0.60103047", "0.60080373", "0.6005595", "0.5993698", "0.59778196", "0.5971443", "0.59689367", "0.5968411", "0.5957955", "0.5951936", "0.59512997", "0.5948268", "0.5948079", "0.5947522", "0.5944109", "0.59388286", "0.5933376", "0.593187", "0.5923662", "0.59227216", "0.5922598", "0.5922566", "0.59175", "0.5912419", "0.5906081", "0.590536", "0.5894934", "0.58915687", "0.5882712", "0.58767855", "0.58662397" ]
0.6099234
53
Allows config options to be read like a hash
def [](option) send(option) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration_from_options(options); end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n return @options if @options_parsed\n options = super\n config_path = File.join(File.dirname(__FILE__),\n '../..', CONFIG_FILE_NAME)\n return options unless File.exist? config_path\n\n defaults = YAML.load_file(config_path).deep_symbolize_keys || {}\n options = defaults.merge_with_arrays(options)\n @options = Thor::CoreExt::HashWithIndifferentAccess.new(options)\n @options_parsed = true\n\n @options\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def config_opts\n CONFIG_OPTS.inject({}) do |config_hash, key|\n config_hash[key] = send(key)\n config_hash\n end\n end", "def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end", "def parsed_options\n config\n end", "def from_options\n # don't do anything, unless options were provided\n return if not @config or @config.empty?\n @config.each { |key, value| update(key, value) }\n end", "def options\n Hash[\n *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten\n ]\n end", "def configure options\n options.map do |key, value|\n types = {String => 'string', Fixnum => 'int', TrueClass => 'bool',\n FalseClass => 'bool', Float => 'float', Array => 'list --list-type=string'}\n type = types[value.class]\n raise 'Invalid type for configure' unless type\n value = value.to_json if value.is_a?(Array)\n value = %(\"#{value}\") if type == 'string'\n check = \"gconftool-2 --get \\\"#{key}\\\" | grep #{value} #{echo_result}\"\n Command.new(\"gconftool-2 --set \\\"#{key}\\\" --type #{type} #{value}\", check)\n end\n end", "def config_options\n # config_file_path = File.join(ENV['SHARED_CONFIG_ROOT'] || \"#{Rails.root}/config\", \"college_mapper.yml\")\n # @config_options ||= YAML::load(ERB.new((IO.read(config_file_path))).result)[(Rails.env)].symbolize_keys \n @config_options ||= API_KEYS['collegemapper'][Rails.env].symbolize_keys\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def config(*args)\n \n raise \"config expects at least one argument\" if args.empty?\n \n # extract the arguments\n if args[0].is_a?(Hash)\n # we can't override when using hash'd arguments since\n # if > 1 hash keys are given, it's impossible to tell which\n # one is the name of the option, and which is the override flag.\n args[0].each { |key, value| _handle_config(key, value)}\n else\n _handle_config(*args)\n end\n end", "def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end", "def options\n config.options\n end", "def config\n @options[:config]\n end", "def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end", "def options \n self.merge!(@config.opts)\n end", "def options\n @config[:options] ||= {}\n \n @config[:options][:order_id] = @order.id\n @config[:options].merge!(@data[:options]) if @data[:options].present?\n \n @config[:options]\n end", "def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end", "def parse_options; end", "def parse_options; end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def options\n return @_options if defined?(@_options)\n\n original_options = super\n @_options = Thor::CoreExt::HashWithIndifferentAccess.new(\n configuration_options.merge(original_options)\n )\n end", "def build_config\n file = [options[:config_file], DEFAULT_CONFIG_FILE_LOCATION].\n compact.find {|f| File.exists?(f) }\n\n hash =\n if file\n YAML.load_file(file).each do |key, value|\n stderr.puts(\"Warn: Unknown key in config file: #{key}\") unless\n self.class.configs.find {|opt| opt.first.to_s == key.to_s }\n end\n else\n {}\n end\n\n options[:config_option].map {|str| str.split('=') }.\n inject(hash) {|m, (k,v)| m.merge(k.to_sym => v) }\n end", "def configuration_options\n json_config = \"\"\n\n if looks_like_s3_path? template\n bucket, key = parse_s3_path template\n json_config = s3.buckets[bucket].objects[key].read\n else\n json_config = File.read template\n end\n\n config = JSON.parse json_config\n config = fix_config_keys config\n\n config\n end", "def read_options args={}, update_options={}\n args = {:environment => nil,\n :config_file => nil,\n :verbose => 'silent'\n }.update(args)\n\n options = {}\n\n if File.exists? @cfg_file\n vputs \"Loading '#{@cfg_file}'\", args[:verbose]\n options = load_file @cfg_file\n end\n\n if args[:config_file]\n if !File.exists? args[:config_file]\n vputs \"ERROR: Config file '#{args[:config_file]}' not found!\", args[:verbose]\n exit\n end\n vputs \"Loading '#{args[:config_file]}'\", args[:verbose]\n update_options(args[:config_file], options)\n elsif @persistent_local_cfg_file && File.exists?(@persistent_local_cfg_file)\n vputs \"Loading '#{@persistent_local_cfg_file}'\", args[:verbose]\n update_options(@persistent_local_cfg_file, options)\n elsif @local_cfg_file && File.exists?(@local_cfg_file)\n vputs \"Loading '#{@local_cfg_file}'\", args[:verbose]\n update_options(@local_cfg_file, options)\n end\n\n if args[:environment]\n vputs \"Using environment '#{args[:environment]}'\", args[:verbose]\n options = (options['default']||{}).deep_merge!(options[args[:environment]]||{})\n end\n\n options.update(update_options)\n options['environment'] = 'development' if options['environment'].nil?\n options['verbose'] = false if options['verbose'].nil?\n\n if args[:verbose] == true\n len = options.keys.map { |k| k.size }.sort.last\n vputs \"Loaded options:\", args[:verbose]\n options.each { |k, v| puts \" #{k.ljust(len)} => #{v}\" }\n end\n\n options\n end", "def custom_settings\n hash = HashWithIndifferentAccess.new\n configurations.each do |c|\n case c.data_type\n when :boolean\n value = c.value == 'true' ? true : false\n when :integer\n value = c.value.to_i\n when :string\n value = c.value\n else\n raise 'not implemented'\n end\n hash[c.key] = value # cast\n end\n hash\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def options\n Hash[Github::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end]\n end", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n optfile = @ConfFile\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @filename\n conf[\"dir\"] = @dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def config(options = T.unsafe(nil)); end", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n if @ConfFile.nil?\n return conf\n end\n\n optfile = @ConfFile\n optfile = optfile.gsub(/%f/, @doc.filename)\n optfile = optfile.gsub(/%F/, @doc.file)\n optfile = optfile.gsub(/%D/, @doc.dir)\n optfile = optfile.gsub(/%E/, @doc.extname)\n optfile = optfile.gsub(/%R/, @doc.dir + \"/\" + @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%t/, @Type)\n optfile = optfile.gsub(/%B/, $basedir)\n optfile = optfile.gsub(/%b/, $confdir)\n\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @doc.filename\n conf[\"dir\"] = @doc.dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def options\n original_options = super\n defaults = Thor::CoreExt::HashWithIndifferentAccess.new(\n {\n width: 72,\n count: 200,\n },\n )\n\n config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml'))\n if File.file?(config_path)\n config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})\n defaults = defaults.merge(config_options)\n end\n\n # Enforce implied options\n defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links]\n\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end", "def parse_config_file(file)\n options = {}\n return options if file.nil?\n\n config_string = \"\"\n if File.exists?(File.expand_path(file))\n config_string << File.open(File.expand_path(file)).read\n end\n\n config_string.each_line do |line|\n line.strip!.gsub!(/#.*/, \"\")\n next if line.empty?\n\n opt,value = line.split(/\\s*/, 2)\n options[opt.to_sym] = value\n end\n\n options\n end", "def additional_config(options, config)\n options[:hostname] = parse_property(config, \"hostname\", String)\n options[:runtime_path] = parse_property(config, \"runtime_path\", String)\n options[:port_range] = parse_property(config, \"port_range\", Range)\n options[:ssl_port_range] = parse_property(config, \"ssl_port_range\", Range)\n options[:jmx_port_range] = parse_property(config, \"jmx_port_range\", Range)\n options[:rpc_port_range] = parse_property(config, \"rpc_port_range\", Range)\n options[:transport_port_range] = parse_property(config, \"transport_port_range\", Range)\n options[:supported_versions] = parse_property(config, \"supported_versions\", Array)\n options[:default_version] = parse_property(config, \"default_version\", String)\n options[:instance_limit] = parse_property(config, \"instance_limit\", Integer)\n options[:seeds] = parse_property(config, \"seeds\", String)\n options[:clustername] = parse_property(config, \"clustername\", String)\n options[:max_heap_size] = parse_property(config, \"max_heap_size\", String)\n options[:heap_newsize] = parse_property(config, \"heap_newsize\", String)\n options\n end", "def read_config(io = nil)\n unless io\n root_path = ::Middleman::Application.root\n config_file_path = File.join(root_path, \".s3_sync\")\n\n # skip if config file does not exist\n return unless File.exists?(config_file_path)\n\n io = File.open(config_file_path, \"r\")\n end\n\n config = YAML.load(io).symbolize_keys\n\n OPTIONS.each do |config_option|\n self.send(\"#{config_option}=\".to_sym, config[config_option]) if config[config_option]\n end\n end", "def config_file_settings\n config_file_settings = {}\n self.class.options.keys.each do |key|\n config_file_settings[key] = Meggy::Config[:meg][key] if Meggy::Config[:meg].has_key?(key)\n end\n config_file_settings\n end", "def option_type_config; end", "def config(options = {})\n if options[:file]\n filename = options[:filename] || File.join(Dir.home, \".bos\")\n config_hash = JSON.parse(IO.read(filename), symbolize_names: true)\n @user_id = config_hash[:user_id]\n @password = config_hash[:password]\n @security_code = config_hash[:security_code]\n else\n @user_id = options[:user_id]\n @password = options[:password]\n @security_code = options[:security_code]\n File.open(File.join(Dir.home, \".bos\"), \"w\") do |f|\n f.write options.to_json\n end\n end\n end", "def config(value,options)\n\n end", "def config(value,options)\n\n end", "def load_config(config_file)\n if !(hash = YAML.load_file(config_file))\n raise(ConfigError, \"Config file [#{config_file}] contains no options.\")\n end\n \n debug(\"Config options:\")\n debug(\"\") \n hash.each do |key, val|\n debug(\"#{key}: #{val}\") \n if CONFIG_OPTIONS.include?(key.to_sym)\n self.send(\"#{key}=\", val)\n else\n raise(ConfigError, \"Unrecognized Option: #{key}\")\n end\n end\n end", "def load_config!\n if options[:config]\n config_inst = Config.new(options[:config])\n elsif self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES)\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = Config.new(path) if path\n end\n if config_inst\n options.delete(:config)\n defaults_inst = Smash[\n config_class.new(\n defaults.to_smash\n ).to_smash.find_all do |key, value|\n defaults.key?(key)\n end\n ]\n config_data = config_inst.data\n config_inst = Smash[\n config_inst.to_smash.find_all do |key, value|\n config_data.key?(key)\n end\n ]\n options_inst = Smash[\n config_class.new(\n options.to_smash\n ).to_smash.find_all do |key, value|\n options.key?(key)\n end\n ]\n @options = config_class.new(\n defaults_inst.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options_inst.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end", "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "def parse_config_file\n if !File.exist?(options[:config_file])\n puts \"Configuration file is not found\"\n exit 1\n end\n\n configs = YAML.load_file(options[:config_file]).deep_symbolize_keys\n options.reverse_merge!(configs[environment.to_sym] || {})\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def parse\n options = {}\n options.merge(parse_config_file(CONFIG_LOCATION))\n\n argv = parse_argv\n if argv[:config_file].kind_of?(String)\n options.merge(parse_config_file(argv[:config_file]))\n end\n\n options.merge(argv)\n end", "def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def conf\n unless @conf\n if @db_url || @db # skip loading config if db set explicitly\n @conf = {}\n else\n parse_command_line unless @args\n\n raise \"No configuration file defined (-c <config>).\" if @args[\"config\"].nil?\n raise \"Couldn't read #{@args[\"config\"]} file.\" unless @args['config'] && @conf = YAML::load(File.new(@args[\"config\"]).read)\n # setting default options that should be written along with all the records to process_items\n if @conf['default_options']\n @conf['default_options'].each do |k,v|\n default_options.send(\"#{k}=\", v)\n end\n end\n\n if @args['params']\n @args['params'].each do |k, v|\n default_options.send(\"#{k}=\", v)\n end\n end\n end\n end\n @conf\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def options_config\n unless @squeezed_options_config\n @squeezed_options_config = (cached_options ? cached_options : squeeze(struct_options))\n end\n @squeezed_options_config\n end", "def get_options(options_string)\n opts = Slop.new :autocreate => true\n opts.parse options_string\n\n opts.to_hash.delete_if { |k,v| v.nil? }\n end", "def temporarily options = {}\n config.temp do\n options.each do |key, value|\n config.send \"#{key}=\", value\n end\n end\n end", "def load_options(path)\n path = File.expand_path path\n if File.exists? path\n JSON.parse(File.read path)\n else\n {}\n end\nend", "def as_config\n Configureasy::Config.new self.parse\n end", "def options\n self[:options] || {}\n end", "def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def config_from_raw(raw_config)\n config = Hash.new\n\n raw_config.split(\"\\n\").select { |line| line.match(/:\\s/) }.each do |line|\n key, value = line.split(/:\\s+/)\n config[key] = value\n end\n\n config\nend", "def parsed_config\n @parsed_config ||= begin\n JSON.parse(config[:json_config], symbolize_names: true)\n rescue JSON::ParserError\n JSON.parse(File.read(config[:json_config]),\n symbolize_names: true)\n end\n end", "def options\n self.read_attribute(:options).split(\"\\n\") unless self.read_attribute(:options).nil?\n end", "def load_configuration(settings)\n configuration = settings.with_indifferent_access\n self.options = configuration[:options]\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def config_options=(opts)\n @config_options = opts\n end", "def configure(options)\n config_options.push(options)\n end", "def configuration\n if system_keys.any?\n options.merge({\n system_keys: Configuration.default_system_keys.merge(system_keys)\n })\n\n else\n options\n\n end\n end", "def options(opt); end", "def options(opt); end", "def load_configuration_file_or_read_the_options!\n @application.load_configuration_file\n @application.config.use(\n :rubies => (options[:rubies] || @application.rubies),\n :test_framework => (options[:test_framework] || @application.config.test_framework),\n :verbose => options[:verbose] || @application.config.verbose)\n end", "def options\n map = Config.class_variables.map do |key|\n [key.to_s.tr('@', '').to_sym, class_variable_get(:\"#{key}\")]\n end\n Hash[map]\n end", "def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end", "def config_data\n {}\n end", "def load_settings(args = [], *names)\n raise \"no setting names provided\" if not args.empty? and names.empty?\n require 'yaml'\n @options = {}\n args.reverse.each do |val|\n @options[names.pop] = val\n end\n \n # import and clean up options from the yaml\n imports = YAML.load_file(SETTINGS_FILE)\n imports.each_pair do |key, value|\n if not key.is_a? Symbol\n imports[key.to_sym] = value\n imports.delete(key)\n end\n end\n\n # combine the hashes\n @options = imports.merge(@options)\n end", "def options(hash)\n @options.merge! hash\n end", "def options\n original_options = super\n user_defaults = @config\n user_defaults.merge(original_options)\n end", "def configure opts\n configuration.merge!(opts)\n end", "def config\n @config ||= YAML.load_file @options[:config_file]\n end", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end", "def options()\n @options ||= OpenStruct.new({\n :debug => false,\n :gist_api_url => nil,\n :gist_extension => defaults[\"extension\"],\n :private_gist => defaults[\"private\"],\n :browse_enabled => defaults[\"browse\"],\n :embed_enabled => nil,\n :description => nil,\n :setup_credentials => false\n })\n end", "def load_config!\n if(options[:config])\n config_inst = config_class.new(options[:config])\n elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = config_class.new(path) if path\n end\n if(config_inst)\n options.delete(:config)\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end", "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def config=(config = {})\n @config = config.is_a?(Hash) ? config : {}\n config = config.split(\",\") if config.is_a?(String)\n if config.is_a?(Array)\n config.each do |c|\n c = c.split(\":\", 2)\n @config[c[0]] = c[1]\n end\n end\n end", "def config\n yield @@config_options\n end" ]
[ "0.7428699", "0.7322754", "0.7322754", "0.71972054", "0.71972054", "0.7061942", "0.7031077", "0.7031077", "0.70282495", "0.69660544", "0.69483906", "0.6948274", "0.6910803", "0.68589896", "0.6834923", "0.67487586", "0.66545624", "0.66460735", "0.66447747", "0.6629105", "0.65949", "0.65929174", "0.65867686", "0.65347505", "0.6534593", "0.6493422", "0.6484505", "0.6469356", "0.6469356", "0.6455538", "0.6450762", "0.644948", "0.64428735", "0.64212406", "0.64099056", "0.63731456", "0.63711566", "0.636038", "0.6357872", "0.63494", "0.6342815", "0.63002175", "0.62970656", "0.62936306", "0.62623054", "0.62568414", "0.62373275", "0.62356925", "0.62356925", "0.62229395", "0.62184715", "0.61828315", "0.61826235", "0.6179019", "0.6179019", "0.6170607", "0.61626136", "0.6162578", "0.61575395", "0.6154734", "0.6149599", "0.6149599", "0.6149599", "0.6143336", "0.6138726", "0.61211276", "0.61188763", "0.6110957", "0.61093944", "0.6108427", "0.6106378", "0.6105598", "0.61035997", "0.6101904", "0.6097694", "0.609345", "0.60923564", "0.6089039", "0.6068351", "0.60672534", "0.60633105", "0.6057068", "0.6055651", "0.6055179", "0.60492486", "0.60491955", "0.604881", "0.6033891", "0.60325015", "0.60310906", "0.6027805", "0.6022328", "0.60208046", "0.6018954", "0.60157853", "0.6013329", "0.60128534", "0.6012378", "0.60094714", "0.6009412", "0.6008269" ]
0.0
-1
Returns a hash of all configurable options
def to_hash OPTIONS.inject({}) do |hash, option| hash.merge(option.to_sym => send(option)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end", "def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[\n *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten\n ]\n end", "def all_options\n Config::Options.all\n end", "def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end", "def options\n hash = {}\n self.class.option_definitions.each do |option|\n hash[option.name] = send(option.name)\n end\n hash\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end", "def config_opts\n CONFIG_OPTS.inject({}) do |config_hash, key|\n config_hash[key] = send(key)\n config_hash\n end\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def get_options\n hash = Hash.new\n instance_variables.each do |var|\n hash[var[1..-1].to_sym] = instance_variable_get(var)\n end\n\n return hash\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def options\n map = Config.class_variables.map do |key|\n [key.to_s.tr('@', '').to_sym, class_variable_get(:\"#{key}\")]\n end\n Hash[map]\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "def options\n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each do |k|\n options[k] = send(k)\n end\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end", "def to_hash\n OPTIONS.each_with_object({}) do |option, hash|\n key = option.first\n hash[key] = send(key)\n end\n end", "def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n Hash[Github::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end]\n end", "def all\n @options\n end", "def options\n self.class.instance_variable_get(:@__options) || []\n end", "def to_hash\n default_options.to_hash\n end", "def to_hash\n default_options.to_hash\n end", "def all_options\n env_variable_options = UserOptions.new\n global_configuration_options = UserOptions.new(Departure.configuration.global_percona_args)\n options = env_variable_options.merge(global_configuration_options).merge(DEFAULT_OPTIONS)\n options.to_a.join(' ')\n end", "def option_set\n @options ||= {}\n end", "def options\n options = {}\n PROPERTY_OPTIONS.each do |method|\n next if (value = send(method)).nil?\n options[method] = value\n end\n options\n end", "def options\n config.options\n end", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def options\n options = {}\n attributes_for(self).each do |p|\n option = self.send(p.to_sym) \n options[p] = option unless option.nil?\n end\n options\n end", "def all\n self::OPTIONS.map {|e| build(e) }\n end", "def get_options\n @options\n end", "def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end", "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end", "def get_full_options\n result = {}\n usable_properties = self.class.held_properties\n usable_properties.delete(:from_class)\n usable_properties.each do |option|\n result[option] = self.send(option) if self.send(option) && self.send(option) != \"\"\n end\n result\n end", "def options\n {}.tap do |options|\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n end\n end", "def option_keys\n []\n end", "def options\n @options ||= Launchr::OrderedHash.new\n @options\n end", "def options \n self.merge!(@config.opts)\n end", "def options()\n {}\n end", "def configuration\n if system_keys.any?\n options.merge({\n system_keys: Configuration.default_system_keys.merge(system_keys)\n })\n\n else\n options\n\n end\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n return @options if @options_parsed\n options = super\n config_path = File.join(File.dirname(__FILE__),\n '../..', CONFIG_FILE_NAME)\n return options unless File.exist? config_path\n\n defaults = YAML.load_file(config_path).deep_symbolize_keys || {}\n options = defaults.merge_with_arrays(options)\n @options = Thor::CoreExt::HashWithIndifferentAccess.new(options)\n @options_parsed = true\n\n @options\n end", "def options\n @options ||= {}\n @options\n end", "def options\n VALID_OPTIONS_KEYS.each_with_object({}) do |k, options|\n options[k] = send(k)\n end\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end" ]
[ "0.81051826", "0.79412043", "0.7936926", "0.7936926", "0.79214734", "0.76402825", "0.7612969", "0.75011855", "0.7470861", "0.7470861", "0.7449152", "0.7343231", "0.72712165", "0.72595704", "0.7201305", "0.7170099", "0.71684414", "0.7116154", "0.7044288", "0.7044288", "0.7044288", "0.7044288", "0.7044288", "0.70236564", "0.7010436", "0.7009988", "0.7009988", "0.7009988", "0.69967794", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.69940037", "0.699179", "0.699179", "0.69727665", "0.6962419", "0.69504", "0.6937609", "0.6937609", "0.6937609", "0.6937609", "0.6937609", "0.6937609", "0.6936727", "0.69348514", "0.6926732", "0.6909987", "0.6909987", "0.6896408", "0.6890201", "0.68825823", "0.6882325", "0.6879646", "0.6841015", "0.68243444", "0.67900175", "0.6768277", "0.6768277", "0.6765387", "0.67634684", "0.67307675", "0.67172813", "0.67153203", "0.66975725", "0.6691843", "0.6687989", "0.6673834", "0.6657026", "0.6653622", "0.6644251", "0.66402143", "0.66187096", "0.65755147", "0.65340894", "0.6528733", "0.65212387", "0.65212387", "0.65212387", "0.65066123", "0.6499108", "0.6492114", "0.6462282", "0.6462282", "0.6462282" ]
0.70420045
26
Returns a hash of all configurable options merged with +hash+
def merge(hash) to_hash.merge(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_options!(hash)\n hash.merge!(@options)\n end", "def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end", "def options(hash)\n @options.merge! hash\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n Hash[\n *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten\n ]\n end", "def config_opts\n CONFIG_OPTS.inject({}) do |config_hash, key|\n config_hash[key] = send(key)\n config_hash\n end\n end", "def options\n hash = {}\n self.class.option_definitions.each do |option|\n hash[option.name] = send(option.name)\n end\n hash\n end", "def options(hash)\n hash.map do |key, value|\n quoted_value = value.to_s.gsub('\"', '\\\\\"')\n %Q(#{key}=\"#{quoted_value}\")\n end.join(', ')\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end", "def options_hash\n the_hash = self.product_id.to_s + self.is_discount.to_s\n \n self.options.order(:option_group_id).each do |o|\n the_hash += \"#{o.option_group_id}#{o.value}#{o.price}\"\n end\n \n the_hash\n end", "def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def options(original_hash=nil, key, value)\n j = Hash.new\n j[key] = value\n j.merge(original_hash) unless original_hash.nil?\n j\n end", "def _ssh_options(mash)\n (mash || {}).inject({}) {|hash, (k, v)| hash[k.to_sym] = v; hash}\n end", "def merge(config_hash)\n config_hash.each_pair { |option, value| set_option(option, value) }\n self\n end", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def get_options\n hash = Hash.new\n instance_variables.each do |var|\n hash[var[1..-1].to_sym] = instance_variable_get(var)\n end\n\n return hash\n end", "def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end", "def optionsHash(length = 12)\n # Don't want to always need this as this may be difficult to compile\n require 'sha3'\n\n # Get only hash relevant options\n # Filter out paths\n toHash = @Options.reject { |i| i =~ %r{.*/.*(/|$)}i }\n\n # Reject some known keys\n toHash.delete :epoch\n\n SHA3::Digest::SHA256.hexdigest(JSON.generate(toHash).to_s)[0..length - 1]\n end", "def options\n Hash[Github::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end]\n end", "def options(opts)\n opts.each { |k,v| merge_options(k, v) }\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end", "def to_hash\n OPTIONS.each_with_object({}) do |option, hash|\n key = option.first\n hash[key] = send(key)\n end\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def to_hash\n {}.tap do |hash|\n # the \"key\" here is to call to_hash on all containers.\n [@wrapped_options.to_hash, @mutable_options.to_hash].each do |options|\n options.each { |k, v| hash[k.to_sym] = v }\n end\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options_from_hash(options_hash)\n options_hash.each do |name, definition|\n option = Option.new\n definition.each do |key, value|\n Array(value).each { |hit| option.send(key, hit) }\n end\n @@options << [name.to_s, option]\n end\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def to_hash\n default_options.to_hash\n end", "def to_hash\n default_options.to_hash\n end", "def all_options\n Config::Options.all\n end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def elevate_hash(hsh)\n # Commander::Command::Options stripped all of the methods from parent\n # objects. I have not nice thoughts about that.\n begin\n hsh = hsh.__hash__\n rescue NoMethodError\n # swallow this.\n end\n # build a hash where the default is 'false' instead of 'nil'\n Hash.new(false).merge(Hash.transform_keys_to_symbols(hsh))\n end", "def options=(hash={})\n hash.each { |key,value| write_option(key, value) }\n end", "def merged_config_for_generator\n return {}\n end", "def options \n self.merge!(@config.opts)\n end", "def to_hash\n { @key => @options }\n end", "def merge opts\n opts.each do |k,v|\n if configurable.key?(k.to_sym) && !v.nil? then\n self.send(\"#{k}=\".to_sym, v)\n end\n end\n end", "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [cluster, options].hash\n end", "def options\n return @_options if defined?(@_options)\n\n original_options = super\n @_options = Thor::CoreExt::HashWithIndifferentAccess.new(\n configuration_options.merge(original_options)\n )\n end", "def get_full_options\n result = {}\n usable_properties = self.class.held_properties\n usable_properties.delete(:from_class)\n usable_properties.each do |option|\n result[option] = self.send(option) if self.send(option) && self.send(option) != \"\"\n end\n result\n end", "def options\n map = Config.class_variables.map do |key|\n [key.to_s.tr('@', '').to_sym, class_variable_get(:\"#{key}\")]\n end\n Hash[map]\n end", "def merge!(hash={}, &block)\n @static_options = Variables.merge( @static_options, handle_array_and_deprecate(hash) )\n @dynamic_options = block if block_given?\n\n self\n end", "def makeDefaultOptionHash()\n\t\toptionHash = Hash.new()\n\t\t@optionDefs.each do |optDef|\n\t\t\tdefault = optDef.getDefault()\n\t\t\tunless default.nil?\n\t\t\t\toptionHash[optDef.getKey()] = default\n\t\t\tend\n\t\tend\n\t\treturn optionHash\n\tend", "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def merge_options(options)\n merged_options=@options\n options.each do |passed_option_key,passed_option_value|\n merged_options[passed_option_key] = passed_option_value\n end\n return merged_options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def default_opts(hash={})\n hash.each {|k, v| @opts[k] = v unless @opts.has_key?(k)}\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def to_hash\n\t\ta = Hash.new\n\t\t@option.each_pair do |k, v|\n\t\t\ta[k] = v.value\n\t\tend\n\t\ta\n\tend", "def options\n options = {}\n VALID_OPTIONS_KEYS.each do |k|\n options[k] = send(k)\n end\n options\n end", "def option_set\n @options ||= {}\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def merged_options\n subset.merge(@options)\n end", "def grouped_options\n @options.group_by { |option| option[:name] }.each_with_object({}) do |(name, group), hash|\n hash[name] ||= []\n group.each { |item| hash[name].push(item[:value]) }\n hash\n end\n end" ]
[ "0.7066515", "0.7010312", "0.69971776", "0.68802094", "0.68802094", "0.68278396", "0.68278396", "0.67177135", "0.671008", "0.65878105", "0.65763277", "0.6574067", "0.64783263", "0.64783263", "0.6456929", "0.6450672", "0.64291453", "0.6426914", "0.6426914", "0.6426914", "0.6426914", "0.6426914", "0.63962793", "0.63962793", "0.63962793", "0.63962793", "0.63489455", "0.633668", "0.63193744", "0.6319299", "0.63155377", "0.63137406", "0.62994075", "0.6298004", "0.62412035", "0.6226053", "0.62164676", "0.62142235", "0.6202094", "0.6198385", "0.6169775", "0.6165465", "0.61520064", "0.61520064", "0.61520064", "0.61520064", "0.61520064", "0.61520064", "0.61454105", "0.6125252", "0.6110186", "0.61043906", "0.6099769", "0.6069003", "0.6069003", "0.60669065", "0.6063636", "0.60626316", "0.6035136", "0.60336363", "0.60098624", "0.60081816", "0.6005876", "0.60002804", "0.5992965", "0.5948718", "0.5941001", "0.5941001", "0.5933155", "0.5931123", "0.59075683", "0.58968633", "0.58884865", "0.58699226", "0.58559585", "0.58525187", "0.58525187", "0.58525187", "0.5851398", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5850169", "0.5831615", "0.58284146", "0.58204865", "0.5816031", "0.5810878", "0.5798117" ]
0.0
-1
Tests that instructor is not linked to any courses in the semester and returns true or false.
def can_be_deleted? !has_courses? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CA_only?\n course_assistant? && (not instructor?)\n end", "def ensure_not_referenced_by_any_course\n if courses.empty?\n return true\n else\n errors.add(:base, 'Courses present')\n return false\n end\n end", "def CA_only?\n course_assistant? && !instructor?\n end", "def ensure_not_referenced_by_any_user\n if users.empty?\n return true\n else\n errors.add(:base, 'Courses present')\n return false\n end\n end", "def instructor_for_course?(node)\n available?(session[:user], node.get_instructor_id)\n end", "def enrolled_in_which?(courses)\n courses.reject {|course| !self.enrolled_in?(course)}\n end", "def can_create_course?\n ptainstructors = Ptainstructor.find_by_semester_id(self.id)\n teachers = Teacher.find_by_semester_id(self.id)\n if ((ptainstructors == nil) or (teachers == nil))\n return false\n end\n return true\n end", "def test_unexistent_course_registering_non_member\n\t\tregistering_non_member = Enrollment.new(:participantID => participants(:non_member_one).participantID, :courseID => \"nap101\")\n\t\tassert Participant.find_by(participantID: registering_non_member.participantID), \"Non Member was not found in Participant database\"\n \t\tassert !Course.find_by(courseID: registering_non_member.courseID), \"Non existent Course is in Courses database\"\n\tend", "def check_courses\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?) && (not @current_user.courses.include?(@course))\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "def check_courses\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?) && (not @current_user.courses.include?(@course))\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "def free?\n self.instructor.nil?\n end", "def enrolled_in?(course)\n\t self.courses.include?(course)\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end", "def course_is_available?(node)\n instructor_for_course?(node) || ta_for_course?(node)\n end", "def check_instructor\n if !current_instructor\n redirect_to :root, notice: \"You are not logged in as instructor\"\n end \n end", "def ptainstructor_is_valid?\n return self.ptainstructor_id != nil\n end", "def test_unexistent_course_registering_member\n\t\tregistering_member = Enrollment.new(:participantID => participants(:one).participantID, :courseID => \"nap09877\")\n\t\tassert Participant.find_by(participantID: registering_member.participantID), \"Member was not found in Participant database\"\n \t\tassert !Course.find_by(courseID: registering_member.courseID), \"Non existent Course is in Courses database\"\n\tend", "def is_taking?(course)\n courses.include?(course)\n end", "def can_add_course?\n self.available_courses > 0 || self.clearance?\n end", "def attended_exam_in? course\n exams.for_course(course).attended.present?\n end", "def has_students?\n !students.empty?\n end", "def has_students?\n !students.empty?\n end", "def check_instructor_or_student\n if !current_instructor && !current_student\n redirect_to :root, notice: \"You are not logged in as instructor or student\"\n end \n end", "def instructors\n users.not_students\n end", "def instructor_active\n if self.instructor != nil\n if self.instructor.active == false\n errors.add(:instructor_id, \"should be active\")\n end \n end \n end", "def enrolled_in?(course)\n course.all_enrollees.include?(self)\n end", "def assigned_course_or_script?\n assigned_courses.any? || any_visible_assigned_scripts?\n end", "def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end", "def check_multiple_courses\n \n end", "def test_unexistent_non_member_registering\n\t\tregistering_non_member = Enrollment.new(:participantID => \"abc12345\", :courseID => \"yoga0123\")\n\t\tassert Course.find_by(courseID: registering_non_member.courseID), \"Course is not in Courses database\"\n\t\tassert !Participant.find_by(participantID: registering_non_member.participantID), \"non existent non member was found in Participant database\"\n\tend", "def non_student?\n !self.has_role?('student')\n end", "def validate_user_not_in_course\n errors.add(:base, :user_in_course) unless course.course_users.where(user: user).blank?\n end", "def ensure_not_referenced\n errors[:base] << \"Student has bookings\" if !bookings.count.zero?\n errors[:base] << \"Student has marks\" if !marks.count.zero?\n\n if errors[:base].length > 0\n return false\n else\n return true\n end\n end", "def show_your_courses_label?\n return true if submitted_and_current_courses?\n return false if only_past_submitted_courses?\n return true if submitted_but_no_current_or_past_courses?\n return true if current_courses_but_incomplete_instructor_training?\n end", "def logged_in_as_student?\n !current_student.nil?\n end", "def check_dups\n\t\t\tCampInstructor.all.each do |e|\n\t\t\t\tif (e.instructor.id == self.instructor_id && e.camp.id == self.camp_id)\n\t\t\t\t\terrors.add(:camp_id, \"camp instrctor obj already exists\")\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn true \n\t\tend", "def ptainstructor_is_valid\n errors.add(:ptainstructor,'No PTA instructor was selected.') unless ptainstructor_is_valid?\n end", "def real_student?\n student? && !phantom\n end", "def subscribing?(course)\n student? && current_user.subscribing?(course)\n end", "def ensure_not_referenced_by_any_enrollments\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end", "def schools_valid?\n valid = true\n self.schools.each do |school|\n unless school.qualifications_valid?\n self.errors.add(:school, \"'#{school.name}' does not have any qualifications\")\n valid = false\n end\n end\n valid\n end", "def has_errors?\n taking_courses.each do |course|\n unless course.is_time_valid?\n return true\n end\n end\n false\n end", "def instructor?(item=nil)\n defined?(@_is_instructor) or @_is_instructor = self.sessions.present?\n return @_is_instructor unless item\n return sessions.any? { |s| s.topic_id == item.id } if item.is_a? Topic\n return sessions.include?(item) if item.is_a? Session\n false\n end", "def requisite_course_taken?(courses, department, level)\n courses.any? do |course|\n course.department == department && course.level.to_s == level\n end\n end", "def test_course_instructors_with_courses\n create_course = Course.create(name: \"Ruby 101\", course_code: \"RUB101\")\n instructor = CourseInstructor.create()\n # student = CourseStudent.create()\n create_course.course_instructors << instructor\n assert create_course.reload.course_instructors.include?(instructor)\nend", "def course_ok?(course)\n if course.publishable?\n true\n else\n flash[:error] = \"The course doesn't have any activities. Add some before publishing.\"\n false\n end\n end", "def proper_ranges_instructor\n\t\t\tinstructor_ids = Instructor.all.active.map { |e| e.id }\n\t\t\tif instructor_ids.include?(self.instructor_id)\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:instructor_id, \"not an active instructor id\")\n\t\t\t\treturn false\n\t\t\tend\n\t\tend", "def has_course?(course_id)\n semesters.collect do |semester|\n if semester.cis_courses.exists?(course_id)\n return true\n end \n end\n \n return course_bin.cis_courses.exists?(course_id)\n end", "def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each {|mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n session[:user].role_id == 2 and instructor_ids.include? session[:user].id\n end", "def is_student?\n student.nil?\n end", "def require_student_or_instructor\n redirect_to root_path unless @auth_user && ['Student', 'Instructor'].include?(@auth_user.type)\n end", "def test_21_course_can_not_be_destroyed_if_course_students_present\n band_course = Course.create(name: \"Marching Band\", course_code: \"MUSC 3000\")\n students = CourseStudent.create(student_id: 1, course_id: band_course.id)\n\n refute band_course.destroy\n end", "def same_graduate_course_required\n notfound = false\n gc = @current_user.graduate_courses.find(params[:id]) rescue notfound = true\n unless notfound\n if (!gc)\n flash[:error] = \"Non puoi modificare questo corso di laurea\"\n redirect_to timetables_url\n end\n else\n redirect_to :controller => 'timetables', :action => 'not_found'\n end\n end", "def student?\n false\n end", "def is_user_instructor?(instructor_id)\n # ta created the course, current user is the instructor of this ta.\n instructor_ids = []\n TaMapping.where(ta_id: instructor_id).each { |mapping| instructor_ids << Course.find(mapping.course_id).instructor_id }\n (session[:user].role_id == 2) && instructor_ids.include?(session[:user].id)\n end", "def test_course_instructors_are_associated_with_instructors\n mason = User.create(first_name: \"Mason\", last_name: \"Matthews\", email: \"mason@email.com\", photo_url: \"https://avatars1.githubusercontent.com/u/5350842?v=3&s=400\")\n class_one = CourseInstructor.create\n class_two = CourseInstructor.create\n\n class_one.instructor = mason\n class_two.instructor = mason\n\n class_one.save\n class_two.save\n\n assert_equal 2, mason.instructors.count\n end", "def waits_for_actual_attestation?\n !index.final_exam_passed? &&\n !attested_for?(Attestation.actual_for_faculty(index.student.faculty))\n end", "def passed?(transcript, courses_taken)\n return false unless courses_taken.include?(course_id)\n\n passed_minimum_grade?(transcript)\n end", "def student_team_requirements_met?\n # checks if the student has a team\n return false if @student.team.nil?\n # checks that the student's team has a topic\n return false if @student.team.topic.nil?\n\n # checks that the student has selected some topics\n @student.assignment.topics?\n end", "def coach?\n students.any?\n end", "def validate_course_access(course_id)\n logger.info 'validating ' + course_id.to_s\n validation_success = false\n courses = get_ids(get_all_courses_for_user)\n logger.info 'courses are' + courses.inspect\n validation_success = courses.include?(Integer(course_id))\n if validation_success == false\n redirect_to (GyanV1::Application.config.landing_page.to_s)\n end\n\n end", "def is_relevant_for_educator?\n supported_schools.any? {|school| authorized_grade_levels(school.id).size > 0 }\n end", "def isValidSemester?(semester)\n\t\tSEMESTERS.include? semester\n\tend", "def complete_schedule?(time_blocks, courses)\n # check to see that all course requirements have been satisfied\n # this part is more likely to return false than the next part\n courses.each do |course|\n if (!requirement_satisfied?(time_blocks, course))\n return false\n end\n end\n\n # check to see that we haven't added any unnecessary courses\n # this is more of an error check, rather than something that we\n # expect to ever be false\n time_blocks.each do |tb|\n course = tb.section.course\n if (!courses.include? course)\n # we added an unnecessary section\n return false\n end\n end\n end", "def test_course_has_many_instructors_through_course_instructors\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n mason = User.create(first_name: \"Mason\", last_name: \"Matthews\", email: \"mason@email.com\", photo_url: \"https://avatars1.githubusercontent.com/u/5350842?v=3&s=400\")\n da_me = User.create(first_name: \"Da-Me\", last_name: \"Kim\", email: \"dame@email.com\")\n\n course.instructors << mason\n course.instructors << da_me\n\n assert_equal 2, course.course_instructors.count\n assert_equal 2, course.instructors.count\n end", "def tests\n BoatingTest.all.select do |test|\n test.instructor == self\n end\n end", "def is_taking_course?(course, term = nil)\n term ||= Utils::Term::now\n taking_courses.each do |c|\n if c.course == course and c.year == term.year and c.semester == term.semester\n return true\n end\n end\n false\n end", "def role_is_instructor?\n has_role? 'instructor'\n end", "def coaches_student?(student)\n\t\tstudents.include?(student)\n\tend", "def course_full\r\n\t\tmax_enrol = Course.find_by(courseID: courseID).size\r\n\t\tcurrent_enrol = Enrollment.where(courseID: courseID).count\r\n\t\tif current_enrol < max_enrol\r\n\t\t\treturn false\r\n\t\telse\r\n\t\t\treturn true\r\n\t\tend\r\n\r\n\tend", "def test_unexistent_member_registering\n\t\tregistering_member = Enrollment.new(:participantID => \"abc12345\", :courseID => \"yoga0123\")\n\t\tassert Course.find_by(courseID: registering_member.courseID), \"Course is not in Courses database\"\n\t\tassert !Participant.find_by(participantID: registering_member.participantID), \"non existent member was found in Participant database\"\n\tend", "def has_classmates?\n belongs_to_classroom? ? !classroom.students.empty? : nil\n end", "def succeeded_in? course\n attended_exam_in?(course) and exams.for_course(course).succeeded.present?\n end", "def same_graduate_course_required\n ids = @current_user.graduate_course_ids\n graduate_course = GraduateCourse.find(:all, :include => {:curriculums => :teachings},\n :conditions => [\"graduate_courses.id IN (?) AND teachings.id = ?\", ids, params[:id]])\n unless graduate_course.size != 0\n flash[:error] = \"Questo insegnamento non appartiene a nessun tuo corso di laurea\"\n redirect_to timetables_url\n end\n end", "def has_assignments?\n ## TO DO add validation on link with categories and receipts\n return (self.finance_category_accounts.present? or self.finance_transaction_receipt_records.first.present?)\n end", "def accomplished_all_enrolled_missions?\n mission_enrollments.select{|m| !m.accomplished? }.empty?\n end", "def individual?\n employments.blank?\n end", "def check_registration\n registrations = Registration.where(\"user_id = ? and course_id = ?\", self.user_id, self.course_id)\n if (registrations.nil? || registrations.length == 0)\n errors[:name] = \"only users who are registered for the course can review the course.\"\n return false\n end\n end", "def test_course_instructors_associated_with_courses\n c = Course.create(name: \"Tech News\", course_code: \"xyz546\")\n i = CourseInstructor.create()\n c.course_instructors << i\n assert_equal [i], Course.find(c.id).course_instructors\n end", "def is_attending? course\n exams.for_course(course).attending.present?\n end", "def critical?\n course.critical? || course.returned_sheets > 0\n end", "def student_logged_in?\n !current_student.nil?\n end", "def logged_in?\n !current_school.nil?\n end", "def tutor_check?(academic_session, student_id)\n \tcurrent_user.is_student_tutor?(academic_session, student_id)\n end", "def course_planned?(course)\n course_id = course.is_a?(Course) ? course.id : course\n planned_courses.any? do |planned_course|\n planned_course.course_id == course_id\n end\n end", "def requirement_satisfied?(time_blocks, course)\n lecture_satisfied = false\n lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately\n tutorial_satisfied = !course.tutorial_required\n time_blocks.each do |tb|\n if (tb.section.course == course)\n if (tb.section_type == 'LectureSection')\n lecture_satisfied = true\n elsif (tb.section_type == 'LabSection')\n lab_satisfied = true\n elsif (tb.section_type == 'TutorialSection')\n tutorial_satisfied = true\n end\n end\n end\n return lecture_satisfied && lab_satisfied && tutorial_satisfied\n end", "def awaiting_college?(college)\n self.course_selections.joins(:course).where('courses.college_id' => college.id, college_offer: nil).any?\n end", "def deletable_by?(user)\n return false unless self.inviter == user\n !self.is_valid? || (self.is_valid? &&\n accepted_students.size == 1 &&\n self.assignment.group_assignment? &&\n !assignment.past_collection_date?(self.section))\n end", "def require_authorized_for_current_lesson\n if !current_user.enrolled_in?(current_lesson.section.course) && current_lesson.section.course.user != current_user\n# redirect_to courses_path, alert: \"Please enroll in the course to view lessons\" # redirects to courses page\n redirect_to course_path(current_lesson.section.course), alert: \"Please enroll in the course to view lessons\" # redirects to specific course page\n end\n end", "def validate_assessments(url)\n valid = true;\n\n TestsLoader::load_tests(url).each do |test|\n begin\n assessment = AssessmentLoader::load_assessment_from_urls(test.questions_url,\n test.answers_url, test.grades_url)\n if assessment.validate_grades\n puts 'Test valid'\n else\n valid = false\n puts 'Test not valid'\n end\n rescue\n valid = false;\n end\n end\n\n return valid\n end", "def check_for_students\n # TODO: set a message.\n # TODO: handle on a per section basis?\n if (!Student.exists?)\n # First we need students, so when the students table is empty\n # go to the import page.\n redirect_to students_path\n end\n end", "def test_valid_non_member_registered_class\n\t\tregistered_non_member = enrollments(:non_member_one)\n\t\tassert Participant.find_by(participantID: registered_non_member.participantID), \"Non Member was not found in Participant database\"\n\t\tassert Course.find_by(courseID: registered_non_member.courseID), \"Course is not in Courses database\"\n\t\t\n\t\t# Checking if the member exists by the expiry date to be greater than tomorrow's date, but if nil or expired date, then participant is not a member\n\t\tmember = Participant.find_by(participantID: registered_non_member.participantID)\n\t\tassert_nil member.expirydate, \"Non Member is a member\"\n\n\t\t# Checking the existence of the pair (courseID, startDate)\n\t\tactual = Course.find_by(courseID: registered_non_member.courseID)\n\t\tassert_equal registered_non_member.startDate, actual.startDate, \"Registering Course does not have valid startDate\"\n\t\t\n\t\tassert registered_non_member.save, \"valid registered member was not saved\"\n\tend", "def can_enroll?(mission)\n (mission_enrollments.empty? && (mission == current_chapter.missions.first_mission)) ||\n ( (current_or_last_accomplished_mission_enrollment && current_or_last_accomplished_mission_enrollment.accomplished?) &&\n (last_accomplished_mission_enrollment.mission.next_mission == mission ) )\n end", "def assignments?\n assignments.length > 0\n end", "def course_component?(key)\n valid_components = %w(AttendanceRegisters Glossary News Checklists\n Grades QuestionLibrary Competencies GradesSettings\n Quizzes Content Groups ReleaseConditions CourseFiles\n Homepages Rubrics Discussions IntelligentAgents\n Schedule DisplaySettings Links SelfAssessments\n Dropbox LtiLink Surveys Faq LtiTP ToolNames Forms\n Navbars Widgets)\n valid_components.include?(key)\n # returns whether the key is actually a course component\nend", "def plan_to_take_course?(course)\n taking_courses.where(:course_id => course).size >0\n end", "def test_course_associated_with_primary_instructor\n c = Course.create(course_code: \"tuv 789\", name: \"Getting Along\", term_id: 3)\n ci = CourseInstructor.create(primary: true)\n ci2 = CourseInstructor.create()\n c.course_instructors << ci\n c.course_instructors << ci2\n assert_equal ci, Course.find(c.id).primary_instructor\n\n\n end", "def has_cohorts_not_in?(user)\n\t\tself.cohorts.size - user.cohorts.size > 0\n\tend" ]
[ "0.73541886", "0.7337089", "0.71748334", "0.7002359", "0.68986166", "0.6887246", "0.68693465", "0.6683787", "0.66521895", "0.66521895", "0.66248304", "0.6586162", "0.6479973", "0.6479973", "0.6428055", "0.6418216", "0.63731784", "0.6359968", "0.6353222", "0.6328268", "0.62843674", "0.6256974", "0.62551594", "0.62551594", "0.6242711", "0.6224835", "0.6203391", "0.6194496", "0.6186688", "0.61811864", "0.6173177", "0.6161461", "0.6143776", "0.6119209", "0.6109387", "0.6087067", "0.60774153", "0.6074527", "0.6060826", "0.6049815", "0.6029717", "0.6018736", "0.60124516", "0.60024494", "0.6000991", "0.59753275", "0.59641826", "0.5963036", "0.59558314", "0.59497076", "0.5937005", "0.59310836", "0.5928527", "0.5920797", "0.591881", "0.58990437", "0.5893363", "0.5891473", "0.5890283", "0.5886262", "0.58775413", "0.5864854", "0.58481073", "0.5847001", "0.584375", "0.5826238", "0.58067876", "0.58020294", "0.5799622", "0.57946354", "0.5783944", "0.5773984", "0.57730615", "0.57649046", "0.5758522", "0.57575387", "0.5743164", "0.57355464", "0.5735543", "0.5725946", "0.5719873", "0.5718174", "0.57110757", "0.57083607", "0.5707022", "0.56992817", "0.5696881", "0.5689398", "0.5676606", "0.5676185", "0.5675605", "0.565458", "0.5652409", "0.5637639", "0.5630442", "0.5628214", "0.56261384", "0.56236815", "0.56182015", "0.5597579" ]
0.60180664
42
Returns last_name, first_name or just first_name if no last_name exists
def full_name_last_first return self.first_name unless (self.last_name.length > 0) return (self.last_name + ", " + self.first_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end", "def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end", "def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end", "def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end", "def full_name\n [first_name, last_name].select(&:'present?').join(' ')\n end", "def name\n if first_name.present? && last_name.present?\n first_name + \" \" + last_name\n elsif first_name.present? && last_name.blank?\n first_name\n elsif first_name.blank? && last_name.present?\n last_name\n else\n \"No Name\"\n end\n end", "def last_first_name\n ret = \"\"\n ret += name unless name.blank?\n ret += \", \" unless firstname.blank? or name.blank?\n ret += firstname unless firstname.blank?\n ret\n end", "def full_name\r\n last_name.blank? ? \"#{first_name} #{mi}\" : \"#{last_name}, #{first_name} #{mi}\"\r\n end", "def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end", "def last_name_first\n self.last_name + ', ' + self.first_name\n end", "def full_name\n if last_name != nil\n first_name + \" \" + last_name\n else\n first_name\n end\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def full_name\n if self.first_name.present? and self.last_name.present?\n \"#{self.first_name} #{self.last_name}\"\n else\n self.first_name\n end\n end", "def last_name_first\n if name\n stripped_name = name.strip\n\n leading_dots = if name =~ /^([A-Za-z\\s\\.]*)\\s/\n $1\n end\n\n if leading_dots\n stripped_name = stripped_name.gsub(/#{leading_dots}/, \"\")\n return stripped_name + \", \" + leading_dots\n end\n\n name_parts = stripped_name.split(' ')\n if name_parts.count > 1\n [name_parts[1, name_parts.length].join(' '), name_parts[0]].join(', ')\n else\n name\n end\n else\n \"\" # return empty string instead of nil if no name\n end\n end", "def last_name_first_name\n \"#{last_name}, #{first_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\" if first_name || last_name\n end", "def full_name\n if self.first_name && self.last_name\n \"#{self.first_name} #{self.last_name}\"\n elsif self.first_name.present?\n \"#{self.first_name}\"\n elsif self.last_name.present?\n \"#{self.last_name}\"\n else\n \"No Name\"\n end\n end", "def name\n if first_name.blank? and last_name.blank?\n \"(no name)\"\n else\n \"#{self.last_name}, #{self.first_name}\"\n end\n end", "def last_name_first_name(name)\n last = last_name(name)\n first = name.gsub(last, '').strip \n \"#{last}, #{first}\"\n end", "def first_and_last_name\n \"#{first_name} #{last_name}\"\n end", "def find_name_or_email\n if self.first_name.present? && self.last_name.present?\n self.first_name + \" \" + self.last_name\n else\n self.name || self.email\n end\n end", "def first_last\n first_name + \" \" + last_name\n end", "def name\n if first_name.present?\n name = [first_name, last_name].join(\" \")\n end\n name.present? ? name : ''\n end", "def name\n [first_name, last_name].compact.join(\" \").presence || email\n end", "def fullname\n if !self.last_name.nil?\n self.first_name + ' ' + self.last_name\n else\n self.first_name\n end\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n\n return \"#{first_name} #{last_name}\".strip if (first_name || last_name)\n \"Anonymouse\"\n end", "def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def first_last_name\n names = name.split\n names.first + \" \" + names.last\n end", "def name_lastfirst\n\t\treturn [ self.sn, self.givenName ].compact.join( ', ' )\n\tend", "def first_last\r\n firstname + (nickname && (nickname.size > 0) ? \" (#{nickname}) \" : \" \") + lastname\r\n end", "def name\n [first_name, last_name].compact.join(' ')\n end", "def full_name\n [first_name, last_name].join(' ').strip\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end", "def full_name \n [first_name, last_name].join(' ')\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end", "def first_name_and_last_name\n \"#{first_name}-#{last_name}\"\n end", "def username_and_first_name\n if first_name.nil?\n username\n else\n \"#{username} (#{first_name})\"\n end\n end", "def displayed_name\n first_name.present? || last_name.present? ? \"#{last_name}#{first_name.blank? ? '' : ', ' + first_name}\" : 'NAME NOT PROVIDED'\n end", "def full_name\n middle_name ? first_name + \" \" + middle_name + \" \" + last_name : first_name + \" \" + last_name\n end", "def name\n [first_name, initial, last_name].select {|x| not x.nil?}.map {|x| x.strip}.join(\" \").titleize\n end", "def name\n [first_name, last_name].join(' ').strip\n end", "def first_name_last_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n if (first_name && last_name) && (!first_name.blank? && !last_name.blank?)\n \" #{first_name} #{last_name}\"\n else\n \" #{nickname}\"\n end\n end", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def fullname\n [firstname, middlename, lastname].compact.join(\" \")\n end", "def lastname_other_names\n \"#{lastname} #{other_names || \"\"}\"\n end", "def display_name\n last_name.blank? ?\n (first_name.blank? ? email : first_name) :\n (first_name.blank? ? last_name : (first_name + ' ' + last_name))\n end", "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def full_name\n [self.first_name, self.last_name].compact.join(\" \").strip\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n #take just first letter of middle name\n last_first += middle_name.slice(0,1)\n last_first += \". \"\n end\n last_first\n end", "def fullname\n [firstname,middlename,lastname].join(' ')\n end", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def name \n last_name + \", \" + first_name\n end", "def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end", "def name\n name = ''\n name = first_name if first_name\n name = name + ' ' + last_name if last_name\n name\n end", "def name\n @name ||= [first_name, last_name].compact.join(' ')\n end", "def get_full_name\n return self.first_name + \" \" + self.last_name\n end", "def full_name\n [self.first_name, self.last_name].join(' ')\n end", "def fullname\n return first_name + \" \" + last_name\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end", "def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end", "def fullName\n return first_name + \" \" + last_name\n end", "def name\n if first_name && last_name\n return \"#{first_name} #{last_name}\"\n else\n return email\n end\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end", "def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end", "def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end", "def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end", "def entire_full_name\r\n mi.blank? ? \"#{first_name} #{last_name}\" : \"#{first_name} #{mi} #{last_name}\"\r\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n if infix&.present?\n [first_name, infix, last_name].join(' ')\n else\n [first_name, last_name].join(' ')\n end\n end", "def full_name\n if (forename != '' && surname != '')\n forename+' '+surname\n elsif (forename != '')\n forename\n elsif (email != '')\n email\n end\n end", "def get_full_name\n [\n (surname.empty? ? nil : surname),\n (name.empty? ? nil : name)\n ].compact.join(\" \")\n end", "def full_name\n @first_name + ' ' + @last_name\n end", "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def full_name\n \"#{last_name}, #{first_name} #{middle_name}\"\n end", "def first_name\n @first_name ||= @data[:givenname].last\n end", "def full_name()\n name + ' ' + last_name\n end", "def full_name\n \"#{name} #{first_last_name} #{second_last_name}\"\n end", "def first_name\n name.partition(',').last\n end", "def name\n [first_name || '', last_name || ''].map(&:capitalize).join(\" \")\n end", "def full_name\n\t name = \"\"\n\t name = name + \"#{first_name}\" if !first_name.nil? || !first_name.empty?\n\t name = name + \" #{last_name}\" if !last_name.nil? || !last_name.empty?\n\t\tname.gsub(/^ /,'')\n\tend" ]
[ "0.82630426", "0.8230351", "0.8187526", "0.8098964", "0.80962664", "0.794671", "0.79358965", "0.79339486", "0.7903188", "0.7893612", "0.7880249", "0.7859064", "0.7847392", "0.7846149", "0.7835837", "0.7759763", "0.77378917", "0.77253187", "0.7711071", "0.7708167", "0.7700223", "0.76858884", "0.7675718", "0.7660912", "0.7644812", "0.76230997", "0.76230997", "0.76230997", "0.76230997", "0.76230997", "0.76183486", "0.76151043", "0.7604311", "0.7594693", "0.7586945", "0.75856036", "0.7585082", "0.7583489", "0.7574133", "0.7573782", "0.7573782", "0.7573782", "0.7573782", "0.7573782", "0.7573782", "0.7559854", "0.7556351", "0.7554843", "0.7552956", "0.75447047", "0.7539023", "0.75352293", "0.7511769", "0.74965996", "0.7487994", "0.7482008", "0.7480688", "0.74747205", "0.74747205", "0.74747205", "0.7457528", "0.745092", "0.74193335", "0.74038655", "0.7383311", "0.73621404", "0.73507196", "0.7346056", "0.7346056", "0.7346056", "0.7315061", "0.7308031", "0.73018086", "0.72993004", "0.7291379", "0.72780687", "0.72780037", "0.7272719", "0.72657263", "0.7257167", "0.72387373", "0.7236812", "0.7221497", "0.72077125", "0.720738", "0.72045934", "0.71972823", "0.71972823", "0.71959424", "0.7190351", "0.7189711", "0.718675", "0.71864384", "0.7183334", "0.7170547", "0.71668655", "0.7163372", "0.71556973", "0.71508634", "0.71418464" ]
0.8495747
0
Returns first_name, last_name or just first_name if no last_name exists
def full_name_first_last return self.first_name unless (self.last_name.length > 0) return (self.first_name + " " + self.last_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end", "def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end", "def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end", "def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end", "def full_name\n [first_name, last_name].select(&:'present?').join(' ')\n end", "def last_first_name\n ret = \"\"\n ret += name unless name.blank?\n ret += \", \" unless firstname.blank? or name.blank?\n ret += firstname unless firstname.blank?\n ret\n end", "def name\n if first_name.present? && last_name.present?\n first_name + \" \" + last_name\n elsif first_name.present? && last_name.blank?\n first_name\n elsif first_name.blank? && last_name.present?\n last_name\n else\n \"No Name\"\n end\n end", "def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end", "def full_name\r\n last_name.blank? ? \"#{first_name} #{mi}\" : \"#{last_name}, #{first_name} #{mi}\"\r\n end", "def last_name_first\n self.last_name + ', ' + self.first_name\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def first_and_last_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n if self.first_name.present? and self.last_name.present?\n \"#{self.first_name} #{self.last_name}\"\n else\n self.first_name\n end\n end", "def full_name\n if last_name != nil\n first_name + \" \" + last_name\n else\n first_name\n end\n end", "def last_name_first_name\n \"#{last_name}, #{first_name}\"\n end", "def last_name_first\n if name\n stripped_name = name.strip\n\n leading_dots = if name =~ /^([A-Za-z\\s\\.]*)\\s/\n $1\n end\n\n if leading_dots\n stripped_name = stripped_name.gsub(/#{leading_dots}/, \"\")\n return stripped_name + \", \" + leading_dots\n end\n\n name_parts = stripped_name.split(' ')\n if name_parts.count > 1\n [name_parts[1, name_parts.length].join(' '), name_parts[0]].join(', ')\n else\n name\n end\n else\n \"\" # return empty string instead of nil if no name\n end\n end", "def full_name\n \"#{first_name} #{last_name}\" if first_name || last_name\n end", "def name\n [first_name, last_name].compact.join(\" \").presence || email\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def full_name\n if self.first_name && self.last_name\n \"#{self.first_name} #{self.last_name}\"\n elsif self.first_name.present?\n \"#{self.first_name}\"\n elsif self.last_name.present?\n \"#{self.last_name}\"\n else\n \"No Name\"\n end\n end", "def find_name_or_email\n if self.first_name.present? && self.last_name.present?\n self.first_name + \" \" + self.last_name\n else\n self.name || self.email\n end\n end", "def name\n [first_name, last_name].compact.join(' ')\n end", "def full_name\n [first_name, last_name].join(' ').strip\n end", "def first_last\n first_name + \" \" + last_name\n end", "def name\n if first_name.present?\n name = [first_name, last_name].join(\" \")\n end\n name.present? ? name : ''\n end", "def name\n if first_name.blank? and last_name.blank?\n \"(no name)\"\n else\n \"#{self.last_name}, #{self.first_name}\"\n end\n end", "def full_name \n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n\n return \"#{first_name} #{last_name}\".strip if (first_name || last_name)\n \"Anonymouse\"\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def username_and_first_name\n if first_name.nil?\n username\n else\n \"#{username} (#{first_name})\"\n end\n end", "def first_name_and_last_name\n \"#{first_name}-#{last_name}\"\n end", "def name\n [first_name, last_name].join(' ').strip\n end", "def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end", "def name\n [first_name, initial, last_name].select {|x| not x.nil?}.map {|x| x.strip}.join(\" \").titleize\n end", "def displayed_name\n first_name.present? || last_name.present? ? \"#{last_name}#{first_name.blank? ? '' : ', ' + first_name}\" : 'NAME NOT PROVIDED'\n end", "def last_name_first_name(name)\n last = last_name(name)\n first = name.gsub(last, '').strip \n \"#{last}, #{first}\"\n end", "def fullname\n [firstname, middlename, lastname].compact.join(\" \")\n end", "def name_lastfirst\n\t\treturn [ self.sn, self.givenName ].compact.join( ', ' )\n\tend", "def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def name\n [first_name, last_name].join(' ')\n end", "def fullname\n if !self.last_name.nil?\n self.first_name + ' ' + self.last_name\n else\n self.first_name\n end\n end", "def first_last\r\n firstname + (nickname && (nickname.size > 0) ? \" (#{nickname}) \" : \" \") + lastname\r\n end", "def first_name_last_name\n \"#{first_name} #{last_name}\"\n end", "def first_last_name\n names = name.split\n names.first + \" \" + names.last\n end", "def full_name\n middle_name ? first_name + \" \" + middle_name + \" \" + last_name : first_name + \" \" + last_name\n end", "def lastname_other_names\n \"#{lastname} #{other_names || \"\"}\"\n end", "def full_name\n if (first_name && last_name) && (!first_name.blank? && !last_name.blank?)\n \" #{first_name} #{last_name}\"\n else\n \" #{nickname}\"\n end\n end", "def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end", "def full_name\n [self.first_name, self.last_name].compact.join(\" \").strip\n end", "def fullname\n [firstname,middlename,lastname].join(' ')\n end", "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def display_name\n last_name.blank? ?\n (first_name.blank? ? email : first_name) :\n (first_name.blank? ? last_name : (first_name + ' ' + last_name))\n end", "def get_full_name\n [\n (surname.empty? ? nil : surname),\n (name.empty? ? nil : name)\n ].compact.join(\" \")\n end", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def full_name\n [self.first_name, self.last_name].join(' ')\n end", "def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end", "def name\n @name ||= [first_name, last_name].compact.join(' ')\n end", "def name \n last_name + \", \" + first_name\n end", "def get_full_name\n return self.first_name + \" \" + self.last_name\n end", "def name\n name = ''\n name = first_name if first_name\n name = name + ' ' + last_name if last_name\n name\n end", "def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end", "def full_name\n [ first_name, last_name].join(' ').squeeze(' ')\n end", "def fullname\n return first_name + \" \" + last_name\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n #take just first letter of middle name\n last_first += middle_name.slice(0,1)\n last_first += \". \"\n end\n last_first\n end", "def fullName\n return first_name + \" \" + last_name\n end", "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end", "def full_name\n if infix&.present?\n [first_name, infix, last_name].join(' ')\n else\n [first_name, last_name].join(' ')\n end\n end", "def full_name\n if (forename != '' && surname != '')\n forename+' '+surname\n elsif (forename != '')\n forename\n elsif (email != '')\n email\n end\n end", "def get_full_name\n [\n (surname.empty? || surname.nil? ? '' : surname),\n (name.empty? || name.nil? ? nil : name)\n ].compact.join(\" \")\n end", "def full_name\n [forename, surname].join(' ')\n end", "def entire_full_name\r\n mi.blank? ? \"#{first_name} #{last_name}\" : \"#{first_name} #{mi} #{last_name}\"\r\n end", "def full_name \r\n [firstname, surname].join(\" \") \r\n end", "def name\n if first_name && last_name\n return \"#{first_name} #{last_name}\"\n else\n return email\n end\n end", "def last_first\n last_first = last_name\n last_first += \", \"\n last_first += first_name\n if !@middle_name.nil?\n last_first += \" \"\n last_first += middle_name.slice(0, 1)\n last_first += \".\"\n end\n last_first\n end", "def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end", "def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n # if @middle_name.nil?\n # \"#{@first_name} #{@last_name}\"\n # else\n # \"#{@first_name} #{@middle_name} #{@last_name}\"\n # end \n [@first_name, @middle_name, @last_name].compact.join(' ')\n end", "def name\n [first_name || '', last_name || ''].map(&:capitalize).join(\" \")\n end", "def name\n last_name + \", \" + first_name\nend", "def full_name\n \"#{last_name}, #{first_name} #{middle_name}\"\n end", "def name\n result = []\n result << self.first_name\n result << self.last_name\n if result.compact.empty?\n self.user.login if self.user\n else\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end\n end" ]
[ "0.84432447", "0.8328628", "0.81748474", "0.8164338", "0.81598985", "0.7848116", "0.78479123", "0.7814771", "0.78054965", "0.7801327", "0.7771904", "0.7745265", "0.7733534", "0.77279496", "0.7683226", "0.76826966", "0.7671234", "0.76451296", "0.76350147", "0.76350147", "0.76350147", "0.76350147", "0.76350147", "0.76322395", "0.7628679", "0.76163363", "0.76111573", "0.76023406", "0.7601473", "0.7596309", "0.7585386", "0.7582013", "0.7578734", "0.7578734", "0.7578734", "0.7578734", "0.7578734", "0.7578734", "0.7575243", "0.756458", "0.7553395", "0.75481397", "0.75313944", "0.75170493", "0.7515838", "0.751342", "0.7493268", "0.74887466", "0.7485272", "0.74840194", "0.7478721", "0.7476118", "0.7476118", "0.7476118", "0.745847", "0.74455446", "0.7434342", "0.74139863", "0.74053013", "0.74052215", "0.73891413", "0.73888063", "0.7385191", "0.7353546", "0.7330419", "0.7255097", "0.72471964", "0.7247029", "0.7247029", "0.7247029", "0.7246228", "0.72443455", "0.72283936", "0.72234726", "0.7214863", "0.71791744", "0.7163156", "0.7161573", "0.71542406", "0.71539605", "0.71516997", "0.71479803", "0.71440446", "0.7143046", "0.7135984", "0.71358997", "0.7120471", "0.7113628", "0.7111225", "0.7109051", "0.7087732", "0.7087615", "0.7085324", "0.70781106", "0.70781106", "0.70762324", "0.7073985", "0.7065711", "0.706494", "0.70643693" ]
0.81253034
5
"Sand", "Water", "Fish", and "Sun" appear without overlapping (regardless of the case). Examples sum_of_a_beach("WAtErSlIde") ==> 1 sum_of_a_beach("GolDeNSanDyWateRyBeaChSuNN") ==> 3 sum_of_a_beach("gOfIshsunesunFiSh") ==> 4 sum_of_a_beach("cItYTowNcARShoW") ==> 0
def sum_of_a_beach (beach) (beach.scan(/sand|water|fish|sun/i) || []).length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_jewels_in_stones(j, s)\n hash_table = {}\n (0..s.length-1).each do |i|\n if hash_table.include? s[i]\n hash_table[s[i]] = hash_table[s[i]] + 1\n else\n hash_table[s[i]] = 1\n end\n end\n\n count = 0\n (0..j.length-1).each do |i|\n if hash_table.include? (j[i])\n if hash_table[j[i]] != nil\n count = count + hash_table[j[i]]\n hash_table[j[i]] = nil\n else\n fail (\"Letters in J are not distinct\")\n end\n end\n end\n\n return count\nend", "def solve(s0, s1)\n count = 0\n\n hash0 = Hash.new(0)\n hash1 = Hash.new(0)\n\n arr0 = s0.split(' ')\n arr1 = s1.split(' ')\n\n arr0.each do |word|\n hash0[word.downcase] += 1\n end\n\n arr1.each do |word|\n hash1[word.downcase] += 1\n end\n\n hash1.each do |k, v|\n if hash0[k] > 0\n count += 1\n end\n end\n\n return count\nend", "def countApplesAndOranges(start_point, ending_point, apple_tree,\n orange_tree, apples, oranges)\n fallen_a = Array.new(0)\n fallen_o = Array.new(0)\n v = start_point..ending_point\n apples.each do |a|\n fallen_a << a if v.include?(apple_tree + a)\n end\n oranges.each do |o|\n fallen_o << o if v.include?(orange_tree + o)\n end\n p fallen_a.size\n p fallen_o.size\nend", "def love_test(s, t)\n e = []\n m = s.gsub(\" \",\"\").split(\"\") + t.gsub(\" \",\"\").split(\"\")\n e << s.gsub(\" \",\"\").split(\"\").uniq\n e << t.gsub(\" \",\"\").split(\"\").uniq\n l = e.flatten.group_by(&:itself).map { |i, d| [i, d.count]}.to_h\n k = l.keep_if{ |k, v| v > 1}\n print (m.size/k.size)\nend", "def hamm one, two\n count = 0\n uno = one.split('')\n dos = two.split('')\n i = 0\n uno.each do |x|\n if x != dos[i]\n count += 1\n end\n i += 1\n end\n puts count\nend", "def countApplesAndOranges(s, t, a, b, apples, oranges)\n result_a = 0\n apples.each do |d|\n cord = a + d\n if s <= cord && cord <= t\n result_a += 1\n end\n end\n puts result_a\n\n result_o = 0\n oranges.each do |d|\n cord = b + d\n if s <= cord && cord <= t\n result_o += 1\n end\n end\n puts result_o\nend", "def hamming_dna(dna_1, dna_2)\n hamming = 0;\n dna_1.split(\"\").each_with_index do |v, i|\n dna_2.split(\"\")[i] != v ? hamming += 1 : hamming = hamming\n end\n hamming\nend", "def bonus_ana(word1, word2)\n hash = Hash.new(0)\n\n word1.each_char { |char| hash[char] += 1 }\n word2.each_char { |char| hash[char] -= 1 }\n\n hash.values.all? { |count| count == 0 }\nend", "def measure_string_overlap(string_a, string_b)\n overlap = 3\n lcs = 1.0\n min_string_length = [string_a, string_b].map(&:length).min\n prev_sim = 0\n max_sim = 0\n overall_sim = string_a.longest_subsequence_similar(string_b)\n puts \"Overall similarity: #{ overall_sim.round(3) }\"\n similarity_threshold = 0.95\n\n until(\n 1.0 == max_sim ||\n (overlap > 5 && max_sim >= similarity_threshold) ||\n overlap >= min_string_length\n ) do\n puts ''\n string_a_end = string_a[-overlap..-1]\n string_b_start = string_b[0..(overlap-1)]\n sim = string_a_end.longest_subsequence_similar(string_b_start)\n puts [\n ('█' * (sim * 10).round).rjust(10),\n ' ',\n string_a_end.inspect\n ].join\n puts [\n sim.round(3).to_s.rjust(10).color(prev_sim <= sim ? :green : :red),\n ' ',\n string_b_start.inspect\n ].join\n if sim > max_sim\n optimal_overlap = overlap\n end\n max_sim = [max_sim, sim].max\n prev_sim = sim\n overlap += 1\n end\n if max_sim > similarity_threshold\n optimal_overlap\n else\n 0\n end\nend", "def countApplesAndOranges(s, t, a, b, apples, oranges)\n # apple_tree = a\n # orange_tree = b\n # house = [s, t]\n apple_count = 0\n orange_count = 0\n\n apples.collect do |distance|\n if ((a + distance) >= s) && ((a + distance) <= t)\n apple_count += 1\n end\n end\n\n oranges.collect do |distance|\n if ((b + distance) >= s) && ((b + distance) <= t)\n orange_count += 1\n end\n end\n\n puts apple_count\n puts orange_count\n\nend", "def commonCharacterCount(s1, s2)\n a1 = s1.split(\"\").uniq\n a2 = s2.split(\"\").uniq\n \n b = a1 - a2\n c = a2 - a1\n \n check_a = a1 - b - c\n \n count = 0\n \n check_a.each do |char|\n count_1 = s1.split(\"\").count(\"#{char}\")\n count_2 = s2.split(\"\").count(\"#{char}\")\n \n if count_1 < count_2\n count += count_1\n else\n count += count_2\n end\n end\n \n count\nend", "def num_jewels_in_stones(j, s)\n j_array = j.split('')\n s_array = s.split('')\n c = 0\n s_array.each do |e|\n c += 1 if j.include?(e)\n end\n c\nend", "def countApplesAndOranges(s, t, a, b, apples, oranges)\n sam_apples_count = 0\n sam_oranges_count = 0\n apples.each do |apple|\n apple_position = apple + a\n if (apple_position >= s && apple_position <= t) then\n sam_apples_count += 1\n end\n end\n \n oranges.each do |orange|\n orange_position = orange + b\n if (orange_position >= s && orange_position <= t) then\n sam_oranges_count += 1\n end\n end\n \n puts sam_apples_count\n puts sam_oranges_count\nend", "def bulls(guess)\n guess.split(//).zip(@word.split(//)).inject(0) { | r, (letter_1, letter_2) | letter_1 == letter_2 ? r + 1 : r }\n end", "def make_anagram word1, word2\n s1 = word1.chars\n s2 = word2.chars\n\n count = 0\n\n # s1.each do |x|\n # if s2.include? x\n # count +=1\n # end\n # end \n # ana = (word1.size - count)*2\n\n freq = Hash.new(0)\n s1.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq\n\n s2.each do |x|\n if freq[x] != nil\n freq[x] -= 1\n end\n end\n\n freq\n\n freq.each do |key,value|\n if value != 0\n count += value.abs\n end\n end\n\n count\n\nend", "def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend", "def common_neighbours(str1, str2)\n pairs1 = get_bigrams(str1)\n pairs2 = get_bigrams(str2)\n union = pairs1.length + pairs2.length;\n hit_count = 0\n pairs1.each{ |pair1|\n pairs2.each{ |pair2|\n hit_count += 1 if pair1 == pair2\n }\n }\n #return (2.0 * hit_count) / union.to_f\n return ((2.0 * hit_count) / union.to_f) / [str1.length, str2.length].min.to_f # -1)\n end", "def num_jewels_in_stones(j, s)\n jewells = []\n j = j.chars\n s = s.chars\n j.each do |jewell|\n s.each do |stone|\n if jewell == stone \n jewells << stone\n end\n end\n end\n jewells.count\nend", "def HammingDistance(arr)\n first_str = arr[0].chars\n sec_str = arr[1].chars\n hamm_dis_count = []\n (0..first_str.size).each do |index|\n if first_str[index] != sec_str[index]\n hamm_dis_count << first_str[index]\n end\n end\n hamm_dis_count.size\nend", "def collapse_count(input, ignore)\n stack = [[], :bottom]\n count = 0\n\n input.each do |x|\n if x.upcase == ignore\n next\n end\n\n if x != stack[1] && x.upcase == stack[1].upcase\n stack = stack[0]\n count -= 1\n else\n stack = [stack, x]\n count += 1\n end\n end\n\n count\nend", "def score_word(a, b)\n count = 0\n a.split('').each_index do |i|\n if a[i] == b[i]\n count += (a.length - i)\n end\n end\n return count\n end", "def defect_count( dict_word, word )\n\n\tdict_letters = Hash.new \t# Characters in dictionary word\n\tword_letters = Hash.new \t# Characters in test word\n\n\t# Add the characters to hash, add the values if character is already present.\n\tdict_word.length.times do |i|\n\t\tif dict_letters[dict_word[i]].nil?\n\t\t\tdict_letters[dict_word[i]] = 1\n\t\telse\n\t\t\tdict_letters[dict_word[i]] += 1\n\t\tend\n\tend\n\n\t# Do the same thing for the other word\n\tword.length.times do |i|\n\t\tif word_letters[word[i]].nil?\n\t\t\tword_letters[word[i]] = 1\n\t\telse\n\t\t\tword_letters[word[i]] += 1\n\t\tend\n\tend\n\n\tdefects = 0 # Defect count to return\n\t\n\t# Compare the two words unique characters, for each non-matching character, add number of \n\t# characters present as defects\n\tif dict_letters.size > word_letters.size\n\t\tdict_letters.each do |key, val|\n\t\t\tdefects += val if word_letters[key].nil?\t\t\n\t\tend\n\telse\n\t\tword_letters.each do |key, val|\n\t\t\tdefects += val if dict_letters[key].nil?\t\t\n\t\tend\n\tend\n\n\t# For the matching unique characters, add the difference in quantity as defects\n\tdict_letters.each do |kd, vd|\n\t\tword_letters.each do |kw, vw|\n\n\t\t\tdefects += (vd - vw).abs if kd.eql? kw\n\t\tend\n\tend\n\n\t# Get the smallest word length\n\tbound = (dict_word.length < word.length)? dict_word.length : word.length\n\n\t# To reward words which have very similar sequences of characters, we add defects for\n\t# each character that does not match sequentially with other word.\n\tbound.times do |i|\n\n\t\t# add defect for each unmatching character\n\t\tdefects += 1 unless dict_word[i].eql? word[i]\n\tend\n\n\t# return score\n\treturn defects\nend", "def jewels_and_stones(j,s)\n\n if (s == nil || s.length < 1 || j == nil || j.length < 1)\n return 0\n end\n\n hash = Hash.new\n\n j.each_char do |char|\n hash[char] = 1\n end\n\n count = 0\n s.each_char do |char|\n if (hash[s[char]] == 1)\n count = count + 1\n end\n end\n return count\n\nend", "def apples_and_oranges(s, t, a, b, apples, oranges)\n n_apples = 0\n n_oranges = 0\n\n apples.each do |apple| \n if apple + a >= s && apple + a <= t\n n_apples += 1 \n end\n end \n\n oranges.each do |orange| \n if orange + b <= t && orange + b >= s\n n_oranges += 1 \n end\n end\n \n puts n_apples\n puts n_oranges\nend", "def checkSum\n h = Hash.new\n # get the counts of each character\n (0..@value.length - 1).each do |idx|\n char = @value[idx]\n h[char] = h.fetch(char,0) + 1\n end\n h.delete(\"-\")\n h.sort_by{|k,v| [-v,k]}.to_h.keys.join[0..4]\n end", "def HammingDistance(strArr)\n hamming = 0\n\n (0...strArr[0].length).each do |i|\n if strArr[0][i] != strArr[1][i]\n hamming += 1\n end\n end\n\n hamming\nend", "def sherlock(str)\n str_len = str.length\n str_arr = str.split('')\n substrings_count = {}\n result = 0\n str_arr.each_with_index do |alpha, index|\n n = str_len - index\n n.times do |pos|\n ss = str_arr[index..(index+pos)].sort.join('')\n substrings_count[ss] = substrings_count[ss] ? substrings_count[ss]+1 : 1\n end\n end\n\n substrings_count.each do |key, val|\n result = result + ((val*(val-1))/2) if val > 1\n end\n result\nend", "def substrings(str, dict)\n results = Hash[dict.map { |word| [word, 0] }]\n str_arr = str.downcase.split(\" \")\n str_arr.each do |i|\n dict.each do |j|\n if i.include?(j)\n results[j] += 1\n end\n end\n end\n results.keep_if { |k,v| v > 0 }\nend", "def pair_not_overlapping?\n !(self.match(/([a-z][a-z]).*\\1/)).nil?\n end", "def num_jewels_in_stones(j, s)\n jewels = 0\n s.each_char do |stone|\n if j.include?(stone)\n jewels += 1\n end\n end\n jewels\nend", "def hamming_distance(first_word, second_word)\n if first_word.length == second_word.length\n first_word = first_word.split('')\n second_word = second_word.split('')\n distance = 0\n first_word.each_with_index do |a, i|\n if a != second_word[i]\n distance += 1\n end\n end\n distance\n else\n nil\n end\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def gemstones(arr)\n common_chars = ('a'..'z').to_a\n arr.each do |a|\n common_chars = common_chars & a.chars\n end\n common_chars.size\nend", "def character_overlap?(item)\n first_array = self.decluttered_and_squished_description.split('')\n second_array = item.decluttered_and_squished_description.split('')\n \n first_array.percentage_similarity_to(second_array) > 80 ? \"Too much character overlap\" : false\n end", "def shortest_nonshared_substrings s1, s2\n i = 1\n distinct = Set.new\n while i < [s1.length, s2.length].min and distinct.empty?\n distinct = distinct_kmers(i, s1, s2)\n i += 1\n end\n distinct\nend", "def fifth_anagram?(first_word, second_word)\n word_count = Hash.new(0)\n first_word.chars.each { |char| word_count[char] += 1 }\n second_word.chars.each { |char| word_count[char] -= 1 }\n\n word_count.all? {|_, val| val == 0}\nend", "def array_overlap_score(s)\n week_overlap_array = s.week_array & self.week_array\n weekend_overlap_array = s.weekend_array & self.weekend_array\n return week_overlap_array.count + weekend_overlap_array.count\n end", "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend", "def number_of_awards(text)\n result = 0\n @awards.each do |a|\n if text.downcase.include?(a)\n result += 1\n end\n end\n return result\nend", "def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend", "def make_anagram a, b\n s1 = a.chars\n s2 = b.chars\n freq = Hash.new 0\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n s2.each{ |letter| freq[letter]-=1 }\n\n freq.each{ |k,v| count += v.abs }\n puts count\nend", "def destinations_with_multiplicities\n destinations.each_with_object(Hash.new(0)) do |word, counts|\n counts[word] += 1\n end\n end", "def mix(s1, s2)\n s1_counts = lowercase_count(s1)\n s2_counts = lowercase_count(s2)\n shared_letters = (s1_counts.keys + s2_counts.keys).uniq.sort\n results = []\n shared_letters.each do |letter|\n if (s1_counts[letter] == s2_counts[letter]) && s1_counts[letter] > 1\n results << \"=:#{letter * s1_counts[letter]}\"\n elsif (s1_counts[letter] > s2_counts[letter]) && s1_counts[letter] > 1\n results << \"1:#{letter * s1_counts[letter]}\"\n elsif (s1_counts[letter] < s2_counts[letter]) && s2_counts[letter] > 1\n results << \"2:#{letter * s2_counts[letter]}\"\n end\n end\n results_arranger(results).join(\"/\")\nend", "def hamm(x, y)\n x, y = *([x,y].map{|z| z.split(\"\")})\n x.zip(y).inject(0){|z,s| z += if s[0] == s[1] then 0 else 1 end}\nend", "def duplicate_count(text)\n return 0 if text.empty?\n\n hash = Hash.new { 0 }\n text.split('').map(&:downcase).map(&:to_sym).each do |char|\n hash[char] += 1\n end\n\n hash.count { |_, v| v >= 2 }\nend", "def f(n,d) # returns total number of times d shows up in range 0..n including n\n total = 0\n (n+1).times do |k|\n total += k.to_s.count(d.to_s)\n end\n return total\nend", "def hamming_distance(string1, string2)\n h = 0\n (0..string1.length - 1).each do |i|\n h += 1 if string1[i] != string2[i]\n end\n h\nend", "def is_isogram(s)\narr = [ ]\nb = \"a\"..\"z\"\nb.map do |x| p arr << s.downcase.split(\"\").count(x)\nend\narr.include?(2) || arr.include?(3) ? false : true\nend", "def fourth_anagram_one_hash?(str1, str2)\n letter_sums = Hash.new(0)\n\n # If we do the exact same subractions for each letter in\n # str2 as we do additions for str1, letter_sums will all be 0.\n str1.each_char { |letter| letter_sums[letter] += 1 }\n str2.each_char { |letter| letter_sums[letter] -= 1 }\n\n # It's a zero-sum game!\n letter_sums.each_value.all? { |sum| sum == 0 }\nend", "def fifth_anagram?(str1, str2)\n\n counter = Hash.new(0)\n str1.each_char.with_index do |char, idx| #O(n)\n counter[char] += 1 \n counter[str2[idx]] -= 1\n end\n\n counter.values.all? { |v| v == 0 } #O(n)\n\nend", "def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend", "def word_overlap?(item)\n first_array = self.clean_description.split.declutter\n second_array = item.clean_description.split.declutter\n\n first_array.percentage_similarity_to(second_array) > 85 ? \"Too much word overlap\" : false\n end", "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 solution(a)\n counts = {}\n for i in a\n counts[i] ||= 0\n counts[i] += 1\n end\n for i in (1..a.count)\n return 0 if counts[i] != 1\n end\n return 1\nend", "def compute(left_strand,right_strand)\n return 0 if left_strand == right_strand\n\n left_chars = left_strand.chars\n right_chars = right_strand.chars\n\n distance = 0\n\n left_chars.each_with_index do |left_char,idx|\n right_char = right_chars[idx]\n break if right_char.nil? # ignore extra length on first strand when longer\n\n distance += 1 unless left_char == right_char\n end\n\n distance\n end", "def fifth_anagram?(string1, string2) # Time: O(n) * O(n) * O(n) => O(n) Space = O(1)\n count = Hash.new(0)\n string1.split(\"\").each {|char1| count[char1]+=1}\n string2.split(\"\").each {|char2| count[char2]-=1}\n count.all? {|k,v| v.zero?}\nend", "def solve(s)\n alphabet = ('a'..'z').to_a\n s.gsub(/[aeiou]/, ' ').split.map { |l| l.chars.map { |i| alphabet.index(i) + 1 }.sum }.max\nend", "def duplicate_count(text)\n result = text.split('')\n result.group_by { |elem| elem and elem.upcase }.select { |_key, val| val.length > 1 }.keys.count\nend", "def nombres_abc(nombres)\n nombres.select{|x| x =~ /A/ || x =~ /B/ || x =~ /C/}.count # 2\nend", "def solve(fighters, bosses)\n f_count = fighters.count(1)\n return bosses.select {|sub_arr| sub_arr.count(1) >= f_count}\nend", "def fifth_anagram?(first_word, second_word)\n hash = Hash.new(0)\n first_word.each_char do |char|\n hash[char] += 1\n end\n\n second_word.each_char do |char|\n hash[char] -= 1\n end\n hash.values.all? {|value| value == 0}\nend", "def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend", "def love_test(str_1, str_2)\n str_1 = str_1.gsub(\" \", \"\").split(\"\")\n str_2 = str_2.gsub(\" \", \"\").split(\"\")\n p \"Total Chars in Common: #{((str_1 + str_2).count - 1) / (str_1 & str_2).count}\"\nend", "def solution(a)\n candidate = a[0]\n count = 0\n index = 0\n a.each_with_index do |d, idx|\n count = candidate == d ? count += 1 : count -= 1\n if count == 0\n candidate = d\n count = 1\n index = idx\n end\n end\n a.count { |d| d == candidate } * 2 > a.length ? index : -1\nend", "def discrepancy(a, b)\n\tcase\n\t\twhen a.empty? then b.length\n\t\twhen b.empty? then a.length\n\t\telse [(a[0] == b[0] ? 0 : 1) + discrepancy(a[1..-1], b[1..-1]),\n\t\t\t\t1 + discrepancy(a[1..-1], b),\n\t\t\t\t1 + discrepancy(a, b[1..-1])].min\n\tend\nend", "def num_jewels_in_stones(j, s)\n s.count(j)\nend", "def overlap_words(normal, patient)\n\t\tfound_words = []\n\t\tnormal_count = []\n\t\tpatient_count = []\n\t\tnormal.each do |row|\n\t\t\tif patient.map(&:first).include? row[0]\n\t\t\t\tfound_words << row[0]\n\t\t\t\tnormal_count << row[1]\n\t\t\t\t# search over the patient to look for that same key (word)\n\t\t\t\tpatient.each do |x,y|\n\t\t\t\t\tif x == row[0]\n\t\t\t\t\t\tpatient_count << y\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t# have to get the values for the other two arrays\n\t\t\tend\n\t\tend\n\n\t\treturn [found_words, normal_count, patient_count]\n\tend", "def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend", "def scramble(s1,s2)\n pile_of_letters = s1.chars\n target_letters = s2.chars\n target_letters.uniq.all? { |letter| pile_of_letters.count(letter) >= target_letters.count(letter) }\nend", "def bears(x,s)\n\n #scan for occurrences of 8B or B8\n bear_array = s.scan(/(8B)|(B8)/) || []\n\n #if the number of bear pairs is greater or the same as x - true, else false\n bear_number = bear_array.length >= x\n\n #join occurences of bear pairs\n all_bear = bear_array.join\n\n #put into correct format\n [all_bear, bear_number]\n\nend", "def get_minimum_index_sum(list1, list2)\n words = []\n value = nil\n\n (0..list1.length-1).each do |i|\n (0..list2.length-1).each do |j|\n break if value != nil and value < i + j\n if list1[i] == list2[j]\n if value == nil or value > i + j\n words = []\n value = i+j\n end\n words.append('\"' + list1[i] + '\"')\n break\n end\n end\n end\n return sprintf \"(%s)\", words.join(', ')\nend", "def num_repeats(string)\n string = string.gsub(\" \", \"\") \n # Get rid of spaces. Also if this contained numbers, symbols, etc would need to delete those too or they will be counted\n letters = string.split(\"\")\n holder = []\n\n i = 0\n count = 0\n while i < letters.length\n j = i+1\n while j < letters.length\n if letters[i] == letters[j] && !holder.include?(letters[i])\n count += 1\n holder << letters[i]\n end\n j += 1\n end\n i += 1\n end\ncount\nend", "def substrings (searchword, listOfWords)\n\n\n\n # create a array first with searchword and put any word in the array\n\n searchwords = searchword.split(/\\W+/)\n listOfWords = listOfWords\n\n\n dict = Hash.new(0)\n\n listOfWords.each do |word| # This function puts the word's inside the hash and increase the counter\n searchwords.each do |search|\n\n if search.downcase.include? word.downcase\n dict[word] += 1\n end\n end\n end\n\n\n dict.each do |word, count|\n\n puts \"Word: #{word} \\n Count: #{count}\"\n\n end\n\n\nend", "def search_substr( fullText, searchText, allowOverlap = true )\n if searchText == ''\n 0\n else\n fullText.scan(allowOverlap ? Regexp.new(\"(?=(#{searchText}))\") : searchText).size\n end\nend", "def count ( nucleotide, strand )\n\tstrand.upcase.count( nucleotide )\nend", "def count_occurance(text='')\n raise \"input must be instance of String\" unless text.is_a?(String)\n\n text_chunks = text.downcase.gsub(ONE_OR_TWO_WORDS_RE, '').gsub(NON_ALPHANUMERIC_AND_NON_DOT_RE, ' ').gsub(@stopwords.to_re, '').gsub(/\\./, '').split\n text_chunks.inject(Hash.new(0)) do |container, word|\n container[word] += 1; container\n end\n end", "def solution(a)\n return 0 if a.empty?\n sorted_hash = a.sort.group_by { |x| x }\n sorted_hash.values.last.count\nend", "def common_chars(arr)\n new_arr = []\n test_letters = arr[0].chars.uniq\n test_letters.each do |letter|\n count = arr[0].count(letter)\n arr.each do |word|\n temp_count = word.count(letter)\n count = temp_count if temp_count < count \n end\n new_arr += [letter] * count \n end\n new_arr\nend", "def look_and_say(str)\n counter = 1\n numbers = str.split(//)\n cluster = []\n\n numbers.each_with_index do |num, i|\n if num != numbers[i + i]\n cluster << [counter, num]\n counter == 1\n else\n counter += 1\n end\n end\n\n cluster.flatten.join(\"\")\nend", "def mutation(arr)\n first = arr[0]\n second = arr[1]\n count = 0\n first.downcase.split(\"\").each do |letter1|\n second.downcase.split(\"\").each do |letter2|\n if letter1 == letter2\n count += 1\n end\n end\n end\n return count\nend", "def missing_from_letters\n word.chars.uniq.inject(\"\") do |memo, l|\n difference = word.count(l) - letters.count(l)\n if difference > 0\n memo += l * difference\n end\n memo\n end\n end", "def combine_anagrams(words)\n\n ouArr = Array.new\n\n words.each do |w|\n\n ouIt = Array.new [w]\n\n words.each do |w2|\n if w.downcase.chars.sort == w2.downcase.chars.sort && !ouIt.include?(w2)\n ouIt.push(w2)\n end\n end\n ouIt.sort!\n\n if !ouArr.include?(ouIt)\n ouArr.push(ouIt)\n end\n end\n ouArr\nend", "def buddy(start, nd)\r\n start.upto(nd) do |n|\r\n potential_match = sum_divisors(n)\r\n next if potential_match < n\r\n return \"(#{n} #{potential_match})\" if sum_divisors(potential_match) == n\r\n end\r\n 'Nothing'\r\nend", "def overlap(b)\n a = self\n a_len = self.length\n b_len = b.length\n n = nil\n\n (0..a_len-1).each do |i|\n j = i\n k = 0\n\n while j < a_len and k < b_len and a[j] == b[k]\n j += 1\n k += 1\n end\n\n n = k and break if j == a_len\n end\n\n n ||= 0\n\n a + b[n..b_len-1]\n end", "def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend", "def substrings(string,dictionary)\n\tword_count = Hash[dictionary.map {|i| [i, 0]}]\n\twords = string.downcase.split(\" \")\n\n\twords.each do |word|\n\t\tword_count.each do |key,value|\n\t\t\tword_count[key] += 1 if word.include?(key)\n\t\tend\n\tend\n\n\tword_count.delete_if {|key, value| value == 0 }\n\tword_count\nend", "def min_umbrellas(weather)\n count, rain, at_home, at_work = 0, [\"rainy\", \"thunderstorms\"], 0, 0\n return 0 if weather.include?(rain[0] == false || weather.include?(rain[1]) == false)\n weather.each_with_index do |x, i|\n if i == 0 && rain.include?(x)\n count += 1\n at_work += 1\n elsif i.odd? == false && rain.include?(x)\n count += 1 if at_home == 0\n at_work += 1 \t \t \n at_home -= 1 if at_home > 0 \n elsif i.odd? && rain.include?(x)\n count += 1 if at_work == 0\n at_home += 1\n at_work -= 1 if at_work > 0\n end\n end\n p count\nend", "def substrings words, dictionary\n hits = Hash.new\n dictionary.each do |lookup|\n hits[lookup] = words.scan(/#{lookup}/i).length\n end\n hits.delete_if {|k,v| v == 0} # squeeze out the empties\nend", "def solution(a)\n a.uniq.count\nend", "def calculateNumStickers(word)\n @@facebook_hash = { f:1,a:1,c:1,e:1,b:1,o:2,k:1 }\n length = word.length - 1 \n word_hash = {}\n stickers = 0\n\n for i in 0..length\n if word_hash[:\"#{word[i].chr}\"] == nil\n word_hash[:\"#{word[i].chr}\"] = 1 \n else\n word_hash[:\"#{word[i].chr}\"] = word_hash[:\"#{word[i].chr}\"] + 1 \n end\n end\n\n word_hash.keys.each do |key|\n temp_stickers = word_hash[:\"#{key}\"] / @@facebook_hash[:\"#{key}\"]\n temp_stickers = temp_stickers.ceil\n\n if temp_stickers > stickers\n stickers = temp_stickers\n end\n end\n\n stickers\nend", "def sluggish_octopus(the_sea)\n the_sea.each_with_index do |fish1, idx|\n longest = true\n\n the_sea.each_with_index do |fish2, idx2|\n next if idx == idx2\n longest = false if fish1.length > fish2.length\n end\n\n return fish1 if longest\n end\nend", "def countingValleys(n, s)\n valleys, counter, flag, prev_flag = 0, 0, \"sea level\", \"\"\n s.chars.each do |x|\n prev_flag = flag\n if x == \"U\" \n counter += 1 \n elsif x == \"D\"\n counter -= 1\n end\n flag = \"valley\" if counter < 0\n flag = \"sea level\" if counter == 0 \n if prev_flag == \"valley\" && flag == \"sea level\"\n valleys += 1\n elsif prev_flag == \"sea level\" && flag == \"valley\"\n valleys += 1\n end\n end\n valleys/2\nend", "def matches(str)\n groups = str.each_char.to_a.group_by{ |c| c }\n groups.values.group_by{ |arr| arr.size }\nend", "def solve_num\n union_apple = [\"a\", \"b\", \"a\"] | [\"c\", \"c\"]\nend", "def common_ngrams(n)\n cipher_text.\n split.\n select { |word| word.size == n }.\n each_with_object(count_hash) { |ngram, counts| counts[ngram] += 1 }.\n sort_by { |_, count| -count }\n end", "def sub_strings(arr,text)\n text = text.downcase\n result = Hash.new(0)\n arr.each do |word|\n result[word] += 1 unless text.scan(word.downcase).empty?\n end\n result\nend", "def common_characters(arr)\n target_count = arr.count\n\n hash = Hash.new(0)\n (0...target_count).each do |i|\n arr[i].split('').each do |letter|\n hash[letter] += 1\n end\n end\n\n result = []\n hash.each do |k, v|\n while v >= target_count\n if v >= target_count\n result << k\n v -= target_count\n end\n end\n end\n\n result\nend", "def share_sub(a,b)\n a_dict = Set.new a.chars\n b.chars.each do |c|\n if a_dict.include?(c) then\n return true\n end\n end\n false\nend", "def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend", "def word_score(word, rack)\n # set our score to 0\n score = 0\n # loop through each letter and find the score from the list then add it\n # to our total\n word.chars.each do |letter|\n score += SCORES[letter.to_sym]\n end\n # return the total. Add 50 points if the word uses all the rack\n word.length == rack.join.length ? score + 50 : score\nend" ]
[ "0.60254127", "0.6016107", "0.59957707", "0.5989535", "0.5769685", "0.57247835", "0.5718512", "0.57029873", "0.57012963", "0.56898737", "0.5672843", "0.565716", "0.5641401", "0.5635661", "0.55931747", "0.5568826", "0.55572534", "0.55544806", "0.5545501", "0.5528204", "0.55245936", "0.55117685", "0.55054176", "0.5484541", "0.5467946", "0.54624385", "0.54580486", "0.5456497", "0.5454521", "0.545301", "0.545028", "0.54493445", "0.5440191", "0.5423778", "0.5400926", "0.5391924", "0.5390143", "0.53833556", "0.5380047", "0.53719133", "0.5366066", "0.53639793", "0.5363302", "0.53568786", "0.53535616", "0.53510225", "0.53443575", "0.5342439", "0.53412664", "0.5333404", "0.5330654", "0.53238845", "0.53238595", "0.5320249", "0.5315378", "0.5311599", "0.5305518", "0.5297919", "0.5294095", "0.52895874", "0.528818", "0.5286953", "0.52833515", "0.5282243", "0.52806515", "0.52800286", "0.52745265", "0.5274093", "0.5259232", "0.5258483", "0.5256741", "0.52566445", "0.52556473", "0.5254575", "0.52477646", "0.5245822", "0.5237024", "0.52302974", "0.52274597", "0.5227298", "0.5227132", "0.52269876", "0.52223164", "0.5221957", "0.52215075", "0.52168876", "0.5216815", "0.5215783", "0.5215549", "0.5212814", "0.5212486", "0.52093345", "0.52084434", "0.5206336", "0.52022934", "0.5201215", "0.52010536", "0.51975834", "0.51959413", "0.5195271" ]
0.6820596
0
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.contact_mailer.contact_me.subject
def contact_me(params) @params = params @greeting = "Hi" #mail to: "to@example.org" mail(:from => @params.personal_email,:to =>@params.personal_email, :subject => "- EJJE -Gracias Por tu ayuda") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def message_subject=(value)\n @message_subject = value\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject\n @mail.subject\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def subject=(string)\n set('Subject', string)\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject_name=(value)\n @subject_name = value\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def subject_name\n subject_full_name\n end", "def subject_name\n return @subject_name\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def subject\n message.subject\n end", "def message_subject\n return @message_subject\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def subject\n self['subject']\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject; @message_impl.getSubject; end", "def set_subject(subject)\n\t\tend", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end", "def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end", "def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end", "def normalize_subject_name\n self.subject = subject.downcase.titleize\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def subject\n title \n end", "def get_subject\n\t\tend", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'\n end\n end", "def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end", "def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end", "def contact_message(contact, store, email)\n @contact = contact\n @store = store\n\n mail(to: email, subject: 'Thanks for contact us')\n end", "def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def i18n_label\n \"email.#{name}_label\"\n end", "def contact_me(contact_form)\n @from = contact_form.email\n @message = contact_form.message\n @name = contact_form.name\n if contact_form.name.presence\n subject = \"Portfolio: A message from #{contact_form.name}\" \n else\n subject = \"Portfolio: A message from an unnamed visitor to your site.\"\n end\n mail from: contact_form.email,subject: subject\n end", "def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end", "def message_me(msg)\n @msg = msg\n mail subject: \"From: #{@msg.name} : #{@msg.email} says : #{@msg.subject}\", body: \"From: #{@msg.name} @ #{@msg.email} | Subject: #{@msg.subject} | Body of email : #{@msg.content}\"\n #@msg.content << \"From : #{@msg.name} :: Subject : #{@msg.subject}\" # previous one\n end", "def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def default_i18n_subject(interpolations = {})\n ''\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def headers\r\n {\r\n :subject => \"My Contact Form\",\r\n :to => \"alama.tounkara@gmail.com\",\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def contact_mail\n @greeting = \"お問い合わせ\"\n # @contact = contact\n\n mail to: \"to@example.org\"\n\n mail subject: \"myAppからお問い合わせがありました\"\n end", "def data_subject=(value)\n @data_subject = value\n end", "def build_email_kase(options={})\n EmailKase.new({\n :kase => self,\n :subject => \"%{name} wants to know what you think\".t % {:name => self.person.casualize_name}\n }.merge(options))\n end", "def subject_names\n @subject_names ||= sw_subject_names\n end", "def translation_scope\n \"mailers.#{mailer_name.tr(\"/\", \".\").sub(\"_mailer\", \"\")}.#{action_name}\"\n end", "def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def contact(contact)\n @recipients = App[:recipients]\n @body[:contact] = contact\n @from = App[:from]\n @subject =\"咨询\"+ contact.name\n @sent_on = Time.now\n end", "def set_subject\n @subject = Subject.friendly.find(params[:id])\n end", "def question(member, subject, content)\n @content = content\n\n mail to: member.email, subject: subject\n end", "def default_email( cid )\n return \"#{cid}@#{DEFAULT_DOMAIN}\"\n end", "def headers\n {\n :subject => \"My Contact Form\",\n :to => \"cmaxwell@ojala.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def subject_name\n subject&.name\n end", "def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end", "def subject\n @subject\n end", "def subject\n @subject\n end", "def subject\n @subject\n end", "def headers\n {\n :subject => \"My Contact Form\",\n :to => \"ahamdi.it@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"My Contact Form\",\n :to => \"Namilya9@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def headers\r\n {\r\n :subject => \"JP Health Insurance Contact Form\",\r\n :to => [\"contact@jpfinancialgroupllc.com\", \"chamiesemarion@gmail.com\", \"cc@ccevans.com\"],\r\n :from => %(\"#{name}\" <#{email}>)\r\n }\r\n end", "def contact_us_template\n 'contact_us'\n end" ]
[ "0.7420738", "0.7318224", "0.7236737", "0.72360134", "0.7096663", "0.70165634", "0.68761426", "0.68317133", "0.6831157", "0.67721164", "0.6770582", "0.67114264", "0.67067504", "0.66979164", "0.6675767", "0.66593754", "0.66515046", "0.6641414", "0.6595883", "0.65678054", "0.65301496", "0.6521717", "0.6521717", "0.6521717", "0.6521717", "0.6517469", "0.6497285", "0.64821047", "0.64821047", "0.64821047", "0.64821047", "0.64821047", "0.64821047", "0.64821047", "0.64821047", "0.64801896", "0.64126104", "0.6401224", "0.6401224", "0.6401224", "0.6401224", "0.6401224", "0.6401224", "0.6337485", "0.6332679", "0.6297907", "0.62433505", "0.622951", "0.62216175", "0.61991537", "0.6182783", "0.6174797", "0.61691225", "0.6140229", "0.61388", "0.6134291", "0.61254495", "0.61143553", "0.61043143", "0.61043143", "0.6070261", "0.6065072", "0.60590804", "0.6038383", "0.6012229", "0.59613293", "0.5948423", "0.59365106", "0.5934836", "0.5932393", "0.5904182", "0.58992165", "0.5896369", "0.5887848", "0.58684033", "0.5834194", "0.5805384", "0.57932", "0.57649064", "0.5762824", "0.5755522", "0.5750396", "0.5750149", "0.5749263", "0.5740299", "0.57386124", "0.5724899", "0.5721748", "0.57209784", "0.57150435", "0.5707468", "0.5706391", "0.57018596", "0.56997937", "0.5692965", "0.5692965", "0.5681477", "0.568034", "0.56704366", "0.56652844", "0.5646016" ]
0.0
-1
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model
def cama_external_menu_on_active(plugin) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute()\n\n end", "def execute()\n\n end", "def execute\n ActiveRecord::Base.connection.execute(source)\n end", "def execute()\r\n\tend", "def execute; end", "def execute; end", "def execute\n\n end", "def execute\n end", "def execute\n end", "def execute_sql\n ActiveRecord::Base.connection.execute(@sql)\n end", "def subscribe_sql_active_record; end", "def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end", "def execute\n end", "def execute sql\n db[sql]\n end", "def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end", "def execute\n end", "def execute\n end", "def fire\n PassiveRecord::Adapter.execute to_sql\n end", "def execute!; end", "def perform_query\n Rails.logger.info queries.to_sql\n queries\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def execute(*)\n super\n end", "def base_execute\n execute\n end", "def connection_execute_method\n :query\n end", "def connection_execute_method\n :query\n end", "def execute(sql)\r\n\t\t@connection.Execute(sql)\r\n\tend", "def execute\n super()\n end", "def execute_query(query)\n ActiveRecord::Base.connection.select_all(query)\n end", "def execute_sql\n # add conditions including the cache_ids and retrieve a count and all of the records\n return @model.find(:all,to_active_record)\n end", "def exec(sql)\n Logging.with_logged_query self, sql do\n raw_connection.exec sql\n end\n end", "def do_execute(sql, name = 'SQL')\n log(sql, name) { raw_connection_do(sql) }\n end", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def query\n end", "def query; end", "def execute\n raise \"you need to define #execute\"\n end", "def execute\n Engine.instance.execute([self])[0]\n end", "def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end", "def execute(sql)\n @logger.debug(\"SQL: #{sql}\") if @logger\n retrieve_connection.query(sql)\n end", "def exec_query(sql, name = 'SQL', binds = [])\n if name == :skip_logging\n #execute(sql, name)\n hash_query(sql, name, binds)\n else\n log(sql, name) do\n #execute(sql, name)\n hash_query(sql, name, binds)\n end\n end \n end", "def run_sql(query)\n raw_run_sql(query)\n end", "def check_sql_before_running; tarif_optimizator.check_sql_before_running; end", "def snapshots_redact_sql_queries; end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def subscribe_sql_active_record=(_arg0); end", "def perform!\n super\n\n pipeline = Pipeline.new\n\n pipeline << mysql\n\n pipeline.run\n if pipeline.success?\n log!(:finished)\n else\n raise Error, \"Execution Failed!\\n\" + pipeline.error_messages\n end\n end", "def perform\n # This will allow us to switch backend data structure for\n # searching pretty easily.\n perform_by_mysql\n end", "def query(sql)\n database.execute2(sql)\n end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def orm; end", "def sql\n @context.sql\n end", "def execute_query(query)\n ActiveRecord::Base.connection.execute(query.to_sql)\n end", "def execute(sql)\n @database_handle.execute(sql)\n end", "def sql\n Slacker.sql(self)\n end", "def execute(*args)\n @db.execute(*args)\n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end", "def execute(sql, name = nil) #:nodoc:\n log(sql, name) { @connection.exec sql }\n end", "def all\n\t\tquery.execute\n end", "def cs_starter\n # make_batched_queries\n make_standard_queries\n end", "def execute_statement(sql)\n results = ActiveRecord::Base.connection.execute(sql)\n if results.present?\n return results\n else\n return nil\n end\n end", "def initial_query; end", "def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def _execute(sql, name = nil)\n @connection.execute(sql)\n end", "def run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def exec_query(query, conn = ActiveRecord::Base.connection)\n res = conn.exec_query(query)\n puts res.rows.map { |r| r.map(&:inspect).join(\",\") }.join('\\n')\n res.to_a\nend", "def query\n super\n end", "def execute_sql(my_sql)\n pg_result = ActiveRecord::Base.connection.execute(my_sql)\n\n # In this example we are just calling #to_a to convert the PG::Result to an\n # Array. PG::Result has a nice API for slicing and dicing itself so you may\n # want to to something clever instead. See\n # https://www.rubydoc.info/gems/pg/PG/Result for details.\n #\n # The important bit here is that we are copying all the data we care about\n # out of the PG::Result in preparation for later clearing the PG::Result\n results = pg_result.to_a\n\n # Calling #clear on the PG::Result is the important bit of cleanup and the\n # whole reason this method exists. See\n # https://www.rubydoc.info/gems/pg/PG/Result#clear-instance_method\n pg_result.clear\n\n yield results if block_given?\n\n results\nend", "def execute\n Rails.logger.debug \"Execution not implemented: #{self.class.to_s}\"\n end", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def execute(sql, name = nil, binds = []) #:nodoc:\r\n if name == :skip_logging\r\n query(sql, binds)\r\n else\r\n log(sql, name, binds) { query(sql, binds) }\r\n end\r\n end", "def run_sql(sql_query)\n\tconn = PG.connect(dbname: 'first_crud_app')\n\tresult = conn.exec(sql_query)\n\tconn.close\n\tresult\nend", "def execute()\n filters = prepare_filters\n return_filtered_model(filters)\n end", "def run_sql(sql)\n connection = PG.connect(dbname: \"facebook_lab\", host: \"localhost\")\n result = connection.exec(sql)\n connection.close\n result\nend", "def execute\n raise \"Not Implemented\"\n end", "def run\n basecmd = []\n basecmd << command(:psql)\n basecmd << \"-U\" unless @resource[:role].nil?\n basecmd << \"#{@resource[:role]}\" unless @resource[:role].nil?\n basecmd << \"-d\" unless @resource[:database].nil?\n basecmd << \"#{@resource[:database]}\" unless @resource[:database].nil?\n \n # We execute by default.\n execute = true\n unless @resource[:query].nil?\n cmd = basecmd\n cmd << '-qAtc'\n \n sqlcmd = \"#{@resource[:query]}\"\n \n cmd << sqlcmd\n \n raw, status = Puppet::Util::SUIDManager.run_and_capture(cmd, 'postgres')\n if status == 0\n execute = false # Got an ok result, so we'll evaluate.\n\n if ! @resource[:rows].nil?\n target_rows = Integer(@resource[:rows].gsub(/[^\\d]/,''))\n operand = @resource[:rows].gsub(/[\\d]/,'').chomp.downcase\n returned_rows = (raw.length <= 0 ? 0 : raw.lines.count)\n if operand.match(/lte|less than or equal|<=/)\n execute = true if returned_rows <= target_rows\n elsif operand.match(/gte|greater than or equal|>=/)\n execute = true if returned_rows >= target_rows\n elsif operand.match(/lt|less than|</)\n execute = true if returned_rows < target_rows \n elsif operand.match(/gt|greater than|>/)\n execute = true if returned_rows > target_rows\n else\n execute = true if returned_rows == target_rows\n end\n end\n else\n # We stop an execution if rows or result params are set\n # on the assumption that if you want to evaluate against criteria like those\n # you want to actually do so.\n execute = false if (! @resource[:rows].nil? or ! @resource[:result].nil?)\n end\n end\n \n unless execute == false\n cmd = basecmd\n if ! @resource[:command].nil?\n cmd << '-qAtc'\n \n sqlcmd = \"#{@resource[:command]}\"\n \n cmd << sqlcmd \n elsif ! @resource[:file].nil?\n cmd << '-qAtf'\n \n sqlcmd = \"#{@resource[:file]}\"\n \n cmd << sqlcmd\n else\n # Right now we send a warning. This should still trigger a refresh if you\n # want to use queries to conditionally do things for some insane reason.\n self.warning(\"Nothing to do.\")\n end\n \n raw, status = Puppet::Util::SUIDManager.run_and_capture(cmd, 'postgres')\n if status != 0\n self.fail(\"Error executing SQL - result #{raw}\")\n else\n @ran = true\n end\n else\n self.fail(\"Execution criteria failed. Failing to prevent dependant resources from executing.\")\n end\n end", "def run_sql_script(path, adapter = dss, ctx = {})\n sql = ErbHelper.new.process(path, ctx)\n puts sql\n adapter.run sql\n end", "def index\n @sql_queries = SqlQuery.all\n end", "def execute\n puts DB_MSG\n logger.info(DB_MSG)\n # connect to the database and query on a Site\n CaTissue::Database.current.open { find_in_transit_site }\n end", "def run_query(q)\n return sky_table.query(q)\n end", "def run\n _escaped_sql = escaped_sql\n @query_logger << _escaped_sql if @query_logger\n result = @conn.exec_query _escaped_sql\n row_class = OccamsRecord::Results.klass(result.columns, result.column_types, @eager_loaders.names, model: @eager_loaders.model, modules: @use)\n rows = result.rows.map { |row| row_class.new row }\n @eager_loaders.run!(rows, query_logger: @query_logger)\n rows\n end", "def execute(cmd)\n RawDB.execute(db, cmd)\n end", "def execute(sql, name = nil)\n # lol no, won't hit connection pool just for this one\n #\n # if @connection\n # # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been\n # # made since we established the connection\n # @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone\n # end\n\n log(sql, name) { @connection.query(sql) }\n end", "def execute(sql, opts={}, &block)\n super(@sproc_name, {:args=>@sproc_args, :sproc=>true}.merge(opts), &block)\n end", "def execute\n raise NotImplementedError\n end", "def execute(sql)\n log_info(sql)\n @pool.hold {|c| c.immediate(sql)}\n end", "def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end", "def execute\n raise NotImplementedError\n end", "def execute(query, name = 'ANSR-NOSQL')\n end", "def execute_query\n query_parameters = self.query_parameters\n query_parameters.delete(:redirect_controller)\n query_parameters.delete(:redirect_action)\n query_parameters.delete(:saved_search_id)\n #sql = \"#{query_parameters}\"\n sql = String.new\n query_parameters.each do |key,val|\n if val.class == TrueClass || val.class == FalseClass\n sql << \"#{key} == #{val} and \"\n else\n sql << \"#{key} like '#{val}' and \"\n end\n end\n sql = sql.slice(0, sql.length-4)\n self.last_query = sql\n self.save\n eval(self.model_name).where(sql)\n end", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def execute(sql, name = nil, skip_logging = false)\n translate(sql) do |sql, args|\n if (name == :skip_logging) or skip_logging\n @connection.execute(sql, *args)\n else\n log(sql, args, name) do\n @connection.execute(sql, *args)\n end\n end\n end\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend", "def set_my_sql\n @my_sql = MySql.find(params[:id])\n end", "def execute(&block)\n define_method(:execute, &block)\n end", "def exec; end", "def exec; end", "def execute(sql, name = nil)\n # check for some DDL and DML statements\n puts \"Running sql? #{RUN_SQL}\"\n\n if /(create |alter |drop |insert |delete |update )/i.match sql.squish\n File.open(SQL_FILENAME, 'a') { |f| f.puts \"#{sql};\\n\" }\n puts \"Rails.env: #{Rails.env} - #{ENV['FPHS_POSTGRESQL_SCHEMA']}\"\n old_execute sql, name if RUN_SQL\n else\n # pass everything else to the aliased execute\n puts \"------------- (#{name}) ---------------\"\n puts sql || ''\n puts \"------------- ---------------\"\n old_execute sql, name if RUN_SQL\n end\n end", "def index\n @my_sqls = MySql.all\n end" ]
[ "0.70241666", "0.70241666", "0.700345", "0.69346076", "0.6863836", "0.6863836", "0.68599904", "0.6821906", "0.6821906", "0.67889315", "0.6739621", "0.67228895", "0.66985303", "0.66153866", "0.6525782", "0.6518682", "0.6518682", "0.6475485", "0.6459327", "0.64522785", "0.6431356", "0.64056885", "0.6401665", "0.6395781", "0.6395781", "0.6378799", "0.63720036", "0.63297343", "0.63156945", "0.62843144", "0.6282106", "0.62060195", "0.62051475", "0.6190938", "0.61733353", "0.61597127", "0.61556774", "0.6125395", "0.6103598", "0.60956466", "0.60934645", "0.60924697", "0.60606796", "0.60518557", "0.60478264", "0.60269743", "0.60193586", "0.60125625", "0.600985", "0.59779763", "0.5963493", "0.59612566", "0.5959199", "0.59481066", "0.5918608", "0.5906817", "0.59022325", "0.5878314", "0.58524233", "0.585124", "0.5845324", "0.58443445", "0.5834356", "0.58277863", "0.58013964", "0.57975036", "0.57833457", "0.577996", "0.5772576", "0.57659036", "0.5763043", "0.57320094", "0.57306236", "0.5729773", "0.57268566", "0.5724796", "0.57236207", "0.57185346", "0.5681295", "0.568021", "0.5680168", "0.566904", "0.5664828", "0.5664713", "0.56562394", "0.56497705", "0.5649274", "0.5643058", "0.56335276", "0.56327546", "0.5630659", "0.5625152", "0.5624253", "0.5624132", "0.56173015", "0.56130487", "0.56122625", "0.56107116", "0.56107116", "0.56097466", "0.55957615" ]
0.0
-1
here all actions on going to inactive plugin: plugin model
def cama_external_menu_on_inactive(plugin) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gallery_on_inactive(plugin)\n end", "def camaleon_spree_on_inactive(plugin)\n end", "def plugin\n\t\t\t\t\tPlugin.where(:id => Item.first.attributes[\"plugin_id\"])\n\t\t\t\tend", "def contact_form_on_inactive(plugin)\n\n end", "def plugin_manager; end", "def set_plugin\n @plugin = Plugin.find_by(:id => params[:id], :user_id => current_user.id)\n end", "def inactive\n end", "def camaleon_category_order_on_inactive(plugin)\n end", "def cama_external_menu_on_active(plugin)\n end", "def plugins; end", "def plugins; end", "def plugins; end", "def plugins; end", "def camaleon_mailchimp_on_inactive(plugin)\n end", "def plugins ; @plugins ; end", "def set_plugin\n @plugin = Plugin.find(params[:id])\n end", "def camaleon_pagenotfound_on_inactive(plugin)\n end", "def plugin_id; end", "def cama_language_editor_on_inactive(plugin)\n end", "def stop_plugin\n @active = false\n end", "def cama_meta_tag_on_inactive(plugin)\n end", "def active; end", "def active; end", "def index\n @plugins = Plugin.all\n end", "def prepare_plugins\n\t\t# this gets the tabs available\n\t\t@tabs = Tab.all\n\tend", "def deactivate; end", "def action_hook; end", "def contact_form_on_active(plugin)\n\n end", "def after_save() \n if (self.placeholder_plugin_id == nil) then \n p = Plugin.new(:content_provider => self, \n :name => \"#{self.plugin_prefix}.NONE\")\n p.save!\n self.placeholder_plugin_id = p.id;\n self.save!\n end \n end", "def after_initialize(plugins); end", "def start_plugin\n @active = true\n end", "def action_enable\n end", "def index\n @plugins = current_user.plugins.all\n\n end", "def _activate\n\t\t\tend", "def set_plugin\n @plugin = Plugin.find(params[:id])\n end", "def set_plugin\n @plugin = Plugin.find(params[:id])\n end", "def camaleon_pagenotfound_on_active(plugin)\n end", "def _deactivate\n\t\t\tend", "def activate; end", "def deactivate()\n end", "def deactivate\n \n end", "def plugins=(_arg0); end", "def actions; end", "def all_plugins; end", "def after_deactivate\n end", "def camaleon_post_created_at_on_inactive(plugin)\n end", "def plugin_manager=(_arg0); end", "def plugins(ordered = true, state = 'all')\n opts = ordered ? {:order => :name } : {}; \\\n conds = { :content_provider_id => id }\n if (state == 'active') then \n conds = conds.merge( :retired => false )\n elsif (state == 'retired') then \n conds = conds.merge( :retired => true )\n end\n Plugin.find(:all, opts.merge( :conditions => conds))\n end", "def camaleon_post_clone_on_inactive(plugin)\n plugin.get_field_groups().destroy_all\n end", "def create\n @pluginmanage = Pluginmag.new(:player_id=>session[:player_id],:plugin_id=>params[:pluginmanage][:plugin_id])\n respond_to do |format|\n if @pluginmanage.save\n\t\t\t\tsession[:plugin_ids]=Player.find(session[:player_id]).plugin_ids\n flash[:notice] = '游戏添加成功。'\n format.html { redirect_to(pluginmanages_url) }\n else\n format.html { redirect_to(pluginmanages_url)}\n end\n end\n end", "def plugin_setup!; end", "def active?; end", "def plugin(ref)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tend", "def blog_on_inactive(plugin)\r\n current_site.post_types.hidden_menu.where(slug: 'blog').first.destroy\r\n end", "def inactivate!\n self.metadata[:inactive] = true\n self.metadata.save\n end", "def get_plugins()\n return plugins\nend", "def activate!\n self.metadata[:inactive] = nil\n self.metadata.save\n end", "def load_plugins; end", "def createPlugin()\n SwivelButton.init()\nend", "def plugin_hash; end", "def camaleon_post_clone_on_upgrade(plugin)\n end", "def camaleon_category_order_on_active(plugin)\n end", "def action_disable\n super\n end", "def activate()\n end", "def index\n @plugins = Plugin.all\n @pluins\n end", "def plugins\n @plugins = @archive.plugins(true, @state); \n respond_to do |format|\n format.html { @plugins }\n end\n end", "def plugin?(ref)\n\t\t\t\t\t\n\t\t\t\tend", "def prepare\n Maadi::post_message(:More, \"Model (#{@type}) is ready\")\n\n super\n end", "def index\n @title=\"游戏世界\"\n @subtitle=\"游戏管理\"\n @pluginmanages = current_player.plugins\n end", "def blog_on_upgrade(plugin)\r\n end", "def plugins\n @plugins = @content_provider.plugins(true, @state).select { |p| !p.placeholder?() }\n respond_to do |format|\n format.html { @plugins }\n format.xml { render :xml => @content_provider }\n end\n end", "def plugin\n server.plugin(plugin_id)\n end", "def manage\n\n end", "def skip_actions; end", "def run_actions; end", "def inactivate_stop\n self.is_active = false\n self.send(:update_without_callbacks)\n end", "def plugin_info(plugin_info_class)\n @plugin_info ||= plugin_info_class.new do\n # Make the engine's controller accessible at /hardware\n add_route(\"hardware\", ConcertoHardware::Engine)\n\n # Initialize configuration settings with a description and a default.\n # Administrators can change the value through the Concerto dashboard.\n add_config(\"poll_interval\", \"60\", \n :value_type => \"integer\",\n :category => \"System\",\n :seq_no => 999,\n :description => \"Client hardware polling interval in seconds\")\n\n # Some code to run at app boot (example)\n # init do\n # Rails.logger.info \"ConcertoHardware: Initialization code is running\"\n # end\n\n # The following hooks allow integration into the main Concerto app\n # at the controller and view levels.\n\n add_header_tags do\n javascript_include_tag \"concerto_hardware/application\"\n end\n\n add_controller_hook \"ScreensController\", :show, :before do\n @player = Player.find_by_screen_id(@screen.id)\n end\n\n add_controller_hook \"ScreensController\", :change, :before do\n Rails.logger.info \"concerto-hardware: screen change callback\"\n if @screen.auth_in_progress? # have a temp token to look at\n if Player.where(:screen_id => @screen.id).count == 0 # No existing player\n if ((@screen.temp_token.length > Screen::TEMP_TOKEN_LENGTH) and\n (@screen.temp_token[Screen::TEMP_TOKEN_LENGTH].downcase == \"s\"))\n # Okay, we have a legit player situation.\n Rails.logger.info \"concerto-hardware: creating Player for the new Screen!\"\n flash[:notice] ||= \"\"\n player = Player.new\n player.screen_id = @screen.id\n player.activated = true\n if player.save\n Rails.logger.info \" Success!\"\n #flash[:notice] << \" A player hardware profile was automatically created!\"\n # TODO: User notification.\n else\n Rails.logger.info \" Failed.\"\n #flash[:notice] << \" We could not create a player hardware profile, however.\"\n end\n end\n end\n end\n end\n\n add_view_hook \"ScreensController\", :screen_details, :partial => \"concerto_hardware/screens/screen_link\"\n\n add_view_hook \"ScreensController\", :screen_statistics, :partial => \"concerto_hardware/screens/player_stats\"\n end\n end", "def add_actions; end", "def ms_update\n\t\t\t\t\twhere(:plugin_id => 12028).joins(:host)\n\t\t\t\tend", "def remove(plugin); end", "def enable\n end", "def cama_language_editor_on_active(plugin)\n end", "def plugin_params\n params.require(:plugin).permit(:name, :description, :is_active, :version, :parent_id, :url, :if_can, :order, :icon)\n end", "def recover_plugin(plugin)\n plugin.each do |plug|\n p = Plugin.new(name:plug.name, checks_id: plug.checks_id)\n\n logger.info(\"p :#{p}\")\n begin \n p.save\n rescue => e\n logger.error(\"recover plugin error, #{e}\")\n return\n end\n end\n end", "def update\n respond_to do |format|\n if @plugin.update_attributes(params[:plugin])\n flash[:notice] = 'Plugin was successfully updated.'\n format.html { redirect_to(@plugin) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plugin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_plugin\n\n\t\t\t\tplugin = Plugin.find_by_id(@info[:plugin_id])\n\n\t\t\t\tif plugin == nil\n\t\t\t\t\tplugin = Plugin.new\n\t\t\t\tend\n\n\t\t\t\t# Populate items from post process module\n\t\t\t\tplugin.id = @info[:plugin_id]\n\t\t\t\tplugin.plugin_name = @info[:plugin_name]\n\t\t\t\tplugin.description = @info[:description]\n\t\t\t\tplugin.plugin_version = @info[:version]\n\t\t\t\tplugin.plugin_publication_date = @info[:publication_date]\n\t\t\t\tplugin.plugin_modification_date = @info[:modification_date]\n\n\t\t\t\t# Boiler plate for all roll up plugins\n\t\t\t\tplugin.family_name = \"Risu Rollup Plugins\"\n\t\t\t\tplugin.synopsis = \"Software often has vulnerabilities that are corrected in newer versions. It was determined that an older version of the software is installed on this system.\"\n\t\t\t\tplugin.solution = \"If possible, update to the latest version of the software.\"\n\t\t\t\tplugin.plugin_type = \"Rollup\"\n\t\t\t\tplugin.rollup = true\n\t\t\t\tplugin.compliance = false\n\n\t\t\t\t# Find oldest vuln date.\n\t\t\t\tbegin\n\t\t\t\t\tp = Plugin.where(:id => @info[:plugin_ids]).where.not(:vuln_publication_date => nil).order(:vuln_publication_date).first\n\t\t\t\t\tunless p.nil?\n\t\t\t\t\t\tplugin.vuln_publication_date = p.vuln_publication_date\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tp = Plugin.where(:id => @info[:plugin_ids]).where.not(:cvss_base_score => nil).order(:cvss_base_score).last\n\t\t\t\t\tunless p.nil?\n\t\t\t\t\t\tplugin.cvss_base_score = p.cvss_base_score\n\t\t\t\t\t\tplugin.cvss_vector = p.cvss_vector\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tp = Plugin.where(:id => @info[:plugin_ids]).where.not(:cvss_temporal_score => nil).order(:cvss_temporal_score).last\n\t\t\t\t\tunless p.nil?\n\t\t\t\t\t\tplugin.cvss_temporal_score = p.cvss_temporal_score\n\t\t\t\t\t\tplugin.cvss_temporal_vector = p.cvss_temporal_vector\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_available => true).count > 0\n\t\t\t\t\tplugin.exploit_available = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_framework_core => \"true\").count > 0\n\t\t\t\t\tplugin.exploit_framework_core = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_framework_metasploit => \"true\").count > 0\n\t\t\t\t\tplugin.exploit_framework_metasploit = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_framework_canvas => \"true\").count > 0\n\t\t\t\t\tplugin.exploit_framework_canvas = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_framework_exploithub => \"true\").count > 0\n\t\t\t\t\tplugin.exploit_framework_exploithub = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploit_framework_d2_elliot => \"true\").count > 0\n\t\t\t\t\tplugin.exploit_framework_d2_elliot = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :in_the_news => true).count > 0\n\t\t\t\t\tplugin.in_the_news = true\n\t\t\t\tend\n\n\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :exploited_by_malware => \"true\").count > 0\n\t\t\t\t\tplugin.exploited_by_malware = true\n\t\t\t\tend\n\n\t\t\t\t[\"Critical\", \"High\", \"Medium\", \"Low\", \"Info\"].each do |risk|\n\t\t\t\t\tif Plugin.where(:id => @info[:plugin_ids], :risk_factor => risk).size > 0\n\t\t\t\t\t\tplugin.risk_factor = risk\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tp = Plugin.where(:id => @info[:plugin_ids]).where.not(:stig_severity => nil).order(:stig_severity).first\n\t\t\t\t\tunless p.nil?\n\t\t\t\t\t\tplugin.stig_severity = p.stig_severity\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Broken\n\t\t\t\t#plugin.references << References.where(:plugin_id => @info[:plugin_ids], :reference_name => \"cve\")\n\n\t\t\t\tplugin.save\n\t\t\tend", "def after_created\n Array(action).each do |act|\n case act\n when :enable\n enable_plugin_shim!\n when :disable\n disable_plugin_shim!\n end\n end\n end", "def admin_logic\n end", "def camaleon_image_optimizer_on_inactive(plugin)\n end", "def action_run\n end", "def update!(**args)\n @plugin_instance = args[:plugin_instance] if args.key?(:plugin_instance)\n end", "def activate_stop\n self.is_active = true\n self.send(:update_without_callbacks)\n end", "def gallery_on_upgrade(plugin)\n end", "def new\n @title=\"游戏世界\"\n @subtitle=\"添加游戏\"\n @plugins = Plugin.find(:all,:conditions => \"root=0\")\n @pluginmanage=Pluginmag.new\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pluginmanage }\n end\n end", "def enable\n end", "def inactivate!(reason = nil)\n end", "def gallery_on_active(plugin)\n generate_custom_field_gallery\n end", "def camaleon_post_clone_on_active(plugin)\n options = [{\"title\"=>\"Enable?\", \"value\"=>\"1\", \"default\"=>\"1\"}]\n group = plugin.add_custom_field_group({name: \"#{t('plugin.post_clone.post_clone_configuration')}\", slug: \"plugin_clone_custom_settings\", description: \"\"})\n group.add_manual_field({\"name\"=>\"#{t('plugin.post_clone.clone_custom_fields')}\", \"slug\"=>\"plugin_clone_custom_fields\", \"description\"=>\"#{t('plugin.post_clone.clone_custom_field_values')}\"},\n {field_key: \"checkboxes\", multiple: false, required: false, multiple_options: options})\n group.add_manual_field({\"name\"=>\"#{t('plugin.post_clone.saved_pending')}\", \"slug\"=>\"plugin_clone_save_as_pending\", \"description\"=>\"#{t('plugin.post_clone.want_save_pending')}\"},\n {field_key: \"checkboxes\", multiple: false, required: false, multiple_options: [{\"title\"=>\"#{t('plugin.post_clone.enable')}\", \"value\"=>\"1\", \"default\"=>\"0\"}]})\n end", "def all_plugin_hook_configs; end", "def activate!\n self.active = true\n save\n end" ]
[ "0.6669169", "0.6559678", "0.6381096", "0.6271562", "0.61708516", "0.60598594", "0.60571194", "0.60280657", "0.59986067", "0.59957856", "0.59957856", "0.59957856", "0.59957856", "0.59669757", "0.59572273", "0.592916", "0.59050167", "0.58284307", "0.5826014", "0.5793883", "0.57750374", "0.57550687", "0.57550687", "0.57231545", "0.5722204", "0.57142586", "0.57105076", "0.56835073", "0.5664261", "0.56640995", "0.5655676", "0.5647767", "0.5641423", "0.56395406", "0.5631127", "0.5631127", "0.5602974", "0.55726224", "0.55527556", "0.55366105", "0.5525896", "0.5503399", "0.5500435", "0.54986084", "0.54897314", "0.5482445", "0.54702365", "0.5467175", "0.5465456", "0.5457314", "0.5454847", "0.54472995", "0.54469025", "0.54467696", "0.54464996", "0.5441049", "0.54393935", "0.5430932", "0.5424461", "0.5416383", "0.54107076", "0.5382721", "0.53787297", "0.5367037", "0.5365378", "0.536025", "0.53517157", "0.5351591", "0.53510106", "0.5343387", "0.5330897", "0.5313763", "0.53136665", "0.53106934", "0.5308556", "0.53026336", "0.52985114", "0.52843606", "0.5279884", "0.5278299", "0.5262404", "0.52131975", "0.520481", "0.52032495", "0.519378", "0.51935416", "0.5183", "0.51804453", "0.51774895", "0.5160153", "0.51587653", "0.51575154", "0.51568687", "0.5156514", "0.5139153", "0.51389676", "0.5108977", "0.5100684", "0.50945085", "0.5093401" ]
0.65550953
2
removed authentication; don't need it for public repositories
def send_request(uri, params, user, password) request = Net::HTTP::Get.new(uri) request.basic_auth(user, password) req_options = { use_ssl: uri.scheme == "https", } params.each_pair do |key, val| request[key] = val end response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(request) end return JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_auth?; end", "def repo; end", "def repo; end", "def repo; end", "def repo; end", "def skip_authorization; end", "def project_unauthorized_proc\n # no-op\n end", "def repository; end", "def auth\n end", "def auth\n end", "def host_authorization; end", "def host_authorization; end", "def auth_store; end", "def auth_param; end", "def http_auth_login\n # FIXME: Implement\n end", "def base_credential; end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def authentication\n auth = \"\"\n auth << \"--username #{variable(:scm_username)} \" if variable(:scm_username)\n auth << \"--password #{variable(:scm_password)} \" if variable(:scm_password)\n auth << \"--no-auth-cache\" if !auth.empty?\n auth\n end", "def auth\n {}\n end", "def http_auth_hash; end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def use_oauth\n\t\t\t\n\t\tend", "def initialize(user = nil, api_token = nil, repo_name = \"cookie_monster\") \n if user.nil?\n puts \"No user provided, getting from git config\"\n user = `git config --get github.user`.chomp\n end\n\n if api_token.nil?\n puts \"No API token provided, getting from git config\"\n api_token = `git config --get github.token`.chomp\n end\n\n\n @user = user.chomp # chomp in case user passes in bad data\n @api_token = api_token.chomp # chomp in case user passes in bad data\n @repo_name = repo_name\n\n # Authenticated client\n #@client = Octopussy::Client.new({:login => @user, :token => @api_token})\n\n # Location of local git repository. Necessary for pushing to Github.\n # Put it in .cloud_path so it doesn't conflict with anything\n @git_dir_path = File.expand_path(\"~/.cloud_path/\" + @repo_name)\n\n create_repo\n create_git_dir\n \n # For whatever reason, Repository.find raises Octopi::NotFound when\n # we've just created the repository in this run of the script.\n # Possibly a caching error.\n begin\n repo = Repository.find(:user => @user, :repo => @repo_name)\n rescue Octopi::NotFound\n puts \"Repository not found. Probably just created repository, please\"\n puts \"run this script again.\"\n exit 0\n end\n end", "def login_as_archivist( create_new = false )\n if !$test_repo\n ($test_repo, $test_repo_uri) = create_test_repo(\"repo_#{SecureRandom.hex}\", \"description\")\n end\n\n if !$archivist_user or create_new\n ($archivist_user, $archivist_pass) = create_user\n add_user_to_archivists($archivist_user, $test_repo_uri)\n end\n\n\n login($archivist_user, $archivist_pass)\n\n select_repo($test_repo)\nend", "def authenticate!\n # Do nothing yet\n end", "def credential; end", "def credential; end", "def host_authorization=(_arg0); end", "def host_authorization=(_arg0); end", "def unauthenticated\n end", "def authenticate_with_http_basic\n nil\n end", "def require_no_authentication\n end", "def authorization; end", "def clean_keys\n self.repo_private_key = clean_key(repo_private_key)\n end", "def repo_url_with_auth\n auth = \"gitlab-ci-token:#{token}@\"\n http_url_to_repo.sub(/^https?:\\/\\//) do |prefix|\n prefix + auth\n end\n end", "def web\n _auth(false)\n end", "def unauthorized\n end", "def authentication\n raise NotImplementedError\n end", "def configure_github_access\n settings = ::GitReview::Settings.instance\n if settings.oauth_token && settings.username\n @github = Octokit::Client.new(\n :login => settings.username,\n :access_token => settings.oauth_token,\n :auto_traversal => true\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def auth_scheme; end", "def unauthorized\n client_id = ENV['GITHUB_CLIENT_ID']\n redirect_uri = ENV['GITHUB_REDIRECT']\n base = \"https://github.com/login/oauth/authorize\"\n href = \"#{base}?client_id=#{client_id}&redirect_uri=#{redirect_uri}\" \n res = {href: href} \n {statusCode: 403, headers: headers, body: res.to_json}\nend", "def current_user_repository_access?\n client = Octokit::Client.new(access_token: @current_user.github_token)\n client.repository?(\"#{@project.github_owner}/#{@project.github_name}\")\n end", "def http_auth_header?; end", "def authentication_method\n super\n end", "def auth(value); end", "def require_no_authentication\n # skip this!\n end", "def ghAuthenticate (username, password)\n\t\t# puts \"Enter GitHub Username:\"\n\t\t# username = \"\"\n\t\t# puts \"Enter GitHub Password:\"\n\t\t# password = \"\"\n\t\t# Octokit.auto_paginate = true\n\t\t@ghClient = Octokit::Client.new(:login => username.to_s, :password => password.to_s, :per_page =>100)\n\tend", "def repo_root; end", "def authenticate!\n redirect \"https://github.com/login/oauth/authorize?scope=user:email,read:org&client_id=#{CLIENT_ID}\"\nend", "def remote_repository\n \"http://www.aQute.biz/repo\"\n end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def can_access_git?\n true\n end", "def authentication\n username = config[:svn_username]\n return \"\" unless username\n result = \"--username #{config[:svn_username]} \"\n result << \"--password #{config[:svn_password]} \"\n result\n end", "def capable_plain_auth?; end", "def initialize\n super(\"ssh-userauth\")\n end", "def initialize_auth\n @conf[:use_user_pool_cache] = false\n end", "def private_gem(name)\n gem name, '0.3.0', git: \"https://#{ENV['GITHUB_TOKEN']}:x-oauth-basic@github.com/mharris717/#{name}.git\", branch: :master\nend", "def remove_auth(uri, realm = T.unsafe(nil)); end", "def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end", "def oauth_authentication; end", "def auth_methods; end", "def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n :login => Settings.instance.username,\n :oauth_token => Settings.instance.oauth_token\n )\n @github.login\n else\n configure_oauth\n configure_github_access\n end\n end", "def auth() @auth ||= Flickr::Auth.new(self) end", "def needs_login?() false end", "def mock_defective_auth_hash\n nil\n end", "def basic_auth(opts); end", "def authorize(auth = {})\n @authentication ||= TaskMapper::Authenticator.new(auth)\n auth = @authentication\n login = auth.login || auth.username\n if auth.login.blank? and auth.username.blank?\n raise TaskMapper::Exception.new('Please provide at least a username')\n elsif auth.token\n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = auth.token\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :token => auth.token)\n elsif auth.password\n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = auth.token\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :password => auth.password)\n else \n TaskMapper::Provider::Github.login = login\n TaskMapper::Provider::Github.user_token = nil\n TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login)\n end\n end", "def git_init\n git.config('user.name', ENV['MACHINE_USER_NAME'])\n git.config('user.email', ENV['MACHINE_USER_EMAIL'])\n end", "def capable_login_auth?; end", "def repository\n @repository ||= Github::Repository.find user: user, name: name\n end", "def set_repo_cred\n @repo = Repo.find(params[:repo_id])\n @repo_cred = @repo.repo_creds.find(params[:id])\n end", "def using_authenticated_proxy?; end", "def valid_for_http_auth?; end", "def authenticate_request\n @current_user = nil\n end", "def auth_bypass\r\n username = datastore['HttpUsername'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n password = datastore['HttpPassword'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n @auth = basic_auth(username, password)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_users/org.couchdb.user:#{username}\"),\r\n 'method' => 'PUT',\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"type\": \"user\",\"name\": \"#{username}\",\"roles\": [\"_admin\"],\"roles\": [],\"password\": \"#{password}\"})\r\n )\r\n\r\n if res && (res.code == 200 || res.code == 201) && res.get_json_document['ok']\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def credential_source\n super\n end", "def github(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end", "def org_member?(client)\n begin\n client.user # Authenticate User.\n if client.org_member?(GITHUB_ORG, client.user.login)\n return true\n else\n return false\n end\n rescue Octokit::OneTimePasswordRequired => e\n GitLfsS3::Application.settings.logger.warn\\\n 'Octokit::OneTimePasswordRequired exception raised for username #{client.user.login}. '\\\n 'Please use a personal access token.'\n return false\n rescue Octokit::Unauthorized\n return false\n end\nend", "def authenticated?; super; end", "def credential=(_arg0); end", "def credential=(_arg0); end", "def set_public(repo, options = {})\n # GitHub Api for setting private updated to use private attr, rather than public\n update_repository repo, options.merge({ :private => false })\n end", "def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end", "def authentication_hash=(_arg0); end", "def authorize\n super(:projects, projects_url)\n end", "def skip_authentication?\n true\n end", "def remote_repository\n url = \"#{configuration[:user]}@#{configuration[:domain]}:\"\n @remote_repository ||= if configuration[:repository].include?(url)\n tmp = configuration[:repository].sub(url, \"file://\")\n if tmp.include?(\"~\")\n tmp.sub!(\"~\", \"/home/#{configuration[:user]}\")\n end\n tmp\n else\n configuration[:repository]\n end\n @remote_repository\n end", "def add_default_auth(user, password, domain = T.unsafe(nil)); end", "def authenticate\n end", "def update_from_github(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.name if auth.info.name\n cv['image'] = auth.info.image if auth.info.image\n cv['biography'] = auth.extra.raw_info.bio if auth.extra.raw_info.bio\n token = auth.credentials.token if auth.credentials.token\n tmp = Array.new\n\n uri = URI(auth.extra.raw_info.repos_url)\n\n #repos = JSON.parse(open(uri.to_s, 'Authentication' => \"token #{token}\").read)\n\n HTTP.auth(\"token #{token}\")\n repos = JSON.parse(HTTP.get(uri.to_s).body)\n\n repos.each do |gitPr|\n if not gitPr['fork']\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n end\n $uriTmp = auth.extra.raw_info.starred_url.to_s\n $realUri = $uriTmp.gsub(/{(.*?)}/,'')\n\n starred = JSON.parse(HTTP.get($realUri).body)\n starred.each do |gitPr|\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n cv['it_languages'] = tmp.uniq\n cv['github_auth'] = true\n end" ]
[ "0.6540841", "0.6418639", "0.6418639", "0.6418639", "0.6418639", "0.6410345", "0.63189554", "0.62235415", "0.62200016", "0.62200016", "0.6134423", "0.6134423", "0.6072045", "0.60674673", "0.6064831", "0.6039415", "0.60346127", "0.60346127", "0.60346127", "0.60346127", "0.60346127", "0.60175806", "0.5983999", "0.5979207", "0.5976737", "0.5976737", "0.5976737", "0.5976737", "0.59677523", "0.58979625", "0.5895164", "0.58873856", "0.5854859", "0.5854859", "0.584379", "0.584379", "0.58370954", "0.58203036", "0.57915103", "0.57855856", "0.5769492", "0.57608527", "0.57570505", "0.5742064", "0.5741118", "0.57163084", "0.57037085", "0.5686918", "0.5683368", "0.5674597", "0.5671301", "0.5659965", "0.5656757", "0.5652305", "0.56280476", "0.5625357", "0.56163996", "0.56136256", "0.56136256", "0.56136256", "0.56136256", "0.56136256", "0.5610831", "0.56061995", "0.5601937", "0.55969673", "0.5596591", "0.559372", "0.5586451", "0.5585779", "0.5575809", "0.55735695", "0.5569821", "0.55537355", "0.55495036", "0.55469424", "0.5541412", "0.5535213", "0.5514499", "0.55129033", "0.5512471", "0.55098957", "0.5506355", "0.5502141", "0.5492931", "0.549268", "0.54864496", "0.54848295", "0.5480074", "0.5476642", "0.547604", "0.547604", "0.5474464", "0.5466174", "0.5465416", "0.54648244", "0.54627806", "0.54504687", "0.5449065", "0.5444194", "0.54369193" ]
0.0
-1
2.Get all windmill id for a given wind Form.
def getmill formid = Windmill.where(windformid: params[:id]) if formid.present? render json: formid.as_json(only:[:no]) else render json: {massage: 'Windform not found'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getform\n\tgetform = Windmill.where(no: params[:no])\n\tif getform.present?\n render json: getform.as_json(only: [:windformid])\n\telse\n\t\trender json: {massage: 'No windfrom available in this id'}\n\tend\nend", "def form_ids\n forms.collect{|f| f.id}.sort\n end", "def form_ids\n forms.collect(&:id).sort\n end", "def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "def getmill\n\t\n \tformid = Userdet.where(usid: params[:userid]).all\n \t\nif formid.present?\n\t\t\n render json: formid.as_json(only: [:windmill])\nelse\nrender json: [{message: 'not found'}]\nend\nend", "def all_ids\n json = JSON.parse(http_client.get(\"mobiledevices\"))\n json[\"mobile_devices\"].map { |c| c[\"id\"] }\n end", "def ffcrm_list_ids\n config.mailchimp_list_fields.map{ |f| f.settings['list_id'] }\n end", "def admids_for id\n @admid_map[id]\n end", "def form_elements(identifier)\n platform.forms_for(identifier.clone)\n end", "def getMissionIds\n now = Time.zone.now #time in UTC 00\n missionsArray = Mission.where \"start < ? AND ? < end\", now, now\n return missionsArray.map { |m| m.id.to_s}\n end", "def html_form_id\n \"#{@form.name}:#{@screen.name}:#{@name}\"\n end", "def field_ids\n @fields.keys\n end", "def extract_ids\n # no-op\n end", "def get_form_start_id(form_name)\n get_form(form_name)[:start_id]\n end", "def ministry_list\n root_ministry.descendants.pluck(:id)\n end", "def identifiers\n request[:ids]\n end", "def get_ids_for_query\n if param.field.options[:definition]\n definition = param.field.options[:definition]\n else\n # Set up a definition\n definition = Definition.new\n definition.base = param.field.options[:base].is_a?(Proc) ? param.field.options[:base].call : param.field.options[:base]\n\n # Get the fields which we should search for\n fields = @field.is_a?(Array) ? @field : [@field]\n fields.each do |field|\n definition.fields << DefinitionField.new(field, :condition => Local, :value_transmogrification => param.field.options[:value_transmogrification])\n end\n end\n\n # Set up a query\n query = Query.new(definition)\n\n # Add all the fields\n query.group(:any) do |params|\n fields.each do |field|\n params << query.param(field, @operator, @value)\n end\n end\n\n ids = query.results.pluck(param.field.options[:foreign_key])\n\n if @operator == :blank\n all_ids = param.query.definition.base.pluck(:id)\n present_ids = definition.base.pluck(param.field.options[:foreign_key])\n ids = (all_ids - present_ids) + ids\n end\n\n ids\n\n end", "def dids\r\n DidsController.instance\r\n end", "def get_form_id(object)\n MyAdmin.get_form_id(object)\n end", "def wp_parse_id_list(list)\n list = wp_parse_list list\n list.map{|i| i.to_i.abs}.uniq\n end", "def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end", "def get_object_contents_ids params\n sequel_db = get_db params[:database]\n sequel_db.transaction do\n sequel_db[:objects].where(:location_object_id => params[:persistence_id]).select_map(:id)\n end\n end", "def datastore_ids\n array = Array.new\n\n self.each(\"DATASTORES/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def form_id\n page.execute_script 'return window.Dashboard.router.pageView.formId'\n end", "def get_forms(id)\n id = get_id(id) if id.is_a?(Symbol)\n return @data[id] || @data.first\n end", "def getPlayerIds\n @socket.request 'world.getPlayerIds()'\n end", "def non_autocomplete_fields\n\t\t\t\t[\"ID\"]\n\t\t\tend", "def id(index)\n i = get_field_index_by_external_id(index,@fields[:id])\n fields(index, i).to_i unless i.nil?\n end", "def id(index)\n i = get_field_index_by_external_id(index,@fields[:id])\n fields(index, i).to_i unless i.nil?\n end", "def object_ids\n #FIXME\n base = @datapath\n Dir.glob(\"#{base}/[0-9][0-9]/[0-9][0-9]/[0-9][0-9]/[0-9][0-9]\").map do |dir|\n dir[base.length..-1].delete('/').to_i\n end\n end", "def list_ids\n @documents.keys\n end", "def get_ids(cw_id, mention_in=nil)\n token = self.company.setting_chats.find_by(chat_id: Chat.find_by(name: \"Chatwork\").id).token\n return response_failure unless token.present?\n mention_in ? room_id = mention_in : room_id = self.mention_in\n begin\n res = open(\"https://api.chatwork.com/v2/rooms/#{room_id}/members\",\n \"X-ChatWorkToken\" => token)\n code, message = res.status\n\n return response_failure unless code == '200'\n results = ActiveSupport::JSON.decode res.read\n response = { 'ok': false }\n results.each do |result|\n if result[\"chatwork_id\"] == cw_id || result[\"account_id\"] == cw_id.to_i\n response[:ok] = true\n response[:cw_id] = result['chatwork_id']\n response[:cw_account_id] = result['account_id']\n break\n end\n end\n response[:ok] ? response : response_failure\n rescue => e\n logger.error(e)\n return response_failure\n end\n end", "def work_entry_other_ids(field)\n case field.tag\n when /(760|762|765|767|770|772|773|774|775|777|780|785|786|787)/\n field.subfields.select { |sf| work_entry_other_id_subfields(field).include?(sf.code) }\n .map { |sf| remove_parenthetical_id_prefix_from_sf_w(sf) }\n end\n end", "def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end", "def admin_ids\n ids = self.retrieve_elements(\"ADMINS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end", "def absolute_form_id(form_id)\n \"#{@master_ids.key?(form_id[0..1]) ? @master_ids[form_id[0..1]] : \"!!!#{form_id[0..1]}\"}/#{form_id[2..7]}\"\n end", "def ids\n pluck(:id)\n end", "def laboratorios_id\n laboratorios.all.map { |l| l.id }\n end", "def directors_ids\n directors_ids = []\n directors_name.each_with_index do |director, index|\n directors_ids << document[\"castMember\"][index][\"person\"][\"code\"] if director == document[\"castMember\"][index][\"person\"][\"name\"]\n end\n directors_ids\n end", "def get_denotation_ids(project_id = nil, span = nil)\n\t\tdenotations.in_project(project_id).in_span(span).pluck(:id)\n\tend", "def all_ids(_context)\n raise NotImplementedError\n end", "def fetch_symids\n doc = exec_doc('syminq -sym -symmids -wwn')\n symids = []\n doc.elements.each('SymCLI_ML/Inquiry/symid') do |ele|\n symids << ele.text\n end\n puts symids.uniq!\n end", "def dump_absolute_form_ids\n @form_ids.sort.each do |form_id|\n puts \"* [#{form_id}] - #{absolute_form_id(form_id)}\"\n end\n end", "def dids_911\n dids_911_list ? dids_911_list.collection : []\n end", "def getUnitFormElements unit_id\n unit_form = UNIT_TYPES[unit_id]\n if mobile_device?\n unit_form_mobile = unit_form + \"_mobile\"\n render :partial => 'examiners/performances/subforms/'.concat(unit_form_mobile)\n else\n render :partial => 'examiners/performances/subforms/'.concat(unit_form)\n end\n end", "def technos\n object.technos.map { |t| t.id }\n end", "def form_field_set_id\n @attributes[:form_field_set_id]\n end", "def form_field_set_id\n @attributes[:form_field_set_id]\n end", "def hidden_field_elements(identifier)\n platform.hidden_fields_for(identifier.clone)\n end", "def fill_form_guids_get_ht_needles(s_form, s_prefix)\n ht_needles=Hash.new\n s_needle=nil\n i=0\n while true\n s_needle=s_prefix+i.to_s+@@lc_rsqbrace\n break if !s_form.include? s_needle\n ht_needles[s_needle]=Kibuvits_GUID_generator.generate_GUID\n i=i+1\n end # loop\n return ht_needles\n end", "def record_ids(opts = {})\n opts = opts.merge(@opts)\n client.list_identifiers(opts).full.lazy.flat_map(&:identifier)\n end", "def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end", "def getPDBsFromEMDB\n emdbId = params[:name].upcase\n emdbToPDB = Hash.new\n if emdbId =~ /^EMD-\\d+$/\n request = makeRequest(Server+EmdbFit,emdbId)\n else\n request = nil\n end\n if request.nil?\n request = \"{}\"\n end\n json = JSON.parse(request)\n json.each do |k,v|\n tmpArray = []\n v.each do |fit|\n if fit != {}\n tmpArray+=fit[\"fitted_emdb_id_list\"][\"pdb_id\"]\n end\n end\n emdbToPDB[k]=tmpArray\n end\n myStatus = :ok\n if emdbToPDB == {}\n myStatus = :not_found\n end\n return render json: emdbToPDB, status: myStatus\n end", "def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end", "def list(count=10)\n @database.documents['rows'].map {|doc| doc['id'] }\n end", "def get_ids(table)\r\n valid_ids = []\r\n table_info = @db.execute(\"SELECT * FROM #{table}\")\r\n table_info.each do |line|\r\n line_info = []\r\n line.each do |name, value|\r\n if name == 'id'\r\n valid_ids << value\r\n end\r\n end\r\n end\r\n valid_ids\r\n end", "def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end", "def kenim_ids\n @kenim_ids = []\n kenim.each do |k|\n @kenim_ids.push( k._id )\n end\n return @kenim_ids\n end", "def tsu_ids\n dwelling_units.map(&:tsu_id).compact.uniq\n end", "def media_promotion_list_id\n @media_promotion_list_id ||= client.lists({:filters=>{:list_name=>@group_name}})['data'].first['id'] \n end", "def return_ids(id)\n array = Array.new\n array.push(id)\n subprojects = subProjects(id)\n subprojects.each do |project|\n array.push(return_ids(project.id))\n end\n\n return array.inspect.gsub(\"[\",\"\").gsub(\"]\",\"\").gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\")\n end", "def get_lawyer_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def rpm_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::Rpm.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n self.unit_search(id, criteria).map { |i| i['unit_id'] }\n rescue RestClient::RequestTimeout\n self.logger.warn('Call to rpm_ids timed out')\n # lazy evaluated iterator from zero to infinite\n pages = Enumerator.new do |y|\n page = 0\n loop do\n y << page\n page += 1\n end\n end\n\n # TODO: this is hotfix, pagination support should be added to Runcible\n pages.reduce([]) do |rpm_ids, page|\n page_size = 500\n criteria = { :type_ids => [Runcible::Extensions::Rpm.content_type],\n :fields => { :unit => [], :association => ['unit_id'] },\n :limit => page_size,\n :skip => 0 + page * page_size }\n result = unit_search(id, criteria).map { |i| i['unit_id'] }\n rpm_ids.concat(result)\n if result.empty? || result.size < 500\n break rpm_ids\n else\n rpm_ids\n end\n end\n end", "def directs\n alias_ids.map(&:e).map(&:company).map(&:id)\n end", "def asset_ids(id)\n monograph = Hyrax::PresenterFactory.build_for(ids: [id], presenter_class: Hyrax::MonographPresenter, presenter_args: nil).first\n return if monograph.blank?\n\n docs = monograph.ordered_member_docs\n return if docs.blank?\n\n ids = []\n docs.each do |doc|\n fp = Hyrax::FileSetPresenter.new(doc, nil)\n next if fp.featured_representative?\n next if fp.id == monograph.representative_id\n next if Sighrax.tombstone?(Sighrax.from_presenter(fp))\n ids << fp.id\n end\n\n ids.join(\",\")\n end", "def ids\n @store.transaction do\n @store.roots\n end\n end", "def omim_ids\n @table.keys\n end", "def fields\n [:id]\n end", "def getuser\n \tformid = Userdet.where(windmill: params[:millid])\nif formid.present?\n\n render json: formid.as_json(only: [:usid])\nelse\nputs \"no\"\nend\nend", "def work_id_list\n query = { params: { q: \"member_of_collection_ids_ssim:#{id} AND has_model_ssim:Work\", fl: \"id\", rows: \"100000\" } }\n results = solr.select(query)\n results['response']['docs'].flat_map(&:values)\n end", "def doc_ids_only\n {'fl'=>'id', 'facet'=>'false'}\n end", "def ids\n root.ids\n end", "def report_list_uids\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n uuids = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report| \r\n uuids.push(report.elements['name'].text)\r\n end\r\n return uuids\r\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 get_form_aggregates(id, object_id)\n @client.raw('get', \"/content/forms/#{id}/aggregates?object_id=#{object_id}\", options)\n end", "def getAllById( id )\n result = Array.new\n #@db = Mongo::Client.new(['127.0.0.1:27017'] , :database => 'xdkAmbiente' )\n @db[:leituras].find( {\"_id.id\" => id }\n ).each { |leitura|\n result.push(\n {\n :id => leitura[\"_id\"][\"id\"],\n :type => leitura[\"_id\"][\"type\"],\n :timestamp => leitura[\"_id\"][\"timestamp\"],\n :value => leitura[\"value\"],\n :gps => {\n :lat =>leitura[\"gps\"][\"lat\"],\n :lon =>leitura[\"gps\"][\"lon\"]\n }\n }\n )\n }\n #@db.close\n return result\n end", "def find_report\n within(start_date, end_date).map(&:patient_id)\n end", "def get_presentation_ids(base_url)\n ids_arr=[]\n get_page(base_url)\n grid = @wait.until{@driver.find_element(:id,\"presentation_grid\")}\n presentation_list = @driver.find_elements(:css, \".presentation_wrap\")\n\n presentation_list.each do |presentation|\n presentation_id = presentation.attribute(\"id\")\n presentation_id.slice! \"p_\"\n ids_arr.push(presentation_id)\n end\n return ids_arr\nend", "def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def get_passenger_ids\n @passengers = Passenger.all.map(&:id)\n end", "def index\n @ids = Id.all\n end", "def file_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::File.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def decode_form_id(form_id)\n form_id = form_id.to_i(16) if form_id.is_a?(String)\n [load_order[form_id / 16_777_216], form_id % 16_777_216]\n end", "def getAllTripIds(route_id)\n trips_array = JSON.parse(File.read(TRIPS))\n all_trip_ids = []\n for trip in trips_array\n if trip[\"route_id\"] == route_id\n all_trip_ids << trip[\"trip_id\"]\n end\n end\n puts \"all_trip_ids is #{all_trip_ids[0, 10]}\"\n return getCurrentTrips(all_trip_ids)\n end", "def get_form_activation_words(id)\n @client.raw('post', \"/content/forms/#{id}/activation-words\")\n end", "def campaign_ids\n (params[:campaign_ids] || []).map(&:to_i)\n end", "def gemd_ids_for(klass)\n ids = Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(klass, id))\n ids.map!(&:to_i) if [:active_record, :data_mapper, :sequel].include?(Recommendable.config.orm)\n ids\n end", "def index\n @milddew_imms = MilddewImm.all\n end", "def listing_tokens\n pixi_post_details.pluck('pixi_id')\n end", "def unitid_elements(marc)\n elements = []\n elements << {\n name: 'unitid',\n attrs: { type: 'clio', repositorycode: repository_code(marc), encodinganalog: '001' },\n value: marc['001'].value\n }\n marc.fields('852').each do |field|\n next unless field['h'].present?\n elements << {\n name: 'unitid',\n attrs: { type: 'call_num', repositorycode: repository_code(marc) },\n value: field['h']\n }\n end\n elements\n end", "def docker_manifest_list_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifestList.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def bill_ids\n first_and_last_info_to_json.fetch(:bill_ids, [])\n end", "def puppet_module_ids(id)\n criteria = {:type_ids => [Runcible::Extensions::PuppetModule.content_type],\n :fields => {:unit => [], :association => ['unit_id']}}\n\n unit_search(id, criteria).map { |i| i['unit_id'] }\n end", "def get_ticket_ids\n @tickets = Ticket.all.map(&:id)\n end", "def dom_id\n form_node['id']\n end", "def pmids \n @pmids ||= []\n end", "def person_ids\n persons = Person.find_all_from_identifier(source: 'xkonto', identifier: username)\n return nil if persons.blank?\n return persons.map(&:id)\n end", "def ids(things)\n things.map(&:id).join(\",\")\n end", "def names \n all_forms\n end", "def id_for(field_name)\n if name = @form_args[:name]\n \"#{name}_#{field_name}\".downcase.gsub(/-/, '_')\n else\n \"form_#{field_name}\".downcase.gsub(/-/, '_')\n end\n end" ]
[ "0.6425715", "0.6211666", "0.62067705", "0.60876197", "0.57503605", "0.55311996", "0.54089653", "0.537362", "0.53451985", "0.5297192", "0.5282358", "0.52794325", "0.5251241", "0.52483505", "0.52100426", "0.5203082", "0.51838595", "0.5178811", "0.51776016", "0.51733357", "0.51675916", "0.51608896", "0.51608115", "0.515834", "0.51315826", "0.5128358", "0.5097234", "0.5074444", "0.5074444", "0.5061816", "0.5045101", "0.50377554", "0.50374526", "0.5035803", "0.49966612", "0.49955058", "0.49877286", "0.4972401", "0.49653485", "0.49641615", "0.49605522", "0.49604407", "0.49556443", "0.49294376", "0.49288547", "0.49104446", "0.49086908", "0.49086908", "0.4905274", "0.49002445", "0.48972243", "0.48823947", "0.4879798", "0.48788875", "0.48751256", "0.4865494", "0.4864875", "0.48632294", "0.48570716", "0.485531", "0.48528987", "0.48420477", "0.48334464", "0.48284277", "0.48222837", "0.48181623", "0.48173672", "0.4812027", "0.480687", "0.48020297", "0.48007488", "0.47953975", "0.4795185", "0.47878435", "0.47866422", "0.47825617", "0.47773972", "0.4763772", "0.47513744", "0.47507495", "0.47476834", "0.47387967", "0.47387737", "0.4737051", "0.4736149", "0.47361147", "0.47353515", "0.47339547", "0.4733812", "0.47294515", "0.47290084", "0.4726626", "0.47245622", "0.47241086", "0.47214743", "0.47209135", "0.4720538", "0.47148365", "0.470945", "0.47075436" ]
0.65941966
0
3.Get a location for a given wind mill id
def getlocation locafid = Windmill.where(no: params[:no]) if locafid.present? locafid = Windmill.find_by(no: params[:no]) render json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])] else render json: {massage: 'windmill not found'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(id)\n @client.get(\"/BikePoint/#{id}\")\n end", "def get_location(location)\n client = Weatherman::Client.new\n client.lookup_by_location(location)\nend", "def location\n fetch('rick_and_morty.locations')\n end", "def get_location(user_location)\n\tclient=Weatherman::Client.new\n\tclient.lookup_by_location(user_location)\nend", "def get_location(id)\n response = perform(:get, \"Location/#{id}\", nil, headers)\n raise Common::Exceptions::BackendServiceException, 'LIGHTHOUSE_FACILITIES404' if response[:status] == 404\n\n response.body\n end", "def get_location(zip)\n location = Weatherman::Client.new(:unit =>'f')\n location.lookup_by_location(zip)\nend", "def location(id, options = {})\n get \"locations/#{id}\", options\n end", "def locationLookup(currLoc) \n client = Weatherman::Client.new\n client.lookup_by_location(currLoc)\nend", "def get_location(photo_id)\n # begin\n rsp = @flickr.send_request('flickr.photos.geo.getLocation', {:photo_id => photo_id})\n Flickr::Photos::Location.new(:latitude => rsp.photo.location[:latitude].to_f,\n :longitude => rsp.photo.location[:longitude].to_f, :accuracy => rsp.photo.location[:accuracy].to_i)\n end", "def find_locality\n\t @locality = Locality.get(params[:locality_id])\n\tend", "def find_locality\n\t @locality = Locality.get(params[:locality_id])\n\tend", "def location\n\t\tUnitLocation.new(@db, @id)\n\tend", "def find(id)\n new(GeoIQ.get(\"/maps/#{id}.json\"))\n end", "def getLocation( location_id)\n params = Hash.new\n params['location_id'] = location_id\n return doCurl(\"get\",\"/location\",params)\n end", "def geo(id)\n get \"/geo/id/#{id}.json\"\n end", "def set_ms_location\n @ms_location = MsLocation.find(params[:id])\n end", "def location\n fetch('hey_arnold.locations')\n end", "def mountain_area_forecast(location_id)\n query(\"txt/wxfcs/mountainarea/json/#{location_id}\")\n end", "def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end", "def locate(place)\n locations, = get :q => place\n return locations.first\n end", "def show\n\n @location = Location.friendly.find(params[:id])\n\n # Retrieve all locations within 20 miles of this location\n @nearby_locations = Location.near([@location.latitude, @location.longitude], 20).where.not(id: @location.id)\n\n end", "def find_nearest_place_id(max_meters)\n Place.collection.find(\n {'geometry.geolocation':\n {'$near': @location.to_hash}\n }).limit(1).projection({:_id=>1}).first[:_id]\n end", "def from_name\n @locations = Location.where(\"name like ?\", \"%#{params[:id]}%\") \n\n lat = params[:lat]\n lon = params[:lon]\n\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end", "def location\n # TODO Check this\n # return poi.location unless poi.nil?\n # return place.location unless place.nil?\n return get_location\n end", "def get_location\n\n end", "def location\n fetch('doraemon.locations')\n end", "def locations_around\n locations_within_proximity.where.not(id: id)\n end", "def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end", "def get_target(id)\n\t\ttarget = WmapTarget.find(:first, :conditions => [ \"id = ?\", id])\n\t\treturn target\n\tend", "def lon\n @position[1]\n end", "def location\n fetch('how_to_train_your_dragon.locations')\n end", "def locate(place)\n check_api_key\n @location = Hamweather::Location.parse(place)\n end", "def find_target_coordinates\n number = Phonelib.parse(@target_number)\n @country = number.country\n @target_cord = PhoneNumberGeolocation::Location.find_by_country_geo_name(\n @country, number.geo_name\n ).first.location\n end", "def locate_pins(location); end", "def determine_weather(location)\n\tclient = Weatherman::Client.new\n\tresponse = client.lookup_by_location(location)\n\nend", "def determine_weather(location)\n\tclient = Weatherman::Client.new\n\tresponse = client.lookup_by_location(location)\n\nend", "def nearby_metros(miles=400)\n return nil unless self.lat and self.lng\n puts \"within 30 miles of #{self.lat}/#{self.lng}\"\n Metro.find(:all, :origin => [self.lat,self.lng],:within=>miles,:order=>'distance')\n end", "def lon\n @location.longitude\n end", "def location\n fetch('harry_potter.locations')\n end", "def set_wind\n @wind = Wind.find(params[:id])\n end", "def at_millesime\n @millesime = @wine.millesimes.find(params[:id])\n end", "def find_location(location_name)\n Location.find_by name: location_name\n end", "def set_location\n @location = Location.friendly.find(params[:id])\n end", "def geo(place_id)\n get \"/geo/id/#{place_id}.json\"\n end", "def get_way(id)\n @ways[id.to_i]\n end", "def longitude; end", "def get_way(id)\n get_object('way', id)\n end", "def location_code\n text(data.at_xpath(\"#{data_root}/did/physloc\"))\n end", "def longitude\n end", "def locate_id\n @config[:locate_id]\n end", "def set_location\n @location = Location.friendly.find(params[:id])\n end", "def get_location_info(article_id)\n \n location_id_info_object = MatchAwL.find_by_var(\"articles_with_locations\", \"article_id\", article_id)\n location_id = location_id_info_object.location_id\n location_object = Location.find_by_var(\"location_keys\", \"id\", location_id)\n @location_name = location_object.location_name\n \n @address = location_object.address\n \n end", "def get_longitude\n get_coord['lon']\n end", "def locate(latitude,longitude)\n get escape(\"lat=#{latitude}&lon=#{longitude}\")\n end", "def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end", "def geolocate \n Zoogle.graveyard_locator(self.graveyard)\n \"#{loc[:latitude]}, #{loc[:longitude]}\"\n end", "def location\n\t\tStructureLocation.new(@db, @id)\n\tend", "def maps_api_location\n \"#{self.city}+#{self.state.sub(\"International\", \"\")}\".sub(\" \", \"+\")\n end", "def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/worlds/#{id}\", options: options)).first, client: client)\n end", "def get_by_lat_lng\n\tend", "def tryWorldKit(location)\n url = getWorldKitURL(location)\n if url\n xml_data = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(xml_data)\n if doc.elements[\"*/geo:Point/geo:long\"]\n long = doc.elements[\"*/geo:Point/geo:long\"].text\n lat = doc.elements[\"*/geo:Point/geo:lat\"].text\n return [lat, long]\n else\n return nil\n end\n else\n return nil\n end\n end", "def location\n @client.get(\"#{path}/location\")\n end", "def near max_meters=nil\n documents = self.class.near(@location, max_meters)\n self.class.to_places(documents)\n end", "def locations(place)\n get :loc => place\n end", "def location\n @location ||= Station.get(@attrs['LocationCode'])\n end", "def lon\r\n return @longitude\r\n end", "def location\n @location ||= locations.hq.first\n end", "def set_specific_location\n @specific_location = SpecificLocation.find(params[:id])\n end", "def get_location_group(project_id, location_group_id)\n get \"projects/#{project_id}/group/location/#{location_group_id}\"\n end", "def set_maplocation\n @maplocation = Maplocation.find(params[:id])\n end", "def location\n fetch('simpsons.locations')\n end", "def find_closest\n find_target_coordinates\n location = build_query.geo_near(@target_cord).first\n\n return nil if location.nil?\n [(location.phone_numbers & customer_numbers).first, location.geo_name]\n end", "def get_position(id)\n (`xwininfo -id #{id}`).scan(/Absolute.*:\\s*(\\d*)/).flatten.map{|n| n.to_i}\nend", "def location\n fetch('games.super_mario.locations')\n end", "def find_location\n\t\t@surgery_location = SurgeryLocation.find(params[:id])\n\tend", "def location\n fetch('sword_art_online.location')\n end", "def set_geolocation\n @location = Geolocation.find(params[:id]) \n end", "def find_nearest_place_id max_dist\n\t#byebug\n\tphot=self.class.find(@id) #returns instance of photo\n\tphot_loc=phot.location #gets location from photo (point where photo was taken)\n\tphot_place=Place.near(phot_loc,max_dist).projection(:_id=>1).first #find closest place to point\n\tphot_place.nil? ? nil : phot_place[:_id] #return the id of the closest place to that point\nend", "def location\n \n # Try to the device with its id or uid\n @device = get_device params[:device_id]\n \n if @device\n # Render Location to json, if user is allowed\n if @device.get_read_access(current_user)\n @location = @device.location\n \n else\n render json: {:message => \"Not authorized to read device location\", :code => 401} , :status => :unauthorized \n end\n \n end\n \n end", "def grab_nearest_by_location(distance, loc)\n\n end", "def location\n fetch('books.the_kingkiller_chronicle.locations')\n end", "def geolocate\n loc = Zoogle.graveyard_locator(self.graveyard)\n \"#{loc[:latitude]}, #{loc[:longitude]}\"\n end", "def worldmap_id\n MapConfig::WORLDMAP_ID;\n end", "def locate(address)\n get :location => address\n end", "def location\n Location.get(@entity['location_id'], client: @client)\n end", "def getlocation\r\n @myip = remote_ip()\r\n # based off freegeoip.net is really terrible\r\n result = Geocoder.search(@myip)\r\n @mylat = result.latitude\r\n @mylong = result.longitude\r\n @mycity = result.address\r\n #51.243048, -0.588458\r\n end", "def my_weather\n location = my_location\n weather_for \"#{location['city']}, #{location['region_code']}\"\nend", "def lookup(name)\n loc = nil # TODO: Periodic refresh of location database table\n=begin\n loc = IlsLocationList.lookup(name)\n=end\n return loc.name, loc.code if loc.present?\n end", "def lookup(woeid, unit = Units::CELSIUS)\n acceptable_units = [Units::CELSIUS, Units::FARENHEIT]\n unit = Units::CELSIUS unless acceptable_units.include?(unit)\n\n url = ROOT + \"?q=select%20*%20from%20weather.forecast%20\"\n url += \"where%20woeid%3D#{woeid}%20and%20u%3D'#{unit}'&format=json\"\n\n doc = get_response url\n Response.new woeid, url, doc\n end", "def find_location\n\t\t@surgery_location = SurgeryLocation.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Surgery Location ID !'}, status: 400 if @surgery_location.nil?\n\tend", "def query_location_lat_long\n loc = MultiGeocoder.geocode(location)\n [loc.lat, loc.lng]\n end", "def show\n @location = Location.find(params[:id])\n end", "def show\n @location = Location.find(params[:id])\n end", "def show\n @location = Location.find(params[:id])\n end", "def show\n @location = Location.find(params[:id])\n end", "def api\n CLLocationCoordinate2DMake(latitude, longitude)\n end", "def location\n self.well_info.location\n end", "def set_location\n @location = Location.find(params[:id])\n end", "def set_location\n @location = Location.find(params[:id])\n end" ]
[ "0.67797107", "0.64473814", "0.6305792", "0.6266786", "0.6212447", "0.62123996", "0.61723906", "0.6151979", "0.6082059", "0.60444397", "0.60444397", "0.6038972", "0.59529644", "0.5952639", "0.5950307", "0.5947981", "0.5945268", "0.59133595", "0.59132504", "0.58959365", "0.5853902", "0.5852385", "0.5835645", "0.57921535", "0.5787309", "0.5779444", "0.5774337", "0.57539195", "0.5751782", "0.5742596", "0.5735967", "0.57169294", "0.5703233", "0.5687083", "0.5677566", "0.5677566", "0.5676631", "0.567644", "0.5674249", "0.56644535", "0.5654489", "0.56260926", "0.5618996", "0.55981386", "0.5597164", "0.559214", "0.55884874", "0.5578759", "0.55764306", "0.5576344", "0.557588", "0.5573939", "0.55699456", "0.5559291", "0.5550241", "0.55446", "0.5543173", "0.553362", "0.55245584", "0.55190676", "0.5505646", "0.5502004", "0.549728", "0.5493331", "0.5490041", "0.5487237", "0.5481516", "0.54782176", "0.5477916", "0.54635173", "0.5461101", "0.5458227", "0.5457526", "0.54499084", "0.544703", "0.5441077", "0.5425261", "0.54162073", "0.54111516", "0.5404673", "0.54015756", "0.5400647", "0.5393201", "0.53928125", "0.539131", "0.53871536", "0.53696066", "0.5361119", "0.53608227", "0.53581315", "0.5356463", "0.53482836", "0.5347697", "0.5347697", "0.5347697", "0.5347697", "0.53475773", "0.5336549", "0.5334898", "0.5334898" ]
0.6326181
2
4.Get a wind form for a given wind mill id
def getform getform = Windmill.where(no: params[:no]) if getform.present? render json: getform.as_json(only: [:windformid]) else render json: {massage: 'No windfrom available in this id'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend", "def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "def get_forms(id)\n id = get_id(id) if id.is_a?(Symbol)\n return @data[id] || @data.first\n end", "def retrieve_smerf_form(id)\n # Retrieve the smerf form record if it exists\n @smerfform = SmerfForm.find_by_code(id)\n # Check if smerf form is active\n if (!@smerfform.code.blank?() and !@smerfform.active?())\n raise(RuntimeError, \"#{@smerfform.name} is not active.\")\n end \n # Check if we need to rebuild the form, the form is built\n # the first time and then whenever the form definition file\n # is changed\n if (@smerfform.code.blank?() or \n SmerfFile.modified?(params[:id], @smerfform.cache_date)) \n @smerfform.rebuild_cache(params[:id])\n end\n # Find the smerf form record for the current user\n @<%= link_table_model_name %> = <%= link_table_model_class_name %>.find_user_smerf_form(\n self.smerf_user_id, @smerfform.id)\n end", "def form(form_id)\n return unless (f = get(\"forms/#{form_id}\")['Forms'])\n Form.new(f.first['Url'], party: self, details: f.first)\n end", "def find_form\n @form = Form.find(params[:id])\n end", "def get_form(form_name)\r\n\t\t\tself.get_design_note(form_name, API::DFLAGPAT_FORM_OR_SIMILAR, Form)\r\n\t\tend", "def set_medical_form\r\n @medical_form = MedicalForm.find(params[:id])\r\n end", "def getUnitFormElements unit_id\n unit_form = UNIT_TYPES[unit_id]\n if mobile_device?\n unit_form_mobile = unit_form + \"_mobile\"\n render :partial => 'examiners/performances/subforms/'.concat(unit_form_mobile)\n else\n render :partial => 'examiners/performances/subforms/'.concat(unit_form)\n end\n end", "def set_wind\n @wind = Wind.find(params[:id])\n end", "def getmill\n\t\n \tformid = Userdet.where(usid: params[:userid]).all\n \t\nif formid.present?\n\t\t\n render json: formid.as_json(only: [:windmill])\nelse\nrender json: [{message: 'not found'}]\nend\nend", "def form_elements(identifier)\n platform.forms_for(identifier.clone)\n end", "def at_millesime\n @millesime = @wine.millesimes.find(params[:id])\n end", "def wind_params\n params[:wind]\n end", "def set_winding\n @winding = Winding.find(params[:id])\n end", "def show\n\t@weather = Weather.find_by_field_id(params[:id])\n\t@project_name = Project.find(session[:project_id]).name\n @field_name = Field.find(params[:id]).field_name\n\tif !(@weather == :nil) # no empty array\n\t if (@weather.way_id == nil)\n\t @way = \"\"\n\t else\n\t @way = Way.find(@weather.way_id)\n\t end \n\t respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end\n end", "def next_form\n json_form.next_form(parsed_json['id'])\n end", "def show\n \n @stateform = Stateform.find(params[:id])\n \n \n end", "def get_question(form_name, id)\n get_form(form_name)[:questions][id]\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def show\n @fields = FormularioField.where \"formulario_id =?\", @formulario.id\n end", "def set_form\n @form = FormKit::Form.find(params[:id])\n end", "def form_fields_open(form_name)\n form_detect(form_name)\n element = @form.find(:css, 'a[id$=\"FormDesignerLnk\"]')\n element.click\n end", "def find_form_by(form_id:, token:, **query_params)\n forms_by_id(form_id: form_id, token: token, **query_params)\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def set_pharmaceuticalform\n @pharmaceuticalform = Pharmaceuticalform.find(params[:id])\n end", "def set_timed_form\n @timed_form = TimedForm.find(params[:id])\n end", "def set_milddew_imm\n @milddew_imm = MilddewImm.find(params[:id])\n end", "def set_form\n #@form = Form.find(params[:id])\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def new\n \t@editing = false\n @extraction_form_arm = ExtractionFormArm.new\n\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t@project = Project.find(params[:project_id])\n puts \".............. >>> extraction_form_armms_controller::new \"\n @extraction_form_arm_instr = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", params[:extraction_form_id].to_s, \"ARMS\", \"GENERAL\"])\n end", "def [](id, form = 0)\n id = get_id(id) if id.is_a?(Symbol)\n return @data.dig(id, form) || @data.dig(id, 0) || @data.dig(0, 0)\n end", "def form_id\n page.execute_script 'return window.Dashboard.router.pageView.formId'\n end", "def show\n @inquiry_form = current_site.inquiry_forms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inquiry_form }\n end\n end", "def form_detect(form_name)\n forms_table.all(:css, 'tr[class$=\"Row\"]').each do | entry |\n element = entry.find(:css, 'span[id$=\"DispName\"]')\n if element.text.to_s.downcase == form_name.to_s.downcase\n @form = entry\n break\n end\n end\n raise \"Form #{form_name} not found.\" unless @form\n end", "def get_form_id(object)\n MyAdmin.get_form_id(object)\n end", "def set_mwc_law\n @mwc_law = MwcLaw.find(params[:id])\n end", "def get_form(slug, options = nil)\r\n @client.raw('get', \"/content/forms/#{slug}\", options)\r\n end", "def set_form\n @form = Form.find(params[:id])\n end", "def form\n form = Form.new(self.mood, self.figure)\n return form\n end", "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('location', app) \n location_form = renderer.render('form', 'em')\n \n end", "def h_undralrm; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id,'humThresholdLoAlm'); end", "def set_formulari\n @formulari = Formulari.find(params[:id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def set_form\n @form = Form.find(params[:form_id])\n end", "def get_form_start_id(form_name)\n get_form(form_name)[:start_id]\n end", "def h_undrwrng; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id,'humThresholdLoWrn'); end", "def set_form\n @wrapper = Wrapper.find(params[:id])\n end", "def set_wod\n @wod = Wod.find(params[:id])\n end", "def set_wod\n @wod = Wod.find(params[:id])\n end", "def show\n session[:field_id] = params[:id]\n\n respond_to do |format|\n format.html { redirect_to weather_path }\n format.json { render json: @field, status: :created, weather: @field.id }\n end\n end", "def forms; end", "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], party: self, details: details)\n end\n end", "def index\n @member = Member.find(params[:member_id])\n\n @forminfos = @member.forminfo\n end", "def h_ovrwrng; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'humThresholdHiWrn'); end", "def find_my_step_form_on_tree(flow = self, step_id)\n found_step = nil\n flow.my_steps.each do |step|\n found_step = step if step.id == step_id.to_i\n found_step = find_my_step_form_on_tree(step.my_child_flow, step_id) if step.step_type == 'flow'\n return found_step if found_step.present?\n end\n found_step if found_step.present?\n end", "def form\n @form ||= Steps::FormObjectFactory.form_object_for(step, enrollment)\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 show\r\n @phr = Phr.find(params[:phr_id])\r\n @immunization = @phr.immunizations.find(params[:id])\r\n end", "def show\n @wod\n end", "def set_form\n @form = Form.find_by(id: params[:id])\n redirect_to '/404.html' and return if @form.nil?\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def show\n @control = @device.controls.find(params[:id])\n end", "def get_target(id)\n\t\ttarget = WmapTarget.find(:first, :conditions => [ \"id = ?\", id])\n\t\treturn target\n\tend", "def set_form_bir\n @form_bir = FormBir.find(params[:id])\n end", "def set_pit_form\n @pit_form = PitForm.find(params[:id])\n end", "def window_by_id(id)\n @windows.ID(id)\n end", "def window_by_id(id)\n @windows.ID(id)\n end", "def window_by_id(id)\n @windows.ID(id)\n end", "def build_rebin_label_station_form(rebin_label_station,action,caption,is_edit = nil,is_create_retry = nil)\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n codes = Facility.find_all_by_facility_type_code(\"packhouse\").map{|g|[g.facility_code]}\n\tfield_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'rebin_label_station_code'}\n\n\tif is_edit == false\n\t field_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'packhouse_code',\n\t\t\t\t\t\t:settings => {:list => codes}}\n\telse\n\t field_configs[1] = {:field_type => 'LabelField',\n\t\t\t\t\t\t:field_name => 'packhouse_code'}\n\tend\n\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'ip_address'}\n\n\tbuild_form(rebin_label_station,field_configs,action,'rebin_label_station',caption,is_edit)\n\nend", "def set_fusion_form\n @fusion_form = FusionForm.find(params[:id])\n end", "def show\n @housing_form = HousingForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_form }\n end\n end", "def set_formulario\n @formulario = Formulario.find(params[:id])\n end", "def set_formulario\n @formulario = Formulario.find(params[:id])\n end", "def set_formulario\n @formulario = Formulario.find(params[:id])\n end", "def set_formulario\n @formulario = Formulario.find(params[:id])\n end", "def show\n @mum = Mum.find(params[:mum_id])\n end", "def t_undralrm; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id,'tempThresholdLoAlm'); end", "def child(id)\n\t\t\tcase id\n\t\t\twhen String\n\t\t\t\t# Allow the user to use an underscore to specify an ampersand for\n\t\t\t\t# the control name.\n\t\t\t\tby_title = find_window_ex @handle, 0, nil, id.gsub('_', '&')\n\t\t\t\tby_class = find_window_ex @handle, 0, id, nil\n\t\t\t\tresult = (by_title > 0) ? by_title : by_class\n\t\t\twhen Fixnum\n\t\t\t\tresult = get_dlg_item @handle, id\n\t\t\telse\n\t\t\t\tresult = 0\n\t\t\tend\n\t\n\t\t\traise \"Control '#{id}' not found\" if result == 0\n\t\t\tWindow.new result\n\t\tend", "def set_housing_form\n @housing_form = HousingForm.find(params[:id])\n end", "def wedding\n if(params[:wedding_id])\n @wedding = Wedding.find(params[:wedding_id])\n else\n @wedding = Wedding.first # Service.all <= What the fuck was that?\n end\n end", "def get_way(id)\n get_object('way', id)\n end", "def new\n @diagnoz = Diagnoz.new\n @admin_mkh_groups = Admin::MkhGroup.all\n @diagnoz.diamkhs.build\n @woman = Woman.find(params[:woman_id])\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def t_undrwrng; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id,'tempThresholdLoWrn'); end", "def show_windows_for_period\n #TODO need conditional logic here if already on the right page\n go_to_manage_reg_windows\n on RegistrationWindowsTermLookup do |page1|\n page1.search_by_term_and_year @year, @term_type\n end\n on RegistrationWindowsPeriodLookup do |page2|\n page2.show_windows_by_period\n end\n end", "def mobile_form\n @user_id = params[:user_id] || 1\n # FORM URL: create_from_mobile_form_api_payments_path\n end", "def form; end", "def set_match_form\n @match_form = MatchForm.find(params[:id])\n end", "def form_schema_id\n SavedClaim::CaregiversAssistanceClaim::FORM\n end", "def show\n @filled_form = FilledForm.find(params[:id])\n @form_template = FormTemplate.find(@filled_form.form_template_id)\n\n @prefilled_ror_contents = prefill_ror_form @form_template.ror_contents, @filled_form.attributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filled_form }\n end\n end", "def find_form_workflow(kapp_slug, form_slug, workflow_id, params={}, headers=default_headers)\n @logger.info(\"Find workflow #{workflow_id} in the \\\"#{form_slug}\\\" Form in the \\\"#{kapp_slug}\\\" Kapp\")\n get(\"#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}/workflows/#{workflow_id}\", params, headers)\n end", "def new\n @floor = Floor.new(dungeon_id: params[:dungeon_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @floor }\n end\n end", "def show\n @forms = Forms.all()\n end", "def get_form_model(form_name)\n get_form(form_name)[:model]\n end", "def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end", "def div_by_id(id_name)\n return @browser.div(:id, id_name)\nend" ]
[ "0.70188755", "0.69844186", "0.6163385", "0.6037567", "0.59459174", "0.59080905", "0.58822536", "0.58781534", "0.56679285", "0.56117207", "0.5533566", "0.54399055", "0.5417854", "0.5362818", "0.53531736", "0.533231", "0.5286203", "0.5242859", "0.5233617", "0.52308726", "0.52308726", "0.5212992", "0.51671684", "0.5165791", "0.5153235", "0.51429284", "0.51411575", "0.5117141", "0.5116652", "0.5107948", "0.50958496", "0.50658566", "0.5044249", "0.5006657", "0.50027317", "0.50024307", "0.49962437", "0.4994895", "0.49864647", "0.49778846", "0.49713233", "0.49681598", "0.49669895", "0.49634537", "0.49489745", "0.49489745", "0.49489745", "0.49489745", "0.49391463", "0.49263698", "0.49158907", "0.49089798", "0.49089798", "0.49022442", "0.48993233", "0.4892394", "0.48875", "0.4877639", "0.48763007", "0.48717406", "0.48693937", "0.48683947", "0.48673898", "0.48567516", "0.48411283", "0.48408926", "0.483972", "0.48242983", "0.48178512", "0.4814608", "0.48142305", "0.48142305", "0.48142305", "0.48140082", "0.4813873", "0.48075163", "0.48066282", "0.48066282", "0.48066282", "0.48066282", "0.47995263", "0.4799035", "0.47904462", "0.47886595", "0.4780671", "0.47780845", "0.4756194", "0.4751234", "0.47481295", "0.47474733", "0.47463733", "0.47454026", "0.47450942", "0.4743972", "0.4741852", "0.47416112", "0.47405025", "0.47402433", "0.4739438", "0.47363803" ]
0.727166
0
it displays all the value for the given no
def form form = Windmill.all #form = Windmill.where(windformid: params[:id]) #if form.present? render json: form.as_json(only: [:no]) #else #render json: {massage: 'No windfrom available in this id'} # #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(number)\n display_each([number])\n end", "def show_all_values my_array\n puts \"\\nAll Values: \"\n puts \"-----------\"\n my_array.each do |value| \n puts \"Name: \" + value.get_name.to_s\n puts \" Area: \" + value.get_area.to_s\n puts \" Temperature: \" + value.get_temperature.to_s\n puts \"Radiator: \" + value.get_num_radiator.to_s\n puts \" Ground: \" + value.get_num_ground.to_s\n puts \" Num: \" + value.get_num.to_s + \"\\n\\n\"\n end \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 display\n\t\t\"SUITE: #{@suite}, RANK: #{@rank}, VALUE: #{@value}\"\n\tend", "def show\n # TODO put computation here for displaying alternate values?\n end", "def display\n @mat.each do | _ ,row|\n row.each do |ele|\n if ele == \"1\"\n print ele\n else\n print \" \"\n end\n end\n puts \"\\n\"\n end\n end", "def outputcase \n for i in 0...@records.recordsArr.length do\n\n isfit = checkMustHaveNotLimit @records.recordsArr[i]\n \n\n for j in 0...@records.recordsArr[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 display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend", "def shownumbers_mand\n\t\tmult = @num1 * @num2 * @num3\n\t\tputs \"With Mandtory #{@num1} * #{@num2} * #{@num3} = #{mult}\"\n\tend", "def show_values\n puts \"Name: \" + @heating_name\n puts \" Area: \" + @heating_area.to_s\n puts \" Temperature: \" + @heating_temperature.to_s\n puts \"Radiator: \" + @num_radiator.to_s\n puts \" Ground: \" + @num_ground.to_s\n puts \" Num: \" + @num.to_s\n end", "def display\n puts \"#{@cell[0..2].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[3..5].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[6..8].join(\" | \")}\"\n \n end", "def to_s\n variable = 0\n @values.each do |k, v|\n if variable % 9 == 0\n puts \"|\"\n\n puts \".\" * 37\n\n end\n print \"| #{v} \"\n variable += 1\n end\n \"|\"\n end", "def display_result(key,value,discount_total)\n puts \"#{key} : #{value} : #{discount_total}\"\n end", "def show_footnotes(val, field_name, study_id)\n retVal = val.to_s\n notes_for_field = FootnoteField.where(:study_id=>study_id, :field_name=>field_name).order(\"footnote_number ASC\")\n unless notes_for_field.empty?\n retVal += \" [\"\n i = 0\n notes_for_field.each do |note|\n note_num = note.footnote_number\n retVal = retVal + note_num.to_s\n unless(i >= (notes_for_field.length - 1))\n retVal = retVal + \",\"\n end\n i += 1\n end\n retVal = retVal + \"]\"\n end\n return retVal\n end", "def show\n \"$#{total} #{@state[0]} #{@state[1]} #{@state[2]} #{@state[3]} #{@state[4]}\"\n end", "def display_nums\n (0...9).each do |ro|\n (0...9).each do |co|\n if @grid[ro][co] == :B\n surround_nums(ro,co)\n end\n end\n end\n end", "def mostrar_actual\n \"#{@actual[:value]}\\n\\n\"\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 print_result\n puts @cells.map{ |row| row.map{ |cell| (cell.determine? ? cell.number : '?').to_s.rjust(length.to_s.length) }.join() }.join(\"\\n\")\n end", "def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless value.nil? }\n puts \"\\n** End of Report\"\n end", "def displayframecolumnvalues\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\tnew_row='|'+row.join('|')+'|'\r\n\t\t\t\t@output.puts(new_row)\r\n\t\t\tend\r\n\t\tend", "def value_viewer(value_array) ### 2\n\tvalue_array.each do |value|\n\t\tputs value\n\tend\nend", "def display\n port_total\n display_port\n overall_total\n end", "def shownumber_hash\n\t\tmult = @no1 * @no2 * @no3\n\t\tputs \"With hash #{@no1} * #{@no2} * #{@no3} = #{mult}\"\n\tend", "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 display_vertical\n\t\t@numbers.to_s.split('').collect{|number| NUMBER[number]}.each do |elems|\n\t\t\telems.each{|elem| puts CHARS[elem]}\n\t\tend\n\tend", "def display(n)\n\n @numerals[n].each.with_index {|x,i| @segments[i].method(x).call}\n\n end", "def show\n $total = VoteLog.all.count\n ## 임시코드 xxx\n #for k in 0..@lotto.winnum.to_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 DisplayEmpDetails(list=[])\n\t\tindex = list[0].to_i;\n\t\tindex2 = 0\n\t\tputs \"\"\n\t\tif @gender[list[index2].to_i] = \"F\"\n\t\t\t$FemaleHighSalary = @salary[list[index2].to_i]\n\t\t\t$FemaleHiredate = @hiredate[list[index2].to_i]\n\t\tend\t\n\t\twhile index2 < list.count\n\t\t\tindex = list[index2].to_i\t\t\t\t\n\t\t\tputs \"#{@name[index]} ($#{@salary[index]})\"\n\t\t\tindex2 = index2 + 1\n\t\tend\t\t\n\tend", "def print_info\n self.values.each do |value|\n puts value\n end\n end", "def mostrar_fin\n \"#{@fin[:value]}\\n\\n\"\n end", "def nama\n puts \"nama : #{@nama}\"\n puts \"blood : #{@blood}\"\n puts \"manna : #{@manna}\"\n end", "def show\n @data.each do | row |\n row.each do | cell |\n if cell.infected?\n print \"%3s\" % cell.virus.generation\n else\n print \" #{cell.content} \"\n end\n end\n puts\n end\n end", "def print_changing_numbers\n\t\ti = 1\n\t\t#zolang i kleiner is dan 11\n\t\twhile i < 11\n\t\t\t#print de string met het nummer variabele en verhoog het daarna met 1\n\t\t\tputs \"This sentence is number #{i}\"\n\t\t\ti = i+1\n\t\tend\n\tend", "def print_details( result_counts, score )\n puts ('=' * 10) << \"\\n\"\n @groups.each_with_index { |group, index| group.each { |row| puts \"#{row} Group \" << (index + 1).to_s } }\n puts '-' * (@groups[0][0].length * 3)\n puts \"#{result_counts} Score\"\n puts \"\\nTotal Score: #{score}\\n\"\n end", "def display_exemple\n @array.each_with_index do |element, index|\n \tif index < @array.count-1 \n \t\tputs \"(data : #{element.value}) --> #{element.next_node.value}\"\n \telse\n \t\tputs \"(data : #{element.value}) --> #{element.next_node}\"\n \tend\n end\n end", "def DisplayResults(data)\n\t\n\tputs \"Street Address: #{data[0]}\"\n\tputs \"Last Year Assessed Value: $#{data[1]}\"\n\tputs \"Current Assessed Value: $#{data[2]}\"\n\tputs \"Exemption: $25,000\"\n\tputs \"Taxable Value: $#{data[2]-25000}\"\n\tputs \"Tax Rate (per $1,000): $10.03\"\n\tputs \"Due: $#{data[3]}\"\nend", "def print_item\n return values\n end", "def disp_details(d)\n d.each do\n |key,value|\n print key,'=',value,' '\n end\nend", "def show\n 10.times do |round|\n @cadena = ''\n if round == 9\n show_auxiliar(4, round, @cadena)\n else\n show_auxiliar(3, round, @cadena)\n end\n puts \"#{@cadena}\\n\"\n end\n end", "def showing \n @numberShowing\n end", "def display_values\n options.each do |option|\n update_ui option, read(option)\n end\n end", "def example\n display [1, 3, 2, 4, 3, 4, 2 , 4, 1]\n end", "def show_value_label_method\n value.to_s\n end", "def display\n i=0\n print \" \"\n 0.upto(9) do |x|\n print\" #{x} \"\n end\n 10.upto(@cols-1) do |x|\n print\" #{x}\"\n end\n print \"\\n\"\n print \" \"\n 0.upto(@cols-1) do\n print\"---\"\n end\n print \"\\n\"\n 0.upto(9) do |x|\n\t\t\tprint\" #{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n \t\tend\n 10.upto(@rows-1) do |x|\n\t\t\tprint\"#{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n end\n return nil\n\tend", "def display (x)\n x.each do |x|\n puts\"#{x} students\\n\\n\"\n end\nend", "def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end", "def show(z = 0)\n\t\t\tto_nef(z).show\n\t\tend", "def display\n puts @o\n puts @a\n puts @b\n puts @c\n puts @d\n puts @e\n puts @f\n puts @g\n puts @h\n puts @i\n puts \" \"\n end", "def show_numbersdef\n\t\tmult = @number1 * @number2 * @number3\n\t\tputs \"With default #{@number1} * #{@number2} * #{@number3} = #{mult}\"\n\tend", "def show_value\n return @show_value\n end", "def multiplication_tables(num)\n #variable que recibe el valor de la tabla\n tablas = 1\n #Loop que calcula la multiplicación de cada número\n for n in 1..num\n (1..10).each do |x| \n tablas = n * x\n #formatea el valor con espacio de 5 string entre cada valor\n printf \"%-5s\", tablas\n end\n #salto de linea\n printf(\"\\n\")\n end\nend", "def display\n puts \" #{@cells[0]} \" + \"|\" + \" #{@cells[1]} \" + \"|\" + \" #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} \" + \"|\" + \" #{@cells[4]} \" + \"|\" + \" #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} \" + \"|\" + \" #{@cells[7]} \" + \"|\" + \" #{@cells[8]} \"\n end", "def print_items\n return values\n end", "def ar_show_data \n result= []\n \n controller.ardata.fields.for_show.each do |column, title|\n label= ar_get_index_label(title)\n if label && !label.empty?\n result << content_tag(:dt, label)\n result << content_tag(:dd, ar_get_resource_value(@resource, column))\n end\n end\n \n content_tag :dl, result.join(\"\\n\")\n end", "def print_value\n\t\t\treturn @value\n\t\tend", "def print_value\n\t\t\treturn @value\n\t\tend", "def display\n\t\tputs \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n\t\tputs \"-----------\"\n\t\tputs \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\tend", "def show_total_unattendance_number\n puts 'show_total_unattendance_number'\n total_unattendance_number = @data.inject (0) do |mem, e|\n num_exams = e.size - 1.0\n mem + e.last(num_exams).count('00')\n end\n puts total_unattendance_number.to_s\n end", "def display\n\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n\n end", "def show\n @inform = @study.inform\n @all_cups_price = 0\n @inform.studies.each do |study|\n @all_cups_price += study.price * study.factor\n end\n end", "def display_products(products)\n puts \" ID Description Price\"\n puts \"-\" * 50\n products.each do |key, value|\n #puts key.class\n #puts value[1] + 1\n puts \"#{key} #{value[0].rjust(25)} $#{sprintf(\"%.2f\", value[1]).to_s.rjust(6)}\"\n end\nend", "def show\n puts @name\n puts @quantity\n end", "def printable_display(numbers)\n numbers.each { |i| puts i.join('') }\n end", "def display\n\t\tcurrent_node = @head\n\t\tlinked_list_array = []\n\t\twhile current_node != nil\n\t\t\t\n\t\t\tlinked_list_array << current_node.value\n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tlinked_list_array\n\tend", "def display_value(count)\n return \"- \" if count.nil?\n return \"0 \" if count.zero?\n\n case Math.log10(count).floor\n when 1...4 then '%d ' % count\n when 4...7 then '%dk' % (count / 1000)\n when 7...10 then '%dM' % (count / 1000_000)\n when 10...13 then '%dG' % (count / 1000_000_000)\n when 13...16 then '%dT' % (count / 1000_000_000_000)\n else '%dP' % (count / 1000_000_000_000_000)\n end\n\n end", "def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end", "def display(values)\n width = 1+($squares.map{|s| values[s].size}).max\n line = \"+\".join([\"-\"*width*3]*3)\n for r in $rows\n for c in $cols\n val_string = values[\"#{r}#{c}\"].join\n print val_string + (\" \" *(width -val_string.size))\n print \"|\" if c ==3 or c ==6\n end\n\n puts \"\"\n puts line if r == \"C\" or r ==\"F\"\n end\nend", "def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end", "def output\n printable_display combined_array(numbers_array)\n end", "def to_s()\n puts \"Nume: \"+@nume+\" Prenume: \"+@prenume\n end", "def outputValue\n\t\tend", "def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \"&nbsp;<b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \"&nbsp;&nbsp;#{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\"&nbsp;&nbsp;\" + (l == 'unknown' ? \"<i>repository not given</i>\" : \"&nbsp;&nbsp;#{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"&#9792;\"\r\n when 'male'\r\n \"&#9794\"\r\n when 'gynadropmorph'\r\n \"[&#9792;&#9794;]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end", "def printQuestionOnScreen()\n $lblQuestionNumber.grid :column => 0, :row => 0\n $lblQuestionNumber['text'] = $intQuestionOnScreen.to_s + \".\"\n $lblQuestion.grid :column => 1, :row => 0\n $lblQuestion['text'] = $arrQuestions[$intQuestionOnScreen - 1]\nend", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end", "def show_prime\n @prime_numbers.uniq.to_s\n end", "def display_phone_number(emp)\n\t\tprint \"Name \t\t: #{emp.name}\t\\n\"\t\t\n\t\tprint \"Phone Number : #{emp.phone}\t\\n\"\n\tend", "def display_details()\r\n\t\tprintf(\"\\n**************************************************\")\r\n\t\tprintf(\"\\n***** MONTHLY PAY SLIP DETAILS *****\")\r\n\t\tprintf(\"\\n**************************************************\")\r\n\t\tprintf(\"\\nEmployee Name : %s\",@name)\r\n\t\t# Amounts are depicted with 2 decimal places.\r\n\t\tprintf(\"\\nGross Monthly Salary : $ %.2f\",@grossMonthlyIncome)\r\n\t\tprintf(\"\\nMonthly Tax : $ %.2f\",@monthlyIncomeTax)\r\n\t\tprintf(\"\\nNet Monthly Salary : $ %.2f\",@netMonthlyIncome)\r\n\t\tprintf(\"\\n**************************************************\")\r\n end", "def show\n header(@keyword)\n counter(list).each_with_index do |el, index|\n print \"#{index + 1} - #{el.first}\"\n (20 - el.first.length).times { print '-' }\n print \"#{el[1]} views\"\n puts\n end\n end", "def show_casilla(i)\n return @genes[i]\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end", "def to_s\n\t \tputs \"#{@autor}, #{@numero_paginas}, #{@isbn}, #{@valor}, #{@categoria}\"\n\t end", "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 describe_value(value)\r\n\t\t\tvalues.find(value.to_i).value\r\n\t\tend", "def details\n #\"#{title} #{active} x: #{ x },q: #{ q },z: #{ z },r: #{ r },y: #{ y }\"\n \"#{title} #{active} , q: #{ q },z: #{ z },r: #{ r } \"\n end", "def output_values(title, m, options={})\n print \"========== \", title, \" ==========\\n\"\n puts options[:sub_heading] if options[:sub_heading]\n printf \"%10s, %s\\n\", \"Count\", \"Value\"\n printf \"%10s, %s\\n\", \"-----\", \"-----\"\n count = 0\n max_items = options[:max_items] || 10000\n threshold = options[:min_threshold] || 0\n entries = m.sort_by {|k,v| v}.reverse\n entries.each do |k,v|\n break if v.is_a?(Integer) && v <= threshold\n if options[:show_titles]\n item = get_item_info(k)\n k = \"(#{k}) #{item[:title]}\"\n end\n printf \"%10s, %s\\n\", v, k\n count += 1\n break if count >= max_items\n end\n end", "def print_values\n print \"\\nRegister A: #{@register_a}\\tRegister B: #{@register_b}\\n\"\n print \"Zero Bit: #{@zero_bit}\\tOverflow Bit: #{@overflow}\\n\"\n print \"Program Counter: #{@pc}\\n\"\n print \"Memory: #{@memory}\\n\"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end", "def show boook\n\t\t\tputs @hash\n\t\t\t\n\t\tend", "def render\n print \" #{(1..9).to_a.join(\" \")}\".light_green.bold\n puts\n puts\n @grid.each.with_index do | row, row_indx |\n print \"#{row_indx + 1} \".light_green.bold\n row.each do | tile |\n if tile.revealed\n print \"#{VALUE_EMOJIS[tile.value]} \"\n elsif tile.flagged\n print \"#{FLAG} \"\n else \n print \"#{HIDDEN} \"\n end\n end\n puts\n puts\n end\n end", "def print_value\n\t\treturn @value\n\tend", "def show \r\n end", "def display\t\n \tstring = \"\\n +-----------------------+\".green\n \t@matrix.each_index{ |i|\n \tstring += \"\\n |\".green\n v = @matrix[i]\n \tv.each_index{|j|\n \t\tif (v[j] != 0)\n \t\t\tstring += \" \" + v[j].to_s\n \t\telse \n \t\t\tstring += \" .\"\n \t\tend\n \t\t\t\t\n \t\tif (j == 2 || j == 5 || j == 8)\n \t\t\tstring += \" |\".green\n \t\tend\n \t\t}\n \t\tif (i == 2 || i == 5)\n \t\t\tstring += \"\\n |-------+-------+-------|\".green\n \t\tend\n \t}\n \tstring += \"\\n +-----------------------+\".green\n\tend", "def show\n total_visit_hsh = Hash.new(:total_visit)\n total_visit_hsh[:total_visit] = total_visit\n unique_visit_hsh = Hash.new(:unique_visit)\n unique_visit_hsh[:unique_visit] = unique_visit\n [total_visit_hsh,unique_visit_hsh].map do |visiter|\n PrettyOutput.new(visiter.keys.first, visiter.values.first).formatted_result\n end\n end", "def info(inf = '1110')\n infarray = []\n infarray.push(\"ID-#{@user_id}\") unless inf[0].to_i.zero?\n infarray.push(\"ФИО-#{@usr_fio.values.join(' ')}\") unless inf[1].to_i.zero?\n infarray.push(\"Rate-#{rate}\") unless inf[2].to_i.zero?\n infarray.push(\"Occupation-#{occupation}\") unless inf[3].to_i.zero?\n infarray.compact.join(' ').to_s\n end", "def show\n @date = @detail_two.pay_strt_date-1.month\n \n @end_balance = @detail_two.loan\n @rate_per_period = @detail_two.rate / (100 * @detail_two.term)\n @period = @detail_two.term\n @dte, @pb, @pp, @intp, @tp, @eb = [], [], [], [], [], []\n for i in 1..(@detail_two.term) do\n @pb.push(@prev_balance = (@end_balance).round(2))\n @dte.push(@date = @date+1.month)\n @intp.push(@intrst = (@prev_balance * @rate_per_period).round(2))\n @tp.push(@total_pay = (@prev_balance * ((@rate_per_period*((1+@rate_per_period)**@period)) / (((1+@rate_per_period)**@period) - 1))).round(2))\n @pp.push(@princpl_pay = (@total_pay - @intrst).round(2))\n @eb.push(@end_balance = (@prev_balance - @princpl_pay).round(2))\n @period = @period - 1\n end\n \n if @detail_two.disburse_date.month == 1 || 3 || 5 || 7 || 8 || 10 || 12\n t = -1\n elsif @detail_two.disburse_date.month == 2\n y = @detail_two.disburse_date.year\n t = (y%4==0 && y%100!=0 || y%400==0) ? 1 : 2\n else\n t = 0 \n end\n\n d = ((@detail_two.pay_strt_date - @detail_two.disburse_date).to_int) + t\n k = @intp[0]\n @intp[0] = ((@intp[0] * d) / 30).round(2)\n @tp[0] = (@tp[0] -k + @intp[0]).round(2) \n \n\n\n\n end" ]
[ "0.6501059", "0.6495188", "0.6407713", "0.6407713", "0.63913995", "0.6331037", "0.6119649", "0.61172926", "0.6095494", "0.60821795", "0.6061574", "0.6047005", "0.60405606", "0.60279125", "0.6002495", "0.5999851", "0.59909844", "0.5969238", "0.5961776", "0.5958758", "0.5945336", "0.59406096", "0.5938713", "0.59305036", "0.5928798", "0.5918867", "0.59038377", "0.5889896", "0.5872218", "0.5856328", "0.5850787", "0.58362734", "0.5792308", "0.5792244", "0.5790915", "0.578949", "0.57773155", "0.577532", "0.5774149", "0.5771877", "0.57550186", "0.57548064", "0.57522535", "0.57491314", "0.5740982", "0.5738254", "0.5719842", "0.5699537", "0.56928307", "0.5690971", "0.5682691", "0.5670764", "0.5666177", "0.5662176", "0.5660798", "0.5656679", "0.5656652", "0.5656652", "0.5651989", "0.56462413", "0.56378293", "0.56311077", "0.5626101", "0.5598837", "0.5598741", "0.55978364", "0.55962896", "0.55861294", "0.55830663", "0.558243", "0.55793434", "0.5578564", "0.5577035", "0.5570583", "0.55629987", "0.55570215", "0.55555683", "0.55543286", "0.554888", "0.55449796", "0.5540435", "0.5538483", "0.5538483", "0.55362093", "0.5535144", "0.5530731", "0.5528086", "0.5527959", "0.55265015", "0.5524813", "0.5524813", "0.5524813", "0.5524813", "0.5523685", "0.5523113", "0.55154985", "0.5505698", "0.55041456", "0.5501939", "0.5499852", "0.5492957" ]
0.0
-1
executes easy_install command with the passed arguments
def ezy_install(*args) easy_install *args rescue NoMethodError => e if pathname = which('easy_install') self.class.commands :easy_install => pathname easy_install *args else raise e end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist_install_s( *args )\n if args.last.is_a?( Hash )\n args = args.dup\n opts = args.pop\n else\n opts = {}\n end\n\n args = dist_map_packages( args )\n\n if opts[ :succeed ]\n \"yum install -q -y #{args.join ' '} || true\"\n else\n \"yum install -q -y #{args.join ' '}\"\n end\n end", "def execute(sub_argv)\n require 'rubygems'\n require 'rubygems/commands/install_command'\n\n $logger.info \"InstallGem, sub_argv = #{sub_argv}\"\n\n options = {}\n\n # Parse the options\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio gem_install gem_name gem_version'\n o.separator ''\n o.separator 'Options:'\n o.separator ''\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"InstallGem command: #{argv.inspect} #{options.inspect}\")\n\n if argv == []\n $logger.error 'No gem name provided'\n return 1\n end\n gem_name = argv[0]\n gem_version = argv[1]\n\n cmd = Gem::Commands::InstallCommand.new\n cmd.handle_options [\"--no-ri\", \"--no-rdoc\", 'rake', '--version', '0.9'] # or omit --version and the following option to install the latest\n\n ARGV.clear\n ARGV << gem_name\n if gem_version\n ARGV << '--version'\n ARGV << gem_version\n end\n\n $logger.info \"Installing gem to #{ENV['GEM_HOME']}\"\n\n begin\n cmd.execute\n rescue => e\n $logger.error \"Error installing gem: #{e.message} in #{e.backtrace.join(\"\\n\")}\"\n exit e.exit_code\n rescue LoadError => e\n # DLM: gem install tries to load a Windows dll to access network functionality in win32/resolv\n # Ruby must be built with libffi to enable fiddle extension to enable win32 extension\n $logger.error \"gem_install command not yet implemented, requires fiddle extension\"\n #$logger.error \"#{e.message} in #{e.backtrace.join(\"\\n\")}\"\n return 1\n end\n\n $logger.info 'The gem was successfully installed'\n\n 0\n end", "def install\n #python executable files\n end", "def install\n system \"./configure\", *std_configure_args\n system \"make\", \"install\"\n end", "def install\n args = std_cmake_args\n system \"cmake\", \".\", *args\n system \"make install\"\n end", "def install\n cd_and_sh( pkg_dir, install_commands )\n end", "def install\n safe_system \"pax --insecure -rz -f Payload.gz -s ',./bin,#{bin},' -s ',./man,#{man},' -s ',./lib,#{lib},' -s ',./license_gpl_pdftk,#{prefix}/LICENSE,' -s ',./,#{prefix}/README/,'\"\n end", "def install_command\n if (RUBY_PLATFORM =~ /linux/ or RUBY_PLATFORM =~ /darwin/) and Process.uid != 0\n cmd = \"sudo gem install\"\n $gems_missing.each do |current_gem|\n cmd = cmd + \" #{current_gem}\"\n end\n if $gems_missing_version.length != 0\n $gems_missing_version.each do |current_gem|\n if cmd == \"sudo gem install\"\n cmd = cmd + \" #{current_gem}\"\n else\n cmd = cmd + \" && sudo gem install #{current_gem}\"\n end\n end\n end\n else\n cmd = \"gem install\"\n $gems_missing.each do |current_gem|\n cmd = cmd + \" #{current_gem}\"\n end\n if $gems_missing_version.length != 0\n $gems_missing_version.each do |current_gem|\n if cmd == \"gem install\"\n cmd = cmd + \" #{current_gem}\"\n else\n cmd = cmd + \" & gem install #{current_gem}\"\n end\n end\n end\n end\n cmd = cmd.delete \",\" \"'\"\n cmd = cmd.gsub(\"=\", \"-v\")\n return cmd\nend", "def install_command\n cmd = \"#{top.sudo} bash\"\n cmd += \" -s -- -v #{required_version}\" unless required_version.nil?\n cmd\n end", "def chef_gem(args)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/gem #{args}\", sudo: true\n end", "def install!\n cmd = [attributes.gem_binary, 'install']\n cmd << '-v' << attributes.version if attributes.version\n cmd << '--source' << attributes.source if attributes.source\n cmd << '--prerelease' if attributes.prerelease\n cmd << attributes.package_name\n\n run_command(cmd)\n end", "def install_packages(app)\n\n `installer -pkg \"#{app}\" -target /`\n\nend", "def execute\n begin\n version = options[:version] || Gem::Requirement.default\n\n (get_all_gem_names rescue [options[:name]]).each do |name|\n spec = find_gem(name, version)\n\n # we find rake and the rakefile first to eliminate needlessly installing\n # dependencies.\n find_rakefile(spec)\n rake_path = find_rake\n\n install_dependencies(spec)\n\n run_tests(spec, rake_path)\n end\n rescue Exception => e \n if @on_install\n raise e\n else\n terminate_interaction 1\n end\n end\n end", "def install_gem; end", "def install_command\n command = ['helm', 'upgrade', name, chart] +\n install_flag +\n reset_values_flag +\n optional_tls_flags +\n optional_version_flag +\n rbac_create_flag +\n namespace_flag +\n value_flag\n\n command.shelljoin\n end", "def install\n\tsystem \"make\"\n end", "def execute_installation\n #start logging\n set_log_file @options[:log]\n \n download_and_decompress(@options[:prefix], [REDIS_URL, SQLITE3_URL, NGINX_URL])\n \n install_redis if @options[:redis]\n install_sqlite\n configure_nginx @options\n\n install_all_gems\n install_rhoconnect\n \n #remove downloaded tarballs\n cleanup options[:prefix]\n end", "def install\n system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\"\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\", \"--disable-debug\", \"--disable-dependency-tracking\"\n# system \"cmake . #{cmake_std_parameters}\"\n system \"make install\"\n end", "def install\n command = resource_or_provider_command\n self.class.validate_command(command)\n\n command_options = get_install_command_options\n execute([command, command_options])\n end", "def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend", "def gem_install_command\n \"sudo gem install #{gem_name} -s http://gems.github.com\"\n end", "def run_installer_command(cmd)\n `#{cmd}`\n end", "def install\n system \"cargo\", \"install\", *std_cargo_args\n end", "def install\n system \"cargo\", \"install\", *std_cargo_args\n end", "def install cmd=nil, &block\n @install = cmd || block\n end", "def install_gem(gem_name)\n if gem_name.match(/getopt/)\n install_name = \"getopt\"\n else\n install_name = gem_name.gsub(/\\//,\"-\")\n end\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{gem_name}\"\nend", "def install uri\n execute(:install, uri)\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\", \"--disable-debug\", \"--disable-dependency-tracking\"\n# system \"cmake\", \".\", *std_cmake_args\n system \"make install\"\n end", "def install\n system \"cmake\", \"-S\", \".\", \"-B\", \"build\", *std_cmake_args\n system \"cmake\", \"--build\", \"build\"\n system \"cmake\", \"--install\", \"build\"\n end", "def install_command\n return \"brew install\" if in_path?(:brew)\n return \"sudo apt-get install\" if in_path?(\"apt-get\")\n return \"sudo yum install\" if in_path?(\"yum\")\n end", "def install_gem(name, options)\n installer = Gem::DependencyInstaller.new(options)\n\n temp_argv(options[:extconf]) do\n log \"Installing #{name}\"\n installer.install(name, options[:version])\n end\n end", "def install(packagename, force=false)\n\t\t\t\traise(InstallError, \"Automated package installation is not implemented on OpenBSD\")\n\t\t\tend", "def install\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\" \n end", "def install\n end", "def install\n bin.install \"#{PACKAGE_NAME}\"\n end", "def install\n yaourt('--noconfirm', '-Sy', @resource[:name])\n end", "def install\n args = std_cmake_args\n\n system \"cmake\", \".\", *args\n system \"make\", \"install\"\n prefix.install \"install_manifest.txt\"\n end", "def install(pkg)\n package pkg do\n action :install\n end\nend", "def install\n args = %w{install -q}\n if @resource[:source]\n args << \"-e\"\n if String === @resource[:ensure]\n args << \"#{@resource[:source]}@#{@resource[:ensure]}#egg=#{\n @resource[:name]}\"\n else\n args << \"#{@resource[:source]}#egg=#{@resource[:name]}\"\n end\n else\n case @resource[:ensure]\n when String\n args << \"#{@resource[:name]}==#{@resource[:ensure]}\"\n when :latest\n args << \"--upgrade\" << @resource[:name]\n else\n args << @resource[:name]\n end\n end\n args << pipproxyarg\n lazy_pip *args\n end", "def gem_install_args\n gem, version = config[:version].split(\"@\")\n if gem =~ /^\\d+\\.\\d+\\.\\d+/\n version = gem\n gem = \"busser\"\n end\n\n root = config[:root_path]\n gem_bin = remote_path_join(root, \"bin\")\n\n # We don't want the gems to be installed in the home directory,\n # this will force the bindir and the gem install location both\n # to be under /tmp/verifier\n args = gem\n args += \" --version #{version}\" if version\n args += \" --no-rdoc --no-ri --no-format-executable -n #{gem_bin}\"\n args += \" --no-user-install\"\n args\n end", "def install\n system \"make\"\n system \"make install PREFIX=#{prefix}\"\n end", "def install!(name:, dir: nil)\r\n end", "def install\n end", "def install\n end", "def run(args)\n safely_mkdir(MAIN_DIR)\n safely_mkdir(MOD_DIR)\n safely_mkdir(PACK_DIR)\n\n return HELP_TEXT if args.include?('-h') || args.include?('--help')\n return VERSION if args.include?('-v') || args.include?('--version')\n\n case args[0]\n when 'help'\n return HELP_COMMANDS[args[1].to_sym] if HELP_COMMANDS.key?(args[1].to_sym)\n return HELP_TEXT\n when 'fetch'\n return CommandFetch.run(args[1])\n when 'manifest'\n return CommandFetch.install_manifest(args[1])\n when 'installmod'\n return CommandInstall.run_mod(args[1])\n when 'installpack'\n return CommandInstall.run_pack(args[1]).to_s # remove\n else\n end\n end", "def install\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--prefix=#{prefix}\", '--verbose', '--with-beecrypt', '--without-archive', '--with-external-db', '--without-lua'\n system \"make\", \"install\"\n end", "def run_install(install_path)\n require 'fileutils'\n install_path ||= '.'\n FileUtils.mkdir_p install_path unless File.exists?(install_path)\n install_file \"#{CC_ROOT}/config/config.example.yml\", \"#{install_path}/config.yml\"\n install_file \"#{CC_ROOT}/config/config.example.ru\", \"#{install_path}/config.ru\"\n install_file \"#{CC_ROOT}/config/database.example.yml\", \"#{install_path}/database.yml\"\n install_file \"#{CC_ROOT}/actions\", \"#{install_path}/actions\", true\n end", "def autoinstall(*packages)\n all_packages_installed = packages.all? { |pkg| Path.which pkg }\n\n unless all_packages_installed\n cmd([\"sudo apt-get install ?\", packages.join(' ')])\n end\nend", "def pkg_cmd; \"#{pkg_binary}\" end", "def execute\n gemname = get_one_gem_name\n path = get_path(gemname, options[:version])\n if path\n require 'fileutils'\n target_dir = File.basename(path).sub(/\\.gem$/, '')\n FileUtils.mkdir_p target_dir\n Installer.new(path).unpack(File.expand_path(target_dir))\n say \"Unpacked gem: '#{target_dir}'\"\n else\n alert_error \"Gem '#{gemname}' not installed.\"\n end\n end", "def easy_install(package_path)\n upload_package(package_path)\n install_package\n end", "def rpm_install(packages, options={})\n install({:base => %w(wget alien) }, :base)\n send(run_method, \"wget -Ncq #{packages.join(' ')}\", options)\n files=packages.collect { |package| File.basename(package) }\n send(run_method, \"alien -i #{files.join(' ')}\", options)\n end", "def install_extras\n p\n p \"====================================\"\n p \"Installing a bevvy of useful utilities\"\n p \"====================================\"\n p\n run %{sudo apt upgrade -y}\n run %{sudo apt install -y zsh ctags git tmux xclip silversearcher-ag guake}\nend", "def gem_command(*args)\n # system('sudo', 'gem', *args)\n ::Gem::CommandManager.instance.find_command(args.shift).invoke(*args)\n end", "def install\n system \"./configure\", \"--disable-debug\",\n \"--prefix=#{prefix}\",\n \"--enable-guile2=yes\"\n system \"make\"\n system \"make\", \"install\"\n end", "def install args = []\n\t\t\tputs \"Starting to install ...\"\n\n\t\t\t# step 1, run migration files\n\t\t\tdb args\n\n\t\t\t# step 2, run the gemfile\n\t\t\tbundle args\n\n\t\t\t# step 3, submit the data to database\n\t\t\tsubmit args\n\n\t\t\tputs \"Successfully installed\"\n\t\tend", "def install(dry = false)\n create_dirs(dry) unless @needs_dir.nil?\n link(dry) unless @links.nil?\n run_shell_commands(dry) unless @commands.empty?\n end", "def install(name:, dir: nil)\r\n end", "def install_plugin(plugin_url)\n system(\"#{ruby_bin} #{plugin_script} install #{plugin_url}\")\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\"\n system \"make\"\n system \"make\", \"install\"\n end", "def install\n ENV.deparallelize\n inreplace \"aqbanking-config.in.in\", \"@PKG_CONFIG@\", \"pkg-config\"\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--prefix=#{prefix}\",\n \"--enable-cli\"\n # This is banking software, so let's run the test suite.\n system \"make\", \"check\"\n system \"make\", \"install\"\n end", "def install(env); end", "def run_package_command(cmd)\n if cmd.is_a?(Array)\n command = cmd[0]\n cmd_options.merge!(cmd[1])\n else\n command = cmd\n end\n\n shellout!(command, cwd: config.package_dir)\n end", "def install\n args = %w{install -q}\n if @resource[:source]\n args << \"-e\"\n if String === @resource[:ensure]\n args << \"#{@resource[:source]}@#{@resource[:ensure]}#egg=#{\n @resource[:name]}\"\n else\n args << \"#{@resource[:source]}#egg=#{@resource[:name]}\"\n end\n else\n case @resource[:ensure]\n when String\n args << \"#{@resource[:name]}==#{@resource[:ensure]}\"\n when :latest\n args << \"--upgrade\" << @resource[:name]\n else\n args << @resource[:name]\n end\n end\n lazy_pip *args\n end", "def install\n args = %w{install -q}\n if @resource[:source]\n args << \"-e\"\n if String === @resource[:ensure]\n args << \"#{@resource[:source]}@#{@resource[:ensure]}#egg=#{\n @resource[:name]}\"\n else\n args << \"#{@resource[:source]}#egg=#{@resource[:name]}\"\n end\n else\n case @resource[:ensure]\n when String\n args << \"#{@resource[:name]}==#{@resource[:ensure]}\"\n when :latest\n args << \"--upgrade\" << @resource[:name]\n else\n args << @resource[:name]\n end\n end\n lazy_pip *args\n end", "def install\n system \"go\", \"install\"\n end", "def install\n system \"make\", \"prefix=#{prefix}\", \"install\"\n end", "def install\r\n automated_install {\r\n installer = Gem::Installer.new( @gem_path,\r\n :domain => :both,\r\n :generate_rdoc => true,\r\n :generate_ri => true,\r\n :force => true,\r\n :test => false,\r\n :wrappers => true,\r\n :install_dir => Gem.dir,\r\n :security_policy => nil\r\n )\r\n installer.install\r\n }\r\n end", "def install\n bin.install \"sack\", \"sag\", \"sgrep\", \"F\"\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\"\n system \"make install\"\n end", "def install\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--enable-introspection\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\"\n end", "def gem_install(jruby, basedir, gemname, quiet = false)\n if gemname.include?(\",\")\n g, v = gemname.split(\",\",2)\n cmd(\"#{jruby} -S gem install -i #{basedir} #{g} -v=#{v}\", quiet)\n else\n cmd(\"#{jruby} -S gem install -i #{basedir} #{gemname}\", quiet)\n end\n end", "def install\n # use the brew python to install the tools needed\n\t system 'python', 'setup.py', 'install', \"--prefix=#{prefix}\", \"--single-version-externally-managed\", \"--record=installed.txt\"\n\n\n # install the gyp executable\n bin.install(\"gyp\")\n bin.install(\"gyp_main.py\")\n end", "def install\n \n end", "def install\n # nothing to do\n end", "def wix_run binary, arguments\n Rake.sh \"\\\"#{wix_path binary}\\\" #{arguments}\"\n end", "def usage\n puts \"USAGE:\"\n puts \"\\t\" + __FILE__ + \" [ARGUMENTS]\"\n print \"\\n\"\n puts \"Installs the ServerUtils to the systems bin directory (Default: #{DEF_INSTALL_DIR}) and generates a config file.\"\n puts \"If you don't like the default values for the config file you can use flags to change them (run \" + \"#{__FILE__} -sc\".yellow + \" to see the default config)\"\n puts \"The installation is based around the idea to keep all the SU files at one place (preferred if you cloned this via git).\"\n puts \"So the installation doesn't move or copy any files, instead it links them to their current location.\"\n puts \"(So don't [re]move this directory after installation!)\".red\n print \"\\n\"\n puts \"Example:\"\n puts \"\\t\" + __FILE__ + \" -c\"\n puts \"\\t\" + __FILE__ + \" -d /usr/sbin\"\n puts \"\\nArguments:\"\n puts \"\\t-h, --help\\t\\t\\tShow this information\"\n puts \"\\t-s, --simulate\\t\\t\\tSimulate everything, don't making any real changes\"\n print \"\\n\"\n \n puts \"\\t-d, --dir DIR\\t\\t\\tThe directory where the scripts should be installed (should be in $PATH) (defaults to #{DEF_INSTALL_DIR})\"\n puts \"\\t\\t\\t\\t\\tWARNING: The script will stop with an error if the files already exists!\".yellow\n puts \"\\t-c, --just-config\\t\\tJust generate the config file, don't do any installing!\"\n puts \"\\t-n, --no-config\\t\\t\\tDon't generate a config (useful if you already have a su_config.rb)'\"\n puts \"\\t-r, --install-requirements\\tInstall all the dependecies of SU (note: adds to the execution time!)\"\n puts \"\\t-F, --force-install\\t\\tForces the install, overwrites files in the install directory if they exists (\" + \"Be careful with this!\".red + \")\"\n puts \"\\t-E, --keep-ext\\t\\t\\tKeep the .rb extensions on the files when installing them\"\n puts \"\\t\\t\\t\\t\\t(then you have to write \" + \"addemailaccount.rb arthur@example.com\".yellow + \" instead of \" + \"addemailaccount arthur@example.com\".yellow + \")\"\n print \"\\n\"\n puts \"\\t-D, --db-name NAME\\t\\tSet the database name to NAME\"\n puts \"\\t-U, --db-user USER\\t\\tSet the database user to USER\"\n puts \"\\t-P, --db-password PASSWORD\\tSet the database password to PASSWORD\"\n puts \"\\t-u, --user-table TABLE\\t\\tSet the database table to TABLE\"\n puts \"\\t-t, --domain-table TABLE\\t\\tSet the database table to TABLE\"\n puts \"\\t-a, --alias-table TABLE\\t\\tSet the database table to TABLE\"\n puts \"\\t-i, --id ID\\t\\t\\tSet the default id (gid & uid) to ID (could be numeric or name [like \" + \"vmail\".yellow + \"], used to set the system/file owner of the mailboxes)\"\n\n # We also exit the script here..\n exit(0)\nend", "def install(packagename, force=false)\n\t\t\t\tpackagename.strip!()\n\n\t\t\t\t# FIXME - check to see if it is already installed\n\n\t\t\t\tCfruby.controller.attempt(\"Installing \\\"#{packagename}\\\"\", 'destructive', 'unknown', 'install') {\n\t\t\t\t\t`#{@finkbin} install '#{packagename.gsub(/(\\')/, \"\\\\\\1\")}'`\n\t\t\t\t}\n\t\t\tend", "def install(packagename, force=false)\n\t\t\t\tpackagename.strip!()\n\n\t\t\t\t# FIXME - check to see if it is already installed\n\n\t\t\t\tCfruby.controller.attempt(\"Installing \\\"#{packagename}\\\"\", 'destructive', 'unknown', 'install') {\n\t\t\t\t\t`#{@rpmbin} -i '#{packagename.gsub(/(\\')/, \"\\\\\\1\")}'`\n\t\t\t\t}\n\t\t\tend", "def install(path)\n gem 'install', '-q', path\n end", "def install\n system \"make\"\n pkgshare.install Dir[\"bin/*.R\"]\n pkgshare.install Dir[\"bin/*.r\"]\n rm Dir[\"bin/*.R\"]\n rm Dir[\"bin/*.r\"]\n bin.install Dir[\"bin/*\"]\n bin.install \"fastahack/fastahack\"\n pkgshare.install \"samples\"\n end", "def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end", "def action_install\n run_package_action(:install)\n end", "def install(url, commands)\n raise \"Invalid url: \" + url if url !~/^https?:\\/\\/.+\\/([^\\/]+)$/\n filename = $1\n raise 'unknown suffix: ' + filename if filename !~/^(.+)\\.tar\\.(bz2|gz)$/\n dirname = $1\n archive = $2\n systemOrDie('wget', url)\n if archive == 'bz2'\n systemOrDie('tar', 'xjvf', filename)\n elsif archive == 'gz'\n systemOrDie('tar', 'xzvf', filename)\n else\n raise 'unexpected archive type: ' + archive\n end\n FileUtils.cd(dirname) {\n commands.each{|cmd|\n systemOrDie(*cmd)\n }\n }\n end", "def install\n args = %W[\n --disable-debug\n --disable-dependency-tracking\n --prefix=#{prefix}\n ]\n\n if build.head?\n system \"./autogen.sh\", *args\n else\n system \"./configure\", *args\n end\n\n system \"make\", \"install\"\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\",\n \"--target=i386-jos-elf\",\n \"--disable-multilib\",\n \"--disable-nls\",\n \"--disable-werror\"\n system \"make\"\n system \"make\", \"install\"\n end", "def install\n # ENV.deparallelize # if your formula fails when building in parallel\n\n # Remove unrecognized options if warned by configure\n system \"git init && git submodule init && git submodule update\"\n bin.install \"install-dot-files\"\n end", "def install\n system \"make\"\n system \"make\", \"PREFIX=#{prefix}\", \"install\"\n end", "def install_gem\n Juwelier::Commands::InstallGem.build_for(self).run\n end", "def install\n bin.install \"testscript\"\n end", "def install_dependencies\n\t\tself.prompt.say \"Installing dependencies\"\n\t\truby '-S', 'gem', 'i', '-Ng'\n\tend", "def bundle args = []\n\t\t\tputs \"Starting to bunlde gemfile for modules ...\"\n\t\t\targs = Smods.keys if args.empty?\n\n\t\t\targs.each do | module_name |\n\t\t\t\tpath = \"#{Smods[module_name]}#{Spath[:gemfile]}\"\n\t\t\t\tif File.exist? path\n\t\t\t\t\t`bundle install --gemfile=#{path}`\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Successfully implemented\"\n\t\tend", "def install\n system \"autoreconf\", \"-fiv\" if build.head?\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\"\n end", "def install(options = {})\n require_relative '../installer'\n\n installer = Gem::Installer.for_spec spec, options\n\n yield installer if block_given?\n\n installer.run_pre_install_hooks\n installer.build_extensions\n installer.run_post_build_hooks\n installer.generate_bin\n installer.run_post_install_hooks\n end", "def install_package_with_rpm(name, cmdline_args = '', opts = {})\n proxy = ''\n if name =~ /^http/ and opts[:package_proxy]\n proxy = extract_rpm_proxy_options(opts[:package_proxy])\n end\n execute(\"rpm #{cmdline_args} -Uvh #{name} #{proxy}\")\n end", "def install\n cmd = %w{--noconfirm --noedit --deps --builddir /tmp}\n cmd += install_options if @resource[:install_options]\n cmd << \"-S\" << @resource[:name]\n\n aurget(*cmd)\n\n unless self.query\n fail(\"Could not find package '#{@resource[:name]}'\")\n end\n end", "def install(options = {})\n yield nil\n end", "def install(options = {})\n yield nil\n end", "def install\n end" ]
[ "0.68979686", "0.67946815", "0.6308114", "0.6296184", "0.62498754", "0.62241715", "0.6200244", "0.61983836", "0.61692244", "0.6168601", "0.6148906", "0.61445975", "0.6132253", "0.61254644", "0.61213946", "0.60783046", "0.60333896", "0.6031039", "0.6027059", "0.5995982", "0.5990482", "0.5989048", "0.59798115", "0.5975543", "0.5975543", "0.595111", "0.59331214", "0.5929557", "0.59142375", "0.5902869", "0.58910644", "0.58806556", "0.587252", "0.5855152", "0.5854875", "0.58512837", "0.58496505", "0.5848756", "0.5840218", "0.58374006", "0.5815754", "0.58133155", "0.58091944", "0.58040506", "0.58040506", "0.58037835", "0.5802021", "0.5798817", "0.57935375", "0.5790474", "0.57899046", "0.57803094", "0.576964", "0.57675576", "0.5745638", "0.57281005", "0.5718478", "0.57083935", "0.57039624", "0.5698764", "0.5698613", "0.56981117", "0.5691491", "0.56836164", "0.56619245", "0.56619245", "0.5656093", "0.5621684", "0.56178415", "0.56128764", "0.5612464", "0.5607472", "0.5604939", "0.56036204", "0.55854005", "0.5582818", "0.5579259", "0.557801", "0.55711997", "0.55679995", "0.5563197", "0.5560341", "0.55566424", "0.5544405", "0.55377054", "0.5533687", "0.55299944", "0.5525055", "0.5523418", "0.5523213", "0.5518771", "0.5512615", "0.5503725", "0.550309", "0.5490461", "0.5487231", "0.5484057", "0.5480497", "0.5480497", "0.5478644" ]
0.76981574
0
executes pip command with the passed arguments
def PiP(*args) pip *args rescue NoMethodError => e if pathname = which('pip') self.class.commands :pip => pathname pip *args else raise e end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pip_command\n %w(pipenv run pip)\n end", "def lazy_pip(*args)\n pip2 *args \n rescue NoMethodError => e\n self.class.commands :pip => pip2_cmd\n pip *args\n end", "def lazy_pip(*args)\n pip(*args)\n rescue NoMethodError => e\n if which(self.class.cmd)\n # @note From provider.rb; It is preferred if the commands are not entered with absolute paths as this allows puppet\n # to search for them using the PATH variable.\n # After pip has upgraded pip, the new path is in /usr/local/bin/pip, which needs to be looked up again. The below approach ensures this\n self.class.commands :pip => self.class.cmd\n pip(*args)\n else\n raise e, 'Could not locate the pip command.', e.backtrace\n end\n end", "def execpipe(command, *args)\n # Puppet 2.7 would join with '', but we wish ' ' (spaces) between args..\n command_str = command.respond_to?(:join) ? command.join(' ') : command\n execpipe_method.call(command_str, *args) { |pipe| yield pipe }\n end", "def execpipe(*args, &block)\n Puppet::Util::Execution.execpipe(*args, &block)\n end", "def pipe(*cmd, stdin: nil)\n IO.popen(cmd, \"r+\", err: %i[child out]) do |io|\n io.write stdin if stdin\n io.close_write\n io.read\n end\nend", "def pipe(*cmds)\n s = cmds.map { |x| x.join(\" \") }\n s = s.join(\" | \")\n STDERR.puts \"+ #{s}\"\n Open3.pipeline(*cmds).each do |status|\n unless status.success?\n error \"Piped command failed\"\n exit 1\n end\n end\n end", "def run_package_command(cmd)\n if cmd.is_a?(Array)\n command = cmd[0]\n cmd_options.merge!(cmd[1])\n else\n command = cmd\n end\n\n shellout!(command, cwd: config.package_dir)\n end", "def shell_commands(cmd, args); end", "def git command, *args\n run 'git', command.to_s, *args\nend", "def pip2_cmd\n return self.class.pip2_cmd\n end", "def shell_commands(cmd, *args); end", "def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end", "def command_exec(name, *args)\n shell_exec command_for(name, *args)\n end", "def run(*command)\n IO.popen(command) { |io| io.read.strip }\n end", "def git(*args)\n IO.popen(\"-\", \"r\") do |io|\n if io\n yield io\n else\n #STDERR.puts [GIT_BIN, \"--git-dir\", @git_dir, *args].inspect\n exec(GIT_BIN, \"--git-dir\", @git_dir, *args)\n end\n end\n end", "def call(argv)\n generate_commands.run(argv)\n end", "def gem_command(*args)\n # system('sudo', 'gem', *args)\n ::Gem::CommandManager.instance.find_command(args.shift).invoke(*args)\n end", "def execute_command(command, options = {})\n executor = options[:execpipe] || method(:execpipe)\n args = [command]\n args << options[:failonfail] if options.include?(:failonfail)\n executor.call(*args) { |pipe| yield pipe }\n end", "def run_app(command, arguments)\nend", "def run(*args, &block)\n IO.popen([path, *args]) do |io|\n block ? io.each(&block) : io.read\n end\n end", "def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend", "def exec(cmd, *rest) end", "def script(subcommand, *args); end", "def script(subcommand, *args); end", "def cmd(options={})\n arguments\n end", "def git(*args)\n system \"git \" + args.join(\" \")\nend", "def _run(argv = [])\n execute(parse_options(argv))\n end", "def system cmd, *args\n ohai \"#{cmd} #{args*' '}\".strip\n\n if ARGV.verbose?\n safe_system cmd, *args\n else\n rd, wr = IO.pipe\n pid = fork do\n rd.close\n $stdout.reopen wr\n $stderr.reopen wr\n exec(cmd, *args) rescue nil\n exit! 1 # never gets here unless exec threw or failed\n end\n wr.close\n out = ''\n out << rd.read until rd.eof?\n Process.wait\n unless $?.success?\n puts out\n raise\n end\n end\n rescue SystemCallError\n # usually because exec could not be find the command that was requested\n raise\n rescue \n raise BuildError.new(cmd, args, $?)\n end", "def ps(*args) = execute(args: args)", "def args(argv)\n Docopt.docopt(docopt, version: @version, argv:argv)\n end", "def run_command(cmd, *args)\n r,w = IO.pipe\n\n pid = fork do\n r.close\n STDIN.close\n STDOUT.reopen(w)\n STDERR.reopen(w)\n\n exec(cmd, *args)\n end\n\n w.close\n output = r.read.force_encoding('binary')\n pid, status = Process::wait2(pid)\n\n [output, status]\n end", "def chef_gem(args)\n @ssh.exec! \"#{CHEF_RUBY_INSTANCE_BASE}/bin/gem #{args}\", sudo: true\n end", "def run_installer_command(cmd)\n `#{cmd}`\n end", "def run_command(cmd, *args)\n raise ArgumentError.new('missing required cmd to run') if cmd.nil?\n rd, wr = IO.pipe\n if fork\n wr.close\n if block_given?\n rd.each { |line| yield(line) }\n else\n rd.read\n end\n rd.close\n Process.wait\n return $?\n else\n rd.close\n $stdin.close\n $stdout.reopen(wr)\n $stderr.reopen(wr)\n exec cmd, *args\n raise \"exec #{cmd} failed\"\n end\nend", "def |(cmd)\n IO.popen(cmd.to_s, 'r+') do |pipe|\n pipe.write(self)\n pipe.close_write\n pipe.read.strip\n end\n end", "def exec_args\n exec(*@args.to_exec)\n end", "def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end", "def process(args)\n args\n end", "def run(argv, req = nil)\n inst, operands = from_argv(argv)\n\n # find standard input reader\n stdin_reader = if req && req.respond_to?(:stdin_reader)\n req.stdin_reader\n else \n Reader.coerce($stdin)\n end\n\n # normalize operands\n operands = [ stdin_reader ] + Array(operands)\n operands = operands.collect{|op| \n Iterator.coerce(op, req && req.environment)\n }\n operands = if nullary?\n []\n elsif unary?\n operands.last\n elsif binary?\n operands[-2..-1]\n end\n\n inst.pipe(operands, req && req.environment)\n inst\n end", "def shell_command(files, options={})\n loadpath = options[:loadpath]\n requires = options[:requires]\n\n cmd = []\n cmd << \"ruby\" # \"bundle exec ruby\"\n cmd << loadpath.map{ |i| %{-I\"#{i}\"} }.join(' ') unless loadpath.empty?\n cmd << requires.map{ |r| %{-r\"#{r}\"} }.join(' ') unless requires.empty?\n #cmd << \"-r minitest/unit\"\n cmd.concat(files)\n cmd << \"| tapout\"\n cmd << \"-t #{trace}\" if @trace\n cmd << \"--no-ansi\" unless @ansi\n cmd << @format\n cmd = cmd.join(' ')\n\n return cmd\n\n #puts cmd if $DEBUG\n #system cmd\n end", "def pip_install(file, target)\n Rake::FileUtilsExt.sh(\n \"pip install --requirement=#{file} --target=#{target} \" \\\n \"--ignore-installed\"\n )\n end", "def git_exec(command, *args)\n Dir.chdir(@grit_repo.working_dir) do\n %x{git #{command} #{args.join(' ')}}\n end\n end", "def command_for(args)\n [vite_env].tap do |cmd|\n cmd.append('node', '--inspect-brk') if args.include?('--debug')\n cmd.append('node', '--trace-deprecation') if args.delete('--trace-deprecation')\n cmd.append(*vite_executable(cmd))\n cmd.append(*args)\n cmd.append('--mode', ViteRuby.mode) unless args.include?('--mode') || args.include?('-m')\n end\n end", "def pipe_reader(*args)\n # avoid shell expansion using fork/exec\n reader, writer = IO.pipe\n pid = fork\n if pid\n writer.close\n yield(reader)\n Process.waitpid(pid)\n else\n begin\n reader.close\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(writer)\n exec(*args)\n rescue => e\n # prevent child from jumping out of this scope and continuing main program\n STDERR.puts(e.to_s)\n end\n exit! # will only reach here if exec() failed\n end\n end", "def run\n # Pure git-feats command\n case @args[0]\n when \"feats\"\n run_feats_cmd\n\n # Overriden git command\n when \"version\" || \"--version\"\n version\n\n # Pure git command\n else\n exec_args\n end\n end", "def run(command)\n if !command.kind_of?(Array)\n cmd = [command]\n else\n cmd = command\n end\n\n cmd.each { |line|\n puts line\n IO.popen(line) { |io|\n io.each_char do |c|\n print c\n end\n }\n }\n\nend", "def install\n args = %w{install -q}\n if @resource[:source]\n args << \"-e\"\n if String === @resource[:ensure]\n args << \"#{@resource[:source]}@#{@resource[:ensure]}#egg=#{\n @resource[:name]}\"\n else\n args << \"#{@resource[:source]}#egg=#{@resource[:name]}\"\n end\n else\n case @resource[:ensure]\n when String\n args << \"#{@resource[:name]}==#{@resource[:ensure]}\"\n when :latest\n args << \"--upgrade\" << @resource[:name]\n else\n args << @resource[:name]\n end\n end\n args << pipproxyarg\n lazy_pip *args\n end", "def run(command, *args)\n command_name = \"lxc-#{command}\"\n\n unless BIN_FILES.include?(command_name)\n raise ArgumentError, \"Invalid command: #{command_name}.\"\n end\n\n cmd = \"\"\n cmd << \"sudo \" if use_sudo == true\n cmd << \"#{command_name} #{args.join(\" \")}\".strip\n cmd << \" | #{yield}\" if block_given?\n\n # Debug if LXC_DEBUG env is set\n if ENV[\"LXC_DEBUG\"]\n puts \"Executing: #{cmd}\"\n end\n\n out = `#{cmd.strip}`\n end", "def pipe(command)\n output = \"\"\n IO.popen(command) do |io|\n until io.eof?\n buffer = io.gets\n output << buffer\n puts buffer\n end\n end\n\n output\n end", "def execute_command(args, capture: false)\n if capture\n Open3.capture3(*command_for(args), chdir: ViteRuby.config.root)\n else\n Dir.chdir(ViteRuby.config.root) { Kernel.exec(*command_for(args)) }\n end\n end", "def command_raw(args)\n\n end", "def run(*args)\n stdin, stdout, stderr, process = Open3.popen3(*args)\n out = stdout.read.strip\n err = stderr.read.strip\n\n [stdin, stdout, stderr].each(&:close)\n [process.value, out + err]\n end", "def run_command(command, *args)\n `#{command} #{args.join(' ')} 2>/dev/null`\n end", "def svn command, *args\n run 'svn', command.to_s, *args\nend", "def command(command)\n IO.pipe do |read_io, write_io|\n pid = Process.spawn(command, :in => \"/dev/tty\", :out => write_io)\n Process.wait(pid)\n raise \"Command failed: #{command.inspect}\" unless $?.success?\n write_io.close\n read_io.read\n end\n end", "def exec(args)\n cmd = if args.kind_of?(Array)\n Shellwords.join(args)\n else\n args\n end\n\n exec_command(cmd)\n end", "def command_setup(args)\n setup(args)\n end", "def pipproxyarg\n proxy = getproxy\n return ((proxy != nil) ? [\"--proxy\", proxy] : [])\n end", "def call(args)\n process(args)\n end", "def call(*command); end", "def execute_command(*argv)\n command = argv.flatten.reject(&:blank?).join(\" \\\\\\n \")\n if settings[:dry_run]\n log.info(\"Dry run:\")\n puts command\n else\n output = `#{command}`\n puts output unless output.empty?\n end\n end", "def run_command(cmd, *args)\n raise ArgumentError.new('missing required cmd to run') if cmd.nil?\n rd, wr = IO.pipe\n if fork\n wr.close\n if block_given?\n rd.each { |line| yield(line) }\n else\n rd.read\n end\n rd.close\n Process.wait\n else\n rd.close\n $stdout.reopen(wr)\n $stderr.reopen(wr)\n exec cmd, *args\n raise \"exec #{cmd} failed\"\n end\n $? == 0 # return a bool indicating a successful exit\nend", "def commander(*cmds)\n pids = cmds.map { |cmd| Process.spawn(\"bundle exec #{cmd}\") }\n\n trap('INT') {\n pids.each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }\n puts '==> Stopped!'\n exit 0\n }\n pids.each { |pid| Process.wait(pid) }\nend", "def command_monit(command, arguments=\"\")\n c = Capistrano::BaseHelper.get_capistrano_instance\n c.run(\"#{c.sudo} monit #{arguments} #{command}\")\n end", "def execute\n unless args.skip?\n if args.chained?\n execute_command_chain\n else\n exec(*args.to_exec)\n end\n end\n end", "def run_pipe(options, driver)\n\n pipe = RPipe.new(driver)\n pp pipe if options[:debug]\n\n if options[:only_given]\n \tcase options[:only]\n \twhen \"recon\"\n \t\tpipe.recon_jobs.each { |job| job.perform }\n \twhen \"preproc\"\n \t\tpipe.preproc_jobs.each { |job| job.perform }\n \twhen \"stats\"\n \t\tpipe.stats_jobs.each { |job| job.perform }\n \tend\n else\n \tpipe.recon_jobs.each { |job| job.perform }\n \tpipe.preproc_jobs.each { |job| job.perform }\n \tpipe.stats_jobs.each { |job| job.perform }\n end\nend", "def invoke(argv)\n system(\n argv.join(' ')\n )\n end", "def pipe!(*cmd)\n require 'open3'\n\n Open3.popen3(*cmd) do |si, so, _thread|\n queue = []\n each_range do |range|\n si.write(range.get)\n queue.concat(range.to_a)\n end\n\n si.close\n output = so.read\n\n return if queue.empty?\n\n buffer.undo_record do |record|\n record.delete(*queue)\n record.insert(queue.first, output.chomp)\n end\n end\n end", "def cmd_run argv\n setup argv\n uuid = @hash['uuid']\n if @hash['boolean'].nil?\n rename = \"\"\n else\n rename = @hash['boolean']\n end\n response = @api.run(uuid, rename)\n msg response\n return response\n end", "def execute(*args)\n set_config('gist.api-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.api-url')\n set_config('gist.default-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.default-url')\n\n begin\n option_parser.parse!(args)\n\n if $stdin.tty? && options.setup_credentials\n api_url # make sure API URL selection happens, if need be\n setup_credentials\n exit 1\n end\n\n if $stdin.tty? && args[0] != '-'\n # Run without stdin.\n usage if args.empty?\n\n files = args.inject([]) { |list, file|\n # Check if arg is a file. If so, grab the content.\n abort \"Can't find #{file}\" unless File.exists?(file)\n\n list.push({\n :input => File.read(file),\n :filename => file,\n :extension => file.include?('.') ? File.extname(file) : options.gist_extension\n })\n }\n else\n # Read from standard input.\n input = $stdin.read\n files = [{:input => input, :extension => options.gist_extension}]\n end\n\n url = write(files, options.private_gist, options.description)\n browse(url) if options.browse_enabled\n $stdout.puts copy(to_embed(url)) if options.embed_enabled\n $stdout.puts copy(url) unless options.embed_enabled\n rescue Interrupt\n $stderr.puts \"\\nQuit.\"\n exit 1\n rescue OptionParser::InvalidOption => e\n warn e; puts\n usage\n exit 1\n rescue StandardError => e\n options.debug ? warn(e) : raise(e)\n end\n end", "def maven(*goals)\n Dir.chdir(\"./recipeminer-java\") { |path| system('/usr/bin/mvn', *goals)}\nend", "def exec(cmd, options = {})\n Git.invoke :before_read\n\n options = {\n '-f' => @file\n }.merge(options)\n\n params = ''\n options.each do |key, val|\n params << \" #{key} #{Escape.shell_single_word(val)}\"\n end\n\n command = \"#{bin} #{params} #{cmd}\"\n\n `#{command}`.rstrip\n end", "def command(command, *args, &block)\n @output.print(command, args.size > 0 ? ' ' : '', args.join(' '), \"\\r\\n\")\n if block\n if @pipeline\n @pipeline << block\n else\n block.call\n end\n end\n end", "def process(options = {})\n command = command_line(options)\n Kernel.system(command)\n end", "def run(*args)\n cli.run(*args)\n end", "def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end", "def exec_cmd(cmd, flags, args)\n # always add the git dir to the cmd to ensure that git is executed\n # within the expected repo\n gd_flag = \"--git-dir=\\\"#{@git_dir}\\\"\"\n wt_flag = \"--work-tree=\\\"#{@repo_root}\\\"\"\n flag_str = flags.join(\" \")\n git_cmd = \"git #{gd_flag} #{wt_flag} #{cmd} #{flag_str} #{args}\"\n Giblog.logger.debug { \"running: #{git_cmd}\" }\n Open3.capture3(git_cmd.to_s)\n end", "def git(*args)\n cmd(*['git'] + args)\n end", "def git(*args)\n cmd(*['git'] + args)\n end", "def spawn(args)\n Gerrit::Subprocess.spawn(args)\n end", "def wc(*args) run_command('wc', args) end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def execute(command)\n system \"#{command}\" # rubocop:disable UnneededInterpolation\nend", "def run(argv, capture: false)\n Dir.chdir(config.root) {\n cmd = command_for(argv)\n capture ? capture3_with_output(*cmd, chdir: config.root) : Kernel.exec(*cmd)\n }\n rescue Errno::ENOENT => error\n raise ViteRuby::MissingExecutableError, error\n end", "def execute(bin, arguments, options)\n resolve_bin!(bin)\n\n cmd_args = [bin, *arguments].map(&:to_s)\n\n if @image_optim.verbose\n run_command_verbose(cmd_args, options)\n else\n run_command(cmd_args, options)\n end\n end", "def new_pipe\n IO.popen(@cmdline, 'r+')\n end", "def run\n if options_valid? && option_combinations_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def exec!(cmd, *args)\n cmd = Command.new(cmd, args)\n cmd.exec!\n end", "def execute\n begin\n version = options[:version] || Gem::Requirement.default\n\n (get_all_gem_names rescue [options[:name]]).each do |name|\n spec = find_gem(name, version)\n\n # we find rake and the rakefile first to eliminate needlessly installing\n # dependencies.\n find_rakefile(spec)\n rake_path = find_rake\n\n install_dependencies(spec)\n\n run_tests(spec, rake_path)\n end\n rescue Exception => e \n if @on_install\n raise e\n else\n terminate_interaction 1\n end\n end\n end", "def execute(*args)\n Puppet::Util::Execution.execute(*args)\n end", "def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend", "def pip_ansible(venv)\n ansibin = File.join(venv, 'bin', 'ansible')\n File.executable?(ansibin) || `#{venv}/bin/pip install ansible markupsafe`\nend", "def execute(command, *argN)\n # Determine the options\n options = argN.last.is_a?(Hash) ? argN.pop : {}\n options = {\n workdir: @workdir_path,\n notify: [:stdin, :stderr, :stdout]\n }.merge(options)\n\n # Add the options to be passed on\n argN << options\n\n # Execute\n Support::Subprocess.execute(command, *argN) do |type, data|\n yield type, data if block_given?\n end\n end", "def Pipeable(*args)\n Pipeable.for(*args, caller: self)\n end", "def invoke(*argv)\n return invoke_cache[argv] if invoke_cache.has_key? argv\n\n arguments = argv.dup\n options = (arguments.last.is_a? Hash) ? arguments.pop : {}\n executable = File.expand_path('../../../bin/myaso', __FILE__)\n\n Open3.popen3(executable, *arguments) do |i, o, *_|\n i.puts options[:stdin] if options[:stdin]\n i.close\n invoke_cache[argv] = o.readlines.map(&:chomp!)\n end\n end", "def run_lazy(*command)\n\t\t\tr=nil\n\t\t\tIO.popen(command) do |f|\n\t\t\t\tr=f.each_line.lazy\n\t\t\tend\n\t\t\tr\n\t\tend", "def execute\n warn 'executing fpm app spec task, but there are no input files [fpm_app_spec::task#execute]' if\n @opts.get(:files).empty?\n\n fpm_package @opts.get(:out), @opts.get(:files)\n end", "def run_cmd(input); end", "def command(args = {}, escape = true)\n SSH.command compile(args), escape\n end" ]
[ "0.6875272", "0.65148634", "0.62955606", "0.62605983", "0.62236756", "0.5959701", "0.5856561", "0.57957506", "0.5756658", "0.57522005", "0.57299125", "0.56577927", "0.55657095", "0.5563142", "0.5540965", "0.55380595", "0.5515961", "0.5505535", "0.547428", "0.5466009", "0.5457191", "0.54517734", "0.54390484", "0.5412792", "0.5412792", "0.53904825", "0.53847", "0.5380498", "0.5376503", "0.5373071", "0.53654945", "0.5364974", "0.53624296", "0.5358751", "0.53493804", "0.53342277", "0.5331174", "0.532812", "0.53187346", "0.5294959", "0.5293066", "0.5290783", "0.5289527", "0.5274975", "0.5270745", "0.5257139", "0.5230829", "0.52273893", "0.5225363", "0.5218169", "0.52070695", "0.5203996", "0.5177651", "0.5176042", "0.5167613", "0.5162864", "0.51606333", "0.51548487", "0.5153329", "0.5150832", "0.5149213", "0.51445687", "0.5143007", "0.5142215", "0.51402247", "0.51288205", "0.51230067", "0.5108905", "0.51055765", "0.50931", "0.5091838", "0.5079236", "0.50741726", "0.50630736", "0.5048896", "0.503923", "0.50384974", "0.5037626", "0.5030753", "0.5030753", "0.5023008", "0.50229895", "0.5022753", "0.50170356", "0.5015429", "0.5011886", "0.5007402", "0.50056976", "0.4998235", "0.49963942", "0.4994285", "0.49926645", "0.49875215", "0.4987152", "0.49863493", "0.49812326", "0.49803668", "0.49619368", "0.49589178", "0.4956131" ]
0.6454224
2
Use callbacks to share common setup or constraints between actions.
def set_appointment @appointment = Appointment.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 setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\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 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def appointment_params params.require(:appointment).permit(:start_time, :end_time, :first_name, :last_name, :comments) 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
ruby macro: creates getters and setters for the symbols listed.
def initialize(n='', i='', v='lampooning authority') # variadic @name = n @instrument = i @vice = v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_getters\n instance_variables.each do |v|\n define_singleton_method(v.to_s.tr('@','')) do\n instance_variable_get(v)\n end\n end\n end", "def create_accessors!\n self.each do |key,val|\n create_accessor_for(key)\n end\n end", "def create_setters\n schema_fields.keys.each do |key|\n self.class.send(:define_method, \"#{key.to_s}=\".to_sym) do |value| \n @data[key] = value #get_value key, value\n end\n end\n end", "def create_accessors!\n instance.each do |key,val|\n create_accessor_for(key)\n end\n end", "def define_accessors\n\n klist = []\n khash = {}\n KEY_SPACE.keys.each do |key|\n\n klist[ key.id ] = key.name.to_sym\n\n khash[ key.name ] = key\n khash[ key.name.to_sym ] = key\n\n const = key.name.upcase\n if const_defined?( const )\n cval = const_get( const )\n if cval != key\n fail \"Constant #{key} already set to incompatible value #{cval}\"\n end\n else\n const_set( const, key )\n end\n\n getter = key.name.downcase\n unless method_defined?( getter )\n class_eval <<-RUBY\n def #{getter}\n get_k( #{const} )\n end\n RUBY\n end\n\n setter = getter + '='\n unless method_defined?( setter )\n class_eval <<-RUBY\n def #{setter}( value )\n set_k( #{const}, value )\n end\n RUBY\n end\n\n end\n\n @key_list = klist.freeze # key name symbols array indexed by key.id\n @key_hash = khash.freeze # Hash of symbols,strings to Key\n end", "def create_accessors\n @buckets.keys.each do |bucket_name|\n class_eval do\n # Define the getter.\n define_method(bucket_name) do\n @buckets[bucket_name]\n end\n # Define the setter.\n define_method(\"#{bucket_name}=\") do |new_value|\n @buckets[bucket_name] = new_value\n end\n end\n end \n end", "def create_accessors(name, meth, options = {})\n field = fields[name]\n create_field_getter(name, meth, field)\n create_field_setter(name, meth, field)\n end", "def templatable_attr (*symbols)\n symbols.each do |symbol|\n # define the instance setter method\n #\n define_method(\"#{symbol}=\".to_sym) do |value|\n instance_variable_set(\"@#{symbol}\", value)\n @@ever_been_set[self][symbol] = true\n end\n\n # define the instance getter method\n #\n define_method(symbol) do \n if @@ever_been_set[self][symbol]\n return instance_variable_get(\"@#{symbol}\")\n elsif self.class.class_variable_defined?(\"@@#{symbol}\")\n return self.class.class_exec { class_variable_get(\"@@#{symbol}\") }\n else\n return nil\n end\n end\n\n class_exec do\n # define the class setter method\n #\n # We have to use this send hack, since define_method is private.\n #\n self.class.send(:define_method, \"#{symbol}=\".to_sym) do |value|\n class_variable_set(\"@@#{symbol}\", value)\n end\n\n # define the class getter/setter method\n #\n # We want to be able to call this like a dsl as a setter, or like a\n # class method as a getter, so we need variable arity, which\n # define_method doesn't support. In order to use the standard `def`\n # with variable arity, eval'ing a string seems to be the only option.\n #\n # Oh man would I love for somebody to submit a patch to do this in a\n # less horrible way.\n #\n self.class.class_eval \"\n def #{symbol} (value = nil)\n if value\n class_variable_set(\\\"@@#{symbol}\\\", value)\n end\n class_variable_get(\\\"@@#{symbol}\\\") if class_variable_defined?(\\\"@@#{symbol}\\\")\n end\n \"\n end\n end\n end", "def create_methods!\n return unless type == :normal\n\n fn = name\n dmm = session_class._dynamic_methods_module\n mn = name.to_s.downcase\n\n dmm.define_method(mn) do\n self[fn]\n end\n\n dmm.define_method(\"#{mn}=\") do |new_value|\n self[fn] = new_value\n end\n\n if visibility == :private\n dmm.send(:private, mn, \"#{mn}=\".to_sym)\n end\n end", "def create_getters\n self.class::ATTRS.each do |method_name|\n self.class.class_eval do\n define_method(method_name) do\n get_webpage\n eval(\"scrape_#{method_name}\")\n eval(\"@#{method_name}\")\n end\n end\n end\n end", "def attr_accessor(sym, *more) end", "def define_accessors attribute_name\n define_getter attribute_name\n define_setter attribute_name\n\n self.attribute_names ||= []\n attribute_names << attribute_name.to_s\n attribute_names.uniq!\n end", "def delegate_methods(*symbols); end", "def define_multiple_accessors *attribute_names\n define_attribute_methods attribute_names.map(&:to_s)\n\n attribute_names.each do |attribute_name|\n define_accessors attribute_name\n end\n end", "def create_accessors(name, meth, options = {})\n field = fields[name]\n generated_field_methods.module_eval do\n if field.cast_on_read?\n define_method(meth) do\n field.get(read_attribute(name))\n end\n else\n define_method(meth) do\n read_attribute(name)\n end\n end\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n define_method(\"#{meth}?\") do\n attr = read_attribute(name)\n (options[:type] == Boolean) ? attr == true : attr.present?\n end\n end\n end", "def dsl_writer(*symbols)\n symbols.each { |sym|\n class_eval %{\n def #{sym}=(val)\n #{sym}(val)\n end\n }\n }\n end", "def accessor(*names)\n ns = self\n Module.new do\n names.each do |name|\n define_method(\"#{name}\") { ns.send(\"#{name}\") }\n define_method(\"#{name}?\") { ns.send(\"#{name}?\") }\n define_method(\"#{name}=\") { |vers| ns.send(\"#{name}=\", vers) }\n end\n end\n end", "def add_accessors(name, opts)\n name_equals = (name.to_s + \"=\").to_sym\n\n self.send(:define_method,name_equals) do |arg|\n attribute_set(name, arg)\n end\n self.send(:define_method,name) do \n attribute_get(name)\n end\n\n end", "def create_accessors(field_name)\n define_singleton_method(field_name) { read_attribute(field_name) }\n define_singleton_method(\"#{field_name}=\") { |value| write_attribute(field_name, value) }\n end", "def attr_writer(sym, *more) end", "def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend", "def mattr_accessor(*syms)\n mattr_reader(*syms) + mattr_writer(*syms)\n end", "def method_missing( sym, *args )\n\t\tkey = sym.to_s.sub( /(=|\\?)$/, '' ).to_sym\n\t\treturn nil unless @struct.member?( key )\n\n\t\tself.log.debug( \"Autoloading #{key} accessors.\" )\n\n\t\tself.class.class_eval %{\n\t\t\tdef #{key}; @struct.#{key}; end\n\t\t\tdef #{key}=(*args); @struct.#{key} = *args; end\n\t\t\tdef #{key}?; @struct.#{key}?; end\n\t\t}\n\n\t\t@struct.__send__( sym, *args )\n\tend", "def attr_reader(sym, *more) end", "def my_attr_accessor(*attributes)\n attributes.each do |attribute|\n # for each attribute, use String interpolation\n # to generate the methods, and set attr_methods\n # equal to the generated string\n attr_methods = %Q{\n def #{attribute}\n @#{attribute}\n end\n def #{attribute}=(val)\n @#{attribute} = val\n end\n }\n # call class_eval and pass in attr_methods\n class_eval(attr_methods)\n end\n end", "def attr_writer_init(*symbols)\n generate_attr_writer(symbols)\n generate_initializer(symbols)\n end", "def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def accessor_pair(init =nil)\r\n value = init\r\n getter = lambda { value }\r\n setter = lambda{|x| value = x}\r\n return getter,setter\r\nend", "def getters; end", "def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end", "def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end", "def setter( name ) (name.to_s + '=').to_sym end", "def attr_path_accessor *syms, &block\n given = block_given?\n\n syms.each do |sym|\n\n # this is the callback method when the value is set\n self.send(:define_method, :\"__on_#{sym}\") do |val|\n instance_exec(val, &block) if given\n end\n\n # this is the setter and getter. The setter also calls\n # the callback method defined above.\n self.class_eval(\n%{def #{sym}= val\n @#{sym} = ::Albacore::Paths.normalise_slashes val\n __on_#{sym} @#{sym}\nend})\n self.class_eval(\n%{def #{sym}\n @#{sym}\nend})\n end \n end", "def key_reader *keys\n keys.each do |method|\n key = method.to_s\n define_method method do\n self[key]\n end\n end\n end", "def dsl_property(*symbols)\n symbols.each { |sym|\n class_eval %{\n def #{sym}(*val)\n if val.empty?\n @#{sym}\n else\n oldvalue = @#{sym}\n tmp = val.size == 1 ? val[0] : val\n newvalue = tmp\n if @_object_created.nil?\n @#{sym} = tmp\n end\n return(self) if @_object_created.nil?\n\n if oldvalue != newvalue\n # trying to reduce calls to fire, when object is being created\n begin\n fire_property_change(\"#{sym}\", oldvalue, newvalue) if !oldvalue.nil?\n @#{sym} = tmp\n @config[\"#{sym}\"]=@#{sym}\n rescue PropertyVetoException\n $log.warn \"PropertyVetoException for #{sym}:\" + oldvalue.to_s + \"-> \"+ newvalue.to_s\n end\n end # if old\n self\n end # if val\n end # def\n #attr_writer sym\n def #{sym}=val\n #{sym}(val)\n end\n }\n }\n end", "def method_missing( sym, *args )\n\t\t# work magic\n\t\treturn super unless sym.to_s =~ /^([a-z]\\w+)(=)?$/\n\n\t\t# If it's an assignment, the (=)? will have matched\n\t\tkey, assignment = $1, $2\n\n\t\tmethod_body = nil\n\t\tif assignment\n\t\t\tmethod_body = self.make_setter( key )\n\t\telse\n\t\t\tmethod_body = self.make_getter( key )\n\t\tend\n\n\t\tself.class.send( :define_method, sym, &method_body )\n\t\treturn self.method( sym ).call( *args )\n\tend", "def cattr_accessor(*syms)\n cattr_reader(*syms) + cattr_writer(*syms)\n end", "def make_readers!(fields, prefix = '_')\n fields.each do |key,field|\n self.define_singleton_method(\"#{prefix}#{key}\".to_sym) { fields[key] }\n end\n end", "def mattr_writer(*syms)\n syms.flatten.each do |sym|\n module_eval(<<-EOS, __FILE__, __LINE__)\n unless defined? @@#{sym}\n @@#{sym} = nil\n end\n\n def self.#{sym}=(obj)\n @@#{sym} = obj\n end\n\n def #{sym}=(obj)\n @@#{sym}=(obj)\n end\n EOS\n end\n return syms\n end", "def create_accessor_for(name, extensions)\n define_method name do |*args|\n if args.length == 0\n attributes[name].tap do |out|\n extensions.each do |extension|\n out.extend( extension )\n end\n end\n else\n send(\"#{name}=\", *args)\n self\n end \n end\n end", "def cattr_writer(*syms)\n syms.flatten.each do |sym|\n module_eval(<<-EOS, __FILE__, __LINE__)\n unless defined? @@#{sym}\n @@#{sym} = nil\n end\n\n def self.#{sym}=(obj)\n @@#{sym} = obj\n end\n\n def #{sym}=(obj)\n @@#{sym}=(obj)\n end\n EOS\n end\n return syms\n end", "def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n define_method(\"#{ meth }=\") do |value|\n instance_variable_set \"@#{ name }\", value\n end\n end\n end", "def readonly(*syms)\n return if syms.size == 0 # If no arguments, do nothing \n code = \"\" # Start with an empty string of code \n # Generate a string of Ruby code to define attribute reader methods.\n # Notice how the symbol is interpolated into the string of code.\n syms.each do |s|\n code << \"def #{s}; #{s}; end\\n\"\n end \n # Finally, class_eval the generated code to create instance methods.\n class_eval code \n end", "def vcattr_accessor(*syms) # :nodoc:\r\n vcattr_reader *syms\r\n vcattr_writer *syms\r\n end", "def attributes\n Hash.new.tap do |atts|\n _accessors.each do |accessor|\n att = accessor[0..-2].to_sym\n atts[att] = send(att)\n end\n end\n end", "def define_getter_for(name, property_name: name)\n return if getters.include?(name)\n define_method(name) { |&block| self.[](property_name, &block) }\n getters << name\n end", "def attr_reader_init(*symbols)\n generate_attr_reader(symbols)\n generate_initializer(symbols)\n end", "def getter_method_names; end", "def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end", "def create_attr_methods(name, val)\n self.instance_variable_set \"@#{name}\", val\n self.class.class_eval do\n define_method(\"#{name}\") { val }\n end\n end", "def define_set_and_get_method(name, &block)\n define_instance_dsl_method \"#{name}\" do |value = ''|\n if value == ''\n instance_eval(&block)\n else\n instance_variable_set(\"@#{name}\".to_sym, value)\n end\n end\n end", "def mattr_reader( *syms )\n syms.flatten.each do |sym|\n module_eval(<<-EOS, __FILE__, __LINE__)\n unless defined? @@#{sym}\n @@#{sym} = nil\n end\n\n def self.#{sym}\n @@#{sym}\n end\n\n def #{sym}\n @@#{sym}\n end\n EOS\n end\n return syms\n end", "def mattr_writer(*syms)\n syms.each{|sym|\n class_eval(<<-EOS, __FILE__, __LINE__)\n @@#{sym} = nil if !defined?(@@#{sym})\n \n def self.#{sym}=(obj)\n @@#{sym} = obj\n end\n def #{sym}=(obj)\n @@#{sym} = obj\n end\n EOS\n }\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def set_attr_with_readers! hash\n hash.each_pair { |symbol, value|\n instance_variable_set \"@#{symbol}\", value\n singleton_class.class_exec { attr_reader symbol }\n }\n end", "def macro hash\n hash.each do |key, value|\n value = value.latex!.to_latex_math\n define_latex_macro key, value\n define_symbol_macro key, value\n define_global_macro key, value\n end\nend", "def all=(symbol)\n [:symbol, :long_symbol, :name, :long_name].each do |field|\n send(field.to_s + '=', symbol.to_s)\n end\n end", "def accessor_builder(k, v)\n self.instance_variable_set(\"@#{k}\", v)\n self.class.send(:define_method, \"#{k}\", proc {self.instance_variable_get(\"@#{k}\")})\n self.class.send(:define_method, \"#{k}=\", proc {|v| self.instance_variable_set(\"@#{k}\", v)})\n end", "def define_attribute_methods\n return if generated_methods?\n property_names.each do |name|\n unless instance_method_already_implemented?(name)\n define_read_method(name.to_sym)\n end\n unless instance_method_already_implemented?(\"#{name}=\")\n define_write_method(name.to_sym)\n end\n unless instance_method_already_implemented?(\"#{name}?\")\n define_question_method(name)\n end\n end\n end", "def key_writer *keys\n keys.each do |method|\n key = method.to_s\n define_method \"#{method}=\" do |value|\n self[key] = value\n end\n end\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def test_generate_accessor_should_add_methods\n assert !defined?(foo)\n generate_accessor(:foo, \"bar\")\n assert_equal \"bar\", foo\n assert !defined?(boo)\n generate_accessor('boo', 'foo')\n assert_equal 'foo', boo\n end", "def add_instance_getters_and_setters(var)\n singleton = (class << self; self end)\n singleton.send :define_method, var.to_sym do\n instance_variable_get \"@#{var}\"\n end\n singleton.send :define_method, \"#{var}=\".to_sym do |val|\n instance_variable_set \"@#{var}\", val\n end\n end", "def define_accessors\n columns.each do |column|\n underscored_column_name = column.name.underscore\n unless respond_to?(underscored_column_name)\n self.class.send :define_method, underscored_column_name do\n @attributes[column.name.underscore]\n end\n end\n end\n end", "def cattr_reader(*syms)\n syms.flatten.each do |sym|\n module_eval(<<-EOS, __FILE__, __LINE__)\n unless defined? @@#{sym}\n @@#{sym} = nil\n end\n\n def self.#{sym}\n @@#{sym}\n end\n\n def #{sym}\n @@#{sym}\n end\n EOS\n end\n return syms\n end", "def cattr_accessor(*syms)\n cattr_reader(*syms)\n cattr_writer(*syms)\n end", "def vcattr_writer(*syms) # :nodoc:\r\n syms.each do |sym|\r\n instance_eval <<EVAL, __FILE__, __LINE__ + 1\r\ndef #{sym}=(value)\r\n @version.nil? ? @_#{sym} = value : versions[@version][#{sym.inspect}] = value\r\nend\r\nEVAL\r\n end\r\n end", "def fields(fields = {})\n fields.each do |k,v|\n define_accessor(k.underscore, v)\n end\n end", "def attr_accessor(*symbols)\n locally_assigned << symbols\n locally_assigned.flatten!\n super(*symbols)\n end", "def cattr_reader(*syms)\n syms.flatten.each do |sym|\n next if sym.is_a?(Hash)\n class_eval(<<-EOS, __FILE__, __LINE__)\n unless defined? @@#{sym}\n @@#{sym} = nil\n end\n\n def self.#{sym}\n @@#{sym}\n end\n\n def #{sym}\n @@#{sym}\n end\n EOS\n end\n end", "def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend", "def _define_method(method)\n #Getters\n self.class.send(:define_method, method) do\n _get method.to_sym\n end\n\n #Setters\n self.class.send(:define_method, \"#{method.to_s}=\") do |value|\n _set method, value\n end\n\n #Incrementer\n self.class.send(:define_method, \"inc_#{method.to_s}\") do |*args|\n value = args.first || 1\n _inc method, value\n end\n\n #Decrementer\n self.class.send(:define_method, \"dec_#{method.to_s}\") do |*args|\n value = args.first || 1\n _dec method, value\n end\n end", "def mattr(*syms)\n writers, readers = syms.flatten.partition{ |a| a.to_s =~ /=$/ }\n writers = writers.collect{ |e| e.to_s.chomp('=').to_sym }\n\n mattr_writer( *writers )\n mattr_reader( *readers )\n\n return readers + writers\n end", "def define_tag_setter_methods\n @tags.keys.each do |tag_name|\n next if respond_to? :\"#{tag_name}=\"\n if tag_name =~ /karma:(.*)/\n class_eval %{\n def karma\n def #{$1}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n end\n }\n else\n class_eval %{\n def #{tag_name}=(new_value)\n update_tag_value('#{tag_name}', new_value)\n end\n }\n end \n end\n end", "def make_setter( key )\n\t\treturn Proc.new {|new_value| self.namespaced_hash[ key.to_sym ] = new_value }\n\tend", "def metaattr_accessor(*meths)\n metaclass.instance_eval{attr_accessor(*meths)}\n end", "def create_symbols\n # creates all named symbols, including vector references\n @expressions.map { |a| a.create_symbols }\n puts(self.class)\n end", "def set_fields_for_methods(assoc_set, singular = false)\n assoc_set.each do |c|\n # ap \"creating method #{c[:name]}\"\n self.class.send(:define_method, c[:name]) do\n assocs = instance_variable_get(\"@#{get_main_model.to_s.underscore}\")\n .send(c[:name])\n\n neww = singular ? c[:klass].constantize.new : [c[:klass].constantize.new] * 2\n\n if singular\n (assocs.present? && assocs) || neww\n else\n (assocs.map { |c| c }.present? && assocs.map { |c| c }) || neww\n end\n end\n\n # ap \"creating method #{c[:name]}_attributes=\"\n self.class.send(:define_method, \"#{c[:name]}_attributes=\") do |attributes|\n end\n end\n end", "def define_getter_for(name)\n define_method(\"#{name}\") do\n instance_variable_get(\"@#{name}\") or\n instance_variable_set(\"@#{name}\", deserialize(name)) or\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end", "def create_accessors(name, meth, options = {})\n define_method(meth) { read_attribute(name) }\n define_method(\"#{meth}=\") { |value| write_attribute(name, value) }\n define_method(\"#{meth}?\") do\n attr = read_attribute(name)\n (options[:type] == Boolean) ? attr == true : attr.present?\n end\n end", "def add(*array_of_string_or_sym)\n Array(array_of_string_or_sym).reject{|key| has?(key.to_s)}.each do |key|\n instance_eval <<~EOM\n def #{key}\n @#{key}\n end\n\n def #{key}=(a_value)\n @#{key} = a_value\n end\n EOM\n send \"#{key}=\", DEFAULT # NOTE: instance varible not created until set\n end\n end", "def define_attribute_methods\n return if attribute_methods_generated?\n @attributes.each_pair do |k,v|\n self.class.module_eval %Q?\n def #{k}\n read_attribute :#{k}\n end\n def #{k}=(value)\n write_attribute :#{k},value\n end\n ?\n end\n self.class.attribute_methods_generated = true\n end", "def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end", "def get_properties\n instance_methods.each_with_object([]) { |key, acc| acc << key.to_s.gsub(/=$/, '') if key.match(/\\w=$/) }\n end", "def singleton_attr_accessor( *symbols )\n\t\t\tsymbols.each do |sym|\n\t\t\t\tsingleton_class.__send__( :attr_accessor, sym )\n\t\t\tend\n\t\tend", "def setter_method\n :\"#{self[:name]}=\"\n end", "def parse_attr_accessor(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg\n rw = \"?\"\n\n tmp = RDoc::CodeObject.new\n read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS\n # TODO In most other places we let the context keep track of document_self\n # and add found items appropriately but here we do not. I'm not sure why.\n return if @track_visibility and not tmp.document_self\n\n case tk[:text]\n when \"attr_reader\" then rw = \"R\"\n when \"attr_writer\" then rw = \"W\"\n when \"attr_accessor\" then rw = \"RW\"\n else\n rw = '?'\n end\n\n for name in args\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n end\n end", "def vars(opts={})\n opts.each do |k,v|\n if v.class == Symbol\n @declarations << \"#{v} _#{k};\"\n @accessors << <<-CODE\n #{v} #{k}(){\n \\treturn _#{k};\n }\n CODE\n else\n type = case v\n when Integer\n \"int\"\n when String\n \"char*\"\n when TrueClass\n \"bool\"\n when FalseClass\n \"bool\"\n end\n\n @declarations << \"#{type} _#{k} = #{v};\"\n @accessors << <<-CODE\n #{type} #{k}(){\n \\treturn _#{k};\n }\n CODE\n end\n end\n end", "def initialize(data)\n data.each do |key, value|\n instance_variable_set \"@#{key}\", value\n self.class.send(\n :define_method,\n key.to_sym,\n lambda { instance_variable_get(\"@#{key}\") }\n )\n end\n end", "def initialize(data)\n data.each do |key, value|\n instance_variable_set \"@#{key}\", value\n self.class.send(\n :define_method,\n key.to_sym,\n lambda { instance_variable_get(\"@#{key}\") }\n )\n end\n end", "def add_attr_accessors(p_attributes, p_type = :both)\n p_type.to_h.assert_valid_keys(:read, :write, :both) #validate type\n\n #loop through the accessors to be added\n Array(p_attributes).flatten.each do |k|\n\n #lets set the write reader if needed\n if [:read, :both].include?(p_type) && !self.respond_to?(k.to_s) #is there already one defined\n self.class.send(:define_method, k.to_sym) do #lets create one as requested\n instance_variable_get('@' + k.to_s) # equivalent of an attr_reader is created here\n end\n end\n\n # Lets set the write accessor if needed\n if [:write, :both].include?(p_type) && !self.respond_to?(\"#{k.to_s}=\") #is there already one defined\n self.class.send(:define_method, \"#{k}=\".to_sym) do |value| #lets create one as requested\n instance_variable_set(\"@\" + k.to_s, value) # equivalent of an attr_writer is created here\n end\n end\n\n end # end p_attributes..do\n self #all done return self\n end", "def getter_method_names\n @getter_method_names ||= instance_methods.map!(&:to_s).tap do |list|\n list.reject! { |item| item.end_with?(\"=\") }\n end\n end", "def create_with_methods!\n @parameters.reject(&:header?).each do |parameter|\n self.class.define_method(:\"with_#{parameter.to_method_name}\") do |value|\n @with_params[parameter.name] = value\n self\n end\n end\n end", "def readwrite(*syms)\nreturn if syms.size == 0\ncode = \"\"\nsyms.each do |s|\ncode << \"def #{s}; @#{s} end\\n\"\ncode << \"def #{s}=(value); @#{s} = value; end\\n\"\nend\nclass_eval code\nend", "def add_accessors(column, name, position, default)\n mask = (1 << position)\n self.bitflags[name] = mask\n if default \n self.default_mask += mask\n end\n \n # now the instance accessors\n # return true/false\n define_method( (name + '?').to_sym ) do\n bits = self[column] ||= 0\n bits[position].eql? 1\n end\n \n # set with true/false \n define_method( (name + '=').to_sym ) do |v|\n bits = self[column] ||= 0\n flag = [ \"true\", '1', 'yes', 'ok' ].include? v.to_s.downcase\n self[column] = flag ? bits |= mask : bits &= ~mask\n end\n \n # make this easy for the form builders like 'check_box' to use standard accessors\n define_method( name.to_sym ) do\n bits = self[column] ||= 0\n bits[position].eql? 1\n end\n \n end", "def shorthand_names(methods)\n names = []\n if java_name =~ /\\Aget(.+)/\n names << snakecase($1[0,1].downcase + $1[1..-1])\n elsif java_name =~ /\\Aset(.+)/\n names << snakecase($1[0,1].downcase + $1[1..-1]) + '='\n elsif java_name =~ /\\Ais(.+)/\n return unless $1\n short_name = snakecase($1[0,1].downcase + $1[1..-1])\n names << short_name\n names << short_name + '?'\n end\n names\n end", "def attr_setter(*attrs)\n code, made = '', []\n attrs.each do |a|\n code << \"def #{a}(*a); a.size > 0 ? (@#{a}=a[0]; self) : @#{a} end\\n\"\n made << a.to_sym\n end\n module_eval(code)\n made\n end", "def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end", "def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end", "def initialize(atts)\n atts.each do |key, val|\n accessor = \"#{key}=\"\n\n if respond_to?(accessor)\n send(accessor, val)\n end\n end\n end" ]
[ "0.7392179", "0.7259517", "0.70115954", "0.68677133", "0.67719114", "0.668616", "0.6665547", "0.66524863", "0.659165", "0.6499498", "0.6380969", "0.6320153", "0.6286636", "0.62355715", "0.6227264", "0.6183111", "0.61600566", "0.6125002", "0.612461", "0.6116803", "0.6110519", "0.6106113", "0.60761297", "0.60605216", "0.6059838", "0.6058843", "0.6054848", "0.6049303", "0.6045565", "0.6044407", "0.6032573", "0.6027369", "0.6023972", "0.60125154", "0.6010945", "0.6005464", "0.60051084", "0.5996735", "0.5981765", "0.59758043", "0.5974454", "0.5942067", "0.59236443", "0.591668", "0.5913759", "0.5912708", "0.5909281", "0.59091896", "0.5897746", "0.58891857", "0.58624625", "0.5849653", "0.5842191", "0.58317286", "0.5825625", "0.5812571", "0.58036935", "0.57949066", "0.5793445", "0.57914776", "0.5789503", "0.5778868", "0.57766813", "0.5776486", "0.5769554", "0.5762791", "0.57580656", "0.57552516", "0.5752886", "0.5739094", "0.5738347", "0.5735639", "0.57278794", "0.57241654", "0.5701288", "0.5699385", "0.56879693", "0.5679655", "0.56765133", "0.5669346", "0.5668105", "0.5662143", "0.56588805", "0.5637102", "0.5634177", "0.5616362", "0.5601955", "0.5595204", "0.55950767", "0.55925333", "0.55925333", "0.55917335", "0.5586509", "0.5586383", "0.5576041", "0.5575748", "0.55747205", "0.5570556", "0.55684245", "0.55684245", "0.55670816" ]
0.0
-1
initializer method for CSVFile
def initialize(file_name: nil, file_extension: DefaultConstants::EXTENSION, convert: false, output: DefaultConstants::FILE_PATTERN) @file_name = file_name ### source file name (full path should be provided) @file_extension = file_extension ### file extension @data = [] ### file rows data @smart_convert = convert ### convert readed data in array of hashes with file headers keys - false by default @file_headers = nil ### file headers array @read_flag = false ### service flag @output = output ### write file name with extension end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(csv_in_filename)\n @in_file = csv_in_filename\n @csv_out_headers = nil\n @index = nil\n @csv_out_data = nil\n convert\n end", "def initialize(csv_source)\n @csv_source = csv_source\n end", "def initialize(csv_filename)\n LOGGER.info 'Konvertierung Commerzbank .csv-Kontoauszugsdatei ins Format .mt940 (SWIFT):'\n\n @csv_filename = csv_filename\n end", "def initialize(str,file = true)\n if file\n @data = CSV.read(str)\n else\n @data = CSV.parse(str) \n end\n parse\n end", "def initialize(filename,\n col_sep: \",\",\n comment_starts: false,\n comment_matches: false,\n ignore_empty_lines: true,\n surrounding_space_need_quotes: false,\n quote_char: \"\\\"\",\n default_filter: Jcsv.optional,\n strings_as_keys: false,\n format: :list,\n headers: true,\n custom_headers: nil,\n chunk_size: 0,\n deep_map: false,\n dimensions: nil,\n suppress_warnings: false)\n \n @filename = filename\n @col_sep = col_sep\n @comment_starts = comment_starts\n @comment_matches = comment_matches\n @default_filter = default_filter\n @filters = false\n @strings_as_keys = strings_as_keys\n @headers = headers\n @custom_headers = custom_headers\n @ignore_empty_lines = ignore_empty_lines\n @format = format\n @surrounding_space_need_quotes = surrounding_space_need_quotes\n @quote_char = quote_char\n @chunk_size = (chunk_size == :all)? 1.0/0.0 : chunk_size\n @deep_map = (@format == :list)? false : deep_map\n @dimensions_names = dimensions\n @column_mapping = Mapping.new\n @suppress_warnings = suppress_warnings\n \n prepare_dimensions if dimensions\n\n # set all preferences. To create a new reader we need to have the dimensions already\n # prepared as this information will be sent to supercsv for processing.\n new_reader(set_preferences)\n\n # Dynamic class change without writing subclasses. When headers, extend this class\n # with methods that assume there is a header, when no headers, then extend this class\n # with methods that know there is no header. Could have being done with subclasses,\n # but this would all subclasses to have two subclasses one inheriting from the header\n # class and one inheriting from the headerless classes. In this way we reduce the\n # subclasses need.\n @headers? prepare_headers : (@custom_headers? set_headers(@custom_headers) :\n headerless)\n\n # if there are dimensions, then we need to prepare the mappings accordingly. With\n # dimensions defined, users cannot defined mappings.\n dimensions_mappings if dimensions\n \n end", "def initialize(csv_file) # csv_fi\n @csv_file = csv_file # we store it in a variable in case it's added later\n @recipes = []\n read_recipe_from_csv_file\n end", "def initialize(file_name)\n super()\n @file_name = file_name\n @headers = nil\n @headers_map = {}\n \n # default options we use for CSV files\n @csv_options = {\n headers: true, # assume input file has headers\n return_headers: false, # all rows will be treated as data by each_row()\n col_sep: \",\",\n row_sep: \"\\n\",\n quote_char: '\"',\n }\n end", "def initialize(csv, importer)\n @source_csv = CSV.read(csv, headers: true)\n @is_for_bulkrax = importer == 'bulkrax'\n @fileset_model_or_type = @is_for_bulkrax ? 'FileSet' : 'fileset'\n directory = File.dirname(csv)\n extension = File.extname(csv)\n filename = File.basename(csv, extension)\n @processed_csv = File.join(directory, filename + \"-processed.csv\")\n @merged_headers = exclusion_guard(additional_headers + @source_csv.headers)\n @tree = {}\n end", "def initialize(csv_file_path)\n # take recipe from csv file\n @csv_file_path = csv_file_path\n @recipes = []\n parse\n end", "def initialize(filename)\n\t\tmyCSV = CSV.new File.new(filename), {:headers => true}\n\t\t@matrix = myCSV.read\n\t\t@headers = @matrix.headers\n\tend", "def initialize(filename)\n puts \"EventManager Initialized.\"\n @file = CSV.open(filename, {:headers => true, :header_converters => :symbol })\n end", "def initialize(database, file_path)\n @file_path = file_path\n @entries = database.entries\n validate_csv_header\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def initialize(file, options = {})\n @rows = []\n opts = { row_sep: \"\\n\", col_sep: ',', skip_blanks: true }.merge(options)\n CSV(file, opts) do |csv|\n csv.each do |r|\n @rows.push(r)\n end\n end\n @column_index = {\n name: 3, route: 4, city: 5, state: 6, zip: 7, td_linx_code: 8\n }\n end", "def initialize(path, int_fields = nil)\n\t\t@int_fields = int_fields || proc { |f| false }\n\t\t@csv = CSV.open(path, :col_sep => ';', :headers => :first_row,\n\t\t\t:encoding => 'ISO-8859-1:UTF-8')\n\t\t@csv.convert { |v,f| @int_fields[f.header] ? v.to_i : v }\n\tend", "def initialize(name, file, opt={:escape_char => '\\\\'})\n super(name)\n @file = file\n @delim = case opt[:type]\n when :csv then ','\n when :tsv then \"\\t\"\n else opt[:delim]\n end\n @opt = opt\n end", "def initialize(path, normalizer = KEY_NORMALIZER)\n @path = Pathname.new(path)\n\n @table = CSV.table(@path.to_s, {\n converters: [YEAR_NORMALIZER, :all],\n header_converters: [normalizer]\n })\n\n @headers = @table.headers\n rescue InvalidKeyError\n raise BlankCSVHeaderError.new(path)\n end", "def initialize(csv_in_filename, era_year_handle, rmid_from_era_year_handles_string)\n @in_file = csv_in_filename\n verify_in_file\n\n @db_conn = PG::Connection.connect(DB_CONNECT_INFO)\t# Connect to the DB\n @era_year_handle = era_year_handle\n verify_era_year_handle\n\n @rmid_from_era_year_handles_string = rmid_from_era_year_handles_string\n if @rmid_from_era_year_handles_string == 'any'\n @rmid_from_era_year_handles = nil\n @rmid_from_era_year_handles_regex = nil\n else\n @rmid_from_era_year_handles = rmid_from_era_year_handles_string.split(',')\n @rmid_from_era_year_handles_regex = \"^(#{@rmid_from_era_year_handles.join('|')})$\"\n end\n verify_rmid_from_era_year_handles\n\n @csv_out_headers = nil\n @csv_out_data = nil\n @handles_by_prefix = {}\t\t# Cache for collection-handles\n convert\n @db_conn.close if @db_conn\n end", "def initialize(instructions_csv=\"instructions.csv\", format)\n\t\t\t#check for errors in parameters\n\t\t\traise \"instructions_csv must not be null\" unless !instructions_csv.nil?\n\t\t\traise \"#{instructiosn_csv} is not a readable file\" unless File.exist?(instructions_csv) and File.readable?(instructions_csv)\n\t\t\t#assign parameters to object variables\n\t\t\t@instructions_csv = instructions_csv\n\t\t\t#format can be 'a' for assembly or 'b' for binary\n\t\t\t@format = format\n\t\tend", "def initialize_csv\n CSV.open(\"results.csv\", \"wb\") do |csv|\n csv << [\"class\", \"title of course\", \"credits\"]\n end\nend", "def initialize(logger, file_reader_class = StandardCSVReader)\n @file_reader_class = file_reader_class\n @logger = logger\n end", "def initialize(filename)\n @data = CSV.read(filename, :headers => true, header_converters: :symbol, converters: :all)\n @stocks = []\n @days = []\n self.parseData() # To initialize stocks, days and parse the data from the file\n end", "def initialize(csv_class_path)\n @path = csv_class_path\n @recipes = CSV.open(@path).map do |row|\n Recipe.new(name: row[0], ingredients: row[1], prep_time: row[2], difficulty: row[3])\n end\n end", "def initialize(*args, &block)\n @csv = CSVReader.new(*args)\n @config = self.class.config.dup\n @config.attributes = args.last\n @report = Report.new\n Configurator.new(@config).instance_exec(&block) if block\n end", "def csv_filename\n raise NotImplementedError\n end", "def initialize(csv, dam_name)\n\t\t#Load initial csv, and fix\n\t\tcrude = CSV.read(\"public/#{csv}.csv\")\n\t\tfix_csv(crude)\n\t\t@report = CSV.read(\"public/ephemeral.csv\", headers:true)\n\t\t@dam_id = extract_dam(dam_name)\n\tend", "def initialize(file_path)\n @filepath = file_path\n @lines = []\n @empty = true\n @error = false\n @description = \"none\"\n @format = \"unknown\"\n @rows = []\n end", "def initialize(table, path = nil)\n @headers = table.headers\n @path = Pathname(path) if path\n @table = table\n\n # Delete the header row for the internal representation. This will be (re-)created when saved.\n @table.delete(0)\n\n raise(BlankCSVHeaderError, path || '<no path>') if @headers.any?(&:nil?)\n end", "def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end", "def csv=(klass); end", "def convert_csv_file_to_object\n begin\n CSV.foreach(@file_name) do |row|\n @csv_object.push(row)\n end \n rescue => exception\n raise FileReadError, exception\n end\n end", "def load_csv(csv_file_or_object, table_name, log_name = nil)\n log_name ||= \"load_csv '#{csv_file_or_object.kind_of?(CSV::Table) ? 'CSV Object' : csv_file_or_object }', 'table_name'\"\n csv_object = case csv_file_or_object\n when String then Slacker.get_csv(csv_file_or_object)\n when CSV::Table then csv_file_or_object\n when Array then Slacker.hash_array_to_csv(csv_file_or_object)\n end\n\n Slacker.load_csv(example, csv_object, table_name, log_name)\n end", "def initialize(params = {})\r\n @uploaded_file = params[:roster]\r\n @column_hash = params[:columns] || {}\r\n @has_headers = params[:has_headers]\r\n @course_role_id = params[:course_role_id]\r\n @course_offering = CourseOffering.find_by_id(params[:id])\r\n\r\n @users_created = []\r\n @users_enrolled = []\r\n\r\n @preview_rows = []\r\n @column_array = []\r\n\r\n process_csv if @uploaded_file\r\n end", "def initialize_generator\n @csv_report_generator ||= CSVReportGenerator.new(method_names: csv_headers)\n end", "def import_csv_full\n \n end", "def initialize(input_filename, output_filename)\n\t\n\t\t# DEBUG\n\t\t# should eventually be turned into error checking\n\t\tputs \"ttt_Reader initialize started\"\n\t\tputs \"input_filename: \" + input_filename\n\t\tputs \"output_filename: \" + output_filename\n\t\tputs \"\"\n\t\t\n\t\t\n\t\t# load input parameters from input file\n\t\t@in = File.open(\"input.csv\", \"r+\")\n\n\t\t# and grab the input parameters\n\t\t@params = @in.gets.chomp.split(\",\")\n\t\t\n\t\t# DEBUG\n\t\tputs \"input parameters:\\n\" + @params.to_s\n\t\tputs \"\"\n\t\t\n\t\t# get an output file ready\n\t\t@out = File.open(output_filename, \"a\")\n\t\t\n\tend", "def initialize(lists = nil)\n\t\t\t\tif !lists.nil?\n\t\t\t\t\t@lists = lists\n\t\t\t\tend\n\t\t\t\t@file_type = 'CSV'\n\t\t\t\t@sort_by = 'EMAIL_ADDRESS'\n\t\t\t\t@export_date_added = true\n\t\t\t\t@export_added_by = true\n\t\t\t\t@column_names = ['Email Address', 'First Name', 'Last Name']\n\t\t\tend", "def import_csv_smart\n \n end", "def initialize(csv_file)\n @csv_file = csv_file\n\n @invalid_sites = []\n\n @valid_sites = []\n\n @already_imported_sites = []\n\n parse_csv_file\n end", "def initialize \n #local variable csv will be created. It will = instance of CSV reader, drawn from \"./zipcode-db.cvs\"\n csv = CSVReader.new(\"./free-zipcode-database.csv\")\n #areas will have default value of an empty array\n @areas = []\n #I will run csv.read, which will return a hash based on a file of information.\n csv.read do |item|\n #the hash I get from csv.read will be formatted according to the Area class, and then put into the @areas array.\n @areas << Area.new(item)\n end\n end", "def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end", "def initialize(filepath, col_sep: \"\\t\")\n @filepath = filepath\n @col_sep = col_sep\n @file_handle = File.open(filepath)\n @headers = @file_handle.gets.chomp!.split(col_sep, -1).map(&:downcase).map(&:to_sym)\n end", "def initialize(name, file, opt={:type => :auto, :escape_char => '\\\\'})\n super(name)\n @file = file\n @delim = case opt[:type]\n when :auto then raise \"File-type auto-detection is not yet supported\"\n when :csv then ','\n when :tsv then \"\\t\"\n else opt[:delim]\n end\n @opt = opt\n end", "def initialize\n @meals = []\n @csv_file = File.join(File.dirname(__FILE__), '..','..','data','meal.csv')\n load\n end", "def set_csv_file\n \t@csv_file = CsvFile.find(params[:id])\n end", "def initialize filename\n\t\t@filename = filename\n\tend", "def initialize(input_file)\n\t\tsuper(input_file)\n\t\t\n\tend", "def initialize(args)\n @creator_csv = CSV.read(args[:creator_csv_path])\n @title_csv = CSV.read(args[:title_csv_path])\n @contributor_csv = CSV.read(args[:contributor_csv_path])\n @logger = Logger.new(File.join(Rails.root, 'log', 'ordered-metadata-migration.log'))\n end", "def initialize( record, column, filename, options = {} )\n @record = record\n @model = record.class\n @column = column.to_sym\n @filename = filename\n settings.merge! options\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def load_data\n @data ||= CSV.read(@file)\n end", "def csv_data\n @csv_data ||= compute_csv_data\n end", "def initialize(source, options = {})\n if source.is_a?(String)\n require 'csv'\n mode_string = options[:encoding] ? \"r:#{options[:encoding]}\" : 'r'\n csv_options = options.fetch(:csv_options, {})\n @path = source\n source = CSV.open(@path, mode_string, csv_options).readlines\n elsif !source.is_a?(Enumerable) || (source.is_a?(Enumerable) && source.size > 0 &&\n !source.first.is_a?(Enumerable))\n raise ArgumentError, \"source must be a path to a file or an Enumerable<Enumerable>\"\n end\n if (options.keys & [:parent_field, :parent_fields, :child_field, :child_fields]).empty? &&\n (kf = options.fetch(:key_field, options[:key_fields]))\n @key_fields = [kf].flatten\n @parent_fields = @key_fields[0...-1]\n @child_fields = @key_fields[-1..-1]\n else\n @parent_fields = [options.fetch(:parent_field, options[:parent_fields]) || []].flatten\n @child_fields = [options.fetch(:child_field, options[:child_fields]) || [0]].flatten\n @key_fields = @parent_fields + @child_fields\n end\n @field_names = options[:field_names]\n @warnings = []\n index_source(source, options)\n end", "def initialize(csvfile)\n @repositories ||=[]\n raise ArgumentError, \"Argument cannot be empty\" unless !csvfile.nil?\n\n file = CSV.open(csvfile)\n file.each_with_index do |item|\n url =item.shift\n name =item.shift\n language =item.shift\n\n repositories << GitRepository.new(url, name, language)\n end\n end", "def initialize(filename, rows, file_mappings)\n @filename = filename\n @rows = rows\n @file_mappings = file_mappings.with_indifferent_access\n end", "def get_csv_object\n @csv_object\n end", "def initMetaData(csvfile,metamap,keyfield)\n\t\tallRows = CSV.read(csvfile,{:col_sep=>\";\"})\n\t\tif allRows and not allRows.empty?\n\t\t\ttitle = allRows[1]\n\t\t\tallRows.each_with_index do |row,i|\n\t\t\t\tif i > 1\n\t\t\t\t\tmetaData = Model::MetaData.new(title,row)\n\t\t\t\t\tkey = metaData.send(keyfield)\n\t\t\t\t\tmetamap[key] = metaData\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def csv_file\n if File.size? csv_filename\n CSV.read(csv_filename, headers: true, col_sep: ';', header_converters: :symbol, converters: :all)\n else\n LOGGER.error(\"File not found or empty: #{csv_filename}\")\n abort('ABORTED!')\n end\n end", "def parse_csv(path)\n require 'csv'\n\n str = Nitro::Template.new.render(File.read(path))\n\n reader = CSV::Reader.create(str)\n header = reader.shift\n\n reader.each_with_index do |row, i|\n data = {}\n row.each_with_index do |cell, j|\n data[header[j].to_s.strip] = cell.to_s.strip\n end\n self[\"#{@name}_#{i+1}\"] = obj = instantiate(data)\n @objects << obj\n end\n end", "def initialize(file_path)\n @file_path = file_path\n end", "def initialize(filename)\n @fname = filename\n end", "def initialize(file_format)\n @lines = []\n @attributes = {}\n register_file_format(file_format)\n end", "def csv_row\n #empty by default\n []\n end", "def csv_row\n #empty by default\n []\n end", "def parse_csv\n if self.csv_file.present?\n csv_text = Paperclip.io_adapters.for(self.csv_file).read\n csv = CSV.parse(csv_text, :headers => false)\n\n csv_columns = ['l', 'r', 'units']\n\n csv_to_save = {}\n\n csv.each_with_index do |row, i|\n if i == 0\n csv_to_save['weight'] = row[1].split(':')[1] # string is like Weight:201, only want the number\n csv_to_save['shoe_size'] = row[2].split(':')[1] # string is like Shoe Size:9\n elsif i >= 3\n row.each_with_index do |field, j|\n if j >= 1 and !field.blank?\n csv_to_save[generate_csv_row_key(csv_columns, row, i, j)] = field\n end\n end\n end\n end\n\n # Check to see if any of the fields are nil, then we must have not received the correct file\n is_clean = true\n csv_to_save.each do |key, val|\n if val.nil?\n is_clean = false\n break\n end\n end\n\n CsvFile.create!(csv_to_save) if is_clean\n end\n end", "def initialize data, file=nil\n @data = data\n @file = file\n end", "def load\n CSV.foreach(@csv_file, headers: :first_row, header_converters: :symbol) do |row|\n @data << Employee.new(row)\n end\n end", "def file=(value)\n @file = value\n csv\n @file\n end", "def read_in_csv_data(csv_file_name)\n begin\n CSV.foreach(csv_file_name, headers: true) do |row|\n @songs << Song.new(row['name'], row['location'])\n end\n rescue Exception\n @songs = nil\n end\n @songs\n end", "def load_csv\n CSV.foreach(@csv_file_path) do |row|\n @recipes << Recipe.new(name: row[0], description: row[1], rating: row[2], prep_time: row[3], tried: row[4])\n end\n end", "def initialize(args)\n @options = args\n @create_query = {}\n @import_query = {}\n @csv_column_datatypes = args[:csv_column_datatypes]\n @nullable = args[:nullable]\n @sql_helper_options = {:tablename => tablename, :filename => @options[:filename], :delimiter => @options[:delimiter]}\n @mysql_helper.extend(CsvImportAnalyzer::MysqlQueryHelper)\n @pg_helper.extend(CsvImportAnalyzer::PgQueryHelper)\n end", "def initialize(source, *options) \n case source\n when File, Tempfile\n raise \"#{source} does not exist\" unless File.exists?(source.path)\n @file = source\n if excel?\n lines = GridFile.read_excel(@file)\n else\n lines = source.readlines\n end\n super(lines, options)\n\n when String\n super(source, options)\n\n when Array\n super(source, options)\n\n else\n raise(ArgumentError, \"Expected String or File, but was #{source.class}\")\n end\n end", "def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend", "def CSVHash arg, columns=nil\n if arg.is_a?(File)\n CSVHash.from_file(arg.path)\n elsif arg.is_a?(String)\n CSVHash.from_file(arg)\n elsif arg.is_a?(Array) && columns.is_a?(Array)\n CSVHash.to_string(arg,columns)\n end\nend", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(filename)\n @filename = filename\n end", "def initialize(filename)\n @filename = filename\n end", "def initialize(filename)\n @filename = filename\n end", "def open_data_for_read\n @data_file = CSV.open(data_file_full_path,\"r\", @data_lib.csv_opt)\n @data_stream = @data_file\n end", "def data_file\n @data_file ||= CSV.foreach(@data_path, headers: true, converters: :numeric)\n end", "def set_csv_attribute\n @csv_attribute = CsvAttribute.find(params[:id])\n end", "def initialize(csv)\n @tags = []\n CSV.foreach(csv) do |row|\n @tags << row[0]\n end\n @tags.sort!{|x, y| y.length <=> x.length}\n end", "def load_csv\n # read each line frmo csv and append to recipes collection\n CSV.foreach(@csv_file) do |row|\n # puts \"#{row[0]} | #{row[1]}\"\n @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2], difficulty: row[3], tested: row[4])\n end\n end", "def initialize\n @arr_of_arrs = CSV.read(__dir__ + \"../../data/data.csv\")\n @endereco = @arr_of_arrs[0][6]\n @state = @arr_of_arrs[0][8]\n @city = @arr_of_arrs[0][7]\n @zip = @arr_of_arrs[0][9]\n @email = @arr_of_arrs[0][0]\n @pass = @arr_of_arrs[0][1]\n @country = @arr_of_arrs[0][10]\n @data_nasc = @arr_of_arrs[0][4].split(\"/\")\n @fist_name = @arr_of_arrs[0][2]\n @last_name = @arr_of_arrs[0][3]\n @mobile_number = @arr_of_arrs[0][11]\n @company = @arr_of_arrs[0][5]\n @alias = @arr_of_arrs[0][12]\n end", "def initialize(file)\n @file = file\n end", "def initialize(record_file)\n @record_file = record_file\n end", "def initialize file_path\n\t\t\t@file_path = file_path\n\t\t\t@meta = {}\n\t\tend", "def initialize(file_path)\n\t\t@path = file_path\n\tend", "def initialize(path, headers, fw_version = nil)\n new_headers = headers + [HDR_DTP, HDR_FW, HDR_SN]\n old_headers = []\n @old_log_name = nil\n\n log_file = path.basename\n log_dir = path.dirname\n log_ext = path.extname\n log_base = log_file.basename log_ext\n @log_path = path\n\n if @log_path.exist?\n CSV.open(@log_path, \"r\", headers: true, return_headers: true) do |log|\n log.readline\n old_headers = log.headers\n end\n end\n\n if old_headers.class == TrueClass || old_headers.size == 0\n # log_file is empty, does not exist yet or has no headers: create/overwrite!\n @log = CSV.open @log_path, \"wb\"\n @log << new_headers\n elsif old_headers == new_headers\n # OK to keep adding log records to the existing file\n @log = CSV.open @log_path, \"ab\"\n else\n # log file exists but it's the wrong format so start a new log\n time_stamp = DateTime.now.strftime(\"%Y%m%dT%H%M%S\")\n @old_log_name = log_base.sub_ext(\"_\" + time_stamp).sub_ext(log_ext)\n rename_path = log_dir.join @old_log_name\n File.rename @log_path, rename_path\n raise \"unable to rename log to #{rename_path}\" if File.exist? @log_path\n @log = CSV.open @log_path, \"wb\"\n @log << new_headers\n end\n\n @fw_version = fw_version\n end", "def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend", "def csvReader(file, headers)\n begin\n csvTable = CSV.read(file, {col_sep:\"\\t\", quote_char:\"\\0\", headers:headers})\n rescue ArgumentError\n puts \"Error: Unsupported encoding, tabulated/CSV file must be in UTF-8 format.\"\n abort\n end\n parsedObj = OpenStruct.new()\n parsedObj.rowArray = []\n parsedObj.belArray = []\n csvTable.each do |row|\n unless row.length == 0\n current = OpenStruct.new()\n current.bel_id = row[0]\n current.bel_id.slice! \"BEL:\"\n current.bel = row[1]\n current.sentence = row[2]\n current.sentence_id = row[3]\n current.sentence_id.slice! \"SEN:\"\n current.pmid = row[4]\n parsedObj.rowArray << current\n parsedObj.belArray << row[1]\n end\n end\n parsedObj.linecount = csvTable.length\n return parsedObj\nend", "def initialize(file_name, initial_data = {})\n @file_name = file_name\n super initial_data\n end", "def initialize(line_reader, cleanse_header: true, **args)\n @tabular = IOStreams::Tabular.new(**args)\n @line_reader = line_reader\n @cleanse_header = cleanse_header\n end", "def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end" ]
[ "0.74810904", "0.7463454", "0.7332542", "0.7300936", "0.7221388", "0.72051495", "0.7198484", "0.7182711", "0.71602803", "0.70697606", "0.6987281", "0.69835466", "0.69002545", "0.6884036", "0.6871319", "0.6816416", "0.6797937", "0.6765835", "0.67487735", "0.67158645", "0.665802", "0.66555446", "0.66384584", "0.66325474", "0.65914035", "0.65801656", "0.65791184", "0.65446794", "0.6491101", "0.6487472", "0.6481868", "0.6473692", "0.6431272", "0.6398783", "0.6391522", "0.6368363", "0.6366475", "0.6364286", "0.6362714", "0.6359247", "0.6347673", "0.63213617", "0.63026446", "0.62921965", "0.629202", "0.6269428", "0.626025", "0.625594", "0.6240995", "0.6219859", "0.6219859", "0.6187172", "0.6168222", "0.6164796", "0.61522335", "0.6147813", "0.6147697", "0.61467105", "0.6117201", "0.61030376", "0.6083315", "0.60813487", "0.6074728", "0.60744077", "0.60744077", "0.6071657", "0.6053504", "0.6053401", "0.6051603", "0.60504997", "0.6035691", "0.6024709", "0.60156083", "0.60154486", "0.6005663", "0.6005593", "0.6005593", "0.6005593", "0.59943426", "0.59943426", "0.59943426", "0.5986849", "0.5986849", "0.5986849", "0.5984194", "0.59817064", "0.5970483", "0.5970224", "0.59701526", "0.5967646", "0.5966924", "0.59608305", "0.59587836", "0.59586793", "0.59559566", "0.59198606", "0.5906592", "0.5906453", "0.5899675", "0.58970755" ]
0.5912538
96
Show some useful info about working file
def info @encoding = find_enoding puts "INFO:" print 'File name '; print "#{@file_name}\n".colorize(:green) print 'File headers '; print "#{@file_headers}\n".colorize(:green) print 'File rows number '; print "#{@data.size}\n".colorize(:green) print 'File encoding '; print "#{@encoding}\n".colorize(:green) ## temp decision if @output_file_name print 'Output File '; print "#{@output_file_name || 'nil'}\n".colorize(:green) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe\n f = file!\n puts \"Current target: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end", "def describe\n f = file!\n puts \"Current environment: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end", "def describe\n\t\t\"Show the present working directory.\"\n\tend", "def describe\n\t\t\"Shows the folder and files of the present working directory.\"\n\tend", "def usage()\n puts \"Usage is:\"\n puts \"#{__FILE__} path/to/STIG/file.xml\"\n puts\nend", "def inspect\n \"#<#{self.class}: #{@cwd}>\"\n end", "def inspect\n \"#<#{self.class}: #{@cwd}>\"\n end", "def inspect\n \"File: #{@name} #{@ext}\"\n end", "def show_file_version\n\t\t\tputs \" Version: #{@elf_version.to_h}\"\n\t\tend", "def __info__(msg=nil)\n puts_error \" #{msg}\" if msg\n File.open(\"#{$lithium_home}/lithium.txt\", 'r') { |f|\n print while f.gets\n }\n exit(1)\nend", "def show\r\n puts @configuration_file.file_content\r\n end", "def info args\n # Find base of git directory\n until Dir.glob('.git').length > 0 do\n if '/'==Dir.pwd\n @out.puts \"can't find .git directory this or any parent folder!\"\n return\n end\n Dir.chdir('..')\n end\n\n @out.puts \"(in \"+Dir.pwd+')'\n\n # Show various information about this git directory\n @out.puts \"== Remote URL: \"\n @out.puts `git remote -v`\n\n @out.puts \"== Remote Branches: \"\n @out.puts `git branch -r`\n\n @out.puts \"== Local Branches:\"\n @out.puts `git branch`\n @out.puts \"\\n\"\n\n @out.puts \"== Configuration (.git/config)\"\n File.open('.git/config'){|fh| @out.puts fh.read }\n @out.puts \"\\n\"\n\n @out.puts \"== Most Recent Commit\"\n @out.puts `git log --max-count=1`\n @out.puts \"\\n\"\n\n @out.puts \"Type 'git log' for more commits, or 'git show' for full commit details.\"\n\n end", "def stats_before_compil\n # Readme available?\n if File.exists?('readme.txt')\n @log_file.puts \"\\nLe fichier README existe !\\n\"\n @log_file.puts IO.read('readme.txt')\n end\n\n # Stats on files\n files_before_compil = Dir::entries('.') - ['.', '..', @results_file_dir]\n @log_file.puts \"\\nLe projet est composé des fichiers suivants :\"\n files_before_compil.each { |e| @log_file.puts \"\\t-#{e}\" }\n\n # Stats on number of lines\n nb_lines = `wc -l *.h *.c`\n @log_file.puts \"\\nStatistiques :\\n #{nb_lines}\"\n\n files_before_compil\n end", "def do_a_thing\n puts \"We are doing a thing!!!!!!!!!!!!!!!! #{file_name}\"\n end", "def info\n paths = bashify_note_paths(matching_notes(:all_if_empty => true))\n puts `wc $(find #{paths} -type f)` \n end", "def info_file\n @info_file ||= File.join(image_dir, '_info.txt')\n end", "def file_info(path)\n info File.read(path)\n end", "def info\n {\n root: File.expand_path(\"../../../../\", __FILE__)\n }\n end", "def help\n print \"\n You must pass in the path to the file to launch.\n\n Usage: #{__FILE__} target_file\n \"\nend", "def help\n puts \"#{$0} - parses EIS binary formatted files\"\nend", "def base_info_file\n ck_valid\n File.join(SysConf.value_for(:pid_dir), '%s_%03d' % [@laboratory.name, @num])\n end", "def showUsage(filename, defaultfn)\n # Emit the Programs Title.\n puts \"Developer Challenge from PlayLab\"\n puts \"--------------------------------\"\n puts\n\n # Check if the logfile exists and is readable\n readable = (File.file?(filename) and File.readable?(filename))\n\n # If the file can not be read then show some usage.\n if not readable\n puts \"Usage:\"\n puts \"#{$PROGRAM_NAME} <filename>\"\n puts \"<filename> is the name of a log file to process, defaults to #{defaultfn}\"\n puts \"\"\n ftype = File.exists?(filename) ? File.ftype(filename) : \"Non Existant\"\n puts \"Error: #{filename} is #{ftype} and is unable to be read. It can not be processed.\"\n end\n\n return readable\nend", "def show_info\n run('show info')\n end", "def view_timestamp(file)\n\t#stamp = commandz(\"stat #{file}\")\n\t#if not stamp.empty?\n\t#\tputs \"#{FGRN}Current Time Stamp for #{HC}#{FWHT}: #{file.chomp}#{RS}\"\n\t#\tstamp.each { |x| puts \"#{FWHT}#{x.chomp}#{RS}\" }\n\t#end\n\n\t# Now we do it with just pure ruby :)\n\t#Stat our target file so we can enumerate all the info normal stat command might show.....\n\tfoo = File.stat(file)\n\tputs \"#{HC}#{FGRN}File#{FWHT}: #{file}\\t#{FGRN}Type#{FWHT}: #{foo.ftype}#{RS}\"\n\tputs \"#{HC}#{FGRN}Size#{FWHT}: #{foo.size}\\t#{FGRN}Blocks#{FWHT}: #{foo.blocks}\\t#{FGRN}IO Blocks#{FWHT}: #{foo.blksize}#{RS}\"\n\tputs \"#{HC}#{FGRN}Dev#{FWHT}: #{foo.dev}\\t#{FGRN}Inode#{FWHT}: #{foo.ino}\\t#{FGRN}Links#{FWHT}: #{foo.nlink}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access#{FWHT}: #{sprintf(\"%o\", foo.mode)}\\t#{FGRN}UID#{FWHT}: #{foo.uid}\\t#{FGRN}GID#{FWHT}: #{foo.gid}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access Time#{FWHT}: #{foo.atime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Modify Time#{FWHT}: #{foo.mtime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Change Time#{FWHT}: #{foo.ctime}#{RS}\"\n\tputs\nend", "def output_project_files_debugging\n\t\tself.prompt.say( \"Project files:\", color: :bright_green )\n\t\ttable = self.generate_project_files_table\n\t\tif table.empty?\n\t\t\tself.prompt.warn( \"None.\" )\n\t\telse\n\t\t\tself.prompt.say( table.render(:unicode, padding: [0,1]) )\n\t\tend\n\t\tself.prompt.say( \"\\n\" )\n\n\t\tself.prompt.say( \"Version from:\" )\n\t\tself.prompt.say( \" \" + self.version_from.to_s, color: :bold )\n\t\tself.prompt.say( \"\\n\" )\n\tend", "def usage_page\n Format.usage(\"You can run me with the following flags: #{File.basename(__FILE__)} -[d|e|h] -[f] <path/to/file/if/any>\")\n exit\nend", "def info_message\n info = File.read(File.join(spec.path, 'INFO')) rescue ''\n template = ERB.new(info, nil, '<>')\n puts \"\\n#{template.result(binding)}\"\n end", "def info_message\n info = File.read(File.join(spec.path, 'INFO')) rescue ''\n template = ERB.new(info, nil, '<>')\n puts \"\\n#{template.result(binding)}\"\n end", "def test_print_usage\n fr = FileReader.new\n assert_output(\"Usage: ruby verifier.rb <name_of_file>\\n\"\\\n \"\\tname_of_file = name of file to verify\\n\") { fr.print_usage }\n end", "def print_info\n print <<EOF\n ****************************************************************************************** \n Info: \n This program needs a input file as first argument to proceed.\n ****************************************************************************************** \n\nEOF\nend", "def show\n @file_name = @quickchecker.file\n end", "def display_help\n puts \"Dev Sync : report or sync your development files\"\n puts \" report nas_directory(optional)\"\n puts \" sync reported_file_name\"\nend", "def whereami() [__FILE__] end", "def build_info_file\n File.join build_info_dir, \"#{full_name}.info\"\n end", "def output_details(files) \n @stdout.puts\n @stdout.puts \"Details\".bold\n files.each do |t|\n fname = t.path\n @stdout.puts \"File: %s\" % [((t.status == FileData::STATUS_OK) ? fname : fname.red)]\n @stdout.puts \"Includes: %s\" % [format_fds(t.includes)] unless t.includes.empty?\n @stdout.puts \"Included by: %s\" % [format_fds(t.included_by)] unless t.included_by.empty?\n @stdout.puts \"References: %s\" % [format_fds(t.references)] unless t.references.empty?\n @stdout.puts \"Referenced by: %s\" % [format_fds(t.referenced_by)] unless t.referenced_by.empty?\n unless t.status == FileData::STATUS_NOT_FOUND\n # show that part only if file exists\n @stdout.puts \"Size: %s (%d)\" % [format_size(t.size),t.size]\n if (t.docbook)\n @stdout.puts \"Type: DocBook, Version #{t.version}, Tag: #{t.tag}\"\n else\n @stdout.puts \"MIME: #{val_s(t.mime)}\"\n end\n @stdout.puts \"Timestamp: %s\" % [t.ts]\n @stdout.puts \"SHA1: %s\" % [t.checksum]\n end\n @stdout.puts \"Error: %s\" % [t.error_string.to_s.red] unless (t.error_string.nil?) \n @stdout.puts\n end\n end", "def print_usage; end", "def output\n puts \"Config files exist for the following sites:\"\n @local[CONFIG_DIR].contents.each do |file|\n puts \"\\t\"+file.name.split('.')[0..-3].to_s+\"\\t\"+file.last_modified.to_s\n end\n\n # And output our help file, too!\n RDoc::usage('synopsis')\n end", "def help\n print \"You must pass in the path to the file to launch.Usage: #{__FILE__} target_file\"\nend", "def print_storage_info()\n puts(\"Correctly received sequences file:\\t#{@received_file_path}\")\n puts(\"Wrongly received sequences file:\\t#{@failed_file_path}\")\n puts(\"Processed received sequences file:\\t#{@processed_file_path}\")\n end", "def print_usage\n puts @@usage\n end", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end", "def printUsage\n \n print \"usage -- main.rb <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - MD output (.out, .xyz)\\n\"\n \n end", "def show_stat\n \t\tputs \"=============Statistics============\"\n \t\tputs \"Score: #{get_score}\"\n \t\tputs \"Total time: \" + \"%0.2f\" %(@end_time - @start_time + @save_time) + \" seconds\"\n \t\tputs \"Number of sets found: #{@number_of_correct}\"\n \t\tputs \"#{@number_of_hint}/#{@total_hint} hints used\"\n \tend", "def describe\n\t\t\"Print the content of the file to the client\"\n\tend", "def working_file(file)\n \"#{working_dir}/#{file_string(file)}\"\n end", "def display_source_file(doc_info)\n <<~SRC_FILE_TXT\n Source file::\n #{doc_info.src_file}\n SRC_FILE_TXT\n end", "def info\n puts 'Info'\n end", "def print_output\r\n\t\t\tprint \"Files: #@num_files \\n\"\r\n\t\t\tprint \"Lines of Code: #@total \\n\"\r\n\t\t\tprint \"Blank Lines: #@blank_lines \\n\"\r\n\t\t\tprint \"Total Lines: #@lines\"\r\n\t\tend", "def txt\n @info_file\n end", "def print_usage\n log.puts \"Usage: yri [options] <Path to object>\"\n log.puts \"See yri --help for more options.\"\n end", "def show\n file_name = project_log_path\n if File.exist?(file_name)\n @logOffset = File.size(file_name)\n else\n @logOffset = 0\n end\n\n # get load_test data\n @load_tests = @project.load_tests.reverse_chronological_list #LoadTest.where(project_id: @project.id).reverse_chronological_list\n end", "def usage(stream=$stderr, status=1)\n stream.puts File.readlines(__FILE__).\n grep(/^#\\//).\n map {|line| line.sub(/^#. ?/, '')}.\n join\n exit status\nend", "def usage\n \"Usage: #{File.basename __FILE__} BIBID_DIR_CSV\"\nend", "def usage()\n\tSTDERR.print \"Usage: ruby #{$0} [INPUT FILE(.txt)] [OUTPUT FILE(.h)]\\n\"\nend", "def print_stat\n puts \"\\n\"\n puts \"********************\"\n puts \"Statistics:\"\n\n puts \"\\n\"\n puts \"Failed: #{$fail_uploaded_count}\"\n $not_uploaded_features_list.each do |feature|\n puts feature\n end\n\n puts \"\\n\"\n puts \"Success: #{$success_uploaded_count}\"\n $uploaded_features_list.each do |feature|\n puts feature\n end\n puts \"********************\"\n\n File.write('result.log', \"#{$updated_count},#{$created_count},#{$deleted_count}\")\nend", "def cur_stat\n # TODO what output format have to be ?\n Time.now.utc.to_s + \" : \" + self.state + \" : \" + self.path\n end", "def description()\r\n #out puts what the command is doing and the path it is taking to do it\r\n puts \"Deleting a file at: #{@FilePath}\"\r\n end", "def inspect\n \"#<HG Versioned File: #{to_s}>\"\n end", "def printUsage\n print \"usage -- Moldyne.rb <numTimesteps> <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - prefix for two output files (.out, .xyz)\\n\"\n end", "def usage()\n STDOUT.puts \"USAGE: ruby find-missing-developers-in-git-commits.rb LOGS_FILE\"\nend", "def usage(stream=$stderr, status=1)\n stream.puts File.readlines(__FILE__).\n grep(/^#\\//).\n map { |line| line.sub(/^#. ?/, '') }.\n join\n exit status\nend", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def infos_path\n\t@infos_path ||= File.join(main_folder, 'infos.yaml')\nend", "def info_msg(msg=\"\")\n puts(msg)\n @file.puts(msg)\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def show_help\n puts HELP_INSTALL\n end", "def show(filename)\n File.read File.join(@base_path, filename)\n end", "def stat\n end", "def print_usage\n puts \"Usage: #{__FILE__} <filename>\"\n exit -1\nend", "def show_usage\n puts \"Usage: #{$PROGRAM_NAME} pattern [filename]\"\n exit\nend", "def usage\n puts @usage_text\n end", "def info\n if exists?(config = plugin_path)\n File.open(config).read.gsub(/^/,' ')\n else\n \" none\"\n end\n end", "def daemon_show_usage\n daemon_show_version\n puts \"\\nUsage:\"\n puts \" -b, --background work in background mode\"\n puts \" -v, --version view version of daemon\"\n puts \" -h, --help view this help\"\nend", "def stat() end", "def help\n J2R.open_file_command(HELP_FILE)\n end", "def help\n J2R.open_file_command(HELP_FILE)\n end", "def print_file(*) end", "def print_usage \n puts \"Usage: packagize [-h] [-v] [-r] [-s source_dir] [-d dest_dir]\"\n puts \"\\tSource and destination default to the current working directory.\"\n puts \"\\t-r search directory and all subdirectories. Defaults to true.\"\n puts \"\\t-v display verbose output. Defaults to false.\"\n puts \"\\t-h display this text.\"\nend", "def usage\n puts \"Usage:\"\n puts \" tools/find-unused-labels.rb > unused-labels.txt\"\nend", "def show_usage\n STDERR.puts \"\\nusage: ./build [ profile=<name> ] [ --minify ]\"\n STDERR.puts \"\\nsupported profiles are:\"\n Dir.chdir(PROFILE_PATH) do\n STDERR.puts Dir['*.js'].map {|profile| \"\\t#{profile.sub(/\\.js/, '')}\"}\n end\n STDERR.puts \"\\nIf no profile is selected, 'core' will be used\\n\\n\"\n exit(1)\nend", "def view_code_for(user)\n results = {}\n puts \"Displaying code for #{user.cyan}\"\n CONFIG['project_files'].each do |file|\n if File.exists?(\"#{user}/#{CONFIG['project_name']}/#{file}\")\n puts \"Displaying #{file.yellow}\"\n code = File.open(\"#{user}/#{CONFIG['project_name']}/#{file}\").read\n puts code\n else\n puts \"No #{file} for #{user}\".red\n end\n end\n puts\n puts \"Displaying #{'git logs'.yellow}\"\n g = Git.open(\"#{user}\")\n g.log.each {|x| puts x.message}\n results['points'] = ask('How many points is this worth? ', Integer)\n results['notes'] = ask('Aditional notes: ').to_s\n results\n end", "def print\n if exists?\n puts file.read\n else\n puts \"No file exists for date: #{@day}\"\n end\n end", "def prof_file\n base_info_file + '.profile'\n end", "def display_source_file(doc_info)\n # Use the path relative to the git repo root as display\n src_file = Pathname\n .new(doc_info.src_file)\n .relative_path_from(@git_repo_root).to_s\n <<~SRC_FILE_TXT\n Source file::\n #{src_file}\n SRC_FILE_TXT\n end", "def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend", "def print_debug_info\n puts \"Programmer #{name}:\"\n puts \"\\tSpeed: #{speed}\"\n puts \"\\tDaily wage: #{daily_wage}\"\n puts \"\\tProject: #{project_name}\"\n end", "def print_help\n puts \"Usage:\n \\t./#{$PROGRAM_NAME} file.gpx [file2.gpx ...] -i|-m|--help\\n\n \\t\\t#{$PROGRAM_NAME}\\t - name of script\n \\t\\tfile.gpx file2.gpx\\t - one or more file names to fix\n \\t\\t-i\\t - fix files 'in place'\n \\t\\t-m\\t - merge to one gpx file, if tracks are continous (see -t switch) (default)\n \\t\\t-t NUM - treshhold for merge tolerance in meters (default 30 meters)\n \\t\\t--help\\t - print usage\"\n exit 1\n end", "def display_info(job)\n unless ARGV.include? \"--silent\"\n puts \"Job #{job.id} of relative duration #{job.relative_duration} has been attributed to server #{(@id + 1)}\"\n end\n end", "def usage()\n puts \"\\nUsage: #{File.basename($0)}\"\n puts \"\\t-d --device\\t\\t\\tList of devices to configure (file).\"\n puts \"\\t-c --config\\t\\t\\tConfiguration file to commit.\"\n puts \"\\t-u --username\\t\\t\\tSSH username.\"\n puts \"\\t-p --password\\t\\t\\t(Optional) SSH password.\"\n puts \"\\t-h --help\\t\\t\\tDisplay the usage.\\n\\n\"\n puts \"* If you have spaces in the path to your file(s), please enclose them in quotes \\\"\\\".\\n\\n\"\n exit\nend", "def print_track track\n\t\tputs('Title: ' + track.name.to_s)\n \tputs('File location: ' + track.location.to_s)\nend", "def info_file(path = nil)\n File.join(info_dir(path), 'info.yaml')\n end", "def show_info\n\t\tputs \"Your start station: #{starting_point}\"\n\t\tputs \"Your destination: #{ending_point}\"\n\t\tputs \"Travel time: ___\"\n\t\tputs \"Price: ____\"\n\tend", "def help\n puts \"Usage: git file-history filename\"\n puts \" Show blame history for a file\"\n exit 1\nend", "def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mysh\").to_s}],\n [\"init file\", $mysh_init_file.to_host_spec],\n [\"user\", ENV['USER']],\n [\"home\", (ENV['HOME'] || \"\").to_host_spec],\n [\"name\", (t = MNV[:name]).empty? ? $PROGRAM_NAME.to_host_spec : t],\n [\"os shell\", (ENV['SHELL'] || ENV['ComSpec'] || \"\").to_host_spec],\n [\"host\", ENV['HOSTNAME'] || ENV['COMPUTERNAME']],\n [\"os\", ENV['OS']],\n [\"platform\", MiniTerm::TERM_PLATFORM],\n [\"java?\", MiniTerm.java? ? true : false],\n [\"PID\", $PROCESS_ID]\n ]\n end", "def print_info\n params = Hash[\n :working, `pwd`.strip,\n :setting_file, ENV['SETTING_FILE'],\n :platform, @platform,\n :project_path, project_path,\n :unity_editor_platform, unity_editor_platform,\n :build_path, build_path,\n :ipa_path, ipa_path,\n :apk_path, apk_path,\n :build_version, build_version,\n :product_name, product_name,\n :bundle_version, bundle_version,\n :build_number, build_number,\n ]\n\n UI.message \"\\n#{Terminal::Table.new(\n title: 'Build info'.green,\n headings: %w[Option Value],\n rows: FastlaneCore::PrintTable.transform_output(params)\n )}\"\n\n print_help\nend", "def readable_file\n\tputs File.readable?(\"test.txt\")\n\tputs File.writable?(\"test.txt\")\n\tputs File.executable?(\"test.txt\")\nend", "def usage\n puts \"Usage: akaza exec|wsrb|exec_wsrb FILE_NAME\"\nend", "def info; end", "def info; end", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend" ]
[ "0.7140719", "0.7116872", "0.67332524", "0.66440094", "0.66355795", "0.6399413", "0.6399413", "0.6352219", "0.6204606", "0.614999", "0.6129707", "0.60903585", "0.6085597", "0.60323995", "0.6001724", "0.60008115", "0.59845006", "0.5981177", "0.5955703", "0.5954945", "0.5945678", "0.593835", "0.5934037", "0.59329355", "0.5932274", "0.5928892", "0.5913224", "0.5913224", "0.59104127", "0.5896438", "0.5892404", "0.5887758", "0.5851621", "0.58499247", "0.5816881", "0.5811962", "0.5806972", "0.58014596", "0.5798156", "0.5783339", "0.57804626", "0.5778939", "0.57763463", "0.5771296", "0.57549846", "0.5739413", "0.5730417", "0.5717072", "0.5700471", "0.5695278", "0.56788534", "0.56494457", "0.56473804", "0.5645009", "0.56408757", "0.5639628", "0.56364846", "0.5629886", "0.5624126", "0.56218594", "0.5620295", "0.56137097", "0.5609761", "0.55954623", "0.55938554", "0.55904174", "0.5586046", "0.558562", "0.558509", "0.55815023", "0.5580382", "0.55781364", "0.55671936", "0.55644286", "0.556396", "0.556396", "0.55622274", "0.55599916", "0.5559451", "0.5551624", "0.55419755", "0.554042", "0.55360734", "0.5520547", "0.55199075", "0.55198705", "0.55158836", "0.5501357", "0.5499873", "0.5493385", "0.5487873", "0.54869217", "0.5484324", "0.5481385", "0.54795104", "0.5474724", "0.54632884", "0.54618955", "0.54618955", "0.5459503" ]
0.6885069
2
Read dta from file Param :only can define limit of readed lines from file not implemented yet
def read return if @read_flag process_reading end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dta_files(fh, num_files, unpack_35)\n dta_files = Array.new(num_files)\n start = dta_start_byte\n fh.pos = start\n\n header.num_dta_files.times do |i|\n dta_files[i] = Mspire::Sequest::Srf::Dta.from_io(fh, unpack_35) \n end\n dta_files\n end", "def read_data_file(path); end", "def read_contents\n\n #puts \"pofr file #{@file_blob.filename}\"\n\n file_lines=[]\n @file_blob.open do |file|\n File.open(file){|x| file_lines = x.readlines}\n puts file_lines[0]\n puts file_lines.last\n end\n\n if @file_blob.filename.extension == \"out\" # GNOM\n getDataLinesFromGnom(file_lines)\n elsif @file_blob.filename.extension == \"dat\" # scatter\n puts \"reading file @file #{@file_blob.filename}\"\n getDataLinesFromScatter(file_lines)\n end\n\n @dmax = @r_values.last\n @pr_values.each do |y|\n @pr_max = (y[1] > @pr_max) ? y[1] : @pr_max\n @pr_min = (y[1] < @pr_min) ? y[1] : @pr_min\n end\n\n end", "def get_range_in_file( file_name, line_a=1, line_b=-1 )\n\t\t@data_source = File.open( file_name, \"r\" )\n\t\tinitial_load_range( line_a, line_b )\n\tend", "def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend", "def get_lines(filename); end", "def read(start: 0, num: 10)\n f = open(@filename, 'r')\n # Iterate to start line\n start.times { f.gets }\n \n # Read lines start to last\n data = ''\n num.times {\n chunk = f.gets\n data << chunk unless chunk.nil?\n }\n \n f.close()\n return data\n end", "def read_file(filename); end", "def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end", "def file_read_opts; end", "def read_denreifile\n set_default\n return unless File.exist? './Denreifile'\n execute_denrei_dsl read_denreifile_source\n end", "def read_txt\n # Open TXT file\n # f = File.open(self.fichero, \"r\")\n # Use TXT file content\n f = self.fichero\n # Loop thru open file lines\n f.each_line do |line|\n cod_reg = line[0,2]\n if cod_reg == '80'\n # Totals line\n amount = line[36,12]\n self.total_bills = line[22,6].to_i\n self.total_amount = (amount[0,10] + '.' + amount[10,2]).to_d\n elsif cod_reg == '02'\n # Header line\n pdate = line[36,6]\n self.nif = line[10,8]\n self.sufijo = line[18,3]\n self.process_date_time = Date.parse(pdate[4,2] + pdate[2,2] + pdate[0,2]) rescue Date.today\n elsif cod_reg == '01' || cod_reg == '90'\n # First or Last line\n else\n # Invoice charged line: Save in array\n amount = line[36,12]\n self.lista_cobros.push(bill_id: line[76,11].to_i,\n amount: (amount[0,10] + '.' + amount[10,2]).to_d,\n date: line[30,6],\n issuer: line[10,8],\n suffix: line[18,3],\n charge_code: line[21,1],\n charge_bank: line[22,4],\n charge_office: line[26,4],\n charge_id: line[48,6],\n iban_head: line[4,4],\n ccc_bank: line[54,4],\n ccc_office: line[58,4],\n ccc_dc: line[62,2],\n ccc_account_no: line[64,10],\n debit_code: line[74,1],\n cancel_code: line[75,1],\n reference: line[76,13])\n end\n end # f.each_line\n # f.close\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 read_file(file, context); end", "def read\n x = nil\n File.open(@filename, 'r') {|f| x = f.readlines }\n x.each do |line|\n\n line = self.class.remove_comments(line)\n\n if line.present?\n @data << self.class.extract_data_from_line(line)\n # puts self.class.extract_data_from_line(line).to_yaml\n end\n end\n end", "def read_config_file(file); end", "def read file\n File.open file\n end", "def read_file filename\n\t\tbegin\t \n\t\t\tfile = File.new(filename, \"r\")\n\t\t\tline_number = 1\n\t\t file.each do |line|\t\t \t\n\t\t \tself.read_input_line line, line_number\n\t\t \tline_number += 1\n\t\t end\t \n\t\trescue => err\n\t\t puts \"File not loaded: #{err}\"\n\t\t err\n\t\tensure file.close if file end\n\tend", "def read_ld_output_file(ldfile)\n snp_lds = Array.new\n\n begin\n File.open(ldfile, \"r\") do |file|\n file.each_line do |oline|\n oline.each_line(\"\\r\") do |line|\n next if line =~ /^\\n$/\n if line =~ /LOD/\n next\n end\n\n data=strip_and_split(line) \n snp_lds << SNPCombination.new(data[0], data[1], data[2], data[3], data[4])\n end\n end\n end\n rescue StandardError => e\n puts e\n exit(1)\n end\n return snp_lds\n\n end", "def readlines(*several_variants)\n #This is a stub, used for indexing\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end", "def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend", "def read_file\n if @file_lines.empty?\n @file = File.open(@population_file)\n @file_lines = @file.readlines()\n end\n end", "def read_trees(filename, limit=nil)\n log(\"Reading #{filename}...\")\n File.open(filename, \"r\") do |file|\n lines = file.readlines\n lines = lines.take(limit) unless limit.nil?\n lines.map do |line|\n Tree.from_string(line)\n end\n end\nend", "def handle_inputs_from_file file_path\n File.open(file_path) do |file|\n file.lazy.each_slice(500) do |input_lines|\n input_lines = input_lines.delete_if { |line| line == \"\\n\" } # There can be empty lines\n iterate_over_lines_and_fetch_domain(input_lines)\n end\n end\n end", "def read_text(filename); end", "def load_file_data(file)\n @data = separate_into_blocks(IO.readlines(file))\n end", "def import_ori(file_path)\n string = IO.read(file_path)\n array = string.split(\"\\n\")\n array.shift\n return array\n end", "def readlines(*args) IO.readlines(path, *args) end", "def read_file(file)\n results = error_basic_inject(\"select CHAR_LENGTH(load_file(#{file.strip.chomp.mysqlhex}))\")\n if results.nil? or results == ''\n print_line(\"\")\n print_caution(\"Unable to determine size of #{file}....\")\n max = 1000\n else\n max = results.to_i\n end\n data = ''\n count = 1\n complete = false\n while not complete \n results = error_basic_inject(\"select mid(load_file(#{file.strip.chomp.mysqlhex}), #{count},50)\")\n count += 50\n if not results.nil? and not results == ''\n data += results.gsub('\\x0A', \"\\n\").gsub('\\x09', \"\\n\")\n else\n results = error_basic_inject(\"select mid(load_file(#{file.strip.chomp.mysqlhex}), #{count},50)\")\n count += 50\n if not results.nil? and not results == ''\n data += results.gsub('\\x0A', \"\\n\").gsub('\\x09', \"\\n\")\n else\n complete = true\n end\n end\n break if count > (max + 100)\n end\n if not data.nil? and not data == ''\n # Log Success for offline review\n logs = RESULTS + $config['INJECTOR']['MYSQL']['URL'].sub('http://', '').sub('https://', '').sub(/\\/$/, '').split(\"/\")[0]\n logdir = logs + '/load_file/'\n logfile = logdir + file.gsub('/', '_').gsub('\\\\', '_').gsub(/[;:'\",.~`!@#$\\%^&*\\(\\)=\\[\\]]/, '_')\n Dir.mkdir(logs) unless File.exists?(logs) and File.directory?(logs)\n Dir.mkdir(logdir) unless File.exists?(logdir) and File.directory?(logdir)\n f = File.open(logfile, 'w+')\n f.puts data\n f.close\n print_good(\"File: #{file}\")\n print_status(\"#########################################################\")\n print_line(\"#{data.chomp}\")\n print_status(\"#########################################################\")\n return true\n else\n print_line(\"\")\n print_error(\"No results for: #{file}\")\n return false\n end\n end", "def read_data(filename)\n count = 0\n fd = File.open(filename)\n while not fd.eof?\n line = fd.readline\n line.chomp!\n count += 1\n fields = []\n line.split('^').each do |f|\n datum = f.gsub('~~','').gsub(/^~/,'').gsub(/~$/,'')\n fields.push(datum.empty? ? nil : datum)\n end\n yield fields\n end\nrescue => e\n STDERR.puts \"error '#{e}' file '#{filename}' line #{count}\"\n exit\nensure\n fd.close\nend", "def by_line_length\n a = File.readlines(file_name)\n while b = a.shift\n puts b if b.length >= 250\n end\n end", "def readlines(*args, **kwd); end", "def readFromDB\n File.open('db.txt', 'r+') do |file|\n file.readlines\n end\nend", "def data; file_log.read(file_node); end", "def file_read_opts(context); end", "def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend", "def read_lines\n File.read(@document_file).split(\"\\n\")\n end", "def read_todos(filename)\n File.readlines(filename)\nend", "def read\n $t1 = Time.now # Init procedure timestamp\n person = []\n IO.foreach(\"data_500.txt\") do |line| # Get all patients from file iterate each line\n line.chomp! # Remove trailing whitespace.\n person.push(line.split(\":\")) # Saving data split :\n end\n group(person) # Get blood type\n end", "def read ( file, trace_dir )\n extension = File.extname(file)\n case extension\n when '.csv' then read_csv(file)\n when '.bag' then read_bag(file,trace_dir)\n else abort(\"file extension #{extension} not supported\")\n end\nend", "def test_read_with_a_length_specified\r\n contents = File.read('data.txt', 15)\r\n assert_equal 'Bradman 99.94 5', contents\r\n end", "def initial_load_range( line_a=1, line_b=-1 )\n\t\t@lines = []\n\t\tline_number = 0\n\t\tf = @data_source\n\t\tf.each do |line|\n\t\t\tline_number += 1\n\t\t\tnext unless line_number >= line_a\n\t\t\t@lines << Line.new(line_number, line.chomp )\n\t\t\tbreak if line_b != -1 && line_number >= line_b\n\t\tend\n\t\tf.close if f.is_a? File\n\t\t@lines\n\tend", "def get_aa_lines(file_name)\n File.open(\"#{File.dirname(__FILE__)}/../../config/aa/#{file_name}.txt\") {|f| f.readlines }\n end", "def read\n file\n end", "def readlines(*args)\n IO.readlines(@path, *args)\n end", "def readfile\n features=[]\n feature=''\n data_range=''\n price=''\n \n File.open(\"./public/test.txt\", \"r\").each_line do |line|\n feature = line.scan(/([a-zA-z ]+ \\– [0-9]+)/).to_s.strip()\n date_range= line.scan(/([0-9\\/]+ \\– [0-9]+\\/[0-9]+)/).to_s\n price = line.scan(/( [0-9]+\\.[0-9]+)/).to_s.strip()\n this_feature={\n \"feature\" => feature,\n \"date_range\" => date_range,\n \"price\" => price\n \n }\n features << this_feature\n \n \n end\n\n return features\n end", "def readlines(*rest) end", "def readlines(*rest) end", "def read(files); end", "def read(files); end", "def get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend", "def read_data(filename)\n data = File.readlines(filename).map{|line| line.chomp.split(\"\\t\"). map{|field| field == \"\" ? nil : field}}\n data.map do |line|\n {:district => line[0], :name => line[1], :sponsorship => line[2], :phone1 => line[3], :phone2 => line[4], :email => line[5]}\n end\nend", "def read_file(file)\r\n\tlines = IO.readlines(file)\r\n\tif lines != nil\r\n\t\tfor i in 0 .. lines.length-1\r\n\t\t\tlines[i] = lines[i].sub(\"\\n\",\"\")\r\n\t\tend\r\n\t\treturn lines[0..lines.length-1]\r\n\tend\r\n\treturn nil\r\nend", "def reader; end", "def readSource\n if @source_in.nil?\n @source_in = open @dir+Pathname.new(@source)\n # fields titles\n head=@source_in.readline.strip\n @heads=head.split(/\\s*,\\s*/)\n @hoplang_cols_order = @heads.join ','\n end\n\n begin\n line=@source_in.readline.strip\n datas=line.split(/\\s*,\\s*/)\n\n i=0\n value={}\n @heads.each {|h|\n value[h]=datas[i]\n i+=1\n }\n value['__hoplang_cols_order'] = @hoplang_cols_order\n # now store variable!\n #varStore.set(@current_var, value)\n return value\n rescue EOFError\n hop_warn \"EOF.....\\n\"\n #varStore.set(@current_var, nil)\n return nil\n end\n line\n end", "def read\n file.read\n end", "def _read filename\n d = []\n File.open(filename).each { |line|\n d << line\n }\n return d\n end", "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n return data\nend", "def openFile(folder, arquive)\n file = File.open(folder+\"/\"+arquive+\".txt\",\"r\")\n @dataLines=file.read\n file.close\n @vectorLines = split_input(@dataLines, \"\\n\")\n end", "def load_file(f)\n\t\tdata = []\n f.each do |line| \n user_id, movie_id, rating, timestamp = line.split(\"\\t\")\n data.push({\"user_id\"=> user_id.to_i, \"movie_id\"=>movie_id.to_i,\"rating\"=> rating.to_i,\"timestamp\"=>timestamp.to_i})\n\t\tend\n\t\treturn data\n\tend", "def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend", "def readFile()\n\t#This is assuming the file name will be used\n\tfilename = 'names-data.txt'\n\topen(filename, 'r') {|f| f.read}\nend", "def read(path); end", "def read\n @lines.shift\n end", "def read_between_the_lines(file_name, start_line, end_line)\n content = File.read(File.expand_path(file_name))\n lines_array = content.each_line.to_a\n\n [lines_array[start_line..end_line].join, normalized_line_number(start_line, lines_array.size),\n normalized_line_number(end_line, lines_array.size)]\n end", "def read\n @fileobj = File.open(@fname,\"r\")\n parse_header_line(@fileobj.readline) unless @fileobj.eof?\n\n while (!@fileobj.eof?)\n yield(parse_data_line(@fileobj.readline))\n end\n end", "def read_file(file)\n\tlines = IO.readlines(file)\n\tif lines != nil\n\t\tfor i in 0 .. lines.length-1\n\t\t\tlines[i] = lines[i].sub(\"\\n\",\"\")\n\t\tend\n\t\treturn lines[0..lines.length-1]\n\tend\n\treturn nil\nend", "def load_file (filename)\n @name = nil\n File.open(filename, mode: 'r').each do |ln|\n flds = ln.split(',')\n if !@name\n @name = flds[0]\n end\n dts = flds[1];\n @obvs << \"#{dts[2..3]}-#{dts[4..5]}-#{dts[6..7]}\"\n @values << flds[2].to_f\n end\n #puts \"load_file: #{@values.size}\"\n end", "def readlines(filename, start_pos, num_lines, client)\n arr = IO.readlines(\"File1.txt\")\n for i in 0..num_lines-1\n client.puts arr[i]\n end\nend", "def n_lines(filename); end", "def get_data_from_file(file)\r\n f = File.open(file, \"r\")\r\n gene = Array.new\r\n f.each_line do |line|\r\n gene << line.delete(\"\\n\") # We remove end of line \\n \r\n end\r\n return gene\r\nend", "def read_data_from_file(aFile)\n count = aFile.gets.to_i\n puts count.to_s\n puts aFile.gets\n puts aFile.gets\n puts aFile.gets\n puts aFile.gets\n puts aFile.gets\nend", "def load_data\n self.open if @io.nil?\n @lines = @io.readlines\n @io.rewind\n @lines.delete_if {|line| line.match(/^\\s*$/)}\n @num_lines = @lines.count\n end", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def read_file_parts(file, variable, funcion = nil)\n while((line = file.gets) and !line.include?(\"---\"))\n line = line.chomp.split(\"\\t\")\n variable.send(funcion, line) if funcion\n end\n end", "def read_ddi_metadata\n dataset = Dataset.find(dataset_id)\n ddi_parser = DDI::Parser.new\n all_variables = Variable.all(:conditions=> {:dataset_id => dataset_id})\n all_variable_ids = all_variables.collect{|var| var.id}\n parsed_variable_ids = []\n new_variables = []\n study = ddi_parser.parse filename\n #create variables for the dataset\n study.ddi_variables.each do |variable|\n #TODO find the variable from the dataset and if nil then add new var since this is from nesstar and we don't use the dataset to find the vars\n existing_variable = Variable.all(:conditions=>{:name=>variable.name, :dataset_id => dataset_id}).first\n #if the variable does not exist then go on to the next one, only load metadata for vars in the db\n if existing_variable != nil\n\t existing_variable.update_attributes(:value=>variable.label) if variable.label != nil\n if variable.group == nil\n variable_category = 'N/A'\n end\n parsed_variable_ids << existing_variable.id \n variable.categories.each do |category|\n valDom = ValueDomain.all(:conditions=>{:variable_id => existing_variable.id, :value => category.value, :label => category.label}).first \n if valDom == nil \n valDom = ValueDomain.new(:variable_id => existing_variable.id, :value => category.value, :label => category.label)\n valDom.save\n end \n category.category_statistics.each do |statistic|\n #the frequency statistics for the value domain\n #guessing that 'freq' is consistent, however......\n if statistic.type == 'freq'\n val_dom_stat = ValueDomainStatistic.all(:conditions=>{:frequency => statistic.value, :value_domain_id => valDom.id}).first\n if val_dom_stat == nil\n val_dom_stat = ValueDomainStatistic.new(:frequency => statistic.value, :value_domain_id => valDom.id)\n val_dom_stat.save\n else\n val_dom_stat.update_attributes(:frequency => statistic.value) if val_dom_stat.frequency != statistic.value\n end\n break\n end\n end\n end\n variable.summary_stats.each do |summary_stat|\n begin\n if summary_stat.type == 'mean'\n existing_variable.update_attributes(:mean => summary_stat.value) if var.mean != summary_stat.value\n elsif summary_stat.type == 'stdev'\n existing_variable.update_attributes(:standard_deviation => summary_stat.value) if existing_variable.standard_deviation != summary_stat.value\n elsif summary_stat.type == 'invd'\n existing_variable.update_attributes(:invalid_entries => summary_stat.value) if existing_variable.invalid_entries != summary_stat.value\n elsif summary_stat.type == 'vald'\n existing_variable.update_attributes(:valid_entries => summary_stat.value) if existing_variable.valid_entries != summary_stat.value\n end\n rescue\n logger.warn Time.now.to_s + 'One of the summary stats failed for variable ' + existing_variable.id.to_s\n end\n end\n question = variable.question != nil ? variable.question : \"\"\n interview = variable.interview_instruction != nil ? variable.interview_instruction : \"\"\n derivation = question + interview\n if variable.question != nil && variable.interview_instruction != nil\n existing_variable.update_attributes(:dermethod => derivation) if existing_variable.dermethod != derivation\n end\n end\n end\n end", "def read_config_file; end", "def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end", "def mysql_lines\n File.open(file_name, \"r\") do |line|\n #File.open('./lib/databasers/fibered_files_output.txt') do |line|\n line.each do |x|\n puts \"('\" + \"#{x.strip}\" + \"')\"\n end\n end\n end", "def read_line\n @line = @file.gets\n @file.close if @line.nil?\n end", "def read_feeds(fname)\r\n File.foreach(fname) {|line| process_feed(line.split(',')[0], line.split(',')[1], line.split(',')[2], line.split(',')[3])}\r\n end", "def read() end", "def read_lines(data)\n blockchain_temp = IO.readlines(data)\n blockchain_temp\n end", "def read(nombre_archivo)\n\tif File.file?(nombre_archivo)\n\t\tf = File.open(\"#{nombre_archivo}\").each_line do |line|\n \tp line\n \tend\t\n\tend\nend", "def read(_lines)\n raise NotImplementedError\n end", "def readlines(sep=$/) end", "def readlines(sep=$/) end", "def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end", "def read_file(absolute_path); end", "def read_file(file_name=\"\")\n\tFile.open(file_name) do |file|\n\t\twhile line = file.gets\n\t\t\ta = %w{#{line}}\n\t\t\tputs a\n\t\t\tputs line\n\t\tend\n\tend\nend", "def read_tail(f)\n f.seek(0)\n f.readbytes(4).unpack('N').first\n end", "def read_test_file(file)\n read_file(file)\n end", "def read_by_line_number line_number\n uri = ''\n File.open('storage.db','r') do |f|\n count = f.gets.to_i\n raise 'URI unaccesible' if count < line_number\n while line_number >0\n uri = f.gets\n line_number -= 1\n end\n end\n uri\n end", "def read_source(source_file)\n @source_lines = source_file.readlines()\n end", "def readDataSingleSource(nameout)\n\t\t\tif nameout.include?(\".source\") == false\n\t\t\t\tnameout = nameout + \".source\"\n\t\t\tend\n\t\t\tdatautils = DataUtils.new\n\t\t\t#puts \"nameout: \" + nameout;\n\t\t\t@l = -1;\n\t\t\t@b = -1;\n\t\t\t@r = -1;\n\t\t\t@ell_a = -1;\n\t\t\t@ell_b = -1;\n\t\t\t@ell_phi = -1;\n\t\t\t\n\t\t\t@sicalc = 0\n\t\t\t@sicalc_error = 0\n\n\t\t\t#read upper limit\n\t\t\tindex2 = 0;\n\t\t\t@r = -1;\n\t\t\t@galcoeff = \"-1\"\n\t\t\t@galcoeff_err = \"-1\"\n\t\t\t@galcoeffzero = \"-1\"\n\t\t\t@galcoeffzero_err = \"-1\"\t\n\t\t\t@isocoeff = \"-1\"\n\t\t\t@isocoeff_err = \"-1\"\n\t\t\t@isocoeffzero = \"-1\"\n\t\t\t@isocoeffzero_err = \"-1\"\t\n\t\t\t@fitdata = \"-1, -1, -1, -1, -1, -1, -1\"\n\t\t\tFile.open(nameout).each_line do | line |\n\t\t\t\tindex2 = index2 + 1;\n\t\t\t\tlll = line.split(\" \")\n\t\t\t\tif index2.to_i == 15\n\t\t\t\t\t@label =lll[0];\n\t\t\t\t\t@fix =lll[1];\n\t\t\t\t\t@si_start = lll[2];\n\t\t\t\t\t@ulconflevel = lll[3];\n\t\t\t\t\t@srcconflevel = lll[4];\n\t\t\t\t\t@startL = lll[5];\n\t\t\t\t\t@startB = lll[6];\n\t\t\t\t\t@startFlux = lll[7];\n\t\t\t\t\t@lmin = lll[9];\n\t\t\t\t\t@lmax = lll[11];\n\t\t\t\t\t@bmin = lll[14];\n\t\t\t\t\t@bmax = lll[16];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 16\n\t\t\t\t\t@sqrtTS =lll[0];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 17\n\t\t\t\t\t@l_peak = lll[0];\n\t\t\t\t\t@b_peak = lll[1];\n\t\t\t\t\t@dist = lll[2];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 18\n\t\t\t\t\t@l = lll[0]\n\t\t\t\t\t@b = lll[1]\n\t\t\t\t\t@distellipse = lll[2];\n\t\t\t\t\t@r = lll[3];\n\t\t\t\t\t@ell_a = lll[4];\n\t\t\t\t\t@ell_b = lll[5];\n\t\t\t\t\t@ell_phi = lll[6];\n\t\t\t\t\t@fullellipseline = format(\"%.2f %.2f %.2f %.2f %.2f %.2f %.2f\", @l, @b, @distellipse, @r, @ell_a, @ell_b, @ell_phi)\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 19\n\t\t\t\t\t@counts = lll[0]\n\t\t\t\t\t@counts_error = lll[1]\n\t\t\t\t\t@counts_error_p = lll[2]\n\t\t\t\t\t@counts_error_m = lll[3]\n\t\t\t\t\t@counts_ul = lll[4];\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 20\n\t\t\t\t\t@flux = lll[0]\n\t\t\t\t\t@flux_error = lll[1]\n\t\t\t\t\t@flux_error_p = lll[2]\n\t\t\t\t\t@flux_error_m = lll[3]\n\t\t\t\t\t@flux_ul = lll[4];\n\t\t\t\t\t@exposure = lll[5]\n\t\t\t\tend\n\t\t\t\tif index2.to_i == 21\n\t\t\t\t\t@sicalc = lll[0]\n\t\t\t\t\t@sicalc_error = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 22\n\t\t\t\t\t@fit_cts = lll[0]\n\t\t\t\t\t@fit_fcn0 = lll[1]\n\t\t\t\t\t@fit_fcn1 = lll[2]\n\t\t\t\t\t@fit_edm0 = lll[3]\n\t\t\t\t\t@fit_edm1 = lll[4]\n\t\t\t\t\t@fit_iter0 = lll[5]\n\t\t\t\t\t@fit_iter1 = lll[6]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 23\n\t\t\t\t\t@galcoeff = lll[0]\n\t\t\t\t\t@galcoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 24\n\t\t\t\t\t@galcoeffzero = lll[0]\n\t\t\t\t\t@galcoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 25\n\t\t\t\t\t@isocoeff = lll[0]\n\t\t\t\t\t@isocoeff_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 26\n\t\t\t\t\t@isocoeffzero = lll[0]\n\t\t\t\t\t@isocoeffzero_err = lll[1]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 27\n\t\t\t\t\t@tstart = lll[0]\n\t\t\t\t\t@tstop = lll[1]\n\t\t\t\t\t\n\t\t\t\t\t@timestart_utc = @tstart\n\t\t\t\t\t@timestop_utc = @tstop\n\t\t\t\t\t@timestart_tt = datautils.time_utc_to_tt(@tstart);\n\t\t\t\t\t@timestop_tt = datautils.time_utc_to_tt(@tstop);\n\t\t\t\t\t@timestart_mjd = datautils.time_tt_to_mjd(@timestart_tt);\n\t\t\t\t\t@timestop_mjd = datautils.time_tt_to_mjd(@timestop_tt);\n\t\t\t\t\t\n\t\t\t\t\t#calcolo fase orbitale\n\t\t\t\t\t@orbitalphase = -1;\n\t\t\t\t\tif(@calcorbitalphase_period.to_f != 0)\n\t\t\t\t\t\ttimemjd = @timestart_mjd.to_f + (@timestop_mjd.to_f-@timestart_mjd.to_f)\n\t\t\t\t\t\t@orbitalphase = (timemjd.to_f - @calcorbitalphase_t0.to_f) / @calcorbitalphase_period.to_f;\n\t\t\t\t\t\t@orbitalphase = @orbitalphase.to_f - @orbitalphase.to_i;\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif index2.to_i == 28\n\t\t\t\t\t@energyrange = lll[0]\n\t\t\t\t\t@fovrange = lll[1]\n\t\t\t\t\t@albedo = lll[2]\n\t\t\t\t\t@binsize = lll[3] \n\t\t\t\t\t@expstep = lll[4] \n\t\t\t\t\t@phasecode = lll[5] \n\t\t\t\tend\n\t\t\tend\n\n\tend", "def find_valid_data filename\n start = 0\n dbfile = File.new(filename)\n s = dbfile.gets\n while s[0] == ?# or s[0]==?\\n\n start+= s.size\n s = dbfile.gets\n end\n dbfile.seek(-128, File::SEEK_END)\n s = dbfile.read(128).chomp;\n last = s.rindex(\"\\n\");\n dbfile.close\n return [start-1,File.size(filename) - last]\nend", "def readNodeFile(filename)\n f = File.open(filename, \"r\")\n f.each_line do |line|\n line = line.strip()\n arr = line.split(',')\n node = arr[0]\n port = arr[1]\n $ports[node] = port\n $dist[node] = \"INF\"\n $next[node] = \"NA\"\n end\n f.close\nend", "def read (filename, length, client)\n afile = File.new(filename.to_s, \"r\")\n if afile\n content = afile.sysread(length)\n puts content\n client.puts content\n else\n client.puts \"Unable to read file!\"\n end\nend", "def read_tsp_file( file_name )\n file_path = File.join( TSP_DIR, \"#{file_name}.tsp\" )\n File.open( file_path ).read\nend" ]
[ "0.6773155", "0.6330076", "0.6018883", "0.5952914", "0.58885807", "0.5849608", "0.5846505", "0.58419204", "0.5794437", "0.578502", "0.57768464", "0.57430184", "0.57319385", "0.57277215", "0.5713827", "0.57098323", "0.567283", "0.5653069", "0.5643832", "0.56415826", "0.5620287", "0.561456", "0.5611325", "0.55995095", "0.5589889", "0.5581766", "0.5577244", "0.55746883", "0.5516024", "0.548627", "0.54798156", "0.5456931", "0.54450816", "0.54331917", "0.54326713", "0.5432", "0.5431725", "0.5427728", "0.5427185", "0.5413982", "0.54051936", "0.5403139", "0.54009646", "0.53741336", "0.5364298", "0.535991", "0.5357022", "0.53502476", "0.53436244", "0.53436244", "0.53434676", "0.53434676", "0.534325", "0.53355616", "0.53277904", "0.53225225", "0.5317517", "0.53162396", "0.5315424", "0.53118277", "0.5311635", "0.52912885", "0.52905613", "0.5268946", "0.5257654", "0.5255081", "0.5252084", "0.5229737", "0.52249426", "0.5217076", "0.5215978", "0.5214438", "0.5212451", "0.52079993", "0.5207779", "0.5206854", "0.5200367", "0.5198171", "0.51912177", "0.51828855", "0.5180683", "0.51778257", "0.51762146", "0.51734936", "0.51653856", "0.5164733", "0.51638013", "0.51603514", "0.51583624", "0.51463306", "0.51420426", "0.51410407", "0.5128754", "0.51273185", "0.5125299", "0.5116096", "0.51148117", "0.5113636", "0.511155", "0.51090366", "0.51045024" ]
0.0
-1
Write data in file (named by pattern may be found in DefaultConstants::FILE_PATTERN) Will write data every time it calles to ensure that all current data writed in file may occurs duplicate if used more than once If data_to_write is array of hashes will use first hash keys as headers, else headers that provided by :header key in method call
def write(data_to_write:, headers: [], encoding: DefaultConstants::ENCODING) data_prepared, headers_prepared = prepare_data_for_writing(data_to_write, headers) begin process_writing(data_prepared, headers_prepared, encoding) puts "Writed in #{@output}".colorize(:cyan) rescue StandardError => e2 e2.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend", "def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end", "def process_writing(data_to_write, headers, encoding)\n begin\n open_and_write_data(data_to_write, headers, encoding)\n @write_flag = true\n puts 'Success. Check file with new data'\n rescue StandardError => e\n puts e.message\n rescue CSV::MalformedCSVError => e2\n puts e2.message\n end\n end", "def write(passed_data = nil)\n\t\t\tthis_data = passed_data || data\n\t\t\tFile.open(file_path+'/'+file_name, 'wb') do |file|\n\t\t\t\tfile.write( this_data.to_json )\n\t\t\tend\n\t\tend", "def write data\n case data\n when Hash then data = [data]\n else \n return { :result => false, :data => \"Input data type #{data.class} is not supproted.\" }\n end\n\n result, output = true, []\n\n data.each do |params|\n \n messages = []\n\n if params.has_key? :action\n messages << \"ArgumentError: Action name #{params[:action]} is not implemented\" unless ACTIONS.keys.include? params[:action]\n else\n messages << \"ArgumentError: Action name must be provided\"\n end\n \n # It makes sense to continue only if checks above did not fail\n if messages.empty?\n #\n # Clear all attributes first - so no old data left\n #\n ACTIONS.values.flatten.uniq.each do |att|\n self.instance_variable_set \"@#{att}\", nil\n end\n #\n # And set it to param's value\n #\n params.each { |k,v| self.instance_variable_set \"@#{k}\", v }\n #\n # Check that all variable that are used in the template are\n # actually set, not nil's\n #\n ACTIONS[@action].each do |var|\n messages << \"ArgumentError, Parameter :#{var} is required, cannot be nil\" if self.instance_variable_get(\"@#{var}\").nil?\n end\n \n # Try to write to file only if none of the above failed\n if messages.empty?\n self.ts = params[:ts] || Time.now.to_i.to_s\n \n format = \"[#{ts}] \" << ([self.action.to_s] + ACTIONS[self.action].map {|x| \"<%= #{x} %>\" }).join(';')\n \n begin\n File.open(path, 'a') do |pipe|\n pipe.puts ERB.new(format).result(self.get_binding)\n pipe.close\n end\n rescue e\n messages << e.message\n end\n end\n end\n \n output << { :data => params, :result => messages.empty? , :messages => messages }\n result &&= messages.empty?\n end # data.each\n\n { :result => result, :data => output }\n end", "def write(data)\n begin\n File.open(@filename, \"wb\") { |file| file.puts data.to_csv }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end", "def write(file_name, unique_keys, data, options = {})\n mode = (!options.empty? && options[:overwrite]) ? \"w\" : \"a\"\n open(file_name + \".json\", mode) do |f|\n unless rec_exists?(file_name, unique_keys, data)\n f.puts data\n end\n end\nend", "def write(*data); end", "def write_file(file, data)\n File.open(file, 'w') { |fd| fd.write(data) }\n end", "def write_file_after_save(file_data_to_write=nil)\n # check if there are data to write\n return unless(@file_data_to_write)\n \n begin\n self.class.benchmark(\"\\033[36m\\033[1m\\033[4mFileStore\\033[0m Saving file for #{self.id}\") do\n # create data directory path\n FileUtils.mkdir_p(data_directory)\n \n if(@file_data_to_write.is_a?(DataPath))\n copy_data_file\n else\n save_cached_data\n end\n \n @file_data_to_write = nil\n end\n rescue Exception => e\n assit_fail(\"Exception on writing file #{self.location}: #{e}\")\n end\n\n end", "def file_write(file2wrt, data2wrt)\n if not ::File.exists?(file2wrt)\n ::FileUtils.touch(file2wrt)\n end\n\n output = ::File.open(file2wrt, 'a')\n data2wrt.each_line do |d|\n output.puts(d)\n end\n output.close\n end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def write_to_file(file_name, data)\n key_path = ::File.dirname(file_name)\n ::FileUtils.mkdir_p(key_path) unless ::File.directory?(key_path)\n ::File.rename(file_name, \"#{file_name}.#{Time.now.to_i}\") if ::File.exist?(file_name)\n ::File.open(file_name, \"wb\", 0o600) { |file| file.write(data) }\n end", "def write(data)\n # black hole, because we don't actually care about what gets written\n end", "def write(data, *args, **kwd); end", "def write_file(file_name)\n File.open(file_name, 'w') { |f| f.write header_build }\n File.write(file_name, @content, mode: 'a')\nend", "def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end", "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def write_file(filename,data_write)\n begin\n data = data_write\n aFile = File.new(filename, \"w+\") \n if aFile\n aFile.syswrite(data)\n else\n raise \"Unable to open file!\"\n end \n rescue Exception => e\n puts e.message\n end \n end", "def prepare_data_for_writing(data_to_write, headers)\n if data_to_write.first.class.to_s.downcase =~ /hash/\n prepared_headers = data_to_write.first.keys.map(&:to_s)\n prepared_data_to_write = data_to_write.map { |data_h| data_h.values }\n return prepared_data_to_write, prepared_headers\n elsif data_to_write.first.class.to_s.downcase =~ /array/\n raise \"No headers provided for writing\" if !headers or headers.empty?\n\n return data_to_write, headers\n end\n end", "def write_data(filename, data)\n\tFile.open(filename, 'w').puts(data)\nend", "def write(data)\n end", "def write(data)\n raise CSVStream::InsufficientDataError unless data.is_a?(Array)\n\t \twrapper = data[0].is_a?(Array) ? data : [data]\n \t\twrapper.each {|r| write_row(r) }\n \tend", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def write_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit)\n end", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write_file(dir, file, data)\n File.open(\"#{dir}/#{file}.data\", \"w\") do |file|\n file.write(data.to_a.join(\"\\n\"))\n end\nend", "def write_to_file(data)\n\t\t\tref = File.join(@root, \"tarrifs_\" + @page[:name])\n\n\t\t\tif File.exists?(ref)\n\t\t\t\tdiff = \"\"\n\t\t\t\tstatus = Open4::popen4(\"diff #{ref} -\") do |pid, stdin, stdout, stderr|\n\t\t\t\t\tstdin.puts data\n\t\t\t\t\tstdin.close\n\t\t\t\t\tdiff = stdout.read\n\t\t\t\tend\n\t\t\t\t#sent mail if content is different\n\t\t\t\tif status != 0\n\t\t\t\t\twrite \"change detected.\"\n\t\t\t\t\tnotify_changed_site(url, diff)\n\t\t\t\tend\n\t\t\tend\n\t\t\tFile.open(ref, \"w\") do |f|\n\t\t\t\tf.puts data\n\t\t\tend\n\t\tend", "def write(data)\n @handle.writeData(data)\n end", "def write(data)\n @data << data\n end", "def write(data)\n begin\n File.open(@filename, \"w\") { |file| file.puts data.to_html }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end", "def _write filename, array\n File.open(filename, \"w\") do |file| \n array.each { |row| file.puts row }\n end\n end", "def write(data=nil, &block)\n mkdir_p dir\n open(fullpath, 'w') do |io|\n io.write data if data\n yield io if block_given?\n end\n end", "def write_data\n data = {}\n tmp_file = \"#{@wallet_file}.tmp\"\n\n @data.each do |item|\n next if item.empty?\n\n data.merge!(\n item.id => {\n 'id' => item.id,\n 'group' => item.group,\n 'user' => item.user,\n 'url' => item.url,\n 'comment' => item.comment,\n 'last_edit' => item.last_edit,\n 'created' => item.created\n }\n )\n end\n\n Gem::Package::TarWriter.new(File.open(tmp_file, 'w+')) do |tar|\n data_encrypt = encrypt(data.to_yaml)\n tar.add_file_simple('wallet/meta.gpg', 0400, data_encrypt.length) do |io|\n io.write(data_encrypt)\n end\n\n @passwords.each do |id, password|\n tar.add_file_simple(\"wallet/passwords/#{id}.gpg\", 0400, password.length) do |io|\n io.write(password)\n end\n end\n\n @otp_keys.each do |id, key|\n tar.add_file_simple(\"wallet/otp_keys/#{id}.gpg\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n\n @keys.each do |id, key|\n tar.add_file_simple(\"wallet/keys/#{id}.pub\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n end\n\n File.rename(tmp_file, @wallet_file)\n rescue => e\n File.unlink(tmp_file) if File.exist?(tmp_file)\n\n raise \"#{I18n.t('error.mpw_file.write_data')}\\n#{e}\"\n end", "def putData(data, filename, *carriage)\n if carriage == [nil] || carriage == [\"MAC\"]\n carriage = \"\\n\"\n elsif carriage == [\"WIN\"]\n carriage = \"\\r\\n\"\n end\n\n file = File.open(filename, 'w')\n file << \"#{data[0]}#{data[1]}\"\n data[2].row_vectors.each do |row|\n line = \"H\\t#{row[0]}\\t#{row[1]}\\t#{row[2]}#{carriage}\"\n file << line\n end\n\n file.close()\n end", "def write\n file = ::File.open(@file, 'w')\n file.write(Bencode.encode(@data))\n file.close\n end", "def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end", "def write_json(file)\n open(file, \"w\") do |io|\n \tio.write(JSON.pretty_generate(@data))\n end\n end", "def write_data_at_offset(offset, data)\n\t\t@file.seek(offset.to_i, IO::SEEK_END)\n\t\t@file << data\n\tend", "def write_data(out_header, code=nil)\n @in.write(out_header)\n @log.info \"[#{Time.now.iso8601}] Out header: #{out_header.to_s}\"\n @in.write(code) if code\n end", "def write_save_data(file)\r\n write_characters(file)\r\n write_frame(file)\r\n write_setup(file)\r\n write_data(file)\r\n end", "def writeData(filename = \"out.csv\")\n\t\tfile = File.new(filename, \"w\")\n\t\t\n\t\t@dataArray.each do |singleEntry|\n\t\t\tfile.puts \"#{singleEntry[0]},#{singleEntry[1]},#{singleEntry[2]}\"\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend", "def writeToFilePartitioned(dataToWrite, fileNamePrefix)\n pageNum = 1\n charCount = 0\n #Array of hero dicts\n writeQueue = ''\n dataToWrite.each do |data|\n writeQueueTemp = ''\n charCountTemp = 4\n data.map do |k, v|\n #For Ult\n if (v.is_a?(Hash))\n v.map do |k2, v2|\n charCountTemp += v2.length + 1\n writeQueueTemp += \"#{v2}\\n\"\n end\n else\n charCountTemp += v.length + 1\n writeQueueTemp += \"#{v}\\n\"\n end\n end\n writeQueueTemp += \"---\\n\"\n \n if ((charCount + charCountTemp) <= 4800)\n writeQueue += writeQueueTemp\n charCount += charCountTemp\n else\n File.open(File.join('..', 'toTranslateData', fileNamePrefix + \"_#{pageNum}.txt\"), 'w') { |f| f.write(writeQueue)}\n charCount = charCountTemp\n writeQueue = writeQueueTemp\n pageNum += 1\n end\n end\n\n if (charCount != 0)\n File.open(File.join('..', 'toTranslateData', \"#{fileNamePrefix}_#{pageNum}.txt\"), 'w') {|f| f.write(writeQueue)}\n end\n end", "def file(data, path)\n File.open(path, 'w') { |f| f << data }\n end", "def write_file(file_name, data, write_type = 'w')\n write_file_base(append_root_path(file_name), data, write_type)\n end", "def write_file(filename, data)\n f = File.open(filename, 'w')\n f.write(data)\n f.close\nend", "def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end", "def open_data_for_write\n @data_file = CSV.open(data_file_full_path,\"w+\", @data_lib.csv_opt)\n @data_stream = @data_file\n end", "def write_file(file_name, contents, options = nil, binary = false)\n options ||= self.options if self.respond_to?(:options)\n options ||= {}\n skip_write = false\n # debugger\n # contents = process_erb(contents, options[:erb]) if options[:erb]\n if File.exists?(file_name)\n existing_contents = IO.read(file_name)\n if existing_contents == contents\n log_action :identical, basename(file_name), options\n skip_write = true\n elsif options[:force]\n log_action :overwrite, basename(file_name), options\n else\n msg = \"File #{basename(file_name)} already exists. Run with --force to force overwrite.\"\n raise puts(msg)\n end\n else\n log_action :create, basename(file_name), options\n end\n if skip_write\n FileUtils.touch file_name\n else\n mode = \"w\"\n mode << \"b\" if binary\n open(file_name, mode) do |file|\n file.write(contents)\n end\n end\n end", "def do_write # :nodoc:\n yield\n\t \n\t if defined?(MAX_FILE_SIZE) && (wio.tell > MAX_FILE_SIZE)\n\t\tnew_file\n\t end\n\tend", "def write!\n new_file = !File.exists?(path)\n File.open(path, File::CREAT | File::RDWR) do |file|\n file.flock(File::LOCK_EX)\n if !new_file && init_mtime != file.mtime\n file.rewind\n content.deep_merge!(\n MultiJson.load(\n file.read\n )\n )\n file.rewind\n end\n pos = file.write MultiJson.dump(content, :pretty => true)\n file.truncate(pos)\n end\n end", "def write_file(file_name_out, content_array)\n\n\toutput = File.new(file_name_out, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def write\n write_data\n end", "def writeFile(fname, data)\n\tinf = File.new(fname, \"w+\")\n\tret = inf.write(data)\n\tinf.close\n\treturn ret\nend", "def write\n return if PictureTag.site.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n f.write JSON.generate(data)\n end\n end", "def write_file(*args)\n end", "def write_file(file_name, content_array)\n\n\toutput = File.new(file_name, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def write(data, offset = 0)\n # Track our offset into the remote file\n fptr = offset\n\n # Duplicate the data so we can use slice!\n data = data.dup\n\n # Take our first chunk of bytes\n chunk = data.slice!(0, self.chunk_size)\n\n # Keep writing data until we run out\n while (chunk.length > 0)\n ok = self.client.write(self.file_id, fptr, chunk)\n cl = ok['Payload'].v['CountLow']\n\n # Partial write, push the failed data back into the queue\n if (cl != chunk.length)\n data = chunk.slice(cl - 1, chunk.length - cl) + data\n end\n\n # Increment our painter and grab the next chunk\n fptr += cl\n chunk = data.slice!(0, self.chunk_size)\n end\n end", "def write\n File.open(path, 'w') { |file|\n file.write(FILE_HEADER + \"\\n\")\n file.write(encoded_body)\n }\n end", "def write_file(data, name)\n raise WebthumbException.new('No data given') if data == nil || data.size == 0\n File.open(name, 'wb+') do |file|\n file.write(data)\n file.close\n file\n end\n end", "def data_file(counter)\n # create a temp file\n t = File.open(File.join(base,\"data\", \"#{counter}.data\"), 'w')\n t << self.data\n t.close\n t.path\n end", "def save_data(file)\n File.open(file, 'w').write(JSON.pretty_generate(@data))\n end", "def write_metadata(variable_set: nil)\n @data_file << variable_set.keys if @data_lib.csv_opt[:headers]\n end", "def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end", "def write(data)\n @output_row << data\n end", "def rewrite(data)\n CSV.open(@@data_path, \"wb\") do |csv|\n csv << [\"id\", \"brand\", \"product\", \"price\"]\n data.each do |item|\n csv << item\n end\n end\n end", "def write(file=nil)\n file = file.nil? ? @file : file\n File.open(file, 'w+') {|f|\n @lines.each{|line|\n f.write(\"#{line}\\r\\n\")\n }\n }\n end", "def writeData\n # Make the directory to store the RoadWaer data.\n File.makedirs(File.dirname($datafilename))\n $debugdata = $debugdata + \"makedir\\n\"\n\n # Open the file to append the registration data.\n file = File.open($datafilename, \"a\")\n $debugdata = $debugdata + \"open\\n\"\n # Write user data.\n file.puts($events.read.print)\n $debugdata = $debugdata + \"puts\\n\"\n # Make sure the output file is always closed.\n file.close\n $debugdata = $debugdata + \"close\\n\"\n\n $debugdata = $debugdata + value.local_path + \"\\n\"\n $debugdata = $debugdata + value.original_filename + \"\\n\"\n $debugdata = $debugdata + value.content_type + \"\\n\"\n true\n\n rescue\n false\nend", "def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end", "def overwrite_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit, force_overwrite = true)\n end", "def write_file\n match_file = File.new(\"matches.txt\", \"w\")\n no_of_match = @matchesarr.length\n match_file.puts(no_of_match.to_s)\n for i in 0..no_of_match - 1\n match_file.puts(@matchesarr[i])\n end\n match_file.close\n end", "def write data\n assert !@closed\n\n # We store the text as a list so appending will be cheap.\n @text << data\n unless @silent\n $stdout.print data \n $stdout.flush\n end\n if @report_file\n @report_file.print data\n @report_file.flush\n end\n end", "def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end", "def writeInfo\n # Make the directory to store the registration data.\n File.makedirs(File.dirname($datafilename))\n $debugdata = $debugdata + \"Makedirs\\n\"\n\n # Open the file to append the registration data.\n file = File.open($datafilename, \"a\")\n $debugdata = $debugdata + \"Open\\n\"\n # Write user data.\n file.puts($name + $sep +\n $organization + $sep + \n $email + $sep +\n $source + $sep + \n $use + $sep +\n $notification)\n $debugdata = $debugdata + \"puts\\n\"\n # Make sure the output file is always closed.\n file.close\n $debugdata = $debugdata + \"file.close\\n\"\n true\n\n rescue\n false\nend", "def write_dataBlock_to_file(miliseconds)\n\t\t# calculate the number of dataBlocks to write to file\n\t\tnumBlocks_to_write = (miliseconds.to_f * @sampleRate.to_f /\n\t\t @samples_per_dataBlock.to_f) / 1000.to_f\n\t\t# calculate bytes per sample\n\t\tif @bitsPerSample == 16\n\t\t\tbytesPerSample = 2\n\t\telsif @bitsPerSample == 32\n\t\t\tbytesPerSample = 4\n\t\tend\n\t\t# write the dataBlocks to file\n\t\tfor i in (0..numBlocks_to_write.round)\n\t\t\t# write binary to file with correct offset\n\t\t\tFile.write(@filename, @dataBlock_joined, @file_offset)\n\t\t\t# increment offset for next method call\n\t\t\t@file_offset += @samples_per_dataBlock * @numChannels * bytesPerSample\n\t\tend\n\tend", "def write\n parts = [ ]\n parts << parquet_special_string\n\n # write the start file descriptor\n @csv.headers.each do |header|\n # write each data chunk and associated page header\n set_data_page_offset(header, current_offset)\n\n parts << page_header(header)\n parts << column_data[header]\n end\n # write the file metadata\n file_meta_data_start = current_offset\n parts << file_meta_data\n file_meta_data_end = current_offset\n\n # write the file meta data offset\n file_meta_data_offset = file_meta_data_end - file_meta_data_start\n parts << file_meta_data_offset\n # write the end file descriptor\n parts << parquet_special_string\n\n writer = ParquetWriter.new(parts)\n writer.write\n end", "def write(contents = {})\n File.open(file_path, 'w+') do |file|\n @metadata = contents\n @metadata.merge!('downloaded_at' => Time.now.utc.iso8601)\n\n file.write(metadata.to_json)\n end\n end", "def write_file(path=nil,data=nil)\n if path.class == String && data.class.method_defined?(:j_del) && block_given?\n @j_del.java_method(:writeFile, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(path,data.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling write_file(path,data)\"\n end", "def write_csv(path, headers, data)\n return if data.empty?\n CSV.open(path, 'wb') do |csv|\n csv << headers\n data.uniq.each do |row|\n csv << CSV::Row.new(row.keys, row.values).values_at(*headers) unless row.values.all? { |v| v.nil? || v.strip == '' }\n end\n end\n end", "def append(data)\n begin\n # convert old data to array\n old_data_array = CSV.read(@file, headers: true, header_converters: :symbol).to_a\n\n # extend the headers by the ones for new testcases\n data.each do |result|\n old_data_array[0] << result[:identifier] if not old_data_array[0].include?(result[:identifier].to_sym)\n end unless data.empty?\n\n # create the new line column by column in the right order\n line = []\n old_data_array[0].each do |header|\n line << (data.detect{ |field| field[:identifier] == header.to_s }[:runtime] rescue nil)\n end unless old_data_array[0].empty?\n\n # append the new line of data to existing data\n old_data_array << line\n\n # write the CSV\n file = File.open(@file, \"w\")\n CSV(file, col_sep: \",\") do |csv|\n old_data_array.each do |line|\n csv << line\n end\n end\n file.close\n rescue\n create(data)\n end\n end", "def write_acct_file (acct_numbers_array, number_acct_fields)\r\n file_name = \"data/accounts\"\r\n output_file = File.open(file_name,\"w\")\r\n \r\n acct_numbers_array.each {|a| output_file.puts a}\r\n output_file.close\r\nend", "def write\n File.write(cache_file, @cache_log.to_json)\n end", "def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end", "def writeData(w)\n ygrid = getOption('ygrid')\n \n elems = @data.shape\n if ( elems.length == 1 ) then write_data_1D(w)\n elsif( elems.length == 2 ) then write_data_2D(w)\n end\n end", "def writetofile(filename)\n self.scan() if @filearray == nil\n\n begin\n FileUtils.mkdir_p(File.dirname(filename))\n file = File.open(filename, \"w\")\n @filearray.each do |line|\n firstvalue = true\n newline = \"\"\n line.each do |value|\n if firstvalue == true\n firstvalue = false\n else\n newline = newline +\",\"\n end\n newline = newline + value\n end\n file.puts(newline)\n end\n rescue IOError => e\n #some error occur, dir not writable etc.\n ensure\n file.close unless file == nil\n end\n #copies original file\n FileUtils.cp(@ddy_filepath, \"#{File.dirname(filename)}/#{File.basename(filename,'.epw')}.ddy\")\n FileUtils.cp(@stat_filepath, \"#{File.dirname(filename)}/#{File.basename(filename,'.epw')}.stat\")\n end", "def write(mph, minutes, incline=\"\", date: Time.now)\n Dir.mkdir(File.dirname(filepath)) unless Dir.exist?(File.dirname(filepath))\n File.open(filepath, 'a+') do |file|\n unless(file.readlines.include?(header(date.month, date.day)))\n file.puts header(date.month, date.day)\n end\n file.puts query(mph, minutes, incline, date: date)\n end\n end", "def write(file)\n self.files.each { |l| file.puts l }\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def write_stmt_file(acct_numbers_array, number_stmt_fields)\r\n file_name = \"data/statements\"\r\n output_file = File.open(file_name,\"w\")\r\n \r\n stmt_start_year = 2015\r\n stmt_end_year= 2015\r\n stmt_start_month = 4\r\n stmt_end_month = 9\r\n stmt_start_day = 01\r\n stmt_end_day = 21\r\n \r\n for i in 1..number_stmt_fields\r\n stmt_date = random_date(stmt_start_year,stmt_end_year, stmt_start_month, stmt_end_month, stmt_start_day,stmt_end_day)\r\n acct_num = acct_numbers_array.sample\r\n output_file.puts \"#{acct_num}\" + \"\\001\" + \"#{stmt_date}\" \r\n end\r\n output_file.close\r\nend", "def write2(file = 'default', data, mode, size)\n dump_object(file)\n dump_object(data)\n dump_object(mode)\n dump_object(size)\n puts \"===========================\"\nend", "def write(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n token = args[2]\n\n # Handle undefs as blanks\n token = '' if token.nil?\n\n # First try user defined matches.\n @write_match.each do |aref|\n re = aref[0]\n sub = aref[1]\n\n if token =~ Regexp.new(re)\n match = eval(\"#{sub} self, args\")\n return match unless match.nil?\n end\n end\n\n # Match an array ref.\n if token.kind_of?(Array)\n return write_row(*args)\n elsif token.kind_of?(Numeric)\n return write_number(*args)\n # Match http, https or ftp URL\n elsif token =~ %r|^[fh]tt?ps?://| and @writing_url == 0\n return write_url(*args)\n # Match mailto:\n elsif token =~ %r|^mailto:| and @writing_url == 0\n return write_url(*args)\n # Match internal or external sheet link\n elsif token =~ %r!^(?:in|ex)ternal:! and @writing_url == 0\n return write_url(*args)\n # Match formula\n elsif token =~ /^=/\n return write_formula(*args)\n # Match blank\n elsif token == ''\n args.delete_at(2) # remove the empty string from the parameter list\n return write_blank(*args)\n else\n return write_string(*args)\n end\n end", "def __write_with_log(name)\n __log_report(name) do\n open(\"OCP_tmp/#{name}\", \"w\") { |io| yield io }\n end\n end", "def write(method, data)\n self.send(method.to_sym, convert_to_hash_array(data))\n end", "def write_file(fname, data = nil, tocrlf = false, &block) # :yields: io\n File.open(fname, \"w\") do |output|\n if block\n block.call(output)\n else\n raise \"no data given\" unless data\n if tocrlf\n require 'strscan'\n sc = StringScanner.new data\n until sc.eos?\n if (ms = sc.scan(/[^\\r\\n]+/))\n output.write(ms)\n elsif (ms = sc.scan(/\\r?\\n/))\n output.write(\"\\r\\n\")\n else\n raise ArgumentError, sc.rest\n end\n end\n else\n output.write(data)\n end\n end\n end\n puts fname\nend" ]
[ "0.62339437", "0.6176751", "0.60550696", "0.60320926", "0.58295375", "0.5793967", "0.5793069", "0.57755715", "0.57734215", "0.57725453", "0.5715384", "0.5707582", "0.5707582", "0.5707582", "0.5707582", "0.56196207", "0.5612801", "0.55998194", "0.559728", "0.55437374", "0.5520712", "0.5511701", "0.5489245", "0.5469141", "0.5455748", "0.54254633", "0.542515", "0.542515", "0.5421255", "0.54174185", "0.54174185", "0.54174185", "0.53619385", "0.5361097", "0.5349312", "0.5325786", "0.5324772", "0.5321339", "0.5306786", "0.52849025", "0.5244124", "0.523883", "0.5219352", "0.52186996", "0.5213719", "0.51799226", "0.51708704", "0.5169983", "0.5167595", "0.5166755", "0.51450306", "0.51385087", "0.5134499", "0.5120924", "0.5119732", "0.5092388", "0.5090753", "0.5087651", "0.5084203", "0.5083824", "0.5083377", "0.5080042", "0.50765723", "0.5068275", "0.50670266", "0.5056345", "0.50445145", "0.5040459", "0.50303316", "0.5025604", "0.501407", "0.5008316", "0.5008237", "0.5007239", "0.49936777", "0.49843472", "0.49828476", "0.4982587", "0.49731886", "0.49726284", "0.494457", "0.4942292", "0.49410787", "0.4930169", "0.4928347", "0.49255675", "0.4924296", "0.49190068", "0.49175024", "0.49111196", "0.48925295", "0.48782134", "0.48696506", "0.48552248", "0.48452222", "0.484214", "0.48282233", "0.48224846", "0.48201677", "0.48159075" ]
0.60161734
4
Only for string row values will be improved to be able to handle more complex selecting like SQL does > multiple select
def select(opts = {}) return @data.select { |row| row[opts[:where]] =~ /#{opts[:like]}/ } if opts[:like] return @data.select { |row| row[opts[:where]] !~ /#{opts[:not_like]}/ } if opts[:not_like] @data.select { |row| row[opts[:where]] == opts[:equals] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_values\n value = nil\n assert_nothing_raised do\n value = ActiveRecord::Base.connection.send(:select_rows, \"VALUES('ur', 'doin', 'it', 'right')\")\n end\n assert_equal [['ur', 'doin', 'it', 'right']], value\n end", "def map_values(row, columns)\n values = columns.map do |v|\n # TODO - stw - which other cases do we need to handle?\n case v[1]\n when /int/: \n row[v[0]] || 'NULL'\n else \n (row[v[0]].nil? ? 'NULL' : \"'\" + @db1.escape_string(row[v[0]].to_s) + \"'\")\n end\n end\n values = values.join(',') \n end", "def extract_values(row, field)\n values = []\n ['', '[]', '[en]', '[en_US]'].each do |attr|\n values << row[field + attr] unless row[field + attr].nil?\n end\n values\n end", "def select_values(sql, name = nil)\n result = select_rows(sql, name)\n result.map { |v| v[0] }\n end", "def string cols\n decode_values :string, cols\n end", "def row_values(string) \n string.gsub!(/INSERT INTO (.*?) VALUES/, '')\n splitted = string.split(\"),(\")\n splitted.each do |s| \n s.gsub!(\"(\", '') if splitted.first == s\n s.gsub!(\")\", '') if splitted.last == s\n s.gsub!(s, \"(#{s})\")\n end\n splitted\n end", "def strings cols\n decode_values :string, cols, true\n end", "def select(string) # :nodoc:\n chk_conn\n conn = @hibernate_session.connection\n stmt = conn.create_statement\n rs = stmt.execute_query(string)\n result = []\n meta = rs.meta_data\n cols = meta.column_count\n while rs.next\n row = []\n (1..cols).each do |n|\n row << from_database_type(rs.get_object(n))\n end\n result << row\n end\n result\n ensure\n rs.close rescue nil\n stmt.close rescue nil\n end", "def case_string_values\n @res = Set.new\n get_col_results(@parse_path.val.case_expr) if @parse_path.val.case_expr\n @res.to_a\n end", "def process_row(row)\n row.to_s\n end", "def construct_target_record(row)\n record=(0..filtered_target_fields.size-1).collect do |index|\n field = filtered_target_fields[index]\n value = row[index]\n value = 'NULL' if value.nil?\n (filtered_map[field].class.name == \"Array\" ? filtered_map[field][1].call(value) : value)\n end\n embed_string_in_quotes(record)\n end", "def getfieldvalues\n #instantiate the Array here to be sure it is clear of values before populating\n @fieldvalues = Array.new\n @db.execute(\"select distinct(#{@fieldname}) from data\") do |value|\n v=value[0].to_s\n @fieldvalues << value[0].to_s\n end\nend", "def make_val(row_value, column_type)\n val = row_value\n if (row_value.nil?)\n val = 'NULL'\n else\n if (column_type == 'varchar' || column_type == 'text' || column_type == 'blob')\n val = \"'#{ Mysql2::Client.escape(row_value) }'\"\n elsif (column_type == 'datetime')\n # datetime values come back like '2014-12-25 11:11:11 -0500' and we want to remove the timezone offset\n val = \"'#{/(\\S* \\S*) .*/.match(val.to_s)[1]}'\"\n end\n end\n val\n end", "def _select_map_single\n rows = []\n clone(:_sequel_pg_type=>:first).fetch_rows(sql){|s| rows << s}\n rows\n end", "def pull_records(value)\n begin\n column = match_column(value) # determine which column contains the specified value\n unless column == \"\"\n results = [] # array to hold all matching hashes\n conn = open_db()\n query = \"select *\n from details\n join numbers on details.id = numbers.details_id\n join quotes on details.id = quotes.details_id\n where \" + column + \" ilike $1\n order by name\"\n conn.prepare('q_statement', query)\n rs = conn.exec_prepared('q_statement', [\"%\" + value + \"%\"])\n conn.exec(\"deallocate q_statement\")\n rs.each { |result| results.push(result) }\n return results\n else\n return [{\"quote\" => \"No matching record - please try again.\"}]\n end\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend", "def _select_map_multiple(ret_cols)\n rows = []\n clone(:_sequel_pg_type=>:array).fetch_rows(sql){|s| rows << s}\n rows\n end", "def multiple(sql, values = [])\n r = $db.exec_params(sql, values)\n return [] if r.ntuples == 0\n r.map { |row| convert_to_ruby_types(row) }\nend", "def sql_strings(value)\n case value\n when String\n \"'#{value}'\"\n when Numeric\n value.to_s\n else\n \"null\"\n end\n end", "def values value_type = :formatted_value\n return @values unless @values.nil?\n\n @values = []\n while @rowset.next do\n @values << 1.upto(self.columns.size).map do |i|\n @rowset.getString i\n end\n end\n\n @values\n end", "def get_value(table, field_val, field_ftr, filter_val)\n #print filter_val\n sql_statement = \"SELECT \" + field_val + \" FROM \" + table + \" WHERE \" + \\\n field_ftr + \" = '\" + filter_val + \"';\"\n db = get_db()\n stm = db.prepare sql_statement\n rs = stm.execute\n retun_val = nil\n rs.each do |row|\n retun_val = row[field_val]\n end\n return retun_val\nend", "def build_compound_select_string(data, table, *columns)\n qry = []\n placeholder_args = []\n qry_string = build_qrystring(table, columns) \n (1...MAX_SQLITE_STATEMENTS).each do |index|\n qry_string << \" UNION SELECT ?\" << \",?\" * (columns.size-1)\n end #index\n (0..data.size).step(MAX_SQLITE_STATEMENTS) do |index|\n if ((data.size - index) < MAX_SQLITE_STATEMENTS)\n qry_string = build_qrystring(table, columns)\n (1...data.size - index).each do |newstr|\n qry_string << \" UNION SELECT ?\" << \",?\" * (columns.size-1)\n end #end newstr\n qry.insert(-1, qry_string)\n holder_args = data.slice(index, data.size-index)\n placeholder_args.insert(-1, holder_args) if holder_args[0].class == String\n placeholder_args.insert(-1, holder_args.flatten) if holder_args[0].class == Array\n else \n qry.insert(-1, qry_string)\n holder_args = data.slice(index, MAX_SQLITE_STATEMENTS)\n placeholder_args.insert(-1, holder_args) if holder_args[0].class == String\n placeholder_args.insert(-1, holder_args.flatten) if holder_args[0].class == Array\n #placeholder_args.insert(-1, data.slice(index, MAX_SQLITE_STATEMENTS))\n end # endif\n end #end index\n \n return qry, placeholder_args\n end", "def get_single_column sql_text\n @client.query(sql_text, :as => :array).map{ |row| row[0] }\n end", "def dbms_type_cast(columns, rows)\n # Cast the values to the correct type\n columns.each_with_index do |column, col_index|\n #puts \" #{column.name} type #{column.type} length #{column.length} nullable #{column.nullable} scale #{column.scale} precision #{column.precision} searchable #{column.searchable} unsigned #{column.unsigned}\"\n rows.each do |row|\n value = row[col_index]\n\n new_value = case\n when value.nil?\n nil\n when [ODBC::SQL_CHAR, ODBC::SQL_VARCHAR, ODBC::SQL_LONGVARCHAR].include?(column.type)\n # Do nothing, because the data defaults to strings\n # This also covers null values, as they are VARCHARs of length 0\n value.is_a?(String) ? value.force_encoding(\"UTF-8\") : value\n when [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(column.type)\n column.scale == 0 ? value.to_i : value.to_f\n when [ODBC::SQL_REAL, ODBC::SQL_FLOAT, ODBC::SQL_DOUBLE].include?(column.type)\n value.to_f\n when [ODBC::SQL_INTEGER, ODBC::SQL_SMALLINT, ODBC::SQL_TINYINT, ODBC::SQL_BIGINT].include?(column.type)\n value.to_i\n when [ODBC::SQL_BIT].include?(column.type)\n value == 1\n when [ODBC::SQL_DATE, ODBC::SQL_TYPE_DATE].include?(column.type)\n value.to_date\n when [ODBC::SQL_TIME, ODBC::SQL_TYPE_TIME].include?(column.type)\n value.to_time\n when [ODBC::SQL_DATETIME, ODBC::SQL_TIMESTAMP, ODBC::SQL_TYPE_TIMESTAMP].include?(column.type)\n value.to_datetime\n # when [\"ARRAY\"?, \"OBJECT\"?, \"VARIANT\"?].include?(column.type)\n # TODO: \"ARRAY\", \"OBJECT\", \"VARIANT\" all return as VARCHAR\n # so we'd need to parse them to make them the correct type\n\n # As of now, we are just going to return the value as a string\n # and let the consumer handle it. In the future, we could handle\n # if here, but there's not a good way to tell what the type is\n # without trying to parse the value as JSON as see if it works\n # JSON.parse(value)\n when [ODBC::SQL_BINARY].include?(column.type)\n # These don't actually ever seem to return, even though they are\n # defined in the ODBC driver, but I left them in here just in case\n # so that future us can see what they should be\n value\n else\n # the use of @connection.types() results in a \"was not dropped before garbage collection\" warning.\n raise \"Unknown column type: #{column.type} #{@connection.types(column.type).first[0]}\"\n end\n\n row[col_index] = new_value\n end\n end\n rows\n end", "def get_scalar sql_text\n @client.query(sql_text, :as => :array).first[0]\n end", "def select_by(how, what); end", "def grab_rows(field, src_table_name = TABLE_NAME, num_rows = ROWS_PER_TRANSACTION)\n LOGGER.info \"Creating select statement based on field `#{field[:name]}` (#{field[:type]})\"\n \n if !(field[:type] =~ /int/).nil?\n LOGGER.info \"Using integer type for select.\"\n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min].to_i.to_s), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max].to_i.to_s), \n Mysql::escape_string(field[:name]), \n num_rows]\n elsif !(field[:type] =~ /datetime/).nil?\n LOGGER.info \"Using datetime type for select.\" \n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min].strftime(MYSQL_DATETIME_FORMAT)), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max].strftime(MYSQL_DATETIME_FORMAT)), \n Mysql::escape_string(field[:name]), \n num_rows]\n else\n LOGGER.info \"Using default type for select, this isn't expected.\"\n sql = \"SELECT * FROM `%s` WHERE `%s` >= '%s' AND `%s` < '%s' ORDER BY `%s` LIMIT %s;\" % [ Mysql::escape_string(src_table_name), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:min]), \n Mysql::escape_string(field[:name]), \n Mysql::escape_string(field[:max]), \n Mysql::escape_string(field[:name]), \n num_rows] \n end\n \n LOGGER.debug \"SQL: #{sql}\"\n dbres = do_sql_command(sql)\n dbres\nend", "def parsed_select\n params[:select].split(',').map do |field|\n field if resource.column_names.include?(field)\n end\n rescue NoMethodError\n []\n end", "def get_selected(id, model, obj_string)\n selection = (obj_string + \"DataPoint\").constantize.where(model+\"_field_id\"=>id, :study_id=>session[:study_id])\n retVal = []\n unless selection.empty? || selection.nil?\n selection.each do |detail|\n retVal << [detail.value,detail.subquestion_value]\n end\n end\n return retVal\n end", "def prepare_for_query(value)\n if value.kind_of?(Array)\n value.join(',')\n else\n value\n end\n end", "def dbselect2(find, table)\n if find.kind_of?(Array) == false\n variables = find\n else\n variables = \"\"\n i = 0\n while i < find.length\n variables += find[i].to_s\n i += 1\n if i < find.length\n variables += \", \"\n end\n end\n end\n return db.execute(\"SELECT #{variables} FROM #{table}\")\nend", "def select_rows(sql, name = nil)\n raise NotImplementedError, \"select_rows is an abstract method\"\n end", "def select_value(str_or_rx)\n select.select_value(str_or_rx)\n end", "def query_translate(mixed_ary)\n rslt = \"\"\n sub = mixed_ary.collect {|a| \"(#{a.join(',')})\"}\n sub.join(\";\")\n end", "def scrooge_select_sql( set )\n set.map{|a| attribute_with_table( a ) }.join( ScroogeComma )\n end", "def select(sql, name = nil)\n fields, rows = select_raw(sql, name)\n result = []\n for row in rows\n row_hash = {}\n fields.each_with_index do |f, i|\n val = row[i]\n row_hash[f.to_s] = val.respond_to?(:rstrip) ? val.rstrip : val\n end\n result << row_hash\n end\n result\n end", "def fetch_value(sql)\n # Get the row\n row = fetch_row(sql)\n\n # Check field count\n if row.count > 1\n check.critical(\"Expected to receive a single value, but result has more than one field\", \"SQL: #{sql}\\nResult: #{row.inspect}\")\n end\n\n return row.values.first\n end", "def values_sql_for_column_names_and_attributes( columns, array_of_attributes ) # :nodoc:\n values = []\n array_of_attributes.each do |arr|\n my_values = []\n arr.each_with_index do |val,j|\n my_values << quote( val, columns[j] )\n end\n values << my_values\n end \n values_arr = values.map{ |arr| '(' + arr.join( ',' ) + ')' }\n end", "def to_any(args={})\n args[:when_empty] ||= \"\"\n args[:values_glue] ||= \", \"\n args[:row_format] ||= \"%s\"\n args[:row_glue] ||= \"\\n\"\n r = []\n case args[:row_format].class.to_s\n when 'String'\n parse(args) do |values|\n r << sprintf(args[:row_format], values.join(args[:values_glue]))\n end\n \n when 'Proc'\n parse(args) do |values|\n r << args[:row_format].call(values) # LOOK OUT: args[:values_glue] ignored\n end\n end\n if r.size > 0\n r = r.join args[:row_glue]\n r = args[:before] + r if args[:before]\n r = r + args[:after] if args[:after]\n r\n else\n args[:when_empty]\n end\n end", "def select_rows(sql, name = nil)\n array_query(sql, name, [])\n end", "def result_value_of(declared_type, value)\n if value.is_a?(::Amalgalite::Blob)\n SQL::Blob.new(value.to_s)\n elsif value.is_a?(String) && declared_type\n (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value\n else\n super\n end\n end", "def parameters_and_values_sql_string\n #first get an array of equal signs\n c = Array.new(self_values.length, \"=\")\n final_array = []\n # Then zip all three arrays together\n # Ex. field_names =[p1, p2, p3] \n # c = [\"=\", \"=\", \"=\"]\n # self_values = [1, 3, \"'string'\"]\n # zip => [[[p1, \"=\"], 1], [[p2, \"=\"], 3, [[p3, \"=\"], \"'string'\"]]\n zip_array = database_field_names.zip(c).zip(quoted_string_self_values)\n zip_array.each do |row|\n # => [[\"p1 = 1\"], [\"p2 = 3\"], [\"p3 = 'string'\"]]\n final_array << row.flatten.join(\" \")\n end\n # => \"p1 = 1, p2 = 3, p3 = 'string'\"\n final_array.join(\", \")\n end", "def select(*args); dataset.select(*args); end", "def strings_for_select( *_array)\n _array = _array.flatten\n if _array.blank?\n []\n else\n _array.zip _array\n end\n end", "def parse(str)\n # defined in ext/rdo_postgres/arrays.c\n end", "def get_values\n data = []\n rows = text_range.to_s.split(/\\<\\/tr>/)\n rows.each_with_index do |row, row_i|\n cells = row.split(/\\<\\/td>/)\n row_data = []\n cells.each_with_index do |cell, cell_i|\n datum = cell.sub('</a>','').gsub(/\\<.*\\>/,'').strip\n row_data << datum if !datum.nil? || datum.empty?\n end\n data << row_data.join(',') if row_data.length > 1 \n end\n data.join(\"\\r\\n\")\n end", "def find_rows(field_name, record_id) \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE #{field_name} = #{record_id}\")\n \n return self.results_as_objects(results) \n end", "def select_rows(sql, name = nil)\n # last parameter indicates to return also column list\n result, columns = select(sql, name, true)\n result.map{ |v| columns.map{|c| v[c]} }\n end", "def col_select(type, position = \"begin\")\n type ||= :string\n case type.to_sym\n when :string\n [[\"等于\",'='],[\"包含\",'like']]\n when :datetime\n #[[\"早于\",'>'],[\"早于等于\",'=>'],[\"等于\",'='],[\"晚于等于\",'=<'],[\"晚于\",'<']]\n list = [[\"晚于\",'>'], [\"晚于等于\",'>='], [\"等于\",'=']] if position.eql? \"begin\"\n list = [[\"早于\",'<'], [\"早于等于\",'<='], [\"等于\",'=']] if position.eql? \"end\"\n list\n when :integer\n #[[\"大于\",'>'],[\"大于等于\",'=>'],[\"等于\",'='],[\"小于等于\",'=<'],[\"小于\",'<']]\n list = [[\"大于\",'>'], [\"大于等于\",'>='], [\"等于\",'=']] if position.eql? \"begin\"\n list = [[\"小于\",'<'], [\"小于等于\",'<='], [\"等于\",'=']] if position.eql? \"end\"\n list\n else\n []\n end\n end", "def test_date_value\n row = SqlRow.new(SqlRowType.new('table', :id => :integer, :text => :date))\n row[:text] = Date.parse('2015-01-01')\n assert_equal \"'2015-01-01'\", row.sql_for(:text, :postgresql)\n end", "def from_sql_array\n retval = Array.new\n quotes = false\n\n # Chop off the leading and trailing braces...\n str = self[1..-2]\n j = 0\n\n # Scan through the characters, looking for quotes and grabbing Array\n # elements when we find them.\n str.split(//).each_with_index do |c, i|\n if c == '\"' && (i == 0 || str[i - 1].chr != '\\\\')\n quotes = !quotes\n elsif c == ',' && !quotes\n retval << str[j, i - j]\n j = i + 1\n end\n end\n\n # Plop on the rest of the string that wasn't accounted for above.\n retval << str[j..-1]\n\n # Get rid of escapes on quotes and backslashes.\n retval.each_with_index do |v, i|\n retval[i] = v.gsub(/^\\\"(.*)\\\"$/, '\\1').gsub(/\\\\\\\"/, '\"').gsub(/\\\\\\\\/, '\\\\')\n end\n end", "def bound_variable_arg(arg, conn)\n case arg\n when ArrayRow\n \"(#{arg.map{|v| bound_variable_array(v) if v}.join(',')})\"\n when HashRow\n arg.check_columns!\n \"(#{arg.values_at(*arg.columns).map{|v| bound_variable_array(v) if v}.join(',')})\"\n else\n super\n end\n end", "def make_select(values, &block)\n return nil unless values\n raise ArgumentError unless values.class == String\n\n result = []\n values.split(',').each do |s|\n s.strip!\n s = yield(s) if block_given?\n result.push(s)\n end\n result\n end", "def searchby(criteria, value, lib)\r\n\t#clear unnecessary apostrophes, and return to int if that was the intention\r\n\tvalue = value.to_s.gsub(\"'\"){\"''\"}\r\n\t#run a sligtly different search if value.class = int...\r\n\tif value.to_i == 0\t\r\n\t\t#if value is a string, then we add '' around the value\r\n\t\treturn lib.execute(\"Select * from books join authors on books.author_id = authors.id WHERE #{criteria} = '#{value}'\")\r\n\telse#if value is a string, we pass it in without ''.\r\n\t\treturn lib.execute(\"Select * from books join authors on books.author_id = authors.id WHERE #{criteria} = #{value}\")\r\n\tend\r\n\r\nend", "def select_for_count\n visited_values = select_visit(select_values.uniq)\n if visited_values.size == 1\n select = visited_values.first\n\n str_select = case select\n when String\n select\n when Symbol\n select.to_s\n else\n select.to_sql if select.respond_to?(:to_sql)\n end\n\n str_select if str_select && str_select !~ /[,*]/\n else\n :all\n end\n end", "def select_values_sql(sql)\n sql << \"VALUES \"\n expression_list_append(sql, opts[:values])\n end", "def mssql_parse_tds_row(data, info)\n\t\tinfo[:rows] ||= []\n\t\trow = []\n\n\t\tinfo[:colinfos].each do |col|\n\n\t\t\tif(data.length == 0)\n\t\t\t\trow << \"<EMPTY>\"\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tcase col[:id]\n\t\t\twhen :hex\n\t\t\t\tstr = \"\"\n\t\t\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\t\t\tif(len > 0 and len < 65535)\n\t\t\t\t\tstr << data.slice!(0,len)\n\t\t\t\tend\n\t\t\t\trow << str.unpack(\"H*\")[0]\n\n\t\t\twhen :string\n\t\t\t\tstr = \"\"\n\t\t\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\t\t\tif(len > 0 and len < 65535)\n\t\t\t\t\tstr << data.slice!(0,len)\n\t\t\t\tend\n\t\t\t\trow << str.gsub(\"\\x00\", '')\n\n\t\t\twhen :datetime\n\t\t\t\trow << data.slice!(0,8).unpack(\"H*\")[0]\n\n\t\t\twhen :rawint\n\t\t\t\trow << data.slice!(0,4).unpack('V')[0]\n\n\t\t\twhen :bigint\n\t\t\t\trow << data.slice!(0,8).unpack(\"H*\")[0]\n\n\t\t\twhen :smallint\n\t\t\t\trow << data.slice!(0, 2).unpack(\"v\")[0]\n\n\t\t\twhen :smallint3\n\t\t\t\trow << [data.slice!(0, 3)].pack(\"Z4\").unpack(\"V\")[0]\n\n\t\t\twhen :tinyint\n\t\t\t\trow << data.slice!(0, 1).unpack(\"C\")[0]\n\n\t\t\twhen :image\n\t\t\t\tstr = ''\n\t\t\t\tlen = data.slice!(0,1).unpack('C')[0]\n\t\t\t\tstr = data.slice!(0,len) if (len and len > 0)\n\t\t\t\trow << str.unpack(\"H*\")[0]\n\n\t\t\twhen :int\n\t\t\t\tlen = data.slice!(0, 1).unpack(\"C\")[0]\n\t\t\t\traw = data.slice!(0, len) if (len and len > 0)\n\n\t\t\t\tcase len\n\t\t\t\twhen 0,255\n\t\t\t\t\trow << ''\n\t\t\t\twhen 1\n\t\t\t\t\trow << raw.unpack(\"C\")[0]\n\t\t\t\twhen 2\n\t\t\t\t\trow << raw.unpack('v')[0]\n\t\t\t\twhen 4\n\t\t\t\t\trow << raw.unpack('V')[0]\n\t\t\t\twhen 5\n\t\t\t\t\trow << raw.unpack('V')[0] # XXX: missing high byte\n\t\t\t\twhen 8\n\t\t\t\t\trow << raw.unpack('VV')[0] # XXX: missing high dword\n\t\t\t\telse\n\t\t\t\t\tinfo[:errors] << \"invalid integer size: #{len} #{data[0,16].unpack(\"H*\")[0]}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tinfo[:errors] << \"unknown column type: #{col.inspect}\"\n\t\t\tend\n\t\tend\n\n\t\tinfo[:rows] << row\n\t\tinfo\n\tend", "def getAgentIdInCsvRow(row)\n# return getValueFromCsvRow(row, \"pedestrianID\").intern ;\n return row[@index_pedestrianID].intern ;\n end", "def row_filter(row)\n row = row.strip.gsub(/\\s+/, \" \")\n item = row.split(\" - \")\n puts \"Start reading and convert #{item.first}\"\n item.last\n end", "def column_value_string\n \"'#{column_value}'\"\n end", "def get_row(values, second = 5)\n condition = \"\"\n values.each do |header, value|\n unless condition.empty?\n condition += \" and \"\n end\n lastpart = \"\"\n if header != \"[unnamed]\" and header != \"\"\n lastpart = \"/@column-id=preceding::thead[1]/tr/th/div[.//text()=#{$browser.generate_concat_for_xpath_text header} \" +\n \"or normalize-space(.//text())=#{$browser.generate_concat_for_xpath_text header}]/@column-id\"\n end\n if value =~ /^\\[img\\](.*)$/ # For the image processing\n condition += \"td/div[.//img[contains(@src,#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif value == \"[spark]\" # For the spark line processing\n condition += \"td/div[.//canvas]#{lastpart}\"\n elsif value =~ /^\\[fuzzy\\](.*)$/\n condition += \"td/div[.//*[contains(text(),#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif value =~ /^\\[fuzzy\\](.*)$/\n condition += \"td/div[.//*[contains(text(),#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif ['[selected]', '[unselected]'].include?(value)\n condition += \"contains(@class,'SelectedRow')\"\n else\n condition += \"td/div[.//*[contains(text(), #{$browser.generate_concat_for_xpath_text value})]]#{lastpart}\"\n end\n end\n\n while true\n row = GridWcfTableRow.new(\"#{@locator}/tr[#{condition}]\")\n\n $browser.wait_for_body_text\n\n if row.wait(second, false)\n return row\n else\n if is_scrollbar_reach_bottom?\n return nil\n else\n drop_vscrollbar\n end\n end\n end\n end", "def execute_scalar( sql )\r\n resultset = execute( sql )\r\n return nil unless resultset.rowcount > 0\r\n raise InvalidOperationException.new( \"excecute_scalar can not return multiple rows\" ) if resultset.rowcount > 1\r\n return resultset.rows.first.send( resultset.columns.first.name.to_sym )\r\n end", "def for_row(row)\n @p.parse_row({:case_id => '123'}.merge(row))\n end", "def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend", "def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end", "def _reduce_20(val, _values, result)\n @handler.scalar val[0].gsub(/^\"|\"$/, '') \n result\nend", "def translateAnswerRow( valArr )\n valStr = \"\"\n index = 0\n valArr.each { |value|\n valStr += ( translateFromFillValue( value, index ) + \",\" )\n index = index + 1\n }\n valStr\n end", "def get_sql_result_str(mysql_res)\n returning String.new do |str|\n while row = mysql_res.fetch_row\n str << row.compact.reject {|s| s.blank? || (s == \"0\")}.join(' ') rescue ''\n end\n end\nend", "def filter_rows rows, incl\n if incl\n incl_str = incl.join \"|\"\n r = Regexp.new incl_str\n #rows = rows.select { |row| row['title'] =~ r }\n rows = rows.select { |row| yield(row, r) }\n end\n rows\n end", "def filter_rows rows, incl\n if incl\n incl_str = incl.join \"|\"\n r = Regexp.new incl_str\n #rows = rows.select { |row| row['title'] =~ r }\n rows = rows.select { |row| yield(row, r) }\n end\n rows\n end", "def convert_row(row_hash)\n result = ''\n row_hash.each_value do|col|\n result << '<td>'\n case col\n # Handle simple columns here, pass off more complex ones\n when String, Fixnum then result << col.to_s\n when NilClass then result << ''\n when Array then result << convert_array(col)\n else\n result << 'Unknown data type!!!'\n end\n result << '</td>'\n end\n result\n end", "def selects_all_female_bears_return_name_and_age\n\" SELECT name, age\n FROM bears \n WHERE gender = 'F';\"\nend", "def sql_literal(*)\n @dataset.sql\n end", "def _match column, field, value, field_is_int = false, opts = { }\n b = lambda { | fmt, v | \"(#{field}#{fmt % Content.connection.quote(v)})\" }\n _match_and(column, b, value, field_is_int, opts)\n end", "def select_one(sql, name = nil) end", "def fetch\n row = @results[@index += 1]\n return unless row\n\n if @types\n row.map!.with_index { |value, index| translate_type(value, @types[index]) } if @types\n elsif @type_translation == :string\n row.map!(&:to_s)\n end\n\n Hash[*@columns.zip(row).flatten]\n end", "def get_row(values, second = 5)\n condition = \"\"\n values.each do |header, value|\n unless condition.empty?\n condition += \" and \"\n end\n lastpart = \"\"\n if header != \"[unnamed]\" and header != \"\"\n lastpart = \"/@column-id=preceding::thead[1]/tr/th/div[.//text()=#{$browser.generate_concat_for_xpath_text header} \" +\n \"or normalize-space(.//text())=#{$browser.generate_concat_for_xpath_text header}]/@column-id\"\n end\n if value =~ /^\\[img\\](.*)$/ # For the image processing\n condition += \"td/div[.//img[contains(@src,#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif value == \"[spark]\" # For the spark line processing\n condition += \"td/div[.//canvas]#{lastpart}\"\n elsif value =~ /^\\[fuzzy\\](.*)$/\n condition += \"td/div[.//*[contains(text(),#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif value =~ /^\\[fuzzy\\](.*)$/\n condition += \"td/div[.//*[contains(text(),#{$browser.generate_concat_for_xpath_text $1})]]#{lastpart}\"\n elsif ['[selected]', '[unselected]'].include?(value)\n condition += \"contains(@class,'SelectedRow')\"\n else\n condition += \"td/div[.//text()=#{$browser.generate_concat_for_xpath_text value}]#{lastpart}\"\n end\n end\n\n while true\n row = GridWcfTableRow.new(\"#{@locator}/tbody/tr[#{condition}]\")\n\n path = \"#{@locator}/tbody/tr[#{condition}]\"\n puts path\n\n $browser.wait_for_body_text\n\n if row.wait(second, false)\n return row\n else\n if is_scrollbar_reach_bottom?\n return nil\n else\n drop_vscrollbar\n end\n end\n end\n end", "def get_selected_by_arm(id, arm, model, obj_string)\n selection = (obj_string + \"DataPoint\").constantize.where(model+\"_field_id\"=>id, :arm_id=>arm,:study_id=>session[:study_id])\n\n retVal = []\n unless selection.empty?\n selection.each do |detail|\n retVal << [detail.value, detail.subquestion_value]\n end\n end\n return retVal\n end", "def parse_value(value, row_value, data)\n return value if value.nil?\n return value unless value.kind_of?(String)\n\n if value[0] == '%'[0]\n if value == '%_'\n return row_value\n else\n if not data[value[1..-1]]\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"parse_value failed. data does not contain value indexed by \\\"#{value[1..-1]}\\\"\")\n exit\n else\n return data[value[1..-1]]\n end\n end\n end\n return value\nend", "def value_conditions(field_name, val)\n val.blank? ? nil : \"CAST(#{field_name} as CHAR(50)) LIKE '#{val.gsub(\"'\",\"''\")}%'\".tr_s('%*', '%')\n end", "def noisify_row(row)\n [\n noisify_value(row[0]),\n noisify_value(row[1]),\n noisify_value(row[2]),\n noisify_value(row[3])\n ]\nend", "def stringToQuery (val)\n\t\t\n\tend", "def Find_MultipleUserDetails(emp_username, course_name)\n \"select first_name from epms_user where username='#{emp_username}' ORDER BY id desc LIMIT 1 \\\\G; \\n\n select id as course_id from mdl_course where fullname='#{course_name}' ORDER BY id desc\"\nend", "def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end", "def handle_row(business, row)\n\n end", "def ascii_query(sql,*values)\n sth = self.query(sql,*values)\n rows = sth.fetch_all\n col_names = sth.column_names\n sth.finish\n DBI::Utils::TableFormatter.ascii(col_names, rows)\n end", "def esc_col(str)\r\n self.conn_exec do |driver|\r\n return driver.esc_col(str)\r\n end\r\n end", "def select_rows(sql, name = nil)\r\n rs = ADS.instance.api.ads_execute_direct(@connection, sql)\r\n raise ActiveRecord::StatementInvalid.new(\"#{ADS.instance.api.ads_error(@connection)}:#{sql}\") if rs.nil?\r\n record = []\r\n while ADS.instance.api.ads_fetch_next(rs) == 1\r\n max_cols = ADS.instance.api.ads_num_cols(rs)\r\n result = Array.new(max_cols)\r\n max_cols.times do |cols|\r\n result[cols] = ADS.instance.api.ads_get_column(rs, cols)[1]\r\n end\r\n record << result\r\n end\r\n ADS.instance.api.ads_free_stmt(rs)\r\n return record\r\n end", "def serialize(row)\n row\n .map { |c| db_format(c) }\n .join(\",\")\nend", "def union_str(columns)\n foo=[]\n 1.upto(columns.to_i) { |num| foo << num.to_i }\n u = \"UNION ALL SELECT \" + \"#{foo.join(',')}\"\n return u\nend", "def get_string_value(field_name)\n\t\tend", "def select_rows(sql, name = nil)\n log(sql, name) do\n @connection.query(:array, sql)\n end\n end", "def fetch_row_text(id_set, are_uids=false, is_update=false)\n log \"Fetch_row_text: #{id_set.inspect}\"\n if id_set.is_a?(String)\n id_set = id_set.split(',')\n end\n if id_set.to_a.empty?\n log \"- empty set\"\n return \"\"\n end\n new_message_rows = fetch_envelopes(id_set, are_uids, is_update)\n new_message_rows.map {|x| x[:row_text]}.join(\"\\n\")\n rescue # Encoding::CompatibilityError (only in 1.9.2)\n log \"Error in fetch_row_text:\\n#{$!}\\n#{$!.backtrace}\"\n new_message_rows.map {|x| Iconv.conv('US-ASCII//TRANSLIT//IGNORE', 'UTF-8', x[:row_text])}.join(\"\\n\")\n end", "def _exec_select\n result = []\n csv = CSV.parse(File.read(@table_name), headers: true)\n if @join_flag != 1\n _parse_when_not_join(result, csv)\n else\n _parse_when_join(result, csv)\n end\n if @order_flag == 1\n result = _parse_order(result)\n end\n p result\n end", "def retrieve_value(obj, i)\r\n case obj.get_meta_data.get_column_type_name(i)\r\n when 'NUMBER'\r\n retrieve_number(obj, i)\r\n when 'INTEGER'\r\n retrieve_int(obj, i)\r\n when 'DATE'\r\n retrieve_time(obj, i)\r\n when 'TIMESTAMP'\r\n retrieve_time(obj, i)\r\n when 'CHAR', 'VARCHAR2', 'CLOB'\r\n retrieve_string(obj, i)\r\n when 'RAW'\r\n retrieve_raw(obj, i)\r\n else\r\n # If it is not one of the built-in tyes, it could be a user defined type\r\n # returning either an array or record type.\r\n type_code = obj.get_meta_data.get_column_type(i)\r\n if Java::JavaSql::Types::ARRAY == type_code\r\n @array ||= Array.new\r\n @array[i] ||= OraArray.new(obj.get_meta_data.get_column_type_name(i), nil)\r\n @array[i].retrieve_out_value(@connection, obj, i)\r\n elsif Java::JavaSql::Types::STRUCT == type_code\r\n @array ||= Array.new\r\n @array[i] ||= OraRecord.new(obj.get_meta_data.get_column_type_name(i), nil)\r\n @array[i].retrieve_out_value(@connection, obj, i)\r\n else\r\n raise UnknownSQLType, obj.get_meta_data.get_column_type_name(i)\r\n end\r\n end\r\n end", "def select(*) end", "def search_type(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if line =~ /(\\\".+,.+\\\")/ \n crappy_csv_line = $1\n not_as_crappy_csv_line = crappy_csv_line.sub(\",\", \"\")\n workable_csv_line = line.sub!(\"#{crappy_csv_line}\",\"#{not_as_crappy_csv_line}\").split(\",\")\n else\n workable_csv_line = line.split(\",\")\n end\n foo = workable_csv_line - workable_csv_line.slice(0,5)\n foobar = foo - workable_csv_line.slice(-1, 1) - workable_csv_line.slice(-2, 1)\n if query == 'nil'\n search_results << line\n else\n if not workable_csv_line[-2].nil?\n search_results << line if \"#{workable_csv_line[-2].downcase}\" =~ /#{query}/i\n end\n end\n end\n return search_results\nend", "def resultset; end", "def get_sql_profiles(sql_row)\n sql_select_all [\"SELECT * FROM DBA_SQL_Profiles WHERE Signature = TO_NUMBER(?) OR Signature = TO_NUMBER(?) #{'OR Name = ?' if sql_row.sql_profile}\n \",\n sql_row.exact_signature.to_s, sql_row.force_signature.to_s].concat(sql_row.sql_profile ? [sql_row.sql_profile] : []) if sql_row\n end", "def cast_string(arg, sql_type = nil)\n cast(arg, sql_type || String).sql_string\n end", "def search_rows(field_name, input) \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE #{field_name} = '#{input}'\")\n \n return self.results_as_objects(results)\n end" ]
[ "0.6084503", "0.60602933", "0.5909822", "0.5886812", "0.5829639", "0.58140266", "0.57646626", "0.56675726", "0.5663689", "0.5651938", "0.5639019", "0.5573033", "0.5564032", "0.5547336", "0.5544435", "0.5531182", "0.5513427", "0.54980457", "0.54804426", "0.54800713", "0.5454353", "0.54411095", "0.5438581", "0.54146093", "0.5403186", "0.5398081", "0.5387226", "0.53621775", "0.5360441", "0.5341595", "0.5339151", "0.5335211", "0.5314178", "0.5299238", "0.5285482", "0.52763796", "0.5276366", "0.526932", "0.5261081", "0.52583313", "0.5254078", "0.52451926", "0.52202505", "0.5218054", "0.52104807", "0.51989424", "0.5197679", "0.5185521", "0.5184005", "0.5182611", "0.5181472", "0.517656", "0.5170399", "0.5162701", "0.51425195", "0.5136524", "0.51358896", "0.51327", "0.51223636", "0.5114442", "0.5108696", "0.5106752", "0.5103654", "0.5099375", "0.50903344", "0.5087162", "0.5084551", "0.50828904", "0.50828904", "0.50754917", "0.5074297", "0.50732934", "0.50704753", "0.50689507", "0.506816", "0.5065972", "0.5065788", "0.5063247", "0.5059356", "0.50590706", "0.5056143", "0.50512135", "0.50303346", "0.5020896", "0.50172776", "0.50160545", "0.50154597", "0.50121653", "0.50100625", "0.50018334", "0.49974877", "0.49966058", "0.49951842", "0.49925756", "0.49887204", "0.49768937", "0.49644828", "0.4964028", "0.49609157", "0.49559763" ]
0.50609624
78
Convert readed data to hash with headers keys Need to prevent reading only in one format and to give opportunity to choose data presentation
def smart_convert! if @file_headers.any? @data = @data.map { |d_arr| @file_headers.each_with_object({}).with_index { |(h_name, h_hash), ind| h_hash[h_name] = d_arr[ind] } } @smart_convert = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_to_hash data\n header = {}\n data = data.split(@opts[:delimiter])\n self.req[\"Verb\"], self.req[\"Url\"], self.req[\"Version\"] = data.shift.split(\" \", 3)\n data.each do |line|\n k,v = line.split(\":\", 2)\n if !@opts[:header_bl] || !(HEADER_BLACKLIST.include? k)\n header[k] = v.lstrip\n end\n end\n header\n end", "def normalized_data\n result = { :headers => [], :values => [] }\n\n data.each do |row|\n values = []\n row.each do |key,val|\n # add the header field if needed\n result[:headers] << key unless result[:headers].include?(key)\n\n # build the values array\n index_of_header = result[:headers].index(key)\n values[index_of_header] = val\n end\n result[:values] << values\n end\n result\n end", "def convert_array_to_hash( headers, data )\n converted_data = {}\n headers.each_index do |position|\n if data[position].nil? or data[position] === \"\"\n converted_data[ headers[position] ] = nil\n else\n converted_data[ headers[position] ] = data[position]\n end\n \n end\n return converted_data\n end", "def to_h\n read!\n @data.dup\n end", "def to_h\n raw_data.split(\"\\n\").each_with_object({}) do |line, hsh|\n key, val = line.split.entries\n key = key.to_sym\n val = true if val == 'true'\n val = false if val == 'false'\n hsh[key] = val\n key == :url && hsh.merge!(parse_url_data(val))\n end\n end", "def parse_headers raw_headers\n\t\theaders = Hash.new\n\n\t\t# Store values as hash, but don't include duplicate values\n\t\tremove_fws(raw_headers).map do |line|\n\t\t\tkey, value = line.split(\": \", 2)\n\t\t\theaders[key] ||= []\n\t\t\theaders[key] << value unless headers[key].include? value\n\t\tend\n\n\t\t# Pop value from array if there's only one value\n\t\theaders.each{ |key, value| headers[key] = value.pop if value.length == 1 }\n\tend", "def to_h\n # TODO: Use a Mash -- some keys are better off addressed as strings\n JSON.parse(raw_data, symbolize_names: true)\n end", "def meta\n @meta ||= begin\n arr = @header_str.split(/\\r?\\n/)\n arr.shift\n arr.inject({}) do |hash, hdr|\n key, val = hdr.split(/:\\s+/, 2)\n hash[key.downcase] = val\n hash\n end\n end\n end", "def parse_csv(decoded_data)\n csv = CSV.parse(decoded_data)\n headers = csv.shift\n csv.to_a.map! { |row| Hash[headers.zip(row)] }\n end", "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend", "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend", "def hashify_header(hash, line)\n return nil if line.nil? || line.strip.empty?\n key, value = line.split(':')\n hash[convert_key(key)] = value.strip.chomp\n end", "def headers\n h = {}\n raw.headers_hash.each {|k,v| h[k] = v }\n h\n end", "def header_data\n\t\treturn self.normalized_headers.to_s\n\tend", "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :birth_year, :first_name, :last_name]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end", "def parse_headers\n headers = {}\n @request.lines[1..-1].each do |line|\n # puts line.inspect\n # puts line.split.inspect\n return headers if line == \"\\r\\n\" # Because HTTP header's last line will be /r/n we return bc we're done\n header, value = line.split\n header = normalize(header)\n headers[header] = value\n end\n \n return headers\n end", "def parseHeaders(request) \n headers = {};\n\n # Loop through headers\n request.lines[1..-1].each do |line|\n # If we are moving to the next line, return what we currently have\n return headers if line == \"\\r\\n\"\n\n # Structure data\n header, value = line.split\n header = header.gsub(\":\", \"\").downcase.to_sym\n headers[header] = value\n end\nend", "def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end", "def parse_header(string)\n {\n # identificação do registro header (conteúdo 0)\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # código da empresa no bradesco\n :codigo_empresa => string[26..45].strip,\n # razão social da empresa\n :razao_social => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => convert_date(string[94..99]),\n # brancos\n #:brancos1 => string[100..107],\n # número aviso bancário\n :numero_aviso_bancario => string[108..112],\n # brancos\n #:brancos2 => string[113..378],\n # data de crédito dos lançamentos\n :data_credito => convert_date(string[379..384]),\n # brancos\n #:brancos3 => string[385..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end", "def parse_headers(raw_headers)\n headers = {}\n raw_headers.each do |h|\n if h =~ /^# *([a-zA-Z_]+) *:(.*)/\n h_key = $1.downcase.intern\n h_value = $2.split(\",\").collect { |v| v.strip }\n if h_value.length > 0 # ignore empty headers\n headers[h_key] = h_value.length > 1 ? h_value : h_value[0]\n end\n end\n end\n \n return headers\n end", "def parse_header(string)\n {\n # identificação do registro header\n :tipo_registro => string[0..0].to_i,\n # identificação do arquivo retorno\n :codigo_retorno => string[1..1],\n # identificação por extenso do tipo de movimento\n :literal_retorno => string[2..8],\n # identificação do tipo de serviço\n :codigo_servico => string[9..10],\n # identificação por extenso do tipo de serviço\n :literal_servico => string[11..25],\n # agência mantenedora da conta\n :agencia => string[26..29],\n # complemento de registro\n :zeros => string[30..31],\n # número da conta corrente da empresa\n :conta => string[32..36],\n # dígito de auto-conferência ag/conta empresa\n :dac => string[37..37],\n # complemento do registro\n #:brancos1 => string[38..45],\n # nome por extenso da \"empresa mãe\"\n :nome_empresa => string[46..75],\n # número do banco na câmara de compensação\n :codigo_banco => string[76..78],\n # nome por extenso do banco cobrador\n :nome_banco => string[79..93].strip,\n # data de geração do arquivo\n :data_geracao => string[94..99],\n # unidade de densidade\n :densidade => string[100..104],\n # densidade de gravação do arquivo\n :unidade_densidade => string[105..107],\n # número sequencial do arquivo retorno\n :numero_sequencial_arquivo_retorno => string[108..112],\n # data de crédito dos lançamentos\n :data_credito => string[113..118],\n # complemento do registro\n #:brancos2 => string[119..393],\n # número sequencial do registro no arquivo\n :numero_sequencial => string[394..399]\n }\n end", "def get_header\n file_in_handle = open_in_file @file_in_path\n file_in_handle.seek FILE_HEADER_MAGIC_KEY_BYTES\n header_data = file_in_handle.read FILE_HEADER_DATA_BYTES\n file_in_handle.close\n\n crypto = Mcrypt.new(:'blowfish-compat', :ecb, HEADER_DECRYPTION_KEY)\n plaintext = crypto.decrypt(header_data)\n\n header_hash = {}\n URI.decode_www_form(plaintext).each { |key_value_array| header_hash[key_value_array[0]] = key_value_array[1] unless key_value_array[0].empty? }\n header_hash\n end", "def parse_hash\n \thash = {}\n \t# Remove the first five lines of the file\n \ttemp_array = @readin[5, @readin.length]\n \t# Split the input at the semicolon: the left hand side is a timestamp and the right hand side\n \t# is the value (either power in W, or energy in Wh depending on the file type).\n \t# This is committed to a hash with time as the key and the W/Wh as the value.\n \ttemp_array.each do |s|\n \t\tk,v = s.split(/;/)\n \t\t# the Aurora reports time as seconds since 1/1/0000 and Ruby reports time utilizing an epoch\n \t\t# that began on 1/1/1970. The time stamp is adjusted for the time in seconds between these\n \t\t# two dates.\n \t\thash[Time.at(k.to_i - 62167104000)] = v.to_f\n \tend\n \treturn hash\n end", "def parse_header(raw)\n header = {}\n field = nil\n\n raw.each_line do |line|\n case line\n when /^([A-Za-z0-9!\\#$%&'*+\\-.^_`|~]+):\\s*(.*?)\\s*\\z/om\n field, value = $1, $2\n header[field] = value\n when /^\\s+(.*?)\\s*\\z/om\n value = $1\n fail \"bad header '#{line}'.\" unless field\n\n header[field][-1] << ' ' << value\n else\n fail \"bad header '#{line}'.\"\n end\n end\n\n header.each do |key, value|\n value.strip!\n value.gsub!(/\\s+/, ' ')\n end\n\n header\n end", "def hash_from source, line\n line_elements = line.split(source[:delim]).map(&:strip)\n Hash[source[:headers].zip(line_elements)].tap do |h|\n h[:birth_date] = Date.strptime( h[:birth_date].to_s.gsub('-','/'), '%m/%d/%Y' )\n end\n end", "def to_headers\n headers = {}\n h = data.merge(@deleted_hash)\n h.each_pair do |k,v|\n key = to_header_key(k,v)\n headers[key] = v || DUMMY_VALUE\n end\n\n headers\n end", "def to_h\n array = []\n array << @header.to_h if @header\n @entries.each do |entry|\n array << entry.to_h\n end\n array\n end", "def to_h\n Hash[ data.map {|k,v| v.is_a?(StructHash) ? [k, v.to_h] : [k, v] } ]\n end", "def headers=(hash); end", "def headers=(hash); end", "def parse_headers(raw_headers)\n # raw headers from net_http have an array for each result. Flatten them out.\n raw_headers.inject({}) do |remainder, (k, v)|\n remainder[k] = [v].flatten.first\n remainder\n end\n end", "def process_headers\n { \"Content-Type\" => content_type }.tap do |result|\n headers.each do |header|\n result[header.name] = header.value\n end\n end\n end", "def get_headers\nheader_values = {}\n i = 1\n # while !params[:header][:type_.to_s + \"#{i}\"].nil?\n while !params[:header_values_.to_s + \"#{i}\"].nil?\n\t value = params[:header_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n \theader_values[params[:header][:type_.to_s + \"#{i}\"]] = value\n i += 1\n end\n header_values\nend", "def to_hash\n h = self.Header.to_hash\n h.merge! self.Metadata.to_hash\n h.merge! self.NewsContent.to_hash\n h\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 read_headers!; end", "def to_hash\n # TODO: find a better option to populate the data to the Hash\n image;feed;links;charset;absolute_links;title;meta_keywords\n @data.to_hash\n end", "def to_h\n @data.reverse.inject({}){ |h,d| h.merge(d.to_h) }\n end", "def headers_hash\n @headers_hash ||= Hash[@http_headers.split(\"\\x00\").map{|x| x.split(': ',2)}]\n end", "def machine_hash(headers,rows)\n # This is just to give a nice data structure (a hash of )\n rows.each_with_index.map do |row, index|\n # todo - rearrange the hash so it is sorted - do we need the row index?\n Hash[headers.each_with_index.map { |header, pos| \n [header, row[pos] ]}\n ].merge('row' => index+2)\n end\n end", "def to_hash\n @headers\n end", "def setup_header(dat)\n @headers = { to: to }\n dat.each do |key, val|\n key = key.to_s.downcase\n raise \"invalid field #{key}\" unless valid_fields.include?(key)\n @headers[key.to_sym] = val unless val.nil?\n end\n end", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def response_headers_hash\n return {} unless response_headers\n result = {}\n prev = nil\n response_headers.each_line do |line|\n next if line.blank?\n if line[0..0].blank?\n raise HeaderParseError.new('Leading whitespace on first header line') unless prev\n prev << line.lstrip\n else\n key, value = line.split(':', 2)\n raise HeaderParseError.new('Missing header name') if key.blank?\n key = NORMALIZED_HEADERS[key.downcase] || key\n prev = value.lstrip!\n result[key] = prev\n end\n end\n result\n end", "def generate_data_hash(data_array)\r\n data_hash = {}\r\n data_array.each_index do |x|\r\n d = convert_to_string(data_array[x])\r\n d = clean_string(d)\r\n row = x + 1\r\n data_hash[row] = d unless d.nil?\r\n end\r\n # deleting the first row which contains the column header and not\r\n # a value\r\n data_hash.delete_if{|k,v| k == 1}\r\n\r\n return data_hash\r\n end", "def to_hash(description='String::to_hash() made by genious RCarlesso (give a better description if u dont like this!)')\n arr = Hash.new\n arr['_meta'] = Hash.new\n arr['_meta']['description'] = description\n arr['_meta']['time'] = Time.now\n self.split(\"\\n\").each{|line| \n k,v = line.split(': ') \n arr[k.strip] = v.strip \n } rescue arr['_meta']['errors'] = $! \n arr\n end", "def parse_header_lines\n if @parsed_values[\"\"].nil? || @parsed_values[\"\"][1].nil?\n @parsed_values[\"\"] = {}\n return\n end\n\n headers = {}\n # Heading lines may have escaped newlines in them\n @parsed_values[\"\"][1].split(/\\\\n/).each do |line|\n next if line.size == 0\n\n if line =~ /(.*?):(.*)/\n key, value = $1, $2\n if headers[key] && headers[key].size > 0\n @errors << [\"Duplicate header line: #{line}\"]\n elsif key =~ /#-#-#-#-#/\n @errors << [\"Marker in header line: #{line}\"]\n else\n headers[key] = value\n end\n else\n @errors << [\"Malformed header #{line}\"]\n end\n end\n\n @parsed_values[\"\"] = headers\n end", "def parse_hash(headers, size, headers_size)\n headers_index = headers.find_index { |x| x.count == headers_size }\n order = headers[headers_index]\n order_index = order.count - size\n order = order[order_index..-1]\n indice = headers[headers_index+1..-1].flatten\n indice = nil if indice.to_a.empty?\n [order, indice]\n end", "def response_to_h(resp) # :nodoc:\n resp = resp.body.gsub(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n\n # unfold folded fields\n # A newline followed by one or more spaces is treated as a\n # single space\n resp.gsub!(/\\n +/, \" \")\n\n #replace CF spaces with underscores\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/)\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n return {:error => resp } if (resp =~ /^#/ and resp =~/does not exist\\.$/) or (resp =~ /Transaction \\d+ is not related to Ticket/)\n\n # convert fields to key value pairs\n ret = {}\n resp.each_line do |ln|\n next unless ln =~ /^.+?:/\n ln_a = ln.split(/:/,2)\n ln_a.map! {|item| item.strip}\n ln_a[0].downcase!\n ret[ln_a[0]] = ln_a[1]\n end\n\n return ret\n end", "def process_hash_row(hsh)\n if @headers.any?\n keys_or_values = hsh.values\n @row_id = hsh[:row_id]\n else\n keys_or_values = hsh.keys.map(&:to_s)\n end\n\n file_line = keys_or_values.join(',')\n validated_line = utf_filter(check_utf(file_line))\n res = line_parse(validated_line)\n res\n end", "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :year, :team_id, :game, :at_bats, :runs, :hits, :doubles, :triples, :home_runs, :runs_batted_in, :stolen_bases, :caught_stealing]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end", "def seperate_headers()\n\t\t@stream.split(\"\\n\\n\")[0].split(\"\\n\", 2)[1]\n\tend", "def to_hash\n data.to_hash\n end", "def to_hash\n data.to_hash\n end", "def extract_parts_hash\n parts_hash = {}\n\n @header_string.sub!(/\\ARange:\\s*/, '')\n\n range_spec_string, params_strings = split_header_string(@header_string)\n\n parts_hash.merge! extract_range_spec_hash(range_spec_string)\n parts_hash.merge! extract_params_hash(params_strings)\n\n return parts_hash\n end", "def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end", "def parse_header_contents; end", "def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end", "def to_h\n {\n data: data,\n nonce: nonce,\n time: time,\n hash: hash,\n index: index,\n prev_hash: prev_hash\n }\n end", "def row_to_hsh(row)\n h = Hash[@headers.zip(row)]\n h.symbolize_keys\n end", "def make_headers_hash( node_data )\n\t\t\theaders = DEFAULT_HTTP_HEADERS.merge( node_data['http_headers'] || {} )\n\t\t\tif node_data['body']\n\t\t\t\theaders[ 'Content-type' ] ||= node_data['body_mimetype'] ||\n\t\t\t\t\t 'application/x-www-form-urlencoded'\n\t\t\tend\n\n\t\t\treturn headers\n\t\tend", "def parse_into_hash(file_content)\n # apt-history file is seperated by double new line\n file_sections = file_content.split(\"\\n\\n\")\n\n # split the sections by line within them\n file_sections.map! { |section| section.split(\"\\n\") }\n\n # split each line of the sections by : seperator\n file_sections.map! do |section|\n section.map! do |line|\n line.partition(\": \").values_at(0, 2) # we don't need the seperator\n end\n section.to_h # Now make a hash of key-value pairs from 2-D array\n end\n end", "def formatData(data)\n data.keys.each{|key| data}\n end", "def to_hash\n # Get buffer contents as a String\n s = lock {buf} rescue ''\n # Split into RECORD_SIZE character lines\n lines = s.scan(/.{#{RECORD_SIZE}}/o)\n # Skip END record\n lines.pop if lines[-1].start_with?('END ')\n\n # Parse lines into key and value\n h = {}\n lines.each do |l|\n key, value = l.split('=', 2)\n value ||= '' # In case no '='\n key.strip!\n value.strip!\n # If value is enclosed in single quotes, remove them and strip spaces\n value = value[1..-2].strip if /^'.*'$/ =~ value\n h[key] = value\n end\n h\n end", "def get_headers_\n hin = ATS::Headers_in.new\n hin.all.reduce({}) do |memo, pair| \n memo[pair.first.downcase] = pair[1]; memo\n end\n end", "def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end", "def data_to_rows\n rows = []\n headers = get_ordered_headers\n rows << headers\n @data.each do |druid, column_hash|\n row_out = [druid]\n headers.each do |header|\n if header == 'druid'\n next\n elsif column_hash.keys.include?(header)\n row_out << column_hash[header].gsub(/\\n/, \" \").squeeze(\" \")\n else\n # Padding if row does not have data for that header\n row_out << \"\"\n end\n end\n rows << row_out\n end\n rows\n end", "def header_array\n hash = get_headers \n arr = []\n hash.each do |k, v|\n\tv.each do |i|\n\tarr << k + \"=\" + i\n\tend\nend\n arr\nend", "def dissect_to_record_hashes\n end", "def headers; return {}; end", "def headers; return {}; end", "def parse_header( data )\n k,v = data.split(\"\\0\", 2)\n return [k, v.delete(\"\\0\")]\n end", "def to_h\n extract_files\n extract_metrics\n data\n end", "def extract_header_data(response)\n header_type = get_full_type_signature(:SoapResponseHeader)\n headers = response.header[:response_header].dup\n process_attributes(headers, false)\n result = headers.inject({}) do |result, (key, v)|\n normalize_output_field(headers, header_type[:fields], key)\n result[key] = headers[key]\n result\n end\n return result\n end", "def actual_header\n data.lines.first.chomp\n end", "def process_csv(file)\n data = CSV.read(file, {encoding: \"UTF-8\", headers: true, header_converters: :symbol, converters: :all})\n hashed_data = data.map { |d| d.to_hash } \n \n puts \"CSV Loaded...\"\n\n return hashed_data\n end", "def convert_header(h)\n changed_header = h.to_s.downcase.gsub('-', '').gsub(' ','_')\n (User::HEADERS[changed_header].present? ? User::HEADERS[changed_header] : changed_header).intern\n end", "def arrange_representative_header header\n head={\"FIRST NAME\" => \"first_name\",\n \"LAST NAME\" => \"last_name\",\n \"EMAIL\" => \"email\",\n \"UIN\" => \"uin\",\n \"FULL ACADEMIC UNIT NAME\" => \"academic_unit_name\",\n \"COLLEGE\" => \"college\"\n }\n arranged_header=[]\n header.each do |k|\n arranged_header.push head[k]\n end\n return arranged_header\n end", "def parse_meta\n meta = Hash.new\n meta[@data[0][0]] = @data[0][1]\n meta[@data[0][2]] = @data[0][3]\n meta[@data[0][4]] = @data[0][5]\n meta[@data[0][6]] = @data[0][7]\n meta[@data[1][0]] = @data[1][1]\n meta[@data[1][2]] = @data[1][3]\n meta[@data[1][4]] = @data[1][5]\n meta[@data[1][6]] = @data[1][7]\n meta[@data[1][8]] = @data[1][9]\n meta[@data[1][10]] = @data[1][11]\n meta[@data[1][12]] = @data[1][13]\n # This is some cleanup that needs to happen because of an oddity (bug?) in \n # the WF/CSV files in version 5.5.1.\n if [\"5.5.0\",\"5.5.1\"].include? meta[\"AppVersion\"]\n day = Hash.new\n hour = Hash.new\n minu = Hash.new\n sec = Hash.new\n meta.each do |k,v|\n if !k.nil?\n if k.include? \"Day\"\n d = k.split(/([0-9]+)/) \n day[d[0]] = d[1]\n h = v.split(/([0-9]+)/) \n hour[h[0]] = h[1]\n meta.delete(k)\n elsif k.include? \"Minu\"\n m = k.split(/([0-9]+)/) \n minu[m[0]] = m[1]\n s = v.split(/([0-9]+)/) \n sec[s[0]] = s[1]\n meta.delete(k)\n end\n else\n meta.delete(k)\n end\n end \n meta.merge! day\n meta.merge! hour\n meta.merge! minu \n meta.merge! sec\n end \n return meta\n end", "def csv_parsed\n transform_to_hash(@csv_array, @header)\n end", "def prep_hash_for_csv(data_hash)\n\tbig_array = []\n\tdata_hash.each do |key, ads|\n\t\tad_array = [].push(key)\n\t\tads.each do |ad|\n\t\t\tad_string = ad[0] + \"\\r\" + ad[1] + \"\\r\" + ad[2]\n\t\t\tad_array.push(ad_string)\n\t\tend\n\t\tbig_array.push(ad_array)\n\tend\n\toutput_array = big_array.safe_transpose\n\treturn output_array\nend", "def headers flatten=nil\n hsh = {}\n if !flatten\n @headers.each_pair do |k, v|\n hsh[k] = v.value\n end\n elsif flatten == true\n @headers.each_pair do |k, v|\n hsh[k] = v.flatten\n end\n else\n @headers.each_pair do |k, v|\n hsh[k] = v.flatten(flatten)\n end\n end\n hsh\n end", "def prepare_data_for_writing(data_to_write, headers)\n if data_to_write.first.class.to_s.downcase =~ /hash/\n prepared_headers = data_to_write.first.keys.map(&:to_s)\n prepared_data_to_write = data_to_write.map { |data_h| data_h.values }\n return prepared_data_to_write, prepared_headers\n elsif data_to_write.first.class.to_s.downcase =~ /array/\n raise \"No headers provided for writing\" if !headers or headers.empty?\n\n return data_to_write, headers\n end\n end", "def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end", "def to_hash\n Hash[ *(map { |line| [line.key, line] }).flatten ]\n end", "def to_h\n data = super\n data[:convert] = data.delete(:converter)\n data.stringify_keys\n end", "def header(buf)\n peek = buf.getbyte\n buf.seek(-1, IO::SEEK_CUR)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end", "def headers\n\t\t\thdr = @curb.header_str\n\t\t\tself.class.recode(log?, @curb.content_type, hdr) ?\n\t\t\t\tself.class.parse_headers(hdr) :\n\t\t\t\tself.class.parse_headers(@curb.header_str) # recode failed\n\t\tend", "def initialize(arr)\n # tokenize headers \n @headers = arr[0].map { |h| h.strip.downcase.sub(' ', '_').to_sym }\n\n # turn all rows into processing friendly format\n @data = arr[1..arr.count].map do |d|\n Hash[@headers.collect.with_index { |header, idx| [header, d[idx]] }]\n end\n end", "def get_header_info\n @data.rewind\n \n #column_count_offset = 33, record_count_offset = 24, record_length_offset = 36\n @record_count, @data_offset, @record_length = data.read(HEADER_LENGTH).unpack(\"@24 I x4 I I\")\n @column_count = (@data_offset-400)/200\n end", "def build_existinghash(data)\n existinghash = {}\n data.each do |key, value|\n existinghash[key.to_s] = value.to_s.tr(\"\\n\", ' ').strip\n end\n existinghash\n end", "def transform_headers( str, rs )\n\t\t\t@log.debug \" Transforming headers\"\n\n\t\t\t# Setext-style headers:\n\t\t\t#\t Header 1\n\t\t\t#\t ========\n\t\t\t#\n\t\t\t#\t Header 2\n\t\t\t#\t --------\n\t\t\t#\n\n\t\t\tsection_numbers = [nil, nil, nil, nil, nil]\n\n\t\t\tstr.\n\t\t\t\tgsub( HeaderRegexp ) {|m|\n\t\t\t\t\tif $1 then\n\t\t\t\t\t\t@log.debug \"Found setext-style header\"\n\t\t\t\t\t\ttitle, id, hdrchar = $1, $2, $3\n\n\t\t\t\t\t\tcase hdrchar\n\t\t\t\t\t\twhen '='\n\t\t\t\t\t\t\tlevel = 1\n\t\t\t\t\t\twhen '-'\n\t\t\t\t\t\t\tlevel = 2\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@log.debug \"Found ATX-style header\"\n\t\t\t\t\t\thdrchars, title, id = $4, $5, $6\n\t\t\t\t\t\tlevel = hdrchars.length\n\n\t\t\t\t\t\tif level >= 7 then\n\t\t\t\t\t\t\trs.warnings << \"illegal header level - h#{level} ('#' symbols are too many)\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tprefix = ''\n\t\t\t\t\tif rs.numbering? then\n\t\t\t\t\t\tif level >= rs.numbering_start_level and level <= 6 then\n\t\t\t\t\t\t\tdepth = level - rs.numbering_start_level\n\n\t\t\t\t\t\t\tsection_numbers.each_index do |i|\n\t\t\t\t\t\t\t\tif i == depth and section_numbers[depth] then\n\t\t\t\t\t\t\t\t\t# increment a deepest number if current header's level equals last header's\n\t\t\t\t\t\t\t\t\tsection_numbers[i] += 1\n\t\t\t\t\t\t\t\telsif i <= depth then\n\t\t\t\t\t\t\t\t\t# set default number if nil\n\t\t\t\t\t\t\t\t\tsection_numbers[i] ||= 1\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t# clear discardeds\n\t\t\t\t\t\t\t\t\tsection_numbers[i] = nil\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tno = ''\n\t\t\t\t\t\t\t(0..depth).each do |i|\n\t\t\t\t\t\t\t\tno << \"#{section_numbers[i]}.\"\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tprefix = \"#{no} \"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle_html = apply_span_transforms( title, rs )\n\n\t\t\t\t\tunless id then\n\t\t\t\t\t\tcase rs.header_id_type\n\t\t\t\t\t\twhen HeaderIDType::ESCAPE\n\t\t\t\t\t\t\tid = escape_to_header_id(title_html)\n\t\t\t\t\t\t\tif rs.headers.find{|h| h.id == id} then\n\t\t\t\t\t\t\t\trs.warnings << \"header id collision - #{id}\"\n\t\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tid = \"bfheader-#{Digest::MD5.hexdigest(title)}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttitle = \"#{prefix}#{title}\"\n\t\t\t\t\ttitle_html = \"#{prefix}#{title_html}\"\n\n\n\t\t\t\t\tunless id =~ IdRegexp then\n\t\t\t\t\t\trs.warnings << \"illegal header id - #{id} (legal chars: [a-zA-Z0-9_-.] | 1st: [a-zA-Z])\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif rs.block_transform_depth == 1 then\n\t\t\t\t\t\trs.headers << RenderState::Header.new(id, level, title, title_html)\n\t\t\t\t\tend\n\n\t\t\t\t\tif @use_header_id then\n\t\t\t\t\t\t%{<h%d id=\"%s\">%s</h%d>\\n\\n} % [ level, id, title_html, level ]\n\t\t\t\t\telse\n\t\t\t\t\t\t%{<h%d>%s</h%d>\\n\\n} % [ level, title_html, level ]\n\t\t\t\t\tend\n\t\t\t\t}\n\t\tend", "def column_headers(data)\n headers = { :types => [], :names => [] }\n\n data.map do |header|\n name = Utils.unprefix(header['name'])\n type = header['dataType'].downcase.to_sym\n type = :date if name == :date\n\n headers[:types] << type\n headers[:names] << name\n end\n\n headers\n end", "def to_h\n pairs = first_child.text.each_line.collect do |line|\n key, value = parse_key_value_line(line)\n end\n Hash[pairs]\n end", "def html_parse_hash(headers, size, headers_size)\n headers_index = headers.find_index { |x| x.count == headers_size }\n order = headers[headers_index]\n order_index = order.count - size\n order = order[order_index..-1]\n indice = headers[headers_index+1..-1].flatten\n indice = nil if indice.to_a.empty?\n [order, indice]\n end", "def get_normalised_headers(headers = nil)\n normalised_keys = {}\n if !headers.nil?\n if headers.kind_of?Hash\n headers.each do |key,value|\n normalised_key = key.to_s.downcase.gsub('_','-').sub(/http-/,'')\n normalised_keys[normalised_key] = value\n end\n elsif headers.kind_of?String\n normalised_keys = {'user-agent' => headers}\n end\n elsif !@headers.nil?\n @headers.each do |key,value|\n normalised_key = key.to_s.downcase.gsub('_','-').sub(/http-/,'')\n normalised_keys[normalised_key] = value\n end\n end\n return normalised_keys\n end", "def meta_to_hash(text)\n hash = {}\n return hash if text.nil?\n result_list = []\n\n text.split(/\\n/).each do |meta|\n # split by the first ':' string\n list = meta.split /^(.*?):/\n\n # ignore the empty string element\n list.delete_at(0)\n\n unless list.empty?\n list.map(&:strip!)\n # downcase the first item to make it easy\n result_list << [list[0].downcase, list[1]]\n hash = Hash[*result_list.flatten]\n end\n end\n hash\n end", "def parse_hash_packet(data)\n hashes = []\n\n algo = data.read_string\n size = case algo\n when \"md5\" then 128\n when \"sha256\" then 256\n when \"sha384\" then 284\n when \"sha512\" then 512\n else raise NotImplementedError, \"unsupported algorithm: #{algo}\"\n end\n\n while !data.eof? do\n hashes << data.read(size)\n end\n\n { :algo => algo, :hashes => hashes }\n end", "def to_h; end", "def to_h; end" ]
[ "0.7607961", "0.6793278", "0.67569", "0.6631557", "0.6587677", "0.6570619", "0.6563308", "0.64562136", "0.6435142", "0.64004", "0.64004", "0.6339961", "0.63252276", "0.63063955", "0.6298083", "0.62965083", "0.6285503", "0.6276126", "0.6275561", "0.62542313", "0.61937106", "0.61859244", "0.6185548", "0.6173911", "0.6172779", "0.6163205", "0.6143418", "0.612661", "0.6124811", "0.6124811", "0.6113017", "0.60995436", "0.6094578", "0.6091239", "0.60877365", "0.60817367", "0.6079124", "0.60653293", "0.604803", "0.6023375", "0.6019959", "0.600968", "0.60092396", "0.59985155", "0.5998029", "0.59972703", "0.5995086", "0.5992754", "0.597214", "0.5964442", "0.5958257", "0.5957732", "0.59531784", "0.59531784", "0.59500617", "0.5948206", "0.5932938", "0.59242195", "0.59191793", "0.5909501", "0.5905795", "0.5898403", "0.58929193", "0.5891295", "0.5887622", "0.58867204", "0.58842593", "0.587479", "0.58688354", "0.58674717", "0.58674717", "0.585729", "0.58559334", "0.585569", "0.58434033", "0.58161354", "0.5811733", "0.5807565", "0.57929045", "0.57883006", "0.5782984", "0.57737696", "0.5769837", "0.5768881", "0.57584333", "0.5752663", "0.5735652", "0.57334346", "0.5732471", "0.57322955", "0.57270616", "0.5725954", "0.5718323", "0.57153004", "0.57023233", "0.56995857", "0.5690914", "0.56895804", "0.56839305", "0.56839305" ]
0.6127311
27
service methods that not need to be opened for usage outside if need more contact please me or contribute yourself by merge request
def prepare_data_for_writing(data_to_write, headers) if data_to_write.first.class.to_s.downcase =~ /hash/ prepared_headers = data_to_write.first.keys.map(&:to_s) prepared_data_to_write = data_to_write.map { |data_h| data_h.values } return prepared_data_to_write, prepared_headers elsif data_to_write.first.class.to_s.downcase =~ /array/ raise "No headers provided for writing" if !headers or headers.empty? return data_to_write, headers end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service; end", "def bi_service\n end", "def service; raise NotImplementedError; end", "def service_request(service); end", "def services\n\n end", "def apis; end", "def services\n end", "def api; end", "def api; end", "def services\n\tend", "def response_from_service\n\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def private; end", "def service\n abstract_method_error\n end", "def private_method\n end", "def implementation; end", "def implementation; end", "def methods() end", "def service_endpoint; end", "def service_endpoint; end", "def hidden_apis; end", "def service_name; end", "def provider; end", "def api_only; end", "def api_only; end", "def api_only; 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 who_we_are\r\n end", "def http; end", "def keyword_based_service?; end", "def call\n\n\tend", "def call\n\n\tend", "def refutal()\n end", "def format_service\n\n end", "def internal; end", "def invoke\n\t\tbegin\n\t\t @service = Object.const_get(@amfbody.service_name).new #handle on service\n\t\t RequestStore.available_services[@amfbody.service_name] = @service\n\t\trescue LoadError => e\n\t\t\traise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"The file #{@amfbody.class_file_uri}#{@amfbody.class_file} was not loaded. Check to make sure it exists in: #{RequestStore.service_path}\")\n\t\trescue Exception => e\n\t\t raise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"There was an error loading file #{@amfbody.class_file_uri}#{@amfbody.class_file}. #{e.message}\")\n\t\tend\n \n #authentication, simple\n\t if RequestStore.auth_header != nil\n\t if @service.public_methods.include?('_authenticate')\n\t begin\n \t res = @service.send('_authenticate', *[RequestStore.auth_header.value.userid, RequestStore.auth_header.value.password])\n if res == false #catch false\n \t\t raise RUBYAMFException.new(RUBYAMFException.AUTHENTICATION_ERROR, \"Authentication Failed\");\n elsif res.class.to_s == 'FaultObject' #catch returned FaultObjects\n \t\t raise RUBYAMFException.new(res.code, res.message)\n \t\tend\n \trescue Exception => e #catch raised FaultObjects\n \t if e.message == \"exception class/object expected\"\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n \tend\n \tend\n\t end\n \n #before_filter\n if @service.public_methods.include?('before_filter')\n\t begin\n\t res = @service.send('before_filter')\n \t if res == false #catch false\n \t raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"before_filter haulted by returning false.\")\n \t elsif res.class.to_s == 'FaultObject' #catch returned FaultObjects\n \t raise RUBYAMFException.new(res.code, res.message)\n \t end\n \trescue Exception => e #catch raised FaultObjects\n \t if e.message == \"exception class/object expected\"\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n \tend\n\t end\n\t \n\t\tif @service.private_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is declared as private, it must be defined as public to access it.\")\n\t\telsif !@service.public_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is not declared.\")\n\t\tend\n\t\t\n\t\tbegin\n\t\t\tif @amfbody.value.empty?\n\t\t\t\t@service_result = @service.send(@amfbody.service_method_name)\n\t\t\telse\n\t\t\t\targs = @amfbody.value\n\t\t\t\t@service_result = @service.send(@amfbody.service_method_name, *args) #* splat the argument values to pass correctly to the service method\n\t\t\tend\n\t\trescue Exception => e #catch any method call errors, transform into RUBYAMFException so that they propogate back to flash correctly\n\t\t\tif e.message == \"exception class/object expected\"\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n\t\t\t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR, e.to_s)\n\t\t\tend\n\t\tend\n\t\t\n\t\t#catch returned custom FaultObjects\n\t\tif @service_result.class.to_s == 'FaultObject'\n\t\t raise RUBYAMFException.new(@service_result.code, @service_result.message)\n\t\tend\n\t\t\t \n\t\t@amfbody.results = @service_result #set the result in this body object\n\t\t\n\t\t#amf3\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper.body = @service_result\n @amfbody.results = @wrapper\n\t\tend\n\t\t\n\t @amfbody.success! #set the success response uri flag (/onResult)\t\t\n\tend", "def weber; end", "def respond(); end", "def across_service_state\n super\n end", "def invoke\n begin \n # RequestStore.available_services[@amfbody.service_class_name] ||=\n @service = @amfbody.service_class_name.constantize.new #handle on service\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise RUBYAMFException.new(RUBYAMFException.UNDEFINED_OBJECT_REFERENCE_ERROR, \"There was an error loading the service class #{@amfbody.service_class_name}\")\n end\n \n #call one or the other method depending in the ruby version we are using\n if RUBY_VERSION > RUBY_19\n caller = \"to_sym\"\n else\n caller = \"to_s\"\n end \n\n if @service.private_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.\")\n elsif !@service.public_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.\")\n end\n \n #clone the request and response and alter it for the target controller/method\n req = RequestStore.rails_request.clone\n res = RequestStore.rails_response.clone\n \n #change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n controller = @amfbody.service_class_name.gsub(\"Controller\",\"\").underscore\n action = @amfbody.service_method_name\n req.parameters['controller'] = req.request_parameters['controller'] = req.path_parameters['controller'] = controller\n req.parameters['action'] = req.request_parameters['action'] = req.path_parameters['action'] = action\n req.env['PATH_INFO'] = req.env['REQUEST_PATH'] = req.env['REQUEST_URI'] = \"#{controller}/#{action}\"\n req.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n \n #set conditional helper\n @service.is_amf = true\n @service.is_rubyamf = true\n \n #process the request\n rubyamf_params = @service.rubyamf_params = {}\n if @amfbody.value && !@amfbody.value.empty?\n @amfbody.value.each_with_index do |item,i|\n rubyamf_params[i] = item\n end\n end\n \n # put them by default into the parameter hash if they opt for it\n rubyamf_params.each{|k,v| req.parameters[k] = v} if ParameterMappings.always_add_to_params \n \n begin\n #One last update of the parameters hash, this will map custom mappings to the hash, and will override any conflicting from above\n ParameterMappings.update_request_parameters(@amfbody.service_class_name, @amfbody.service_method_name, req.parameters, rubyamf_params, @amfbody.value)\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.PARAMETER_MAPPING_ERROR, \"There was an error with your parameter mappings: {#{e.message}}\")\n end\n\n #fosrias\n #@service.process(req, res)\n\n # call the controller action differently depending on Rails version\n if Rails::VERSION::MAJOR < 3\n @service.process(req, res)\n else\n @service.request = req\n @service.response = res\n @service.process(action.to_sym)\n end\n #fosrias\n \n #unset conditional helper\n @service.is_amf = false\n @service.is_rubyamf = false\n @service.rubyamf_params = rubyamf_params # add the rubyamf_args into the controller to be accessed\n \n result = RequestStore.render_amf_results\n \n #handle FaultObjects\n if result.class.to_s == 'FaultObject' #catch returned FaultObjects - use this check so we don't have to include the fault object module\n e = RUBYAMFException.new(result['code'], result['message'])\n e.payload = result['payload']\n raise e\n end\n \n #amf3\n @amfbody.results = result\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper[\"body\"] = result\n @amfbody.results = @wrapper\n end\n @amfbody.success! #set the success response uri flag (/onResult)\n end", "def operation_method\n raise 'Not implemented!'\n end", "def operations; end", "def operations; end", "def parent_api; end", "def parent_api; end", "def strategy; end", "def server_software; end", "def process_custom_method\n # da implementare per eventuali estensioni\n end", "def req\n \n end", "def contract; end", "def contract; end", "def hidden_apis=(_arg0); end", "def calls; end", "def calls; end", "def business_decision_support \n end", "def notifier; end", "def notifier; end", "def method\n\t\t# code code\n\tend", "def transport; end", "def transport; end", "def transport; end", "def how_it_works\r\n end", "def vendor; end", "def service_unavailable\n\n end", "def preflight; end", "def service_name\n raise \"please implement #service_name in your subclass #{self.class}\"\n end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def provider\n\tend", "def invoke\n\t\tbegin\n\t @service = Object.const_get(@amfbody.service_name).new #handle on service\n\t RequestStore.available_services[@amfbody.service_name] = @service\n\t\trescue LoadError => e\n\t\t\traise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"The file #{@amfbody.class_file_uri}#{@amfbody.class_file} was not loaded. Check to make sure it exists in: #{RequestStore.service_path}\")\n\t\trescue Exception => e\n\t\t raise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"There was an error loading file #{@amfbody.class_file_uri}#{@amfbody.class_file}.\")\n\t\tend\n\t\t\n\t\tif @service.private_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is declared as private, it must be defined as public to access it.\")\n\t\telsif !@service.public_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is not declared.\")\n\t\tend\n\t\t\t\t\n\t\t#clone the request and response and alter it for the target controller/method\n\t\treq = RequestStore.rails_request.clone\n\t\tres = RequestStore.rails_response.clone\n\t\t\n\t\t#change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n\t ct = @amfbody.target_uri.clone.split('Controller')[0].downcase\n\t sm = @amfbody.service_method_name\n\t\treq.parameters['controller'] = ct\n\t\treq.parameters['action'] = sm\n\t\treq.request_parameters['controller'] = ct\n\t\treq.request_parameters['action'] = sm\n\t\treq.request_parameters['amf'] = 'hello world'\n\t\treq.path_parameters['controller'] = ct\n\t\treq.path_parameters['action'] = ct\n\t\treq.env['PATH_INFO'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_PATH'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_URI'] = \"#{ct}/#{sm}\"\n\t\treq.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n\t\t\n\t\t#set conditional helper\n\t\t@service.is_amf = true\n\t\t@service.is_rubyamf = true\n \n #process the request\n\t\tif @amfbody.value.empty? || @amfbody.value.nil?\n\t\t @service.process(req,res)\n\t\telse\n\t\t @amfbody.value.each_with_index do |item,i|\t\t \n\t\t req.parameters[i] = item\n\t\t if item.class.superclass.to_s == 'ActiveRecord::Base'\n\t\t req.parameters[i] = item.original_vo_from_deserialization.to_hash\n if i < 1 #Only the first parameter will be \n req.parameters.merge!(item.original_vo_from_deserialization.to_hash) #merge in properties into the params hash\n #have to specifically check for id here, as it doesn't show up in any object members.\n if item.original_vo_from_deserialization.id != nil\n #This will override the above params[:id] attempt, because it's the original deserialized values.\n req.parameters[:id] = item.original_vo_from_deserialization.id\n end\n end\n\t req.parameters[item.class.to_s.downcase.to_sym] = item.original_vo_from_deserialization.to_hash\n\t \n\t\t elsif !item._explicitType.nil?\n\t\t t = item._explicitType\n\t\t if t.include?('.')\n\t\t t = t.split('.').last.downcase.to_s\n\t\t end\n \t\t req.parameters[t.to_sym] = item.to_hash\n \t\t if i < 1\n \t\t if item.class.to_s == 'Object' || item.class.to_s == 'OpenStruct'\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end\n \t\t \n \t\t elsif item.class.to_s == 'OpenStruct' || item.class.to_s == \"Object\"\n\t\t if i < 1\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end \t\t \n\t\t end\n end\n\t @service.process(req,res)\n end\n \n #unset conditional helper\n @service.is_amf = false\n\t\t@service.is_rubyamf = false\n \n\t\t#handle FaultObjects\n\t\tif @service.amf_content.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(@service.amf_content.code, @service.amf_content.message)\n\t\tend\n\t\t\n\t\t#amf3\n\t\t@amfbody.results = @service.amf_content\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper.body = @service.amf_content\n @amfbody.results = @wrapper\n\t\tend\n\t @amfbody.success! #set the success response uri flag (/onResult)\n\tend", "def client; end", "def client; end", "def request\n raise 'need to be implemented'\n end", "def internal_methods; end", "def unsupported_client\n\n end", "def service_functions(service_module)\n methods = service_module.const_get('Client').instance_methods.map {|method| method.to_s}\n methods.select do |method|\n send_exists = methods.include? \"send_#{method}\"\n upped = method.dup\n upped[0..0] = method[0..0].upcase\n begin\n send_exists && service_module.const_get(\"#{upped}_args\")\n rescue\n false\n end\n end\n 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", "def method; end", "def method; end" ]
[ "0.7737704", "0.7351209", "0.7225053", "0.702254", "0.68654746", "0.68396556", "0.6827828", "0.66029984", "0.66029984", "0.6549432", "0.63603586", "0.63320774", "0.63320774", "0.63320774", "0.63320774", "0.6331718", "0.62942153", "0.62758154", "0.6270298", "0.6270298", "0.6235825", "0.6225132", "0.6225132", "0.61921954", "0.6183376", "0.6177052", "0.6102096", "0.6102096", "0.6102096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6096", "0.6075259", "0.60662", "0.60489964", "0.60287243", "0.60287243", "0.6027317", "0.6017506", "0.60068756", "0.5972724", "0.59384036", "0.5901291", "0.589667", "0.5886117", "0.5863149", "0.58569366", "0.58569366", "0.58519185", "0.58519185", "0.58511907", "0.58433473", "0.5841156", "0.5806504", "0.5793429", "0.5793429", "0.5782632", "0.57790357", "0.57790357", "0.5777614", "0.5736348", "0.5736348", "0.5736331", "0.5730622", "0.5730622", "0.5730622", "0.57132196", "0.56961566", "0.5693241", "0.56931084", "0.56815344", "0.5679638", "0.5679638", "0.5679638", "0.5679638", "0.5677999", "0.5668257", "0.56648797", "0.56648797", "0.5663739", "0.5659988", "0.5648294", "0.564668", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288", "0.5642288" ]
0.0
-1
find out file encoding
def find_enoding scmdlog = `file -I #{@file_name}`.strip scmdlog[/charset=(.+?)$/, 1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_encoding(file)\n output = %x{file --mime-encoding #{file} 2>&1}.chomp\n regexp = Regexp.new(\"#{file}: (\\\\S+)\")\n matched = output.match(regexp)\n encoding = matched[1] if matched\n encoding = begin Encoding.find(encoding) rescue nil end\n end", "def found_encoding; end", "def found_encoding; end", "def find_encoding(encoding); end", "def encoding_found; end", "def encoding_found; end", "def file_mode(m)\n Cucumber::RUBY_1_9 ? \"#{m}:#{keyword_hash['encoding']}\" : m\n end", "def meta_encoding; end", "def meta_encoding; end", "def check_encoding\n\tall_encoding = []\n\tfiles = Dir.glob(\"**/*.rb\") + Dir.glob(\"**/*.yml\") + Dir.glob(\"**/*.feature\")\n\tfiles.each do |file|\n\t\tall_encoding.push(File.open(file).map { |line| line.to_s.encoding })\n\tend\n\n\tnb = all_encoding.flatten.count { |encoding| encoding.name != 'UTF-8' }\n\tif nb > 0\n\t\tputs \"Error encoding file\"\n\t\t$errors = true\n\tend\nend", "def encodings; end", "def get_encoding()\n puts @csv_encoding\n end", "def default_encoding; end", "def default_encoding; end", "def detect_charset(path)\n Process.run_command 'uchardet', path\n rescue Errno::ENOENT\n # :nocov:\n Process.run_command('encguess', path).sub(/^.*\\s+/, '')\n # :nocov:\n end", "def guess_byte_order\n # Assume native, since we don't know what type of file we have.\n :native\n end", "def encoding(encoding); end", "def guess_encoding\n if @mime_type && !@mime_type.binary?\n \"7bit\"\n else\n \"binary\"\n end\n end", "def find_file(path_info, accept_encoding:); end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encodings(safe_path)\n @encodings ||= determine_encodings!(safe_path)\n end", "def encoding\n @io.external_encoding\n end", "def encoding\n @io.external_encoding\n end", "def charset; end", "def charset; end", "def charset; end", "def determine_encodings!(*)\n @encoding ||= super\n end", "def encoding_line; end", "def explicit_transcode(filename, from_encoding, to_encoding)\n puts ''\n puts `file test_files/#{filename}`\n puts \"transcoding from #{from_encoding.name} to #{to_encoding.name}\"\n\n file_str = read_file(filename)\n encoded_str = file_str.force_encoding(from_encoding).encode!(Encoding::UTF_8, from_encoding)\n\n puts encoded_str\n puts 'valid encoding: ' + encoded_str.valid_encoding?.to_s\n puts ''\nend", "def charset\n metadata[:charset]\n end", "def internal_encoding()\n #This is a stub, used for indexing\n end", "def external_encoding()\n #This is a stub, used for indexing\n end", "def encoding\n @content[pn(:Encoding)]\n end", "def encoding\n @attributes[:encoding]\n end", "def handle_encoding str\n str = str.dup\n has_enc = str.respond_to? :encoding # TODO: remove\n encoding = nil\n\n header = str.each_line.first(2)\n header.map! { |s| s.force_encoding \"ASCII-8BIT\" } if has_enc\n\n first = header.first || \"\"\n encoding, str = +\"utf-8\", str.b[3..-1] if first =~ /\\A\\xEF\\xBB\\xBF/\n\n encoding = $1.strip if header.find { |s|\n s[/^#.*?-\\*-.*?coding:\\s*([^ ;]+).*?-\\*-/, 1] ||\n s[/^#.*(?:en)?coding(?:\\s*[:=])\\s*([\\w-]+)/, 1]\n }\n\n if encoding then\n if has_enc then\n encoding.sub!(/utf-8-.+$/, \"utf-8\") # HACK for stupid emacs formats\n hack_encoding str, encoding\n else\n warn \"Skipping magic encoding comment\"\n end\n else\n # nothing specified... ugh. try to encode as utf-8\n hack_encoding str if has_enc\n end\n\n str\n end", "def charset\n #@data.charset ||= CharGuess.guess(document).downcase\n end", "def info\n @encoding = find_enoding\n puts \"INFO:\"\n print 'File name '; print \"#{@file_name}\\n\".colorize(:green)\n print 'File headers '; print \"#{@file_headers}\\n\".colorize(:green)\n print 'File rows number '; print \"#{@data.size}\\n\".colorize(:green)\n print 'File encoding '; print \"#{@encoding}\\n\".colorize(:green)\n\n ## temp decision\n if @output_file_name\n print 'Output File '; print \"#{@output_file_name || 'nil'}\\n\".colorize(:green)\n end\n end", "def iconv() end", "def untitled_file_name()\n return \"ללא שם\"\n end", "def so_encoding(feature)\n if hash = @data[feature]\n if hash[\"encoding\"]\n return hash[\"encoding\"]\n end\n end\n end", "def encoding\n\t'ISO-8859-1'\nend", "def content_encoding\n v = @meta['content-encoding']\n if v && %r{\\A#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?(?:,#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?)*}o =~ v\n v.scan(RE_TOKEN).map {|content_coding| content_coding.downcase}\n else\n []\n end\n end", "def guess_encoding(guesser = CharDet)\n Encoding.find(guesser.detect(self, :silent => true)[\"encoding\"])\n end", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def readfile(path, opt={})\n if File.readable?(path)\n bin = File.read(path).utf8!\n [bin, bin.former_enc ||'ascii-8bit' ]\n else\n raise ArgumentError.new(\"File is not readable!\")\n end\n end", "def decode_file\n # Open 'encoded' to read from\n File.open(\"encoded_#{original_datei}\",'r') { |fr|\n # Open 'decoded' to write to\n File.open(\"decoded_#{original_datei}\",'w') { |fw|\n fr.each_byte { |byte|\n # \"decode\" each byte and write to 'decoded'\n fw << encode(byte, -schluessel).chr\n }\n }\n }\n\n end", "def determine_encodings!(safe_path)\n # delimiter encoding => # FasterCSV encoding string\n supported_encodings = {\n 'UTF-8' => 'bom|utf-8',\n 'Windows-1252' => 'windows-1252:utf-8'\n }\n\n successful_options = nil\n supported_encodings.each do |delimiter_encoding, csv_encoding|\n begin\n col_sep = @options['col_sep']\n options = {\n :col_sep => (col_sep || ',').force_encoding(delimiter_encoding),\n :encoding => csv_encoding\n }\n\n row_num = 0\n # Iterate through the file; if we reach the end, this encoding worked:\n CSVLibrary.foreach(safe_path, options) { |_line| row_num += 1 }\n rescue ArgumentError => e\n next if e.message =~ /invalid byte sequence/ # This encoding didn't work\n raise(e)\n rescue CSVLibrary::MalformedCSVError => e\n description = (col_sep ? col_sep.inspect + ' delimited' : 'CSV')\n\n raise(CSVLibrary::MalformedCSVError, \"Invalid #{description} format \" \\\n \"on row #{row_num + 1} of #{::File.basename(safe_path)}. Original: #{e.message}\")\n end\n\n # We got this far => encoding choice worked:\n successful_options = options\n break\n end\n\n # We tried them all, and none worked:\n unless successful_options\n fail \"None of the encodings #{supported_encodings.values.inspect} were successful!\"\n end\n\n successful_options\n end", "def default_encoding=(_arg0); end", "def meta_encoding=(encoding); end", "def meta_encoding=(encoding); end", "def convert_encoding(content); end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @external_encoding\n end", "def default_encoding\n Encoding::UTF_8\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encode_file\n # open 'orginal' to read from\n # fr = File.open(\"#{original_datei}\", 'r') dann muss die Datei explizit geschlossen werden\n File.open(\"#{original_datei}\", 'r') {|fr|\n # create 'encoded' to write to\n File.open(\"encoded_#{original_datei}\",'w') { |fw|\n # encode each letter and then write to 'encoded'\n fr.each_byte{|byte|\n fw << encode(byte).chr\n }\n }\n }\n end", "def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n if @encoding.blank?\n if !self.http_headers.blank?\n if self.http_headers['content-type'] =~ /charset=([\\w\\d-]+)/\n @encoding = $1.downcase\n else\n @encoding = self.encoding_from_feed_data\n end \n else\n @encoding = self.encoding_from_feed_data\n end\n end\n return @encoding\n end", "def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end", "def encoding\n if @connection.respond_to?(:encoding)\n @connection.encoding.to_s\n else\n @connection.execute('PRAGMA encoding')[0]['encoding']\n end\n end", "def external_encoding\n Encoding.default_external\n end", "def external_encoding; @_external_encoding || _external_encoding; end", "def isutf8;\tKconv.isutf8(self) end", "def force_default_encoding; end", "def guess_mime_encoding\n # Grab the first line and have a guess?\n # A multiple of 4 and no characters that aren't in base64 ?\n # Need to allow for = at end of base64 string\n squashed = self.tr(\"\\r\\n\\s\", '').strip.sub(/=*\\Z/, '')\n if squashed.length.remainder(4) == 0 && squashed.count(\"^A-Za-z0-9+/\") == 0\n :base64\n else\n :quoted_printable\n end\n # or should we just try both and see what works?\n end", "def charset\n # locale parameter is ignored now.\n system.charset\n end", "def get_charset(locale)\n loc = LocaleTable.find{|v| v[1] == locale.to_win}\n loc = LocaleTable.find{|v| v[1] =~ /^#{locale.language}-/} unless loc\n loc ? loc[2] : \"CP1252\"\n end", "def utf8read(x)\n File.open(x,\"rb\"){|f|\n if f.getbyte!=0xef || f.getbyte!=0xbb || f.getbyte!=0xbf\n f.pos=0 # skip UTF-8 byte order mark\n end\n data=f.read\n ec1=Encoding::Converter.new(\"utf-8\",\"utf-16\",{\n :undef=>:replace,\n :invalid=>:replace\n })\n ec2=Encoding::Converter.new(\"utf-16\",\"utf-8\",{\n :undef=>:replace,\n :invalid=>:replace,\n :replace=>\"\\uFFFD\"\n })\n data=ec1.convert(data)\n data=ec2.convert(data)\n return data\n }\nend", "def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def charset\n 'UTF8'\n end" ]
[ "0.8069067", "0.769913", "0.769913", "0.7376027", "0.72158855", "0.72158855", "0.70100343", "0.6678872", "0.6678872", "0.66581994", "0.66434723", "0.6579416", "0.65448093", "0.65448093", "0.6530589", "0.6450764", "0.64201695", "0.63622296", "0.6355989", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6354602", "0.6318553", "0.62649804", "0.62649804", "0.62325084", "0.62325084", "0.62325084", "0.6195084", "0.61778635", "0.6170443", "0.6160444", "0.61548835", "0.6096637", "0.60868835", "0.6078473", "0.6062205", "0.6061106", "0.60544336", "0.60470855", "0.60389465", "0.60381603", "0.6032032", "0.6010485", "0.59650195", "0.595437", "0.595437", "0.5912968", "0.59116715", "0.58985823", "0.5895589", "0.5893873", "0.5893873", "0.58828014", "0.58794516", "0.58794516", "0.58794516", "0.58794516", "0.58794516", "0.58664274", "0.5855476", "0.5852784", "0.5852784", "0.5852784", "0.5829524", "0.58283", "0.5826443", "0.5826443", "0.5825413", "0.58239305", "0.5821375", "0.5801802", "0.5790218", "0.5783194", "0.5778257", "0.57747597", "0.57598567", "0.5748239", "0.5743599", "0.5728282", "0.57275337", "0.57275337", "0.57275337", "0.57275337", "0.57275337", "0.5727002", "0.5727002", "0.5715478" ]
0.697007
7
read data from file
def process_reading begin open_and_read_file @read_flag = true puts 'Success. Check instance fields'.colorize(:green) rescue StandardError => e puts e.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_file(path); end", "def read file\n File.open file\n end", "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end", "def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend", "def read\n file.read\n end", "def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end", "def data\n File.read(path)\n end", "def read\n file\n end", "def read_file(filename); end", "def read_file(filename)\n file = File.open(filename, 'r')\n data = file.read\n file.close\n data\nend", "def get_data(file)\n f = File.open(file, 'rb')\n buffer = f.read\n f.close\n\n buffer\n end", "def load_file_data(file)\n @data = separate_into_blocks(IO.readlines(file))\n end", "def read\n return nil if FileTest.exist?(@fname)==false\n\n open(@fname,\"rb\") do |file| #Read & Binary mode\n @data = Marshal.load(file)\n end\n @data\n end", "def read_save_data(file)\r\n read_characters(file)\r\n read_frame(file)\r\n read_data(file)\r\n read_edit\r\n read_refresh\r\n end", "def readFile()\n\t#This is assuming the file name will be used\n\tfilename = 'names-data.txt'\n\topen(filename, 'r') {|f| f.read}\nend", "def read_file(file_name)\n file = File.open(file_name, \"r\")\n data = file.read\n file.close\n return data\nend", "def read_file(file)\n File.read(file)\n end", "def read_file(file)\n File.read(file)\n end", "def read_file(file, context); end", "def read\n x = nil\n File.open(@filename, 'r') {|f| x = f.readlines }\n x.each do |line|\n\n line = self.class.remove_comments(line)\n\n if line.present?\n @data << self.class.extract_data_from_line(line)\n # puts self.class.extract_data_from_line(line).to_yaml\n end\n end\n end", "def read_text(filename); end", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend", "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n return data\nend", "def readData(filename)\n\t\t@dataArray = Array.new\n\t\tfile = File.open(filename)\n\t\t\n\t\tfile.each_line do |line|\n\t\t\tarray = line.split(/,/)\n\t\t\tentry = Struct::ContactEntry.new(array[0], array[1], array[2])\n\t\t\t@dataArray.push(entry)\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend", "def read filename\n # Open file, Read in and process data.\n file = File.open(filename)\n file.each do |line|\n # Comma seperated data.\n # E.g. 1,2,1 => x=1, y=2, output=1\n line = line.chomp\n if line.size > 0\n # If the line is not empty, then it has data\n line = line.split \",\"\n @x << line[0].to_i\n @y << line[1].to_i\n @output << line[2].to_i\n end\n end\n end", "def data; file_log.read(file_node); end", "def read(path); end", "def read\n @fileobj = File.open(@fname,\"r\")\n parse_header_line(@fileobj.readline) unless @fileobj.eof?\n\n while (!@fileobj.eof?)\n yield(parse_data_line(@fileobj.readline))\n end\n end", "def read_file(path)\n File.read(path)\n end", "def read(path)\n @file_data = Nokogiri.parse(open(path).read)\n self\n end", "def read_data_from_file(filename=nil)\n filename = default_data_filename if filename.nil?\n @raw_data = File.read(filename)\n end", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend", "def read\n @read ||= File.read(path)\n end", "def read_file(file, context)\n File.read(file)\n end", "def read_binary(file); end", "def read_data\n unpacker.read\n end", "def read_file\n\t\tif @filename == \"\"\n\t\t\t@text = [\"\"]\n\t\t\treturn\n\t\telse\n\t\t\tif File.exists? @filename\n\t\t\t\ttext = IO.read(@filename)\n\t\t\telse\n\t\t\t\t@text = [\"\"]\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# get rid of crlf\n\t\ttemp = text.gsub!(/\\r\\n/,\"\\n\")\n\t\tif temp == nil\n\t\t\t@eol = \"\\n\"\n\t\telse\n\t\t\t@eol = \"\\r\\n\"\n\t\tend\n\t\ttext.gsub!(/\\r/,\"\\n\")\n\t\t@text = text.split(\"\\n\",-1)\n\tend", "def load_data\n @data ||= CSV.read(@file)\n end", "def read(files); end", "def read(files); end", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def get_file(filename)\n file = File.open(filename, \"r\")\n file.each_line do |line|\n line = line.delete \"\\n\"\n @data.push(line)\n end\n file.close\n @data\n end", "def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend", "def read_file(file)\n File.read(file)\nend", "def read_contents\n\n #puts \"pofr file #{@file_blob.filename}\"\n\n file_lines=[]\n @file_blob.open do |file|\n File.open(file){|x| file_lines = x.readlines}\n puts file_lines[0]\n puts file_lines.last\n end\n\n if @file_blob.filename.extension == \"out\" # GNOM\n getDataLinesFromGnom(file_lines)\n elsif @file_blob.filename.extension == \"dat\" # scatter\n puts \"reading file @file #{@file_blob.filename}\"\n getDataLinesFromScatter(file_lines)\n end\n\n @dmax = @r_values.last\n @pr_values.each do |y|\n @pr_max = (y[1] > @pr_max) ? y[1] : @pr_max\n @pr_min = (y[1] < @pr_min) ? y[1] : @pr_min\n end\n\n end", "def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end", "def read_file filename\n\t\tbegin\t \n\t\t\tfile = File.new(filename, \"r\")\n\t\t\tline_number = 1\n\t\t file.each do |line|\t\t \t\n\t\t \tself.read_input_line line, line_number\n\t\t \tline_number += 1\n\t\t end\t \n\t\trescue => err\n\t\t puts \"File not loaded: #{err}\"\n\t\t err\n\t\tensure file.close if file end\n\tend", "def read_file\n \t@readin = []\n file = File.open(@filename[@file_count], 'r')\n\t @readin = file.each.to_a\n\t # chop off the escaped characters (in this case: \\r\\n)\n @readin.map! {|s| s.chomp}\n # increment the file count\n @file_count += 1\n file.close\n # determine which file was read in\n # the files either have a \"W\" (for power) or \"Wh\" as the first line\n \tif @readin[0] =~ /Wh/\n \t\tparse_energy\n \telse @readin[0] =~ /W/\n \t\tparse_power\n \tend\n end", "def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end", "def read() end", "def read_file\n if @file_lines.empty?\n @file = File.open(@population_file)\n @file_lines = @file.readlines()\n end\n end", "def read_file(path)\n file_contents = []\n File.open(path).each { |line| file_contents << line }\n\n file_contents\n end", "def read_contents\n\t\treturn File.open(self.file_name).read.lines.map(&:chomp) if self.file_name\n\tend", "def data name\n File.read data_path(name)\nend", "def read_input_file\n\t\tbegin \n\t\t\tfile = File.read('data.json')\n\t\t\tjson_info = JSON.parse(file)\n\t\t\t\n\t\t\t#getting cars and rentals information\n\t\t\t@cars = json_info[\"cars\"]\n\t\t\t@rentals = json_info[\"rentals\"]\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to read the input file!\" \n\t\t\tputs e.message\n\t\tend\n\tend", "def load_file_contents(filename)\n File.open(filename).readlines\n end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read_data(filename)\n count = 0\n fd = File.open(filename)\n while not fd.eof?\n line = fd.readline\n line.chomp!\n count += 1\n fields = []\n line.split('^').each do |f|\n datum = f.gsub('~~','').gsub(/^~/,'').gsub(/~$/,'')\n fields.push(datum.empty? ? nil : datum)\n end\n yield fields\n end\nrescue => e\n STDERR.puts \"error '#{e}' file '#{filename}' line #{count}\"\n exit\nensure\n fd.close\nend", "def load_file_contents(file)\n File.open(file, 'r').read\n end", "def readFile(filename)\n info = \"\"\n file = File.open(filename)\n file.each do |line|\n info = info + line\n end\n file.close\n $myinfo = info\n end", "def _read filename\n d = []\n File.open(filename).each { |line|\n d << line\n }\n return d\n end", "def read(nombre_archivo)\n\tif File.file?(nombre_archivo)\n\t\tf = File.open(\"#{nombre_archivo}\").each_line do |line|\n \tp line\n \tend\t\n\tend\nend", "def read_test_file(file)\n read_file(file)\n end", "def read_file(path)\n struct=Struct.new(:u_id, :m_id,:rating,:time)\n puts path\n return [] if !File.exists? path\n File.open(path, \"r\") do |f|\n #splits each line by ws and convert to integer and build structures from values\n return f.each_line.map { |line| struct.new(*line.split.map {|x| x.to_i}) }\n end\n end", "def read\n $t1 = Time.now # Init procedure timestamp\n person = []\n IO.foreach(\"data_500.txt\") do |line| # Get all patients from file iterate each line\n line.chomp! # Remove trailing whitespace.\n person.push(line.split(\":\")) # Saving data split :\n end\n group(person) # Get blood type\n end", "def data\n return @data unless @data.nil?\n\n if File.exists?(@path)\n @data = File.read(@path)\n else\n raise FileNotFound.new(@path)\n end\n end", "def load_sample_data\n\tbegin # try to load the file\n\t\t# open the file and create an array to hold it\n\t\tsample_data_file = File.open($sample_data_filename)\n\t\tsample_contents = Array.new{Array.new}\n\t\ti = 0\n\t\t# add the contents of the file to the two-dimensional array\n\t\tsample_data_file.each do |line|\n\t\t\tsample_contents[i] = line.split(\",\").map(&:strip)\n\t\t\ti += 1\n\t\tend\n\t\treturn sample_contents\n\trescue # catch exceptions\n\t\tabort \"Unable to continue - sample data file #{$sample_data_filename} not found.\"\n\tend\nend", "def parse_file\n @filecontent ||= File.read(@filepath)\n end", "def read_file(absolute_path); end", "def read_in\n File.foreach(file_name).map(&:chomp)\n end", "def read_file\n # returns CSV StringIO data\n # e.g. Paperclip.io_adapters.for(file).read\n fail \"read_file method is required by #{self.class.name}\"\n end", "def read(file)\n begin\n if file.class == String\n f = File::open(file)\n else\n f = file\n end\n f.each_line do |line|\n input(line.strip)\n end\n ensure\n f.close\n end\n end", "def load_file(f)\n\t\tdata = []\n f.each do |line| \n user_id, movie_id, rating, timestamp = line.split(\"\\t\")\n data.push({\"user_id\"=> user_id.to_i, \"movie_id\"=>movie_id.to_i,\"rating\"=> rating.to_i,\"timestamp\"=>timestamp.to_i})\n\t\tend\n\t\treturn data\n\tend", "def read\n @input_files.each do |file|\n if File.exist? file\n input_data[file] = File.read(file)\n end\n end\n nil\n end", "def read\n data = File.open(@filename, mode(\"r\")) do |f|\n f.flock File::LOCK_SH\n f.read\n end\n import(data)\n end", "def read_task_file\n File.read(file_path)\n end", "def readFile(fname)\n\tinf = File.new(fname, \"r\")\n\tret = inf.read()\n\tinf.close\n\treturn ret\nend", "def read(file)\n if @options[:input_file]\n file = File.join(File.dirname(@options[:input_file]), file)\n end\n File.read(file)\n end", "def read\n IO.read(full_path)\n end", "def read_file(file)\n\tbegin\n\t\tinput_file = File.open(file)\n\trescue\n\t\traise \"Can't find file with that name\"\n\tend\n\n\tfile_type = File.extname(input_file)\n\n\tif file_type == \".bmp\"\n\t\tdata_array\t= input_file.read.unpack(\"C*\")\n\t\ttotal_size\t= input_file.size\n\t\tdata_offset\t= get_data_offset(data_array.slice(10..13))#Not pretty, but these 4 bytes are the data offset.\n\t\tdata_size\t= input_file.size - data_offset\n\telse\n\t\traise \"Couldn't recognize file type. Must be a .bmp file.\"\n\tend\n\n\tinput_file.close#Or sherri will kill me telepathically\n\n\tworking_file = User_File.new(\ttotal_size,\n\t\t\t\t\t\t\t\t\tdata_size,\n\t\t\t\t\t\t\t\t\tfile_type,\n\t\t\t\t\t\t\t\t\tdata_offset,\n\t\t\t\t\t\t\t\t\tdata_array)\nend", "def open_file (file)\r\n \r\n data = Array.new\r\n input = File.new(file, \"r\")\r\n input.gets\r\n while line = input.gets # gets each line of the file\r\n line.chomp! # deletes \\n\r\n data << line\r\n end\r\n input.close\r\n \r\n return data\r\n \r\nend", "def _get_file_contents(file)\n raise InvalidPath, \"connection file doesn't exist\" unless File.file?(file)\n _parse File.read(file)\n end", "def read_file(file, context)\n File.read(file, file_read_opts(context))\n end", "def read_file(file_name)\n begin\n content = File.open(file_name).read\n return content\n rescue\n raise\n end\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def read(filename)\n buffer = File.read filename if File.exist? filename\n end", "def load_data(file)\n return [] unless File.exist?(file)\n @crypto.decrypt(File.open(file, 'rb').read, password: @passphrase).to_s.each_line.to_a\n rescue GPGME::Error::NoData\n []\n end", "def read\n \n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def read_data_to(dir, data); end", "def read(file)\n filepath = File.join(File.dirname(__dir__), file)\n file = File.read(filepath)\n Success(file)\n rescue\n Failure(\"Failed to parse file\")\n end", "def working_read(filename)\n data = @file_opener.open(filename, \"r\") {|f| f.read }\n data = @filters[\"encode\"].call(filename, data) if @filters[\"encode\"]\n data\n end" ]
[ "0.80181766", "0.7729118", "0.7604488", "0.75958073", "0.7583198", "0.74269825", "0.735359", "0.73248494", "0.7311742", "0.722713", "0.72068393", "0.7166236", "0.7149558", "0.7088047", "0.70837516", "0.7029586", "0.6998808", "0.6998808", "0.69640386", "0.69637156", "0.6962746", "0.69533885", "0.6918183", "0.6917797", "0.6912957", "0.6878934", "0.687248", "0.6863545", "0.67929447", "0.67845297", "0.67744565", "0.6752319", "0.67520964", "0.6737205", "0.6734767", "0.6722963", "0.6721256", "0.6707609", "0.6705648", "0.66909295", "0.6615715", "0.6615715", "0.65901923", "0.6588833", "0.65834016", "0.65803146", "0.65724224", "0.65708923", "0.656992", "0.65668106", "0.65489143", "0.6535632", "0.6535524", "0.6523553", "0.65190893", "0.65114564", "0.6505999", "0.64959097", "0.6489098", "0.64887774", "0.64887774", "0.64887774", "0.64887774", "0.64887774", "0.64887774", "0.64887774", "0.64830464", "0.64730465", "0.64636457", "0.6449554", "0.64487445", "0.6447095", "0.64315534", "0.64159936", "0.64088106", "0.64022386", "0.6390875", "0.63884974", "0.6383436", "0.6382423", "0.63679904", "0.63632256", "0.6362138", "0.6355787", "0.63554823", "0.63505006", "0.63475794", "0.63440734", "0.634043", "0.6331352", "0.6326768", "0.63081396", "0.6295288", "0.62823784", "0.62823784", "0.62812454", "0.62730706", "0.6270983", "0.6270942", "0.6266946", "0.6259487" ]
0.0
-1
write data into file (upstream in write method)
def process_writing(data_to_write, headers, encoding) begin open_and_write_data(data_to_write, headers, encoding) @write_flag = true puts 'Success. Check file with new data' rescue StandardError => e puts e.message rescue CSV::MalformedCSVError => e2 puts e2.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def write(data)\n end", "def write(data)\n # black hole, because we don't actually care about what gets written\n end", "def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end", "def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end", "def write\n write_data\n end", "def write(data)\n @handle.writeData(data)\n end", "def write_file(file, data)\n File.open(file, 'w') { |fd| fd.write(data) }\n end", "def write\n file = ::File.open(@file, 'w')\n file.write(Bencode.encode(@data))\n file.close\n end", "def write(*data); end", "def write(data, *args, **kwd); end", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write_data(filename, data)\n file = File.open(filename, \"w\")\n file.puts(data)\n file.close\nend", "def write; end", "def write; end", "def write(data)\n @data << data\n end", "def write_data(filename, data)\n\tFile.open(filename, 'w').puts(data)\nend", "def write\n end", "def write(data)\n outfile.write(data)\n outfile.close unless outfile.tty?\n end", "def file_write(file2wrt, data2wrt)\n if not ::File.exists?(file2wrt)\n ::FileUtils.touch(file2wrt)\n end\n\n output = ::File.open(file2wrt, 'a')\n data2wrt.each_line do |d|\n output.puts(d)\n end\n output.close\n end", "def write(path, data)\n\t\t@connection.write(path, data)\n\tend", "def write(data)\n begin\n File.open(@filename, \"wb\") { |file| file.puts data.to_csv }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end", "def file(data, path)\n File.open(path, 'w') { |f| f << data }\n end", "def save!; File.write @path, @data end", "def write_file(filename, data)\n f = File.open(filename, 'w')\n f.write(data)\n f.close\nend", "def write()\n f = File.open(\"#{@directory}/#{@filename}\", \"w\")\n f.write(@raw)\n f.close()\n end", "def write(data)\n File.open('text.txt') do |f2|\n f2.puts data\n end\nend", "def write_file(filename,data_write)\n begin\n data = data_write\n aFile = File.new(filename, \"w+\") \n if aFile\n aFile.syswrite(data)\n else\n raise \"Unable to open file!\"\n end \n rescue Exception => e\n puts e.message\n end \n end", "def write(data)\n begin\n File.open(@filename, \"w\") { |file| file.puts data.to_html }\n rescue \n puts \"Error: \" + $!.to_s\n end \n end", "def write_to_file(f)\n return f.write(self.buffer)\n end", "def write(passed_data = nil)\n\t\t\tthis_data = passed_data || data\n\t\t\tFile.open(file_path+'/'+file_name, 'wb') do |file|\n\t\t\t\tfile.write( this_data.to_json )\n\t\t\tend\n\t\tend", "def writeFile(fname, data)\n\tinf = File.new(fname, \"w+\")\n\tret = inf.write(data)\n\tinf.close\n\treturn ret\nend", "def write(dest); end", "def write(dest); end", "def write(dest); end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def write_file(dir, file, data)\n File.open(\"#{dir}/#{file}.data\", \"w\") do |file|\n file.write(data.to_a.join(\"\\n\"))\n end\nend", "def write_to_file(data)\n\t\t\tref = File.join(@root, \"tarrifs_\" + @page[:name])\n\n\t\t\tif File.exists?(ref)\n\t\t\t\tdiff = \"\"\n\t\t\t\tstatus = Open4::popen4(\"diff #{ref} -\") do |pid, stdin, stdout, stderr|\n\t\t\t\t\tstdin.puts data\n\t\t\t\t\tstdin.close\n\t\t\t\t\tdiff = stdout.read\n\t\t\t\tend\n\t\t\t\t#sent mail if content is different\n\t\t\t\tif status != 0\n\t\t\t\t\twrite \"change detected.\"\n\t\t\t\t\tnotify_changed_site(url, diff)\n\t\t\t\tend\n\t\t\tend\n\t\t\tFile.open(ref, \"w\") do |f|\n\t\t\t\tf.puts data\n\t\t\tend\n\t\tend", "def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend", "def write(buf); end", "def write_file(name, data, commit = {})\n write(merge_path_elements(nil, name, nil), data, commit)\n end", "def write_to_file(file_name, data)\n key_path = ::File.dirname(file_name)\n ::FileUtils.mkdir_p(key_path) unless ::File.directory?(key_path)\n ::File.rename(file_name, \"#{file_name}.#{Time.now.to_i}\") if ::File.exist?(file_name)\n ::File.open(file_name, \"wb\", 0o600) { |file| file.write(data) }\n end", "def write_line(data); end", "def write(file)\n self.files.each { |l| file.puts l }\n end", "def write_file(file_name, data, write_type = 'w')\n write_file_base(append_root_path(file_name), data, write_type)\n end", "def write\n File.open(@file, 'a') do |w| \n w.write(\"\\n\"+ @name + \" \" + @path)\n end\n end", "def close_write() end", "def close_write() end", "def close_write() end", "def write\n\n # output to disk\n File.open(@outfile, 'w:UTF-8') { |file|\n file.write(@buffer)\n }\n end", "def write( path, data )\n FileUtils.mkdir_p( File.dirname( path ) )\n File.open( path, 'w' ) do |f|\n f.write( data )\n end\n \n data.length\n end", "def write_data_at_offset(offset, data)\n\t\t@file.seek(offset.to_i, IO::SEEK_END)\n\t\t@file << data\n\tend", "def write(filename)\n File.open(filename, \"wb\") { |f| f.write(@raw_data) }\n end", "def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end", "def write(data=nil, &block)\n mkdir_p dir\n open(fullpath, 'w') do |io|\n io.write data if data\n yield io if block_given?\n end\n end", "def write(file=nil)\n file = file.nil? ? @file : file\n File.open(file, 'w+') {|f|\n @lines.each{|line|\n f.write(\"#{line}\\r\\n\")\n }\n }\n end", "def write data\n assert !@closed\n\n # We store the text as a list so appending will be cheap.\n @text << data\n unless @silent\n $stdout.print data \n $stdout.flush\n end\n if @report_file\n @report_file.print data\n @report_file.flush\n end\n end", "def write(file)\n # write the length & header; always write length (int2) as network\n # order (as per GDSII spec)\n file.write [self.byte_size].pack('n')\n file.write [self.type].pack('c')\n file.write [self.data.type].pack('c')\n\n # now write the data...\n @data.write(file)\n end", "def write(s)\n @file.write(s)\n end", "def write file, text\n File.open file, \"w\" do |file|\n file.write text\n end\n end", "def write(data, offset = 0)\n # Track our offset into the remote file\n fptr = offset\n\n # Duplicate the data so we can use slice!\n data = data.dup\n\n # Take our first chunk of bytes\n chunk = data.slice!(0, self.chunk_size)\n\n # Keep writing data until we run out\n while (chunk.length > 0)\n ok = self.client.write(self.file_id, fptr, chunk)\n cl = ok['Payload'].v['CountLow']\n\n # Partial write, push the failed data back into the queue\n if (cl != chunk.length)\n data = chunk.slice(cl - 1, chunk.length - cl) + data\n end\n\n # Increment our painter and grab the next chunk\n fptr += cl\n chunk = data.slice!(0, self.chunk_size)\n end\n end", "def write_save_data(file)\r\n write_characters(file)\r\n write_frame(file)\r\n write_setup(file)\r\n write_data(file)\r\n end", "def write(val)\n @file.seek(@address)\n @file.putc(val)\n @file.flush\n end", "def close_write; end", "def write_file(data, name)\n raise WebthumbException.new('No data given') if data == nil || data.size == 0\n File.open(name, 'wb+') do |file|\n file.write(data)\n file.close\n file\n end\n end", "def write(path)\n # TODO: should start locking write process\n Writer.new(self, path).write\n end", "def open_data_for_write\n @data_file = CSV.open(data_file_full_path,\"w+\", @data_lib.csv_opt)\n @data_stream = @data_file\n end", "def write(file)\n @file_written = file\n file = Pathname.new(file)\n file.dirname.mkpath\n file.open \"w+\" do |output|\n output << self.build!\n end\n self\n end", "def write_file_after_save(file_data_to_write=nil)\n # check if there are data to write\n return unless(@file_data_to_write)\n \n begin\n self.class.benchmark(\"\\033[36m\\033[1m\\033[4mFileStore\\033[0m Saving file for #{self.id}\") do\n # create data directory path\n FileUtils.mkdir_p(data_directory)\n \n if(@file_data_to_write.is_a?(DataPath))\n copy_data_file\n else\n save_cached_data\n end\n \n @file_data_to_write = nil\n end\n rescue Exception => e\n assit_fail(\"Exception on writing file #{self.location}: #{e}\")\n end\n\n end", "def write_file(path)\n File.open(path, 'w') {|f| write_io(f)}\n end", "def write_line data\n _data[:out].puts data\n _data[:out].flush\n end", "def write_file\n\n # file_edited is false when there was no match in the whole file and thus no contents have changed.\n if file_edited\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, :preserve => true)\n File.open(original_pathname, \"w\") do |newfile|\n contents.each do |line|\n newfile.puts(line)\n end\n newfile.flush\n end\n end\n self.file_edited = false\n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end", "def write2(file = 'default', data, mode, size)\n dump_object(file)\n dump_object(data)\n dump_object(mode)\n dump_object(size)\n puts \"===========================\"\nend", "def write(data)\n @output_row << data\n end", "def write(data_to_write:, headers: [], encoding: DefaultConstants::ENCODING)\n data_prepared, headers_prepared = prepare_data_for_writing(data_to_write, headers)\n begin\n process_writing(data_prepared, headers_prepared, encoding)\n puts \"Writed in #{@output}\".colorize(:cyan)\n rescue StandardError => e2\n e2.message\n end\n end", "def write(file,content,timestamp=nil)\n\n f = File.join(path(:destination),file)\n log(\"writing '#{f}'\")\n\n # write the file \n File.open(f, 'w') {|f| f.write(content) }\n\n # Time-stamp the file if required\n File.utime(Time.now,timestamp,f) unless timestamp.nil?\n\n end", "def write_file(dir, name, data)\n path = File.join(dir, name)\n File.open(path, 'w') do |f|\n f.write(data)\n end\n path\n end", "def save(filename, data)\n\tf = File.open(filename, 'w')\n\tf.puts(data)\n\tf.close\nend", "def filewrt(file2wrt, data2wrt)\n\toutput = ::File.open(file2wrt, \"a\")\n\tdata2wrt.each_line do |d|\n\t\toutput.puts(d)\n\tend\n\toutput.close\nend", "def filewrt(file2wrt, data2wrt)\n\toutput = ::File.open(file2wrt, \"a\")\n\tdata2wrt.each_line do |d|\n\t\toutput.puts(d)\n\tend\n\toutput.close\nend", "def write_to(io, *options); end", "def close_write(*) end", "def write(data)\n @write_buffer << data\n post do\n begin\n @monitor&.interests = :rw\n rescue EOFError => e\n # Monitor is closed\n logger.error \"Error when writing: #{e.message}\"\n end\n end\n end", "def send_data(data)\n logdebug \"send_data:\", :data => data\n attempt_write(data)\n end", "def puts data\n\t\t@write_semaphore.synchronize do\n\t\t\t@write_data = data\n\t\t\t@write_cv.signal\n\t\tend\n\tend", "def save_to_file(data, destination)\n path = File.join(file_dir, destination)\n File.write(path, data)\nend", "def call_write(data, openclose = true)\n if options[:delta]\n wf.write_delta(data, openclose)\n else\n wf.write(data, openclose)\n end\n end", "def write\n File.open(path, 'w') { |file|\n file.write(FILE_HEADER + \"\\n\")\n file.write(encoded_body)\n }\n end", "def write_safe\n encrypted_data = Format.write(\n @data,\n password: @password,\n format: @options[:out],\n iterations: @options[:iterations],\n )\n File.open(@filename, 'wb'){ |f| f.write(encrypted_data) }\n update_abbrevs!\n end", "def write(message)\n f = open(@filename, 'a')\n f.puts(message)\n f.close()\n end", "def write_file(file_name)\n File.open(file_name, 'w') { |f| f.write header_build }\n File.write(file_name, @content, mode: 'a')\nend", "def put_file(path, data)\n raise NotImplemented\n end", "def open_for_write\n self.eof_flag = false\n open_data_for_write\n end" ]
[ "0.8352205", "0.8352205", "0.8352205", "0.8352205", "0.80332655", "0.802342", "0.7896684", "0.77450144", "0.771225", "0.7676903", "0.76766723", "0.76339376", "0.75983137", "0.75894976", "0.7513029", "0.7460712", "0.7460712", "0.7460712", "0.7413541", "0.7413541", "0.74087346", "0.7335696", "0.72697514", "0.72376215", "0.7194588", "0.7169174", "0.71477056", "0.7029359", "0.70223707", "0.7021934", "0.70039475", "0.6956847", "0.6953181", "0.6947837", "0.6924599", "0.69175553", "0.6915445", "0.69146484", "0.69146484", "0.69146484", "0.68913215", "0.68839484", "0.68748975", "0.68745446", "0.68663883", "0.68647003", "0.6848525", "0.6845684", "0.68239194", "0.6795247", "0.6794238", "0.6765885", "0.6765885", "0.6765885", "0.6748152", "0.672484", "0.6724797", "0.67223465", "0.67112523", "0.67007643", "0.66926026", "0.6690422", "0.66804487", "0.6614481", "0.6610096", "0.6589127", "0.65800375", "0.65774524", "0.65744597", "0.657341", "0.6541495", "0.6537431", "0.6536928", "0.6531689", "0.6522503", "0.65197176", "0.6491288", "0.648544", "0.648544", "0.6484568", "0.647311", "0.6469878", "0.6462147", "0.6439093", "0.6429768", "0.64267075", "0.64267075", "0.6412967", "0.6405285", "0.63968325", "0.63929886", "0.6392677", "0.6385157", "0.63806826", "0.637535", "0.6369987", "0.6348239", "0.63478243", "0.6346333", "0.6342362" ]
0.64700663
81
copy the structure of an attached table, along with any indexes
def copy_table_structure(rdb,tbl) template = "SELECT sql, type from X.sqlite_master WHERE tbl_name = ? ORDER BY type DESC" lsql = template.gsub('X',"main") rsql = template.gsub('X',quote_with_dots(rdb)) args = [quote_with_dots(tbl)] lschema = sqlite_execute(lsql,args) rschema = sqlite_execute(rsql,args) if lschema.length>0 return false end rschema.each{ |row| sqlite_execute(row[0],[]) } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_structure\n logger.info \"Copying structure for table #{name} from watched to audit database\"\n db.query(\"CREATE TABLE #{audit} LIKE #{watched}\")\n add_copied_at_field\n add_has_delta_field\n add_last_version_field\n add_has_violation_field\n add_deletion_flag\n end", "def copy_rows( field, \n table_struct, \n src_table_name = TABLE_NAME, \n dest_table_name = NEW_TABLE_NAME, \n num_rows = ROWS_PER_TRANSACTION)\n rows = grab_rows(field, src_table_name, num_rows)\n keys_for_delete = insert_rows(rows, field, table_struct, dest_table_name)\n keys_for_delete\nend", "def copy_to(db, args = {})\r\n data[\"tables\"].each do |table|\r\n table_args = nil\r\n table_args = args[\"tables\"][table[\"name\"].to_s] if args and args[\"tables\"] and args[\"tables\"][table[\"name\"].to_s]\r\n next if table_args and table_args[\"skip\"]\r\n table.delete(\"indexes\") if table.key?(\"indexes\") and args[\"skip_indexes\"]\r\n db.tables.create(table[\"name\"], table)\r\n \r\n limit_from = 0\r\n limit_incr = 1000\r\n \r\n loop do\r\n ins_arr = []\r\n q_rows = self.select(table[\"name\"], {}, {\"limit_from\" => limit_from, \"limit_to\" => limit_incr})\r\n while d_rows = q_rows.fetch\r\n col_args = nil\r\n \r\n if table_args and table_args[\"columns\"]\r\n d_rows.each do |col_name, col_data|\r\n col_args = table_args[\"columns\"][col_name.to_s] if table_args and table_args[\"columns\"]\r\n d_rows[col_name] = \"\" if col_args and col_args[\"empty\"]\r\n end\r\n end\r\n \r\n ins_arr << d_rows\r\n end\r\n \r\n break if ins_arr.empty?\r\n \r\n db.insert_multi(table[\"name\"], ins_arr)\r\n limit_from += limit_incr\r\n end\r\n end\r\n end", "def copy\n result = HashTablet.new(@table.size)\n each {|element| result.insert(element) }\n return result\n end", "def extract_table(table)\n puts \"Extracting from #{table['name']}\\n\"\n puts \">>> assoc: #{table['associations']}\"\n extract_associations(table['associations']) if table['associations']\n @outfile.puts create_table(table)\n columns = table_columns(table)\n ids = table_ids(table)\n query = table_query(table, columns, ids)\n results = db_client.query(query)\n results.each do |row|\n @outfile.puts make_insert(table, columns, results.fields, row)\n end\n end", "def rebuild(table); end", "def copy \n t = @tab.clone ;\n for i in 0..3\n t[i] = t[i].clone\n end\n Table.new(t) ;\n end", "def dump_table(io, table_obj)\n #Get SQL for creating table and add it to IO.\n sqls = @args[:db].tables.create(table_obj.name, table_obj.data, :return_sql => true)\n sqls.each do |sql|\n io.write(\"#{sql};\\n\")\n end\n \n \n #Try to find a primary column in the table.\n prim_col = nil\n table_obj.columns do |col|\n if col.primarykey?\n prim_col = col\n break\n end\n end\n \n \n #Set up rows and way to fill rows.\n rows = []\n block_data = proc do |row|\n rows << row\n @rows_count += 1\n \n if rows.length >= 1000\n self.update_status\n self.dump_insert_multi(io, table_obj, rows)\n end\n end\n \n \n #If a primary column is found then use IDQuery. Otherwise use cloned unbuffered query.\n args = {:idquery => prim_col.name.to_sym} if prim_col\n \n \n #Clone the connecting with array-results and execute query.\n @args[:db].clone_conn(:result => \"array\") do |db|\n db.select(table_obj.name, nil, args, &block_data)\n end\n \n \n #Dump the last rows if any.\n self.dump_insert_multi(io, table_obj, rows) if !rows.empty?\n end", "def copy_new_rows\n tables.each(&:copy_new_rows)\n end", "def initialize_copy(original)\n super\n @table = @table.dup\n end", "def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end", "def initialize_copy(orig)\n super\n @table = @table.dup\n end", "def copy_table(old_table_name, new_table_name)\n transaction do\n execute \"CREATE TABLE #{new_table_name} LIKE #{old_table_name}\"\n execute \"INSERT INTO #{new_table_name} SELECT * FROM #{old_table_name}\"\n end\n end", "def dump_table(io, table_obj)\n create_data = table_obj.data.clone\n create_data.delete(:name)\n create_data[:return_sql] = true\n\n # Get SQL for creating table and add it to IO.\n sqls = @export_db.tables.create(table_obj.name, **create_data)\n sqls.each do |sql|\n io.write(\"#{sql};\\n\")\n end\n\n\n # Try to find a primary column in the table.\n prim_col = nil\n table_obj.columns do |col|\n if col.primarykey?\n prim_col = col\n break\n end\n end\n\n\n debug \"Dumping data for table: #{table_obj.name}\"\n\n # Set up rows and way to fill rows.\n rows = []\n\n\n @db.select(table_obj.name, nil, unbuffered: true) do |row|\n rows << row\n @rows_count += 1\n\n if rows.length >= 1000\n update_status\n dump_insert_multi(io, table_obj, rows)\n end\n end\n\n\n # Dump the last rows if any.\n dump_insert_multi(io, table_obj, rows) unless rows.empty?\n end", "def import_table( table )\n # This must come first, so we can exclude foreign key indexes later.\n import_foreign_keys( table )\n import_indexes( table )\n import_columns( table )\n end", "def copy_embedded_tables\n self.embed_tables.each do |t|\n sql_connection.select_rows(t.sql_name) do |rows, page, total_pages|\n Mongify::Status.publish('copy_embedded', :size => rows.count, :name => \"Embedding #{t.name} (#{page}/#{total_pages})\", :action => 'add')\n rows.each do |row|\n target_row = no_sql_connection.find_one(t.embed_in, {:pre_mongified_id => get_type_casted_value(t, t.embed_on, row)})\n next unless target_row.present?\n row, parent_row, unset_keys = t.translate(row, target_row)\n parent_row ||= {}\n parent_row.delete(\"_id\")\n parent_row.delete(t.name.to_s)\n unset_keys ||= {}\n row.delete(t.embed_on)\n row.merge!(fetch_reference_ids(t, row))\n row.delete('pre_mongified_id')\n save_function_call = t.embedded_as_object? ? '$set' : '$addToSet'\n no_sql_connection.update(t.embed_in, target_row['_id'], append_parent_object({save_function_call => {t.name => row}}, parent_row, unset_keys))\n Mongify::Status.publish('copy_embedded')\n end\n Mongify::Status.publish('copy_embedded', :action => 'finish')\n end\n end\n end", "def initialize_copy(orig)\n super\n @__table__ = @__table__.dup\n end", "def prepare_table(element)\n name=element.attributes[\"name\"]\n oid=SNMPPass.oid2num(element.attributes[\"oid\"])\n\n # Read index and columns\n indexes=element.elements[\"row/linkage\"].elements.collect(\"index\") {|index| index.attributes[\"name\"]}\n columns=element.elements[\"row\"].elements.collect(\"column\") do\n |column|\n column_name=column.attributes[\"name\"]\n column_oid=column.attributes[\"oid\"]\n column_id=SNMPPass.oid2num(column_oid).last\n\n $DEBUG.puts \"TABLE: #{name} NAME: #{column_name} ID #{column_id}, OID: #{column_oid}\"\n\n #column_desc=column.elements[\"description\"].text.gsub(/^[[:blank:]\\n]*/,\"\").gsub(/[[:blank:]\\n]*$/,\"\")\n type=prepare_type(column.elements[\"syntax\"], column_name)\n [column_name,column_id,type]\n end\n\n @indexes[name]=indexes\n @columns[name]=columns\n\n table=DynamicTree.new(oid){|op, *roid| dynamic_tree_callback(name, op, *roid) }\n add_node(table)\n end", "def copy_table(old_table_name, new_table_name)\r\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\r\n end", "def copy_table(old_table_name, new_table_name)\n execute add_select_into_table(new_table_name, \"SELECT * FROM #{old_table_name}\")\n end", "def unlocked_copy\n copy_ = Structure.new\n @indexes.each{ |ai_| copy_.add(ai_.axis_object, ai_.axis_name) }\n copy_\n end", "def pack\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n lines_deleted = @db.engine.pack_table(self)\r\n\r\n update_header_vars\r\n\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n create_indexes\r\n create_table_class unless @db.server?\r\n\r\n return lines_deleted\r\n end", "def marshal_dump\n @table\n end", "def dump(table) # :nodoc:\n Marshal::dump(table)\n end", "def copy_table_contents(from, to, columns, rename = {})\n column_mappings = Hash[ columns.map { |name| [name, name] } ]\n rename.each { |a| column_mappings[a.last] = a.first }\n from_columns = columns(from).collect {|col| col.name}\n columns = columns.find_all{ |col| from_columns.include?(column_mappings[col]) }\n quoted_columns = columns.map { |col| quote_column_name(col) } * ','\n\n quoted_to = quote_table_name(to)\n\n raw_column_mappings = Hash[ columns(from).map { |c| [c.name, c] } ]\n\n execute(\"SELECT * FROM #{quote_table_name(from)}\", 'Copy Table').each do |row|\n sql = \"INSERT INTO #{quoted_to} (#{quoted_columns}) VALUES (\"\n\n column_values = columns.map do |col|\n quote(row[column_mappings[col]], raw_column_mappings[col])\n end\n\n sql << column_values * ', '\n sql << ')'\n exec_insert sql, 'Copy Table', []\n end\n end", "def copy_table_data(from, to, remaps = [])\n old = columns(from).collect(&:name)\n current = columns(to).collect(&:name)\n remapped_columns = remaps.collect {|c| c.first.to_s}.compact\n common = (current & old).sort - remapped_columns\n from_columns = common.collect {|c| \"`#{c}`\"}\n to_columns = common.collect {|c| \"`#{c}`\"}\n remaps.each do |remap|\n remap = [remap].flatten\n next if remap.length != 2\n from_columns << remap.first\n to_columns << remap.last\n end\n from_columns_to_s = from_columns.join(', ')\n to_columns_to_s = to_columns.join(', ')\n execute \"INSERT INTO #{to}(#{to_columns_to_s}) SELECT #{from_columns_to_s} FROM #{from}\"\n end", "def copy_table_indexes(from, to, rename = {})\n indexes(from).each do |index|\n name = index.name.downcase\n if to == \"a#{from}\"\n name = \"t#{name}\"\n elsif from == \"a#{to}\"\n name = name[1..-1]\n end\n\n to_column_names = columns(to).map(&:name)\n columns = index.columns.map { |column| rename[column] || column }\n columns = columns.select { |column| to_column_names.include?(column) }\n\n unless columns.empty?\n # index name can't be the same\n opts = { :name => name.gsub(/(^|_)(#{from})_/, \"\\\\1#{to}_\"), :internal => true }\n opts[:unique] = true if index.unique\n add_index(to, columns, opts)\n end\n end\n end", "def to_h\n @table.dup\n end", "def copy\n old_schema = self\n new_schema = Schema.new\n for field in old_schema.fields\n new_schema.fields << field.copy\n end\n new_schema\n end", "def copy_polymorphic_tables\n self.polymorphic_tables.each do |t|\n polymorphic_id_col, polymorphic_type_col = \"#{t.polymorphic_as}_id\", \"#{t.polymorphic_as}_type\"\n sql_connection.select_rows(t.sql_name) do |rows, page, total_pages|\n Mongify::Status.publish('copy_polymorphic', :size => rows.count, :name => \"Polymorphicizing #{t.name}\", :action => 'add')\n rows.each do |row|\n\n #If no data is in the column, skip importing\n if (row[polymorphic_type_col])\n table_name = row[polymorphic_type_col].tableize\n new_id = no_sql_connection.get_id_using_pre_mongified_id(table_name, get_type_casted_value(t, polymorphic_id_col, row))\n end\n\n row = t.translate(row)\n row[polymorphic_id_col] = new_id if new_id\n row.merge!(fetch_reference_ids(t, row))\n row.delete('pre_mongified_id')\n\n if t.embedded? && table_name\n row.delete(polymorphic_id_col)\n row.delete(polymorphic_type_col)\n save_function_call = t.embedded_as_object? ? '$set' : '$addToSet'\n no_sql_connection.update(table_name, new_id, {save_function_call => {t.name => row}})\n else\n no_sql_connection.insert_into(t.name, row)\n end\n\n Mongify::Status.publish('copy_polymorphic')\n end\n Mongify::Status.publish('copy_polymorphic', :action => 'finish')\n end\n end\n end", "def load_physical_schema(conn, builder)\n builder.indexes{\n conn.tables.each{|table|\n conn.indexes(table).each_pair{|name, defn|\n next if defn[:unique]\n builder.index(name, {:relvar => table, :attributes => defn[:columns]})\n }\n }\n }\n end", "def copy(force = false)\n yield if block_given?\n\n @force_table_create = force\n tables_count = Rmre::Source::Db.connection.tables.length\n Rmre::Source::Db.connection.tables.sort.each_with_index do |table, idx|\n info \"Copying table #{table} (#{idx + 1}/#{tables_count})...\"\n copy_table(table)\n end\n end", "def copy\n create_obj(obj.amoeba_dup)\n build_enabled(obj)\n\n #add (copy) suffix to name/title, etc.\n obj.send(obj.class.columns_for_table[0] + '=', obj.send(obj.class.columns_for_table[0]) + I18n.t('backend.copy_suffix'))\n end", "def chrono_copy_indexes_to_history(table_name)\n history_indexes = on_history_schema { indexes(table_name) }.map(&:name)\n temporal_indexes = on_temporal_schema { indexes(table_name) }\n\n temporal_indexes.each do |index|\n next if history_indexes.include?(index.name)\n\n on_history_schema do\n # index.columns is an Array for plain indexes,\n # while it is a String for computed indexes.\n #\n columns = Array.wrap(index.columns).join(', ')\n\n execute %[\n CREATE INDEX #{index.name} ON #{table_name}\n USING #{index.using} ( #{columns} )\n ], 'Copy index from temporal to history'\n end\n end\n end", "def clone_table_schema(table_name, new_table_name, preserve_splits = true)\n @admin.cloneTableSchema(TableName.valueOf(table_name),\n TableName.valueOf(new_table_name),\n preserve_splits)\n end", "def table(table, stream)\n return if already_dumped?(table)\n\n new_stream = StringIO.new\n super(table, new_stream)\n string = new_stream.string\n\n if (parent_table = @connection.parent_table(table))\n table(parent_table, stream)\n string = inject_inherits_for_create_table(string, table, parent_table)\n string = remove_parent_table_columns(string, @connection.columns(parent_table))\n\n pindexes = Hash[@connection.indexes(parent_table).map { |index| [index.columns, index] }]\n cindexes = Hash[@connection.indexes(table).map { |index| [index.columns, index] }]\n\n string = remove_parent_table_indexes(string, (pindexes & cindexes).values)\n end\n\n # We've done this table\n dumped_tables << table\n\n stream.write string\n stream\n end", "def copy_into_sql(table, opts)\n sql = String.new\n sql << \"COPY #{literal(table)}\"\n if cols = opts[:columns]\n sql << literal(Array(cols))\n end\n sql << \" FROM STDIN\"\n if opts[:options] || opts[:format]\n sql << \" (\"\n sql << \"FORMAT #{opts[:format]}\" if opts[:format]\n sql << \"#{', ' if opts[:format]}#{opts[:options]}\" if opts[:options]\n sql << ')'\n end\n sql\n end", "def copy_into(table, opts=OPTS)\n data = opts[:data]\n data = Array(data) if data.is_a?(String)\n\n if block_given? && data\n raise Error, \"Cannot provide both a :data option and a block to copy_into\"\n elsif !block_given? && !data\n raise Error, \"Must provide either a :data option or a block to copy_into\"\n end\n\n synchronize(opts[:server]) do |conn|\n conn.execute(copy_into_sql(table, opts))\n begin\n if block_given?\n while buf = yield\n conn.put_copy_data(buf)\n end\n else\n data.each{|buff| conn.put_copy_data(buff)}\n end\n rescue Exception => e\n conn.put_copy_end(\"ruby exception occurred while copying data into PostgreSQL\")\n ensure\n conn.put_copy_end unless e\n while res = conn.get_result\n raise e if e\n check_database_errors{res.check}\n end\n end\n end \n end", "def move_table(from, to, options = {}, &block)\n copy_table(from, to, options, &block)\n drop_table(from)\n end", "def import_indexes( table )\n # Foreign keys also automatically create indexes, which we must exclude when importing.\n # But only if they look like indexes named by the automatic foreign key naming convention.\n foreign_key_indexes = table.foreign_keys.map{ |x| x.columns if x.columns.size == 1 }.compact\n for name, opts in db.indexes( table.name )\n opts = opts.dup\n opts[ :name ] = name\n columns = opts.delete( :columns )\n next if ( ! opts[ :unique ] ) && foreign_key_indexes.include?( columns ) && name == columns.first\n # Sequel currently doesn't provide info about fulltext indexes, so we have to rely on properly used names.\n opts[ :type ] = :full_text if name =~ /_fulltext$/\n opts.delete( :deferrable ) unless opts[ :deferrable ]\n table.add_index( columns, opts )\n end\n end", "def ir_add_source_structure!(ir)\n ir.keys.each do |k|\n if ir[k][:full_source_relation_name]\n ir[k][:source_structure] = ir[\n ir[k][:full_source_relation_name]\n ]\n end\n end\n end", "def dump( out = Dumper.new )\n out.dump \"table #{out_name}\" do\n for column in columns\n column.dump( out )\n end\n for index in indexes\n index.dump( out )\n end\n for foreign_key in foreign_keys\n foreign_key.dump( out )\n end\n end\n end", "def create_table_structure(columns_to_include)\n if @table_created\n @columns.each do |column|\n begin\n ActiveRecord::Schema.add_column(@new_table_name, column[:name], column[:type]) if (columns_to_include.blank? or columns_to_include.include? column[:name])\n rescue\n puts \"Couldnt add field #{column[:name].downcase}\"\n end\n end\n ActiveRecord::Schema.add_column(@new_table_name,\"the_geom\", :geometry,:null => false)\n ActiveRecord::Schema.add_index(@new_table_name,\"the_geom\",:spatial => true)\n end\n end", "def create_table_structure(columns_to_include)\n if @table_created\n @columns.each do |column|\n begin\n ActiveRecord::Schema.add_column(@new_table_name, column[:name], column[:type]) if (columns_to_include.blank? or columns_to_include.include? column[:name])\n rescue\n puts \"Couldnt add field #{column[:name].downcase}\"\n end\n end\n ActiveRecord::Schema.add_column(@new_table_name,\"the_geom\", :geometry,:null => false)\n ActiveRecord::Schema.add_index(@new_table_name,\"the_geom\",:spatial => true)\n end\n end", "def rebuild_table\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.ZMERGEABLEDATA1 \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" +\n \"WHERE ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER=?\",\n @uuid) do |row|\n\n # Extract the blob\n gzipped_data = row[\"ZMERGEABLEDATA1\"]\n zlib_inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n gunzipped_data = zlib_inflater.inflate(gzipped_data)\n\n # Read the protobuff\n mergabledata_proto = MergableDataProto.decode(gunzipped_data)\n\n # Build list of key items\n @key_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_key_item.each do |key_item|\n @key_items.push(key_item)\n end\n\n # Build list of type items\n @type_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_type_item.each do |type_item|\n @type_items.push(type_item)\n end\n\n # Build list of uuid items\n @uuid_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_uuid_item.each do |uuid_item|\n @uuid_items.push(uuid_item)\n end\n\n # Build Array of objects\n @table_objects = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n @table_objects.push(mergeable_data_object_entry)\n\n # Best way I've found to set the table direction\n if mergeable_data_object_entry.custom_map\n if mergeable_data_object_entry.custom_map.map_entry.first.key == @key_items.index(\"crTableColumnDirection\") + 1 #Oddly seems to correspond to 'self'\n @table_direction = mergeable_data_object_entry.custom_map.map_entry.first.value.string_value\n end\n end\n end\n\n # Find the first ICTable, which shuld be the root, and execute\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n if mergeable_data_object_entry.custom_map and @type_items[mergeable_data_object_entry.custom_map.type] == \"com.apple.notes.ICTable\"\n parse_table(mergeable_data_object_entry)\n end\n end\n end\n end", "def adapt_step_table(step_table_ast)\n adapted_step_table = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_step_table, step_table_ast)\n clear_child_elements(adapted_step_table, [[:rows]])\n\n adapted_step_table['rows'] = []\n step_table_ast.rows.each do |row|\n adapted_step_table['rows'] << adapt_table_row(row)\n end\n adapted_step_table['line'] = step_table_ast.location.line\n adapted_step_table['column'] = step_table_ast.location.column\n\n adapted_step_table\n end", "def tableConvert(tableName, table)\n dbTableH = Hash.new\n records = Array.new\n i = 0\n \n table.each do\n |row|\n records[i] = row\n i += 1\n end\n dbTableH[tableName] = records\n \n return dbTableH\nend", "def index\n @table1_copy1s = Table1Copy1.all\n end", "def create_ast\n tables = sqlite3_all_tables\n if !tables.empty?\n tables.each {|table|\n tb_schema = sqlite3_pragma(table[1])\n column_info = Hash.new\n tb_schema.each {|schema|\n # schema:\n # 0 := CID (int), 1 := table name (str), 2 := type (str),\n # 3 := null? (int, 1: Null. 0: Not-null)\n # 5 := PK? (int, 1: PK. 0: Not-PK)\n column_info[schema[1]] = {:type => schema[2], :null? => schema[3], :pk? => schema[5]}\n }\n @table_ast[table[1]] = column_info\n }\n end\n return @table_ast\n end", "def fill_out\n @build = {}\n descend(@schema, [])\n @build\n end", "def extract_dbc_data\n tabledata = {}\n\n curt = nil\n @db.each do |r|\n unless r.nil?\n if r.objecttype == \"Table\"\n # This is a related table\n tabledata[r.objectid] = {name: r.objectname, fields: []}\n elsif r.objecttype == \"Field\"\n # This is a related field. The parentid points to the table object\n\n # create using the parentid if the parentid is still unknown.\n tabledata[r.parentid] = {name: \"UNKNOWN\", fields: []} unless tabledata.has_key?(r.parentid)\n tabledata[r.parentid][:fields] << r.objectname\n end\n end\n end\n\n # now we need to transform the resulting array-hash to a direct mapping (changed to support older Ruby versions)\n # { tablename => [fieldnames] }\n @tables = {}\n tabledata.each{|k, v| @tables[v[:name]] = v[:fields] }\n end", "def dump(io)\n print \"Going through tables.\\n\" if @debug\n @rows_count = 0\n \n if @args[:tables]\n tables = @args[:tables]\n else\n tables = @args[:db].tables.list.values\n end\n \n if @on_status\n @on_status.call(:text => \"Preparing.\")\n \n @rows_count_total = 0\n tables.each do |table_obj|\n @rows_count_total += table_obj.rows_count\n end\n end\n \n tables.each do |table_obj|\n table_obj = @args[:db].tables[table_obj] if table_obj.is_a?(String) or table_obj.is_a?(Symbol)\n \n #Figure out keys.\n @keys = []\n table_obj.columns do |col|\n @keys << col.name\n end\n \n @table_obj = table_obj\n self.update_status\n print \"Dumping table: '#{table_obj.name}'.\\n\" if @debug\n self.dump_table(io, table_obj)\n end\n end", "def read_new_schema\n AssociatedRecord.reset_column_information\n DeeplyAssociatedRecord.reset_column_information\n\n AssociatedRecord.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n Item.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n end", "def dump_table_generator(table, options=OPTS)\n s = schema(table, options).dup\n pks = s.find_all{|x| x.last[:primary_key] == true}.map(&:first)\n options = options.merge(:single_pk=>true) if pks.length == 1\n m = method(:recreate_column)\n im = method(:index_to_generator_opts)\n\n if options[:indexes] != false && supports_index_parsing?\n indexes = indexes(table).sort\n end\n\n if options[:foreign_keys] != false && supports_foreign_key_parsing?\n fk_list = foreign_key_list(table)\n \n if (sfk = options[:skipped_foreign_keys]) && (sfkt = sfk[table])\n fk_list.delete_if{|fk| sfkt.has_key?(fk[:columns])}\n end\n\n composite_fks, single_fks = fk_list.partition{|h| h[:columns].length > 1}\n fk_hash = {}\n\n single_fks.each do |fk|\n column = fk.delete(:columns).first\n fk.delete(:name)\n fk_hash[column] = fk\n end\n\n s = s.map do |name, info|\n if fk_info = fk_hash[name]\n [name, fk_info.merge(info)]\n else\n [name, info]\n end\n end\n end\n\n create_table_generator do\n s.each{|name, info| m.call(name, info, self, options)}\n primary_key(pks) if !@primary_key && pks.length > 0\n indexes.each{|iname, iopts| send(:index, iopts[:columns], im.call(table, iname, iopts, options))} if indexes\n composite_fks.each{|fk| send(:foreign_key, fk[:columns], fk)} if composite_fks\n end\n end", "def dump_table_schema(table, options=OPTS)\n gen = dump_table_generator(table, options)\n commands = [gen.dump_columns, gen.dump_constraints, gen.dump_indexes].reject{|x| x == ''}.join(\"\\n\\n\")\n \"create_table(#{table.inspect}#{', :ignore_index_errors=>true' if !options[:same_db] && options[:indexes] != false && !gen.indexes.empty?}) do\\n#{commands.gsub(/^/, ' ')}\\nend\"\n end", "def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'recno:Integer',\r\n field_defs].join('|')\r\n\r\n header_rec = 'Z' + encrypt_str(header_rec) if encrypt\r\n\r\n begin\r\n fptr = open(File.join(@db.path, name.to_s + @db.ext), 'w')\r\n fptr.write(header_rec + \"\\n\")\r\n ensure\r\n fptr.close\r\n end\r\n end", "def create_stats_tbl\n tblName = \"#{@table}_stat\"\n creationQuery = \"select ''::text as key, ''::text as value from t_result where 1 =2\"\n # puts creationQuery\n DBConn.tblCreation(tblName, 'key', creationQuery)\n\n parseTree = @parseTree\n\n # fromPT = parseTree['SELECT']['fromClause']\n originalTargeList = parseTree['SELECT']['targetList']\n # fields = DBConn.getAllRelFieldList(fromPT)\n keyList = []\n valueList = []\n selectList = []\n pkJoinList = []\n \n pkArray = @pkList.split(',').map { |col| col.delete(' ') }\n pkArray.each do |pkcol|\n originalTargeList.each do |targetCol|\n targetField = targetCol['RESTARGET']['val']['COLUMNREF']['fields']\n if targetField.count > 1 && targetField[1].to_s == pkcol\n pkJoinList << \"t.#{pkcol} = #{targetField[0]}.#{targetField[1]}\"\n pkArray.delete(pkcol)\n end\n end\n end\n\n stats = {\n \"min\": {\"func\": \"min($COLUMN)\", \"type\": \"text\" },\n \"max\": {\"func\": \"max($COLUMN)\", \"type\": \"text\" },\n \"count\": {\"func\": \"count($COLUMN)\", \"type\": \"int\" },\n \"dist_count\": {\"func\": \"count(distinct $COLUMN)\", \"type\": \"int\" }\n }\n @all_cols.each do |field|\n # puts field.colname\n rel_alias = field.relalias\n stats.each do |stat, info|\n # SELECT\n # UNNEST(ARRAY['address_id_max','address_id_min']) AS key,\n # UNNEST(ARRAY[max(address_id),min(address_id)]) AS value\n # FROM address\n # only add N(umeric) and D(ate) type fields\n if %w(N D).include? field.typcategory\n keyList << \"'#{field.relname}_#{field.colname}_#{stat}'\"\n value = info[:func].gsub('$COLUMN',\"result.#{field.relname}_#{field.colname}\")\n # if info[:type] == 'text'\n value = \"#{value}::text\"\n # end\n valueList << value\n # valueList << \"#{stat}(result.#{field.relname}_#{field.colname})::text\"\n end\n end\n selectList << \"#{rel_alias}.#{field.colname} as #{field.relname}_#{field.colname} \"\n\n # construnct pk join cond\n if pkArray.include?(field.colname)\n pkJoinList << \"#{@table}.#{field.colname} = #{rel_alias}.#{field.colname}\"\n end\n end\n\n # # remove the where clause in query and replace targetList\n whereClauseReplacement = []\n selectQuery = ReverseParseTree.reverseAndreplace(parseTree, selectList.join(','), whereClauseReplacement)\n resultQuery = %(with result as (#{selectQuery} join #{@table} on #{pkJoinList.join(' AND ')}))\n newTargetList = \"UNNEST(ARRAY[#{keyList.join(',')}]) AS key, UNNEST(ARRAY[#{valueList.join(',')}]) as value\"\n\n newQuery = %(#{resultQuery} SELECT #{newTargetList} FROM result)\n query = %(INSERT INTO #{tblName} #{newQuery})\n # puts query\n DBConn.exec(query)\n end", "def _table; @table end", "def initialize_copy(c)\n @db = c.db\n @opts = Hash[c.opts]\n if cols = c.cache_get(:_columns)\n @cache = {:_columns=>cols}\n else\n @cache = {}\n end\n end", "def load_table_schema(conn, builder, table)\n builder.relvar(table){\n primary_key_columns = load_table_heading(conn, builder, table)\n load_table_constraints(conn, builder, table, primary_key_columns)\n }\n end", "def structure_dump() end", "def split_old_bin(table, new_table, i, node, node_hash, forwarder); end", "def copy_new_rows\n logger.debug \"Copying new rows into #{name} ...\"\n\n q = <<-EOF \n INSERT INTO #{audit} \n SELECT #{watched}.*, NULL, 0, NULL, 0, NULL\n FROM #{watched} LEFT JOIN #{audit} ON #{pkey_equality_condition} \n WHERE #{audit}.`_last_version` IS NULL\n LIMIT #{MAX_ROWS}\n EOF\n\n db.query(q)\n cnt = db.query(\"SELECT COUNT(*) FROM #{audit} WHERE `_copied_at` IS NULL\").to_a[0].flatten.to_a[1]\n logger.info \"Copied #{cnt} new rows for table #{name}.\"\n\n version_inserted_rows if cnt > 0\n\n cnt\n end", "def load_table_heading(conn, builder, table)\n primary_key_columns = []\n builder.heading{\n columns = conn.schema(table, {:reload => true})\n columns.each do |name, info|\n #puts info.inspect\n \n # find attribute definition\n defn = {:domain => dbtype_to_ruby_type(info),\n :mandatory => !info[:allow_null] }\n unless info[:ruby_default].nil?\n defn[:default] = info[:ruby_default]\n end\n \n # mark primary key columns\n if primary_key_columns and info[:primary_key]\n primary_key_columns << name \n end\n \n # build the attribute\n builder.attribute(name, defn)\n end\n }\n primary_key_columns\n end", "def dump(io)\n debug \"Going through tables.\"\n @rows_count = 0\n\n if @on_status\n @on_status.call(text: \"Preparing.\")\n\n @rows_count_total = 0\n tables.each do |table_obj|\n @rows_count_total += table_obj.rows_count\n end\n end\n\n each_table do |table_obj|\n # Figure out keys.\n @keys = []\n table_obj.columns do |col|\n @keys << col.name\n end\n\n @table_obj = table_obj\n update_status\n debug \"Dumping table: '#{table_obj.name}'.\"\n dump_table(io, table_obj)\n end\n\n dump_foreign_keys(io)\n end", "def clone\n t = self\n c = super\n c.delete_all\n t.each { |r| c << r.clone }\n c.header = c[header_row_index] if header_row_index\n c\n end", "def test_entire_table\n $BS = Basie.new :name => \"testdb\"\n $BS.enable_full_access\n\n create :simpletest\n assert_equal [{:id=>1, :test=>\"one\"},{:id=>2, :test=>\"two\"},{:id=>3, :test=>\"two\"}],\n $BS.tables[:simpletest].entire_table(:override_security => true)\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def add_table(hash, options={})\n @main_doc.add_table(create_table_fragment(hash, options))\n end", "def tableView(tableView, \n writeRowsWithIndexes:rowIndexes, \n toPasteboard:pboard)\n \n \n data = NSKeyedArchiver.archivedDataWithRootObject(rowIndexes)\n pboard.declareTypes( [\"TSTab\"], owner:self )\n pboard.setData(data, forType:\"TSTab\") \n \n return true\n end", "def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend", "def copy_and_clear_table(params)\n table_name = params[:table]\n game = params[:game]\n team_table = params[:team_table]\n result_filter = params[:result_filter] # for Log only\n main_class = table_name.constantize\n archive_class = (\"Archive#{table_name}\").constantize\n\n main_class.where(game_id: game.id).each do |row|\n\n condition = result_filter.blank? || result_filter.include?(row.result_code) # check the result_filter\n condition &&= archive_class.find_by_id(row.id).blank? # check if this record is already archived\n if condition\n archive_instance = archive_class.new\n main_class.column_names.each do |column|\n if column == 'team_id'\n # if this team is not in game requests\n unless team_table[row.team_id]\n team = Team.find(row.team_id)\n archive_team = ArchiveTeam.create(name: team.name, alternative_name: team.alternative_name,\n image_url: team.image_url, team_id: team.id, game_id: game.id)\n team_table.merge!({team.id => archive_team.id})\n end\n\n archive_instance.send( \"#{column}=\", team_table[row.team_id] )\n else\n archive_instance.send(\"#{column}=\", row.send(column))\n end\n end\n archive_instance.save\n end\n end\n main_class.where(game_id: game.id).map(&:delete)\n end", "def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend", "def makeCopyTableFile()\n # Create the copy table output file name\n copyTableFileName = ccdd.getOutputPath() + \"hk_cpy_tbl.c\"\n\n # Open the copy table output file\n copyTableFile = ccdd.openOutputFile(copyTableFileName)\n\n # Check if the copy table file successfully opened\n if copyTableFile != nil\n totalEntries = 0\n entryIndex = 1\n allTableEntries = []\n\n # Add the build information to the output file\n outputFileCreationInfo(copyTableFile)\n\n # Get an array containing the data stream names\n copyTables = ccdd.getDataStreamNames()\n\n # Default column widths. The widths of the individual copy table\n # entries can increase these values\n columnWidth = [10, 6, 10, 6, 5, 0, 0]\n\n # Process the copy table for each data stream separately\n for copyTable in 0..copyTables.length - 1\n # Get the telemetry message IDs for this data stream\n tlmMsgIDs = ccdd.getTelemetryMessageIDs(copyTables[copyTable])\n\n # Step through each of the telemetry message IDs\n for msgIndex in 0..tlmMsgIDs.length - 1\n isFound = false\n\n # Step through the list of names already used\n for index in 0..$usedHKNames.length - 1\n # Check if the message ID name is in the list\n if tlmMsgIDs[index][0] == $usedHKNames[index]\n # Set the flag to indicate the name is already in the\n # list and stop searching\n isFound = true\n break\n end\n end\n\n # Check if the message ID name isn't in the list\n if !isFound\n # Add the telemetry message ID name and ID to the lists\n $usedHKNames.push(tlmMsgIDs[msgIndex][0])\n $usedHKValues.push(tlmMsgIDs[msgIndex][1])\n end\n end\n\n # Get the copy table entries for this data stream\n copyTableEntries = ccdd.getCopyTableEntries(copyTables[copyTable], $CCSDS_HEADER_LENGTH, \"Message ID Name\", true)\n\n # Store the copy table entries so they won't have have to be\n # retrieved from CCDD again below\n allTableEntries.push(copyTableEntries)\n\n # Check if there are any entries in the copy table\n if copyTableEntries.length > 0\n # Adjust the minimum column widths\n columnWidth = ccdd.getLongestStrings(copyTableEntries, columnWidth)\n \n # Update the total number of copy table entries\n totalEntries += copyTableEntries.length\n end\n end\n\n # Check if there are unused copy table entries \n if totalEntries < $HK_COPY_TABLE_ENTRIES\n # Update the maximum width of the input message ID column\n if columnWidth[$INPUT_MSG_ID] < \"HK_UNDEFINED_ENTRY\".length\n columnWidth[$INPUT_MSG_ID] = \"HK_UNDEFINED_ENTRY\".length\n end\n\n # Update the maximum width of the output message ID column\n if columnWidth[$OUTPUT_MSG_ID] < \"HK_UNDEFINED_ENTRY\".length\n columnWidth[$OUTPUT_MSG_ID] = \"HK_UNDEFINED_ENTRY\".length\n end\n end\n\n # Write the standard include files to the copy table file\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"cfe.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"hk_utils.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"hk_app.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"hk_msgids.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"hk_tbldefs.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"#include \\\"cfe_tbl_filedef.h\\\"\")\n ccdd.writeToFileLn(copyTableFile, \"\")\n \n # Get the number of rows for the Includes table data\n numIncludeRows = ccdd.getTableNumRows(\"Includes\")\n \n # Check if there are any data to include\n if numIncludeRows > 0\n # Step through each row of Includes data\n for row in 0..numIncludeRows - 1\n # Output the Includes table's 'includes' column data\n ccdd.writeToFileLn(copyTableFile, ccdd.getTableData(\"Includes\", \"includes\", row))\n end\n \n ccdd.writeToFileLn(copyTableFile, \"\")\n end\n \n # Build the format strings so that the columns in each row are aligned\n formatHeader = \"/* %-\" + columnWidth[$INPUT_MSG_ID].to_s + \"s| %-\" + columnWidth[$INPUT_OFFSET].to_s + \"s| %-\" + columnWidth[$OUTPUT_MSG_ID].to_s + \"s| %-\" + columnWidth[$OUTPUT_OFFSET].to_s + \"s| %-\" + columnWidth[$VARIABLE_BYTES].to_s + \"s */\\n\"\n formatBody = \" {%-\" + columnWidth[$INPUT_MSG_ID].to_s + \"s, %\" + columnWidth[$INPUT_OFFSET].to_s + \"s, %-\" + columnWidth[$OUTPUT_MSG_ID].to_s + \"s, %\" + columnWidth[$OUTPUT_OFFSET].to_s + \"s, %\" + columnWidth[$VARIABLE_BYTES].to_s + \"s}%s /* (%\" + $HK_COPY_TABLE_ENTRIES.to_s.length.to_s + \"s) %s : %s */\\n\"\n\n # Write the copy table definition statement\n ccdd.writeToFileLn(copyTableFile, \"hk_copy_table_entry_t HK_CopyTable[$HK_COPY_TABLE_ENTRIES] =\")\n ccdd.writeToFileLn(copyTableFile, \"{\")\n ccdd.writeToFileFormat(copyTableFile, formatHeader, \"Input\", \"Input\", \"Output\", \"Output\", \"Num\")\n ccdd.writeToFileFormat(copyTableFile, formatHeader, \"Message ID\", \"Offset\", \"Message ID\", \"Offset\", \"Bytes\")\n\n # Set the counter for the number of entries remaining in the copy table\n rowsRemaining = $HK_COPY_TABLE_ENTRIES - 1\n\n # Step through each entry in the copy table\n for copyTable in 0..copyTables.length - 1\n # Get the copy table entries for this data stream\n copyTableEntries = allTableEntries[copyTable]\n\n # Check if any copy table entries exist; i.e., if any packets are\n # defined\n if copyTableEntries.length != 0\n # Step through each copy table entry\n for row in 0..copyTableEntries.length - 1\n # Set the value so that it will append a comma to all but\n # the last row\n if entryIndex == $HK_COPY_TABLE_ENTRIES\n comma = \" \"\n else\n comma = \",\"\n end\n\n # Write the entry to the copy table file\n ccdd.writeToFileFormat(copyTableFile, formatBody, copyTableEntries[row][$INPUT_MSG_ID], copyTableEntries[row][$INPUT_OFFSET], copyTableEntries[row][$OUTPUT_MSG_ID], copyTableEntries[row][$OUTPUT_OFFSET], copyTableEntries[row][$VARIABLE_BYTES], comma, entryIndex.to_s, copyTableEntries[row][$VARIABLE_PARENT], copyTableEntries[row][$VARIABLE_NAME])\n\n # Check if no available rows remain in the copy table\n if entryIndex == $HK_COPY_TABLE_ENTRIES\n # Exit the loop since no more entries can be added to\n # the copy table\n break\n end\n\n # Increment the copy table entry index\n entryIndex += 1\n end\n end\n end\n\n # Check if there are any unfilled rows in the copy table\n if entryIndex < $HK_COPY_TABLE_ENTRIES\n # Build the format string for the empty entries so that the\n # columns in each row are aligned\n emptyFormatBody = \" {%-\" + columnWidth[$INPUT_MSG_ID].to_s + \"s, %\" + columnWidth[$INPUT_OFFSET].to_s + \"s, %-\" + columnWidth[$OUTPUT_MSG_ID].to_s + \"s, %\" + columnWidth[$OUTPUT_OFFSET].to_s + \"s, %\" + columnWidth[$VARIABLE_BYTES].to_s + \"s}%s /* (%\" + $HK_COPY_TABLE_ENTRIES.to_s.length.to_s + \"s) */\\n\"\n \n # Step through the remaining, empty rows in the copy table\n for index in entryIndex..$HK_COPY_TABLE_ENTRIES\n # Set the value so that it will append a comma to all but\n # the last row\n if entryIndex == $HK_COPY_TABLE_ENTRIES\n comma = \" \"\n else\n comma = \",\"\n end\n \n # Add the blank entry to the copy table\n ccdd.writeToFileFormat(copyTableFile, emptyFormatBody, \"HK_UNDEFINED_ENTRY\", \"0\", \"HK_UNDEFINED_ENTRY\", \"0\", \"0\", comma, entryIndex.to_s)\n\n # Increment the copy table entry index\n entryIndex += 1\n end\n end\n\n # Terminate the table definition statement\n ccdd.writeToFileLn(copyTableFile, \"};\")\n ccdd.writeToFileLn(copyTableFile, \"\")\n ccdd.writeToFileLn(copyTableFile, \"CFE_TBL_FILEDEF(HK_CopyTable, HK.CopyTable, HK Copy Tbl, hk_cpy_tbl.tbl)\")\n ccdd.closeFile(copyTableFile)\n # The copy table file failed to open\n else\n # Display an error dialog\n ccdd.showErrorDialog(\"<html><b>Error opening copy table output file '</b>\" + copyTableFileName + \"<b>'\")\n end\nend", "def initialize(table, id, data = {})\n @row_id = id\n @table = table\n @attributes = data\n @attributes.clone.\n keep_if{ |col, _| @table.indices.include? col }.\n each_pair{ |col, val| add_to_index(col, val) }\n end", "def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end", "def dump_table(table)\n conditions = conditions_for(table)\n\n cmd = \"mysqldump #{ mysql_options } --tables #{ table }\"\n cmd += \" \\\"--where=#{ conditions }\\\"\" if conditions.present?\n\n if post_dump_command\n cmd += \"| #{post_dump_command}\"\n end\n\n cmd += \" > #{ output_dir }/#{ table }#{file_extension}\"\n\n system(cmd)\n end", "def setup\n setup_connection\n\n unless tables.count == 0\n puts \"Aborting! Job already has tables attached. Setup requires a new job.\"\n return\n end\n source_tables = source_connection.tables\n source_tables = source_tables.reject { |table| \n exclude_table_names.include?(table) || table.starts_with?('tmp_') \n }\n\n source_tables.each do |table_name|\n copy_table_schema(table_name)\n end\n\n puts \"Done setup!\"\n puts \"Warning! Table settings have been guessed but you can do extra configuration such as setting the insert_only flag on tables to further increase speed of loading.\"\n end", "def to_table\n @doc.make_table(data, table_options)\n end", "def copy\n DataFrame.new(@rows.copy, rownames: @rownames.copy, colnames: @colnames.copy)\n end", "def copy_tables(table_names, from_db, to_db)\n return if table_names.empty?\n \n # For efficiency, turn off time consuming options.\n sql_connection.execute(\"set autocommit = 0;\")\n sql_connection.execute(\"set unique_checks = 0;\")\n sql_connection.execute(\"set foreign_key_checks = 0;\")\n\n from_escaped = sql_connection.identifier(from_db)\n to_escaped = sql_connection.identifier(to_db)\n\n table_names.each { |name| \n print \".\"\n # Think about whether we should drop/create/re-add triggers, or just truncate.\n tbl = sql_connection.identifier(name)\n\n to_create, to_autoincr = show_create_table_without_increment(to_db, name)\n from_create, from_autoincr = show_create_table_without_increment(from_db, name)\n\n if to_create.nil?\n # table doesn't exist, create it.\n op = :create\n sql_connection.execute(\"CREATE TABLE IF NOT EXISTS #{to_escaped}.#{tbl} LIKE #{from_escaped}.#{tbl}\")\n elsif from_create == to_create\n # table is the same, truncate it.\n op = :truncate\n sql_connection.execute(\"TRUNCATE TABLE #{to_escaped}.#{tbl}\")\n else\n # table is different, drop and create.\n op = :drop_and_create\n sql_connection.execute(\"DROP TABLE #{to_escaped}.#{tbl}\")\n sql_connection.execute(\"CREATE TABLE IF NOT EXISTS #{to_escaped}.#{tbl} LIKE #{from_escaped}.#{tbl}\")\n end\n\n if block_given?\n yield name, op\n end\n\n sql_connection.execute(\"INSERT INTO #{to_escaped}.#{tbl} SELECT * FROM #{from_escaped}.#{tbl}\")\n #\n # if from_create == to_create and from_autoincr != to_autoincr\n # puts \"Warning: set auto_increment not implemented yet.\"\n # For many purposes it won't matter because TRUNCATE TABLE\n # will reset auto_increment (see docs for TRUNCATE TABLE).\n # If it does matter then either implement this or\n # provide an option to drop the table.\n # end\n\n }\n\n sql_connection.execute(\"COMMIT;\")\n sql_connection.execute(\"set foreign_key_checks = 1;\")\n sql_connection.execute(\"set unique_checks = 1;\")\n sql_connection.execute(\"set autocommit = 1;\")\n end", "def get_schema_struct(table_name)\n dbres = do_sql_command(\"DESC #{table_name};\")\n\n dbstruct = []\n\n if(dbres) then\n dbres.each_hash do | row |\n dbstruct_hash = {}\n row.each {|key, val|\n dbstruct_hash[key.downcase.to_sym] = val \n }\n dbstruct << dbstruct_hash\n end \n end\n\n dbstruct\nend", "def copy_table_sql(table, opts)\n if table.is_a?(String)\n table\n else\n if opts[:options] || opts[:format]\n options = String.new\n options << \" (\"\n options << \"FORMAT #{opts[:format]}\" if opts[:format]\n options << \"#{', ' if opts[:format]}#{opts[:options]}\" if opts[:options]\n options << ')'\n end\n table = if table.is_a?(::Sequel::Dataset)\n \"(#{table.sql})\"\n else\n literal(table)\n end\n \"COPY #{table} TO STDOUT#{options}\"\n end\n end", "def table_structure(table_name)\n execute('select * from information_schema.columns where table_schema = ?' \\\n 'AND table_name = ?', [schema, table_name])\n end", "def setup_db_index\n self.copy_tables.each do |t|\n no_sql_connection.create_pre_mongified_id_index(t.name)\n end\n end", "def dump_table_indexes(table, meth, options={})\n return '' unless respond_to?(:indexes)\n im = method(:index_to_generator_opts)\n indexes = indexes(table).sort_by{|k,v| k.to_s} \n gen = Schema::Generator.new(self) do\n indexes.each{|iname, iopts| send(:index, iopts[:columns], im.call(table, iname, iopts))}\n end\n gen.dump_indexes(meth=>table, :ignore_errors=>!options[:same_db])\n end", "def create_all(name, table)\n table.hashes.map do |attributes|\n Utils.model(name).new(attributes).tap do |document|\n document.save\n end\n end\n end", "def columns(table)\r\n tab = @handle.describe_table(table)\r\n cols = tab.columns\r\n cols.collect! do |col|\r\n column_metadata_to_column_info(col)\r\n end\r\n\r\n dbh = DBI::DatabaseHandle.new(self)\r\n\r\n primaries = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect column_name\r\n from all_cons_columns a, all_constraints b\r\n where a.owner = b.owner\r\n and a.constraint_name = b.constraint_name\r\n and a.table_name = b.table_name\r\n and b.constraint_type = 'P'\r\n and b.owner = :1\r\n and b.table_name = :2\r\nEOS\r\n primaries[row[0]] = true\r\n end\r\n\r\n indices = {}\r\n uniques = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect a.column_name, a.index_name, b.uniqueness\r\n from all_ind_columns a, all_indexes b\r\n where a.index_name = b.index_name\r\n and a.index_owner = b.owner\r\n and a.table_owner = :1\r\n and a.table_name = :2\r\nEOS\r\n col_name, index_name, uniqueness = row\r\n indices[col_name] = true\r\n uniques[col_name] = true if uniqueness == 'UNIQUE'\r\n end\r\n\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name).collect do |row|\r\nselect column_id, column_name, data_default\r\n from all_tab_columns\r\n where owner = :1\r\n and table_name = :2\r\nEOS\r\n col_id, col_name, default = row\r\n\r\n col = cols[col_id.to_i - 1]\r\n col_name = col['name']\r\n\r\n if default && default[0] == ?'\r\n default = default[1..-2].gsub(/''/, \"'\")\r\n end\r\n\r\n col['indexed'] = indices[col_name] || false\r\n col['primary'] = primaries[col_name] || false\r\n col['unique'] = uniques[col_name] || false\r\n col['default'] = default\r\n col\r\n end\r\n rescue OCIException => err\r\n raise_dbierror(err)\r\n end", "def upload\n @schema = Schema.find(params[:id])\n uploaded_io = params[:table_file]\n version_name = params[:version]\n file_name = Rails.root.join('public', 'uploads', uploaded_io.original_filename).to_s\n\n File.open(file_name, 'wb') do |file|\n file.write(uploaded_io.read)\n file.close\n end\n fh = File.open(file_name, 'r')\n\n # this is based on a call like\n # mysqldump -h 10.0.249.151 -u lmurdock -p --no-data --single-transaction uptilt_db > schema.sql\n #\n # first line should be\n #-- MySQL dump 10.13 Distrib 5.6.12, for osx10.8 (x86_64)\n re = /MySQL dump\\s+(\\S+)\\s+Distrib\\s+(.*)/\n line = fh.gets\n m = re.match(line)\n if m #found a match\n schema_version = @schema.schema_versions.build(version: version_name, mysql_dump: m[1], mysql_distrib: m[2], comment: file_name)\n while line do # process tables\n #CREATE TABLE `Billing_Suppression_Table` (\n re = /^CREATE TABLE `(.*)`/\n line = fh.gets until line.nil? || m = re.match(line)\n if line # ie. found a table\n schema_table = schema_version.schema_tables.build(name: m[1])\n # - next fields\n field = true\n # `TYPE` varchar(255) NOT NULL DEFAULT '',\n re = /^ `([^`]*)`\\s(\\w+)(\\((\\w+)\\)|)/ # 1 = field name, 2 = field_type, 4 = size\n while field do # process fields\n line = fh.gets.chomp\n if m = re.match(line)\n # process a field\n nullable = (line =~ /NOT NULL/ ? false : true )\n match_default=/DEFAULT\\s+'(.*)'/.match(line)\n default = ( match_default ? match_default[1] : nil)\n schema_table.schema_fields.build(name: m[1], field_type: m[2], type_params: m[4], nullable: nullable, default: default)\n else\n field = false\n end\n end # fields\n while /^\\s+\\w*\\s*KEY/.match(line) do\n # process a key\n # UNIQUE KEY `idx_sidcycle` (`SITE_ID`,`CYCLESTARTDATE`)\n # PRIMARY KEY (`AUTOMATOR_TASK_ID`,`MESSAGE_ID`,`STAT_DATE`,`SITE_ID`,`MAILING_LIST_ID`)\n # KEY `Automator_Payload_Email_Daily_Stat_IDX_01` (`SITE_ID`,`STAT_DATE`)\n primary = (line =~ /^\\s+PRIMARY/ ? true : false)\n unique = (line =~ /^\\s+UNIQUE/ ? true : false)\n name = ''\n key_list = ''\n if primary\n m = /\\((.*)\\)/.match(line)\n name = 'PRIMARY'\n key_list = m[1]\n\n else\n m = /`(\\S*)`\\s+\\((.*)\\)/.match(line)\n name = m[1]\n key_list = m[2]\n\n end\n key_list = key_list.scan(/[^`,]+/) # assumes that the list is ` and , seperated fields with no white space\n schema_key = schema_table.schema_keys.build(name: name, primary: primary, unique: unique)\n for i in 0..key_list.size - 1 do\n schema_key.schema_key_fields.build(name: key_list[i], order: i)\n end\n\n line = fh.gets\n end # loop over key lines\n if /^\\)/ !~ line\n logger.error = \"Something other than an end of table was found after a line inside a table that was not a field or a key. Line is:\"\n logger.error = \"|#{line}|\"\n end\n end # a single table\n end # table while\n @schema.save\n else\n logger.error = \"File starts with something other than '-- MySQL dump' Line is:\"\n logger.error = \"|#{line}|\"\n end\n fh.close\n redirect_to schema_path, notice: \"File uploaded as #{file_name}\"\n end", "def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend", "def insert_table(table, identifier, data)\n if existing_data = get_table(table, identifier)\n if existing_data.empty? || !existing_data.has_key?('.members')\n data.each { |key, value| existing_data[key] = value }\n return data\n else\n error_report \"Error in insert_table: Redefinition of #{identifier}\"\n raise ParseError\n end\n end\n\n table['table_data'].push([identifier, data])\n table['quick_look'][identifier] = 1\n return data\nend", "def load_tables\n tables = @table_ast.keys\n tables.each {|table|\n columns = Hash.new\n column_names = @table_ast[table].keys\n rows = @dbh.execute(\"SELECT * FROM #{table}\")\n @mem_db_row[table] = rows\n column_names.each {|col|\n col_data = Array.new\n rows.each {|data|\n col_data.push(data[col])\n }\n columns[col] = col_data\n }\n @mem_db_col[table] = columns\n }\n return @mem_db_col, @mem_db_row\n end", "def init_conn_table(table_name)\n # Create destination table\n sql = <<SQL\ndrop table if exists #{table_name};\ncreate table #{table_name} (\n day timestamp, \n id int,\n value int,\n dw_created timestamp,\n dw_updated timestamp\n );\nSQL\n conn.run(sql)\n return conn\n end", "def add(connection, table_name)\n if data_source_exists?(connection, table_name)\n primary_keys(connection, table_name)\n columns(connection, table_name)\n columns_hash(connection, table_name)\n indexes(connection, table_name)\n end\n end", "def inner_dump( &encode_block )\n # could possibly overrride Dataset#paginate(page_no, page_size, record_count=nil)\n on_conditions = primary_keys.map{|f| [f,f]}.to_h\n (0..table_dataset.count).step(page_size).each do |offset|\n limit_dataset = table_dataset.select( *primary_keys ).limit( page_size, offset ).order( *primary_keys )\n page = table_dataset.join( limit_dataset, on_conditions ).order( *primary_keys ).qualify(table_name)\n logger.info \"#{__method__} #{table_name} #{offset}\"\n logger.debug page.sql\n page.each &encode_block\n end\n end" ]
[ "0.71946454", "0.6521952", "0.649078", "0.6262572", "0.62434936", "0.61201864", "0.61195266", "0.603655", "0.6017377", "0.59772307", "0.5921113", "0.59018046", "0.5887744", "0.5873437", "0.5843929", "0.5838268", "0.5811328", "0.5796456", "0.5782667", "0.5771281", "0.56829625", "0.5671586", "0.5629402", "0.56244266", "0.5622736", "0.5615352", "0.5611787", "0.5585424", "0.5559694", "0.5517797", "0.5515647", "0.5489995", "0.546823", "0.5426106", "0.53966755", "0.53962773", "0.538968", "0.5371164", "0.53631085", "0.5352825", "0.5348555", "0.53346634", "0.5291214", "0.5291214", "0.5249797", "0.523824", "0.5235958", "0.5214976", "0.5212057", "0.5209335", "0.51972175", "0.5195192", "0.5183597", "0.5182857", "0.51807404", "0.51322216", "0.5104494", "0.5103873", "0.5095012", "0.5088971", "0.50823396", "0.50665694", "0.50659305", "0.5054076", "0.5022685", "0.5015043", "0.5014023", "0.5009012", "0.5009012", "0.5009012", "0.5009012", "0.49941307", "0.49870056", "0.49867213", "0.498672", "0.49866393", "0.49851367", "0.4974065", "0.4966485", "0.49650332", "0.49605113", "0.4940274", "0.492998", "0.49296293", "0.49293786", "0.49216816", "0.4916223", "0.49091262", "0.49080345", "0.48931876", "0.48915842", "0.48709908", "0.48622093", "0.48622093", "0.4854847", "0.48413676", "0.48409006", "0.4837736" ]
0.6626185
2
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def create respond_to do |format| if @user.save(account_update_params) format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7225568", "0.7129473", "0.70036036", "0.6903525", "0.6821961", "0.68157715", "0.6708618", "0.66936064", "0.66810983", "0.6673763", "0.6672601", "0.6664346", "0.6664346", "0.6659468", "0.6659468", "0.6654875", "0.66486204", "0.66436917", "0.6641295", "0.6635214", "0.6618464", "0.66153306", "0.6610267", "0.6607359", "0.6583569", "0.65825915", "0.65820843", "0.65801483", "0.65615994", "0.6558883", "0.6558883", "0.6543664", "0.6537492", "0.6515997", "0.6514648", "0.65062994", "0.65054137", "0.65054137", "0.65015376", "0.6468482", "0.6466442", "0.64641905", "0.6453641", "0.64496416", "0.6443516", "0.6441606", "0.6437562", "0.6428467", "0.6428467", "0.64279026", "0.6427495", "0.64269704", "0.6424723", "0.6424723", "0.64239854", "0.6418606", "0.64156115", "0.6411428", "0.64053625", "0.6405119", "0.6398354", "0.63945407", "0.6390761", "0.63903916", "0.63876307", "0.6383881", "0.63834596", "0.63829523", "0.6382388", "0.63776475", "0.63752687", "0.6374351", "0.63735604", "0.6373269", "0.6370833", "0.6363397", "0.63607967", "0.6360649", "0.6356513", "0.6356091", "0.6350332", "0.6342926", "0.6334242", "0.6333647", "0.6328633", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188", "0.6327188" ]
0.0
-1
Write a method that returns a list of all substrings of a string that start at the beginning of the original string. The return value should be arranged in order from shortest to longest substring.
def substrings_at_start(string) results = [] string.length.times do results << string string = string.chop end results.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substrings_at_start(string)\n string.size <= 1 ? [string] : [substrings_at_start(string.chop), string].flatten\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend", "def substrings_at_start(string)\n string.size <= 1 ? [string] : [*substrings_at_start(string.chop), string] \nend", "def substrings_at_start(string)\n leading_substrings = []\n 0.upto(string.size - 1) do |index|\n leading_substrings << string.slice(0..index)\n end\n \n leading_substrings\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do\n results << string\n string = string.chop\n end\n\n results.sort\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.length) { |n| result << string.slice(0, n) }\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.length) { |n| result << string.slice(0, n) }\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |index|\n result << string.slice(0, index)\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def leading_substrings(string)\n substring = []\n string.each_char.with_index { |_, index| substring << string[0..index] }\n substring\nend", "def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend", "def substrings_at_start(string)\n sub_arr = []\n start = 0\n while start < string.size\n string.chars.each_index do |idx|\n sub_arr << string.slice(start..idx)\n end\n start += 1\n end\n sub_arr.sort.reject(&:empty?)\nend", "def leading_substrings(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def leading_substrings(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def substrings_at_start(string)\n substrings = []\n string.chars.each_with_index do | _, idx |\n substrings << string.slice(0..idx)\n end\n substrings\nend", "def substrings_at_start(string)\n result = []\n string.length.times { |idx| result << string[0..idx] }\n result\nend", "def leading_substrings(str)\n substrings = []\n str.each_char.with_index do |char, idx|\n substrings << str[0..idx]\n end\n substrings\nend", "def leading_substrings(string)\n substrings = []\n string.each_char.with_index { |_, index| substrings << string[0..index] }\n substrings\nend", "def leading_substrings(string) \n result = [] \n string.split(\"\").each_index {|i| result << string[0..i] }\n result\nend", "def substrings_at_start(string)\n result = []\n index = 0\n while index < string.size\n result << string[0..index]\n index += 1\n end\n result\nend", "def substrings_at_start(str)\n\n results = []\n\n str.chars.each_with_index do |ss, idx|\n results << str.slice(0..idx)\n end\n\n results\n\nend", "def substrings_at_start(str)\n result = []\n index = 0\n while index < str.size\n result << str[0..index]\n index += 1\n end\n result\nend", "def substrings_at_start(string)\n sub_arr = []\n string.chars.each_index do |idx|\n sub_arr << string.slice(0, idx + 1)\n end\n sub_arr.sort\nend", "def substrings_at_start(str)\n results = []\n substring = ''\n \n str.chars.each do |char|\n substring += char\n results << substring\n end\n \n results\nend", "def substrings_at_start(string)\n result = []\n string = string.chars\n string.size.times do\n result << string.join('')\n string.pop\n end\n\n result.sort\nend", "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }\nend", "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }\nend", "def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend", "def substrings_at_start(string)\n array = []\n for i in (0..string.length - 1)\n array << string[0..i]\n end\n array\nend", "def find_substrings_from_start(str)\n substrings = []\n str.size.times { |i| substrings << str[0..i] }\n substrings\nend", "def substrings_at_start(string)\n substrings = []\n 1.upto(string.length) do |index|\n substrings << string.slice(0, index)\n end\n substrings\nend", "def substrings_at_start(string)\n string.split(\"\").map.with_index do |_, index|\n string[0..index]\n end\nend", "def leading_substrings(string)\n array = string.chars\n result = []\n loop do\n break if array.empty?\n result.unshift(array.join)\n array.pop\n end\n result\nend", "def substrings_at_start(string)\n (0...string.size).map do |length|\n string[0..length]\n end\nend", "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend", "def substrings_at_start(string)\n results = []\n\n string.chars.each_with_index do |char, index|\n results << string.chars[0..index].inject(:+)\n end\n results\nend", "def substrings_at_start(string)\n (1..string.size).map { |count| string[0, count] }\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do |count|\n results << string.slice(0, count +1)\n end\n results\nend", "def leading_substrings(string)\n 0.upto(string.size - 1).map { |count| string[0..count] }\nend", "def substrings_at_start(str)\n subs = []\n str.chars.each_with_index do |ch, i|\n subs << str.slice(0..i)\n end \n subs.sort {|a, b| a.length <=> b.length} \nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def substrings_at_start(string)\n \n new_array = []\n string.size.times do |idx|\n new_array << string[0..idx]\n end\n new_array\nend", "def substrings_at_start(str)\n subs = []\n str.size.times { |i| subs << str[0..i] }\n subs\nend", "def substrings_at_start(string)\n array_of_strings = []\n split_string = string.split('')\n substring = ''\n split_string.each_index do |position|\n substring += split_string[position]\n array_of_strings << substring\n end\n array_of_strings\nend", "def substrings_at_start(str)\n new_arr = []\n 0.upto(str.size) do |i|\n next if i == 0 \n new_arr << str.slice(0,i)\n end\n new_arr\nend", "def leading_substrings(string)\n substring_arr = []\n counter = 0\n loop do\n substring_arr << string[0..counter]\n counter += 1\n break if counter == string.size\n end\n substring_arr\nend", "def substrings_at_start(str)\n (1..str.length).map { |size| str[0, size] }\nend", "def substrings_at_start(str)\n (1..str.length).map { |size| str[0, size] }\nend", "def substrings_at_start(string)\n sub_strings = []\n 1.upto(string.size) do |count|\n sub_strings << string[0, count]\n end\n\n sub_strings\nend", "def substrings_at_start(string)\n result = []\n\n loop do\n break if string.empty?\n result << string\n string = string.chop\n end\n\n result.reverse\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def leading_substrings(str)\n substr_arr = []\n \n (0...str.size).each do |index|\n substr_arr << str[0..index]\n end\n substr_arr\nend", "def leading_substrings(string)\n substrings = []\n for num in 1..string.length\n substrings << string[0, num]\n end\n substrings\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index| # iterates from 0 to the string size.\n result << string[0..index] # iterates each index from 0..0 to 0..index, which is string size.\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |idx|\n result << string[0..idx]\n end\n p result\nend", "def substrings_at_start(string, initial_index)\n result = []\n 0.upto(string.size-1) do |i|\n result << string[initial_index..i]\n end\n result\nend", "def substrings_at_start(str)\r\n chars = str.chars\r\n chars.each_with_object([]).with_index { |(el,memo), idx| memo << chars.take(idx+1).join('').to_s }\r\nend", "def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend", "def substrings_at_start(string)\n length = 0\n substrings = []\n while length < string.size\n substrings << string[0..length]\n length += 1\n end\n substrings\nend", "def leading_substrings(str)\n sub_strings = []\n\n str.split('').each_with_index { |_, index| sub_strings << str[0, index + 1] }\n\n sub_strings\nend", "def substrings_at_start(str)\n counter = 1\n array = str.chars\n return_array = []\n\n loop do\n break if counter > array.size\n return_array << array.take(counter).join\n counter += 1\n end\n return_array\nend", "def substrings_at_start(string)\n string_array = string.chars\n array_final = []\n\n 1.upto(string.size) do |count|\n array_final << string_array.slice(0, count).join\n end\n array_final\nend", "def substrings_at_start(string)\n substrings = []\n string.length.times do |i|\n substrings.push(string[0..i])\n end\n\n substrings\nend", "def substrings_at_start(string)\n result = []\n string.size.times do |index|\n result << string.split(//).slice(0, index + 1).join\n end\n result\nend", "def leading_substrings(str)\n result = []\n str.size.times { |index| result << str[0..index] }\n result\nend", "def substrings_at_start(str)\n results = []\n count = 1\n \n str.size.times do\n results << str.slice(0, count)\n count += 1\n end\n results\nend", "def substrings(str)\n result = []\n 0.upto(str.size) do |number|\n result[number] = leading_substrings(str[number..str.size])\n end\n\n result.flatten\nend", "def leading_substrings(string)\n result = []\n (string.size).times do |sub_num|\n result << string[0..sub_num]\n end\n result\nend", "def substrings_at_start2(str)\n result = []\n (0..str.size - 1).each { |idx| result << str[0..idx] }\n result\nend", "def substrings_at_start(string)\n # Create a new array to store our substring in\n new_array = []\n\n # We call the upto method to go from 0 up until the size of the string - 1\n # to know when to stop iterating.\n 0.upto(string.size - 1) do |index|\n\n # We will append the substring that starts at the beginning, in this case 'a'\n # and since it's index is 0, we're only going to return 'a' on the first iteration.\n # However, on the second iteration we will be returning the substring 'ab'\n # since we're returng in the string starting at index 0 to index 1 # => 'ab' and so on.\n new_array << string[0..index]\n end\n\n # Return our array with substrings\n new_array\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n substr_arr = []\n 1.upto(str.length) do |n|\n substr_arr << str.slice(0, n)\n end\n substr_arr\nend", "def substrings_at_start(str)\n new_arr = []\n 1.upto(str.size) do |count| \n substring = ''\n substring += str.slice(0, count)\n new_arr << substring\n end\n new_arr\nend", "def substrings_at_start(string)\n substrings = []\n counter = 1\n\n until counter > string.size\n substrings << string[0, counter]\n counter += 1\n end\n\n substrings\nend", "def substrings_at_start(string)\n substrings = []\n counter = 1\n\n until counter > string.size\n substrings << string[0, counter]\n counter += 1\n end\n\n substrings\nend", "def substrings(str)\n str.chars.map.with_index do |subr,index|\n leading_substrings(str.slice(index..-1))\n end.flatten\nend", "def substrings(str)\n results = []\n (0..str.size).each do |start_index|\n this_substring = str[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def leading_substrings(str)\n index = 1\n arr = []\n loop do\n break if index > str.length\n arr << str[0, index]\n index += 1\n end\n arr\nend", "def substrings_at_start(str)\n result_arr = []\n 0.upto(str.size-1) do |num|\n result_arr << str[0..num]\n end\n result_arr\nend", "def substrings_at_start(string)\n substring = string\n results = []\n n = -1\n \n string.length.times do\n results << substring\n substring = substring.chop\n end\n \n results.reverse\nend", "def substrings_at_start(string)\n susbtrings = []\n string.size.times do |count|\n susbtrings << string.slice(0, count + 1)\n end\n susbtrings\nend", "def leading_substrings(string)\n substrings = []\n letters = string.chars\n\n 1.upto(string.size) do |sliced_length|\n substrings << letters.slice(0, sliced_length)\n end\n\n substrings.map do |sub_array|\n sub_array.join\n end\nend", "def substrings(str)\n result = []\n str.size.times do |idx|\n result << leading_substrings(str[idx..-1])\n end\n result.flatten\nend", "def leading_substrings(string)\n str = string\n arr = []\n counter = 0\n\n loop do\n break if str.size == counter\n arr << str.slice(0..counter)\n counter += 1\n end\n \n arr\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(str)\n str.split(//).map.with_index { |_, idx| substrings_at_start(str[idx..-1]) }.flatten\nend", "def substrings_starting_at(string, index)\n substrings_at = []\n string = string[index...string.size]\n (0...string.size).each do |index|\n substrings_at << string[0..index]\n end\n substrings_at\nend", "def substrings_at_start(string)\n string.size.times.with_object([]) { |idx, arr| arr << string[0..idx] }\nend", "def leading_substrings(string)\n result = ''\n string.chars.map { |char| result += char }\nend", "def substrings(string)\n string.chars.map.with_index { |_, idx| substrings_at_start(string[idx..-1]) }.flatten\nend", "def substrings(str)\n result = []\n count = 0\n\n until count == str.length\n result << substrings_at_start(str.slice(count..-1))\n count += 1\n end\n result.flatten\nend", "def substrings_at_start(string)\n string.size.times.with_object([]) { |idx, arr| arr << string.chars.take(idx + 1).join}\nend" ]
[ "0.8325489", "0.8155206", "0.8155206", "0.812128", "0.8113986", "0.80989605", "0.80890393", "0.80890393", "0.80863243", "0.805721", "0.805721", "0.8045335", "0.80292356", "0.8026634", "0.8019423", "0.8019423", "0.8014547", "0.80064577", "0.8000202", "0.7994773", "0.79933316", "0.7991338", "0.7989403", "0.79834706", "0.7972448", "0.7971564", "0.7959948", "0.7950127", "0.7950127", "0.791636", "0.7906467", "0.79018337", "0.7898574", "0.7895858", "0.78923243", "0.788682", "0.787166", "0.785797", "0.78495437", "0.7831341", "0.78172266", "0.7814257", "0.77993375", "0.77993375", "0.779444", "0.77868223", "0.7783345", "0.77825904", "0.77609247", "0.77609164", "0.77609164", "0.7756109", "0.77552336", "0.7753884", "0.7753884", "0.7747445", "0.7745141", "0.7737057", "0.77257776", "0.7719813", "0.77175313", "0.77143675", "0.7710664", "0.7704234", "0.7694858", "0.7690701", "0.76793593", "0.76724654", "0.7665038", "0.7647745", "0.76015335", "0.7598478", "0.7587378", "0.7584913", "0.7574855", "0.7574855", "0.7574855", "0.75537527", "0.75426775", "0.75369024", "0.75369024", "0.75331044", "0.75329673", "0.7526253", "0.7519014", "0.750976", "0.74993575", "0.7493037", "0.7487894", "0.74859446", "0.74610764", "0.74610764", "0.74610764", "0.7442867", "0.7423757", "0.7418645", "0.7416608", "0.74150294", "0.73778695", "0.730543" ]
0.7683622
66
GET /albums/1 GET /albums/1.json
def show @album = @user.albums.find(params[:id]) respond_to do |format| format.html # show.html.erb format.js { render 'show'} format.json { render json: @album } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def album\n album = Album.find(params[:id])\n render json: album\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def index\n @albums = @user.albums\n end", "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "def show\n @album = Album.find(params[:id])\n @albums_count = Album.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def get_albums(url)\n # should return albums\n # List of Hashes\n \n # must implement \n # - custom site parser\n end", "def show\n @album = Album.where(id: params[:id]).first\n if @album\n render json: @album, status: 200\n else\n return_not_found \n end\n end", "def get_albums(person_id, params={})\n @restv9.get_albums(person_id,params)\n end", "def show\n @album = Album.find(params[:id])\n render json: AlbumSerializer.new(@album)\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def show\n @album = Album.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def show\r\n @album = Album.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def index\n @albums = @user.albums\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n\t\t@albums = Album.all\n\tend", "def show\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_album }\n end\n end", "def index\n @albums = current_user.albums\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = @artist.albums.all.page(params[:page] || 1).per(18)\n end", "def index\n @albums = current_user.albums.page(params[:page]).per(10)\n end", "def show\n @albumm = Albumm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @albumm }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def albums(options={})\n call_pageable('library.getalbums', :albums, Album, {:user => @user.name}.merge(options))\n end", "def find_album_by_id(client, album_id)\n client.api(:album, :show, album_id)\nend", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def album(album_id_or_url, options = {})\n options = make_options(:album_id, album_id_or_url, options)\n get(options)\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_owned }\n end\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def index\n @galleries_albums = Galleries::Album.all\n end", "def show\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_item }\n end\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def show\n @user = User.find(@artist.user_id)\n @albums = @artist.albums\n end", "def index\n @albums = Album.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def show\n if !session[:access_token]\n redirect_to :controller => 'sessions', :action => 'connect'\n end\n\n pmocampo = \"30792403\"\n client = Instagram.client(:access_token => session[:access_token])\n \n @user = client.user(pmocampo)\n \n @album = Album.find(params[:id])\n @photos = client.user_recent_media(pmocampo)\n @photos = @photos.select {|p| p.tags.include?(@album.tag)}\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def top_albums(tag)\n get(:standard, {:method => \"tag.getTopAlbums\", :tag => tag})\n end", "def show\n\t\t@album = Album.find(params[:id])\n\tend", "def index\n @albums = current_account.albums.find(:all, :order => 'position')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end", "def index\n @albums = Album.page(params[:page]).per(10).order(created_at: :desc)\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\r\n @photos = Photo.all\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n params[:q]||={:s => \"name asc\"}\n unless current_user.admin.present?\n @albums = current_user.albums\n end\n @q = @albums.search(params[:q])\n @albums = @q.result.page(params[:page]).limit(params[:per_page]||10)\n end", "def index\n unless @user = User.first(:conditions => {:id => params[:user_id].to_i})\n redirect_to(root_url)\n return\n end\n \n @photo_albums = @user.photo_albums \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photo_albums }\n end\n end", "def resource\n\t\t@album\n\tend", "def index\n @band = Band.find(params[:band_id])\n @albums = @band.albums\n end", "def top_albums(artist)\n get(:standard, {:method => \"artist.getTopAlbums\", :artist => artist})\n end", "def show\n @album = Album.find(params[:id]) #find takes one id\n render :show\n end", "def index\n @user = User.find(params[:id])\n raise \"not found\" if @user.blank? \n @albums = @user.albums.all(:order => :title)\n rescue\n redirect_to root_url, :notice => \"Can't find this user.\"\n end", "def picasa_albums(options = {})\n return [] unless current_user.has_provider_auth('google')\n PicasaPhoto.picasa_request_with_refresh(current_user.picasa_identity) do\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n goog.albums[\"albums\"]\n end\n end", "def top_albums(user, options={})\n get(:standard, {:method => \"user.getTopAlbums\", :user => user}.merge(options))\n end", "def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end", "def show\n respond_to do |format|\n format.html { redirect_to action: 'edit', id: @album.id }\n format.json do\n render json: { rows: (@album.nil? ? [] : [@album.marshall]),\n status: (@album.nil? ? 404 : 200),\n total: (@album.nil? ? 0 : 1) }\n end\n end\n end", "def index\n authorize! :read, Album\n \n @albums = Album.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n end", "def info(options={})\n get(:standard, {:method => \"album.getInfo\"}.merge(options))\n end", "def index\n @item_albums = ItemAlbum.all\n end", "def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def album\n\t\talbums == nil ? nil : albums.first\n\tend", "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end", "def index\r\n jump_to(\"/albums/list/#{session[:account_id]}\")\r\n end", "def index\n @private_albums = PrivateAlbum.all\n end", "def index\n @albums = Album.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n @images = @album.images.all\n end", "def index\n @albums = Album.where(\"group_id = ?\", params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @albums }\n end\n end", "def new\r\n\r\n @album = Album.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def show\n @album = Album.find(params[:id])\n if @album.artist != nil\n @songs = get_songs_from_album @album.artist.name, @album.name\n @song_list = []\n if @songs\n @songs.each do |song|\n entry = Hash.new\n entry['rank'] = song['rank']\n entry['title'] = song['name']\n entry['artist'] = @album.artist.name\n song_in_db = lookup_song song['name'], @album.artist.name\n if song_in_db != nil\n entry['available'] = true\n entry['song_id'] = song_in_db.id\n else\n entry['available'] = false\n end\n entry['duration'] = seconds_to_duration(song['duration'].to_i)\n @song_list << entry\n end\n end\n @album_cover = get_album_cover @album.artist.name, @album.name\n @description = get_description_from_album @album.artist.name, @album.name\n end\n\n @songs = [] if @songs == nil\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def picasa_albums(user, picasa_user_id=nil)\n return [] unless user.picasa_identity\n picasa = user.picasa_client\n user_data = picasa.user(picasa_user_id) \n albums = []\n unless user_data.nil?\n user_data.albums.select{|a| a.numphotos.to_i > 0}.each do |a|\n albums << {\n 'aid' => a.id,\n 'name' => a.title,\n 'cover_photo_src' => a.thumbnails.first.url\n }\n end\n end\n return albums\n end", "def index\n @interior_albums = InteriorAlbum.all\n end", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def albums\n link :top_albums, :Album, name\n end", "def get_albums\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n albums_data = SqlRunner.run(sql, values)\n albums = albums_data.map { |albums_data| Album.new(albums_data)}\n return albums\n end", "def set_album\n begin\n @album = Album.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render :json => {error: 'record not found'}, status: :not_found\n end\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @album = current_account.albums.find(params[:id])\n @page_title = @album.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "def fetch_album(args)\n search = AlbumFetch.new(args)\n response = APIRequest.post(search.query, Configuration.instance.api_url(@format))\n parse_response(response)\n end", "def show\n @photos = @album.photos.includes(:album).page(params[:page])\n\n respond_to do |format|\n format.html do\n @page = @site.pages.find_by_name 'albums'\n @pages = @site.pages\n end\n format.js {}\n end\n end", "def index\n @pictures = @album.pictures.all\n end", "def show\n song = Song.find(params[:id])\n render json: song.to_json(only: [:id, :title, :artist], methods: :path, include: {category: {only: [:id, :name]}})\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end" ]
[ "0.8009467", "0.7959881", "0.78372234", "0.7691804", "0.7597149", "0.7578913", "0.7575133", "0.75557536", "0.7509159", "0.7499277", "0.74331", "0.7425575", "0.7392072", "0.73376465", "0.72854936", "0.7269928", "0.7238321", "0.7209099", "0.7199257", "0.71921223", "0.7189279", "0.7189137", "0.7188176", "0.7188176", "0.7188176", "0.7188176", "0.7188176", "0.7188176", "0.7188176", "0.7188176", "0.7174807", "0.71159935", "0.7077667", "0.7075811", "0.7066274", "0.70585614", "0.70499605", "0.70416313", "0.7025077", "0.7015936", "0.7007801", "0.6974397", "0.69741446", "0.69704115", "0.69655323", "0.69416326", "0.6941518", "0.6925969", "0.68859136", "0.687767", "0.68748695", "0.68604624", "0.68503296", "0.6848442", "0.68452483", "0.6828061", "0.6785789", "0.67593056", "0.67585176", "0.6750455", "0.67453134", "0.6735354", "0.6732283", "0.67280465", "0.6716446", "0.6715494", "0.67081326", "0.6706795", "0.6704817", "0.6698118", "0.66919065", "0.6675958", "0.6656919", "0.66414887", "0.6640463", "0.6623678", "0.66046196", "0.66041774", "0.65981346", "0.65920943", "0.65880114", "0.6586254", "0.65813816", "0.6578412", "0.657574", "0.6573183", "0.65716356", "0.6569554", "0.6567218", "0.6566847", "0.6566847", "0.6557419", "0.6551684", "0.6551241", "0.65476245", "0.6541607", "0.65102684", "0.65102684", "0.6496752", "0.6496752" ]
0.7192076
20
GET /albums/new GET /albums/new.json
def new @album = @user.albums.new respond_to do |format| format.js { render 'new' } format.html # show.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @album }\n end\n end", "def new\r\n\r\n @album = Album.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def new\n @album = current_account.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n @title = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @album }\n format.js {}\n end\n end", "def new\n @albumm = Albumm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @albumm }\n end\n end", "def new\n @album = Album.find_by_slug(params[:album_id])\n @album_item = AlbumItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album_item }\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @user_album = UserAlbum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_album }\n end\n end", "def new\n @album = Album.find(params[:album_id])\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @album = Album.find(params[:album_id])\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end", "def new\n @photo = Photo.new\n @photo.album_id = params[:album_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @album_owned = AlbumOwned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album_owned }\n end\n end", "def new\n @photo = Photo.new\n @albums = Album.where('user_id=?',session[:user_id]).latest\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @album = Album.new\n render :new\n end", "def new\n @album = Album.new\n end", "def new\n @album = Album.new\n end", "def new\r\n @photo = Photo.new\r\n \r\n if params[:id] != nil\r\n @album = Album.find(params[:id])\r\n if @album != nil\r\n @photo.ALBUM_ID = @album.ID\r\n end\r\n end\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def new\r\n @album = Album.new\r\n end", "def new\n @album2photo = Album2photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album2photo }\n end\n end", "def new\n @album = Album.new\n\n 3.times do\n @album.tracks.build\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new \n @album = Album.new(params[:album])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @photo = Photo.new\n\t@albums = Album.find_all_by_twit_id(params[:view_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @album = Album.new\n 1.upto(3) { @album.photos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def create\n @album = current_user.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'You created a #Album. Now share your #album around the internets' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n @album.album_photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json do\n render json: { rows: (@album.nil? ? [] : [@album.marshall]),\n status: (@album.nil? ? 404 : 200),\n total: (@album.nil? ? 0 : 1) }\n end\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def new\n @album_genre = AlbumGenre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album_genre }\n end\n end", "def new\n @photo = Photo.new\n\n render json: @photo\n end", "def new\n @photoalbum = Photoalbum.new\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'El album a sido creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\talbum = Album.create(album_params)\n\n\t\tif !album.errors.any?\n\t\t\trender json: album\n\t\telse\n\t\t\trender json: {message: \"Error occurred\"}\n\t\tend\n\tend", "def new\n @photoalbum = Photoalbum.new\n @agendaitems = Agendaitem.order(\"date DESC\").limit(\"50\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photoalbum }\n end\n end", "def new\n @photo_album = PhotoAlbum.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo_album }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @photo_library = PhotoLibrary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo_library }\n end\n end", "def create\n @album = current_account.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'album was successfully created.'\n format.html { redirect_to( :action => 'edit', :id => @album.id) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @photo_album = PhotoAlbum.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo_album }\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if !@album\n @album = current_user.albums.find(params[:id])\n end\n @track = Track.new\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @song }\n end\n end", "def new\n @artists = Artist.find(:all)\n @features = Feature.find(:all)\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to action: 'index', notice: 'Album was successfully created.' }\n format.json { render action: 'index', status: :created, location: @album }\n else\n format.html { render action: 'index' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n @images = Image.all(:conditions => {:album_id => nil})\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def create\n @album = Album.new(allowed_params_album)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n @artists = Artist.all\n end", "def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end", "def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end", "def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end", "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @gallery }\n end\n end", "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @gallery }\n end\n end", "def new\n @song = Song.new\n @song.verses.build\n @song.regions.build\n\n @kinds = Kind.all()\n @regions = Region.all()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @photo = Photo.new\n \n\tif params[:album_id]\n\t\t$album = Album.find(params[:album_id])\n\tend\n\t\n\trender :layout => false\n end", "def new\n @song = @playlist.songs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: \"Album was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n \n @palbum = Palbum.new\n\n \n end", "def create\n @album = Album.new(album_params)\n if @album.save\n redirect_to albums_path\n else \n render 'new'\n end\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.build(params[:album])\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"new\"\n end\n end", "def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @music }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to group_url(@album.group), notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n respond_to do |format|\n if @user.albums << @album\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n @album.user = current_user\n if @album.save\n format.html { redirect_to artist_album_path(@artist,@album), notice: 'album was successfully created.' }\n format.json { render action: 'show', status: :created, location: artist_album_path(@artist,@album) }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @music = Music.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @music }\n end\n \n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end" ]
[ "0.8188422", "0.79822683", "0.79822683", "0.788069", "0.78131187", "0.7684299", "0.75881", "0.75813186", "0.7565208", "0.7560758", "0.7540226", "0.7530166", "0.7487129", "0.7453177", "0.74511963", "0.7413497", "0.7364595", "0.73290884", "0.7294432", "0.7257032", "0.7257032", "0.72523105", "0.7231252", "0.72000515", "0.7171153", "0.71189713", "0.70985967", "0.7090273", "0.7067949", "0.7044011", "0.7044011", "0.7044011", "0.70382077", "0.7027386", "0.7027386", "0.7027386", "0.7027386", "0.7008827", "0.69756484", "0.6965667", "0.6919638", "0.6906501", "0.6876676", "0.6876041", "0.6857118", "0.68539095", "0.68403035", "0.683808", "0.6823203", "0.6823203", "0.6823203", "0.6823203", "0.6817865", "0.679693", "0.67929375", "0.67923707", "0.67923707", "0.677754", "0.6772733", "0.6761582", "0.6761582", "0.6748424", "0.67369384", "0.67200017", "0.6714783", "0.6711356", "0.670994", "0.670994", "0.670994", "0.66958624", "0.66958624", "0.66878664", "0.66814864", "0.6673223", "0.6669732", "0.6668422", "0.66651225", "0.66512495", "0.66512084", "0.6644926", "0.6638358", "0.66370213", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.6631431", "0.66311544", "0.6625565", "0.66234905", "0.6601364", "0.65686184", "0.65666133" ]
0.7486999
13
POST /albums POST /albums.json
def create @album = @user.albums.new(params[:album]) if @album.save flash[:notice] = 'User was successfully created.' if params[:album][:avatar].blank? redirect_to @album else render :action => 'cropping' end else render :action => 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def create\n @album = current_user.albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'El album a sido creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'You created a #Album. Now share your #album around the internets' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to action: 'index', notice: 'Album was successfully created.' }\n format.json { render action: 'index', status: :created, location: @album }\n else\n format.html { render action: 'index' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\talbum = Album.create(album_params)\n\n\t\tif !album.errors.any?\n\t\t\trender json: album\n\t\telse\n\t\t\trender json: {message: \"Error occurred\"}\n\t\tend\n\tend", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: \"Album was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n respond_to do |format|\n if @user.albums << @album\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @album = current_user.albums.build(params[:album])\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"new\"\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to group_url(@album.group), notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @album = Album.create!(album_params)\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def create\n @album_ownership = AlbumOwnership.new\n @album_ownership.album = @album\n @album_ownership.user = current_user\n\n unless @album_ownership.save\n render json: @album_ownership.errors, status: :unprocessable_entity\n end\n end", "def create\n @album = Album.new(allowed_params_album)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.build(album_params)\n \n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @user_album = UserAlbum.new(params[:user_album])\n\n respond_to do |format|\n if @user_album.save\n format.html { redirect_to @user_album, notice: 'User album was successfully created.' }\n format.json { render json: @user_album, status: :created, location: @user_album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_account.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'album was successfully created.'\n format.html { redirect_to( :action => 'edit', :id => @album.id) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def create\n @album = Album.new(album_params)\n respond_to do |format|\n if @album.save\n flash[:success] = 'The album was successfully created.'\n format.html { redirect_to albums_path }\n format.json { render json: { rows: [@album.marshall], status: 200, total: 1 } }\n else\n @albums = Album.all\n notice = \"An error occured while creating the album. #{@album.errors.full_messages.to_sentence}.\"\n flash[:error] = notice\n format.html { render action: 'index', alert: notice }\n format.json { render json: { errors: @album.errors, status: :unprocessable_entity } }\n end\n end\n end", "def create\n\t\tAlbum.create({\n\t\t\tname: params[:name]\n\t\t\t})\n\t\tredirect_to albums_path\n\tend", "def create\n respond_to do |format|\n @album.user = current_user\n if @album.save\n format.html { redirect_to artist_album_path(@artist,@album), notice: 'album was successfully created.' }\n format.json { render action: 'show', status: :created, location: artist_album_path(@artist,@album) }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n not_blank_photos = @album.photos.select do |photo|\n ! photo.title.blank?\n end\n @album.photos = not_blank_photos\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n if @album.save\n redirect_to albums_path\n else \n render 'new'\n end\n end", "def index\n @albums = @user.albums\n end", "def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end", "def new\n @album = Album.new\n\n 3.times do\n @album.tracks.build\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @galleries_album = Galleries::Album.new(galleries_album_params)\n @galleries_album.user = current_user\n respond_to do |format|\n if @galleries_album.save\n format.html { redirect_to @galleries_album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @galleries_album }\n else\n format.html { render :new }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album_owned = AlbumOwned.new(params[:album_owned])\n\n respond_to do |format|\n if @album_owned.save\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully created.' }\n format.json { render json: @album_owned, status: :created, location: @album_owned }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photoalbum = Photoalbum.new(params[:photoalbum])\n\n respond_to do |format|\n if @photoalbum.save\n format.html { redirect_to edit_photoalbum_path @photoalbum, notice: 'Photoalbum was successfully created.' }\n format.json { render json: @photoalbum, status: :created, location: @photoalbum }\n else\n format.html { render 'new' }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.create(params[:album_item])\n\n respond_to do |format|\n if @album_item.save\n format.html { redirect_to @album, notice: 'Album item was successfully created.' }\n format.json { render json: @album_item, status: :created, location: @album_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def create\n @albumm = Albumm.new(params[:albumm])\n\n respond_to do |format|\n if @albumm.save\n format.html { redirect_to @albumm, notice: 'Albumm was successfully created.' }\n format.json { render json: @albumm, status: :created, location: @albumm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @albumm.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.') }\n format.xml { render :xml => albums_path, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_api_json\n Jbuilder.encode do |json|\n json.albums do\n json.array! @albums do |album|\n json.call(album, :name, :uuid)\n json.set!(:artist, album.artist_name)\n json.set!(:artist_twitter_screen_name, twitter_screen_name(album))\n json.set!(:thumbnail_url, album.image || album.thumbnail)\n json.set!(:release_date, album.release_date.in_time_zone.to_i)\n json.set!(:release_date_string, album.release_date.to_s)\n json.set!(:age, album.anniversary.count)\n json.set!(:day_of_week, album.anniversary.current.strftime('%A'))\n json.set!(:anniversary, album.anniversary.current.in_time_zone.to_i)\n json.set!(:anniversary_string, album.anniversary.current.to_s)\n json.set!(:review_link, album.link)\n json.set!(:rating, album.rating)\n json.set!(:generated_fun_fact_description, album.generated_fun_fact_description)\n json.set!(:fun_fact_description, album.fun_fact_description)\n json.set!(:fun_fact_source, album.fun_fact_source)\n json.set!(:link, \"/albums/#{album.slug}\")\n json.set!(:update, \"/v1/admin/albums/#{album.id}\")\n end\n end\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\r\n\r\n @album = Album.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def create\n authorize! :create, Album\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@album = Album.find(params[:album_id])\n \t@photo = @album.photos.create!(params[:photo])\n \tredirect_to @album, :notice => 'Photo created'\n end", "def create\n redirect_to new_album_path, alert: \"You have to select at least one artist.\" and return if params[:album][:album_artists].size == 1 && params[:album][:album_artists][0].empty? # TODO: Find a better way to do this, it does not play nicely with json and xml\n @album = Album.new(album_params)\n album_artists\n album_cover if params[:search_online]\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n format.xml { render xml: @album, status: :created }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n format.xml { render xml: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n new_album = Album.new\n new_album.title = params[:title]\n new_album.artist = params[:artist]\n new_album.year = params[:year]\n new_album.album_art = params[:album_art]\n new_album.save\n end", "def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path(@album.band.id, @album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Albumi loomine õnnestus.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create_album(name, description=nil)\n body = {}\n body['name'] = name\n body['description'] = description\n post(\"/albums\", body: body, code: 201 )\n end", "def new\n \n @album = @user.albums.new\n respond_to do |format|\n format.js { render 'new' }\n format.html # show.html.erb\n end\n end", "def new\n @user_album = UserAlbum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_album }\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n #Dir.chdir(\"public/images\")\n Dir.mkdir(@album['directory'])\n flash[:notice] = 'Album was successfully created.'\n #flash[:notice] = Dir.pwd\n format.html { redirect_to @album }\n #format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action = \"new\" }\n #format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n \n respond_to do |format|\n @photo_album = current_user.photo_albums.build(params[:photo_album])\n if @photo_album.save\n flash[:notice] = 'Новый альбом создан.'\n format.html {\n # if current_user.photo_albums.size > 1\n # redirect_to(@photo_album)\n # else\n redirect_to(new_photo_path)\n # end\n }\n format.xml { render :xml => @photo_album, :status => :created, :location => @photo_album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = @student.albums.new(album_params)\n authorize @album\n if @album.save\n redirect_to new_album_photo_path(@album), notice: 'Album was successfully created.'\n else\n render :new\n end\n end", "def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end", "def create\n @album = Pagealbum.new(album_params)\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n\n respond_to do |format|\n if @album.save\n page=Page.first\n page.albums << @album\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @album = Album.find(params[:id])\n @albums_count = Album.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "def create\n @interior_album = InteriorAlbum.new(interior_album_params)\n\n respond_to do |format|\n if @interior_album.save\n format.html { redirect_to @interior_album, notice: 'Interior design album was successfully created.' }\n format.json { render :show, status: :created, location: @interior_album }\n else\n format.html { render :new }\n format.json { render json: @interior_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @album = Album.new(:account_id => session[:account_id])\r\n \r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n if @album.save\r\n return jump_to(\"/albums/#{@album.id}/upload\")\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n end\r\n \r\n render(:action => \"new\")\r\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def new\n @album = current_account.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new_album(set_albumName, params = {})\n params = { :cmd => 'new-album', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "def new\n @photo = Photo.new\n @photo.album_id = params[:album_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @albumm = Albumm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @albumm }\n end\n end", "def new\n @album = Album.new\n 1.upto(3) { @album.photos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def create\n @albumsix = Albumsix.new(albumsix_params)\n\n respond_to do |format|\n if @albumsix.save\n format.html { redirect_to @albumsix, notice: 'Albumsix was successfully created.' }\n format.json { render :show, status: :created, location: @albumsix }\n else\n format.html { render :new }\n format.json { render json: @albumsix.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @albums = current_user.albums\n end", "def set_album\n if token = album_token\n @album = Album.find_or_create_by(token: token)\n else\n @album = Album.find_by(uuid: params[:id])\n end\n end", "def show\n @album = Album.find(params[:id])\n render json: AlbumSerializer.new(@album)\n end", "def create_album\n @other_user=@login_user\n @albums = @login_user.albums\n @album = Album.new(:name=>params[:album][:name], :user_id=>@login_user.id, :share_type => 0)\n @notice = @album.save ? \"Album created successfully.\": activerecord_error_list(@album.errors)\n\n respond_to do |format|\n format.js\n end\n end", "def create\n @private_album = PrivateAlbum.new(private_album_params)\n\n respond_to do |format|\n if @private_album.save\n format.html { redirect_to @private_album, notice: 'Private album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @private_album }\n else\n format.html { render action: 'new' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @albums = Pagealbum.all.joins(:pagehavingalbums)\n redirect_to \"/beautyvip/create_album\"\n end", "def index\n @albums = @user.albums\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end" ]
[ "0.77528495", "0.7283492", "0.7234256", "0.71961457", "0.7179153", "0.70808494", "0.70808494", "0.70808494", "0.7003637", "0.7003637", "0.69838834", "0.6972035", "0.697075", "0.6958249", "0.69494504", "0.6927158", "0.68965065", "0.6890949", "0.6846395", "0.6823431", "0.6823243", "0.6805188", "0.68006617", "0.6783471", "0.6780751", "0.6744856", "0.67399913", "0.6703513", "0.66474885", "0.6614327", "0.66008705", "0.65916294", "0.6586136", "0.6576275", "0.6574894", "0.65735185", "0.65718293", "0.65695035", "0.65057874", "0.6504347", "0.6487022", "0.64768714", "0.6468198", "0.64659685", "0.64646834", "0.6463741", "0.6448549", "0.64485276", "0.63998497", "0.6386238", "0.6386238", "0.63813585", "0.6380879", "0.6356562", "0.63548636", "0.6351672", "0.63231444", "0.63163716", "0.63135", "0.6309164", "0.6292462", "0.6279711", "0.6274554", "0.6271388", "0.6267765", "0.6266342", "0.6239959", "0.623754", "0.6225732", "0.62210894", "0.6217303", "0.6209731", "0.6206741", "0.620647", "0.6191023", "0.61875355", "0.61841935", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6178229", "0.6176458", "0.61556894", "0.6155587", "0.61546636", "0.61544496", "0.6150628", "0.6143432", "0.61402255", "0.61357373", "0.6124057", "0.6123519", "0.6118628", "0.61185163", "0.61165434" ]
0.61339444
95
PUT /albums/1 PUT /albums/1.json
def update @album = @user.albums.find(params[:id]) respond_to do |format| format.js { render 'new' } format.html{ if @album.update_attributes params[:album] @album.avatar.reprocess! flash[:notice] = 'User was successfully updated.' if params[:album][:avatar].blank? redirect_to @album else render :action => 'cropping' end else render :action => "edit" end} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @album = current_user.albums.find(params[:id])\n\n respond_to do |format|\n if @Album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @album.update!(name: params[:name])\n @album.album_images.destroy_all\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = current_account.albums.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: \"Album was successfully updated.\" }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def update\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to album_url(@album), notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(album_params[:id])\n respond_to do |format|\n if @album.update_attributes(album_params)\n flash[:success] = 'The album was successfully updated.'\n format.html { redirect_to edit_album_url(@album.id) }\n format.json { render json: { rows: [@album.marshall], status: 200, total: 1 } }\n else\n base = 'Failed to save the album. '\n flash[:error] = 'An error occured while updating the album.'\n format.html { render action: 'edit', alert: base + @album.errors.full_messages.to_sentence + '.' }\n format.json { render json: { errors: @album.errors, status: :unprocessable_entity } }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'El album a sido actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @song.update(song_params)\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n \n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n if @album.update(album_params)\n flash[:success] = 'Album updated successfully.'\n path = albums_path\n else\n flash[:error] = 'Problem updating album.'\n path = root_path\n end\n redirect_to path\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to @album }\n format.json { head :no_content }\n else\n format.html { render action = \"edit\" }\n # format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_album(person_id,album_id, caption, location='', privacy='Everyone')\n @restv9.update_album(person_id,album_id, caption, location, privacy)\n end", "def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_album\n begin\n @album = Album.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render :json => {error: 'record not found'}, status: :not_found\n end\n end", "def update\n authorize! :update, @album\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(allowed_params_album)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to artist_album_url(@artist,@album), notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @track_file = TrackFile.find(params[:id])\n\n if @track_file.update(track_file_params)\n @album = Album.find(@track_file.track.album.id)\n render json: @album\n else\n render json: @track_file.errors.full_messages, status: 422\n end\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to band_albums_path(@album.band.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n if @user_album.update_attributes(params[:user_album])\n format.html { redirect_to @user_album, notice: 'User album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = current_user.albums.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:album_id])\n end", "def set_album\n @album = Album.find(params[:album_id])\n end", "def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = Admin::Album.find(params[:id])\n end", "def set_album\n @album = Admin::Album.find(params[:id])\n end", "def update\n respond_to do |format|\n if @albumone.update(albumone_params)\n format.html { redirect_to @albumone, notice: 'Albumone was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumone }\n else\n format.html { render :edit }\n format.json { render json: @albumone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n if @album.update(album_params)\n flash[:success] = \"Album updated!\"\n redirect_to albums_path\n else\n render 'edit'\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to(@album, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @album\n if @album.update(album_params)\n redirect_to @album, notice: 'Album was successfully updated.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'アルバム情報を更新しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = Album.find_by(id: params[:id])\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def update\n respond_to do |format|\n if @galleries_album.update(galleries_album_params)\n format.html { redirect_to @galleries_album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @galleries_album }\n else\n format.html { render :edit }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Albumi uuendamine õnnestus' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateartists\n @album = Album.find(params[:id])\n album_param = params[:albums]\n @album.artists.delete_all \n album_param[:artists].each do |artist_id|\n artist = Artist.find(artist_id)\n @album.artists << artist \n end \n respond_to do |format|\n format.html { redirect_to(:action => :show) }\n format.xml { head :ok }\n end \n end", "def update\n @album = Album.find_by_id_and_user_id(params[:id], @user)\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = Album.includes(:photos, :shares).find(params[:id])\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def update\n respond_to do |format|\n if @item_album.update(item_album_params)\n format.html { redirect_to @item_album, notice: 'Item album was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_album }\n else\n format.html { render :edit }\n format.json { render json: @item_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album\n if token = album_token\n @album = Album.find_or_create_by(token: token)\n else\n @album = Album.find_by(uuid: params[:id])\n end\n end", "def update\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n if @album_owned.update_attributes(params[:album_owned])\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end", "def album=(v)\n if @album != v\n @needs_commit = true\n @album = v\n end\n end", "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "def destroy\n\n @album = @user.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n expire_fragment :action_suffix => 'homepage_albums'\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_album\n # create an instance variable that can be accessed in\n # every action.\n @album = Album.find(params[:album_id])\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n @album = Admin::Album.find(params[:album_id])\n end", "def update\n respond_to do |format|\n if @album_photo.update(album_photo_params)\n format.html { redirect_to @album_photo, notice: 'Album photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_photo }\n else\n format.html { render :edit }\n format.json { render json: @album_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, artist, year, genre)\n self.name = name.length > 0 ? name : self.name\n self.artist = artist.length > 0 ? artist : self.artist\n self.year = year.length > 0 ? year : self.year\n self.genre = genre.length > 0 ? genre : self.genre\n @@albums[self.id] = Album.new(self.name, self.artist, self.year, self.genre, self.id)\n end", "def to_api_json\n Jbuilder.encode do |json|\n json.albums do\n json.array! @albums do |album|\n json.call(album, :name, :uuid)\n json.set!(:artist, album.artist_name)\n json.set!(:artist_twitter_screen_name, twitter_screen_name(album))\n json.set!(:thumbnail_url, album.image || album.thumbnail)\n json.set!(:release_date, album.release_date.in_time_zone.to_i)\n json.set!(:release_date_string, album.release_date.to_s)\n json.set!(:age, album.anniversary.count)\n json.set!(:day_of_week, album.anniversary.current.strftime('%A'))\n json.set!(:anniversary, album.anniversary.current.in_time_zone.to_i)\n json.set!(:anniversary_string, album.anniversary.current.to_s)\n json.set!(:review_link, album.link)\n json.set!(:rating, album.rating)\n json.set!(:generated_fun_fact_description, album.generated_fun_fact_description)\n json.set!(:fun_fact_description, album.fun_fact_description)\n json.set!(:fun_fact_source, album.fun_fact_source)\n json.set!(:link, \"/albums/#{album.slug}\")\n json.set!(:update, \"/v1/admin/albums/#{album.id}\")\n end\n end\n end\n end", "def destroy\n @album = current_user.albums.find(params[:id])\n @Album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def index\n @albums = @user.albums\n end", "def update\n\n artist_id = update_artist_exist_or_new(params[:artist_name])\n\n album_id = update_album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n respond_to do |format|\n\n @song.album_id = album_id\n a = @song.album\n a.artist_id = artist_id\n a.save\n\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def update\n respond_to do |format|\n if @albumsix.update(albumsix_params)\n format.html { redirect_to @albumsix, notice: 'Albumsix was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumsix }\n else\n format.html { render :edit }\n format.json { render json: @albumsix.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @album.update(album_params)\n redirect_to @album, notice: 'Альбом успешно изменён.'\n else\n render :edit\n end\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n #flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to :album=>@album, :action=>\"edit\", :id=>@album.album_id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @albums = Album.all\n render json: @albums\n end" ]
[ "0.68898857", "0.6792222", "0.6670106", "0.6660307", "0.6606993", "0.6606993", "0.65957916", "0.6580667", "0.6580667", "0.6580667", "0.6578174", "0.6538606", "0.6499689", "0.64891946", "0.64501524", "0.64501524", "0.64501524", "0.6420907", "0.64052725", "0.64043105", "0.6369847", "0.6366644", "0.6366644", "0.6366644", "0.6366644", "0.6366644", "0.63631684", "0.63589895", "0.63472664", "0.6343624", "0.63364565", "0.63087296", "0.6280683", "0.6277798", "0.6277227", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6268728", "0.6237141", "0.62362003", "0.6230971", "0.6218395", "0.61938375", "0.61938375", "0.61928034", "0.61843884", "0.61843884", "0.61810344", "0.61761594", "0.61747956", "0.61664546", "0.6152592", "0.6138999", "0.61200213", "0.6118861", "0.6114816", "0.6104679", "0.6104679", "0.6103069", "0.6093274", "0.6091521", "0.60629386", "0.6040827", "0.60354453", "0.60283536", "0.60055417", "0.6001441", "0.59923804", "0.59554076", "0.59470516", "0.58988774", "0.58888197", "0.5885509", "0.58835185", "0.5883205", "0.58821416", "0.58759713", "0.5870056", "0.58631283", "0.5855444", "0.58535284", "0.5853146", "0.5849648" ]
0.0
-1
DELETE /albums/1 DELETE /albums/1.json
def destroy @album = @user.albums.find(params[:id]) @album.destroy respond_to do |format| format.html { redirect_to albums_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @album.destroy\n render json: @album\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = current_user.albums.find(params[:id])\n @Album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albums = Album.all\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = current_account.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_album = UserAlbum.find(params[:id])\n @user_album.destroy\n\n respond_to do |format|\n format.html { redirect_to user_albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: \"Album was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'El album a sido removido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n# @album = Album.find(params[:id])\n# @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @private_album.destroy\n respond_to do |format|\n format.html { redirect_to private_albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to user_albums_path(@user) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @album = Album.find(params[:id])\r\n @album.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to user_albums_path(session[:user_id]),:notice => \"Your Album has been successfully Deleted\" }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_album album_id\n delete(\"/albums/#{album_id}\", code: 204)\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n redirect_to root_url\n end", "def destroy\n @albumone.destroy\n respond_to do |format|\n format.html { redirect_to albumones_url, notice: 'Albumone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: \"Pagealbum was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumm = Albumm.find(params[:id])\n @albumm.destroy\n\n respond_to do |format|\n format.html { redirect_to albumms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @galleries_album.destroy\n respond_to do |format|\n format.html { redirect_to galleries_albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album_id\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_album.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 @albumsix.destroy\n respond_to do |format|\n format.html { redirect_to albumsixes_url, notice: 'Albumsix was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album_owned = AlbumOwned.find(params[:id])\n @album_owned.destroy\n\n respond_to do |format|\n format.html { redirect_to album_owneds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_item = AlbumItem.find(params[:id])\n @album_item.destroy\n\n respond_to do |format|\n format.html { redirect_to album_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n @album = @photo.album\n\n respond_to do |format|\n format.html { redirect_to @album, notice: \"写真を削除しました。\" }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo_album = PhotoAlbum.find(params[:id])\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album_photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_url, notice: 'Album photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n alb=@photo.album\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to alb, notice: 'Фотография успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfife.destroy\n respond_to do |format|\n format.html { redirect_to albumfives_url, notice: 'Albumfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n \n album_path = ALBUMS_ROOT + @album.name\n if(File.exists?(album_path))\n FileUtils.remove_dir(album_path)\n end\n\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # authorize\n authorize! :delete, @album\n @album.destroy\n \n render nothing:true\n flash[:notice] = 'Xóa album thành công.'\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n # Dir.chdir(\"public/images\")\n Dir.delete(@album['directory'])\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto_album = FotoAlbum.find(params[:id])\n @foto_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(foto_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @albumseven.destroy\n respond_to do |format|\n format.html { redirect_to albumsevens_url, notice: 'Albumseven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n if @album.destroy\n format.html { redirect_to artist_albums_url, notice: 'album was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { render action: 'delete' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @album2photo = Album2photo.find(params[:id])\n @album2photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album2photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interior_album.destroy\n respond_to do |format|\n format.html { redirect_to interior_albums_url, notice: 'Interior design album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfour.destroy\n respond_to do |format|\n format.html { redirect_to albumfours_url, notice: 'Albumfour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end", "def destroy\n @album_follow.destroy\n respond_to do |format|\n format.html { redirect_to album_follows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n redirect_to albums_url, notice: 'Альбом успешно удалён.'\n end", "def destroy\n\t\t# binding.pry\n\t\t@useralbum.destroy_all\n\t\tredirect_to user_albums_path\n \tend", "def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n flash[:notice] = 'Album was successfully removed.'\n redirect_to(albums_url)\n end", "def destroy\n @album = Album.find(params[:id])\n @album.images.clear\n @album.save!\n @album.destroy\n Image.all(:conditions => {:album_id => params[:id]}).each do |x| \n x.album_id = nil\n x.save\n end\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n render :json => true\n end", "def destroy\n @private_album_image.destroy\n respond_to do |format|\n format.html { redirect_to private_album_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n AlbumOwnership.find_by({album_id: @album.id, user_id: current_user.id}).destroy\n end", "def destroy\n @album_information.destroy\n respond_to do |format|\n format.html { redirect_to album_informations_url, notice: 'Album information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_album\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.js\n end\n end", "def destroy\n @artist.destroy_songs\n @artist.albums.destroy_all\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @palbum = Palbum.find(params[:id])\n @palbum.destroy\n \n end", "def destroy\n @album = @track.album\n @track.destroy\n redirect_to album_tracks_url(@album)\n end", "def destroy\n @photo = Photo.find( params[:id])\n @album = @photo.album\n if @photo.destroy\n if params[:bucket_id]\n redirect_to bucket_album_path( params[:bucket_id], @album )\n else\n redirect_to @album\n end\n else\n redirect_to @photo\n end\n end", "def destroy\n @album.destroy\n @activity = PublicActivity::Activity.find_by(trackable_id: (params[:id]), trackable_type: controller_path.classify)\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to band_albums_url(@album.band.id), notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @comments = @photo.comments.all\n @comments.each do |cmt|\n cmt.destroy\n end\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n end\n end", "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @album_pub.destroy\n respond_to do |format|\n format.html { redirect_to album_pubs_url, notice: 'Album pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n unless editable(current_user, @album.user)\n redirect_back fallback_location: root_path, alert: '削除権限がありません。'\n return\n end\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'アルバムを削除しました' }\n format.json { head :ok }\n end\n end", "def destroy\n @album_genre = AlbumGenre.find(params[:id])\n @album_genre.destroy\n\n respond_to do |format|\n format.html { redirect_to album_genres_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wedding_album.destroy\n respond_to do |format|\n format.html { redirect_to wedding_albums_url, notice: 'Wedding album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_listing.destroy\n respond_to do |format|\n format.html { redirect_to album_listings_url, notice: 'Album listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_album.destroy\n respond_to do |format|\n format.html { redirect_to favorite_albums_url, notice: 'Favorite album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end", "def destroy\n @picture = @album.pictures.find(params[:id]) #JRD111115\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @album = Album.find(params[:album_id])\n @image = @album.images.find(params[:id])\n @image.destroy\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been deleted.\"\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n expire_fragment :action_suffix => 'homepage_albums'\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.79129416", "0.7841086", "0.77922285", "0.77922285", "0.77922285", "0.77922285", "0.77922285", "0.7786131", "0.77811533", "0.7776723", "0.7772079", "0.77639914", "0.77639914", "0.77639914", "0.7685881", "0.7641379", "0.7640984", "0.76020396", "0.7557685", "0.75472915", "0.75460744", "0.75460744", "0.75460744", "0.75460744", "0.7542899", "0.75275445", "0.75005704", "0.75005704", "0.75005704", "0.75005704", "0.74930316", "0.747494", "0.74583405", "0.745369", "0.74424005", "0.74336374", "0.7424747", "0.74094343", "0.7407808", "0.74036837", "0.74009466", "0.738901", "0.73761207", "0.7360413", "0.73531246", "0.734977", "0.7336717", "0.7329434", "0.7318501", "0.7304504", "0.7302005", "0.72889954", "0.7288853", "0.72463524", "0.7214461", "0.72080195", "0.72045845", "0.7201893", "0.7189118", "0.7186314", "0.716828", "0.71580535", "0.7133637", "0.7116811", "0.71148294", "0.7099436", "0.7088341", "0.70818937", "0.70605695", "0.70411694", "0.7035364", "0.70237535", "0.7017946", "0.6954029", "0.6940127", "0.6938739", "0.6933498", "0.6928256", "0.6909188", "0.69038427", "0.6884675", "0.6884211", "0.6883755", "0.6865249", "0.67984223", "0.6798213", "0.6787964", "0.6781233", "0.6768976", "0.676043", "0.67557925", "0.6751776", "0.6751693", "0.6750957", "0.67453986", "0.67021936", "0.669365", "0.6685797", "0.663667", "0.6617066" ]
0.8011329
0
def reverse_sentence(string) return string.split.reverse.join(" ") end
def reverse_sentence(str) sent_out = [] str.split.each { |word| sent_out.unshift(word) } sent_out.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_sentence(string)\n \n string.split.reverse.join(' ')\n \nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\r\n string.split.reverse.join(\" \")\r\nend", "def reverse_sentence(string)\n string.split(\" \").reverse.join(\" \")\nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(str)\n str.split.reverse.join(\" \")\nend", "def reverse_sentence(str)\n str.split.reverse.join(\" \")\nend", "def reverse_sentence(str)\n str.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n array = string.split\n array.reverse!\n array.join(\" \")\nend", "def reverse_sentence str \n str.split.reverse.join' '\nend", "def reverse_sentence(str)\n\n str.split.reverse.join(\" \")\n \nend", "def reverse_sentence(a_string)\n a_string.split.reverse.join(' ')\nend", "def reverse_sentence(str)\n str.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n \n arr = string.split\n arr = arr.reverse\n arr.join(' ')\nend", "def reverse_sentence(sentence)\n sentence.split.reverse.join(' ')\nend", "def reverse_sentence_old(str)\n str.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string = string.split(' ')\n new_sentence = []\n while string.length > 0\n new_sentence << string.pop\n end\n string = ''\n new_sentence.each do |value|\n string = string + ' ' + value\n end\n string.strip\nend", "def reverse_sentence(str)\n new_str = []\n str.split.reverse_each {|x| new_str.push(x)}\n new_str.join(' ')\nend", "def reverse_sentence(sentence)\n reverse = sentence.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n=begin\n p string.reverse # ex. \"dlroW olleH\" --- reverses whole string\n p string.split(' ') # ex. [\"Hello\", \"World\"] --- returns array of strings split by the space\n p string.split(' ').reverse # ex. [\"World\", \"Hello\"] --- returns array in reverse order\n p string.split(' ').reverse.join # ex. \"WorldHello\" --- returns string from reversed array\n p string.split(' ').reverse.join(' ') # ex. \"World Hello\" --- solution\n=end\n if string != ''\n string.split(' ').reverse.join(' ')\n else\n string\n end\nend", "def reverse_it(sentence)\n sentence.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n reverse = []\n words = string.split(\" \")\n words.length.times do\n reverse << words.pop\n end\n reverse.join(\" \")\nend", "def reverse_sentence(string)\n results = []\n\n split_string = string.split(' ')\n\n split_string.size.times do \n results << split_string.pop\n end\n\n results.join(\" \")\nend", "def reverse_sentence(sentence)\n reverse_string = reverse_string(sentence)\n \n reverse_words = reverse_string.split\n \n new_words = []\n \n reverse_words.each do |word|\n new_words << reverse_string(word)\n end\n \n return new_words.join(\" \")\nend", "def reverse_sentence(string)\n words = string.split(' ')\n reversed = []\n while words != []\n word = words.pop # take previous word\n reversed << word # make next word\n # alternative:\n # word = words.shift\n # reversed.unshift(word)\n end\n reversed.join(' ')\nend", "def reverse_sentence(sentence)\n return '' if sentence == ''\n list = sentence.split(' ').reverse\n str = '' \n list.each{|word| str << word + \" \"}\n str.strip!\nend", "def reverse_sentence(words)\n words.split.reverse.join(' ')\nend", "def reverse_sentence(sentence)\n p sentence.split.reverse.concat.join(\" \")\nend", "def reverse_sentence(string)\n array_of_words = string.split.reverse.join(\" \")\nend", "def reversal(sentence)\n sentence.split(' ').reverse.join(' ')\nend", "def reverse_sentence(sentence)\n s_array = sentence.split\n r_array = []\n s_array.length.times do\n r_array << s_array.pop\n end\n r_array.join(' ')\nend", "def reverse_sentence(str)\n words_array = str.split.reverse.join(' ')\n words_array\nend", "def reverse_sentence(sentence)\n p sentence # String # \"Hello World\"\n p sentence.split # Array # [\"Hello\", \"World\"]\n p sentence.split.reverse # Array # [\"World\", \"Hello\"]\n p sentence.split.reverse.join # String # \"WorldHello\"\n p sentence.split.reverse.join(' ') # String # \"World Hello\"\nend", "def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n (words.size).downto(1) do |i|\n reversed_words << words[i-1]\n end\n\n reversed_words.join(' ')\nend", "def word_reverse(sentence)\n sentence.split(\" \").reverse.join(\" \")\nend", "def reverse_sentence(string)\n result = []\n\n array = string.split(' ')\n \n i = 0\n loop do\n break if i == array.size\n result << array.pop\n end\n\n answer = result.join(' ')\n answer\nend", "def reverse_sentence(string)\n array_string = string.split\n array_string.reverse #discovered after looking at the solution, adding .join(\" \") here yields a true conditional\nend", "def reverse_sentence(sentence)\n string = ''\n unless sentence.empty?\n array = sentence.split(' ')\n until array.empty?\n if array.length == 1\n string << array.pop\n else\n string << array.pop + ' '\n end\n end\n end\n string\nend", "def reverse_words(sentence)\n\tsentence.split.map! { |word| word.reverse }.join(\" \")\nend", "def reverse_words(sentence)\n # sentence_array = sentence.split\n sentence.split.map(&:reverse)\n .join(' ')\n\nend", "def reverse_words(sentence)\n\twords = sentence.split(' ')\n\twords.each do |word|\n\t\tword.reverse!\n\tend\n\treversed_sentence = words.join(\" \")\nend", "def reverse_sentence(str)\n # turn the string into an array\n arr = str.split(' ')\n\n # create a new array to store the reversed array\n new_arr = []\n\n # get the last element of that array\n # add that element to the first element to a new array\n # in a loop\n ndx = arr.length-1\n while ndx >= 0\n element = arr[ndx]\n new_arr.push(element)\n ndx -= 1\n end\n\n # join the array into a sentence\n new_arr.join(' ')\nend", "def reverse(string)\n words = string.split(' ')\n words.reverse!\n return words.join(' ')\nend", "def reverse_sentence(input)\n sentence = []\n sentence << input.split.reverse.join(' ')\n\nend", "def reverse_sentence2(sentence)\n words = sentence.split\n reversed = []\n words.each { |word| reversed.unshift(word) }\n reversed.join(' ')\nend", "def reverse_sentence(sentence)\n sentence_array = sentence.split(\" \")\n reverse_array = []\n iterator = sentence_array.length\n while iterator > 0\n reverse_array << sentence_array[(iterator - 1)]\n iterator -= 1\n end\n reverse_array.join(' ')\nend", "def reverse_sentence(str)\n str.scan(/\\w+/).reverse.join(' ')\nend", "def reverse_sentence(string)\n \n if string.class == String\n string.split.reverse.join(' ')\n else\n \"Please input a String\"\n end\nend", "def reverse_words(sentence)\n if sentence != \"\"\n sent_array = sentence.split\n sent_array.each do |word|\n word.reverse!\n end\n sentence = sent_array.join(\" \")\n end\n sentence\nend", "def reverse_words(sentence)\n new_sentence = []\n reversed_sentence = []\n new_sentence = sentence.split(\" \")\n new_sentence.each do |word|\n new_word = word.reverse\n reversed_sentence << new_word\n end\n reversed_sentence.join(\" \")\nend", "def reverse_words(sentence)\n\tnew_sentence = sentence.split\n\tnew_sentence.map {|x| x.reverse!}\n\treturn new_sentence.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\n \nend", "def reverse_words sentence\n sentence.split(\" \").map{ |x| x.reverse }.join(\" \")\nend", "def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words.unshift(words[i])\n i += 1\n end\n\n reversed_words.join(' ')\nend", "def reverse_words (string)\n array = string.split(\"\")\n array.reverse!\n final = array.join(\"\")\n return final\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend", "def reverse_words(sentence)\n\t# improved readability by making this code into two separate lines.\n\tnew_sentence = sentence.split.map! do |word| \n\t\tword.reverse!\n\tend\n\t# removed an unnecessary \"return\"\n\tnew_sentence.join(\" \")\nend", "def reverse_sent(str)\n\tp str.split.reverse.join(' ')\nend", "def reverse_sentence(my_sentence)\n # raise NotImplementedError\n return my_sentence if my_sentence.nil? || my_sentence.empty?\n\n array = my_sentence.split(/\\s(\\s$)?/)\n\n reverse_array = []\n i = array.length - 1\n\n while i >= 0\n reverse_array << array[i]\n i -= 1\n end\n\n joined_sentence = reverse_array.join(\" \")\n j = 0\n while j < joined_sentence.length\n my_sentence[j] = joined_sentence[j]\n j += 1\n end\n\nend", "def reverse_words(sentence)\r\n\tsent_arr = sentence.split(\" \")\r\n\tsent_arr.each do |word|\r\n\t\tsent_arr[sent_arr.index(word)] = word.reverse\r\n\tend\r\n\treturn sent_arr.join(\" \")\r\nend", "def reverse_each_word(string)\n sentence_array = string.split(\" \")\n reversed_sentence = []\n sentence_array.collect do |word|\n reversed_sentence << word.reverse\n end\n reversed_sentence.join(\" \")\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n\n array = my_sentence.split(/(\\S+)|(\\W)/)\n\n first_index = 0\n last_index = (array.length) - 1\n \n while first_index < last_index\n temp = array[first_index]\n array[first_index] = array[last_index]\n array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n\n array = array.join(\"\")\n\n array.length.times do |n|\n my_sentence[n] = array[n]\n end\n return my_sentence \nend", "def reverse_sentence(sentence)\n array = sentence.split(' ')\n reverse_array = []\n idx = array.size\n\n loop do\n idx -= 1\n break if idx < 0\n reverse_array << array[idx]\n end\n\n reverse_array.join(' ')\nend", "def reverse_each_word(sentence)\n sentence.split.collect { |word| word.reverse }.join(\" \")\nend", "def reverseWords(s)\n s.split(\" \").reverse.join(\" \")\nend", "def reverse(string)\ns = string.split.reverse.join(\" \")\n #your code here\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\n end", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\n end", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.map! do |word|\n word.reverse\n end\n .join(\" \")\nend", "def reverse_sentence(my_sentence)\r\n my_sentence = reverse_words(my_sentence)\r\n my_sentence = string_reverse(my_sentence)\r\nend", "def wordReverse (string)\n puts string.split.reverse.join(' ')\nend", "def reverse_each_word(sentence)\n sentence.split.collect(&:reverse).join(' ')\nend", "def reverse_each_word(sentence)\n sentence_array = sentence.split(/ /) \n final_sentence = sentence_array.collect {|word| word.reverse}\n final_sentence.join(\" \")\nend", "def wordReverse (string_of_words)\n\n new_string = string_of_words.split(' ').reverse().join(' ')\n puts new_string\n\nend", "def reverse_each_word(string)\n s = string.split(\" \")\n backward_sentence = s.collect do |word|\n word.reverse\n end\n backward_sentence.join(\" \")\nend", "def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split(\" \").collect do |word|\n word.reverse\n end\n .join(\" \")\nend", "def reverse_string(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(my_sentence)\n if my_sentence == nil\n return nil\n elsif my_sentence == \"\"\n return \"\"\n end\n words = my_sentence.split(/(\\s)/)\n return my_sentence if words.length < 2\n\n hi = words.length - 1\n low = 0\n until low >= hi\n bottom = words[low]\n top = words[hi]\n words[low] = top\n words[hi] = bottom\n hi -= 1\n low += 1\n end\n my_sentence = words.join\n return my_sentence\nend", "def solution(sentence)\n sentence.split.reverse.join(\" \")\nend", "def reverse_sentence(string)\n reverse_words = []\n word_array = string.split(' ')\n counter = 0\n loop do\n break if counter == word_array.length\n reverse_words.unshift(word_array[counter])\n counter += 1\n end\n p reverse_words.join(' ')\nend", "def reverse_sentence(werds)\n if werds != ''\n werds = werds.split.reverse\n output = werds.shift\n werds.each { |werd| output += \" \" + werd}\n output\n else return werds end\nend", "def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words = [words[i]] + reversed_words\n i += 1\n end\n\n reversed_words.join(' ')\nend", "def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words = [words[i]] + reversed_words\n i += 1\n end\n\n reversed_words.join(' ')\nend", "def reverse_sentence(my_sentence)\r\n reverse_words(my_sentence)\r\n string_reverse(my_sentence)\r\nend", "def reverse_words(sentence)\n sentence = reverse(sentence)\n words = sentence.split(/ /)\n words.map! { |word| reverse(word) }\n words.join(\" \")\nend", "def reverse_words(string)\n string_array = string.split(\" \")\n string_array.each do |word|\n word.reverse!\n end\n p string_array\n reversed_sentance = \"\"\n string_array.each do |reverse_word|\n reversed_sentance += reverse_word + \" \"\n end\n p reversed_sentance.chop\nend", "def reverse_words(sentence)\n array = sentence.split(\" \")\n reversed_array = []\n array.each do |word|\n reversedWord = word.reverse\n reversed_array.push(reversedWord)\n end\n return reversed_array.join(\" \")\nend", "def reverse_each_word(sentence)\n\tsentence.split.collect { |el| el.reverse }.join(\" \")\nend" ]
[ "0.9722934", "0.9716321", "0.9716321", "0.9716321", "0.9716321", "0.9716321", "0.9715754", "0.96540797", "0.96519816", "0.96519816", "0.96519816", "0.957925", "0.957925", "0.95757717", "0.95520675", "0.95494825", "0.9548157", "0.9524697", "0.951481", "0.9493014", "0.9395695", "0.9385134", "0.9365179", "0.9359818", "0.9257586", "0.92325556", "0.9201733", "0.91483146", "0.9103248", "0.9102271", "0.9062629", "0.90532374", "0.9044182", "0.90369946", "0.89338255", "0.8929454", "0.89161974", "0.8892568", "0.8887772", "0.8860216", "0.8855756", "0.8855633", "0.8851393", "0.88161504", "0.87995684", "0.87804896", "0.8771862", "0.8763906", "0.87563306", "0.874232", "0.87214583", "0.8718598", "0.8695925", "0.8693996", "0.8685089", "0.8668255", "0.86656123", "0.8661721", "0.86483043", "0.8637907", "0.8630823", "0.8616829", "0.8616829", "0.8609076", "0.86062366", "0.86032116", "0.85805804", "0.8559208", "0.85522544", "0.85481995", "0.85438097", "0.85298944", "0.8520988", "0.851669", "0.851669", "0.85072607", "0.85072607", "0.85072607", "0.85072607", "0.85041744", "0.8503856", "0.849712", "0.849294", "0.849281", "0.8491221", "0.8490021", "0.84853953", "0.84828585", "0.8480372", "0.8476053", "0.8468758", "0.8464919", "0.846073", "0.84590745", "0.84590745", "0.8450239", "0.8448197", "0.84471136", "0.8445546", "0.844487" ]
0.9073781
30
The array will never be empty and the numbers will always be positive integers. Your result should also be an integer.
def average(arr) arr.sum / arr.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_only_numbers(array)\n ll_sum = 0.0\n if array.length > 0\n for idx in array do\n if idx.is_a?(Numeric)\n ll_sum += idx\n end\n end\n end\n return ll_sum\nend", "def sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.all? { |x| x.integer?})\n \n array.reduce(0,:+)\n \nend", "def new_numbers (array)\n emptyArr = []\n array.each do |i|\n if i.class == Integer\n emptyArr << i\n end\n end\n return emptyArr\nend", "def missing_integer(a)\n result = []\n a.each do |i|\n result[i] = i if i > 0\n end\n\n i = 1\n while result[i] != nil\n i += 1\n end\n i\nend", "def array_nums(arr)\n\n result = []\n count = 0\n\n arr.each { |num| num!=0 ? result << num : count += 1 }\n count.times { result.push(0) }\n result\n\nend", "def sum_array(arry)\n sum = 0\n arry.each do |num|\n # if num = num.to_i\n sum += num\n\n\n end\n sum\nend", "def sum_only_numbers(an_array)\n total = 0\n num = an_array.each { |a| total += a if a.is_a?(Fixnum)} \n \n return total\nend", "def sum(arr)\r\n #if array includes the value of non-integer,change it to 1\r\n iIntegerFlag=0\r\n #initialize the value of the sum of array's elements\r\n iSum=0\r\n #identify array\r\n if arr.instance_of?(Array) then\r\n #get the length of arr\r\n iArrLength=arr.size\r\n #justify whether the each element of array is a integer\r\n for value in arr do\r\n if !value.is_a?(Integer) then\r\n iIntegerFlag=1\r\n break\r\n end\r\n end\r\n if iIntegerFlag==1 then\r\n puts \"The array must be consisted of integers!\"\r\n return false\r\n else\r\n if iArrLength!=0 then\r\n for n in 1..iArrLength\r\n iSum=iSum+arr[n-1]\r\n end\r\n end\r\n return iSum\r\n end\r\n else\r\n puts \"Please input an array!\"\r\n return false\r\n end\r\nend", "def sum_of_array(array)\n sum = 0\n array.each do |item|\n if item.is_a?(Integer) == true\n sum = sum + item\n else\n sum = sum + num_value(item)\n end\n end\n sum\nend", "def sum_only_numbers(an_array)\n count = 0\n an_array.map do |array|\n \tif array.is_a? Fixnum or array.is_a? Float\n \t\tcount = count + array\n \tend\n end\t\nend", "def sum(int_array)\r\n sum = 0\r\n\r\n #puts int_array.class.to_s == 'Array'\r\n # Check that int_array behaves like array \r\n if int_array.respond_to?(:each)\r\n int_array.each do |num|\r\n if num.class.to_s =='Fixnum' \r\n sum += num\r\n else\r\n puts \"Non-integer entry #{num} of the array are not added to the sum\"\r\n end\r\n end\r\n else\r\n raise \"Input parameter is not an array\"\r\n end\r\n sum\r\nend", "def sum_only_numbers(an_array)\n\tsummation = 0\n\tfor item in an_array\n\t\tif item.is_a? Integer\n\t\t\tsummation += item\n\t\tend\n\t\tif item.is_a? Float\n\t\t\tsummation += item\n\t\tend\n\tend\n\treturn summation\nend", "def sum_only_numbers(an_array)\n if an_array.length == 0\n \treturn 0\n end\n if an_array[0].is_a?(Numeric)\n \tan_array[0] + sum_only_numbers(an_array.drop(1))\n else\n \tsum_only_numbers(an_array.drop(1))\n end\n\nend", "def array_num_total array\r\n i = 0\r\n\tnum_total = 0\r\n\tinteger_array = array.collect { |item| item.to_i }\r\n\twhile i < integer_array.length\r\n\t num_total = integer_array[i] + num_total\r\n\t\ti = i + 1\r\n\tend\r\n num_total\r\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.each {|value| sum += value if value.is_a? Numeric}\n sum\nend", "def missing_number(array)\n\tlast = array[-1]\n\tp last+1\n\tp last/2\n\texpected_sum = (last+1) * (last/2)\n\tactual = array.inject(:+)\n\texpected_sum - actual\nend", "def total_negative_integers(array)\n if array.length > 0\n\n total_negative_integers(array.shift)\n # if array.shift < 0\n # counter += 1\n else\n counter\n end\n # total_negative_integers(array[1..-1])\n end", "def up_array(arr)\n return nil if arr.length < 1\n condition = true\n arr.each { |i| condition = false if ( (i < 0) || (i > 9) || (i.class == Float) ) }\n return (arr.join.to_i + 1).to_s.chars.map {|i| i.to_i} if condition == true\nend", "def missingNumber(array)\n n = array.length + 1\n expectedSum = n * (n +1) / 2\n currentSum = 0\n\n for value in array do \n \tcurrentSum += value\n end\n\n return expectedSum - currentSum\n\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.select{|x| x.is_a?Numeric }.each{|x| sum +=x }\n sum\nend", "def positive_sum(arr)\r\n sum = 0\r\n arr.each do |number|\r\n if number > 0\r\n sum += number\r\n end\r\n end\r\n sum\r\n end", "def sum_only_numbers(an_array)\n nums = an_array.select { |x| x.is_a? Numeric }\n return nums.inject { |sum,x| sum + x }\nend", "def average(array)\n sum = 0\n\n if array.empty? || array.index {|x| x > 0} == 1\n puts \"Your array may be empty or contain negative intergers\"\n else\n array.each do |int|\n sum +=int\n end\n sum /= array.size\n end\nend", "def sum_positive_count_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n sum += num \n else\n neg_count += 1\n end\n end\n\n return [sum, neg_count]\nend", "def sum_array(some_array) \n sum = 0\n\tsome_array.each do |x|\n\t if x.is_a?Integer\n\t sum = sum + x\n\t end\n\t \n\t end\n\t \n\tsum\n end", "def positive_sum(arr)\n arr != [] ? arr.select {|num| num > 0}.sum() : 0\nend", "def missing_integer(a)\n a.sort!\n a.select!{|i| i > 0}\n\n return 1 if a.length == 0 || a[0] > 1\n\n\n (0..(a.length - 2)).each do |i|\n return (a[i] + 1) if a[i+1] - a[i] > 1\n end\n return a[-1] + 1\nend", "def count_positive_sum_negative(arr)\n sum = 0\n neg_count = 0\n arr.each do |num|\n if num >= 0\n neg_count += 1\n else\n sum += num\n end\n end\n\n return [neg_count, sum]\nend", "def sum(in_array)\n return 0 if in_array.length == 0\n return in_array.reduce(:+)\nend", "def check_array(nums)\n if(nums.length >= 2)\n\t\treturn (nums[0] + nums[1])\n\tend\n\tif(nums.length == 1)\n\t\treturn nums[0];\n\tend\n\treturn 0;\n\nend", "def sum_only_numbers(an_array)\n # TODO write your code here\n arraySum = 0\n an_array.each do |arrayElement|\n if arrayElement.is_a?(Numeric) == true\n arraySum += arrayElement\n end\n end\n puts arraySum\nend", "def plusMinus(arr)\n positive = arr.count{|x| x > 0}\n negative = arr.count{|x| x < 0}\n zero = arr.count{|x| x == 0}\n size = arr.size\n puts positive.to_f/size\n puts negative.to_f/size\n puts zero.to_f/size\nend", "def int_array_check(arr)\n arr.each do |element|\n Integer(element) != nil rescue return false\n end\n return true\n end", "def sum_up_numbers(arr)\n arr.select {|n| n.is_a? Integer}.reduce(0, :+)\nend", "def my_solution(array)\n hash = {}\n\n array.each do |element|\n hash[element] = 0 if element > 0\n end\n\n (1..array.size).each do |i|\n return i if hash[i].nil?\n end\nend", "def is_a_number?(arr_value)\n\tarr_value.is_an_integer?\nend", "def positive_sum(arr)\n arr.select!{|num| num > 0}\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def get_nums_built_in(array2)\n array2.select { |el| el.is_a? Numeric }\nend", "def sum_only_numbers(an_array)\n # TODO write your code here\n total = 0\n\n an_array.each do |x|\n if(x.is_a? Numeric)\n total = total + x\n end\n end\n\n total\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.each do |item|\n item.is_a?(Integer) || item.is_a?(Float) ? sum += item : sum\n end\n return sum\nend", "def count_sum(array)\n ans = []\n count = 0\n sum = 0\n return [] if array.empty?\n array.each do |n|\n if n > 0\n count += 1\n elsif n < 0\n sum += n\n end\n end\n ans << count\n ans << sum \n return ans\nend", "def sum_of_positive(arr)\n sum = 0\n arr.each do |num|\n if num >= 0\n sum += num \n end\n end\n\n return sum\nend", "def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend", "def sum(array_of_integers)\n # TODO\nend", "def sum(in_array)\n # YOUR CODE HERE\n sumr=0\n if in_array.length == 0\n sumr=0\n elsif \n #Enumerable\n sumr= in_array.reduce(:+)\n end\n\n return sumr\nend", "def missing_num a\n for i in 0...a.length\n return i if (i ^ a[i] != 0)\n end\nend", "def sum_only_numbers(an_array)\n\n count = 0\n an_array.map {|index| \n if index.is_a? Fixnum or index.is_a? Float\n count += index\n end\n }\n return count\n\nend", "def sum_only_numbers(an_array)\n sum=0\n an_array.each do |item|\n if item.is_a? Integer or item.is_a? Float\n\tsum+=item\n end\n end\n return sum\nend", "def sum(array)\n return 0 if array.empty?\n array.inject(:+)\nend", "def sum_of_negative(arr)\n sum = 0\n arr.each do |num|\n if num < 0\n sum += num \n end\n end\n\n return sum\nend", "def is_integer_array? array\n\t\treturn array.all? {|a| a.is_a? Integer}\n\tend", "def is_int_array(arr)\n if arr == nil || arr == ''\n return false\n elsif arr.empty?\n return true\n end\n\narr.each do |i|\n if i.class == Integer || i.class == Float && i%1==0\n else\n return false\n end\n end\ntrue\nend", "def positive_sum(arr)\n total = 0\n arr.each { |num| total += num if num > 0 }\n\n total\nend", "def sum_of_big_numbers(array_of_integers)\n # TODO\nend", "def sum(array)\n #return 0 if array.empty?\n #array.reduce(:+)\n \n array.length > 0 ? array.inject(:+) : 0\nend", "def find_missing_number(array)\n # Calculate the full sum (which is the sum if only the 0 were missing):\n full_sum = 0\n (1..array.length).each do |n|\n full_sum += n\n end\n\n # Calculate the CURRENT sum:\n current_sum = 0\n\n array.each do |n|\n current_sum += n\n end\n # The difference between the two sums will be the missing number:\n return full_sum - current_sum\nend", "def sum_array(integers)\n integers.inject(0) { |result, element| result + element }\nend", "def sum_only_numbers(an_array)\n sum = 0.0\n an_array = an_array.flatten\n for n in an_array\n if n.class == Float || n.class == Fixnum\n sum = sum + n\n end\n end\n sum\nend", "def sum(array)\n i = 0\n output = 0\n while i < array.length\n output += array[i].to_int\n i += 1\n end\n return output\nend", "def array_to_int(arr)\n\tarr_int = 0\n\ti = 1\n\t\n\tarr.reverse.each do |d|\n\t\tarr_int += d*i\n\t\ti *= 10\n\tend\n\t\n\treturn arr_int\nend", "def array_to_int(arr)\n\tarr_int = 0\n\ti = 1\n\t\n\tarr.reverse.each do |d|\n\t\tarr_int += d*i\n\t\ti *= 10\n\tend\n\t\n\treturn arr_int\nend", "def sum_up_numbers(arr)\n sum = 0\n arr.each do |num|\n if num.is_a? Integer\n sum += num\n end\n end\n return sum\nend", "def smallest_integer(array)\n\tif array == []\n\t return nil\n\telse array.sort!\n \t return array[0]\n end\nend", "def missingNumber(array)\n (1..100).each do |i|\n return i if !array.index(i)\n end\nend", "def positive_sum(arr)\n sum = arr.select {|num| num > 0}.reduce(&:+) \n sum == nil ? 0 : sum\nend", "def missingNumber(array)\n currentSum = array.inject(:+)\n n = array.length + 1\n expectedSum = n * (n + 1) / 2\n puts expectedSum - currentSum\nend", "def missing(array)\n result = []\n num = array.first + 1\n loop do\n result << num if !array.include?(num)\n num += 1\n break if num == array.last\n end\n result\nend", "def total_negative_numbers\n numbers = [0, 3, -1, -45.4, 5, 68, -8]\nend", "def total(array)\n if array.size !=0\n total_num = 0\n for n in 0...array.size\n value = array[n]\n total_num += value\n end\n return total_num\n end\nend", "def missing(nums)\n (nums.first.to_i...nums.last.to_i).to_a - nums\nend", "def namerisuminarray arr \n len = arr.length\n sum = 0\n sum = sum.to_i\n broqch = 0\n \n while broqch <= len - 1\n sum = sum + arr[broqch].to_i\n broqch = broqch + 1\n end\n \n return sum \nend", "def sum_array(int_array)\n int_array.reduce(:+)\nend", "def plus_minus arr\n p arr.select { |el| el > 0 }.size / arr.size.to_f\n p arr.select { |el| el < 0 }.size / arr.size.to_f\n p arr.select { |el| el == 0 }.size / arr.size.to_f\n end", "def big_numbers(array_of_integers)\n # TODO\nend", "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def smallest_integer(array)\n array.min\nend", "def get_num(arr)\n case rand(100) + 1\n when 1..5\n check_if_nil(arr,0)\n when 6..65\n check_if_nil(arr,1)\n when 66..100\n check_if_nil(arr,2)\n end\n end", "def squash(arr)\n arr.map(&:to_i).reduce(:+) || 0 unless arr.nil?\n end", "def average_array(array)\n array.each do |ele|\n raise \"All member must be numbers\" if !(ele.instance_of?(Integer))\n end\n\n array.sum / array.length.to_f\nend", "def missing_int(a)\n a.sort!\n return 1 if a.length == 0 || a[0] != 1\n n_plus_one = a.length + 1\n return n_plus_one if a[-1] != n_plus_one\n\n len = a.length - 2\n missing_val = nil\n (0..len).each do |i|\n if (a[i + 1] - a[i]) > 1\n missing_val = a[i] + 1\n break\n end\n end\n return missing_val || n_plus_one\nend", "def total(array)\n\tanswer=array.inject(0){\n\t\t|sum,i| sum+i\n\t}\n\treturn answer\nend", "def armstrong_number number_array, number\n result = 0\n number_array.reverse_each do |number|\n \tresult += number.to_i ** number_array.size\n end\n return number == result\nend", "def up_array(arr)\n\n\treturn nil if arr.empty? == true\n\tarr.each do |number|\n\t\treturn nil if number < 0 == true || number > 9 == true\n\tend\n\tnum = arr.join.to_i + 1\n\tnum.to_s.split(//).map(&:to_i)\nend", "def count_in_array(number)\n first = first_in_array(number)\n return 0 if first == -1\n\n last = last_in_array(number)\n (last - first + 1)\n end", "def sum(array)\n return 0 if array.empty?\n return array.first if array.length == 1\n\n array.inject(:+)\nend", "def total_of_array(array)\n array.inject(0) {|sum, i| sum + i }\nend", "def positive_sum(arr)\n return 0 if arr.size == 0\n arr.inject(0){|sum, el| puts sum; el > 0 ? sum + el : sum}\nend", "def plusMinus(arr)\n plus = []\n minus = []\n zero = []\n arr.each do |v|\n if v == 0\n zero << v\n elsif v > 0\n plus << v\n else\n minus << v\n end\n end\n total_count = arr.length\n puts sprintf(\"%.6f\", plus.length.to_f / total_count)\n puts sprintf(\"%.6f\", minus.length.to_f / total_count)\n puts sprintf(\"%.6f\", zero.length.to_f / total_count)\nend", "def sum_of_positive(arr)\n arr.select {|e| e>=0}.sum\nend", "def sum arr\n return 0 if arr.empty?\n arr.inject(:+)\nend", "def explode arr\n arr2 = []\n \n if arr.grep(Integer).reduce(:+).nil?\n return 'Void!'\n else\n score = arr.grep(Integer).reduce(:+)\n score.times { arr2 << arr }\n return arr2\n end\nend", "def biggest_number(array_of_integers)\n # TODO\nend", "def convert_array_elements_to_i(array)\n for i in 0..array.length-1\n array[i] = array[i].to_i\n end\nend", "def array_sum(arr)\n if arr.empty?\n 0\n else\n arr.reduce(:+)\nend\nend", "def plus_minus arr\n positive_count = 0\n negative_count = 0\n zero_count = 0\n arr.each do |val|\n case val <=> 0\n when 1\n positive_count += 1\n when -1\n negative_count += 1\n else\n zero_count += 1\n end\n end\n p positive_count / arr.size.to_f\n p negative_count / arr.size.to_f\n p zero_count / arr.size.to_f\n end", "def sum_checker(array)\n# Check if the array contains at least 2 elements\n if array.length < 2\n false\n else\n# Iterate over the array to check if the array has a -num (num and -num add up to zero)\n array.each do |num|\n return true if array.include?(-num)\n end\n end\n false\nend", "def missing_numbers(arr)\n new_arr = []\n (arr[0]...arr[-1]).each do |num|\n if !arr.include?(num)\n new_arr << num\n end\n end\nend", "def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend", "def sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "def missing_numbers(nums)\n (nums.first..nums.last).to_a - nums\nend" ]
[ "0.7417678", "0.74021983", "0.72484815", "0.7217035", "0.7144029", "0.70300347", "0.70143604", "0.6995353", "0.6950198", "0.69414586", "0.6934746", "0.6897065", "0.6882831", "0.6862095", "0.6861659", "0.6860734", "0.68400455", "0.68379444", "0.68257815", "0.6823499", "0.6814095", "0.681019", "0.68055624", "0.67969847", "0.6793336", "0.67833567", "0.67766", "0.67713124", "0.6771303", "0.6760342", "0.67500556", "0.6735479", "0.6711377", "0.6697596", "0.6691497", "0.6668393", "0.66609746", "0.66524833", "0.6642574", "0.6640791", "0.66357076", "0.6634972", "0.6595997", "0.65928155", "0.65846103", "0.65767306", "0.65697354", "0.6569361", "0.6565469", "0.65640134", "0.65522873", "0.6549748", "0.65412676", "0.6531291", "0.6526095", "0.65201265", "0.6519658", "0.65162283", "0.6488689", "0.64852566", "0.64852566", "0.64837897", "0.6479934", "0.64745754", "0.6468212", "0.6461299", "0.64603144", "0.64581454", "0.64555734", "0.64393836", "0.642467", "0.64237237", "0.64236283", "0.64204663", "0.6408315", "0.6408315", "0.64062923", "0.6406061", "0.6402606", "0.6395834", "0.63925874", "0.6386991", "0.6378589", "0.6375179", "0.6373939", "0.63738364", "0.6367586", "0.63592726", "0.6358342", "0.6355685", "0.63495356", "0.63478655", "0.6343791", "0.6341819", "0.63346875", "0.6332471", "0.6329263", "0.63255364", "0.63227725", "0.6318129", "0.63127494" ]
0.0
-1
Returns server hostnames and IDs, suitable for caching.
def card_tags select('id, hostname').inject({}) do |hash, s| hash[s.hostname] = { server_id: s.id } hash end.with_indifferent_access end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_server_hosts\n [server_host]\n end", "def servers\n @servers.keys\n end", "def server_structs\n array = []\n if @struct.hosts\n @struct.hosts.count.times do |i|\n array << Lib.memcached_select_server_at(@struct, i)\n end\n end\n array\n end", "def servers\n servers_by_name.values\n end", "def servers\n list = []\n Penctl.execute(@pen, \"servers\", 5).each do |l| \n server = Penctl.parse_server_line(l)\n list[server[:slot]] = server\n end\n list.compact\n end", "def servers\r\n @servers.values\r\n end", "def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend", "def non_ha_server_identities\n group_instance.server_identities.uniq\n end", "def all_servers\n if @all_servers_cache.nil?\n @all_servers_cache=[]\n CLOUD_NAME.keys.each do |name|\n read(\"servers/#{name.to_s.upcase}\")[:data].each do |i|\n @all_servers_cache.push(i)\n end\n end\n end\n return @all_servers_cache\n end", "def servers\n servers_for\n end", "def servers\n @_servers ||= []\n end", "def servers\n @_servers ||= []\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "def list_known_servers\n connect.servers.all\n end", "def server_id\n @host.id\n end", "def server_hash\n @server_hash ||= {}.tap do |h|\n num_members.times do |idx|\n h[\"server.#{idx}\"] = \"127.0.0.1:#{base_port + FOLLOWER_PORT_OFFSET + idx}:#{base_port + LEADER_PORT_OFFSET + idx}\"\n end\n end\n end", "def servers\n @config['servers'].map { |server| server.split(/:/) }\n end", "def servers\n server_structs.map do |server|\n inspect_server(server)\n end\n end", "def servers\n @servers ||= execute_remote!(command(:servers)).each_line.map { |line| JSON.parse line }\n end", "def get_ids(host)\n node_uid, site_uid, grid_uid, _tdl = host.split('.')\n cluster_uid, node_num = node_uid.split('-')\n ids = { 'node_uid' => node_uid, 'site_uid' => site_uid, 'grid_uid' => grid_uid, 'cluster_uid' => cluster_uid, 'node_num' => node_num }\n return ids\nend", "def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end", "def get_servers\n\n if @settings.auto_server_ranking\n\n @self_auto_ranking = 'y'\n\n # if possible fetch server ranked list from cache\n path = get_cache_base_path() + File::SEPARATOR + 'servers'\n\n if File.readable?(path) &&\n (@settings.auto_server_ranking_lifetime == 0 ||\n File.mtime(path) > (Time.now() -\n (60 + [-5,5].sample)*@settings.auto_server_ranking_lifetime))\n\n servers = JSON.parse(File.read(path), :symbolize_names => true)\n\n if !servers.nil?\n @ranking_status = 'A'\n return servers\n end\n\n end\n\n # no or expired server ranked list - rank servers\n servers = rank_servers()\n\n if !servers.nil?\n return servers\n end\n\n end\n\n # check if manual list is cached or not\n # manual list is cached and used for some time when top server fails\n path = get_cache_base_path() + File::SEPARATOR + 'servers-manual'\n if File.readable?(path) &&\n @settings.server_phaseout_lifetime > 0 &&\n File.mtime(path) >\n (Time.now() - (60 + [-5,5].sample)*@settings.server_phaseout_lifetime)\n\n servers = JSON.parse(File.read(path), :symbolize_names => true)\n\n if !servers.nil?\n @ranking_status = 'M'\n return servers\n end\n\n end\n\n # default list\n @ranking_status = 'D'\n return @settings.servers\n\n end", "def get_servers\n\t\t\tbegin\n\t\t\t\tresp = @rs_conn.get('/servers')\n\n\t\t\t\t# 200 Success :: anything else is failure\n\t\t\t\tunless resp.code == \"200\"\n\t\t\t\t\traise \"Error requesting server list. Error code #{resp.code}\"\n\t\t\t\tend\n\t\t\t\t# Convert the output to json\n\t\t\t\tserver_list = JSON.parse(resp.body)\n\t\t\t\treturn server_list\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend", "def get_puppetdb_hosts\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes\")\n curl.get\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['name'] }\n @puppetdb_hosts = servers_array\n end", "def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend", "def hostnames\n @machines.each_with_index.map do |_, number|\n \"#{::Chef.node.run_state['fragments']['cluster']['name']}-#{number}\"\n end\n end", "def name_servers\n Array(@gapi.name_servers)\n end", "def name_servers\n response = @client.rest_get(@data['uri'] + '/nameServers')\n response.body\n end", "def select_server\n compute.servers.map { |s| [s.name, s.id] }\n end", "def server_hosts\n return [:default] if @resource[:server_hosts] &&\n @resource[:server_hosts][0] == :default &&\n @property_hash[:server_hosts] ==\n @aaa_group.default_servers\n @property_hash[:server_hosts]\n end", "def memcached_servers\n %w(127.0.0.1:11211)\n end", "def lookup_addresses(data)\n return @servers\n end", "def servers\n tuples = config.scan(SERVER_REGEXP)\n tuples.map do |(host, mplex, vrf, port, tout, keyfm, key)|\n hsh = {}\n hsh[:hostname] = host\n hsh[:vrf] = vrf\n hsh[:port] = port.to_i\n hsh[:timeout] = tout.to_i\n hsh[:key_format] = keyfm.to_i\n hsh[:key] = key\n hsh[:multiplex] = mplex ? true : false\n hsh\n end\n end", "def all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\n end", "def nameserver_info\n facts.fetch(\"Nameserver\", {})\n end", "def servers\n sync{@servers.keys}\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def get_server_details_map(isrunning)\n servers={}\n get_instances().each { |instance|\n if not isrunning or (isrunning and instance.ready?)\n details={}\n details['name']=instance.tags['name_s']\n details['orgid']=instance.tags['orgid']\n details['group']=instance.tags['group']\n details['private_dns_name'] = instance.private_dns_name\n details['role']\t= instance.tags['role']\n details['public_dns_name'] = instance.dns_name\n details['id'] = instance.id\n details['zone'] = instance.availability_zone\n details['device_mappings'] = Array.new\n instance.block_device_mapping.each { |mapping|\n details['device_mappings'] << mapping['deviceName']\n }\n servers[instance.private_dns_name] = details\n end\n }\n return servers\n end", "def servers(service_id)\n request :get, \"/services/#{service_id}/servers\"\n end", "def servers\n configuration.servers\n end", "def servers_detailed()\n return get_request(address(\"/servers/detail\"), @token)\n end", "def host_ids\n array = Array.new\n\n self.each(\"HOSTS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def server_info()\n #This is a stub, used for indexing\n end", "def managed_list(inst_id)\n uri = URI.parse(@url + \"/#{inst_id}/servers\") unless @server_name\n uri = URI.parse(@url + \"/#{inst_id}/servers/\" + @server_name) if @server_name\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def hosts\n @hosts.values\n end", "def services\n services = RingyDingy::RingServer.list_services\n return [] if services.empty?\n\n services = RingyDingy::RingServer.list_services.values.first.uniq\n\n rrc_servers = services.select do |_, klass,|\n klass == RailsRemoteControl::Server::RINGY_DINGY_SERVICE\n end\n\n rrc_servers.map do |_, _, server, name|\n host, pid, = name.split '_', 3\n Server.new host, pid.to_i, server\n end\n end", "def getHostInfo(srv=nil)\n return [nil,nil] if srv.nil?\n resolver=Resolv::DNS.new\n all=resolver.getresources(srv,Resolv::DNS::Resource::IN::SRV)\n return [nil,nil] if all.length==0\n rec=all[(rand(all.length)+1).to_i-1]\n return [ rec.target.to_s, rec.port.to_i ]\n end", "def getAllServers(targethost = Model::TARGETHOST)\n if @@serverList.nil?\n @@serverList = ZMProv.new('-l', 'gas', targethost).run[1].split(/\\n/)\n end\n \n @@serverList\n end", "def other_server_hosts\n @other_server_hosts ||= all_server_hosts.reject {|x| x == server_host}\n end", "def servers\n gateway_check\n @servers\n end", "def get_nameservers (host)\n\t\tputs \"Retrieve a list of authoritative name server for: #{host}\" if @verbose\n\t\tbegin\n\t\t\tdomain=get_domain_root(host)\n\t\t\tw=Wmap::Whois.new\n\t\t\tns = w.query(domain).nameservers.map! { |x| x.name }\n\t\t\tif ns.empty?\n\t\t\t\tputs \"No name server found for domain root: #{domain}\" if @verbose\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\treturn ns\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method get_nameservers for #{host}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def hosts\n @hosts ||= []\n end", "def ssh_hostnames\n ssh_configs.map { |c| c.hostname }.compact.uniq.sort\n end", "def hostnames_for_machine machine\n # Cast any Symbols to Strings\n machine_name = machine.name.to_s\n hostname = machine.config.vm.hostname || machine_name\n\n hostnames = [hostname]\n # If the hostname is a fqdn, add the first component as an alias.\n hostnames << hostname.split('.').first if hostname.index('.')\n # Also add the machine name as an alias.\n hostnames << machine_name unless hostnames.include? machine_name\n\n hostnames\n end", "def discovered_servers\n server_pool.select {|s| s[:discovered] }\n end", "def getServerNames(servers, should_return_all_if_servers_empty)\n regionservers = getRegionServers\n servernames = []\n\n if servers.empty?\n # if no servers were specified as arguments, get a list of all servers\n if should_return_all_if_servers_empty\n servernames = regionservers\n end\n else\n # Strings replace with ServerName objects in servers array\n i = 0\n while i < servers.length\n server = servers[i]\n\n if ServerName.isFullServerName(server)\n servernames.push(ServerName.valueOf(server))\n else\n name_list = server.split(',')\n j = 0\n while j < regionservers.length\n sn = regionservers[j]\n if name_list[0] == sn.hostname && (name_list[1].nil? ? true : (name_list[1] == sn.port.to_s))\n servernames.push(sn)\n end\n j += 1\n end\n end\n i += 1\n end\n end\n\n servernames\n end", "def server_id\n @server_id ||= Gititback::Support.hostname\n end", "def cluster_servers\n endpoint.config.nodes.map { |h| \"#{h[:host]}:#{h[:port]}\" }\n end", "def getRegionServers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.map { |server_name| server_name }\n end", "def servers\n endpoint.config.nodes.map(&:to_s)\n end", "def server_hostname\n @node['serverHostname']\n end", "def servers(backend = nil)\n my_servers = []\n if backend.nil?\n # return all servers\n backend_instances.each_value do | backend|\n my_servers << backend.server_names\n end\n else\n begin\n my_servers = backend_instances[backend].server_names\n rescue KeyError => e\n \"The backend #{backend} is not a valid argument\"\n end\n end\n # return a list of serv\n my_servers.flatten.uniq\n end", "def get_uniq_sites\n\t\tputs \"Getter to retrieve unique sites containing unique IP:PORT key identifier.\" if @verbose=\n\t\t#primary_host_tracker=Wmap::HostTracker::PrimaryHost.instance\n\t\tsites=Hash.new\n\t\t#uniqueness=Hash.new\n\t\thost_tracker=Wmap::HostTracker.instance\n\t\thost_tracker.data_dir=@data_dir\n\t\thost_tracker.hosts_file=host_tracker.data_dir + '/' + 'hosts'\n\t\thost_tracker.load_known_hosts_from_file\n\t\t@known_sites.keys.map do |key|\n\t\t\tport=url_2_port(key).to_s\n\t\t\thost=url_2_host(key)\n\t\t\tmd5=@known_sites[key]['md5']\n\t\t\tcode=@known_sites[key]['code']\n\t\t\tip=host_tracker.local_host_2_ip(host)\n\t\t\tip=host_2_ip(host) if ip.nil?\n\t\t\t# filtering out 'un-reachable' sites\n\t\t\tnext if (code == 10000 or code == 20000)\n\t\t\t# filtering out 'empty' sites\n\t\t\tnext if (md5.nil? or md5.empty?)\n\t\t\tnext if ip.nil?\n\t\t\t# url_new=key\n\t\t\t#if primary_host_tracker.ip_known?(ip)\n\t\t\t#\tp_host=primary_host_tracker.known_hosts[ip]\n\t\t\t#\turl_new=key.sub(host,p_host)\n\t\t\t#end\n\t\t\tid=ip+\":\"+port\n\t\t\t# filtering out duplicates by 'IP:PORT' key pair\n\t\t\tunless sites.key?(id)\n\t\t\t\t#if @known_sites.key?(key)\n\t\t\t\t#\tsites[id]=url_new\n\t\t\t\t#else\n\t\t\t\t\t# Further filtering out redundant site by checking MD5 finger-print\n\t\t\t\t\t#unless uniqueness.key?(md5)\n\t\t\t\t\t\tsites[id]=key\n\t\t\t\t\t#\tuniqueness[md5]=true\n\t\t\t\t\t#end\n\t\t\t\t#end\n\t\t\tend\n\t\tend\n\t\t#primary_host_tracker=nil\n\t\thost_tracker=nil\n\t\treturn sites.values\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend", "def host_id\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "def index\n @servers = @site.servers\n end", "def host_identities\n identities = []\n @known_host_identities = Hash.new\n\n @host_key_files.each do |file|\n if @key_existence_tester.readable?( file )\n begin\n key = @keys.load_public_key( file + \".pub\" )\n identities.push key\n @known_host_identities[ key ] =\n { :from => :file, :file => file }\n rescue Exception => e\n @log.warn \"could not load public host key file \" +\n \"'#{file}.pub' (#{e.message} [#{e.class}])\" if @log.warn?\n end\n end\n end\n\n identities\n end", "def getServers(admin)\n serverInfos = admin.getClusterStatus().getServerInfo()\n servers = []\n for server in serverInfos\n servers << server.getServerName()\n end\n return servers\nend", "def host_list\n return @host_list if defined?(@host_list)\n\n if !self.hosts.blank?\n @host_list = self.hosts.split(/[,\\s]+/).compact\n else\n @host_list = []\n end\n\n @host_list\n end", "def servers # Only in Ruby API (1.3 compatible)\n\t\t@settings.servers\n\tend", "def hosts\n `#{cmk} --list-hosts`.split(/\\n/).sort\n end", "def server_id(server_name)\n Puppet.warning \"[DEPRICATED]: Use find_match in common.rb\"\n @compute.servers.each do |server|\n return server.id if server.name == server_name\n end\n return nil\n end", "def private_hostname_of(server)\n server[:fqdn]\n end", "def available_servers\n authenticate_user!\n @rackspace_servers = Server.rackspace_servers\n end", "def servers\n return self.bare_metal_servers + self.virtual_servers\n end", "def [](key)\r\n return @servers[key]\r\n end", "def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n hsh = {}\n tuples.map do |(vrf, host, prefer, minpoll, maxpoll, sourcei, key)|\n hsh[host] = {\n vrf: vrf,\n prefer: !prefer.nil?,\n minpoll: minpoll.nil? ? nil : minpoll.to_i,\n maxpoll: maxpoll.nil? ? nil : maxpoll.to_i,\n source_interface: sourcei,\n key: key.nil? ? nil : key.to_i\n }\n hsh[host]\n end\n\n { servers: hsh }\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def details\n data = servers_client.get(server_path, json_headers).body\n JSON.parse(data)['server']\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end", "def servers\n gateway_check\n unavailable_servers_check\n @servers\n end", "def servers\n result = Gorillib::ModelCollection.new(item_type: Ironfan::Dsl::Server, key_method: :full_name)\n facets.each{ |f| f.servers.each{ |s| result << s } }\n result\n end", "def hosts; end", "def hosts; end", "def hosts; end", "def servers_with_fact(factname)\n servers = {}\n response = fact_request('facts', factname)\n response.each do |r|\n hostname = r['certname']\n factname = r['value']\n servers[hostname] = factname\n end\n\n servers\nend", "def servers\n server_structs.each do |server|\n def server.alive?\n next_retry <= Time.now\n end\n end\n end", "def get_server_tags \n tags_list = `rs_tag --list`\n # remove unnecessary \\n from the tags list \n tags_list.gsub(/\\n/, \" \").split(\",\")\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def getServerName(servers, hostname, port)\n servername = nil\n upperCaseHostname = hostname.upcase;\n for server in servers\n hostFromServerName, portFromServerName = getHostPortFromServerName(server)\n hostFromServerName = hostFromServerName.upcase\n if hostFromServerName == upperCaseHostname and portFromServerName == port\n servername = server\n break\n end\n end\n raise ArgumentError, \"Server %s:%d not online\" % [hostname, port] unless servername\n return servername\nend", "def unique_scanned_hosts\n hosts = []\n scanned_hosts = self.show_scanned_hosts\n scanned_hosts.each do |sh|\n sh.hosts.split(\", \").each do |host|\n if host.scan(\"0/24\").empty?\n hosts << host.gsub(/\\s+/, \"\")\n else\n host = host.gsub(/\\s+/, \"\").gsub(\"0/24\", \"\")\n (0..255).each do |last_digit|\n tmp_host = \"#{host}#{last_digit}\" \n hosts << tmp_host\n end\n end\n end\n end\n return hosts.uniq.sort\n end", "def server_host\n Socket.gethostname\n end", "def formatted_servers\n static_ips = connect.describe_addresses.addresses.map(&:public_ip)\n\n servers.select { |server| include_server? server }.map do |server|\n o = {\n date: server.launch_time.to_s,\n az: server.placement.availability_zone,\n id: server.instance_id,\n subnet: [server.subnet_id, \"(#{subnet_name[server.subnet_id]})\"].join(' '),\n priv_ip: server.private_ip_address,\n type: server.instance_type,\n vpc: server.vpc_id,\n state: opts[:csv] ? server.state.name : colorize_state(server.state.name).bold\n }\n\n if opts[:groups]\n groups_string =\n server.security_groupserver.map { |g| \"#{g.group_id} (#{g.group_name})\" }.join(', ')\n\n # Shorten the groups string to a manageable length\n unless (opts[:csv] || opts[:all_groups]) && groups_string.length > GROUPS_MAX_LENGTH\n groups_string = groups_string[0..GROUPS_MAX_LENGTH] + '...'\n end\n\n o[:groups] = groups_string\n end\n\n if server.vpc_id && opts[:vpc]\n o[:vpc] = [server.vpc_id, \"(#{vpc_name[server.vpc_id]})\"].join(' ')\n end\n\n if server.public_ip_address\n static_ip = static_ips.include?(server.public_ip_address) ? '(S)' : '(D)'\n o[:pub_ip] = [server.public_ip_address, static_ip].join(' ')\n end\n\n # Always include the name tag regardless of cli args (for searching)\n (opts[:tags] | %w[tag_Name]).each do |tag|\n next unless (k = server.tags.find { |t| t.key == tag })\n\n o[\"tag_#{tag}\".to_sym] = k.value\n end\n\n o\n end\n end", "def configured_servers\n\t\thosts = self.configured_hosts\n\t\treturn Mongrel2::Config::Server.where( id: hosts.select(:server_id) )\n\tend", "def server_info\n check_connection\n @protocol.server_info\n end", "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end", "def server_instances(refresh=false)\n if @server_instances.nil? or refresh\n @server_instances = {}\n backend_instances.each do |key, backend|\n @server_instances = @server_instances.merge(backend.servers)\n end\n end\n @server_instances\n end", "def servers=(servers)\r\n @servers = {}\r\n servers.each{|s| @servers[s.host] = s}\r\n end" ]
[ "0.71656597", "0.7109295", "0.7089845", "0.69327396", "0.6888951", "0.67374986", "0.6675617", "0.66313446", "0.662831", "0.6616807", "0.6510707", "0.6510707", "0.64835477", "0.64835477", "0.6445302", "0.6426511", "0.6417283", "0.6411443", "0.64056474", "0.63945854", "0.6369555", "0.6363646", "0.6351081", "0.6338101", "0.633386", "0.6300186", "0.6276385", "0.62755686", "0.625039", "0.6240349", "0.62360775", "0.62260145", "0.622595", "0.6204584", "0.6198674", "0.61677873", "0.6164998", "0.6134475", "0.60979277", "0.60621977", "0.60328186", "0.60317576", "0.6008099", "0.59910846", "0.59893066", "0.5988633", "0.598106", "0.59781957", "0.5962278", "0.5960967", "0.59609145", "0.5958884", "0.59472513", "0.59296274", "0.59259474", "0.5922985", "0.5918847", "0.5908616", "0.5907708", "0.58892214", "0.58878434", "0.58830446", "0.5867233", "0.5850151", "0.5831155", "0.5824929", "0.57970124", "0.579567", "0.57832646", "0.57773024", "0.57668155", "0.57634735", "0.5760773", "0.57583785", "0.57394296", "0.5734353", "0.5731673", "0.57242894", "0.5722272", "0.5720184", "0.5719507", "0.5719507", "0.57188165", "0.56998056", "0.5690339", "0.5690339", "0.5690339", "0.56872207", "0.5686815", "0.56831396", "0.56824285", "0.56808805", "0.5664933", "0.5663439", "0.5653437", "0.56476563", "0.56405514", "0.56354076", "0.56242526", "0.56206506" ]
0.6065139
39
Returns absolute and movingaverage values of time to repair ()complete unplanned cards) since supplied time.
def time_to_repair(since_time, unit: :second) total_repair_time = 0 total_repairs = 0 ttr = { point_values: {}, moving_averages: {} } # Unplanned cards created after since_time, in order of creation. cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNPLANNED).order('cards.created_at DESC').map do |unplanned_card| lead_time = unplanned_card.lead_time if lead_time > 0 total_repairs += 1 total_repair_time += time_in_unit(lead_time, unit) ttr[:point_values][unplanned_card.created_at] = time_in_unit(lead_time, unit) ttr[:moving_averages][unplanned_card.created_at] = total_repair_time / total_repairs end end ttr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_time(time)\n resource = @initial\n\n puts \"[START] initial: #{initial}\" if COPIOUS_DEBUGGING\n puts \"[START] time: #{time}\" if COPIOUS_DEBUGGING\n\n if intervals_at_time(@harvesters, time).size > 1\n generate_pairs(intervals_at_time(@harvesters, time)).each_with_index do |pair, index|\n puts \"[DEBUG] #{index}: STARTING LOOP\" if COPIOUS_DEBUGGING\n start_time = pair[0]\n next_time = pair[1]\n puts \"#{index}: start_time: #{start_time}\" if COPIOUS_DEBUGGING\n\n harvesters = @harvesters[start_time]\n puts \"#{index}: harvesters: #{harvesters}\" if COPIOUS_DEBUGGING\n\n period = next_time - start_time\n puts \"#{index}: period: #{period}\" if COPIOUS_DEBUGGING\n\n harvested = time_to_resource(period, harvesters)\n resource += harvested\n puts \"#{index}: harvested: #{harvested}\" if COPIOUS_DEBUGGING\n\n consumed = consumed_in_interval(start_time, next_time)\n resource -= consumed\n puts \"#{index}: consumed: #{consumed}\" if COPIOUS_DEBUGGING\n\n puts \"#{index}: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n else\n resource -= consumed_at_time(0)\n puts \"0: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n\n if resource < 0\n raise(InvalidEconomyError, \"The Starcraft economy does not allow deficit spending (deficit of #{resource} #{@type} at #{time} seconds).\")\n end\n\n puts \"[FINISH] at_time: #{resource}\" if COPIOUS_DEBUGGING\n resource\n end", "def time_difference(distance, time)\n etd = base_time + departure_time.minutes\n eta = etd + journey_pattern.time_on_path(distance)\n if eta - 1.minute <= time\n if time <= eta + 1.minute\n # We are for the most part, on time\n return 0;\n else\n logger.info \"LATE!!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # we are late (positive) in minutes\n return ((time - eta)/1.minute).to_i\n end\n else\n logger.info \"EARLY!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # We are early (negative)\n return ((time - eta)/1.minute).to_i\n end\n end", "def avg_time_lap\n times = []\n self.voltas.each { |lap_num, lap_stat| times << time_in_ms(lap_stat[:tempo])}\n return ms_to_min(get_avg(times))\n end", "def find_time_asleep\n @total_time_asleep = 0\n @wake_times.each_with_index do |wake_time, index|\n @total_time_asleep += ( wake_time - @sleep_times[index] )\n end\n end", "def time_survived\n return 0 if self.is_oz\n tag = self.killing_tag\n real_begins = self.game.game_begins - self.game.utc_offset\n return [0, tag.datetime - real_begins].max unless tag.nil?\n return [0, Game.now(self.game) - real_begins].max\n end", "def time_between_failures(since_time, unit: :second)\n total_uptime = 0\n total_failures = 0\n tbf = { point_values: {}, moving_averages: {} }\n\n # Unplanned cards created after since_time, in order of creation.\n unplanned_cards = cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNPLANNED).order('cards.created_at DESC')\n\n unplanned_cards.each_with_index do |unplanned_card, index|\n previous_unplanned_card = unplanned_cards[index + 1]\n\n if previous_unplanned_card && previous_unplanned_card.completed_at\n uptime = unplanned_card.created_at - previous_unplanned_card.completed_at\n total_failures += 1\n total_uptime += time_in_unit(uptime, unit)\n\n tbf[:point_values][unplanned_card.created_at] = time_in_unit(uptime, unit)\n tbf[:moving_averages][unplanned_card.created_at] = total_uptime / total_failures\n end\n end\n\n tbf\n end", "def average_missed_call_duration\n average_duration(missed_contacts, 'arrived', 'call_ended')\n end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def calc_average_distance(time_period)\n return 0 if time_period.size <= 1 # Need at least 2 cars\n sum = 0\n for i in 0...(time_period.size - 1)\n sum += calc_distance(time_period[0], time_period[1])\n end\n return sum / (time_period.size - 1)\n end", "def update_time_worked\n\n time_entries = self.time_card.time_entry\n total_hours = 0\n # Ordering by time so the total hours can be calculated.\n # An odd array will have [start_time1, end_time1, start_time2]\n # and the total_hours_worked = start_time1 - end_time1\n # An even array will have [start_time1, end_time1, start_time2, end_time 2]\n # and the total_hours_worked = (start_time1 - end_time1) + (start_time2 - end_time2)\n\n time_entries = time_entries.order(time: :asc)\n time_entries_count = time_entries.count\n\n i = 0\n while i < time_entries_count and i+1 < time_entries_count\n start_time = time_entries[i].time\n end_time = time_entries[i+1].time\n i = i+2\n total_hours = total_hours + time_diff(start_time, end_time).to_i\n end\n\n if time_entries_count == 1\n self.time_card.update_attribute(:total_hours_worked, 0)\n else\n self.time_card.update(:total_hours_worked => total_hours)\n end\n\n end", "def fix_negative_times\n proto_record[:absolute_times] = proto_record[:times_of_day].map do |datetime|\n next unless datetime\n\n seconds = datetime - effort_start_time\n seconds_in_day = (1.day / 1.second)\n adjustment = seconds&.negative? ? (seconds.to_i / seconds_in_day).abs * seconds_in_day : 0\n datetime + adjustment\n end\n end", "def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n 0\n else\n time.set_time_to( @closing_time ) - start_time(time)\n end\n end", "def next_closest_time(time)\n store = Array.new(9)\n past = []\n\n time.split('').each do |num| \n if (num.ord >= 48 && num.ord <= 57)\n store[num.to_i] = true \n past.push(num.to_i)\n end\n end\n\n future = past\n place = 3\n until (place == -1)\n limit = find_limit(place, past[place])\n if next_greatest(store, past[place], limit)\n if place == 1 && next_greatest(store, past[place], limit) >= 5 && future[0] == 2\n next_num = next_greatest(store, 0, 2)\n future[0] = next_num\n future[1] = next_num\n else \n future[place] = next_greatest(store, past[place], limit)\n end\n break\n else\n future[place] = lowest(store)\n place -= 1\n end\n end\n\n future[0..1].join(\"\").to_s + \":\" + future[2..3].join(\"\").to_s\nend", "def sum_time(time)\n @ip_object = Ip.find_by_ip(@ip)\n if @ip_object.nil?\n Ip.create(ip: @ip, time: 0)\n @ip_object = Ip.find_by_ip(@ip)\n end\n # debugger\n @ip_object.update_attribute(:time, @ip_object.time + time)\n if @ip_object.time >= 60\n Reservation.where(ip: @ip).each do |reservation|\n reservation.seat.reserved = false\n reservation.seat.prereserved = false\n reservation.seat.save\n reservation.destroy\n end\n @ip_object.update_attribute(:time, 0)\n end\n\n end", "def average\n return @@average_times.inject(:+).to_f / @@average_times.size\n end", "def average_driving_time\n if self.total_duration > 0\n ((self.total_driving_time / self.total_duration) * 100)\n else\n 0\n end\n end", "def schedule_impact\n if self.time_added?\n self.hours\n elsif time_removed?\n self.hours * -1.0\n else\n 0.0\n end\n end", "def average_pricessing_time(mashine_number, remainded_jobs)\n jobs_count = remainded_jobs.count.to_f\n processing_times_for_mashine = processing_times.row(mashine_number)\n\n remainded_jobs\n .map { |job_number| processing_times_for_mashine[job_number] }\n .sum / jobs_count\n end", "def time_until_hungry\n time_since_recent_action = if time_since_last_burrito < time_since_active\n time_since_last_burrito\n else\n time_since_active\n end\n\n x = greedy_time - time_since_recent_action.to_i\n x > 0 ? x : 0\n end", "def takeoff_avarage_acceleration(takeoff_distance,takeoff_time)\n takeoff_avarage_acceleration = (2*takeoff_distance)/(takeoff_time*takeoff_time)\n return takeoff_avarage_acceleration \nend", "def pred_time\n @time = (@time - @delta).max(0)\n end", "def as_of!(time)\n _as_of(time).first!\n end", "def as_of!(time)\n _as_of(time).first!\n end", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_to_enqueue_list(missed_times)\n end", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_to_enqueue_list(missed_times)\n end", "def updateTime\n\n # Cleanup phase\n @timestamps << @activestamps.map {|s| s.to_f}\n\n t1, t2, t3, t4, cfs, cfd = @activestamps\n @log.debug \"t1: #{t1.to_f}, \"\\\n \"t2: #{t2.to_f}, \"\\\n \"t3: #{t3.to_f}, \"\\\n \"t4: #{t4.to_f}, \"\\\n \"cfs: #{cfs.to_f}, \"\\\n \"cfd: #{t4.to_f}\"\n\n # Calculate link delay and average link delay\n delay = ((t2 - t1) + (t4 - t3) - cfs - cfd) / BigDecimal.new(2)\n @delay << (delay.to_f > 0 ? delay : delay * -1)\n delay_avg = @delay[-1]\n if @delay_avg[-1]\n one = BigDecimal.new(1)\n delay_avg = ALPHA * @delay_avg[-1] + (one - ALPHA) * @delay[-1]\n end\n @delay_avg << delay_avg\n\n # Calculate phase error and average phase_error\n @phase_error << ((t2 - t1) - (t4 - t3) - cfs + cfd) / BigDecimal.new(2)\n\n # Calculate average phase error if multiple data points exists\n avg = @phase_error[-1]\n if @phase_err_avg[-1]\n one = BigDecimal.new(1)\n avg = ALPHA * @phase_err_avg[-1] + (one - ALPHA) * @phase_error[-1]\n end\n @phase_err_avg << avg\n\n # Calculate frequency error\n distance = -2\n if @timestamps[distance]\n ot1 = @timestamps[distance][0]\n ot2 = @timestamps[distance][1]\n ode = @delay_avg[distance].to_f\n de = @delay_avg.last.to_f\n ocfs = @timestamps[distance][4].to_f\n error = (t1.to_f - ot1)/((t2.to_f + de + cfs.to_f)-(ot2 + ode + ocfs))\n # Do some hard filtering of data\n if error < 2 && error > 0.5\n @freq_error << error\n else\n puts \"ERROR ERROR ERROR ERROR \" + error.to_s # Why?\n @freq_error << @freq_error[-1] || 1\n end\n end\n\n # Calculate average frequency error if multiple data points exists\n if @freq_error[-1] && @flipflop - 1 < @flipflopeach\n @freq_err_avg << @freq_err_avg.last\n elsif @freq_error[-1]\n avg = @freq_error[-1]\n if @freq_err_avg[-1]\n one = BigDecimal.new(1)\n avg = ALPHA_F * @freq_err_avg[-1] + (one - ALPHA_F) * @freq_error[-1]\n end\n @freq_err_avg << avg\n end\n\n # TODO: Update system\n @log.info \"Delay: #{@delay.last.to_f} \\t\" \\\n \"Delay_avg: #{@delay_avg.last.to_f} \\t\" \\\n \"phase_err: #{@phase_error.last.to_f} \\t\"\\\n \"phase_err_avg: #{@phase_err_avg.last.to_f}, \\t\"\\\n \"freq_err: #{@freq_error.last.to_f} \\t\"\\\n \"freq_err_avg: #{@freq_err_avg.last.to_f}\"\n\n # Adjust phase\n adjOffset(@phase_err_avg.last.to_f) if @flipflop < @flipflopeach\n\n # Adjust frequency when we have some point of measurement and when we can\n # actually make adjustments in the flipflop thing.\n if @freq_err_avg[-10] && @flipflop >= @flipflopeach\n adjFreq(@freq_err_avg.last.to_f)\n end\n\n # Final cleanup\n @activestamps.fill(nil,0,4)\n\n # Adjust flipflop\n @flipflop = (@flipflop + 1) % (2 * @flipflopeach)\n end", "def interrupted_time\n interrupts.inject(0) { |sum, i| i.approved? ? (sum + i.current_duration) : sum }\n end", "def contact_time(time)\n return '' if !time.is_a?(Time) and !(Float Integer).include?(time_offset.class)\n time - time_offset\n rescue\n time\n end", "def average_response_time\n return summary_average[:average_response_time]\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def avg_time\n self[:avg_time] || Tournament.current.default_avg_time\n end", "def process_time(player, start_time, end_time)\n t = time_duration(player.mytime, start_time, end_time)\n\n player.mytime += @fischer\n player.mytime -= t\n if (player.mytime < 0)\n player.mytime = 0\n end\n\n return t\n end", "def before( time )\n\t\treturn time - self\n\tend", "def before( time )\n\t\treturn time - self\n\tend", "def height_at(time)\n height_entries = self.tracker_entries.joins(:tracker).where(\"trackers.name = ?\", \"height\")\n closest_in_past = height_entries.where(\"logged_on < ?\", time.utc).order(:logged_on).last\n \n if closest_in_past\n closest_in_past.quantity\n end\n end", "def avg_time(data)\n #pp data\n total = 0\n count = 0\n data.each do |_, list|\n list.each do |v|\n unless v[\"value\"].empty?\n hour,min = v[\"value\"].split(':')\n if hour.to_i >= 21\n total += hour.to_i * 60 + min.to_i\n count += 1\n elsif hour.to_i <= 6\n total += 24*60 + hour.to_i * 60 + min.to_i\n count += 1\n end\n end\n end\n end\n avg_hour = total / count / 60 % 24\n avg_min = total / count % 60\n puts \"#{avg_hour}:#{avg_min}\"\nend", "def time_data column = \"calories\"\n return [] if !valid?\n return [] if ![\"calories\", \"fat\", \"carbs\", \"protein\"].include?(column)\n\n scope_multiplier = 1\n scope_multiplier = length_scope == \"week\" ? 7 : scope_multiplier\n scope_multiplier = length_scope == \"month\" ? 30 : scope_multiplier\n scope_multiplier = length_scope == \"year\" ? 360 : scope_multiplier\n\n last = num.to_i * scope_multiplier\n\n # First, we get the days\n days = FoodEntry.where(user_id: user_id)\n .group_by_day(:day_ts, default_value: 0, last: last)\n .sum(column)\n .to_a\n\n return days if length_scope == \"day\"\n\n # Group by the weeks\n if length_scope == \"week\"\n weeks = days.group_by_week() { |d| d[0] }\n return average_of weeks\n end\n\n # Group by months\n if length_scope == \"month\"\n months = days.group_by_month { |d| d[0] }\n return average_of months\n end\n\n # Group by year\n if length_scope == \"year\"\n years = days.group_by_year { |d| d[0] }\n return average_of years\n end\n\n return []\n end", "def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end", "def look_ahead(board, current_hand, ai_hand)\n #n = NegamaxAgent.new(board, current_hand, ai_hand)\n #n_suggested_move = n.invoke\n #n_suggested_card = n_suggested_move.first\n #n_x = n_suggested_move[1]\n #n_y = n_suggested_move[2]\n #n_s = n_suggested_move[3]\n\n #puts \"DEBUG: negamax suggested #{@player_hand.key(n_suggested_card)} @ #{n_x + 1}, #{n_y + 1} with score of #{n_s}\"\n #return\n\n available_cards = current_hand.values.compact\n available_spaces = board.open_spaces\n possible_moves = available_cards.product(available_spaces)\n\n best_moves = []\n value_of_best_move = -10\n\n possible_moves.each do |card, space|\n x, y = space\n value = board.next_state(card, x, y).score\n if value > value_of_best_move\n best_moves = [[card, x, y]]\n value_of_best_move = value\n elsif value == value_of_best_move\n \tbest_moves << [card, x, y]\n end\n end\n\n chosen_move = best_moves.sample\n card, x, y = chosen_move\n\n puts \"HINT: placing #{current_hand.key(card).rstrip} at #{x+1}, #{y+1} gives a good score of #{value_of_best_move}\"\n end", "def display_time_at\n gm = self.good_memories.count\n bm = self.bad_memories.count\n lifespan = (Time.now.to_i - self.created_at.to_i)\n unless gm == 0\n shift = (lifespan * (bm + 1)) / gm\n return (Time.now.to_i - shift)\n else\n shift = lifespan * (bm + 1)\n return (Time.now.to_i - shift)\n end\n end", "def racepace(time,distance)\n\t\tpace_total = (time[:hours].to_i * 60 + time[:minutes].to_i + time[:seconds].to_f / 60) / distance\n\t\t# pace = (time[:hours].to_i * 60 + time[:minutes] + time[:seconds] / 60) / distance\n\t\tpace_seconds = ( pace_total % 1 * 60 ).truncate\n\t\tif pace_seconds < 10\n\t\t\tpace_seconds = \"0\"+pace_seconds.to_s\n\t\telse\n\t\t\tpace_seconds = pace_seconds.to_s\n\t\tend\n\t\tpace = pace_total.truncate.to_s + \":\" + pace_seconds\n\t\tpace\n\tend", "def average_after_call_duration\n average_duration(closed_contacts, 'call_ended', 'after_call_ended')\n end", "def average_queue_duration_by_hour\n gmt_offset = Time.now.getlocal.gmt_offset\n select = [\n \"EXTRACT(HOUR FROM contacts.arrived + '#{gmt_offset} seconds') AS hour\",\n 'AVG(EXTRACT(EPOCH FROM contacts.forwarded_to_agent - contacts.arrived)) AS avg_duration'\n ].join(',')\n data = answered_contacts.select(select).group('hour')\n\n result = Array.new(24, 0)\n data.each { |d| result[(d['hour'])] = d['avg_duration'].round }\n result\n end", "def peaktime\n time.change(hour: 17)\n end", "def offset(time)\n time\n end", "def at_time_price_amount_for(time,currency,country=nil)\n sups=self.supplies_with_default_tax.select { |p| p[:currency]==currency }\n if country\n sups=sups.select{|p| p[:territory].include?(country)}\n end\n if sups.length > 0\n # exclusive\n sup=sups.first[:prices].select { |p|\n (!p[:from_date] or p[:from_date].to_date <= time.to_date) and\n (!p[:until_date] or p[:until_date].to_date > time.to_date)\n }.first\n\n if sup\n sup[:amount]\n else\n # or inclusive\n sup=sups.first[:prices].select { |p|\n (!p[:from_date] or p[:from_date].to_date <= time.to_date) and\n (!p[:until_date] or p[:until_date].to_date >= time.to_date)\n }.first\n\n if sup\n sup[:amount]\n else\n nil\n end\n end\n\n else\n nil\n end\n end", "def calculate_previous_enqueue_time(time)\n parsed_cron.previous_time(time.utc).utc\n end", "def get_adjust_easy_read_time(time)\n minute = DateUtils.epoch_to_minute(time).to_i\n diff = minute % 5 \n time - diff.minutes\n end", "def appellant_time\n # Check if there's a recipient, and if it has a timezone, it it does use that to set tz\n appellant_tz_from_recipient = @hearing.appellant_recipient&.timezone\n return normalized_time(appellant_tz_from_recipient) if appellant_tz_from_recipient.present?\n # If there's a virtual hearing, use that tz even if it's empty\n return normalized_time(@hearing.virtual_hearing[:appellant_tz]) if @hearing.virtual_hearing.present?\n\n # No recipient and no virtual hearing? Use the normalized_time fallback\n normalized_time(nil)\n end", "def before(time)\n time - self\n end", "def report_time time\n end", "def clean_aged(time_now)\n near_past = time_now - @time_window_in_seconds\n @errors = @errors.reverse.select{|time_stamp| time_stamp > near_past }.reverse.to_a\n end", "def adjusted_time(finish_time)\n start_time = matching_start_time(finish_time) || competition_start_time_in_thousands\n finish_time - start_time\n end", "def time\n @time ||= begin\n if Array === first # Distribution\n times.max\n else # Press\n sum\n end\n end\n end", "def calculate_heating_on_time(asof_date, frost_protection_temperature)\n daily_kwh = @school.aggregated_heat_meters.amr_data.one_day_kwh(asof_date)\n average_half_hourly_kwh = daily_kwh / 48.0\n (0..47).each do |halfhour_index|\n if @school.temperatures.temperature(asof_date, halfhour_index) > frost_protection_temperature &&\n @school.aggregated_heat_meters.amr_data.kwh(asof_date, halfhour_index) > average_half_hourly_kwh\n return halfhour_index\n end\n end\n nil\n end", "def risk_global_pheromone_at_time(time, risk)\n\t# where q = [time=10, cost= 10_000, quality=0.0005]\n\t((1 - GLOBAL_EVAPORATION_RATE) * pheromone_at_t_minus_1) + risk_changed_pheromone(time, risk)\nend", "def show_avg_time\n avg_times = []\n RACER_RECORDS.each {|racer| avg_times << [ racer.piloto, racer.avg_time_lap ]}\n @view.display_avg_times(avg_times)\n end", "def total_time(distance, mph)\n time = distance / mph \nend", "def state_time\n\t\tarr = []\n\t\t@state_in_stock.each do |state|\n\t\t\tarr << state.time\n\t\tend\n\t\tarr.shift\n\t\tarr\n\tend", "def time\n end_time - start_time\n end", "def count_time(relevant_line)\n t0 = 0\n time_between = []\n relevant_line.each do |n|\n t1 = Time.parse(n)\n d = t1 - t0\n t0 = t1\n time_between << d\n end\n time_between\nend", "def estimate_at_completion_duration\n return planned_duration - earned_schedule\n end", "def ideal_hit_time\n while (hit_limit.nil? || (hit_limit - hit_count) <= 0) do\n update_rate_limit_status\n # + 1.0 to account for clock skew between computers\n sleep_until(@will_reset_at + 1.0) if (hit_limit == 0)\n end\n blather(\"hits_remaining = #{hit_limit - hit_count}, seconds_remaining = #{will_reset_at - Time.zone.now}\")\n # ideal_time ramps from updated_at to will_reset_at as\n # hit_count goes from 0 to hit_limit.\n linear_intepolate(hit_count, 0, hit_limit, updated_at, will_reset_at)\n end", "def timesheet_value(date_string, start_string, finish_string)\r\n start_time = Time.parse(start_string.strftime('%I:%M%P'))\r\n finish_time = Time.parse(finish_string.strftime('%I:%M%P'))\r\n date = date_string\r\n dollar_value = 0\r\n if date.saturday? or date.sunday?\r\n dollar_value = 47 * (finish_time - start_time) / 1.hours\r\n elsif date.tuesday? or date.thursday?\r\n five_am = Time.parse(\"5:00am\")\r\n five_pm = Time.parse(\"5:00pm\")\r\n # Calculate time between 5am and 5pm, and 'outside' time\r\n total_work_time = (finish_time - start_time) / 1.hours\r\n five_am_to_five_pm_time = time_intersection(start_time, finish_time, five_am, five_pm)\r\n other_work_time = total_work_time - five_am_to_five_pm_time\r\n dollar_value = 25 * five_am_to_five_pm_time + 35 * other_work_time\r\n else\r\n seven_am = Time.parse(\"7:00am\")\r\n seven_pm = Time.parse(\"7:00pm\")\r\n # Calculate time between 7am and 7pm, and 'outside' time\r\n total_work_time = (finish_time - start_time) / 1.hours\r\n seven_am_to_seven_pm_time = time_intersection(start_time, finish_time, seven_am, seven_pm)\r\n other_work_time = total_work_time - seven_am_to_seven_pm_time\r\n dollar_value = 22 * seven_am_to_seven_pm_time + 33 * other_work_time\r\n end\r\n return dollar_value\r\n end", "def after_midnight(time)\n hrs, mins = time.split(':')\n mins_in_hrs = hrs.to_i * 60\n total = mins_in_hrs + mins.to_i\n return 0 if total == 1440\n total\nend", "def average_finish_time(game, nb_game)\n\n#On initialise la somme des nombres de laps\nsomme = 0\n\n#On teste si le nombre de parties > 100, si non on n'accpete pas\n\tif nb_game < 100 then puts \"Il faut un nombre > 100 !\"\n\n#Si oui, on lance nb_parties (en l'occurence 150) fois le jeu (en l'occurence Stairways)\n\telse\n\t\t\tnb_game.times do game\n\t\t\tsomme += stairway\n\t\t\tend\n\n#On affiche la moyenne du nombre de parties\n\t\tputs \"**************************************************************************\"\n\t\tputs \"Le score moyen de vos #{nb_game} parties est de #{somme/nb_game} !\"\n\t\tputs \"**************************************************************************\"\n\n\tend\n\nend", "def remain_time\n rem_time = $time - Time.new\n rem_time.to_i\nend", "def time\n @originalTime.gsub(/[ (AM|PM)]/, '').split(':').map(&:to_f)\n end", "def time_elevation(amount_water, time)\n \tamount_water * time\nend", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def solution(time)\n timeArray = time.split(\".\")\n hours = timeArray[0].to_f()\n min = timeArray[1].to_f()\n if hours > 12\n hours = hours - 12\n end\n\n minDegrees = 360.00 / 60.00 * min\n hourDegrees = 360.00/12.00 * hours\n hourDegreesMin = (360.00 / (12.00 * 60.00)) * min\n hourDegreesResult = hourDegrees + hourDegreesMin\n result = hourDegreesResult - minDegrees\n return result.abs\nend", "def average_predict_time\n\t\treturn @timmer/Float(@predict_call_count)\n\tend", "def compute_average_time_between_invitation_and_rdv_in_days\n cumulated_invitation_delays = 0\n @rdv_contexts.find_each do |rdv_context|\n cumulated_invitation_delays += rdv_context.time_between_invitation_and_rdv_in_days\n end\n cumulated_invitation_delays / (@rdv_contexts.count.nonzero? || 1).to_f\n end", "def as_of(time)\n _as_of(time).first\n end", "def as_of(time)\n _as_of(time).first\n end", "def getavg\r\n\t\tif @duration == 0\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\treturn ((@miles_driven.to_f / @duration)*60)\r\n\t\tend\r\n\tend", "def processing_lag\n time_distance_in_ms(processed_at, scheduled_at)\n end", "def average_speed\n unless (@total_distance == 0) || (@total_driving_time == 0)\n @average_speed = (@total_distance / @total_driving_time).round\n end\n end", "def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end", "def update_card_totalhours\n if timecard.time_entries.count == 2\n # yup there is a pair of entries\n # grab the times of each entry and calculate the difference to add to the time card\n times = timecard.time_entries.pluck(:time)\n timecard.totalhours = ((times[1] - times[0]) / 3600).round(TOTAL_HOURS_SCALE)\n else\n # not a pair\n # make sure the total hours is nil\n timecard.totalhours = nil\n end\n timecard.save\n end", "def next_clean_time(addr) \n #Figure out side of the street\n side = self.get_side(addr) \n \n #Find all blocks that match Street Address \n all_blocks = self.blocks\n blocks = all_blocks.where(\"side = ? AND bottom <= ? AND top >= ?\", side, addr, addr)\n if blocks == []\n return nil\n else \n #Compute the next cleaning times for the block and pick the smallest(i.e. the soonest) time\n cts = Array.new\n blocks.each{|x|cts << x.ct.next_time}\n best = cts.min\n return best, blocks[0].id\n end\n end", "def getTimeIndex(time)\n if(@timeOrigin.nil?) then\n return nil ;\n else\n time = parseTime(time) ;\n diff = time - @timeOrigin ;\n index = (diff / @timeStep).floor ;\n return index ;\n end\n end", "def fix_time(time=nil)\n if time == nil\n # no full time, use current\n hh, mn, ss = Time.now.strftime(\"%H:%M:%S\").split(':')\n elsif time.size == 3\n # we got full time\n hh = time[0].rjust(2,'0')\n mn = time[1].rjust(2,'0')\n ss = time[2].rjust(2,'0')\n elsif time.size == 2\n # we got full time minus seconds\n hh = time[0].rjust(2,'0')\n mn = time[1].rjust(2,'0')\n ss = Time.now.strftime(\"%S\")\n end\n return hh, mn, ss\n end", "def average_pace(ride)\n if ride.points.size < 2\n ride.points.each { |point| point.pace = 0 }\n return 0\n end\n\n ride.points.first.pace = 0\n\n point_pairs(ride).each do |pair|\n pair.last.pace = pace_between(*pair)\n end\n\n distance = distance(ride)\n return 0 if distance == 0\n active_duration(ride) / distance\n end", "def avg_adjusted_payoff\n \tpayoff = []\n \tn_player_adjusted_payoffs.each do |p|\n \t\tpayoff << p.payoff\n \tend\n\n \tpayoff.sum.to_f / payoff.length.to_f\n end", "def time_left\n return 0.0 if free?\n return end_time - Time.now.to_f\n end", "def average_flat_pace(ride)\n distance = flat_distance(ride)\n return 0 if distance == 0\n flat_duration(ride) / distance\n end", "def safe_relative_time(time)\n return unless time\n\n time = parse_time(time)\n\n relative_time(time)\n end", "def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end", "def normalize_end_time(time)\n time.midnight + 1.day - 1.minute\n end", "def verbose_distance_until_time_from_now(time)\n return '' if time.blank?\n arr = distance_until_time_from_now_arr(time)\n ret = []\n ret.push(pluralize(arr[0], 'day')) unless arr[0] == 0\n ret.push(pluralize(arr[1], 'hour')) unless arr[1] == 0\n ret.push(pluralize(arr[2], 'min')) unless arr[2].blank?\n ret.join(', ') + ' and ' + pluralize(arr[3], 'sec')\n end", "def get_trailing_avg_day\n how_many_games = {}\n\n names = []\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n name_results = db.query(\"SELECT name from oconnor where fanduel_pts is not null and mp > 0 order by name asc\")\n\n name_results.each do |name_result|\n names << name_result[0]\n end\n names = names.uniq\n\n names.each do |name|\n master_avgs_string = \"#{name}, \"\n\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n results = db.query(\"SELECT date, name, fanduel_pts, mp from oconnor where name='#{Mysql.escape_string(name)}' and fanduel_pts is not null and date < '#{Date.today}' order by date asc\")\n\n games = []\n\n results.each do |result|\n games.push(result[2].to_f/result[3].to_f)\n end\n\n empty = []\n averages1=[]\n averages2=[]\n averages3=[]\n averages4=[]\n averages5=[]\n averages6=[]\n averages7=[]\n averages8=[]\n averages9=[]\n averages10=[]\n averages11=[]\n averages12=[]\n averages13=[]\n averages14=[]\n averages15=[]\n\n differences = [[empty], [averages1], [averages2], [averages3], [averages4], [averages5], [averages6], [averages7], [averages8], [averages9], [averages10], [averages11], [averages12], [averages13], [averages14], [averages15]]\n\n avg_differences = []\n games.each do |game|\n\n game_num = games.index(game)\n if game_num!=0\n #puts \"Actual Performance in game #{game_num}: #{games[game_num]}\"\n\n if game_num > 15\n upper = 15\n else\n upper = game_num\n end\n\n for j in 1..upper\n\n trailing_number = j\n sum = 0\n i = 1\n\n while i <= trailing_number\n game_avg = games[game_num-i]\n sum+= game_avg\n i+=1\n end\n\n trailing_avg = sum/trailing_number\n difference = (games[game_num]-trailing_avg).abs\n differences[trailing_number].push(difference)\n #puts \"#{trailing_number} game average: #{difference} p/m off\"\n end\n end\n end\n haystack = []\n for d in 1..15\n sum=0\n num_of_avgs=0\n differences[d].each do |diff|\n if diff.class==Float\n #puts \"#{d}: #{diff}\"\n sum+=diff\n num_of_avgs+=1\n end\n end\n\n if num_of_avgs>0\n avg_avg = sum/num_of_avgs\n haystack.push(avg_avg)\n master_avgs_string << \"#{avg_avg},\"\n end\n end\n\n if haystack!=nil\n what_to_use = 0\n if haystack.index(haystack.min) != nil\n what_to_use = haystack.index(haystack.min)\n end\n #puts \"#{name} - #{what_to_use+1}\"\n how_many_games[name] = what_to_use+1\n end\n end\n return how_many_games\nend", "def at(time)\n from, to = quoted_history_fields\n unscoped.\n select(\"#{quoted_table_name}.*, '#{time}' AS as_of_time\").\n where(\"'#{time}' >= #{from} AND '#{time}' < #{to}\")\n end", "def get_total_time\n return RideShare.get_all_trip_durations_in_seconds(@trips)\n end", "def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end", "def calc_time_diff(src_path)\n i=0\n timediff =[]\n pictimes = read_all_dates(src_path).values.sort\n timediff << 0\n \n until i == pictimes.length-1 \n i +=1\n timediff << pictimes[i] - pictimes[i-1]\n end\n \n return timediff # returns an array of time differences\nend", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_required_jobs_list(missed_times)\n end", "def remove_time\n ticket_time = [self.ticket.actual_time - self.time, 0].max\n self.ticket.update_column :actual_time, ticket_time\n end", "def mean_time_to_failure_in_minutes\n return @mean_time_to_failure_in_minutes\n end", "def mean_time_to_failure_in_minutes\n return @mean_time_to_failure_in_minutes\n end" ]
[ "0.5869817", "0.58603567", "0.56355774", "0.5614027", "0.5604639", "0.5559245", "0.55308306", "0.54630786", "0.5405201", "0.5365227", "0.5290069", "0.5286041", "0.52774304", "0.52488804", "0.5222357", "0.5212122", "0.5208633", "0.5184622", "0.5179051", "0.51691294", "0.5164482", "0.5148553", "0.51470685", "0.5142945", "0.5142945", "0.51389205", "0.513467", "0.51030916", "0.5085383", "0.508058", "0.5076009", "0.5043431", "0.503748", "0.503748", "0.50311756", "0.5027774", "0.5027096", "0.50222766", "0.50038224", "0.4995156", "0.49948573", "0.49909237", "0.49864173", "0.4974877", "0.49733335", "0.4964787", "0.49646956", "0.49629733", "0.49627855", "0.49604863", "0.49589148", "0.49511892", "0.49410757", "0.49310887", "0.4931084", "0.49304876", "0.49301478", "0.49181837", "0.49104387", "0.49083838", "0.4902994", "0.4896581", "0.48937267", "0.48918793", "0.4888485", "0.48838508", "0.48815414", "0.48751432", "0.48739526", "0.4859666", "0.48578694", "0.48526248", "0.48389885", "0.48317742", "0.48317742", "0.4830616", "0.48221594", "0.48205394", "0.48179826", "0.48091486", "0.48060688", "0.48030874", "0.4796811", "0.4795554", "0.4792667", "0.47833842", "0.4775742", "0.47754923", "0.47684142", "0.47681263", "0.4762508", "0.4760208", "0.47584167", "0.47522587", "0.474904", "0.47357672", "0.4725992", "0.47256798", "0.47251868", "0.47251868" ]
0.6589963
0
Returns absolute and movingaverage values of time between failures (creation of unplanned card and completion of last unplanned card) since supplied time.
def time_between_failures(since_time, unit: :second) total_uptime = 0 total_failures = 0 tbf = { point_values: {}, moving_averages: {} } # Unplanned cards created after since_time, in order of creation. unplanned_cards = cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNPLANNED).order('cards.created_at DESC') unplanned_cards.each_with_index do |unplanned_card, index| previous_unplanned_card = unplanned_cards[index + 1] if previous_unplanned_card && previous_unplanned_card.completed_at uptime = unplanned_card.created_at - previous_unplanned_card.completed_at total_failures += 1 total_uptime += time_in_unit(uptime, unit) tbf[:point_values][unplanned_card.created_at] = time_in_unit(uptime, unit) tbf[:moving_averages][unplanned_card.created_at] = total_uptime / total_failures end end tbf end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_repair(since_time, unit: :second)\n total_repair_time = 0\n total_repairs = 0\n ttr = { point_values: {}, moving_averages: {} }\n\n # Unplanned cards created after since_time, in order of creation.\n cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNPLANNED).order('cards.created_at DESC').map do |unplanned_card|\n lead_time = unplanned_card.lead_time\n\n if lead_time > 0\n total_repairs += 1\n total_repair_time += time_in_unit(lead_time, unit)\n\n ttr[:point_values][unplanned_card.created_at] = time_in_unit(lead_time, unit)\n ttr[:moving_averages][unplanned_card.created_at] = total_repair_time / total_repairs\n end\n end\n\n ttr\n end", "def mean_time_to_failure_in_minutes\n return @mean_time_to_failure_in_minutes\n end", "def mean_time_to_failure_in_minutes\n return @mean_time_to_failure_in_minutes\n end", "def time_difference(distance, time)\n etd = base_time + departure_time.minutes\n eta = etd + journey_pattern.time_on_path(distance)\n if eta - 1.minute <= time\n if time <= eta + 1.minute\n # We are for the most part, on time\n return 0;\n else\n logger.info \"LATE!!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # we are late (positive) in minutes\n return ((time - eta)/1.minute).to_i\n end\n else\n logger.info \"EARLY!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # We are early (negative)\n return ((time - eta)/1.minute).to_i\n end\n end", "def average_missed_call_duration\n average_duration(missed_contacts, 'arrived', 'call_ended')\n end", "def set_failed_count_and_average\n @failed_count = 0\n sum = count = 0\n @ping_times.each do |t|\n if t == -1\n @failed_count += 1\n else\n sum += t\n count += 1\n end\n end\n\n @average = if count > 0\n sum / count\n else\n 0\n end\n end", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_to_enqueue_list(missed_times)\n end", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_to_enqueue_list(missed_times)\n end", "def average_response_time\n return summary_average[:average_response_time]\n end", "def at_time(time)\n resource = @initial\n\n puts \"[START] initial: #{initial}\" if COPIOUS_DEBUGGING\n puts \"[START] time: #{time}\" if COPIOUS_DEBUGGING\n\n if intervals_at_time(@harvesters, time).size > 1\n generate_pairs(intervals_at_time(@harvesters, time)).each_with_index do |pair, index|\n puts \"[DEBUG] #{index}: STARTING LOOP\" if COPIOUS_DEBUGGING\n start_time = pair[0]\n next_time = pair[1]\n puts \"#{index}: start_time: #{start_time}\" if COPIOUS_DEBUGGING\n\n harvesters = @harvesters[start_time]\n puts \"#{index}: harvesters: #{harvesters}\" if COPIOUS_DEBUGGING\n\n period = next_time - start_time\n puts \"#{index}: period: #{period}\" if COPIOUS_DEBUGGING\n\n harvested = time_to_resource(period, harvesters)\n resource += harvested\n puts \"#{index}: harvested: #{harvested}\" if COPIOUS_DEBUGGING\n\n consumed = consumed_in_interval(start_time, next_time)\n resource -= consumed\n puts \"#{index}: consumed: #{consumed}\" if COPIOUS_DEBUGGING\n\n puts \"#{index}: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n else\n resource -= consumed_at_time(0)\n puts \"0: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n\n if resource < 0\n raise(InvalidEconomyError, \"The Starcraft economy does not allow deficit spending (deficit of #{resource} #{@type} at #{time} seconds).\")\n end\n\n puts \"[FINISH] at_time: #{resource}\" if COPIOUS_DEBUGGING\n resource\n end", "def avg_time_lap\n times = []\n self.voltas.each { |lap_num, lap_stat| times << time_in_ms(lap_stat[:tempo])}\n return ms_to_min(get_avg(times))\n end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def pred_time\n @time = (@time - @delta).max(0)\n end", "def find_time_asleep\n @total_time_asleep = 0\n @wake_times.each_with_index do |wake_time, index|\n @total_time_asleep += ( wake_time - @sleep_times[index] )\n end\n end", "def updateTime\n\n # Cleanup phase\n @timestamps << @activestamps.map {|s| s.to_f}\n\n t1, t2, t3, t4, cfs, cfd = @activestamps\n @log.debug \"t1: #{t1.to_f}, \"\\\n \"t2: #{t2.to_f}, \"\\\n \"t3: #{t3.to_f}, \"\\\n \"t4: #{t4.to_f}, \"\\\n \"cfs: #{cfs.to_f}, \"\\\n \"cfd: #{t4.to_f}\"\n\n # Calculate link delay and average link delay\n delay = ((t2 - t1) + (t4 - t3) - cfs - cfd) / BigDecimal.new(2)\n @delay << (delay.to_f > 0 ? delay : delay * -1)\n delay_avg = @delay[-1]\n if @delay_avg[-1]\n one = BigDecimal.new(1)\n delay_avg = ALPHA * @delay_avg[-1] + (one - ALPHA) * @delay[-1]\n end\n @delay_avg << delay_avg\n\n # Calculate phase error and average phase_error\n @phase_error << ((t2 - t1) - (t4 - t3) - cfs + cfd) / BigDecimal.new(2)\n\n # Calculate average phase error if multiple data points exists\n avg = @phase_error[-1]\n if @phase_err_avg[-1]\n one = BigDecimal.new(1)\n avg = ALPHA * @phase_err_avg[-1] + (one - ALPHA) * @phase_error[-1]\n end\n @phase_err_avg << avg\n\n # Calculate frequency error\n distance = -2\n if @timestamps[distance]\n ot1 = @timestamps[distance][0]\n ot2 = @timestamps[distance][1]\n ode = @delay_avg[distance].to_f\n de = @delay_avg.last.to_f\n ocfs = @timestamps[distance][4].to_f\n error = (t1.to_f - ot1)/((t2.to_f + de + cfs.to_f)-(ot2 + ode + ocfs))\n # Do some hard filtering of data\n if error < 2 && error > 0.5\n @freq_error << error\n else\n puts \"ERROR ERROR ERROR ERROR \" + error.to_s # Why?\n @freq_error << @freq_error[-1] || 1\n end\n end\n\n # Calculate average frequency error if multiple data points exists\n if @freq_error[-1] && @flipflop - 1 < @flipflopeach\n @freq_err_avg << @freq_err_avg.last\n elsif @freq_error[-1]\n avg = @freq_error[-1]\n if @freq_err_avg[-1]\n one = BigDecimal.new(1)\n avg = ALPHA_F * @freq_err_avg[-1] + (one - ALPHA_F) * @freq_error[-1]\n end\n @freq_err_avg << avg\n end\n\n # TODO: Update system\n @log.info \"Delay: #{@delay.last.to_f} \\t\" \\\n \"Delay_avg: #{@delay_avg.last.to_f} \\t\" \\\n \"phase_err: #{@phase_error.last.to_f} \\t\"\\\n \"phase_err_avg: #{@phase_err_avg.last.to_f}, \\t\"\\\n \"freq_err: #{@freq_error.last.to_f} \\t\"\\\n \"freq_err_avg: #{@freq_err_avg.last.to_f}\"\n\n # Adjust phase\n adjOffset(@phase_err_avg.last.to_f) if @flipflop < @flipflopeach\n\n # Adjust frequency when we have some point of measurement and when we can\n # actually make adjustments in the flipflop thing.\n if @freq_err_avg[-10] && @flipflop >= @flipflopeach\n adjFreq(@freq_err_avg.last.to_f)\n end\n\n # Final cleanup\n @activestamps.fill(nil,0,4)\n\n # Adjust flipflop\n @flipflop = (@flipflop + 1) % (2 * @flipflopeach)\n end", "def average_predict_time\n\t\treturn @timmer/Float(@predict_call_count)\n\tend", "def mean_time_to_failure_in_minutes=(value)\n @mean_time_to_failure_in_minutes = value\n end", "def mean_time_to_failure_in_minutes=(value)\n @mean_time_to_failure_in_minutes = value\n end", "def calculate_missed_runs(last_run_time, as_time)\n missed_times = []\n last_time = last_run_time\n while (next_run = next_run_time(last_time, as_time))\n missed_times << next_run\n last_time = next_run\n end\n\n generate_required_jobs_list(missed_times)\n end", "def average_after_call_duration\n average_duration(closed_contacts, 'call_ended', 'after_call_ended')\n end", "def average_call_duration\n average_duration(finished_contacts, 'answered', 'call_ended')\n end", "def average_driving_time\n if self.total_duration > 0\n ((self.total_driving_time / self.total_duration) * 100)\n else\n 0\n end\n end", "def time_survived\n return 0 if self.is_oz\n tag = self.killing_tag\n real_begins = self.game.game_begins - self.game.utc_offset\n return [0, tag.datetime - real_begins].max unless tag.nil?\n return [0, Game.now(self.game) - real_begins].max\n end", "def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end", "def time_spent_attempting_state(state, options)\n states = retries_for_state(state, options)\n if states.empty?\n 0\n else\n Time.now.to_f - states.last[:transitioned_at].to_f\n end.to_f\n end", "def interrupted_time\n interrupts.inject(0) { |sum, i| i.approved? ? (sum + i.current_duration) : sum }\n end", "def estimate_at_completion_duration\n return planned_duration - earned_schedule\n end", "def clean_aged(time_now)\n near_past = time_now - @time_window_in_seconds\n @errors = @errors.reverse.select{|time_stamp| time_stamp > near_past }.reverse.to_a\n end", "def next_closest_time(time)\n store = Array.new(9)\n past = []\n\n time.split('').each do |num| \n if (num.ord >= 48 && num.ord <= 57)\n store[num.to_i] = true \n past.push(num.to_i)\n end\n end\n\n future = past\n place = 3\n until (place == -1)\n limit = find_limit(place, past[place])\n if next_greatest(store, past[place], limit)\n if place == 1 && next_greatest(store, past[place], limit) >= 5 && future[0] == 2\n next_num = next_greatest(store, 0, 2)\n future[0] = next_num\n future[1] = next_num\n else \n future[place] = next_greatest(store, past[place], limit)\n end\n break\n else\n future[place] = lowest(store)\n place -= 1\n end\n end\n\n future[0..1].join(\"\").to_s + \":\" + future[2..3].join(\"\").to_s\nend", "def average\n return @@average_times.inject(:+).to_f / @@average_times.size\n end", "def update_time_worked\n\n time_entries = self.time_card.time_entry\n total_hours = 0\n # Ordering by time so the total hours can be calculated.\n # An odd array will have [start_time1, end_time1, start_time2]\n # and the total_hours_worked = start_time1 - end_time1\n # An even array will have [start_time1, end_time1, start_time2, end_time 2]\n # and the total_hours_worked = (start_time1 - end_time1) + (start_time2 - end_time2)\n\n time_entries = time_entries.order(time: :asc)\n time_entries_count = time_entries.count\n\n i = 0\n while i < time_entries_count and i+1 < time_entries_count\n start_time = time_entries[i].time\n end_time = time_entries[i+1].time\n i = i+2\n total_hours = total_hours + time_diff(start_time, end_time).to_i\n end\n\n if time_entries_count == 1\n self.time_card.update_attribute(:total_hours_worked, 0)\n else\n self.time_card.update(:total_hours_worked => total_hours)\n end\n\n end", "def error(process_variable)\n e = process_variable - @set_point\n now = Time.now\n if @last_time\n dt = now - @last_time\n dt = Float::MIN if dt == 0\n else\n dt = 1.0\n end\n @last_time = now\n [e, dt]\n end", "def calc_average_distance(time_period)\n return 0 if time_period.size <= 1 # Need at least 2 cars\n sum = 0\n for i in 0...(time_period.size - 1)\n sum += calc_distance(time_period[0], time_period[1])\n end\n return sum / (time_period.size - 1)\n end", "def fail_rate(days=30)\n latest_executions(days).average('IF(success, 0, 1)')&.to_f\n end", "def average_wait_time\n self.reviews.average(:wait_time).to_i\n end", "def compute_average_time_between_invitation_and_rdv_in_days\n cumulated_invitation_delays = 0\n @rdv_contexts.find_each do |rdv_context|\n cumulated_invitation_delays += rdv_context.time_between_invitation_and_rdv_in_days\n end\n cumulated_invitation_delays / (@rdv_contexts.count.nonzero? || 1).to_f\n end", "def end_traction(step_name, start_time)\n\n if ($transactions_iterations[step_name].nil?) then\n $transactions_iterations[step_name] = 0\n end\n\n $transactions_iterations[step_name] += 1\n\n # This uses the value from start_traction() and finds how long the test took.\n transaction_duration = (Time.now - start_time) * 1000\n\n # If the current transaction have no results, lets define their arrays\n if ($results_transactions[step_name].nil?) then\n $results_transactions[step_name] = []\n $results_transactions_graph[step_name] = {}\n end\n\n # Add the duration of the test to an array so we can work our max/min/avg etc...\n $results_transactions[step_name] << transaction_duration\n\n # For each second we need to build up an average, so need to build up another array\n # based on the current time\n current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1\n\n # If the array doesn't exist for the current time, then lets define it\n if($results_transactions_graph[step_name][current_time_id].nil? == true) then\n $results_transactions_graph[step_name][current_time_id] = Array.new()\n end\n\n # Add the value to the array\n $results_transactions_graph[step_name][current_time_id].push(transaction_duration)\n\nend", "def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def display_time_at\n gm = self.good_memories.count\n bm = self.bad_memories.count\n lifespan = (Time.now.to_i - self.created_at.to_i)\n unless gm == 0\n shift = (lifespan * (bm + 1)) / gm\n return (Time.now.to_i - shift)\n else\n shift = lifespan * (bm + 1)\n return (Time.now.to_i - shift)\n end\n end", "def average_usage\n\t\treturn 0.0 if @run_count.zero?\n\t\t(@total_utime + @total_stime) / @run_count.to_f\n\tend", "def average_finish_time \n \ni = 0\n while i != 100\n $round = 0 \n while $step < $max_step\n jet = throw_dice\n make_move(jet)\n $round = $round + 1\n end\n $step = 0\n $resultGame.push($round)\n i +=1\n end\nend", "def average_finish_time(game, nb_game)\n\n#On initialise la somme des nombres de laps\nsomme = 0\n\n#On teste si le nombre de parties > 100, si non on n'accpete pas\n\tif nb_game < 100 then puts \"Il faut un nombre > 100 !\"\n\n#Si oui, on lance nb_parties (en l'occurence 150) fois le jeu (en l'occurence Stairways)\n\telse\n\t\t\tnb_game.times do game\n\t\t\tsomme += stairway\n\t\t\tend\n\n#On affiche la moyenne du nombre de parties\n\t\tputs \"**************************************************************************\"\n\t\tputs \"Le score moyen de vos #{nb_game} parties est de #{somme/nb_game} !\"\n\t\tputs \"**************************************************************************\"\n\n\tend\n\nend", "def get_course_time(results)\n list = []\n results.take(3).each do |r|\n list << r.float_time\n end\n get_harmonic_mean(list)\n end", "def show_avg_time\n avg_times = []\n RACER_RECORDS.each {|racer| avg_times << [ racer.piloto, racer.avg_time_lap ]}\n @view.display_avg_times(avg_times)\n end", "def failure_date_time\n return @failure_date_time\n end", "def avg_time\n self[:avg_time] || Tournament.current.default_avg_time\n end", "def count_time(relevant_line)\n t0 = 0\n time_between = []\n relevant_line.each do |n|\n t1 = Time.parse(n)\n d = t1 - t0\n t0 = t1\n time_between << d\n end\n time_between\nend", "def assert_timed_out\n assert avatar.lights[-1].output.start_with?('Unable to complete')\n assert_equal :timed_out, avatar.lights[-1].colour\n end", "def attempting_times_left\n @times_left ||= begin\n return MAX_ATTEMPTING_TIMES unless question.actable.attempt_limit\n\n times = question.actable.attempt_limit - submission.evaluated_or_graded_answers(question).size\n times = 0 if times < 0\n times\n end\n end", "def calculate_score\n statuses = Tile::STATUSES\n missed_shots = starting_shots - shots_remaining\n hit_shots = board.board.flatten.select do |tile|\n [statuses[:hit], statuses[:sunk]].include?(tile.status)\n end\n hit_shots = hit_shots.count\n total_time = (Time.now - starting_time).round\n ((500 * hit_shots) - (50 * missed_shots)) / total_time\n end", "def avg_time(data)\n #pp data\n total = 0\n count = 0\n data.each do |_, list|\n list.each do |v|\n unless v[\"value\"].empty?\n hour,min = v[\"value\"].split(':')\n if hour.to_i >= 21\n total += hour.to_i * 60 + min.to_i\n count += 1\n elsif hour.to_i <= 6\n total += 24*60 + hour.to_i * 60 + min.to_i\n count += 1\n end\n end\n end\n end\n avg_hour = total / count / 60 % 24\n avg_min = total / count % 60\n puts \"#{avg_hour}:#{avg_min}\"\nend", "def average_response_time\n (active_time / requests.to_f) * 1000\n end", "def compute_times\n @render_avg = 0.0\n @db_avg = 0.0\n @total_avg = 0.0\n @render_max = 0.0\n @db_max = 0.0\n @total_max = 0.0\n @error_avg = 0.0\n \n @log_entries.each do |la|\n if la.error?\n @error_avg += 1.0\n next\n end\n @render_avg += la.rendering\n @db_avg += la.db\n @total_avg += la.duration\n @render_max = la.rendering if la.rendering > @render_max\n @db_max = la.db if la.db > @db_max\n @total_max = la.duration if la.duration > @total_max\n end\n \n @render_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @db_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @total_avg /= @log_entries.size.to_f - @error_avg + 0.0001\n @error_avg /= @log_entries.size.to_f\n\n # using math.log allows us to smooth out the score between\n # infrequent and very frequent actions. 0.1 is added for a\n # non-0 result\n @render_cost = @render_avg * Math.log(@log_entries.size+0.1)\n @db_cost = @db_avg * Math.log(@log_entries.size+0.1)\n @total_cost = @total_avg * Math.log(@log_entries.size+0.1)\n end", "def calc_time_diff(src_path)\n i=0\n timediff =[]\n pictimes = read_all_dates(src_path).values.sort\n timediff << 0\n \n until i == pictimes.length-1 \n i +=1\n timediff << pictimes[i] - pictimes[i-1]\n end\n \n return timediff # returns an array of time differences\nend", "def average_finish_time\n\tcount = 0\n\t#simuler une game\n\tgame_state = 0\n\twhile game_state != 10\n\t\troll = rand(6)\n\t\tif roll > 3 #5-6\n\t\t\tgame_state +=1\n\t\telsif roll == 0\n\t\t\tif game_state != 0 \n\t\t\t\tgame_state -= 1\n\t\t\tend\n\t\tend\n\t\tcount +=1\n\tend\n\n\treturn count\nend", "def difference_in_minutes time_one, time_two\n time_one_with_resetted_date = reset_date_for_time time_one\n time_two_with_resetted_date = reset_date_for_time time_two\n (time_one_with_resetted_date - time_two_with_resetted_date) / 60\n end", "def parse_cs_exam_time(exam)\n if exam[:finalized] != 'Y'\n if exam[:exam_exception] == 'Y' || (exam[:exam_type] != 'Y' && exam[:exam_type] != 'C')\n return nil\n end\n end\n start = exam[:exam_start_time]\n ending = exam[:exam_end_time]\n if start && ending\n start_time = (start.strftime '%l:%M').strip\n start_time_meridian_indicator = single_letter_meridian_indicator(start.strftime '%p')\n end_time = (ending.strftime '%l:%M').strip\n end_time_meridian_indicator = single_letter_meridian_indicator(ending.strftime '%p')\n return \"#{start_time}#{start_time_meridian_indicator} - #{end_time}#{end_time_meridian_indicator}\"\n end\n nil\n end", "def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end", "def estimated_stop_time\n result = 0\n recipe.schedule.tasks.each do |t|\n result += t.duration + t.ramp_estimate\n end\n\n start_time + result.seconds\n end", "def adjusted_time(finish_time)\n start_time = matching_start_time(finish_time) || competition_start_time_in_thousands\n finish_time - start_time\n end", "def expected\n (@terminated_at - @started_at).to_i * @schedule.pill_times.size\n end", "def time_until_hungry\n time_since_recent_action = if time_since_last_burrito < time_since_active\n time_since_last_burrito\n else\n time_since_active\n end\n\n x = greedy_time - time_since_recent_action.to_i\n x > 0 ? x : 0\n end", "def get_test_average_time(test_name, n = 10, default = 0)\n test_pack = runtime.test_pack\n configuration = test_pack.get_test_configuration(test_name)\n average = configuration['test.average_execution_time', default: nil]\n return average unless average.nil?\n\n test = Test.where(test_name: test_name).first\n return default if test.nil?\n\n running_value = Automation::Status::Running.value\n exception_value = Automation::Result::Exception.value\n test_results = test.test_results\n test_results = test_results.where('status != ? AND result < ?', running_value, exception_value)\n test_results = test_results.order('id DESC').limit(n)\n # If there are no previous results, return the default value.\n count = test_results.length\n return default if count == 0\n # Calculate average.\n total = 0\n test_results.each { |test_result| total += (test_result.end_date_time - test_result.start_date_time) }\n (total / count)\n end", "def pill_taking_time_diff(record)\n ptime = record.pill_time_at\n ctime = record.actual_pill_time_at\n\tif ctime == nil\n\t\treturn \"No submission\"\n\tend\n range = (ptime - 10.minutes)..(ptime + 10.minutes)\n\n if range.cover? ctime\n \"Taken on time\"\n elsif record.created_at < record.pill_time_at\n \"Taken early by #{distance_of_time_in_words(ctime, ptime)}\"\n else\n \"Taken late by #{distance_of_time_in_words(ctime, ptime)}\"\n end\n end", "def validate_answer(result, right_answer, status, start_time, time)\r\n case result\r\n when right_answer\r\n # Get the stop time stamp to calculate the score, the faster to get the answer, the more bounds score is earned.\r\n answer_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n time_used = (answer_time - start_time).round(1)\r\n # Basic socre for each corrent answer is 500\r\n total_score = 500 + (time - time_used) * 10\r\n # Update the score and pass back to the loop\r\n status[0] += total_score\r\n status[1] += 1\r\n puts \"\\n\\n Hooray!!! You got it!!\"\r\n\r\n else\r\n puts \"\\n\\nSorry, not correct answer or time expired!\\nIt's fine. Let's keep going\"\r\n status[2] += 1\r\n end\r\n enter_to_continue\r\n end", "def racepace(time,distance)\n\t\tpace_total = (time[:hours].to_i * 60 + time[:minutes].to_i + time[:seconds].to_f / 60) / distance\n\t\t# pace = (time[:hours].to_i * 60 + time[:minutes] + time[:seconds] / 60) / distance\n\t\tpace_seconds = ( pace_total % 1 * 60 ).truncate\n\t\tif pace_seconds < 10\n\t\t\tpace_seconds = \"0\"+pace_seconds.to_s\n\t\telse\n\t\t\tpace_seconds = pace_seconds.to_s\n\t\tend\n\t\tpace = pace_total.truncate.to_s + \":\" + pace_seconds\n\t\tpace\n\tend", "def get_time_diff(time)\n return (time*60*60*24).to_i\n end", "def avg_time_spent\n self.average(:time_spent)\n end", "def display_time_diff(src_path)\n td = calc_time_diff(src_path)\n avg = td.inject{|sum,el| sum + el}.to_f / td.size\n\n td.each {|t| puts t}\n puts \"Size: #{td.size}\"\n puts \"Min: #{td.min}\"\n puts \"Max: #{td.max}\"\n puts \"Avg: #{avg.round}\" \nend", "def fix_negative_times\n proto_record[:absolute_times] = proto_record[:times_of_day].map do |datetime|\n next unless datetime\n\n seconds = datetime - effort_start_time\n seconds_in_day = (1.day / 1.second)\n adjustment = seconds&.negative? ? (seconds.to_i / seconds_in_day).abs * seconds_in_day : 0\n datetime + adjustment\n end\n end", "def time\n end_time - start_time\n end", "def total_time\n entries.reduce(0) do |acc, entry|\n acc + entry.total_minutes\n end\n end", "def ideal_hit_time\n while (hit_limit.nil? || (hit_limit - hit_count) <= 0) do\n update_rate_limit_status\n # + 1.0 to account for clock skew between computers\n sleep_until(@will_reset_at + 1.0) if (hit_limit == 0)\n end\n blather(\"hits_remaining = #{hit_limit - hit_count}, seconds_remaining = #{will_reset_at - Time.zone.now}\")\n # ideal_time ramps from updated_at to will_reset_at as\n # hit_count goes from 0 to hit_limit.\n linear_intepolate(hit_count, 0, hit_limit, updated_at, will_reset_at)\n end", "def duration\n if leg_a_answered_at.nil?\n return 0\n else\n if hangup? \n (leg_a_hangup_at - leg_a_answered_at).round\n else\n (Time.now - leg_a_answered_at).round\n end\n end\n end", "def average_idling_time\n if self.total_duration > 0\n ((self.total_idling_time / self.total_duration) * 100)\n else\n 0\n end\n end", "def report_time time\n end", "def test_max_accuracy\n result=Array.new\n at=Activity_tracker.new do |id|\n result[id]=Time.now-result[id]\n end\n 10.times do |i|\n result[i]=Time.now\n at.active i\n sleep at.tick_time\n end\n sleep at.timeout+at.tick_time\n accuracy=result.max-at.timeout\n expected_accuracy=at.tick_time-\n at.timeout%at.tresholds\n assert((accuracy-expected_accuracy).abs>0.02, 'bad accuracy: '+accuracy.to_s)\n end", "def getavg\r\n\t\tif @duration == 0\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\treturn ((@miles_driven.to_f / @duration)*60)\r\n\t\tend\r\n\tend", "def time_diff(time1, time2)\n time1_a = time1.split(':')\n time2_a = time2.split(':')\n \n hours_output = 0\n hours1 = time1_a[0].to_i\n hours2 = time2_a[0].to_i\n hours = hours2 - hours1\n \n mins = time2_a[1].to_i - time1_a[1].to_i\n \n while hours > 0\n hours_output += 60\n hours -= 1\n end\n return hours_output + mins \nend", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end", "def get_trailing_avg_day\n how_many_games = {}\n\n names = []\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n name_results = db.query(\"SELECT name from oconnor where fanduel_pts is not null and mp > 0 order by name asc\")\n\n name_results.each do |name_result|\n names << name_result[0]\n end\n names = names.uniq\n\n names.each do |name|\n master_avgs_string = \"#{name}, \"\n\n db = Mysql.new('127.0.0.1','root',ENV[\"SQL_PASSWORD\"],'fanduel')\n results = db.query(\"SELECT date, name, fanduel_pts, mp from oconnor where name='#{Mysql.escape_string(name)}' and fanduel_pts is not null and date < '#{Date.today}' order by date asc\")\n\n games = []\n\n results.each do |result|\n games.push(result[2].to_f/result[3].to_f)\n end\n\n empty = []\n averages1=[]\n averages2=[]\n averages3=[]\n averages4=[]\n averages5=[]\n averages6=[]\n averages7=[]\n averages8=[]\n averages9=[]\n averages10=[]\n averages11=[]\n averages12=[]\n averages13=[]\n averages14=[]\n averages15=[]\n\n differences = [[empty], [averages1], [averages2], [averages3], [averages4], [averages5], [averages6], [averages7], [averages8], [averages9], [averages10], [averages11], [averages12], [averages13], [averages14], [averages15]]\n\n avg_differences = []\n games.each do |game|\n\n game_num = games.index(game)\n if game_num!=0\n #puts \"Actual Performance in game #{game_num}: #{games[game_num]}\"\n\n if game_num > 15\n upper = 15\n else\n upper = game_num\n end\n\n for j in 1..upper\n\n trailing_number = j\n sum = 0\n i = 1\n\n while i <= trailing_number\n game_avg = games[game_num-i]\n sum+= game_avg\n i+=1\n end\n\n trailing_avg = sum/trailing_number\n difference = (games[game_num]-trailing_avg).abs\n differences[trailing_number].push(difference)\n #puts \"#{trailing_number} game average: #{difference} p/m off\"\n end\n end\n end\n haystack = []\n for d in 1..15\n sum=0\n num_of_avgs=0\n differences[d].each do |diff|\n if diff.class==Float\n #puts \"#{d}: #{diff}\"\n sum+=diff\n num_of_avgs+=1\n end\n end\n\n if num_of_avgs>0\n avg_avg = sum/num_of_avgs\n haystack.push(avg_avg)\n master_avgs_string << \"#{avg_avg},\"\n end\n end\n\n if haystack!=nil\n what_to_use = 0\n if haystack.index(haystack.min) != nil\n what_to_use = haystack.index(haystack.min)\n end\n #puts \"#{name} - #{what_to_use+1}\"\n how_many_games[name] = what_to_use+1\n end\n end\n return how_many_games\nend", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def average_marking_time\n @average_marking_time ||=\n if valid_submissions.empty?\n nil\n else\n valid_submissions.sum { |s| s[:published_at] - s[:submitted_at] } / valid_submissions.size\n end\n end", "def get_score\n\t\tscore = ((360000/((@end_time - @start_time).to_f + @save_time.to_f))*((@number_of_correct-@number_of_hint).fdiv(@number_of_correct+1))).truncate(2)\n\t\tif score < 0\n\t\t\treturn 0\n\t\telse\n\t\t\treturn score\n\t\tend\n\tend", "def calculate_elapsed_time(result)\n Time.parse(result.finish_time).to_i - Time.parse(result.start_time).to_i\n end", "def time_spent\n if File.exist?(@path)\n time = File.read(@path).to_i\n\n return (Time.new.to_i - time) / 60\n else\n return 0\n end\n end", "def duration\n ran? ? (completed_at || failed_at) - started_at : 0\n end", "def parse_time\n s0 = @scanner.pos\n if match_str('(') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s3 = parse_ms\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str('/') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s5 = parse_hms\n s5 = parse_ms(with_hour: true) if s5 == :failed\n if s5 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str(')') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'now' => s3, 'total' => s5 }\n end\n end\n end\n end\n end\n s0\n end", "def calculate_results_stalling\n state = nil\n stalling_start_time = nil\n stalling_end_time = nil\n\n @events.each do |event|\n next if event.type != \"playerStateChange\"\n next unless ['stalling', 'playing'].include? event.data\n\n if event.data == \"stalling\"\n if state == \"playing\" or state.nil? # if we didn't buffer already\n stalling_start_time = event.timestamp\n end\n state = \"stalling\"\n next\n end\n\n if state == \"stalling\" and event.data == \"playing\"\n state = \"playing\"\n stalling_end_time = event.timestamp\n\n # we found a stalling event\n @stalling_events += 1\n @stalling_events_time << stalling_start_time\n @stalling_events_duration << (stalling_end_time - stalling_start_time)\n @total_stalling_duration += @stalling_events_duration.last\n @average_stalling_duration = @stalling_events_duration.reduce(:+).to_f / @stalling_events_duration.size\n end\n end\n end", "def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end", "def schedule_impact\n if self.time_added?\n self.hours\n elsif time_removed?\n self.hours * -1.0\n else\n 0.0\n end\n end", "def time\n @time ||= begin\n if Array === first # Distribution\n times.max\n else # Press\n sum\n end\n end\n end", "def average_pricessing_time(mashine_number, remainded_jobs)\n jobs_count = remainded_jobs.count.to_f\n processing_times_for_mashine = processing_times.row(mashine_number)\n\n remainded_jobs\n .map { |job_number| processing_times_for_mashine[job_number] }\n .sum / jobs_count\n end", "def avg_time_spent\n\t\ttotal_time = self.visitors.inject(0){|sum,v| sum + v.total_time }.to_f\n\t\tavg_time = total_time/self.total_visits\n\tend", "def parse_srt_time(time)\n time =~ /^(\\d+):(\\d+):(\\d+),(\\d{3})$/\n hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)\n hh*3600 + mm*60 + ss + ms/1000.0\n end", "def error_time\n @@state[@server] && @@state[@server][:time]\n end", "def triptime(time1, time2)\r\n\r\n\t #For precision let the answer be in minutes\r\n\t t = ((Time.parse(time2) - Time.parse(time1))/60)\r\n\t t\r\n\tend", "def test_contracted_time\n batch = batches(:batch1)\n assert_in_delta(20.hours, (batch.contract_time(\"HLSC\")- Time.now).to_i, 2)\n end", "def time_diff\n return ((time_2 - time_1) / 3600).round\n end" ]
[ "0.59466237", "0.5944881", "0.5944881", "0.5897146", "0.57786214", "0.55632937", "0.5487752", "0.5487752", "0.5437157", "0.540516", "0.5381568", "0.53214526", "0.52549005", "0.5250814", "0.5245481", "0.5217097", "0.5204357", "0.5204357", "0.51853985", "0.5181975", "0.5174489", "0.5174196", "0.5166103", "0.5156709", "0.5146101", "0.5138826", "0.5122031", "0.5109701", "0.510276", "0.50935686", "0.50833654", "0.5079085", "0.50660443", "0.5065875", "0.5062038", "0.5060769", "0.5057084", "0.50365317", "0.5034382", "0.49943554", "0.4994256", "0.49845994", "0.49822813", "0.49593654", "0.49586508", "0.4958407", "0.49482635", "0.49460757", "0.4937634", "0.4936344", "0.49242064", "0.4922856", "0.4920877", "0.49073115", "0.4905257", "0.48878396", "0.48823693", "0.48765835", "0.4876291", "0.48728257", "0.48723856", "0.4864365", "0.48576608", "0.4855542", "0.48555192", "0.48350134", "0.4826225", "0.48244336", "0.48209673", "0.48172855", "0.4815189", "0.4815012", "0.4812173", "0.48089617", "0.480534", "0.48025182", "0.48010385", "0.47933662", "0.47706556", "0.47688735", "0.47564587", "0.47559282", "0.47545922", "0.47428733", "0.47418043", "0.47409526", "0.4736798", "0.47361213", "0.47356668", "0.47349048", "0.47326812", "0.47291216", "0.47286734", "0.47279444", "0.47272357", "0.4723933", "0.47228158", "0.47207043", "0.4717578", "0.47090706" ]
0.664568
0
Returns hash containing timestamp and details from ServerLog and Card
def logs_and_cards_with_timestamp(since_time) required_logs = server_logs.where('server_logs.created_at > ?', since_time).order('server_logs.created_at DESC') required_cards = cards.where('cards.created_at > ?', since_time).order('cards.created_at DESC') formatted_logs_info = required_logs.inject({}) do |specific_log_info, required_log| specific_log_info[required_log.timestamp] = required_log.log.join(',') specific_log_info end if required_logs.count > 0 formatted_cards_info = required_cards.inject({}) do |specific_card_info, required_card| specific_card_info[required_card.created_at.to_i.to_s] = "<a href=#{required_card.url}>Trello URL</a>" specific_card_info end if required_cards.count > 0 { logs: formatted_logs_info, cards: formatted_cards_info } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(ts)\n sig = [\n Rackspace::Email::Api.configuration.user_key,\n Rackspace::Email::Api.configuration.user_agent,\n ts,\n Rackspace::Email::Api.configuration.api_key\n ].join('')\n\n Base64.encode64(Digest::SHA1.digest(sig))\n end", "def hash\n [serial_number, timestamp, description, controller_id, device_id, subdevice_id, segment_id, event_type, event_subtype, event_text, badge_id, badge_id_str, badge_extended_id, badge_issue_code, asset_id, cardholder_key, alarm_priority, alarm_ack_blue_channel, alarm_ack_green_channel, alarm_ack_red_channel, alarm_blue_channel, alarm_green_channel, alarm_red_channel, access_result, cardholder_entered, duress, controller_name, event_source_name, cardholder_first_name, cardholder_last_name, device_name, subdevice_name, must_acknowledge, must_mark_in_progress].hash\n end", "def hash\n [created_time, last_modified_time, token, user_token, card_product_token, last_four, pan, expiration, expiration_time, cvv_number, chip_cvv_number, barcode, pin_is_set, state, state_reason, fulfillment_status, reissue_pan_from_card_token, fulfillment, bulk_issuance_token, translate_pin_from_card_token, activation_actions, instrument_type, expedite, metadata, contactless_exemption_counter, contactless_exemption_total_amount].hash\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def get_string_to_hash(info)\r\n\t\treturn \"#{info['id']}|#{info['prev_hash']}|#{info['transaction'].join(':')}|#{info['ts'][:sec]}.#{info['ts'][:nsec]}\".strip\r\n\tend", "def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end", "def hash\n [cert, event_type, failure, http_status_code, request_headers, response_body, response_headers, response_size, timings].hash\n end", "def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end", "def to_s\n return \"%s %08x %s\" % [@sha512hash, @mtime.to_i, @archive_filename]\n end", "def hash\n [commseq_postcard_uuid, commseq_step_uuid, commseq_uuid, conversion_dts, cost, customer_uuid, delivered_dts, from_address_line1, from_address_line2, from_city, from_name, from_state, from_zip, mailed_dts, order_id, postcard_tracking_uuid, status, submit_dts, to_address_line1, to_address_line2, to_city, to_name, to_state, to_zip, tracking_description].hash\n end", "def hash_secure\n # TODO: implement this method\n # - Use sha256 from openssl to create a cryptographically secure hash.\n # - Credit cards with identical information should produce the same hash\n OpenSSL::Digest::SHA256.digest(to_s).unpack(\"H*\")\n end", "def summary\n [hexdigest, @buffer.size]\n end", "def hash_secure\n # TODO: Use sha256 from openssl to create a cryptographically secure hash.\n # Credit cards with identical information should produce the same hash.\n\n sha256 = OpenSSL::Digest::SHA256.new\n sha256.digest(self.to_s).unpack('h*')\nend", "def hash\n [audit, username, ereq_id, level, comp, error_code, s2comp, req_id, ent_id, security, subcomp].hash\n end", "def hash\n [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash\n end", "def md5_hash(ts, public_key)\n private_key = Rails.application.credentials.marvel[:private_key]\n Digest::MD5.hexdigest(ts + private_key + public_key)\n end", "def hash\n [channel_order_no, lines, created_at, updated_at, extra_data, track_trace_no, track_trace_url, return_track_trace_no, method, shipped_from_country_code, shipment_date].hash\n end", "def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend", "def hash\n # TODO: Produce a hash (using default hash method) of the credit card's\n # serialized contents.\n # Credit cards with identical information should produce the same hash.\n self.to_s.hash\nend", "def sha\n result_hash['sha']\n end", "def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end", "def get_timestamp_and_signatures(header)\n list_items = header.split(/,\\s*/).map { |i| i.split(\"=\", 2) }\n timestamp = Integer(list_items.select { |i| i[0] == \"t\" }[0][1])\n signatures = list_items.select { |i| i[0] == @version }.map { |i| i[1] }\n [Time.at(timestamp), signatures]\n end", "def sso_logging_info\n { user_uuid: @current_user&.uuid,\n sso_cookie_contents: sso_cookie_content,\n request_host: request.host }\n end", "def peer_hash\n {\n :info_hash => sha,\n :peer_id => peer_id,\n :left => piece_length,\n :pieces => stream['info']['files']\n }\n end", "def digest_card_data\n @sha256 = self.class.set_digest\n\n self.card_number = @sha256.base64digest(@card_number_undigest) if @card_number_undigest.present?\n self.cvv = @sha256.base64digest(@cvv_undigest) if @cvv_undigest.present?\n\n @cvv_undigest = nil\n @card_number_undigest = nil\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def hash\n [mti, stan, transmission_time, acquiring_institution_id, network_reference_id, forwarding_institution_id, transaction_token].hash\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end", "def last_response\n hash = @_res.scan(/h=([\\w_\\=\\/]+)[\\s]/).first\n timestamp = @_res.scan(/t=([\\w\\-:]+)[\\s]/).first\n status = @_res.scan(/status=([a-zA-Z0-9_]+)[\\s]/).first\n info = @_res.scan(/info=([\\w\\t\\S\\W]+)/).first\n \n return { \"h\" => hash, \"t\" => timestamp, \"status\" => status, \"info\" => info }\n end", "def header\n \"Sentry sentry_signature=#{signature}, sentry_timestamp=#{@timestamp}, redtail=#{VERSION}\"\n end", "def hash\n [id, sender, receiver, text, status, contact_id, session_id, message_time, avatar, deleted, charset, charset_label, first_name, last_name, country, phone, price, parts_count, from_email, from_number].hash\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 request_timestamp\n auth_info[\"date\"] || \"\"\n end", "def hash\n [admin, created_at, customer_id, description, event_type, ip, metadata, service_id, user_id, token_id].hash\n end", "def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end", "def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end", "def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end", "def hash\n [bin_commercial, bin_corporate, bin_country_issued, bin_credit, bin_currency, bin_debit, bin_description, bin_eu, card_id, card_status, default, expmonth, expyear, label, label2, last4digits, scheme, token].hash\n end", "def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end", "def hash\n [access_key_id, address, arn, aws_session_name, connection_type, event_source, exchange_server_hostname, exchange_user, folder_path, id, ldap_server, links, name, port, protocol, region, scan_engine_is_inside_aws, secret_access_key, status, username, win_rm_server].hash\n end", "def hash\n [airline_data, amount, avs_postcode_policy, bill_to, card_holder_name, cardnumber, csc, csc_policy, currency, duplicate_policy, expmonth, expyear, external_mpi, identifier, match_avsa, mcc6012, merchantid, sdk, ship_to, threedsecure, trans_info, trans_type].hash\n end", "def dumpServer\n $evm.log(\"info\",\"#{@method} - Server:<#{$evm.root['miq_server'].name}> Begin Attributes\")\n $evm.root['miq_server'].attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Server:<#{$evm.root['miq_server'].name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - Server:<#{$evm.root['miq_server'].name}> End Attributes\")\n $evm.log(\"info\", \"\")\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; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def getDebugInfo\n debug = 0\n debug += self.peerip.size if self.peerip\n debug += self.recvip.size if self.recvip\n debug += self.sipfrom.size if self.sipfrom\n debug += self.uri.size if self.uri\n debug += self.useragent.size if self.useragent\n debug += self.peername.size if self.peername\n #debug += self.t38passthrough.size if self.t38passthrough\n if debug != 0\n debuginfo = Hash.new()\n self.peerip ? debuginfo[\"peerip\"] = self.peerip.to_s : debuginfo[\"peerip\"] = \"\"\n self.recvip ? debuginfo[\"recvip\"] = self.recvip.to_s : debuginfo[\"recvip\"] =\"\"\n self.sipfrom ? debuginfo[\"sipfrom\"] = self.sipfrom.to_s : debuginfo[\"sipfrom\"] = \"\"\n self.useragent ? debuginfo[\"useragent\"] = self.useragent.to_s : debuginfo[\"useragent\"] =\"\"\n self.peername ? debuginfo[\"peername\"] = self.peername.to_s : debuginfo[\"peername\"] = \"\"\n self.uri ? debuginfo[\"uri\"] = self.uri.to_s : debuginfo[\"uri\"] =\"\"\n self.t38passthrough ? debuginfo[\"t38passthrough\"] = self.t38passthrough.to_s : debuginfo[\"t38passthrough\"] = \"\"\n return debuginfo\n else\n return nil\n end\n end", "def checksum\n fil_header[:checksum]\n end", "def digest\n Digest::MD5.hexdigest(id.to_s+Interactiff::Application.config.secret_token).to_i(16).to_s[3,8]\n end", "def getTimestamps(cfg)\n hw_ts = nil\n sw_ts = nil\n cfg.each do |c|\n # Here, the first two 64-bit fields are sw stamps, two are not used,\n # and the last two contains the hw stamp we are looking for.\n if c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPING)\n hw_ts = c.data.unpack(\"q*\")[4..5]\n elsif c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPNS)\n sw_ts = c.data.unpack(\"qq\")\n end\n\n end\n return sw_ts,hw_ts\n end", "def hash\n [application, authorized_entity, platform, attest_status, app_signer, connection_type, connect_date, rel].hash\n end", "def hash\n [last_price, last_time, last_size, bid_price, bid_size, ask_price, ask_size, open_price, close_price, high_price, low_price, exchange_volume, market_volume, updated_on, source, listing_venue, sales_conditions, quote_conditions, market_center_code, is_darkpool, security].hash\n end", "def hash\n [status, area, days_on_market, originating_system_name].hash\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def calculate_payload_hash\n\t\treturn Digest::SHA2.hexdigest( self.payload )\n\tend", "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 config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end", "def hash\n [aperture_value, body_serial_number, brightness_value, cfa_pattern, camera_owner_name, color_space, components_configuration, compressed_bits_per_pixel, contrast, custom_rendered, date_time_digitized, date_time_original, device_setting_description, digital_zoom_ratio, exif_version, exposure_bias_value, exposure_index, exposure_mode, exposure_program, exposure_time, f_number, file_source, flash, flash_energy, flashpix_version, focal_length, focal_length_in35_mm_film, focal_plane_resolution_unit, focal_plane_x_resolution, focal_plane_y_resolution, gps_altitude, gps_altitude_ref, gps_area_information, gpsdop, gps_dest_bearing, gps_dest_bearing_ref, gps_dest_distance, gps_dest_distance_ref, gps_dest_latitude, gps_dest_latitude_ref, gps_dest_longitude, gps_dest_longitude_ref, gps_differential, gps_img_direction, gps_img_direction_ref, gps_date_stamp, gps_latitude, gps_latitude_ref, gps_longitude, gps_longitude_ref, gps_map_datum, gps_measure_mode, gps_processing_method, gps_satellites, gps_speed, gps_speed_ref, gps_status, gps_timestamp, gps_track, gps_track_ref, gps_version_id, gain_control, gamma, iso_speed, iso_speed_latitude_yyy, iso_speed_latitude_zzz, photographic_sensitivity, image_unique_id, lens_make, lens_model, lens_serial_number, lens_specification, light_source, maker_note_raw_data, max_aperture_value, metering_mode, oecf, pixel_x_dimension, pixel_y_dimension, recommended_exposure_index, related_sound_file, saturation, scene_capture_type, scene_type, sensing_method, sensitivity_type, sharpness, shutter_speed_value, spatial_frequency_response, spectral_sensitivity, standard_output_sensitivity, subject_area, subject_distance, subject_distance_range, subject_location, subsec_time, subsec_time_digitized, subsec_time_original, user_comment, white_balance, white_point].hash\n end", "def hexhash\n hash.to_s(16)\n end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end", "def hash\n [__meta, created_at, updated_at, customer, reusable, status, token].hash\n end", "def hash\n [created, customer_impact_duration, customer_impact_end, customer_impact_scope, customer_impact_start, customer_impacted, detected, fields, modified, notification_handles, public_id, resolved, time_to_detect, time_to_internal_response, time_to_repair, time_to_resolve, title].hash\n end", "def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def h2(msg)\n fail ReportError.new self, msg: 'util: can not h2 nil' if msg.nil?\n RbNaCl::Hash.sha256 RbNaCl::Hash.sha256 \"\\0\" * 32 + msg\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n [id, upload_time, polar_user, device, start_time, duration, calories, distance, heart_rate, training_load, sport, has_route, club_id, club_name, detailed_sport_info].hash\n end", "def hash\n [_403, _404, _500, _504, start_timestamp, end_timestamp, start_datetime, end_datetime, total_requests, cache_hits, cache_hit_rate, total_request_time, avg_origin_response_time, response_time_ms, _100_x, _20_x, _30_x, _40_x, _50_x, _50th, _95th, _99th].hash\n end", "def get_timestamp headers\n headers['Fecha']\n end", "def hash\n [id, id_account, webid, application_date, date, value, gross_value, nature, original_wording, simplified_wording, stemmed_wording, wording, id_category, state, date_scraped, rdate, vdate, bdate, coming, active, id_cluster, comment, last_update, deleted, original_value, original_gross_value, original_currency, commission, commission_currency, country, counterparty, card].hash\n end", "def sha\n id.sha\n end", "def fingerprint(res)\n version = \"Puppetmaster\"\n puppet_ver = \"< 3.3.1-rc3\"\n http_fingerprint({ :response => res })\n\n data = res.headers['X-Puppet-Version']\n if data\n version << \" #{data}\"\n else\n version << \" #{puppet_ver}\"\n end\n\n data = res.headers['Server']\n version << \" running on #{data}\" if data\n return version\n end", "def details\n data = Storm::Base::SODServer.remote_call '/Server/details',\n :uniq_id => @uniq_id\n self.from_hash data\n end", "def calculate_hash(apikey, apisecret, timestamp, parameters)\n # gather values included in hash, sort them alphabetically\n\tsig_params = Hash.new\n\tsig_params[:apikey] = apikey\n\tsig_params[:apisecret] = apisecret\n\tsig_params[:ts] = timestamp\n\t\n\t# stringify the values to be hashed - e.g. key1=value1&key2=value2&key3=value3\n\tstring_to_hash = ''\n\tsig_params.sort.map do |key,value|\n\t string_to_hash = string_to_hash + key.to_s + \"=\" + value.to_s + \"&\"\n\tend\n\tstring_to_hash = string_to_hash.chomp('&') # Ensuring that the last '&' is removed.\n\t\n\t# compute the SHA256 hash and return as a string\n\tDigest::SHA256.hexdigest(string_to_hash).to_s\nend", "def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend", "def getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend", "def digest\n Digest::SHA2.new\n end", "def hash_from_payload(payload)\n Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack(\"H*\")[0]\n end", "def hash\n [returned_balances, tags, transaction_type, token, ref_transaction, node, network, sub_network, mid, tid, stan, ca_name, ca_street, ca_zip, ca_city, ca_region, ca_country, function_code, reason_code, response_code, approval_number, display_message, date, transmission_date, local_transaction_date, capture_date, settlement_date, itc, irc, currency_code, amount, additional_amount, acquirer_fee, issuer_fee, rc, extrc, duration, cardholder, acting_cardholder, card, account, account2, mcc, network_reference_id, acquirer_reference_id, retrieval_reference_number, forwarding_inst_id, network_mid, request_amount, transaction_state, remote_host, response_amount, expiration_time, incoming_network_request_itc, digital_wallet_token, tranlog_attributes, payload, layer, transaction_name, originator, acquirer, gpaorder, gateway_log].hash\n end", "def parse_info(block)\r\n\t\tinfo = Hash.new\r\n\t\tinfo['original'] = block\r\n\r\n\t\tblock = block.split('|')\t# splits the block by the regex '|'\r\n\t\tif block.length != 5\r\n\t\t\tputs 'Invalid block format, should consist of only 5 elements'\r\n\t\t\tputs 'BLOCKCHAIN INVALID'\r\n\t\t\texit()\r\n\t\tend\t\t\r\n\r\n\t\tinfo['id'] = block[0].to_i\r\n\t\tinfo['prev_hash'] = block[1]\r\n\t\tinfo['transaction'] = block[2].split(':')\t# splits transaction by the regex ':'\r\n\t\tinfo['ts'] = {'sec': block[3].split('.')[0].to_i, 'nsec': block[3].split('.')[1].to_i}\r\n\t\t#puts info['ts']\r\n\t\tinfo['self_hash'] = block[4]\r\n\t\treturn info\r\n\tend", "def timestamp\n self[:timestamp]\n end", "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end", "def hash\n [class_id, object_type, hardware_status, hcl_cimc_version, hcl_driver_name, hcl_driver_version, hcl_firmware_version, hcl_model, inv_cimc_version, inv_driver_name, inv_driver_version, inv_firmware_version, inv_model, reason, software_status, status, component, hcl_status].hash\n end", "def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end", "def hash\n [error, from_date, group_by, message, query, res_type, series, status, to_date].hash\n end", "def hash\n guid.hash\n end", "def hashes(log)\n return log.split(\"\\n\").map{|line| parser(line) }\n end" ]
[ "0.6000593", "0.5935062", "0.5913583", "0.58834237", "0.5822245", "0.58120126", "0.578311", "0.56563985", "0.56487066", "0.5637914", "0.5631631", "0.55961853", "0.5559007", "0.55397695", "0.55334884", "0.5509347", "0.5508729", "0.548707", "0.5477845", "0.5406288", "0.5386556", "0.53844786", "0.53749436", "0.5374541", "0.5362047", "0.5361133", "0.53576696", "0.53373855", "0.5334505", "0.53268987", "0.5323612", "0.5317375", "0.53172565", "0.5296997", "0.52725244", "0.5216946", "0.51995414", "0.5184027", "0.5183338", "0.51819855", "0.51819855", "0.5169911", "0.51697975", "0.5167944", "0.51671326", "0.51662743", "0.51659936", "0.51655203", "0.51655203", "0.51655203", "0.51655203", "0.51655203", "0.51655203", "0.51637995", "0.51568156", "0.5153552", "0.5146778", "0.51418394", "0.51373696", "0.5128176", "0.51246345", "0.51202184", "0.51194024", "0.5118555", "0.51068854", "0.5105574", "0.510427", "0.51006156", "0.50971913", "0.5096436", "0.50878567", "0.508728", "0.5086575", "0.50838256", "0.5077835", "0.5077835", "0.5077835", "0.5076409", "0.5075277", "0.5072253", "0.506555", "0.50611144", "0.50530636", "0.5050403", "0.50476444", "0.5040379", "0.5034294", "0.50317717", "0.5027009", "0.50238454", "0.5023694", "0.5023598", "0.50230783", "0.50230783", "0.5021308", "0.5017764", "0.50172853", "0.5016992", "0.5014647", "0.499931" ]
0.639813
0
GET /places/1 GET /places/1.xml
def show @place = Place.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @place } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @places = Place.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def index\n @places = Place.lookfor(params[:q])\n @places = @places.map{|p| {:tag=>p.tag,:id=>p.id,:name=>p.name}}\n respond_to do |format|\n format.xml { render :xml => @places }\n end\n end", "def show\n @place = @event.places.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end", "def index\n @places = @places.page params[:page]\n\n @feed_link = places_url(:format => :atom)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n format.atom { render :layout => false }\n end\n end", "def index\n @places = @event.places.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place.to_xml(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n format.json { render :json => @place.to_json(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n end\n end", "def locations(place)\n get :loc => place\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @travel_place = TravelPlace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @travel_place }\n end\n end", "def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end", "def show\n @places = @client.places.page params[:place_page]\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def fetch_xml(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http.read_timeout = GoogleCustomSearch.configuration.timeout\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.initialize_http_header({ 'User-Agent' => user_agent })\n\n response = http.request(request)\n\n raise GoogleCustomSearch::InvalidRequest if response.code.match(/[34]\\d{2}/)\n raise GoogleCustomSearch::ServerError if response.code.match(/5\\d{2}/)\n\n response.body\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "def index\n respond_to do |format|\n format.html {\n @places = Place.paginate(page: params[:page])\n }\n format.json {\n @places = Place.all\n }\n end\n end", "def index\n @marketplaces = Marketplace.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @marketplaces }\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address }\n end\n end", "def show\n @geoname = Geoname.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def index\n @places = Place.order(\"place_type_id\").order(\"town_id\").order(\"name\").page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def show\n respond_with @place, status: :ok, location: places_path(@place)\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @location }\n end\n end", "def index\n render json: @places\n end", "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n format.plist { render plist: @place }\n end\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @api_vi_places = Api::Vi::Place.all\n end", "def show\n @location = Location.find(:first, :conditions => [ \"geonameid = ?\", params[:id] ] )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @way = Way.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @way }\n end\n end", "def info\n @historic_place = HistoricPlace.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { render :xml => @historic_place }\n format.json { render :json => @historic_place }\n end\n end", "def index\n @places = Place.page(params[:page]).per(10).all\n end", "def show\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end", "def create_waypoint(city, state)\n url = \"http://local.yahooapis.com/MapsService/V1/geocode?appid=#{APP_ID}\"\n res = Net::HTTP.get(URI.parse( URI.escape(url + \"&state=#{state}&city=#{city}\") ))\n \n lat = res.slice(/Latitude\\>(.*)\\<\\/Latitude/,1)\n lon = res.slice(/Longitude\\>(.*)\\<\\/Longitude/,1)\n point = Waypoint.new :name=>city, :lon=>lon, :lat=>lat\n puts point\n point\nend", "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "def show\n place = Place.find(params[:id])\n\n render json: place\n end", "def show\n @place = Place.find(params[:id])\n render json: @place\n end", "def index\n @places = Place.all\n\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n @places = Place.all\n end", "def index\n respond_to do |format|\n format.html { @places = Place.order(:name) }\n format.json { @places = Place.order(:name) }\n end\n end", "def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end", "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "def locate(address)\n get :location => address\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @city }\n end\n end", "def index\n\t\t@places = Place.all\n\t\t@places = Place.paginate(:page => params[:page], :order => 'created_at DESC', :per_page => 4)\n\tend", "def show\n Project.hit 4\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location, callback: params[:callback] }\n format.xml { render xml: @location }\n end\n end", "def show\n @place = Place.find(params[:id])\n respond_with(@place)\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def index\n\t\t@places = Place.paginate(:page => params[:page], :per_page => 5)\n\n\tend", "def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end", "def google_places\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_KEY'])\n @results = @client.spots(params[:latitude], params[:longitude], :name => 'bar', :types => ['bar', 'night_club'], :radius => 10000)\n @spots = @results.map do |spot|\n spot.place_id = spot.id\n spot\n end\n render json: @spots\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: @place }\n end\n end", "def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end", "def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route }\n end\n end", "def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend", "def show\n if params[:distancia]\n distancia = params[:distancia]\n else\n distancia = 100\n end\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@place.latitude},#{@place.longitude}&radius=#{distancia}&type=#{params[:tipo]}&key=#{Rails.application.secrets.google_places_key}\"\n uri = URI(url)\n http_call = Net::HTTP.get(uri)\n response = JSON.parse(http_call, {:symbolize_names => true})\n @locations = response[:results]\n @hash = Gmaps4rails.build_markers(@place) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place[:name]\n end\n end", "def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @place = Place.find(params[:id])\n end", "def show\n @address_book_item = AddressBookItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_book_item }\n end\n end", "def show\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @waypoint }\n end\n end", "def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spot }\n end\n end", "def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spot }\n end\n end", "def show\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def show\n @google_map = GoogleMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @google_map }\n end\n end", "def show\n @place = Place.find_by(:id=> params[\"id\"])\n end", "def show\n @localmap = Localmap.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "def locate(address)\n get :geo, :q => address\n end", "def show\n @geo_country = Geo::Country.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @geo_country }\n end\n end", "def places(lat, lng)\n response = HTTParty.post(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{lat},#{lng}&radius=500&type=cafe&key=#{ENV['PLACES_API_KEY']}\")\n return response['results'][1]\n end", "def show\n @admin_town = Admin::Town.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @admin_town }\n end\n end", "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end" ]
[ "0.70868665", "0.6749994", "0.6707183", "0.66383576", "0.660664", "0.6579932", "0.6579619", "0.6539432", "0.6347312", "0.6338752", "0.6288413", "0.6238508", "0.6133827", "0.6062072", "0.60595745", "0.60522354", "0.60425276", "0.59225714", "0.5920716", "0.59172386", "0.5905921", "0.5905921", "0.5905921", "0.5888949", "0.5888949", "0.5888949", "0.5888949", "0.5888949", "0.5888949", "0.5888949", "0.5885438", "0.58773035", "0.58689344", "0.5859061", "0.583107", "0.5822359", "0.5822359", "0.5822359", "0.5822359", "0.5822359", "0.5822359", "0.581633", "0.5804216", "0.58032674", "0.579492", "0.578887", "0.57740587", "0.57721245", "0.5765177", "0.57597345", "0.57572794", "0.575081", "0.57398784", "0.57387334", "0.57387334", "0.57387334", "0.5737329", "0.57345", "0.57081825", "0.57016116", "0.5697818", "0.56913644", "0.5689234", "0.5682139", "0.56663376", "0.5661426", "0.56574184", "0.5656683", "0.565597", "0.565597", "0.565597", "0.565597", "0.565597", "0.565597", "0.565597", "0.565404", "0.565402", "0.565402", "0.5651621", "0.56442714", "0.5639796", "0.5631864", "0.5624493", "0.5610347", "0.56036925", "0.55882734", "0.5588093", "0.5586031", "0.5582413", "0.5581808", "0.5580534", "0.55785954", "0.5578249", "0.55738556", "0.55660594", "0.5560648" ]
0.67937523
5
GET /places/new GET /places/new.xml
def new @place = Place.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @place } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @place = @event.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @travel_place = TravelPlace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n\t@meta[:title] = \"DondeVoyAComer.com | Ingresar nuevo local de comida\"\n\t @current_page = \"add\"\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end", "def new\n @address = Address.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address }\n end\n end", "def new\n place = Place.new\n\n render json: place\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\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 @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @place = Place.new\n respond_with(@place)\n end", "def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end", "def new\n @way = Way.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @way }\n end\n end", "def new\n @map = Map.new\n\n puts @saved_locations\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @address_type = AddressType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(admin_place_path(@place), :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @person = Person.new\n @person.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end", "def new\n @location = Location.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @location }\n format.json { render :text => @location.to_json }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @photo = Photo.new\n @place = Place.find(params[:place_id]) \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @location = Location.new\n @pages = {}\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend", "def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end", "def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end", "def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end", "def new\n @place = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @town_type = TownType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town_type }\n end\n end", "def new\n @admin_town = Admin::Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @admin_town }\n end\n end", "def new\n @web_location = WebLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @web_location }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_region }\n end\n end", "def new\n #TODO\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end", "def new\n @place = Place.new\n end", "def new\n @place = Place.new\n end", "def new\n \t@place = Place.new\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 @provider = Provider.new\n @provider.locations.build\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 @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @station }\n end\n end", "def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @park = Park.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @park }\n end\n end", "def new\n @park = Park.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @park }\n end\n end", "def new\n @location_tag = LocationTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location_tag }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @address_book = AddressBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book }\n end\n end", "def new\n # if (params[:map_link])\n # check_slashes(params[:map_link])\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @url_search = UrlSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_search }\n end\n end", "def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n @location = Location.new(:status=>1)\n init_new_form\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @post_code = PostCode.new\n @towns = Town.find :all \n @geo_positions = GeoPosition.find :all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post_code }\n end\n end", "def getnewaddress\n @api.request 'getnewaddress'\n end", "def new\n @place = Place.new\n end", "def new\n @location = Location.new\n \n respond_to do |format|\n format.fbml # new.fbml.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @weather_location = WeatherLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weather_location }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n klass = (params[:type] || \"Location\").constantize\n klass = Location unless klass.new.is_a?(Location)\n @location = klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end", "def new\n @subway = Subway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "def new\n @place = Place.new( :status => Status.active )\n @locals = Local.all\n @ticket_type_groups = TicketTypeGroup.order(:value)\n @statuses = Status.order(:value)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @place }\n end\n end", "def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end", "def create\n @place = @event.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to([@event,@place], :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @place = Place.new\n \n render_standard :data => @place\n end", "def new\n @kingdom = Kingdom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kingdom }\n end\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end" ]
[ "0.71660686", "0.70630187", "0.69331986", "0.69331986", "0.69331986", "0.69331986", "0.69331986", "0.6907546", "0.68690354", "0.679841", "0.67375517", "0.6726614", "0.6693176", "0.6676003", "0.6676003", "0.667547", "0.66647315", "0.6628229", "0.6614093", "0.6614093", "0.65887505", "0.65878487", "0.65878487", "0.65878487", "0.65878487", "0.65878487", "0.65878487", "0.6581669", "0.6575197", "0.65711105", "0.65200996", "0.6493907", "0.6485147", "0.6482842", "0.6480145", "0.64587116", "0.6450449", "0.64488035", "0.64179087", "0.6416451", "0.6393133", "0.6376075", "0.6367216", "0.63622135", "0.6355647", "0.63426644", "0.6340327", "0.63306445", "0.6327662", "0.63108087", "0.630922", "0.6303465", "0.6285619", "0.6284389", "0.62796396", "0.6278392", "0.6278392", "0.6276994", "0.62613493", "0.6254963", "0.6241706", "0.6237284", "0.6232375", "0.6228237", "0.6228237", "0.62231326", "0.62197375", "0.62156945", "0.6214987", "0.621374", "0.62121737", "0.6208288", "0.6203205", "0.6196063", "0.61859554", "0.6178926", "0.61719453", "0.61685646", "0.616842", "0.6165615", "0.61644155", "0.6163964", "0.61628675", "0.61590236", "0.61590236", "0.61590236", "0.61579126", "0.6156463", "0.6156234", "0.6154213", "0.61418694", "0.61418056", "0.6134525", "0.6122032" ]
0.76149035
6
POST /places POST /places.xml
def create @place = Place.new(params[:place]) respond_to do |format| if @place.save flash[:notice] = 'Place was successfully created.' format.html { redirect_to(@place) } format.xml { render :xml => @place, :status => :created, :location => @place } else format.html { render :action => "new" } format.xml { render :xml => @place.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = @event.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to([@event,@place], :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(admin_place_path(@place), :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @travel_place = TravelPlace.new(params[:travel_place])\n\n respond_to do |format|\n if @travel_place.save\n flash[:notice] = 'TravelPlace was successfully created.'\n format.html { redirect_to(@travel_place) }\n format.xml { render :xml => @travel_place, :status => :created, :location => @travel_place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to new_service_direction_path, notice: 'place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end", "def create\n @place = Place.new(params[:place])\n\n if not @place.address == \"\"\n @place.lat = Geocoder.coordinates(@place.address)[0];\n @place.lon = Geocoder.coordinates(@place.address)[1];\n end\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to cms_places_path, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = current_merchant.places.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n @place.cuisine_type_ids = params[:place][:cuisine_type_ids]\n @place.highlight_ids = params[:place][:highlight_ids]\n @place.dining_type_ids = params[:place][:dining_type_ids]\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n place = Place.new(place_params)\n\n if place.save\n render json: place, status: 201\n\n else\n render json: { errors: place.errors}, status: 422\n end\n\n end", "def new\n @place = @event.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def index\n @places = Place.lookfor(params[:q])\n @places = @places.map{|p| {:tag=>p.tag,:id=>p.id,:name=>p.name}}\n respond_to do |format|\n format.xml { render :xml => @places }\n end\n end", "def create\n @place = Place.new(params[:place])\n\t@place.active = true\n\n respond_to do |format|\n if @place.save\n\t\tcurrent_user.points += APP_CONFIG['new_place']\n\t\tcurrent_user.save\n\n\t\tact = Action.new({:owner_user_id => current_user.id, :code => :new_place})\n\t\tact.set_attributes({:place => @place})\n\t\tact.save\n\n\n format.html { redirect_to(@place, :notice => 'El local fue creado correctamente!') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n if @place.save\n redirect_to @place, notice: \"Place was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n @place = Place.new(place_params)\n # @trip = Trip.find(params[:trip_id])\n # @trip.places << @place\n # @place.author = current_user\n respond_to do |format|\n if @place.save\n format.html { redirect_to partner_places_path, notice: 'Le lieu a été crée.' }\n # format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n # format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place } #, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end", "def create\n @admin_place = Admin::Place.new(admin_place_params)\n\n respond_to do |format|\n if @admin_place.save\n format.html { redirect_to @admin_place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @admin_place }\n else\n format.html { render :new }\n format.json { render json: @admin_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = @site.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to organisation_site_path(@site.organisation, @site), notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to [:admin, @place], notice: t('messages.created', model:Place.model_name.human) }\n format.json { render action: 'show', status: :created, location: @place }\n else\n format.html { render action: 'new' }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n respond_if_is_true_web(format, places_url, 'Place was successfully created.', :show, :created, @place)\n else\n respond_if_is_false_web(format, :new, :unprocessable_entity, @place.errors, :unprocessable_entity)\n end\n end\n end", "def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n\n @client = GooglePlaces::Client.new(\"AIzaSyDslRFZO4CcrhN9M9gchkS0VKLWrOB8J_Y\")\n\n # @attractions = JSON.parse(@trip.tag).join(' ')\n places = @client.spots_by_query(\"tourist landmark in #{@trip.location} \", :radius => @trip.location_radius, :exclude => 'lodging')\n\n # https://maps.googleapis.com/maps/api/place/textsearch/json?query=points+of+interest+for+tourists+in+aberdeen&radius=5000&key=AIzaSyCsJcCSDOx5fdOlmWagQZabLeAe6EGxNSI\n\n places.take(@trip.sightsnum).each do |place|\n if place.photos[0]\n photo_url = place.photos[0].fetch_url(800)\n end\n p = @trip.places.create :name => place.name, :google_id => place.place_id, :latitude => place.lat, :longitude => place.lng, :photo_url => photo_url\n end\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def places\n body['places'].map { |p| Place.new(p, name) }\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def place_params\n params.require(:place).permit(:name, :category, :address, :latitude, :longitude, :tel, :url)\n end", "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end", "def create\n @dataele_place = DataelePlace.new(params[:dataele_place])\n\n respond_to do |format|\n if @dataele_place.save\n format.html { redirect_to @dataele_place, notice: 'Dataele place was successfully created.' }\n format.json { render json: @dataele_place, status: :created, location: @dataele_place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataele_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_params\n params.require(:place).permit(:name, :description, :address)\n end", "def create\n @place = Place.new(place_params)\n\n \n @place.save\n \n \n \n end", "def add_address\n \n params[:place]\n address = ReceiverAddress.new(:label => params[:place], \n :city_id => params[:city_id], \n :address => params[:address])\n @receive.document = \"234\"\n @receiver.receiver_addresses << address\n respond_to do |format|\n format.html { render @receiver, action ='new'}\n end\n end", "def place_params\n params.require(:place).permit(:name, :description, :neighborhood, :rating, :address, :latitude, :longitude, :location)\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def create\n @place = Place.new(place_params)\n\n @place.user_id = current_user.id\n\n add_tags\n \n if @place.save\n @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @restaurant_place = RestaurantPlace.new(restaurant_place_params)\n\n respond_to do |format|\n if @restaurant_place.save\n format.html { redirect_to @restaurant_place, notice: 'Restaurant place was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restaurant_place }\n else\n format.html { render action: 'new' }\n format.json { render json: @restaurant_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def create\n @schedule_place = SchedulePlace.new(schedule_place_params)\n\n respond_to do |format|\n if @schedule_place.save\n format.html { redirect_to schedule_places_path }\n format.json { render :show, status: :created, location: @schedule_place }\n else\n format.html { render :new }\n format.json { render json: @schedule_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = current_user.places.create(place_params)\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def place_params\n params.require(:place).permit(:address, :latitude, :longitude, :descricao)\n end", "def create\n @place = Place.new(params[:place])\n @place.apply_geo(params[:coordinates])\n \n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: I18n.t('views.messages.places.notifications.create') }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tp = Place.new\n\t\tp.title = params['title']\n\t\tp.photo_url = params['photo_url']\n\t\tp.admission_price = params['admission_price']\n\t\tp.description = params['description']\n\t\tp.save\n\t\tredirect_to \"/\"\n\tend", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end", "def place_params\n params.require(:place).permit(:name, :content, :latitude, :longitude)\n end", "def create\n redirect_to(root_url) unless current_user\n\n @place = current_user.places.build(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_place = UserPlace.new(user_place_params)\n\n respond_to do |format|\n if @user_place.save\n format.html { redirect_to @user_place, notice: 'User place was successfully created.' }\n format.json { render json: @user_place }\n else\n format.html { render :new }\n format.json { render json: @user_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def place_params\n params.require(:place).permit(:name, :longitude, :latitude)\n end", "def place_params\n params.require(:place).permit(:latitude, :longitude, :place_name)\n end", "def place_params\n params.require(:place).permit :name,\n :enabled,\n :printer_name,\n :printer_ip,\n :abn,\n :code,\n :address,\n :phone,\n :description,\n :map,\n :photo\n end", "def create\n @place = current_user.places.create(place_params)\n #Check if validations are passed and the record actually got saved to our database\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n @address_type = AddressType.new(params[:address_type])\n\n respond_to do |format|\n if @address_type.save\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully created.') }\n format.xml { render :xml => @address_type, :status => :created, :location => @address_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tourist_place = TouristPlace.new(tourist_place_params)\n\n respond_to do |format|\n if @tourist_place.save\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_place }\n else\n format.html { render :new }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def resource_params\n params.require(:address).permit(:place, :codigopostal, :estado, :municipio, :colonia, :domicilio, :country)\n end", "def create\n @place = Place.new(place_params.except(:location))\n @place.creator_id = @current_creator.id\n \n # Create a new location or use an existing location\n if !place_params[:location] || place_params[:location].nil?\n render json: { error: \"The location was not provided\"}, status: :bad_request\n else\n get_location\n @place.location = @location\n \n #Save the place\n if @place.save\n render json: serialize_place(@place), status: :created\n else\n render json: { error: \"Something went wrong, the place could not be saved\" }, status: :bad_request\n end\n end \n end", "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "def place\n raise CatalogAPI::Error, 'No Items' if items.nil? || items.length.zero?\n raise CatalogAPI::Error, 'No Socket ID' if items.first.socket_id.nil?\n raise CatalogAPI::Error, 'No First Name' if first_name.nil?\n raise CatalogAPI::Error, 'No Last Name' if last_name.nil?\n raise CatalogAPI::Error, 'No Adress1' if address_1.nil?\n raise CatalogAPI::Error, 'No City' if city.nil?\n raise CatalogAPI::Error, 'No State' if state_province.nil?\n raise CatalogAPI::Error, 'No Postal Code' if postal_code.nil?\n raise CatalogAPI::Error, 'No Country' if country.nil?\n raise CatalogAPI::Error, 'No Items' if items.nil?\n\n request = CatalogAPI.request.new(:order_place)\n request.post(place_params(request))\n json = request.json.dig(:order_place_response, :order_place_result)\n request.data = CatalogAPI::Order.new(json)\n request\n end", "def create\n @place = Place.new(params[:place])\n\n add_missing_translation_content(@place.place_translations)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to place_path(@place), notice: t('app.msgs.success_created', :obj => t('activerecord.models.place')) }\n format.json { render json: @place, status: :created, location: @place }\n else\n @place.name = params[:place][:name]\n @place.address = @place.place_translations.first.address\n @venue_categories = VenueCategory.with_venues\n @show_map = true\n\n gon.show_place_form = true\n gon.edit_place_form = true\n gon.default_address_selection_index = params[:address]\n gon.address_search_path = address_search_places_path\n gon.near_venue_id = @place.venue_id\n if @place.lat.present? && @place.lon.present?\n gon.lat = @place.lat\n gon.lon = @place.lon\n end\n\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def post_business(business, location)\n xml = Builder::XmlMarkup.new\n query = xml.tag!(\"BPMSPost\", 'Edition' => \"1.1\") {\n xml.tag!(\"Record\") {\n xml.tag!(\"Phone\", location.phone)\n xml.tag!(\"BusinessName\", location.location_name)\n xml.tag!(\"Address\", location.address)\n xml.tag!(\"City\", location.city)\n xml.tag!(\"State\", location.state)\n xml.tag!(\"Zip\", location.zip)\n xml.tag!(\"URL\", location.website_url)\n xml.tag!(\"TagLine\", location.special_offer)\n #xml.tag!(\"LogoImage\", location.logo)\n xml.tag!(\"Categories\") {\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Primary\")\n xml.tag!(\"Name\", business.industry_primary)\n }\n if business.industry_alt_1.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt1\")\n xml.tag!(\"Name\", business.industry_alt_1)\n }\n end\n if business.industry_alt_2.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt2\")\n xml.tag!(\"Name\", business.industry_alt_2)\n }\n end\n }\n }\n }\n body = build_request(3700, 1510, query)\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n xml_doc['Error'] == '0' # success (returns true/false)\n end", "def place_params\n params.require(:place).permit(:title, :description, :user_id, :lat, :lng, :category_id, :name)\n end", "def create\n @api_vi_place = Api::Vi::Place.new(api_vi_place_params)\n\n if @api_vi_place.save\n render :show, status: :created, location: @api_vi_place\n else\n render json: @api_vi_place.errors, status: :unprocessable_entity\n end\n end", "def addPlace\n params[:new_place]\n end", "def create\n @post_code = PostCode.new(params[:post_code])\n @towns = Town.find :all \n @geo_positions = GeoPosition.find :all\n \n respond_to do |format|\n if @post_code.save\n flash[:notice] = 'PostCode was successfully created.'\n format.html { redirect_to(@post_code) }\n format.xml { render :xml => @post_code, :status => :created, :location => @post_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n @visited_place = VisitedPlace.new(visited_place_params)\n\n respond_to do |format|\n if @visited_place.save\n format.html { redirect_to @visited_place, notice: 'Visited place was successfully created.' }\n format.json { render :show, status: :created, location: @visited_place }\n else\n format.html { render :new }\n format.json { render json: @visited_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_params\n params.require(:place).permit(:name, :address, :city_id)\n end", "def restaurant_place_params\n params.require(:restaurant_place).permit(:name, :address)\n end", "def place_params\n params.require(:place).permit(:title, :url, :latitude, :longitude, :content, :address, :source, :hours)\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def index\n @places = @event.places.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @places }\n end\n end", "def create\n # expire_page :action => :index\n @place = Place.new(params[:place])\n @place.save\n respond_with(@place)\n end", "def create\n @place = Place.new(user_id: params[:user_id], place_name: params[:place_name], latitude: params[:latitude], longitude: params[:longitude])\n\n if @place.save\n @trip_point = TripPoint.new(trip_id: params[:trip_id], place_id: @place.id, place_type: \"Favorite\")\n @trip_point.save!\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Creation failed.\"]}\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def place_params\n params.require(:place).permit(:name, :address, :slug)\n end", "def create\n @notable_place = @system.notable_places.new(notable_place_params)\n\n respond_to do |format|\n if @notable_place.save\n format.html { redirect_to campaign_system_notable_places_path(@campaign, @system), notice: \"Notable place was successfully created.\" }\n format.json { render :show, status: :created, location: @notable_place }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @notable_place.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6196169", "0.61007696", "0.6077837", "0.60313135", "0.5999693", "0.5840869", "0.58246005", "0.5755907", "0.5734695", "0.5729121", "0.57287043", "0.57287043", "0.57287043", "0.5716145", "0.57081753", "0.57081574", "0.57081574", "0.57081574", "0.57081574", "0.56898564", "0.5654004", "0.5623909", "0.5623556", "0.5610788", "0.56033623", "0.55927795", "0.5576345", "0.555715", "0.5547494", "0.55466044", "0.5526911", "0.55094373", "0.54993176", "0.5491291", "0.5442462", "0.543913", "0.5435853", "0.54354984", "0.5418526", "0.5417755", "0.5403691", "0.53641635", "0.5354364", "0.5350963", "0.5350963", "0.5350963", "0.5350963", "0.5350963", "0.5350963", "0.5350963", "0.5342242", "0.5338719", "0.5334567", "0.5332342", "0.5330399", "0.532874", "0.5318939", "0.5315329", "0.5310625", "0.530604", "0.5305277", "0.530348", "0.5302822", "0.5297333", "0.5293368", "0.52877414", "0.52782863", "0.5271977", "0.52515376", "0.5250436", "0.5247345", "0.52445424", "0.5230126", "0.522672", "0.5225603", "0.52249587", "0.5220422", "0.52139986", "0.52123654", "0.52121353", "0.52022135", "0.51905423", "0.51879656", "0.5187211", "0.51834315", "0.5178161", "0.51737577", "0.5160568", "0.51443756", "0.51355934", "0.51354575", "0.5133652", "0.5132538", "0.51320386", "0.5130742", "0.5124962", "0.51238483", "0.5110564", "0.51099175" ]
0.61501765
2
PUT /places/1 PUT /places/1.xml
def update @place = Place.find(params[:id]) respond_to do |format| if @place.update_attributes(params[:place]) flash[:notice] = 'Place was successfully updated.' format.html { redirect_to(@place) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @place.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @place = @event.places.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to([@event, @place], :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = 'Place was successfully updated.'\n format.html { redirect_to(@place) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n format.json { render :nothing => true }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n place = Place.find(params[:id])\n\n if place.update_attributes(params[:place])\n head :no_content\n else\n render json: place.errors, status: :unprocessable_entity\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 @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(admin_place_path(@place), :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = @site.places.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to [@site, @place], notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n if not @place.address == \"\"\n @place.lat = Geocoder.coordinates(@place.address)[0];\n @place.lon = Geocoder.coordinates(@place.address)[1];\n end\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @travel_place = TravelPlace.find(params[:id])\n\n respond_to do |format|\n if @travel_place.update_attributes(params[:travel_place])\n flash[:notice] = 'TravelPlace was successfully updated.'\n format.html { redirect_to(@travel_place) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @travel_place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to cms_places_path, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n if @place.update(place_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Update failed.\"]}\n end\n end", "def update\n @place = Place.find_by(:id => params[\"id\"])\n @place.title = params[\"title\"]\n @place.photo_url = params[\"photo_url\"]\n @place.admission_price = params[\"price\"]\n @place.description = params[\"description\"]\n @place.save\n redirect_to \"/places/#{@place.id}\"\n end", "def update\n # expire_page :action => :index\n @place = Place.find(params[:id])\n @place.update_attributes(params[:place])\n respond_with(@place)\n end", "def put(*args)\n request :put, *args\n end", "def put!\n request! :put\n end", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @place.tags.destroy_all\n\n @place.user_id = current_user.id\n\n add_tags\n\n if @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end", "def update\n puts place_params\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to partner_place_path(@place[:id]), notice: 'Les modifications ont été enregistrées.' }\n # format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n # format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @place = Place.find(params[:id])\n @place.apply_geo(params[:coordinates])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: I18n.t('views.messages.places.notifications.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @place.update(place_params)\n redirect_to @place, notice: \"Place was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end", "def update\n if @place.update(place_params)\n render :show, status: :ok, location: @place\n else\n render json: @place.errors, status: :unprocessable_entity\n end\n end", "def put(path, options={})\n request :put, path, options\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place } #, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tp = Place.find_by(:id=> params[\"id\"])\n\n\t\tif p != nil\n\t\t\tp.title = params['title']\n\t\t\tp.photo_url = params['photo_url']\n\t\t\tp.admission_price = params['admission_price']\n\t\t\tp.description = params['description']\n\t\t\tp.save\n\t\t\tredirect_to \"/\"\n\t\telse\n\t\t\tredirect_to \"/\", notice: \"Place not found in this app!\"\n\t\tend\n\tend", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def put(*args)\n request(:put, *args)\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to [:admin, @place], notice: t('messages.updated', model:Place.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def put(path, options={})\n send_request 'put', path, options\n end", "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def update\n @place = Place.find(params[:id])\n @locals = Local.all\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n respond_if_is_true_web(format, places_url, 'Place was successfully updated.', :show, :ok, @place)\n else\n respond_if_is_false_web(format, :new, :unprocessable_entity, @place.errors, :unprocessable_entity)\n end\n end\n end", "def update\n if @api_vi_place.update(api_vi_place_params)\n render :show, status: :ok, location: @api_vi_place\n else\n render json: @api_vi_place.errors, status: :unprocessable_entity\n end\n end", "def set_places\n @place = Place.find(params[:id])\n end", "def update!(**args)\n @places = args[:places] if args.key?(:places)\n end", "def update\n @place.user = current_user\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n Log.logit!(:places, :notice, \"User updated place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n place = Place.find(params[:id])\n map = Map.find(params[:map_id])\n #place.update(place_params)\n place_attrs = place_params\n #binding.pry\n map.adjust_place(place, place_attrs)\n redirect_to edit_map_path(map)\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def update\n respond_to do |format|\n if @admin_place.update(admin_place_params)\n format.html { redirect_to @admin_place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_place }\n else\n format.html { render :edit }\n format.json { render json: @admin_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n @title = \"თაროს რედაქტირება\"\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = \"თარო #{@place.name} განახლებულია.\"\n format.html { redirect_to(:action=>'index', :parent_id => (@place.parent ? @place.parent : nil)) }\n# format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n# format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def update\n put :update\n end", "def update\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:venue])\n format.html { redirect_to @place, notice: 'Venue.was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n respond_to do |format|\n if @tourist_place.update(tourist_place_params)\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully updated.' }\n format.json { render :show, status: :ok, location: @tourist_place }\n else\n format.html { render :edit }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def update\n @dataele_place = DataelePlace.find(params[:id])\n\n respond_to do |format|\n if @dataele_place.update_attributes(params[:dataele_place])\n format.html { redirect_to @dataele_place, notice: 'Dataele place was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataele_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(path, params)\n request(:put, path, params)\n end", "def update\n redirect_to(root_url) unless current_user.id == @place.user.id\n\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place = Place.find(params[:id])\n\n @place.assign_attributes(params[:place])\n\n add_missing_translation_content(@place.place_translations)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to place_path(@place), notice: t('app.msgs.success_updated', :obj => t('activerecord.models.place')) }\n format.json { head :ok }\n else\n @venue_categories = VenueCategory.with_venues\n @show_map = true\n gon.show_place_form = true\n gon.edit_place_form = true\n gon.default_address_selection_index = params[:address]\n gon.address_search_path = address_search_places_path\n gon.near_venue_id = @place.venue_id\n if @place.lat.present? && @place.lon.present?\n gon.lat = @place.lat\n gon.lon = @place.lon\n end\n\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @place_visit = PlaceVisit.find(params[:id])\n\n if @place_visit.update(place_visit_params)\n head :no_content\n else\n render json: @place_visit.errors, status: :unprocessable_entity\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n if params[:place_id]\n @safe_house = Place.find(params[:place_id])\n place_id_present = true\n end\n\n respond_to do |format|\n if place_id_present && @safe_house.update_attributes( :name => params[:name],\n :zombie_probability => params[:zombie_probability],\n :latitude => params[:latitude],\n :longitude => params[:longitude],\n :has_weapons => params[:has_weapons],\n :has_food => params[:has_food],\n :has_people => params[:has_people])\n format.json { render :json => { :status => \"OK\", :response => {:updated => true} }}\n else\n format.json { render :json => { :status => \"Error\", :response => {} }}\n end\n end\n end" ]
[ "0.6674657", "0.64221364", "0.63929063", "0.63915205", "0.63915205", "0.636533", "0.62242603", "0.61510205", "0.6067097", "0.6041314", "0.6041314", "0.6041314", "0.6041314", "0.6041314", "0.60403854", "0.5966747", "0.5951642", "0.588858", "0.5887603", "0.5852387", "0.5844916", "0.5838387", "0.5828568", "0.5824182", "0.58176595", "0.5793524", "0.57683927", "0.57683927", "0.57683927", "0.57512736", "0.5748885", "0.5735983", "0.5722225", "0.56730646", "0.56699014", "0.5666419", "0.5662278", "0.5659013", "0.5655849", "0.5640424", "0.5628398", "0.56237024", "0.56092656", "0.5594026", "0.5565525", "0.55629295", "0.55412215", "0.553694", "0.5533054", "0.550808", "0.550808", "0.5497871", "0.5490654", "0.5481713", "0.54775304", "0.54734784", "0.54678845", "0.54604214", "0.5451427", "0.54496354", "0.54443854", "0.5442218", "0.5442218", "0.5441368", "0.54370344", "0.5436967", "0.5436967", "0.5436967", "0.5436967", "0.5436967", "0.5436967", "0.5436967", "0.5436967", "0.5436511", "0.5436511", "0.5436511", "0.54346055", "0.5427849", "0.54270136", "0.5426888", "0.542628", "0.542003", "0.54118955", "0.5404992", "0.53879064", "0.5381145", "0.5377887", "0.5376884", "0.5375897", "0.5374574", "0.53713393", "0.5367298", "0.5364553", "0.5360902", "0.5359651", "0.5354009", "0.5354009", "0.534986" ]
0.64036614
4
DELETE /places/1 DELETE /places/1.xml
def destroy @place = Place.find(params[:id]) @place.destroy respond_to do |format| format.html { redirect_to(places_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_places_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place = @event.places.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_places_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 # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(addresses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @travel_place = TravelPlace.find(params[:id])\n @travel_place.destroy\n\n respond_to do |format|\n format.html { redirect_to(travel_places_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n place = Place.find(params[:id])\n place.destroy\n\n head :no_content\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'index') }\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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @place = Place.find(params[:id])\n @place.comments.delete_all\n @place.rates.delete_all\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n # delete the place and its evaluations\n @place.destroy\n # delete the summaries for this place\n PlaceSummary.where(:place_id => params[:id]).destroy_all\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end", "def delete\n @place = Place.find_by(:id => params[\"id\"]) # Find out what link has been clicked\n @place.delete # Delete the item which has been clicked\n redirect_to root_url # Show home page to verify that the place has been deleted\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @place = @site.places.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to site_places_url(@site) }\n format.json { head :no_content }\n end\n end", "def destroy\n @geoname = Geoname.find(params[:id])\n @geoname.destroy\n\n respond_to do |format|\n format.html { redirect_to(geonames_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n redirect_to places_path\n end", "def destroy\n @dataele_place = DataelePlace.find(params[:id])\n @dataele_place.destroy\n\n respond_to do |format|\n format.html { redirect_to dataele_places_url }\n format.json { head :ok }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n head :no_content\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def destroy\n @address_type = AddressType.find(params[:id])\n @address_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_types_url) }\n format.xml { head :ok }\n end\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n request(:delete)\n end", "def destroy\n @place = Place.find(params[:id])\n parent = @place.parent\n\n # შევამოწმოთ, არის თუ არა ეს თარო ცარიელი\n if @place.children.empty? and @place.books.empty?\n @place.destroy\n else\n flash[:notice] = 'ეს თარო არ არის ცარიელი.'\n end\n\n # გამოტანა იგივე გვერდის, სადაც ეს თარო იყო განთავსებული\n respond_to do |format|\n if parent\n format.html { redirect_to(:controller => :places, :action => :index, :parent_id => parent.id) }\n else\n format.html { redirect_to(:controller => :places, :action => :index) }\n end\n format.xml { head :ok }\n end\n end", "def delete\n @address = Address.find(params[:address_id])\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to cms_places_path, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_vi_place.destroy\n end", "def destroy\n @place = Place.find(params[:id])\n @place.status = Status.active\n @place.save\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.json { head :ok }\n end\n end", "def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end", "def destroy\n @technocal_client_address = TechnocalClientAddress.find(params[:id])\n @technocal_client_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(technocal_client_addresses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place_visit.destroy\n\n head :no_content\n end", "def delete\n CONNECTION.execute(\"DELETE FROM locations WHERE id = #{self.id};\")\n end", "def destroy\n Log.logit!(:places, :notice, \"User deleted place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_path }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @restaurant_place.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storeloc = Storeloc.find(params[:id])\n @storeloc.itemlocs.each do |loc|\n loc.destroy\n end\n\n @storeloc.destroy\n\n respond_to do |format|\n format.html { redirect_to(storelocs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @place.destroy\n \n \n end", "def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_addresses_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @way = Way.find(params[:id])\n @way.destroy\n\n respond_to do |format|\n format.html { redirect_to(ways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @waypoint = Waypoint.find(params[:id])\n @waypoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(waypoints_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @geo_country = Geo::Country.find(params[:id])\n @geo_country.destroy\n\n respond_to do |format|\n format.html { redirect_to(geo_countries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @atom = Atom.find(params[:id])\n @atom.destroy\n\n respond_to do |format|\n format.html { redirect_to(atoms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@address = Address.find(params[:id])\n\t\t@address.coordinates.each do |c|\n\t\t\tc.destroy\n\t\tend\n\t\tredirect_to address_url(@address)\n\tend", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end", "def destroy\n @kingdom = Kingdom.find(params[:id])\n @kingdom.destroy\n\n respond_to do |format|\n format.html { redirect_to(kingdoms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: \"Place was successfully destroyed.\" }\n end\n end", "def destroy\n @admin_place.destroy\n respond_to do |format|\n format.html { redirect_to admin_places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @openmapa = Openmapa.find(params[:id])\n @openmapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(openmapas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @address_book_item = AddressBookItem.find(params[:id])\n @address_book_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_book_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy; delete end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @map = Map.find_by_id(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\t\t@place = Place.find_by(:id => params[\"id\"])\n\n\t\tif @place != nil\n\t\t\ttitle = @place.title\n\t\t\t@place.delete\n\t\t\tredirect_to \"/\", notice: title + \" was deleted!\"\n\t\telse\n\t\t\tredirect_to \"/\", notice: \"Place not found in this app!\"\n\t\tend\n\tend", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete(name)\n\n end", "def destroy\n @neighborhood = Neighborhood.find(params[:id])\n @neighborhood.destroy\n\n respond_to do |format|\n format.html { redirect_to(neighborhoods_url) }\n format.xml { head :ok }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place.destroy\n redirect_to places_url, notice: \"Place was successfully destroyed.\"\n end", "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html do\n redirect_to places_url, notice: 'Place was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to partner_places_path, notice: 'Le lieu a été supprimé.' }\n # format.json { head :no_content }\n end\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end" ]
[ "0.7019525", "0.67803085", "0.6702724", "0.67005825", "0.66454726", "0.6605662", "0.6551402", "0.6547136", "0.65405244", "0.65173507", "0.6481668", "0.64708424", "0.6451609", "0.64098465", "0.64006424", "0.6367989", "0.6366349", "0.63611084", "0.6348793", "0.6348793", "0.6348793", "0.6348793", "0.6348793", "0.6341971", "0.6331232", "0.6325603", "0.6315001", "0.6310887", "0.6278397", "0.627072", "0.6242554", "0.6223922", "0.62227446", "0.6218486", "0.6216623", "0.6205696", "0.6195267", "0.6189262", "0.61790323", "0.617778", "0.61749244", "0.616858", "0.6164929", "0.6162729", "0.6162729", "0.6162729", "0.6162729", "0.6159591", "0.61547244", "0.61434615", "0.614047", "0.614047", "0.614047", "0.614047", "0.6139718", "0.61395735", "0.61385405", "0.61334103", "0.61315715", "0.61270237", "0.61168575", "0.61094236", "0.6107638", "0.6098131", "0.6090339", "0.6082651", "0.60799766", "0.6070175", "0.6070175", "0.6070175", "0.6070175", "0.6070175", "0.60650903", "0.6061688", "0.60589075", "0.60506773", "0.60505354", "0.6047362", "0.6046986", "0.6043394", "0.60330975", "0.60301536", "0.6030083", "0.60269785", "0.6019895", "0.60193294", "0.6010792", "0.6010792", "0.6008248", "0.6007593", "0.6002836", "0.6001264", "0.599873", "0.59981173" ]
0.7032682
6
Provides a default configuration
def initialize @codice_fiscale = CodiceFiscaleConfiguration.new @cap_lookup = CapLookupConfiguration.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_config\n {}\n end", "def default_configuration\n {}\n end", "def default_config\n self.class.default_config\n end", "def default_configuration\n configuration[:_default] || {}\n end", "def default_config\n <<~CONFIG\n defaults: &defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n development:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n test:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n\n production:\n # <<: *defaults\n data_root: data\n candidates_root: zzz_candidates\n departed_root: zzz_departed\n project_root: projects\n editor: code\n feedback_polarity_default: positive\n meeting_location_default: alcove\n log_filename: log.adoc\n overview_filename: overview.adoc\n pto_default: vacation\n voip_meeting_default: Zoom\n CONFIG\n end", "def default_configuration=(_arg0); end", "def default_config\n self.class.config[:default_config].nil? ? {} : {}.merge(self.class.config[:default_config])\n end", "def configDefaults(config)\n end", "def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugger.default_credentials\n configuration.service_name ||= Debugger.default_service_name\n configuration.service_version ||= Debugger.default_service_version\n end", "def configured_default\n @options[:default] || default_entry\n end", "def set_conf_default(conf)\n end", "def set_conf_default(conf)\n end", "def default_settings\n {}\n end", "def default_value\n config[:default]\n end", "def set_defaults!\n __load_config( DEFAULTS )\n end", "def configuration_defaults(&block)\n @configuration_defaults = block\n end", "def init_default_config\n configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)\n configuration.credentials ||= Cloud.configure.credentials\n configuration.service_name ||= ErrorReporting::Project.default_service_name\n configuration.service_version ||= ErrorReporting::Project.default_service_version\n configuration.ignore_classes = Array(configuration.ignore_classes)\n end", "def defaults_for( name, &block )\n ::Loquacious::Configuration.defaults_for(name, &block)\n end", "def default_configuration!\n # Overwriting Sinatra defaults\n set :app_file, caller_files.first || $0 # Assume app file is first caller\n set :environment, Padrino.env\n set :raise_errors, true if development?\n set :logging, false # !test?\n set :sessions, true\n set :public, Proc.new { Padrino.root('public', self.uri_root) }\n # Padrino specific\n set :uri_root, \"/\"\n set :reload, development?\n set :app_name, self.to_s.underscore.to_sym\n set :default_builder, 'StandardFormBuilder'\n set :flash, defined?(Rack::Flash)\n set :authentication, false\n # Padrino locale\n set :locale_path, Proc.new { Dir[File.join(self.root, \"/locale/**/*.{rb,yml}\")] }\n set :auto_locale, false\n # Plugin specific\n set :padrino_mailer, defined?(Padrino::Mailer)\n set :padrino_helpers, defined?(Padrino::Helpers)\n end", "def default_config\n config = {}\n config['webhook_url'] = nil\n\n return config\n end", "def default_settings()\n @default_settings ||= {}\n end", "def genPiledDefaultConf(klass = self.class())\n if(klass == WithConfParam) then\n return klass::DefaultConf.dup() ;\n else\n newConf = genPiledDefaultConf(klass.superclass()) ;\n if(klass.const_defined?(:DefaultConf)) \n newConf.update(klass::DefaultConf) ;\n end\n \n return newConf ;\n end\n end", "def config_default\n lock(:c) do\n @cache[:c][:default] ||= config_new\n end\n end", "def defaults\n Hash(@config[:defaults])\n end", "def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end", "def configuration\n {}\n end", "def config\n @default_args || Surrealist::HashUtils::EMPTY_HASH\n end", "def init_config()\n options_apply_filter(\"DEFAULT\")\n end", "def config\n @config || QuestBack.default_configuration || fail(QuestBack::Error, 'No configuration given or found on QuestBack.default_configuration.')\n end", "def default_options\n if Object.const_defined?('Rails')\n {\n :file => Rails.root.join('config', 'config.yml'),\n :reload => Rails.env.development?,\n :env => Rails.env\n }\n else\n {\n :file => File.expand_path(\"config.yml\"),\n :reload => false,\n :env => \"development\"\n }\n end\n end", "def default_options; {} end", "def default_config\n data = {\n 'acr_values' => 'http://idmanagement.gov/ns/assurance/loa/1',\n 'client_id' => 'urn:gov:gsa:openidconnect:sp:sinatra',\n }\n\n if LoginGov::Hostdata.in_datacenter?\n # EC2 deployment defaults\n\n env = LoginGov::Hostdata.env\n domain = LoginGov::Hostdata.domain\n\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n data['redirect_uri'] = \"https://sp-oidc-sinatra.#{env}.#{domain}/\"\n data['sp_private_key_path'] = \"aws-secretsmanager:#{env}/sp-oidc-sinatra/oidc.key\"\n data['redact_ssn'] = true\n else\n # local dev defaults\n data['idp_url'] = 'http://localhost:3000'\n data['redirect_uri'] = 'http://localhost:9292/'\n data['sp_private_key_path'] = demo_private_key_path\n data['redact_ssn'] = false\n end\n\n data\n end", "def load_default_config\n self[:disable_html] ||= true\n self[:url_target] ||= \"_BLANK\"\n self[:image_alt] ||= \"Posted Image\"\n self[:table_width] ||= \"100%\"\n self[:syntax_highlighter] ||= :raw\n self[:coderay_options] ||= {}\n end", "def default_config\n UvConfiguration.new\n end", "def parse_default_config\n default_config_path = 'config/default.yml'\n @default_config = ( YAML.load_file(default_config_path) if File.exist?(default_config_path) ) || {}\n end", "def default_options; end", "def default_options; end", "def default_options; end", "def default_config\n data = {\n 'acr_values' => ENV['acr_values'] || 'http://idmanagement.gov/ns/assurance/ial/1',\n 'client_id' => ENV['client_id'] || 'urn:gov:gsa:openidconnect:sp:sinatra',\n 'mock_irs_client_id' => ENV['mock_irs_client_id'] ||\n 'urn:gov:gsa:openidconnect:sp:mock_irs',\n 'redirect_uri' => ENV['redirect_uri'] || 'http://localhost:9292/',\n 'sp_private_key_path' => ENV['sp_private_key_path'] || './config/demo_sp.key',\n 'redact_ssn' => true,\n 'cache_oidc_config' => true,\n }\n\n # EC2 deployment defaults\n\n env = ENV['idp_environment'] || 'int'\n domain = ENV['idp_domain'] || 'identitysandbox.gov'\n\n data['idp_url'] = ENV.fetch('idp_url', nil)\n unless data['idp_url']\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n end\n data['sp_private_key'] = ENV.fetch('sp_private_key', nil)\n\n data\n end", "def default_options\n @default_options ||= {}\n end", "def default_config_file\n './deadlyzer.yml'\n end", "def default_config\n {\n db_type: 'sqlite', # Any database connector supported by the Sequel gem\n db_name: 'data.db', # The name of the database (or file) to use\n db_user: nil, # The database user and optional password (user:password)\n db_host: 'localhost' # The database host and options port (host:port)\n }\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_blacklight_config\n @default_blacklight_config ||= begin\n config = Spotlight::Engine.blacklight_config.deep_copy\n add_exhibit_specific_fields(config)\n config\n end\n end", "def config\n name.split('_')[2] || 'default'\n end", "def default_options\n {}\n end", "def defaults\n return @config if @config\n\n @config = Configatron::Store.new\n file_path = File.expand_path('../../../config/xpaths.yml', __FILE__)\n hash_config = YAML::load_file(file_path)\n\n @config.configure_from_hash(hash_config)\n @config.lock!\n @config\n end", "def default_options\n option_type_config_for :default\n end", "def default\n options[:default]\n end", "def initial_config\n default_config.deep_merge(@passed_config)\n end", "def default_options\n { }\n end", "def configurations; end", "def default_options\n # {}\n end", "def config_defaults(asset_host: nil, mode: ENV.fetch('RACK_ENV', 'development'), root: Dir.pwd)\n {\n 'asset_host' => option_from_env('asset_host') || asset_host,\n 'config_path' => option_from_env('config_path') || DEFAULT_CONFIG.fetch('config_path'),\n 'mode' => option_from_env('mode') || mode,\n 'root' => option_from_env('root') || root,\n }\n end", "def load_default_config\n # Load the default\n path = File.join(::Lyricli.root, \"config\", @defaults_path)\n\n if File.exist?(path)\n file = File.new(path, \"r\")\n @config = MultiJson.decode(file.read)\n else\n @config = {}\n end\n end", "def default\r\n @opts[:default]\r\n end", "def default_config\n ProjectRazor::Config::Server.new\nend", "def config\n @config ||= {}\n end", "def config\n @config ||= {}\n end", "def default_settings\n {\n 'strategy' => 'any'\n }\n end", "def default_options\n environment = ENV['SHELF_ENV'] || 'development'\n default_host = environment == 'development' ? 'localhost' : '0.0.0.0'\n\n { environment: environment, port: 9292, host: default_host }\n end", "def setup_config(*args)\n args.first.is_a?(Hash) ? args.first : { default: args }\n end", "def config_file_defaults\n Chef::Config[:knife].save(true) # this is like \"dup\" to a (real) Hash, and includes default values (and user set values)\n end", "def defaults\n {\n colour: {},\n name: '',\n repository: Vedeu::Repositories::RepositoryTestModule,\n style: [],\n }\n end", "def set_conf_default(conf)\n conf['url_prefix'] = 'http://YOUR_HOST/juli' if !conf['url_prefix']\n conf['facebook'] = {} if !conf['facebook']\n if !conf['facebook']['comments']\n conf['facebook']['comments'] = {\n 'template' => self.class::DEFAULT_TEMPLATE\n }\n end\n if !conf['facebook']['like']\n conf['facebook']['like'] = {\n 'template' => Juli::Visitor::Html::Helper::FbLike::DEFAULT_TEMPLATE\n }\n end\n end", "def puppet_default_settings\n Puppet.settings.initialize_app_defaults(\n {\n :logdir => '/dev/null',\n :confdir => '/dev/null',\n :vardir => '/dev/null',\n :rundir => '/dev/null',\n :hiera_config => '/dev/null',\n }\n )\n end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def get_defaults\n unless @defaults\n conf_str = JustInCase::Templates::CONFIG_FILE\n conf_hash = JSON.parse(conf_str)\n @defaults = conf_hash.symbolize_keys!\n end\n return @defaults\n end", "def default_config # including inherited defaults \n calling_class = klass = self\n my_defaults = @@default_config[klass.to_s.downcase.to_sym] ||\n HashWithIndifferentAccess.new\n inherited_defaults = HashWithIndifferentAccess.new\n\n until ancestor_class(klass) == NilClass\n ancestor_defaults = @@default_config[ancestor_class(klass).to_s.downcase.to_sym] ||\n HashWithIndifferentAccess.new\n inherited_defaults.merge!(ancestor_defaults)\n klass = ancestor_class(klass)\n end\n inherited_defaults.merge(my_defaults)\n end", "def config\n (null_config? ? NoConfig.instance : actual_config)\n end", "def default_config\n db_config['mysql']\n end", "def get_default( default, *args )\n if args.empty?\n return @config\n end\n\n r = get_sub_tree( @config, *args )\n r.nil? ? default : r\n end", "def default_config=(config)\n unless config.is_a? Hash\n raise ArgumentError.new('Configuration has to be a Hash')\n end\n\n @default_config = config\n end", "def apply_default_config\n return unless DEFAULT_CONFIG.is_a?(Hash)\n DEFAULT_CONFIG.each do |k, v|\n apply_config(k, v)\n end\n end", "def default_options\n DEFAULT_OPTIONS\n end", "def default_options\n @default_options ||= self.class.default_options\n end", "def create_default_configuration_file\n puts 'Creating the default configuration'\n FileUtils.touch(CONFIGURATION_FILE)\n\n configuration = YAML::load_file(CONFIGURATION_FILE) || {}\n configuration[:elasticsearch] = { host: 'localhost',\n port: '9200',\n search_results_size: 10 }\n\n File.write(CONFIGURATION_FILE, configuration.to_yaml)\nend", "def config\n @config ||= multi_config || single_config\n end", "def config(opts=nil)\n if opts\n @config = @config.merge(get_subhash(opts, DEFAULTS.keys))\n else\n @config\n end\n end", "def default_options()\n options = {\n :verbose => 0, # Logger::DEBUG\n :logfile => STDERR\n }\n config_file = File.join(ENV['HOME'],\"#{File.basename($0, \".*\")}.rc.yaml\")\n if File.exists? config_file then\n config_options = YAML.load_file(config_file)\n options.merge!(config_options)\n end\n return options\n end", "def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end", "def defaults\n {}\n end", "def load_config\n # Nothing in base class. This should be used to load the configuration from\n # disk if saved to a file.\n configuration || {}\n end", "def set_default_options\n end", "def initialize(conf = nil)\n @conf = conf || default_config\n end", "def add_default_configuration!\n plugins << Plugin::LinkTracker.instance\n plugins << Plugin::Causata.instance\n end", "def configuration\n @config ||= setup\n end", "def genPiledConf(conf = {})\n return genPiledDefaultConf().update(conf) ;\n end", "def defaults\n {}\n end", "def defaults\n {}\n end", "def single_config\n default = begin\n if profile.is_a?(Hash)\n profile\n elsif [String, Symbol].include?(profile.class)\n available[profile] ||\n raise(ProfileError, \"Profile #{profile.inspect} is undefined\")\n else\n available[:default] ||\n raise(ProfileError, 'No default profile defined')\n end\n end\n {:default => default}\n end", "def configuration\n @configuration ||= deep_merge(default_configuration, @factory_config)\n end" ]
[ "0.8807638", "0.86508226", "0.8470093", "0.832503", "0.82438046", "0.8194717", "0.811372", "0.78117883", "0.7711394", "0.76459974", "0.75989085", "0.75989085", "0.7532349", "0.7494192", "0.7470694", "0.7448921", "0.74468434", "0.7420179", "0.7369174", "0.7354674", "0.73447245", "0.7244809", "0.7227969", "0.7222423", "0.7219", "0.71871215", "0.71678466", "0.7153572", "0.71375173", "0.712392", "0.70960313", "0.70939785", "0.7080868", "0.7071197", "0.70563513", "0.7032987", "0.7032987", "0.7032987", "0.7022344", "0.6998063", "0.69906324", "0.69837093", "0.69761074", "0.69761074", "0.69761074", "0.6971454", "0.6971454", "0.6971283", "0.6947147", "0.69410527", "0.69366413", "0.6926235", "0.69172513", "0.6914282", "0.69141155", "0.69022626", "0.6902112", "0.6895493", "0.68855405", "0.68842405", "0.6882153", "0.6861161", "0.6839387", "0.6839387", "0.68387043", "0.6806478", "0.6767339", "0.6753478", "0.67522013", "0.6750502", "0.6743781", "0.6732589", "0.6732589", "0.6732589", "0.6732589", "0.6732589", "0.6730923", "0.67229813", "0.6721509", "0.67116517", "0.6705679", "0.67022234", "0.66905755", "0.66790384", "0.6678687", "0.6652581", "0.6650688", "0.66455656", "0.66246873", "0.6616519", "0.66164625", "0.6610719", "0.66081345", "0.6606931", "0.66001236", "0.6599437", "0.65871316", "0.65843654", "0.6584154", "0.65827006", "0.6569428" ]
0.0
-1
TODO: cache the eth block number with expiration in 10 sec?
def confirmed_blocks eth_client.eth_block_number.to_i - self.block_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_number\n request('getblocknumber')\n end", "def getblocknumber\n request :getblocknumber\n end", "def getblocknumber\n @api.request 'getblocknumber'\n end", "def getblocknumber\n coind.getblocknumber\n end", "def add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, broadcast)\r\n hash = Digest::SHA256.new.hexdigest(amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s + nonce.to_s)\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES)) # Hash Is Valid\r\n block = Block.new(amount.to_f, signature.to_i, timestamp.to_i, prev_hash.to_s, nonce.to_i, hash.to_s, payer.to_i, payee.to_i, miner.to_i)\r\n $blockchain << block\r\n broadcast_block(block) if (broadcast)\r\n puts $blockchain.length.to_s.green\r\n Thread.new { calc_net_worth } # Calculates net worth of all peers\r\n else\r\n puts \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\".red\r\n $status = \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n end\r\nend", "def getblockhash(index)\n @api.request 'getblockhash', index\n end", "def get_block_count\n call_blockchain_api('getblockcount').to_i\n end", "def getblockbycount(height)\n request :getblockbycount, height\n end", "def getblockcount\n request :getblockcount\n end", "def new_block(amount, payer, payee, key_private)\r\n timestamp = Time.now.to_i\r\n signature = sign_block(key_private, Time.now)\r\n if ($blockchain.length == 0)\r\n prev_hash = \"0000000000000000000000000000000000000000000000000000000000000000\" # If First Block, No Previous Hash So 64 Zeroes Default\r\n else\r\n prev_hash = $blockchain[$blockchain.length-1].hash # Hash Of Previous Block\r\n end\r\n blob = amount.to_s + payer.to_s + payee.to_s + timestamp.to_s + prev_hash.to_s\r\n begin\r\n if ($blockchain.length > 0) # Send To All Miners If Not Genesis Block\r\n $peers.length.times do |i|\r\n Thread.new { Faraday.post(\"#{URL}:#{$peers[i].port}/mine_block\", amount: amount, payer: payer, payee: payee, timestamp: timestamp, signature: signature, prev_hash: prev_hash) if ($peers[i].port != payer) }\r\n end\r\n else # Send To First Port If Genesis Block\r\n Faraday.post(\"#{URL}:1801/mine_block\", amount: amount, payer: payer, payee: payee, timestamp: timestamp, signature: signature, prev_hash: prev_hash)\r\n end\r\n rescue\r\n # Miner Never Sent Response (Do Nothing)\r\n end\r\nend", "def create_blocks prev_hash, n, opts = {}\n interval = opts[:interval] || 600\n time = opts[:time] || Time.now.to_i\n bits = opts[:bits] || 553713663\n block = @store.get_block(prev_hash)\n n.times do |i|\n block = create_block block.hash, true, [], @key, 50e8, {\n time: time += interval, bits: bits }\n # block = @store.get_block(block.hash)\n # puts \"#{i} #{block.hash[0..8]} #{block.prev_block.reverse_hth[0..8]} #{Time.at(block.time).strftime('%Y-%m-%d %H:%M:%S')} c: #{block.chain} b: #{block.bits} n: #{block.nonce} w: #{block.work}\"\n end\n block\nend", "def block_count\n request('getblockcount')\n end", "def latest\n uri = Iri.new('https://chain.api.btc.com/v3/block/latest')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n data = json['data']\n raise Sibit::Error, 'The latest block not found' if data.nil?\n hash = data['hash']\n @log.info(\"The hash of the latest block is #{hash}\")\n hash\n end", "def getblockcount\n @api.request 'getblockcount'\n end", "def getblockbycount(height)\n @api.request 'getblockbycount', height\n end", "def block(hash)\n head = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = head['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n nxt = data['next_block_hash']\n nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'\n {\n provider: self.class.name,\n hash: data['hash'],\n orphan: data['is_orphan'],\n next: nxt,\n previous: data['prev_block_hash'],\n txns: txns(hash)\n }\n end", "def mmc_blockinfo\n\n # number of latest block\n @blckhigh = `#{@mmc_path} getblockcount`\n\n # hash of latest block\n blckhash = `#{@mmc_path} getblockhash #{@blckhigh}`\n\n # complete json of latest block\n blckinfo = `#{@mmc_path} getblock #{blckhash}`\n\n # difficulty of latest block\n @blckdiff = `#{@mmc_path} getdifficulty`\n\n # number of 30th latest block\n rcnthigh = @blckhigh.to_i - 30\n\n # hash of 30th latest block\n rcnthash = `#{@mmc_path} getblockhash #{rcnthigh}`\n\n # complete json of 30th latest block\n rcntinfo = `#{@mmc_path} getblock #{rcnthash}`\n\n # timestamp of latest block\n blcktime = JSON.parse(blckinfo)['time'].to_i\n\n # timestamp of 30th latest block\n rcnttime = JSON.parse(rcntinfo)['time'].to_i\n\n # average blocktime of 30 last blocks in seconds\n @blocktime = (blcktime.to_f - rcnttime.to_f) / 30.0\n\n # current hashrate in hashs per minute\n @hashrate = ((2 ** 32) * @blckdiff.to_f) / (@blocktime.to_f / 60.0)\n\n # calculates current block reward and total minted coins\n i = 0\n currweek = ((@blckhigh.to_f / 1680.0) - 0.5).round\n @reward = 280.0 ### @TODO: initial reward was limited, PTS shares\n @minted = 715842.49 ### @TODO: initial reward was limited, PTS shares\n while i < currweek do\n @minted += @reward * 1680.0\n @reward *= 0.95\n i += 1\n end\n @minted += (@blckhigh.to_f - (currweek * 1680.0)) * @reward\n\nend", "def next_of(hash)\n head = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = head['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n nxt = data['next_block_hash']\n nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'\n @log.info(\"In BTC.com the block #{hash} is the latest, there is no next block\") if nxt.nil?\n @log.info(\"The next block of #{hash} is #{nxt}\") unless nxt.nil?\n nxt\n end", "def latest_block(blockchain)\n blockchain[-1]\n end", "def getblockcount\n coind.getblockcount\n end", "def bitcoin\n @bitcoin || BlockrIo.new\n end", "def latest\n Sibit::Json.new(http: @http, log: @log).get(\n URI('https://blockchain.info/latestblock')\n )['hash']\n end", "def block_count; @data[17].to_i; end", "def getblock(hash)\n block = @api.request 'getblock', hash\n block[\"time\"] = Time.at(block[\"time\"]).utc if block.is_a? Hash\n block\n end", "def mmc_voteinfo\n\n # gets memorycoin blockchain info\n mmc_blockinfo\n\n # gets the last vote block number\n tlock = @blckhigh.to_f / 20.0\n block = @blckhigh.to_i - ((tlock - tlock.round) * 20.0).round\n if (block > @blckhigh.to_i)\n block -= 20\n end\n\n # parse voting info\n begin\n t = Timeout.timeout(5) do\n @votes = JSON.parse(open(\"http://www.mmcvotes.com/block/#{block}?output=json\").read)\n end\n rescue Timeout::Error\n @votes = nil\n end\nend", "def btc(lifetime: 30 * 60)\n item = read\n if item['btc'] && item['assigned']\n age = Time.now.to_i - item['assigned']\n return item['btc'] if age < lifetime\n return item['btc'] if item['active'] && item['active'] == 2 && age < lifetime * 10\n end\n found = @aws.query(\n table_name: 'zold-wallets',\n limit: 1,\n index_name: 'queue',\n select: 'ALL_ATTRIBUTES',\n consistent_read: false,\n expression_attribute_values: { ':a' => 1 },\n key_condition_expression: 'active=:a'\n ).items\n if found.empty? || Time.at(found[0]['assigned']) > Time.now - lifetime\n return item['btc'] if item['btc']\n item['btc'] = yield\n else\n expired = found[0]\n prev = item['btc']\n item['btc'] = expired['btc']\n raise \"There is no BTC in the table for @#{expired['login']}, while marked as active\" if item['btc'].nil?\n if prev.nil?\n expired.delete('btc')\n expired['active'] = 0\n else\n expired['btc'] = prev\n end\n @aws.put_item(table_name: 'zold-wallets', item: expired)\n end\n item['assigned'] = Time.now.to_i\n item['active'] = 1\n @aws.put_item(table_name: 'zold-wallets', item: item)\n item['btc']\n end", "def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"10b4\")\r\n\t\t\r\n\t\tassert_equal(0, tb.compare_current_hash)\r\n\tend", "def download_block tf, peer, piece, block\n payload = \"#{piece.index}#{block.offset}#{[TorrentFile::REQUEST_LENGTH].pack(\"N*\")}\"\n request = \"#{[1 + payload.bytesize].pack(\"N\")}#{[6].pack(\"C\")}#{payload}\"\n\n peer.socket.write request\n\n puts \"Requested Piece #{piece.index_10} block #{block.index}\"\n\n loop do\n begin\n length = peer.socket.recv(4) # 4 bytes for length of message\n length = length.unpack1 \"N\"\n\n next unless length # nil\n\n # 1 byte for message id\n # length += 1 # ???\n puts \"Received length:\\t#{length.inspect}\"\n\n # keep alive\n if length == 0\n peer.socket.write [0].pack(\"N\")\n\n next\n end\n\n result = peer.socket.read_with_timeout(length, 8)\n\n message = Message.new length, result\n\n # puts message.inspect\n\n case message.name\n when 'piece'\n piece_idx = message.index\n block_idx = TorrentFile::Block.find_index(message.offset)\n\n tf.pieces[piece_idx].blocks[block_idx].receive(message.data)\n # puts block.inspect\n\n unless block.have\n block.invalidate!\n end\n\n return\n end\n rescue RuntimeError => e\n puts e.message\n block.invalidate!\n return\n end\n end\nend", "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 get_block_by_tx(tx_hash)\n raise \"Not implemented\"\n end", "def getblockbycount(height)\n coind.getblockbycount height\n end", "def latest\n get_json('/latestblock')['hash']\n end", "def on_get_block(hash)\n log.debug { \">> get block: #{hash.hth}\" }\n blk = @node.store.get_block(hash.hth)\n return unless blk\n pkt = Bitcoin::Protocol.pkt(\"block\", blk.to_payload)\n log.debug { \"<< block: #{blk.hash}\" }\n send_data pkt\n end", "def height(hash)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = json['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n h = data['height']\n raise Sibit::Error, \"The block #{hash} found but the height is absent\" if h.nil?\n @log.info(\"The height of #{hash} is #{h}\")\n h\n end", "def broadcast_block(block)\r\n $peers.length.times do |i|\r\n Faraday.post(\"#{URL}:#{$peers[i].port}/broadcast_block\", amount: block.amount, signature: block.signature, timestamp: block.timestamp, prev_hash: block.prev_hash, nonce: block.nonce, hash: block.hash, payer: block.payer, payee: block.payee, miner: block.miner) if ($peers[i].port.to_s.chomp != block.payer.to_s.chomp)\r\n end\r\nend", "def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end", "def initialize\n super(Network.generate_id(\"block_\"))\n end", "def get_number_block\n\n\tblock = rand(4**4)\n\t#make sure block length is 3 chars\n\n\twhile block.to_s.length != 3\n\t\tblock = rand(4**4)\n\tend\n\n\treturn block\nend", "def test_invalid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n\n assert_equal 0, block.is_valid\n end", "def validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n puts \"Validating Block From #{payer}...\".blue\r\n error = \"\"\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n peer = search_peers_by_port(payer)\r\n if (peer != -1)\r\n if (validate_signature(peer.key_public, signature, timestamp))\r\n if $blockchain.length == 0\r\n return true\r\n else\r\n if (peer.balance.to_f >= amount.to_f)\r\n prev_block = $blockchain[$blockchain.length - 1]\r\n prev_block_hash = Digest::SHA256.new.hexdigest(prev_block.amount.to_s + prev_block.payer.to_s + prev_block.payee.to_s + prev_block.miner.to_s + prev_block.timestamp.to_s + prev_block.signature.to_s + prev_block.prev_hash.to_s + prev_block.nonce.to_s)\r\n if (prev_hash == prev_block_hash)\r\n return true\r\n else\r\n error = \"Previous Hash = #{prev_hash}\\nThis Block Has #{prev_block_hash}, Not Matching.\"\r\n end\r\n else\r\n error = \"Payer doesn't have enough Swincoins.\"\r\n end\r\n end \r\n else\r\n error = \"Wrong Signature.\"\r\n end\r\n else\r\n error = \"Peer Not Found.\"\r\n end\r\n else\r\n error = \"Hash #{hash} Not Nonced, no Proof of Work Found.\"\r\n end\r\n # If Payer Sends Invalid Block, Add Them To Rogue List\r\n puts \"INVALID BLOCK... BLACKLISTING PEER #{payer}\".red\r\n puts error.red\r\n $status = \"INVALID BLOCK... BLACKLISTING PEER #{payer} because #{error}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n return false\r\nend", "def calculate_block_hash(block)\n Digest::SHA256.hexdigest(block.block_index.to_s + block.previous_block_hash + block.timestamp + block.data)\n end", "def check_if_block_exists(miner, timestamp)\r\n block_exists = false\r\n winning_miner = nil\r\n $blockchain.length.times do |i|\r\n ts = $blockchain[i].timestamp\r\n block_exists = true if ts == timestamp\r\n winning_miner = $blockchain[i].miner\r\n break if block_exists\r\n end\r\n if block_exists\r\n $status = \"Miner #{miner} is late, block already mined by #{winning_miner}\"\r\n puts \"Miner #{miner} is late, block already mined by #{winning_miner}\".red\r\n end\r\n return block_exists\r\nend", "def get_namecoin_hash\n return @chunks[-7].hth if is_name_new?\n if is_name_firstupdate?\n name = @chunks[-10].to_s.hth\n rand = @chunks[-9].to_s.hth\n return Bitcoin.hash160(rand + name)\n end\n rescue\n nil\n end", "def block_num(block_num, hash_calc, block_check, line)\r\n block_val = block_num.to_i # convert to integer\r\n zero = nil\r\n error = \"Line #{line}: Invalid block number #{block_num}, should be #{line}\"\r\n # if a value such as 2a is stored, will fail here\r\n return error + \"\\nNon-numeric value detected\" if block_val.digits.size != block_num.size\r\n\r\n # handles case where if to_i returns 0 because string was a char and line is 0,\r\n # will not pass\r\n zero = block_check.verify_zero(block_num, hash_calc) if block_val.zero?\r\n return error + \"\\nNon-numeric value detected\" unless zero.nil?\r\n # if the block number is not the next number\r\n return error unless block_check.check_block_num(line, block_val)\r\n\r\n nil\r\n end", "def generate_next_block(block_data, blockchain)\n previous_block = latest_block(blockchain)\n p previous_block\n block_index = previous_block.block_index + 1\n timestamp = Time.now.to_i.to_s\n block_hash = Digest::SHA256.hexdigest(block_index.to_s + previous_block.block_hash + timestamp + block_data)\n Block.new(block_index, previous_block.block_hash, timestamp, block_data, block_hash)\n end", "def block_length()\n #This is a stub, used for indexing\n end", "def block_length()\n #This is a stub, used for indexing\n end", "def new_block(transaction:, previous_hash: nil)\n block = {\n index: chain.length + 1,\n timestamp: Time.now.to_f,\n transaction: transaction,\n previous_hash: previous_hash || CryptoHelper.block_hash(last_block)\n }\n\n chain.push(block)\n block\n end", "def parse_info(block)\r\n\t\tinfo = Hash.new\r\n\t\tinfo['original'] = block\r\n\r\n\t\tblock = block.split('|')\t# splits the block by the regex '|'\r\n\t\tif block.length != 5\r\n\t\t\tputs 'Invalid block format, should consist of only 5 elements'\r\n\t\t\tputs 'BLOCKCHAIN INVALID'\r\n\t\t\texit()\r\n\t\tend\t\t\r\n\r\n\t\tinfo['id'] = block[0].to_i\r\n\t\tinfo['prev_hash'] = block[1]\r\n\t\tinfo['transaction'] = block[2].split(':')\t# splits transaction by the regex ':'\r\n\t\tinfo['ts'] = {'sec': block[3].split('.')[0].to_i, 'nsec': block[3].split('.')[1].to_i}\r\n\t\t#puts info['ts']\r\n\t\tinfo['self_hash'] = block[4]\r\n\t\treturn info\r\n\tend", "def test_valid_block\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch77\")\n\n assert_equal 1, block.is_valid\n end", "def test_count_transactions\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\t\r\n\t\tassert_equal(2, tb.calculate_transaction_count)\r\n\tend", "def create_block prev, store = true, tx = [], key = @key, coinbase_value = 50e8, opts = {}\n key ||= Bitcoin::Key.generate\n opts[:bits] ||= Bitcoin.network[:proof_of_work_limit]\n block = build_block(Bitcoin.decode_compact_bits(opts[:bits])) do |b|\n b.time opts[:time] if opts[:time]\n b.prev_block prev\n b.tx do |t|\n t.input {|i| i.coinbase }\n t.output {|o| o.value coinbase_value; o.script {|s| s.recipient key.addr } }\n end\n tx.each {|cb| b.tx {|t| cb.call(t) } }\n end\n @store.store_block(block) if store\n block\nend", "def blocks_trail_count\n @highest_block_number - @current_block_number\n end", "def handle_monitor_block request, *params\n last, _ = *params\n head = Bitcoin::P::Block.new(@node.store.get_head.to_payload) rescue nil\n if last\n ((last.to_i+1)..@node.store.get_depth).each do |i|\n blk = @node.store.get_block_by_depth(i)\n respond(request, [[\"block\", *params].join(\"_\"), [blk, blk.depth]])\n end\n else\n respond(request, [[\"block\", *params].join(\"_\"), [head, @node.store.get_depth]]) if head\n end\n end", "def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend", "def get_block(x,y,z)\n response = @api.send_and_receive(\"world.getBlock(#{x},#{y},#{z})\")\n Block.find(response.to_i) \n end", "def test_nonequal_hash\n chain = \"Person1<Person2(360):Person3<Person4(930)\"\n block = Blockchain.new(0,0,chain, 1.5,\"ch77\")\n block.setHash(\"m1p0\")\n\n assert_equal(0, block.check_curr())\n end", "def read_block(session_id, block_id, nonce)\n _check_block_id block_id\n session_cache_entry = @allocator.session_cache_entry session_id\n data = @storage.read_block block_id\n hmac = @hash_tree_controller.sign_read_block block_id, session_cache_entry, nonce \n return data, hmac\n end", "def update_last_processed_block_number\n SaleGlobalVariable.last_block_processed.update_all(variable_data: @current_block_number.to_s)\n @last_processed_block_number = @current_block_number\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def block_reference_count; end", "def test_previous_hash_too_big\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n output = \"Line 0: Previous hash was 12345, should be 2710\\nLenght of previous hash too long\"\r\n assert_equal output, @g.previous_hash( '12345', 10000, block_checker, 0)\r\n end", "def get_block(blk_hash)\n raise \"Not implemented\"\n end", "def getblock(hash, verbosity)\n rpc_call('getblock', hash, verbosity)\n end", "def eth_cnt_rst; eth_ctrl_bit(8); end", "def btc_arrived\n item = read\n item['active'] = 2\n item['assigned'] = Time.now.to_i\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def test_bad_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\t\r\n\t\tassert_equal 0, tb.validate_block\r\n\tend", "def block_size; end", "def block_size\n\t\t25\n\tend", "def last_block\n\t\t(self.track_count*8)-1\n\tend", "def get_next_block\n @store.get_block_by_prev_hash(@hash)\n end", "def get_block(street_number)\n if street_number < 100\n return 0\n else\n rank = street_number.to_s.size\n return (street_number / rank) * rank\n end\nend", "def network\n @network ||= :bitcoin\n end", "def check_block_num(curr_block)\n # make sure number of blocks is in order starting at 0\n return unless curr_block.block_number.to_i != @curr_count\n\n @block_num_error = true\n puts \"Line #{curr_count}: Invalid block number #{curr_block.block_number}, should be #{curr_count} \"\n puts 'BLOCKCHAIN INVALID'\n exit 1\n end", "def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end", "def reset!\n @latest_block_number = nil\n end", "def new_block(proof, previous_hash = nil)\n block = {\n index: @chain.length + 1,\n epoch: Time.now.utc.to_f,\n transactions: @current_transactions,\n cost: @current_transactions.length - 1,\n proof: proof,\n previous_hash: previous_hash || Blockchain.hash(@chain.last)\n }\n @current_transactions = []; @chain << block; block\n end", "def mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n blob = amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s\r\n nonce = find_nonce(blob)\r\n Faraday.post(\"#{URL}:#{payer}/block_mined\", amount: amount, payer: payer, payee: payee, miner: miner, timestamp: timestamp, signature: signature, prev_hash: prev_hash, nonce: nonce)\r\nend", "def nonce; end", "def test_good_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd18\")\r\n\t\t\r\n\t\tassert_equal 1, tb.validate_block\r\n\tend", "def test_calc_hash\n chain = \"SYSTEM>Kurt(50)\"\n block = Blockchain.new(\"5\", \"5\", chain, \"1518892051.812065000\", \"ch78\")\n hash_value = block.getHash\n calc = hash_value.strip.eql? \"ch77\"\n\n assert_equal calc, true\n end", "def find_nonce(blob)\r\n $status = \"Mining Started\"\r\n puts \"Mining Started\".blue\r\n start_time = Time.now\r\n nonce = \"0\"\r\n loop do\r\n nonce = rand(0..9999999999).to_s\r\n hash = Digest::SHA256.new.hexdigest(blob + nonce)\r\n break if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n end\r\n end_time = Time.now\r\n $status = \"Mining Ends in #{end_time - start_time} seconds\"\r\n puts \"Mining Ends in #{end_time - start_time} seconds\".blue\r\n return nonce\r\nend", "def connect_block(block, state)\n start_time = Time.now\n\n # Check it again in case a previous version let a bad block in\n if !self.check_block(block, state)\n return false\n end\n\n # Special case for the genesis block, skipping connection of its transactions\n # (its coinbase is unspendable because since the beginning it wasn't included in UTXO index)\n if block.hash == Bitcoin.network[:genesis_hash]\n # We do not store the block as it is already stored early in the processing.\n return true\n end\n\n # Let the storage know about the current block (as it can spent its own transactions)\n # This way, when we request outputs, we'll be able to get them from the current block.\n # This block is reset when transaction completes/rollbacks or when we process another block.\n @storage.current_block = block\n\n # This block may not be stored in the chain yet, so refer to its parent to get the height and add 1.\n height = 1 + @storage.height_for_block(block.prev_block_hex)\n\n # Skip scripts evaluation before the last checkpoint to speed up download process.\n #\n check_scripts = (@execute_all_scripts || @checkpoints_disabled || height >= self.max_checkpoint_height)\n\n # Enforce BIP30 - disallow overwriting transactions that were not completely spent yet.\n if !self.enforce_BIP30(block, height, state)\n return false\n end\n\n # BIP16 (P2SH scripts) didn't become active until Apr 1 2012.\n bip16_switch_time = 1333238400\n strict_p2sh = (block.time >= bip16_switch_time)\n\n # TODO: implement the flags.\n #unsigned int flags = SCRIPT_VERIFY_NOCACHE |\n # (fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE);\n\n verify_dersig = false\n\n # Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks, when 75% of the network has upgraded:\n if block.ver >= 3\n prev_block_header = @storage.block_header_for_hash(block.prev_block_hex)\n # if 750 of the last 1,000 blocks are version 3 or greater (51/100 if testnet)\n if ((!is_testnet? && verify_block_version_super_majority(3, prev_block_header, 750, 1000)) ||\n (is_testnet? && verify_block_version_super_majority(3, prev_block_header, 51, 100)))\n # DER signature is required.\n # See: https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki\n verify_dersig = true\n end\n end\n\n # Will count total fees (to verify block balance)\n fees = 0\n\n # Will count signature operations to prevent DoS.\n sigops = 0\n\n block.tx.each do |tx|\n # This is already counted in check_block(), but we have to add P2SH signature counts to it as well.\n # (And P2SH sigops can't be discovered until we actually attempt to connect unspent outputs.)\n sigops += tx.legacy_sigops_count\n\n if sigops > Bitcoin::MAX_BLOCK_SIGOPS\n # DoS 100\n raise BlockValidationError, \"ConnectBlock() : too many sigops\"\n return false\n end\n\n if !tx.is_coinbase?\n # Check if there are unspent outputs for this tx's inputs\n # aka view.HaveInputs() - but with only a view of pcoinsTip.\n if !self.verify_inputs_are_available(tx)\n raise BlockValidationError, \"ConnectBlock() : inputs missing/spent\"\n return false\n end\n\n if strict_p2sh\n # Add in sigops done by pay-to-script-hash inputs;\n # this is to prevent a \"rogue miner\" from creating\n # an incredibly-expensive-to-validate block.\n\n sigops += self.p2sh_sigops_count(tx);\n\n if sigops > Bitcoin::MAX_BLOCK_SIGOPS\n # DoS 100\n raise BlockValidationError, \"ConnectBlock() : too many sigops\"\n return false\n end\n end\n\n # Compute fees:\n # nFees += view.GetValueIn(tx)-tx.GetValueOut();\n\n # Note: we don't validate that each transaction does not spend more than on its inputs.\n # The balances are checked only per-block, so it's possible for some transactions to have negative fees\n # (provided some other transactions in the block have positive fees to compensate for that).\n fees += tx_value_in(tx) - tx_value_out(tx)\n\n # Actually check scripts. See CheckInputs() in bitcoind.\n if !self.check_inputs(block, tx, state, check_scripts, strict_p2sh, include_memory_pool=false, verify_dersig)\n return false\n end\n\n end # not a coinbase\n\n # UpdateCoins - mark inputs as spent and add new outputs as unspent.\n self.update_unspent_outputs(tx)\n\n end # each tx in block\n\n # Verify that coinbase pays no more than fees + block reward.\n coinbase_out_value = tx_value_out(block.tx[0])\n max_value = Bitcoin.block_creation_reward(height) + fees\n if coinbase_out_value > max_value\n # DoS 100\n raise BlockValidationError, (\"ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)\" % [coinbase_out_value, max_value])\n end\n\n measure_method(:connect_block, start_time)\n log_raw_block_events(block.hash, \"ConnectBlock processing time: #{(Time.now - start_time).to_f}\")\n\n # Save the block on \"main branch\"\n self.persist_block_on_main_branch(block, height, @storage.total_work_up_to_block_hash(block.prev_block_hex))\n\n # update outputs and remove txs last as they'll lock the affected rows\n # and block queries for the transaction processor. concurrency is hard.\n\n # This lock protects previous outputs as well.\n # We should take care to make this scope as tight as possible to not\n # unnecessarily block the transaction processor. It is released automatically\n # after the wrapping db transaciton completes\n @mempool.lock\n\n # Optimized method for marking existing outputs in the database in bulk\n @storage.update_outputs_on_connect_block(block)\n\n # mempool.removeForBlock() normally done in ConnectTip()\n @mempool.remove_for_block(block)\n\n # Flush this now\n @output_cache.flush\n\n return true\n end", "def listsinceblock(hash)\n @api.request 'listsinceblock', hash\n end", "def get_block_by_prev_hash(prev_hash)\n raise \"Not implemented\"\n end", "def scan_block(client, blocknum)\n bhash = client.getblockhash(blocknum)\n block = client.getblock(bhash)\n txhashes = block['tx']\n\n # Many blocks contain > 2k transactions, so batching this\n # can cause read timeouts on slower hardware.\n # The timeout can be adjusted in btcrpcclient if needed.\n calls = txhashes.map { |txhash| ['getrawtransaction', txhash, 1] }\n txs = client.batch(calls)\n return txs.inject([]) {|findings, tx| findings += scan_tx(client, tx) }\nend", "def bitcoin\n @bitcoin_data = {\n price: @api_hash[\"RAW\"][\"BTC\"][\"USD\"][\"PRICE\"],\n change_usd: @api_hash[\"RAW\"][\"BTC\"][\"USD\"][\"CHANGE24HOUR\"].round(2),\n change_percent: @api_hash[\"RAW\"][\"BTC\"][\"USD\"][\"CHANGEPCT24HOUR\"].round(2)\n }\nend", "def hold_coins num\n @held_coins = num\n end", "def on_getblocks(version, hashes, stop_hash)\n # remember the last few received getblocks messages and ignore duplicate ones\n # fixes unexplained issue where remote node is bombarding us with the same getblocks\n # message over and over (probably related to missing locator fallback handling)\n return if @last_getblocks && @last_getblocks.include?([version, hashes, stop_hash])\n @last_getblocks << [version, hashes, stop_hash]\n @last_getblocks.shift if @last_getblocks.size > 3\n\n blk = @node.store.db[:blk][hash: hashes[0].htb.blob]\n depth = blk[:depth] if blk\n log.info { \">> getblocks #{hashes[0]} (#{depth || 'unknown'})\" }\n\n return unless depth && depth <= @node.store.get_depth\n range = (depth+1..depth+500)\n blocks = @node.store.db[:blk].where(chain: 0, depth: range).order(:depth).select(:hash).all\n send_inv(:block, *blocks.map {|b| b[:hash].hth })\n end", "def create clock=nil, time=nil, mac_addr=nil\nc = t = m = nil\nDir.chdir Dir.tmpdir do\nunless FileTest.exist? STATE_FILE then\n# Generate a pseudo MAC address because we have no pure-ruby way\n# to know the MAC address of the NIC this system uses. Note\n# that cheating with pseudo arresses here is completely legal:\n# see Section 4.5 of RFC4122 for details.\nsha1 = Digest::SHA1.new\n256.times do\nr = [rand(0x100000000)].pack \"N\"\nsha1.update r\nend\nstr = sha1.digest\nr = rand 14 # 20-6\nnode = str[r, 6] || str\nnode[0] |= 0x01 # multicast bit\nk = rand 0x40000\nopen STATE_FILE, 'w' do |fp|\nfp.flock IO::LOCK_EX\nwrite_state fp, k, node\nfp.chmod 0o777 # must be world writable\nend\nend\nopen STATE_FILE, 'r+' do |fp|\nfp.flock IO::LOCK_EX\nc, m = read_state fp\nc = clock % 0x4000 if clock\nm = mac_addr if mac_addr\nt = time\nif t.nil? then\n# UUID epoch is 1582/Oct/15\ntt = Time.now\nt = tt.to_i*10000000 + tt.tv_usec*10 + 0x01B21DD213814000\nend\nc = c.succ # important; increment here\nwrite_state fp, c, m\nend\nend\n \ntl = t & 0xFFFF_FFFF\ntm = t >> 32\ntm = tm & 0xFFFF\nth = t >> 48\nth = th & 0x0FFF\nth = th | 0x1000\ncl = c & 0xFF\nch = c & 0x3F00\nch = ch >> 8\nch = ch | 0x80\npack tl, tm, th, cl, ch, m\nend", "def next_of(_hash)\n # They don't provide next block hash\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide next_of()'\n end", "def find_higher_blocks_on_the_network\n $logger.info(\"Looking for higher blocks on the network\")\n\n Array(@peers).each do |peer|\n peer_response = JSON.parse(HTTParty.get(\"http://#{peer}/blocks/last\").body)\n\n return if peer_response.nil?\n\n block = Block.initialize_from_json(self, peer_response)\n\n if block.height > last_block_height.to_i\n $logger.info(\"Found an higher block: #{block.height} (from #{last_block_height.to_i})\")\n validate_and_switch_to_fork(peer, block.height)\n end\n end\n end", "def append_block(block)\n valid = block.transactions.all? do |tx|\n tx.coinbase? || verify_transaction?(tx)\n end\n\n unless valid\n puts \"Verify block failed!\"\n return\n end\n\n pow = ProofOfWork.new(block)\n catch :not_found do\n result = pow.run!\n nonce, hash = result.values_at(:nonce, :hash)\n puts \"Mining done - #{hash}\"\n block.hash = hash\n block.nonce = nonce\n save_block(block)\n\n self.hash = hash\n end\n end", "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def test_previous_hash_zero\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n output = \"Line 0: Previous hash was 0123, should be 2710\\nCannot have leading 0's in previous hash\"\r\n assert_equal output, @g.previous_hash( '0123', 10000, block_checker, 0)\r\n end", "def bitcoin\n @bitcoin || Counterparty.bitcoin\n end", "def handle_tslb\n { tslb: (Time.now - @node.last_block_time).to_i }\n end", "def create_first_block\n i = 0\n instance_variable_set(\"@b#{i}\", Block.first({from: \"Minou\", to: \"VINE\", what:\"BTC\", qty: \"1000000\"}))\n #instance_variable_set permet de passer d'une chaine de caractère à une variable\n LEDGER << @b0\n p \"==============================\"\n pp @b0\n p \"==============================\"\n add_block\nend", "def add_block(block, state)\n start_time = Time.now\n\n mainchain_tip_hash = @storage.mainchain_tip_hash\n thischain_tip_hash = block.prev_block_hex\n\n mainchain_tip = @storage.block_header_for_hash(mainchain_tip_hash)\n thischain_tip = @storage.block_header_for_hash(thischain_tip_hash)\n\n # If the new work does not exceed the main chain work, stash this block away in a \"side branch\".\n # No further validations will be performed.\n if !thischain_tip.is_more_work?(mainchain_tip, block.hash, block.block_work)\n # This can only be possible on the sidechain, so we simply store the block without further validations.\n # Outputs will be validated when/if this block will become a part of the mainchain (see below).\n @storage.load_output_cache(block.tx)\n return persist_block_on_side_branch(block,\n @storage.height_for_block_header(thischain_tip) + 1,\n @storage.total_work_up_to_block_header(thischain_tip))\n end\n\n # New work is greater. Find the common ancestor block to rebuild the chain from there.\n # Scan both chains up to the common (minimum) height.\n # Then scan from there simultaneously until we hit the same hash.\n\n mainchain_ancestor = mainchain_tip\n thischain_ancestor = thischain_tip\n\n block_hashes_to_disconnect = []\n block_hashes_to_connect = []\n\n # 1. Scan each chain until the common min_height\n min_height = [ @storage.height_for_block_header(mainchain_ancestor),\n @storage.height_for_block_header(thischain_ancestor) ].min\n\n while @storage.height_for_block_header(mainchain_ancestor) > min_height\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n end\n\n while @storage.height_for_block_header(thischain_ancestor) > min_height\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # 2. Scan both chains simultaneously until we get to the same common ancestor\n while !(thischain_ancestor == mainchain_ancestor)\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # Finally we arrive at the common ancestor.\n # Now we need to attempt to disconnect old mainchain blocks and connect new thischain blocks.\n common_ancestor = mainchain_ancestor\n\n # 1. Disconnect the blocks on the mainchain to move them into the sidechain\n # We start from the latest hash and move on to the one right before the common ancestor.\n # Most of the time this array is empty, so no blocks are being disconnected.\n block_hashes_to_disconnect.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n if !self.disconnect_block(b, state)\n return false\n end\n end\n end\n\n # 2. Connect the blocks to form the new mainchain.\n # If any block is actually invalid (double-spends some outputs or has an invalid script),\n # this will fail and we would have to abort DB transaction to rollback all changes.\n block_hashes_to_connect.reverse.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(b, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(b)\n @output_cache.flush\n raise ex\n end\n end\n end\n\n measure_method(:add_block, start_time)\n log_raw_block_events(block.hash, \"add_block processing time: #{(Time.now - start_time).to_f}\")\n\n # Connect this new block too.\n @storage.load_output_cache(block.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(block, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(block)\n @output_cache.flush\n raise ex\n end\n end\n\n return true\n end", "def transfer_swincoin(amount, payer, payee, key_private)\r\n payer_peer = search_peers_by_port(payee)\r\n if (payer_peer != -1)\r\n new_block(amount, payer, payee, key_private)\r\n else\r\n puts \"Transaction failed. The payee port does not exist!\".red\r\n $status = \"Transaction failed. The payee port does not exist!\"\r\n end\r\nend" ]
[ "0.7329643", "0.71780944", "0.70912856", "0.68424726", "0.66567653", "0.6545536", "0.64524627", "0.63939327", "0.63720405", "0.63670194", "0.6334744", "0.6300179", "0.6294749", "0.627423", "0.6254718", "0.6190706", "0.6181141", "0.6137486", "0.61327815", "0.6107315", "0.61069703", "0.60813385", "0.6080733", "0.6069976", "0.60627794", "0.59055185", "0.5901249", "0.588079", "0.58503854", "0.58447844", "0.5843183", "0.58389676", "0.581382", "0.5776733", "0.5756218", "0.5752244", "0.57257706", "0.57155716", "0.5703254", "0.5692679", "0.5674302", "0.56313217", "0.5615083", "0.5614425", "0.5613336", "0.55941874", "0.55941874", "0.5582665", "0.5568927", "0.55442506", "0.5541105", "0.5534586", "0.5528703", "0.5520853", "0.55057085", "0.5505348", "0.5492662", "0.5483533", "0.5481033", "0.54776925", "0.5474206", "0.5472972", "0.54727215", "0.5472175", "0.5472033", "0.54324925", "0.5431817", "0.5425212", "0.5406541", "0.5395226", "0.5389097", "0.53853613", "0.5376389", "0.5375898", "0.53715634", "0.5344942", "0.53377813", "0.5335347", "0.53278726", "0.5321624", "0.531701", "0.53157645", "0.53100514", "0.5306975", "0.5300108", "0.52954835", "0.5294835", "0.5293668", "0.52881205", "0.52685183", "0.5268047", "0.5266988", "0.52603304", "0.5239112", "0.5234395", "0.52343065", "0.5231273", "0.5226241", "0.52233416", "0.5219233" ]
0.59889466
25
parse the command line arguments example 'c 23 f text.csv' = :count = 23 and :path = text.csv
def parse_arguments OptionParser.new do |parser| # parser.banner = "Usage: init.rb -c <integer>" parser.on("-c", "--count COUNT", Integer, "Specify number of uuid's to generate") do |c| @options[:count] = c end parser.on("-f", "--file FILE", "Specify path to save csv file example -f '/path/to/file.csv'") do |path| @options[:path] = path end end.parse! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args()\n opts = GetoptLong.new(\n ['--host', GetoptLong::OPTIONAL_ARGUMENT],\n ['--port', GetoptLong::OPTIONAL_ARGUMENT],\n ['--columns', GetoptLong::OPTIONAL_ARGUMENT],\n ['--index', GetoptLong::REQUIRED_ARGUMENT],\n ['--type', GetoptLong::REQUIRED_ARGUMENT]\n )\n\n opts.each do |opt, arg|\n case opt\n when '--host'\n @host = arg\n when '--port'\n @port = arg\n when '--columnns'\n @cols = arg.split(\",\")\n when '--index'\n @index = arg\n when '--type'\n @type = arg\n end\n end\n\n if @index.nil?\n STDERR.puts 'missing argument: --index'\n exit 1\n end\n\n if @type.nil?\n STDERR.puts 'missing argument: --type'\n exit 1\n end\n\n if ARGV.length != 1\n STDERR.puts 'Missing argument: file'\n exit 1\n end\n\n @file = ARGV.shift\nend", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def parse_options(argv:)\n input_path = nil\n benchmark_time = 30\n benchmark_warmup = 5\n lines_multipliers = [1]\n verbose = false\n\n OptionParser.new do |parser|\n parser.banner = 'Usage: bin/benchmark [file.csv] [options]'\n parser.default_argv = argv\n\n parser.on('--csv=[file1.csv]', String, 'CSV file(s)') do |value|\n input_path = value\n end\n\n parser.on('--[no-]verbose', 'Verbose output') do |value|\n verbose = value\n end\n\n parser.on('--lines-multipliers=[1,10,50]', Array, 'Multiply the rows in the CSV file (default: 1)') do |value|\n lines_multipliers = value.map do |v|\n Integer(v).tap do |int|\n unless int >= 1\n raise(ArgumentError, '--lines-multiplier must be 1 or greater')\n end\n end\n end\n end\n\n parser.on('--time=[30]', String, 'Benchmark time (default: 30)') do |value|\n benchmark_time = Integer(value)\n end\n\n parser.on('--warmup=[30]', String, 'Benchmark warmup (default: 30)') do |value|\n benchmark_warmup = Integer(value)\n end\n\n parser.on('-h', '--help', 'How to use') do\n puts parser\n exit\n end\n\n # No argument, shows at tail. This will print an options summary.\n parser.on_tail('-h', '--help', 'Show this message') do\n puts parser\n exit\n end\n end.parse!\n\n {\n input_path: input_path,\n benchmark_time: benchmark_time,\n benchmark_warmup: benchmark_warmup,\n lines_multipliers: lines_multipliers,\n verbose: verbose,\n }\n end", "def count\n @count ||= begin\n ARGV.each { |a| task a.to_sym do ; end }\n Integer(ARGV[1]) rescue 0 >0 ? ARGV[1].to_i : 10\n end\n @count\n end", "def test_parse04c\n options = ArgumentManager.parse( [ '-k', '3' ] )\n assert_equal( 3, options[ 'k' ] )\n end", "def initialize argv\n @argv = argv.dup\n @options = {}\n while @argv[0] =~ /^-/\n option, value = @argv.shift.split(/[=:]/, 2)\n csv = (value =~ /,/ ? value.split(',') : Array(value))\n modes = csv.inject({}){|h,s| k, v = s.split(/=/, 2); h[k] = v || true; h }\n @options[option.sub(/^-*/,'')] = modes\n end\n end", "def parse!( args )\n @args = args\n @options.grep!(args)\n end", "def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 1,\n :cols => 3, :rows => 3,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => false,\n :moveto_color => '#0000ff', :lineto_color => '#ff0000',\n :xshift => 0, :yshift => 0, :gcode => false, :do_tform => false\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n elsif v = a.match(/^--gcode$/) then params[:gcode] = true\n elsif v = a.match(/^--apply-maths$/) then params[:do_tform] = true\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n params\nend", "def test_parse02c\n options = ArgumentManager.parse( [ '-i', '1' ] )\n assert_equal( 1, options[ 'i' ] )\n end", "def initialize\n if valid_arguments?\n @directory = ARGV[0]\n @modification_factor = parse_number(ARGV[1])\n @cancellaction_factor = parse_number(ARGV[2])\n else\n raise \"Wrong input! directroy: #{ARGV[0]}, modification_factor: #{ARGV[1]}, cancellaction_factor: #{ARGV[2]}.\n Please pass arguments in such order: directory name (string), modification factor (integer or float),\n cancellaction factor (integer or float), for example: ruby run.rb directory_name 1 0.4\"\n end\n end", "def argc! count, syntax = nil\n @params = @params_str.split(/\\s/, count)\n\n return true if @params.length >= count\n\n if syntax\n raise \"At least #{count} parameters required: #{syntax}\"\n else\n raise \"At least #{count} parameters required.\"\n end\n end", "def process_args\n if has_directory?\n @directory_to_parse = @args[0]\n else\n @files = @args[0...@args.count-3]\n @owner = @args[@args.count-3]\n @repo = @args[@args.count-2]\n @token = @args[@args.count-1]\n end\n end", "def test_parse05c\n options = ArgumentManager.parse( [ '-k', '3', '-l', '7' ] )\n assert_equal( 7, options[ 'l' ] )\n end", "def test_parse03c\n options = ArgumentManager.parse( [ '-j', '9' ] )\n assert_equal( 9, options[ 'j' ])\n end", "def __parse__(args)\n opts = @parser.parse(args.empty? ? ['-h'] : args)\n opts[:mode] = opts[:mode].to_s.to_i(8)\n opts[:tail] = @parser.tail\n opts\nend", "def parse_arguments\n expect_at_least(1, \"chunk files to weave\")\n end", "def test_options_parser\n input_short = '-oC:\\test -v -c pass'.split(\" \")\n input_long = '--output-path=C:\\test --verbose --copy-only pass'.split(\" \")\n\n [input_short, input_long].each do |input|\n options = parse_args(input)\n\n assert_equal('C:\\test', options[:output_folder])\n assert_true(options[:verbose])\n assert_true(options[:copy_only])\n assert_equal(['pass'], input)\n end\n end", "def file_read_opts=(_arg0); end", "def parse_args(args)\n options = {\n :excount => 5,\n :testdata => nil,\n :console => false,\n :raw => false,\n :pronounciation_offset => 1,\n :definition_offset => 2,\n :url => \"m\"\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n opts.on(\"-p N\", Integer, \"Offset to pronunciation column, default 1\") do |n|\n options[:pronounciation_offset] = n\n end\n opts.on(\"-d N\", Integer, \"Offset to definition column, default 2\") do |n|\n options[:definition_offset] = n\n end\n opts.on(\"-n N\", Integer, \"Number of example sentences, default 5\") do |n|\n options[:excount] = n\n end\n opts.on(\"-u U\", String, \"Source url (#{WWWJDICExampleProvider::SOURCES.to_s}), default #{options[:url]}\") do |u|\n options[:url] = u\n end\n\n opts.separator \"\"\n opts.separator \"Testing:\"\n opts.on(\"-t\", \"--testdata [DATAFILE]\",\n \"Path to yaml data file of examples (useful for testing)\") do |d|\n options[:testdata] = d\n end\n\n opts.separator \"\"\n opts.separator \"Output:\"\n opts.on(\"-c\", \"--console\", \"Dump to console only\") do |c|\n options[:console] = c\n end\n opts.on(\"-r\", \"--raw\", \"Output raw data (all examples)\") do |c|\n options[:raw] = c\n end\n\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend", "def machine_count_top\n infile, result, *others = params\n a_filename = \"A-customers-#{others[0] || File.basename(infile, '.*')}.csv\"\n count_filename = \"A-customers-count-#{others[0] || File.basename(infile, '.*')}.csv\"\n age_filename = \"A-customers-age-#{others[0] || File.basename(infile, '.*')}.csv\"\n count = others[1] || 50\n\n puts; print \"Extracting customers with more than #{count} machines\"\n\n Sycsvpro::Extractor.new(infile: infile,\n outfile: a_filename,\n rows: \"0,1,BEGINn5>=#{count}END\").execute\n\n puts; print \"Extract customer name and machine count\"\n\n Sycsvpro::Extractor.new(infile: a_filename,\n outfile: count_filename,\n cols: \"0,5\").execute\n\n puts; print \"Extract customer name, machine count and age older than 7 years\"\n\n Sycsvpro::Extractor.new(infile: a_filename,\n outfile: age_filename,\n cols: \"0,5,6\").execute\n\n puts;\n puts \"You can find the result in '#{a_filename}', '#{count_filename}' \"+\n \"and '#{age_filename}'\"\n \nend", "def parse_arguments\n options = {}\n parser = OptionParser.new do |opts|\n opts.on(\"-d\", \"--dir DIR\", \"absolute or relative path of the directory\") do |arg|\n options[:dir] = arg\n end\n\n opts.on(\"-p\", \"--pattern PATTERN\", \"search pattern - can contain asterisk(*) as wildcard\") do |arg|\n options[:pattern] = arg\n end\n end\n parser.parse!\n [options, parser]\nend", "def initialize(argv)\n @max = 65535\n @ceil = nil\n @num = 3\n\n args = cli argv,\n '-n --num' => lambda{ |d| @num = d.to_i },\n '-m --max' => lambda{ |m| @max = m.to_i },\n '-s --sort' => lambda{ @sort = true },\n '-a --abs' => lambda{ @abs = true },\n '-c --ceil' => lambda{ |c| @ceil = c.to_i },\n '-d --debug' => lambda{ $DEBUG = true },\n '-h --help' => lambda{ show_help }\n\n @directory = args.first\n end", "def process_args\n @options = { sequence_num: nil, directory: nil, verbose: false }\n\n @optparse = OptionParser.new do |opts|\n opts.banner = 'Usage: Upload directory to MOA repository'\n\n @options[:sequence_num] = nil\n opts.on( '-s', '--seq SEQ', Integer, 'disk upload sequence number' ) do |seq|\n @options[:sequence_num] = seq\n end\n\n @options[:batch] = 1\n opts.on( '-b', '--batch BATCH', Integer, 'Start from batch number' ) do |batch|\n @options[:batch] = batch\n end\n\n @options[:batchsize] = BATCH_SIZE\n opts.on( '-n', '--batchsize BATCHSIZE', Integer, 'Set Batch Size (Default 5000 files)' ) do |batchsize|\n @options[:batchsize] = batchsize\n end\n\n @options[:directory] = nil\n opts.on( '-d', '--dir DIR', String, 'directory to upload' ) do |dir|\n @options[:directory] = dir\n end\n\n @options[:verbose] = false\n opts.on( '-v', '--verbose', 'Output more information' ) do\n @options[:verbose] = true\n end\n\n opts.on( '-?', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n\n @optparse.parse!\n\n if @options[:directory].nil? || @options[:sequence_num].nil?\n puts @optparse\n exit(-1)\n end\nend", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "def parse(args)\n # The options specified on the command line will be collected in\n # *options*.\n\n @options = CLIOptions.new\n @args = OptionParser.new do |parser|\n @options.define_options(parser, help_info)\n parser.parse!(args)\n end\n\n @cdb_path = args.shift\n if @options.debug\n validate_debug!(@options.debug)\n self.file_logger.add_appenders(Logging.appenders.file(@options.debug))\n end\n\n self.logger.level = 4 - @options.verbose\n\n @options\n end", "def parse(args, &_block)\n skip_next = false\n\n args.each_with_index do |arg, idx|\n if skip_next\n skip_next = false\n next\n end\n\n if arg.length > 1 && arg[0] == '-' && arg[1] != '-'\n arg.split('').each do |flag|\n fmt.each_pair do |fmtspec, val|\n next if fmtspec != \"-#{flag}\"\n\n param = nil\n\n if val[0]\n param = args[idx + 1]\n skip_next = true\n end\n\n yield fmtspec, idx, param\n end\n end\n else\n yield nil, idx, arg\n end\n end\n end", "def read_file_import(filename, format = nil)\n # Ask the user which format the file is in\n if(format.nil?)\n puts(\"Which format is the file?\")\n puts(\"1) Multiple lines with the same entry (or unique lines)\")\n puts(\"2) Output from call to 'uniq -c'\")\n puts(\"3) Lines in the format 'count,value'\")\n puts(\"4) Lines in the format 'count:value'\")\n\n format = get_with_default(\"Selection\", '0', /^[1234]$/)\n end\n\n # Read the file into the appropriate place\n lines = IO.readlines(filename).collect do |line| line.chomp end\n\n # Create an associative array counts, which will be hash=>count pairs\n counts = {}\n if(format == IMPORT_FORMAT_MULTIPLE_LINES)\n lines.each do |line|\n counts[line] = counts[line].nil? ? 1 : counts[line] + 1\n end\n else\n lines.each do |line|\n results = nil\n if(format == IMPORT_FORMAT_UNIQ)\n results = line.match(/^[ ]*([0-9]+) (.*)$/)\n elsif(format == IMPORT_FORMAT_COMMA)\n results = line.match(/^[ ]*([0-9]+)[ ]*,(.*)$/)\n elsif(format == IMPORT_FORMAT_COLON)\n results = line.match(/^[ ]*([0-9]+)[ ]*:(.*)$/)\n else\n throw :InvalidFormatException\n end\n\n if(results.nil? || results[1].nil? || results[2].nil?)\n puts(\"Line is in an invalid format: #{line}\")\n throw :InvalidFormatException\n end\n counts[results[2]] = counts[results[2]].nil? ? results[1].to_i : counts[results[2]] + results[1].to_i\n end\n end\n\n return counts\nend", "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end", "def parse_args\n options = {}\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: harness.rb [-c || --config ] FILE [-d || --testdir] DIR\"\n\n options[:testdir] = nil\n opts.on( '-d', '--testdir DIR', 'Execute tests in DIR' ) do|dir|\n options[:testdir] = dir\n end\n options[:config] = nil\n opts.on( '-c', '--config FILE', 'Use configuration FILE' ) do|file|\n options[:config] = file\n end\n\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n return options\nend", "def parse_args\n doc = <<DOCOPT\nschwifty saves and downloads objects from ipfs, keeping track of their hashes in a garbage collection file in ~/.ipfs/ipfs_pinned_objects.yaml and an objects file in ./ipfs_objects.yaml\n\nUsage:\n schwifty add <files>...\n schwifty bootstrap (--clear | <nodes>... | --file=<bootstrap_list_yaml>)\n schwifty get <files_or_hashes>...\n schwifty gc\n schwifty -h | --help\n schwifty --version\n\nOptions:\n -h --help Show this screen.\n --version Show version.\nDOCOPT\n begin\n Docopt.docopt(doc)\n rescue Docopt::Exit => e\n puts e.message\n exit\n end\n end", "def count\n\t\t@input_ary.each_with_index { |line,i|\n\t\t\tif line =~ /^COUNT=([0-9]*)\\s*/\n\t\t\t\t@fileinfo[:count] = $1.to_i \n\t\t\t\tat = i+1\n\t\t\tend\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot define number of elements!\" unless @fileinfo[:count]\n\t\traise DTA_ReaderErr, \"Error parsing elements count :: #{@input_file}:#{at} :: COUNT=\" + $1.inspect if @fileinfo[:count] == 0\n\tend", "def parse_option(args)\n if args.include?(\"-h\") || args.include?(\"--help\")\n puts \"usage: bq_guess input_file\"\n exit\n elsif args.include?(\"-v\") || args.include?(\"--version\")\n require \"bq_guess/version\"\n puts BqGuess::VERSION\n exit\n else\n { input_path: args.first }\n end\n end", "def parse(args)\n @options = {\n reporters: [DEFAULT_REPORTER],\n }\n\n OptionParser.new do |parser|\n parser.banner = \"Usage: #{parser.program_name} [options] [scss-files]\"\n\n add_display_options parser\n add_linter_options parser\n add_file_options parser\n add_info_options parser\n end.parse!(args)\n\n # Any remaining arguments are assumed to be files\n @options[:files] = args\n\n @options\n rescue OptionParser::InvalidOption => e\n raise SCSSLint::Exceptions::InvalidCLIOption,\n e.message,\n e.backtrace\n end", "def parse input\n c_doc = []\n while line = input.gets\n l = line.chomp.split(',')\n c_record = {\n :key => l[0],\n :volume => l[1],\n :path => l[2],\n :break => l[3],\n :empty1 => l[4],\n :empty2 => l[5],\n :pages => l[6],\n }\n new_doc if c_record[:break] && $. >1\n @doc.push c_record\n end\n new_doc\n Loadfile::Opticon.new @docs\n end", "def parse_command_line()\n opts = GetoptLong.new(\n [ \"--input-file\" , \"-i\", GetoptLong::REQUIRED_ARGUMENT ],\n [ \"--verbose\" , \"-v\", GetoptLong::NO_ARGUMENT ]\n )\n #----------------------------- defaults\n\n opts.each do |opt, arg|\n if (opt == \"--input-file\" ) ; $input_file = arg\n elsif (opt == \"--verbose\" ) ; $verbose = 1\n end\n\n if ($verbose != 0) ; puts \"Option: #{opt}, arg #{arg.inspect}\" ; end\n end\nend", "def parse_file_argument(key)\n if @opts[key].nil? and f=@argv.shift\n @opts[key] = do_file_read(f)\n end\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"Whole Building\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n\r\n return args\r\n end", "def parse_args(args)\n options = OpenStruct.new\n\n options[:html] = false\n options[:directory] = './'\n options[:ext] = '.jpg'\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: main.rb [options]'\n opts.separator ''\n opts.separator 'Options:'\n\n opts.on('-f', '--filename FILE', 'Filename to write') do |f|\n options[:filename] = f\n end\n\n opts.on('-d', '--directory DIRECTORY', 'Image directory to process') do |d|\n options[:directory] = d\n end\n\n opts.on('--html', 'Output HTML instead of CSV') do\n options[:html] = true\n end\n\n opts.on('-h', '--help', 'Help') do\n puts opts\n exit\n end\n end\n\n begin\n opt_parser.parse(args)\n rescue OptionParser::ParseError\n $stderr.print(\"Argument Error: #{$ERROR_INFO}\\n\")\n exit\n end\n\n # set default filename if not supplied\n unless options[:filename]\n ext = options[:html] ? 'html' : 'csv'\n options[:filename] = \"exif_data_#{Time.now.strftime('%s')}.#{ext}\"\n end\n\n options\n end", "def parse(src)\n recAttrParse(src)\n # look if there are any duplicates, if there are it's an error:\n counterHash = Hash.new(0)\n args.each { |a| k=a.to_sym; counterHash[k] += 1 }\n dupes = []; counterHash.each { |k, v| dupes << k if v > 1 }\n raise \"Duplicate arguments for #{self} - [#{dupes.join(',')}]\" unless dupes.empty?\n @argSet = Set.new(args)\n updateKey\n self\n end", "def parse(args)\n arg_list = arg_groups(args)\n options = DEFAULT_OPTIONS.dup\n options[:exclude] += default_excludes\n options[:locations] = arg_list.shift\n\n arg_list.reject(&:empty?).each do |set|\n flag, *args = set\n args.map! { |arg| arg.delete(\"/\") } # \"log/\" => \"log\"\n\n case flag\n when '-f', '--flags' then options[:flags] += args\n when '-e', '--exclude' then options[:exclude] += args\n else puts \"Unknown argument: #{flag}\"\n end\n end\n\n options\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # the name of the sql file\r\n csv_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_name\", true)\r\n csv_name.setDisplayName(\"CSV file name\")\r\n csv_name.setDescription(\"CSV file name.\")\r\n csv_name.setDefaultValue(\"mtr.csv\")\r\n args << csv_name\r\n \r\n csv_time_header = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_time_header\", true)\r\n csv_time_header.setDisplayName(\"CSV Time Header\")\r\n csv_time_header.setDescription(\"CSV Time Header Value.\")\r\n csv_time_header.setDefaultValue(\"Date/Time\")\r\n args << csv_time_header\r\n \r\n csv_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var\", true)\r\n csv_var.setDisplayName(\"CSV variable name\")\r\n csv_var.setDescription(\"CSV variable name\")\r\n csv_var.setDefaultValue(\"Whole Building:Facility Total Electric Demand Power [W](TimeStep)\")\r\n args << csv_var\r\n \r\n csv_var_dn = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"csv_var_dn\", true)\r\n csv_var_dn.setDisplayName(\"CSV variable display name\")\r\n csv_var_dn.setDescription(\"CSV variable display name\")\r\n csv_var_dn.setDefaultValue(\"\")\r\n args << csv_var_dn\r\n \r\n years = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"year\", true)\r\n years.setDisplayName(\"Year in csv data\")\r\n years.setDescription(\"Year in csv data => mm:dd:yy or mm:dd\")\r\n years.setDefaultValue(true)\r\n args << years\r\n \r\n seconds = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"seconds\", true)\r\n seconds.setDisplayName(\"Seconds in csv data\")\r\n seconds.setDescription(\"Seconds in csv data => hh:mm:ss or hh:mm\")\r\n seconds.setDefaultValue(true)\r\n args << seconds\r\n \r\n sql_key = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_key\", true)\r\n sql_key.setDisplayName(\"SQL key\")\r\n sql_key.setDescription(\"SQL key\")\r\n sql_key.setDefaultValue(\"\")\r\n args << sql_key \r\n\r\n sql_var = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"sql_var\", true)\r\n sql_var.setDisplayName(\"SQL var\")\r\n sql_var.setDescription(\"SQL var\")\r\n sql_var.setDefaultValue(\"Facility Total Electric Demand Power\")\r\n args << sql_var \r\n \r\n stp = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"stp\", true)\r\n stp.setDisplayName(\"Timeseries Timestep\")\r\n stp.setDescription(\"Timeseries Timestep\")\r\n stp.setDefaultValue(\"Zone Timestep\")\r\n args << stp\r\n \r\n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\r\n env.setDisplayName(\"availableEnvPeriods\")\r\n env.setDescription(\"availableEnvPeriods\")\r\n env.setDefaultValue(\"RUN PERIOD 1\")\r\n args << env\r\n \r\n norm = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"norm\", true)\r\n norm.setDisplayName(\"norm of the difference of csv and sql\")\r\n norm.setDescription(\"norm of the difference of csv and sql\")\r\n norm.setDefaultValue(1)\r\n args << norm \r\n\r\n scale = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"scale\", true)\r\n scale.setDisplayName(\"scale factor to apply to the difference\")\r\n scale.setDescription(\"scale factor to apply to the difference\")\r\n scale.setDefaultValue(1)\r\n args << scale \r\n\r\n find_avail = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"find_avail\", true)\r\n find_avail.setDisplayName(\"find_avail\")\r\n find_avail.setDescription(\"find_avail\")\r\n find_avail.setDefaultValue(true)\r\n args << find_avail \r\n\r\n compute_diff = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"compute_diff\", true)\r\n compute_diff.setDisplayName(\"compute_diff\")\r\n compute_diff.setDescription(\"compute_diff\")\r\n compute_diff.setDefaultValue(true)\r\n args << compute_diff\r\n \r\n verbose_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"verbose_messages\", true)\r\n verbose_messages.setDisplayName(\"verbose_messages\")\r\n verbose_messages.setDescription(\"verbose_messages\")\r\n verbose_messages.setDefaultValue(true)\r\n args << verbose_messages \r\n \r\n algorithm_download = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"algorithm_download\", true)\r\n algorithm_download.setDisplayName(\"algorithm_download\")\r\n algorithm_download.setDescription(\"algorithm_download\")\r\n algorithm_download.setDefaultValue(false)\r\n args << algorithm_download \r\n \r\n plot_flag = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"plot_flag\", true)\r\n plot_flag.setDisplayName(\"plot_flag timeseries data\")\r\n plot_flag.setDescription(\"plot_flag timeseries data\")\r\n plot_flag.setDefaultValue(true)\r\n args << plot_flag\r\n \r\n plot_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"plot_name\", true)\r\n plot_name.setDisplayName(\"Plot name\")\r\n plot_name.setDescription(\"Plot name\")\r\n plot_name.setDefaultValue(\"\")\r\n args << plot_name\r\n \r\n warning_messages = OpenStudio::Ruleset::OSArgument.makeBoolArgument(\"warning_messages\", true)\r\n warning_messages.setDisplayName(\"warning_messages\")\r\n warning_messages.setDescription(\"warning_messages\")\r\n warning_messages.setDefaultValue(false)\r\n args << warning_messages\r\n\r\n return args\r\n end", "def parseEntry(path, deadline, counter)\n\t\n\tdef entryScore(key, value)\n\t\tif value >=3\n\t\t\tif @results[key] == nil then @results[key] = initializeStudent() end\n\t\t\t@results[key][\"VH\"] += 1\n\t\tend\n\tend\n\t\n\ttmp = Hash.new\n\ttmpOnTime = Hash.new\n\tDir.glob(ARGV[0] + \"#{path}\").each do |file|\n\t\t\n\t\tname = file.split(\"/\").last.split(\"_\")\n\t\t\n\t\tfirstName = name[0].capitalize\n\t\tlastName = name[1].capitalize\n\t\t\n\t\tname = firstName + ' ' + lastName\n\t\t\n\t\tif tmp[name] == nil\n\t\t\ttmp[name] = 0\n\t\t\ttmpOnTime[name] = 0\n\t\tend\n\t\t\n\t\tif (is_on_time?(deadline, file) == 2)\n\t\t\ttmpOnTime[name] = tmpOnTime[name] + 1\n\t\tend\n\t\t\n\t\ttmp[name] += 1\n\tend\n\t\n\ttmpOnTime.each do |key, value|\n\t\tentryScore(key, value)\n\tend\n\t\n\ttmp.each do |key, value|\n\t\tentryScore(key, value)\n\tend\n\t\n\tcounter += 1\n\t\n\tif counter == @n\n\t\t\n\t\treturn 0\n\t\t\n\tend\n\t\nend", "def initialize(line)\n @argtype = line.split(\" \")[0].to_sym\n end", "def test_parse04b\n options = ArgumentManager.parse( [ '-k' ] )\n assert_equal( 0, options[ 'k' ] )\n end", "def checkCommandLine\r\n if ARGV.length != 2\r\n puts \"\\nUsage: sum <fileName> <numThreads>\\n\\n\"\r\n exit(1)\r\n end\r\nend", "def command_parse(argv)\n end", "def parse_args\n { :ip => ARGV[1] || '0.0.0.0', :port => (ARGV[0] || '9000').to_i,\n :logging => !(ENV['DEBUG'] &&\n ['0', 'no', 'false'].include?(ENV['DEBUG'].downcase)) }\nend", "def parse_args\n opt = {}\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: testLogin.rb [options]\"\n opts.separator('')\n opts.on('-b', '--browser [BROWSER]', \"Default is Chrome\") do |driver|\n opt[:browser] = driver\n end\n opts.on('-v', '--version [BUILDNO]', 'CODAP build number (build_0xxx). Default is latest') do |build|\n opt[:version] = build\n end\n opts.on('-r', '--root_dir [ROOTDIR]', 'Root directory of CODAP. Default is localhost:4020/dg') do |root|\n opt[:root]=root\n end\n opts.on('-t', '--trials [NUMBER OF TRIALS]') do |num_trials|\n opt[:num_trials]=num_trials\n end\n opts.on('-c', '--cases [NUMBER OF CASES]') do |cases|\n opt[:num_cases]=cases\n end\n opts.on('-d', '--delay [DELAY BETWEEN TRIALS (ms)]') do |delay|\n opt[:delay]=delay\n end\n opts.on('-f', '--filename [FILENAME where to save results]','Must be specified if writing to a new file') do |filename|\n opt[:filename]=filename\n end\n opts.on('-p', '--path [PATH where to save results, do not include home in path]') do |path|\n opt[:path]=path\n end\n opts.on('-s', '--sleep [SLEEP time between runs (s)]') do |sleep_time|\n opt[:sleep_time]=sleep_time\n end\n opts.on('-w', '--[no-]write [WRITE]', 'write to a new file-> must specify filename, default is append (no-write). If no file name is specified, results will be appended.') do |write|\n opt[:write]=write\n end\n\n end\n opt_parser.parse!(ARGV)\n return opt\nend", "def test_parse03c\n options = ArgumentManager.parse( [ '--t-opt=foo' ] )\n assert_equal( 'foo', options[ 't-opt' ] )\n end", "def check_command_line\n if (!ARGV[0].nil? && ARGV[0].downcase == \"test\")\n @test = true\n elsif(ARGV.length < 2)\n puts \"USAGE: ruby main.rb <users_csv_file> <businesses_csv_file>\"\n puts \"OR\"\n puts \"USAGE: ruby main.rb test\"\n exit 1\n end\nend", "def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 0.7,\n :cols => 10, :rows => 10,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => true,\n :moveto_color => 'none', :lineto_color => '#ff0000', :background_color => '#fe8736',\n :xshift => 0, :yshift => 0,\n :shiftstep => nil, :shiftstepx => 0, :shiftstepy => 0, :shiftsteps => 15,\n :outputstepfile => 'output/img_%.04d.svg'\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n\n elsif v = a.match(/^--shiftstep=([-.0-9]+)$/) then params[:shiftstep] = v[1].to_f\n elsif v = a.match(/^--shiftstepx=([-.0-9]+)$/) then params[:shiftstepx] = v[1].to_f\n elsif v = a.match(/^--shiftstepy=([-.0-9]+)$/) then params[:shiftstepy] = v[1].to_f\n elsif v = a.match(/^--shiftsteps=([0-9]+)$/) then params[:shiftsteps] = v[1].to_i\n elsif v = a.match(/^--outputstepfile=['\"]*(.+\\.svg)['\"]*$/)\n then\n if v[1].match(/%[.0-9]*d/)\n params[:outputstepfile] = v[1]\n STDERR.puts \"got outputstepfile == #{params[:outputstepfile]}\"\n end\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n unless params[:shiftstep].nil? \n params[:shiftstepx] = params[:shiftstep]\n params[:shiftstepy] = params[:shiftstep]\n end\n\n params\nend", "def parse_arguments\n\toptions = {}\n\t\n\toptparse = OptionParser.new do|opts| \n\t\t# Set a banner, displayed at the top \n\t\t# of the help screen. \n\t\topts.banner = \"Usage: ruby #{$0} [options] file1 file2...\"\n\n\t\t#Figure out the framerate\n\t\toptions[:framerate] = DEFAULT_FRAMERATE\n\t\trates = [23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60]\n\t\topts.on('-f', '--framerate RATE', Float, \"The framerate of your sequence. Defaults to #{DEFAULT_FRAMERATE}. Acceptable rates: #{rates}\") do |fr|\n\t\t\tif !rates.include?(fr)\n\t\t\t\tputs \"Invalid framerate. Must be one of: #{rates}.\".red\n\t\t\t\texit\n\t\t\tend\n\t\t\toptions[:framerate] = fr\n\t\tend\n\n\t\t# This displays the help screen, all programs are\n\t\t# assumed to have this option. \n\t\topts.on( '-h', '--help', 'Display this screen' ) do\n\t\t\tputs opts\n\t\t\texit\n\t\tend\n\n\tend\n\n\t#Parse the options we've set above.\n\t#Whatever is left goes into ARGV\n\toptparse.parse!\n\n\t#XML requirements. Timebase is the round number closest to the framerate\n\ttimebase = options[:framerate].round\n\tntsc = \"FALSE\"\n\n\t#NTSC is true if the true framerate is not a round number\n\t#NTSC should be true if the framerate does not match the timebase\n\tif timebase != options[:framerate]\n\t\tntsc = \"TRUE\"\n\tend\n\n\toptions[:timebase] = timebase\n\toptions[:ntsc] = ntsc\n\n\tif ARGV.length == 0\n\t\tputs \"No files listed.\".red\n\t\texit\n\tend\n\n\t#Parse out the remaining files\n\toptions[:files] = Array.new(ARGV)\n\t \n\treturn options\nend", "def parseInput(args)\n\t# in case it is a full path, get only the filename part\n\targstr = File.basename(args.join(\" \").strip())\n\t# remove filename extensions\n\twhile argstr.sub!(/\\.[a-zA-Z2]{1,5}/,''); end\n\t# Case 1: LC control number\n\tif argstr.start_with?('lccn:') then\n\t\treturn {'lccn' => argstr.sub!('lccn:','')}\n\tend\n\t# Case 2: worldcat query string\n\ttokens = argstr.split(/\\b(author|isbn|keyword|title)=/).drop(1)\n\tif tokens.length > 1 then\n\t\treturn Hash[*tokens]\n\tend\n\t# Case 3: ISBN10 or ISBN13\n\tfor i in 0..(argstr.length - 13) do\n\t\treturn {'isbn' => argstr[i..(i+12)]} if isbn13?(argstr[i..(i+12)])\n\tend\n\tfor i in 0..(argstr.length - 10) do\n\t\treturn {'isbn' => argstr[i..(i+9)]} if isbn10?(argstr[i..(i+9)])\n\tend\n\t# Case 4: Semicolon-separated pieces (probably filename without extension)\n\ttokens = argstr.split(\";\")\n\tret = {}\n\tif tokens.length == 3 then # fulltitle;authors;year\n\t\tret['fulltitle'] = tokens[0].gsub(/[-_]/, ' ')\n\t\tret['year'] = tokens[2].gsub(/[^\\d]/,'')\n\t\tif tokens[1] =~ /^([a-zA-Z]+-)?(.*)$/ then\n\t\t\tret['author'] = $2 if $2.length > 0\n\t\tend\n\telsif tokens.length > 1 then\n\t\tret['fulltitle'] = tokens.shift.gsub(/[-_]/, ' ')\n\t\tauthor = tokens.drop_while{|x| x =~ /[^a-zA-Z\\s]/}.first\n\t\tret['author'] = author unless author.nil?\n\telse\n\t\tret['fulltitle'] = argstr.gsub(/[-_]/, ' ')\n\tend\n\tret['fulltitle'] = ret['fulltitle'].gsub(/\\(.*\\)/,'').gsub(/ +/,' ').strip\n\tret['fulltitle'].match(/\\b(\\d+)e$/) { |m|\n\t\tret['edition'] = m[1]\n\t\tret['fulltitle'].sub!(/\\b\\s*\\d+e$/,'')\n\t}\n\tret['title'] = ret['fulltitle'].sub(/\\..*$/,'').strip()\n\treturn ret\nend", "def parse_args\n @args.extend OptionParser::Arguable\n opts = @args.getopts('cdDi:lm:n:o:s:St:uvVz')\n @nsocks = opts['s'] ? opts['s'].to_i : 1\n @max_idle = opts['i'] ? opts['i'].to_i : DEFAULT_MAX_IDLE\n @max_use = opts['m'] ? opts['m'].to_i : DEFAULT_MAX_USE\n $VERBOSE = true if opts['v']\n end", "def main()\n case ARGV[0]\n when \"--list\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.list()\n when \"--delete\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.delete(ARGV[1])\n when \"--set\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.set(ARGV[1], ARGV[2])\n when \"--help\", \"-h\"\n puts HELP_INFO\n exit 1\n else\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, ARGV[0], MAX_LEVEL\n cd_source.search()\n end\nend", "def test_parse02c\n options = ArgumentManager.parse( [ '--s-opt=foo' ] )\n assert_equal( 'foo', options[ 's-opt' ] )\n end", "def parse_args\n args = {\n :stack_name => nil,\n :parameters => {},\n :interactive => false,\n :region => default_region,\n :profile => nil,\n :nopretty => false,\n :s3_bucket => nil,\n }\n ARGV.slice_before(/^--/).each do |name, value|\n case name\n when '--stack-name'\n args[:stack_name] = value\n when '--parameters'\n args[:parameters] = Hash[value.split(/;/).map { |pair| parts = pair.split(/=/, 2); [ parts[0], Parameter.new(parts[1]) ] }]\n when '--interactive'\n args[:interactive] = true\n when '--region'\n args[:region] = value\n when '--profile'\n args[:profile] = value\n when '--nopretty'\n args[:nopretty] = true\n when '--s3-bucket'\n args[:s3_bucket] = value\n end\n end\n\n args\nend", "def main \n settings = {}\n settings[\"--dp4\"]=2\n settings[\"--pv41\"]=0.0001\n settings[\"--pv42\"]=0.0001\n settings[\"--pv43\"]=0.0001\n settings[\"--pv44\"]=0.0001\n settings[\"--mq0\"]=4\n\n optHash = getopt()\n vcf = optHash[\"--vcf\"]\n \n settings.keys.sort.each do |s|\n if optHash.key?(s)\n settings[s] = optHash[s].to_f\n end\n end\n \n# nsample=countSamples(vcf)\n \n filterVCF(vcf,settings) # gt: gene -> pos -> sample -> genotype, \n\nend", "def parse_options=(_arg0); end", "def parse_options=(_arg0); end", "def parseArgs\n forceDefaultMode=false\n opts = GetoptLong.new(\n [\"-h\", \"--help\", GetoptLong::NO_ARGUMENT],\n [\"-f\", \"--file\", GetoptLong::REQUIRED_ARGUMENT],\n [\"--st\", \"--statements\", GetoptLong::REQUIRED_ARGUMENT],\n [\"-s\", \"--size\", GetoptLong::REQUIRED_ARGUMENT],\n [\"-d\", \"--default\", GetoptLong::NO_ARGUMENT],\n [\"-o\", \"--outer-control\", GetoptLong::NO_ARGUMENT],\n [\"-p\", \"--package\", GetoptLong::REQUIRED_ARGUMENT],\n [\"-n\", \"--main-class-name\", GetoptLong::REQUIRED_ARGUMENT])\n opts.each do |opt, arg|\n case opt\n when \"-f\"\n parseConfFile(arg)\n when \"-s\"\n @max_size = arg.to_i()\n when \"--st\"\n @max_stmts = arg.to_i()\n when \"-d\"\n forceDefaultMode = true\n when \"-o\"\n @outer_control = true\n when \"-p\"\n @package = arg.to_s\n when \"-n\"\n @mainClassName = arg.to_s\n end\n end\n if ARGV.length > 0\n error(\"Invalid arguments\")\n end\n @mode = 'default' if forceDefaultMode\n end", "def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend", "def parse_command_line_options\n options = {}\n options[:config] = \"config/clamav.yml\" # default\n opts = OptionParser.new\n # define options\n opts.banner = \"Usage: clamav.rb [-c file] [-u] [-i time]\"\n opts.on('-c', '--config FILE',\n \"Specify config file other than default \",\n \"'config/clamav.yml' - use relative path\") do |file|\n options[:config] = file\n end\n opts.on('-i', '--install TIME', Time,\n \"Install LaunchAgent to run clamav.rb every\",\n \"day at specified time {eg: 2:30pm}\",\n \"Try using with --config FILE\",\n \"Requires RELOGIN\") do |time|\n options[:install] = time\n end\n opts.on('-u', '--uninstall', \"Uninstall LaunchAgent - requires RELOGIN\") do |time|\n options[:uninstall] = true\n end\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") {puts opts; exit 0}\n opts.on_tail(\"-v\", \"--version\", \"Show version\") {puts \"clamav.rb 1.1.0\"; exit 0}\n # parse options\n opts.parse!(ARGV)\n options\nend", "def start\n file_name = ARGV[0]\n puts \"file_name: #{file_name}\"\n \n input = CSV.read(file_name)\n\n header = input.first\n #puts header\n rows = []\n (1...input.size).each { |i| rows << CSV::Row.new(header, input[i]) }\n \n @FeatureCount = 0 #@iCount = 0 or rows.length-1\n while @FeatureCount<rows.length #@iCount<rows.length or @iCount> 0\n if(input[@FeatureCount]!= nil)\n puts rows[@FeatureCount]\n manage_userStory(rows[@FeatureCount])\n end\n @FeatureCount += 1\n end\nend", "def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend", "def test_parse05c\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt=bar' ] )\n assert_equal( 'bar', options[ 'v-opt' ] )\n end", "def parse_options(opts, args); end", "def extract_arguments!\n return ARGV[0], nil, nil if ARGV.length == 1\n\n raise(ArgumentError, \"Usage: mixtape-bu SOURCE [CHANGES] [DEST]\") unless ARGV.length == 3\n\n ARGV.take(3)\nend", "def main \n settings = {}\n settings[\"--dp4\"]=2\n settings[\"--pv41\"]=0.0001\n settings[\"--pv42\"]=0.0001\n settings[\"--pv43\"]=0.0001\n settings[\"--pv44\"]=0.0001\n settings[\"--clr\"]=20\n settings[\"--normal\"]=1\n \n optHash = getopt()\n vcf = optHash[\"--vcf\"]\n \n settings.keys.sort.each do |s|\n if optHash.key?(s)\n settings[s] = optHash[s].to_f\n end\n end\n \n nsample=countSamples(vcf)\n \n filterVCF(vcf,settings,nsample) # gt: gene -> pos -> sample -> genotype, \n\nend", "def readParams(fname)\n begin\n f = File.open(fname)\n rescue Exception => e\n puts e\n $stdout.flush\n exit(1)\n end\n\n section = nil\n f.each_line{|line|\n\n line.chomp!\n line.strip!\n if line == \"\" || line =~ /^%/\n # skip blank lines & lines beginning with %\n\n elsif line == $headerPorts || line == $headerShips ||\n line == $headerTraveler || line == $headerOutput\n section = line\n\n elsif section == $headerPorts\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starport.push(Starport.new(name,size))\n \n elsif section == $headerShips\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starship.push(Starship.new(name,size))\n\n elsif section == $headerTraveler\n parts = line.split(' ')\n name = parts.shift\n itinerary = []\n parts.each { |p| itinerary.push(find_name($starport,p)) }\n person = Traveler.new(name,itinerary)\n $traveler.push(person)\n find_name($starport,parts.first).arrive(person)\n\n elsif section == $headerOutput\n $simOut.push(line)\n\n else\n puts \"ERROR: simFile format error at #{line}\"\n $stdout.flush\n exit(1)\n end\n }\nend", "def stats(filename,*args)\n fn = OptArg.quote(filename)\n opt = OptArg.parse(*args)\n puts send_cmd \"stats #{fn} #{opt}\"\n end", "def parse_command_line_args(args)\n opts = OptionParser.new do |opts|\n opts.banner = 'Usage: tbibtools [OPTIONS] [FILES] < IN > OUT'\n opts.separator ''\n opts.separator 'tbibtools is a free software with ABSOLUTELY NO WARRANTY under'\n opts.separator 'the terms of the GNU General Public License version 2 or newer.'\n opts.separator ''\n \n opts.on('-c', '--config=FILE', String, 'Configuration file') do |value|\n @configuration.config value\n end\n\n opts.on('-e', '--regexp=REGEXP', String, 'Display entries matching the regexp') do |value|\n @configuration.filter Regexp.new(value)\n end\n\n opts.on('-f', '--format=STRING', String, 'Re-format entries (order matters)') do |value|\n @configuration.format *value.split(/,/)\n end\n\n opts.on('--[no-]formatted', 'Unformatted output') do |bool|\n unless bool\n @configuration.entry_format = []\n @configuration.entry_format_default = []\n end\n end\n\n opts.on('-i', '--[no-]case-sensitive', 'Case insensitive') do |bool|\n @configuration.sort_case bool\n end\n \n opts.on('-l', '--format-list=[STRING]', String, 'Format string for list (implies --ls)') do |value|\n @configuration.shortcut_ls\n @configuration.list_format value if value\n end\n\n opts.on('--ls', 'Synonym for: -f list,stripPrelude (\"list\" implies \"unwrap\")') do |bool|\n @configuration.shortcut_ls if bool\n end\n\n opts.on('-o', '--output=FILE', String, 'Output file') do |value|\n @configuration.output value\n end\n\n opts.on('-P', '--strip-prelude', 'Strip the prelude: same as -f stripPrelude but helps to maintain the original formatting') do |bool|\n @configuration.strip_prelude\n end\n\n opts.on('-q', '--query=FIELD=REGEXP', String, 'Show entries for which field matches the regexp') do |value|\n field, rx = value.split(/=/, 2)\n @configuration.query field => Regexp.new(rx, Regexp::IGNORECASE)\n end\n\n opts.on('-s', '--sort=STRING', String, 'Sort (default: sort by key; key = _id, type = _type)') do |value|\n @configuration.sort_key value\n end\n\n opts.on('-S', '--[no-]expand-strings', 'Replace/expand strings') do |bool|\n @configuration.expand_strings bool\n end\n\n opts.on('--strip=FIELDS', String, 'Ignore/strip fields') do |value|\n @configuration.strip value.split(/,/)\n end\n\n opts.on('-u', '--unsorted', 'Unsorted output') do |bool|\n @configuration.sort_key nil\n end\n\n opts.separator ''\n opts.separator 'Other Options:'\n \n opts.on('--debug', Integer, 'Show debug messages') do |v|\n $DEBUG = true\n $VERBOSE = true\n end\n \n opts.on('-v', '--verbose', 'Run verbosely') do |v|\n $VERBOSE = true\n end\n \n opts.on('-h', '--help', 'Show this message') do\n puts opts\n exit 1\n end\n\n opts.separator ''\n opts.separator 'Available formats:'\n format_rx = /^(format|preprocess|head|body|tail)_/\n format_names = (['nnIsYear', 'sortCrossref', 'downcaseType', 'upcaseType'] + \n @configuration.methods.find_all{|m| m =~ format_rx}.collect{|m| m.sub(format_rx, '')}).uniq.sort.join(', ')\n opts.separator format_names\n\n opts.separator ''\n opts.separator 'Known format shortcuts:'\n acc = []\n @configuration.methods.find_all{|m| m =~ /^shortcut_/}.sort.each do |meth|\n fn = meth.sub(/^shortcut_/, '')\n fs = @configuration.send(meth, acc)\n opts.separator \"#{fn}: #{fs.join(',')}\"\n end\n end\n @configuration.input *opts.parse!(args)\n self\n end", "def main \n settings = {}\n settings[\"--dp4\"]=2\n settings[\"--pv41\"]=0\n settings[\"--pv42\"]=0\n settings[\"--pv43\"]=0\n settings[\"--pv44\"]=0\n settings[\"--clr\"]=20\n settings[\"--normal\"]=0 ## default: tumor is first, normal is second. \n settings[\"--minPL\"] = 40\n optHash = getopt()\n vcf = optHash[\"--vcf\"]\n \n settings.keys.sort.each do |s|\n if optHash.key?(s)\n settings[s] = optHash[s].to_f\n end\n end\n \n nsample=countSamples(vcf)\n \n filterVCF(vcf,settings,nsample) # gt: gene -> pos -> sample -> genotype, \n\nend", "def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend", "def parse(args)\n #add the possible arguments to the argument parser\n\topt_parser = OptionParser.new do |opts|\n\t\topts.banner = \"Usage: Scanner.rb [options] file [files...]\"\n\t\topts.on(\"-s [FILE]\", \"--save [FILE]\", \"Saves to file [FILE]\") do |file|\n\t\t\t$save2File = true\n\t\t\t$file = File.new(Pathname.new(file).realpath, \"w+\")\n\t\tend\n opts.on(\"-x [FILE]\", \"--xml [FILE]\", \"Saves to XML file [FILE]\") do |file|\n $save2XML = true\n $xmlFile = File.new(Pathname.new(file).realpath, \"w+\")\n end\n\t\topts.on(\"-q\", \"--quiet\", \"Do not show output on console\") do\n\t\t\t$quiet = true\n\t\tend\n opts.on(\"-v\", \"--verbose\", \"Show additional output on the console, overwrites quiet\") do\n $verbose = true\n end\n\tend\n\t#start the parsing of the arguments\n\topt_parser.parse!(args)\nend", "def parsed_argv\n Hash[ARGV.map { |arg| arg.split(\":\") }]\nend", "def parse_args(args)\n options = {\n :console => false,\n :tag => nil\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n\n opts.on(\"-t T\", String, \"Tag\") do |t|\n options[:tag] = t\n end\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend", "def parse(args={})\n csv_args = {:skip_blanks=>true,:col_sep=>\",\"}\n csv_args[:col_sep] = args[:col_sep] if args[:col_sep]\n args[:value_filter] ||= Csv2sql.method :default_value_filter\n i = 0\n CSV.foreach(@filename,csv_args) do |row|\n values = row\n #values_filter is for whole row\n #value_filter is for single value\n values = args[:values_filter].call(row, i) if args[:values_filter]\n if values\n if args[:value_filter]\n j = -1\n values = row.map do |value|\n j += 1\n args[:value_filter].call(value,i,j)\n end\n end\n yield values if values\n end\n i += 1\n end\n end", "def parse(args)\n @options = {}\n @options[:command] = :scan # Default command is to scan for lints\n\n OptionParser.new do |parser|\n parser.banner = \"Usage: #{@application.executable_name} [options] [file1, file2, ...]\"\n\n add_linter_options parser\n add_file_options parser\n add_misc_options parser\n add_info_options parser\n end.parse!(args)\n\n # Any remaining arguments are assumed to be files that should be linted\n @options[:included_paths] = args\n\n @options\n rescue OptionParser::InvalidOption => ex\n raise InvalidCliOptionError,\n \"#{ex.message}\\nRun `#{@application.executable_name} --help` to \" \\\n 'see a list of available options.'\n end", "def test_parse02b\n options = ArgumentManager.parse( [ '-i' ] )\n assert_equal( 0, options[ 'i' ] )\n end", "def main(args)\n expectedArgs = 1\n helpMessage = \"Usage\\nlef_layer_blockage_count.rb input_lef [layer_name]\\n\"\n helpMessage << \"Default [layer_name] is VI1\\n\" \n if (args.size<expectedArgs)\n puts helpMessage\n abort\n end\n\n layer_name = \"VI1\"\n lef_file = args.shift\n if args.length>0\n layer_name = args.shift\n end\n\n\n # Header\n puts \"cell_name,#{layer_name}_blockage_count\"\n # Open a file and parse some stuff\n infile = File.open(lef_file,\"r\")\n lines = infile.readlines\n infile.close\n cntr=0\n layer_count=0\n in_obs = false\n in_obs_layer = false\n cell_layer_count = Hash.new()\n while cntr<(lines.length-1)\n line=lines[cntr]\n # Get cell name\n if line=~/^\\s*MACRO\\s+(\\w+)\\s*$/\n cell = $1\n layer_count=0\n # Look for obstruction\n elsif line=~/^\\s*OBS\\s*$/\n in_obs = true\n # Look for layers and get a count\n elsif in_obs && line=~/^\\s*LAYER\\s+#{layer_name}\\s*;/\n in_obs_layer = true\n #keep processinga all the layers and look for the end of the layers\n while in_obs_layer\n cntr+=1\n line=lines[cntr]\n if (line=~/^\\s*LAYER\\s+/) \n in_obs_layer = false\n elsif (line=~/^\\s*END\\s*$/)\n in_obs = false\n in_obs_layer = false\n else\n layer_count+=1\n end\n end\n cell_layer_count[cell]=layer_count\n puts \"#{cell},#{layer_count}\"\n # Look for end of obs\n elsif in_obs && (line=~/^\\s*END\\s*$/)\n in_obs = false\n end\n cntr+=1\n end\nend", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def parse_options(argv:)\n input_path = nil\n columns = nil\n output_path = nil\n delimiter = ','\n header_only = false\n rows_only = false\n skip_lines = nil\n type_map = {}\n\n OptionParser.new do |parser|\n @parser = parser\n\n parser.banner = 'Usage: honey_format [options] <file.csv>'\n parser.default_argv = argv\n\n parser.on('--csv=input.csv', String, 'CSV file') do |value|\n input_path = value\n end\n\n parser.on('--columns=id,name', Array, 'Select columns') do |value|\n columns = value&.map(&:to_sym)\n end\n\n parser.on('--output=output.csv', String, 'CSV output (STDOUT otherwise)') do |value|\n output_path = value\n end\n\n parser.on('--delimiter=,', String, 'CSV delimiter (default: ,)') do |value|\n delimiter = value\n end\n\n parser.on('--skip-lines=,', String, 'Skip lines that match this pattern') do |value|\n skip_lines = value\n end\n\n parser.on('--type-map=[key1=val1,key2=val2]', Array, 'Type map') do |value|\n type_map = option_to_h(value || [])\n end\n\n parser.on('--[no-]header-only', 'Print only the header') do |value|\n header_only = value\n end\n\n parser.on('--[no-]rows-only', 'Print only the rows') do |value|\n rows_only = value\n end\n\n parser.on('-h', '--help', 'How to use') do\n puts parser\n exit\n end\n\n parser.on_tail('--version', 'Show version') do\n puts \"HoneyFormat version #{HoneyFormat::VERSION}\"\n exit\n end\n end.parse!\n\n if header_only && rows_only\n raise(ArgumentError, \"you can't provide both --header-only and --rows-only\")\n end\n\n if input_path && argv.last\n raise(ArgumentError, \"you can't provide both --csv and <path>\")\n end\n\n input_path ||= argv.last\n\n {\n input_path: input_path,\n columns: columns,\n output_path: output_path,\n delimiter: delimiter,\n header_only: header_only,\n rows_only: rows_only,\n skip_lines: skip_lines,\n type_map: type_map,\n }\n end", "def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An input must be specified.\")\n\n @generator = args[:generator] ||\n ((key = args[:key]) && Generator.new(key)) ||\n fail(\"A key or generator must be specified.\")\n\n @window = args[:window] || 16\n\n #The filler value is for testing purposes only. It should\n #not be specified when secure operation is desired.\n @fill_value = args[:filler]\n end", "def parse!(argv)\n\t\t$log.debug(\"#{self.class}.#{__method__}('#{argv.join(\" \")}'#{block_given? ? ',&block' : ''})\")\n\t\tif (argv.size == 0)\n\t\t\traise OptionParser::InvalidArgument, \"No arguments specified.\"\n\t\tend\n\n\t\t# @options is used to store recognized command-line args\n\t\t@options = Hash.new\n\t\twhile arg = argv.shift\n\t\t\tcase arg\n\t\t\twhen \"-cmd\"\n\t\t\t\t@command = argv.shift\n\t\t\twhen \"-debug\"\n\t\t\t\t$log.level = Logger::DEBUG\n\t\t\t\t$logerr.level = Logger::DEBUG\n\t\t\twhen \"-opt\"\n\t\t\t\t@options[:dataset] = argv.shift\n\t\t\twhen \"-path\"\n\t\t\t\t@options[:path] = argv.shift\n\t\t\twhen \"-target\"\n\t\t\t\t@options[:target] = argv.shift\n\t\t\twhen \"-log\"\n\t\t\t\tlevel = $log.level\n\t\t\t\tlog_path = argv.shift\n\t\t\t\t$log = Logger.new(log_path)\n\t\t\t\t$log.level = level\n\t\t\t\t$logerr = Logger.new(log_path)\n\t\t\t\t$logerr.level = level\n\t\t\telse\n\t\t\t\targv.unshift(arg)\n\t\t\t\tif block_given?\n\t\t\t\t\tunless (argv = yield(argv))\n\t\t\t\t\t\traise OptionParser::InvalidArgument, \"Unknown argument.\"\n\t\t\t\t\tend\n\t\t\t\telse break\n\t\t\t\tend\n\t\t\tend\t\t\n\t\tend\n\t\traise OptionParser::InvalidArgument, \"No command specified.\" unless @command\n\t\tunless (self.class::COMMANDS.include?(@command) && self.respond_to?(@command))\n\t\t\traise OptionParser::InvalidArgument, \"Unknown command '#{@command}' specified.\"\n\t\tend\n\t\treturn argv\n\tend", "def argument_parser\n cmds = self\n Trollop::Parser.new do\n version Cheripic::VERSION\n banner cmds.help_message\n opt :assembly, 'Assembly file in FASTA format',\n :short => '-f',\n :type => String\n opt :input_format, 'bulk and parent alignment file format types - set either pileup or bam or vcf',\n :short => '-F',\n :type => String,\n :default => 'pileup'\n opt :mut_bulk, 'Pileup or sorted BAM file alignments from mutant/trait of interest bulk 1',\n :short => '-a',\n :type => String\n opt :mut_bulk_vcf, 'vcf file for variants from mutant/trait of interest bulk 1',\n :type => String,\n :default => ''\n opt :bg_bulk, 'Pileup or sorted BAM file alignments from background/wildtype bulk 2',\n :short => '-b',\n :type => String\n opt :bg_bulk_vcf, 'vcf file for variants from background/wildtype bulk 2',\n :type => String,\n :default => ''\n opt :output, 'custom name tag to include in the output file name',\n :default => 'cheripic_results'\n opt :loglevel, 'Choose any one of \"info / warn / debug\" level for logs generated',\n :default => 'info'\n opt :hmes_adjust, 'factor added to snp count of each contig to adjust for hme score calculations',\n :type => Float,\n :default => 0.5\n opt :htlow, 'lower level for categorizing heterozygosity',\n :type => Float,\n :default => 0.25\n opt :hthigh, 'high level for categorizing heterozygosity',\n :type => Float,\n :default => 0.75\n opt :mindepth, 'minimum read depth at a position to consider for variant calls',\n :type => Integer,\n :default => 6\n opt :max_d_multiple, \"multiplication factor for average coverage to calculate maximum read coverage\nif set zero no calculation will be made from bam file.\\nsetting this value will override user set max depth\",\n :type => Integer,\n :default => 5\n opt :maxdepth, 'maximum read depth at a position to consider for variant calls\nif set to zero no user max depth will be used',\n :type => Integer,\n :default => 0\n opt :min_non_ref_count, 'minimum read depth supporting non reference base at each position',\n :type => Integer,\n :default => 3\n opt :min_indel_count_support, 'minimum read depth supporting an indel at each position',\n :type => Integer,\n :default => 3\n opt :ambiguous_ref_bases, 'including variant at completely ambiguous bases in the reference',\n :type => String,\n :default => 'false'\n opt :mapping_quality, 'minimum mapping quality of read covering the position',\n :short => '-q',\n :type => Integer,\n :default => 20\n opt :base_quality, 'minimum base quality of bases covering the position',\n :short => '-Q',\n :type => Integer,\n :default => 15\n opt :noise, 'praportion of reads for a variant to conisder as noise',\n :type => Float,\n :default => 0.1\n opt :cross_type, 'type of cross used to generated mapping population - back or out',\n :type => String,\n :default => 'back'\n opt :use_all_contigs, 'option to select all contigs or only contigs containing variants for analysis',\n :type => String,\n :default => 'false'\n opt :include_low_hmes, 'option to include or discard variants from contigs with\nlow hme-score or bfr score to list in the final output',\n :type => String,\n :default => 'false'\n opt :polyploidy, 'Set if the data input is from polyploids',\n :type => String,\n :default => 'false'\n opt :mut_parent, 'Pileup or sorted BAM file alignments from mutant/trait of interest parent',\n :short => '-p',\n :type => String,\n :default => ''\n opt :bg_parent, 'Pileup or sorted BAM file alignments from background/wildtype parent',\n :short => '-r',\n :type => String,\n :default => ''\n opt :repeats_file, 'repeat masker output file for the assembly ',\n :short => '-R',\n :type => String,\n :default => ''\n opt :bfr_adjust, 'factor added to hemi snp frequency of each parent to adjust for bfr calculations',\n :type => Float,\n :default => 0.05\n opt :sel_seq_len, 'sequence length to print from either side of selected variants',\n :type => Integer,\n :default => 50\n opt :examples, 'shows some example commands with explanation'\n end\n end", "def parse_options\n @opts = Slop.parse do |o| \n o.string '-f1', '--file1', 'First source file'\n o.string '-f2', '--file2', 'Second source file'\n o.on '-v', '--version' do\n puts Slop::VERSION\n end\n end\n rescue Exception => e\n raise\n end", "def parse_options()\n\n options = {}\n\n ARGV.each_index do |index|\n case $*[index]\n when '-m' then options[:auto_connect] = false\n when '-v' then options[:verbose] = true\n when '-q' then options[:verbose] = false\n when '-t' then options[:log_truncate] = true\n when '-r' then options[:log_response] = false\n else\n ::Twiga.say_warn \"unknown option: #{arg}\"\n end # case\n\n $*.delete_at(index) # remove from command line\n\n end # do each cmd line arg\n \n return Kinokero::Cloudprint::DEFAULT_OPTIONS.merge(options)\n\n end", "def parse args=ARGV\n\t\t\tOptionParser.new do |opts|\n\t\t\t\t# Setup\n\t\t\t\tversion_path = File.expand_path('../../VERSION', File.dirname(__FILE__))\n\t\t\t\topts.version = File.exist?(version_path) ? File.read(version_path) : ''\n\t\t\t\t# Start of help text\n\t\t\t\topts.banner = 'Usage: tracking [mode]'\n\t\t\t\topts.separator ' display recent tasks'\n\t\t\t\topts.separator ' <task description> start a new task with the given text (spaces allowed)'\n\t\t\t\t# Modes\n\t\t\t\topts.on('-f', '--find', 'display all tasks that match a search query') do\n\t\t\t\t\tdisplay(:query => text_from_args)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-a', '--all', 'display all tasks') do\n\t\t\t\t\tdisplay(:max => :all)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-n', '--number integer', 'display n tasks') do |number_str|\n\t\t\t\t\tdisplay(:max => number_str.to_i)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-r', '--rename', 'rename the last task') do\n\t\t\t\t\tList.rename text_from_args\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-d', '--delete', 'delete the last task') do\n\t\t\t\t\tList.delete\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-c', '--clear', 'delete all tasks') do\n\t\t\t\t\tList.clear\n\t\t\t\t\tputs 'List cleared.'\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-h', '--help', 'display this help information') do\n\t\t\t\t\tputs opts\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend.parse! args\n\n\t\t\t# Basic modes (display and add)\n\t\t\tif args.count == 0\n\t\t\t\t# Display all tasks\n\t\t\t\tdisplay\n\t\t\telse\n\t\t\t\t# Start a new task\n\t\t\t\tList.add args.join(' ').gsub(\"\\t\",'')\n\t\t\t\tdisplay\n\t\t\tend\n\t\tend", "def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end", "def argv; argline.split(/ +/) unless argline.nil?; end", "def findopts\n [{ option: :atime,\n flag: '-atime',\n value: 'n[smhdw]',\n validate: validate_time,\n description: 'Access time.'\n },\n { option: :depth,\n flag: '-depth',\n value: 'n',\n validate: validate_number,\n description: 'Depth relative to the starting point.'\n },\n { option: :iname,\n flag: '-iname',\n value: '[pattern]',\n description: 'Path matches pattern (case insensitive).'\n },\n { option: :ipath,\n flag: '-ipath',\n value: '[pattern]',\n description: 'Path matches pattern (case insensitive).'\n },\n { option: :maxdepth,\n flag: '-maxdepth',\n value: 'n',\n validate: validate_nonnegative,\n description: 'Descend at most n directory levels.'\n },\n { option: :mindepth,\n flag: '-mindepth',\n value: 'n',\n validate: validate_nonnegative,\n description: 'Descend at least n directory levels.'\n },\n { option: :minsize,\n flag: '-minsize',\n value: 'n',\n validate: validate_unsigned_numeric,\n description: 'Prunes find expression to objects of a minimum size.'\n },\n { option: :mindsize,\n flag: '-mindirsize',\n value: 'n',\n validate: validate_unsigned_numeric,\n description: 'Prunes find expression to directories of a minimum size.'\n },\n { option: :mtime,\n flag: '-mtime',\n value: 'n[smhdw]',\n validate: validate_time,\n description: 'Modification time.'\n },\n { option: :name,\n flag: '-name',\n value: '[pattern]',\n description: 'Name (last component of the path) matches pattern.'\n },\n { option: :path,\n flag: '-path',\n value: '[pattern]',\n description: 'Path matches pattern.'\n },\n { option: :print,\n flag: '-print',\n description: 'Print the pathname.'\n },\n { option: :ls,\n flag: '-ls',\n description: 'Print ls-style information.'\n },\n { option: :size,\n flag: '-size',\n value: 'n[ckMGTP]',\n validate: validate_numeric,\n description: 'File size.'\n }\n ]\n end", "def test(cmd, file1, file2=\"foo\") end", "def initialize(p_args)\n\n\t\t\t# Scan path (where to start the file search from)\n\t\t\t@scan_path = p_args[:path]\n\n\t\t\t# Scan extension (only look at files with the given extension),\n\t\t\t# e.g. \".mp3\", \".jpg\" and so on\n\t\t\t@scan_extension = p_args[:extension]\n\n # How many files are scanned per folder (default is 1 -- fastest)\n @scan_depth = p_args[:depth] || 1\n\n # A cache containing folders which have been scanned\n @scan_history = {}\n\t\tend", "def parse( argv )\n self.data = ::Crate.data_path\n opts = option_parser\n begin\n opts.parse!( argv )\n self.project = argv.shift\n\n if project.nil?\n puts opts\n exit 1\n end\n rescue ::OptionParser::ParseError => pe\n puts \"#{opts.program_name}: #{pe}\"\n puts \"Try `#{opts.program_name} --help` for more information\"\n exit 1\n end\n end", "def find_open(file) \n line = file.gets\n if line == nil then return end\n openings = {\"u\" => 0, \"d\" => 0, \"l\" => 0, \"r\" => 0 };\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if line.include? \"u\"\n openings[\"u\"] += 1;\n end\n if line.include? \"d\"\n openings[\"d\"] += 1;\n end\n if line.include? \"l\"\n openings[\"l\"] += 1;\n end\n if line.include? \"r\"\n openings[\"r\"] += 1;\n end \n end\n end\n puts \"u: #{openings[\"u\"]}, d: #{openings[\"d\"]}, l: #{openings[\"l\"]}, r: #{openings[\"r\"]}\"\nend", "def parseopts\n\n opts = OptionParser.new\n opts.on( '-v', '--verbose', \"Run verbosely\" ) { @verbose = true }\n opts.on( '-h', '--help', \"Emit help information\") { @help = true }\n opts.on( '--version', \"Emit version and exit\") { @version = true }\n opts.on( '-n', '--name NAME', \"Array name\" ) { |n| @arrayname = n }\n opts.on( '-t', '--type TYPE', \"Array type\" ) { |t| @arraytype = t }\n opts.on( '-o', '--output FILE', 'Output file name' ) { |f| @outfile = f\n $stdout.reopen(f, \"w\")}\n opts.on( '-p', '--[no-]preamble', \"No file header\" ) { |n| @preamble = n }\n\n opts.banner =<<-end.gsub(/^ {6}/, '')\n Translates the contents of any file to a C array.\n\n Usage: #{@appname} [options] [filename]\n\n Options:\n end\n\n\n opts.separator <<-notes.gsub(/^ {6}/, '')\n\n Examples:\n #{@appname} -o output.cpp foo.bin\n #{@appname} -o header.h foo.bin\n #{@appname} -v <foo.bin >output.cpp\n #{@appname} --no-preamble -o output.cpp <foo.bin\n #{@appname} --type \\\"uint8_t\\\" <foo.bin >output.cpp\n\n notes\n\n begin\n opts.parse!\n\n rescue Exception => e\n puts e, opts\n exit\n end\n\n if @version\n puts @verstring\n exit 0\n\n elsif @help\n puts opts\n exit 0\n end\n\n\n # if no arrayname specified, use\n # infile name. If infile is\n # stdin, use default.\n\n if @arrayname == \"\"\n fname = ARGF.filename\n\n if fname == \"-\" # stdin\n fname = \"binary_data\"\n end\n\n @arrayname = fname.chomp(File.extname(fname))\n end\n\n\n if @verbose\n warn <<-end.gsub(/^ {8}/, '')\n appname = #{File.basename $0}\n verstring = #{@appname} #{BIN2CVER}\n time = #{@time}\n verbose = #{@verbose}\n help = #{@help}\n version = #{@version}\n arrayname = #{@arrayname}\n arraytype = #{@arraytype}\n infile = #{ARGF.filename}\n outfile = #{@outfile}\n preamble = #{@preamble}\n\n end\n end\n end", "def parse_options(args)\n @options = OpenStruct.new\n @options.emacs = !args.delete('--emacs').nil?\n @options.wrap = !args.delete('--wrap').nil?\n @options.inner = !args.delete('--inner').nil?\n @options.jruby = !args.delete('--jruby').nil?\n @options.nojruby = !args.delete('--nojruby').nil?\n @options.action = args[0] || nil\n @options.path = args[1] || File.basename(Dir.pwd + '.rb')\n @options.args = args[2..-1] || []\n end", "def parse_options(args)\n\t\t\t\tbegin\n\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t@options['verbose'] = false\n\t\t\t\t\t@options['rescan'] = false\n\t\t\t\t\t@options[:timeout] = 25\n\t\t\t\t\t@options[:directory] = nil\n\n\t\t\t\t\topts = OptionParser.new do |opt|\n\t\t\t\t\t\topt.banner = \"#{APP_NAME} v#{VERSION}\\nJacob Hammack\\n#{HOME_PAGE}\\n\\n\"\n\t\t\t\t\t\topt.banner << \"Usage: #{APP_NAME} <options>\"\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('File Options')\n\n\t\t\t\t\t\topt.on('-h HASH', '--search-hash HASH', 'Searches a single hash on virustotal.com') do |hash|\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-r HASH[,HASH]', '--rescan-hash HASH[,HASH]', 'Requests a rescan of a single hash, or multiple hashes (comma separated), by virustotal.com') do |hash|\n\t\t\t\t\t\t\t@options['rescan'] = true\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-f FILE', '--search-hash-file FILE', 'Searches each hash in a file of hashes on virustotal.com') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@files_of_hashes.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-u FILE', '--upload-file FILE', 'Uploads a file to virustotal.com for analysis') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@uploads.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator(\"Url Options\")\n\n\t\t\t\t\t\topt.on('-s SITE', '--search-site SITE', 'Searches for a single url on virustotal.com') { |site|\n\t\t\t\t\t\t\t@sites.push(site)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('Output Options')\n\n\t\t\t\t\t\topt.on('-j', '--json-output', 'Print results as json to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :json\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-x', '--xml-output', 'Print results as xml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :xml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-y', '--yaml-output', 'Print results as yaml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :yaml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--stdout-output', 'Print results as normal text line to stdout, this is default') do\n\t\t\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Advanced Options'\n\n\t\t\t\t\t\topt.on('-c', '--create-config', 'Creates a skeleton config file to use') do\n\t\t\t\t\t\t\tcreate_config\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-d DIRECTORY', '--directory', 'Scans a directory recursively for files and submits the hashes') do |directory|\n\t\t\t\t\t\t\t@options[:directory] = directory\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-p PROXY', '--proxy-server', 'Uses a specified proxy server') do |proxy|\n\t\t\t\t\t\t\t@options['proxy'] = proxy\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--[no-]verbose', 'Print verbose information') do |v|\n\t\t\t\t\t\t\t@options['verbose'] = v\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Other Options'\n\n\t\t\t\t\t\topt.on('-v', '--version', 'Shows application version information') do\n\t\t\t\t\t\t\tputs \"#{APP_NAME} - #{VERSION}\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on_tail('-?', '--help', 'Show this message') { |help|\n\t\t\t\t\t\t\tputs opt.to_s + \"\\n\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\n\t\t\t\t\tif ARGV.length != 0\n\t\t\t\t\t\topts.parse!\n\t\t\t\t\telse\n\t\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\trescue OptionParser::MissingArgument\n\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend" ]
[ "0.6028493", "0.5696837", "0.5345504", "0.5277444", "0.5276807", "0.5252528", "0.5217761", "0.5186166", "0.51670563", "0.5155809", "0.51500833", "0.5144254", "0.5134379", "0.51314235", "0.51246405", "0.5122422", "0.51139", "0.5082428", "0.50822866", "0.5046602", "0.5024367", "0.50219035", "0.49958003", "0.49638408", "0.4958693", "0.49584916", "0.49579757", "0.49545616", "0.4954444", "0.49493346", "0.4924576", "0.49236023", "0.49218294", "0.49195436", "0.49142894", "0.4906131", "0.49046865", "0.4902851", "0.4897948", "0.48736605", "0.48502684", "0.48456985", "0.48402354", "0.4831767", "0.48154217", "0.48079738", "0.48079106", "0.48026383", "0.48022482", "0.48021638", "0.47984827", "0.47940493", "0.47757858", "0.47717166", "0.47684586", "0.4762464", "0.47548106", "0.47522318", "0.47514325", "0.4740826", "0.4740826", "0.47407395", "0.4736858", "0.4732128", "0.47215575", "0.46883872", "0.46842727", "0.46835035", "0.46822768", "0.46730176", "0.46714485", "0.46714047", "0.46639025", "0.46624103", "0.46438578", "0.46400777", "0.4639137", "0.4636964", "0.46332613", "0.4632371", "0.46312353", "0.46290284", "0.46209553", "0.4615008", "0.4607306", "0.46060616", "0.46018264", "0.45948952", "0.45927617", "0.45911795", "0.458992", "0.45887873", "0.45884103", "0.4569908", "0.45641872", "0.45583665", "0.45536676", "0.45504653", "0.45453215", "0.45450428" ]
0.6839619
0
Converts account to a Struct::Account and sets it.
def account=(account) @account = account ? Struct::Account.new(account) : account end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account=(val)\n @account = val\n @base.accountRef = val.ref\n end", "def account=(value)\n @account = value\n end", "def account= val\n @account = val\n self.source_account = val.address\n end", "def set_account\n @account = current_user.accounts.find(current_account.id)\n end", "def set_account\n @account = current_user.accounts.find(current_account.id)\n end", "def assign_account(account_id)\n self.account_id = account_id\n end", "def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end", "def set_account\n @account = Account.find(params[:account_id])\n end", "def set_account\n @account = current_user\n end", "def setaccount(coinaddress, account)\n coind.setaccount coinaddress, account\n end", "def set_account\n @account = Directory::Account.find(params[:id])\n end", "def set_account(id)\n @account = Account.find(id)\n end", "def set_account\n Finance::Account.create.save\n @account = Finance::Account.first\n end", "def account=(attributes)\n @account = FakeBsmobil::Generator.full_account.merge(attributes)\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.by_id(params[:id])\n end", "def set_account\n @account = current_user.accounts.find(params[:account_id])\n end", "def set_account\n @account = current_user.accounts.find(params[:id])\n end", "def setaccount(bitcoinaddress, account)\n @api.request 'setaccount', bitcoinaddress, account\n end", "def copy_account_to_user(account)\n return account if account.current_user.nil?\n\n account.current_user.phone_number = account.contact_number\n account.current_user.email_address = account.email_address\n account.current_user.email_address_confirmation = account.email_address_confirmation\n account\n end", "def account=(str)\n @account = str.strip.gsub('acct:','').to_s.downcase\n end", "def account\n @account = current_account_settings\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def setaccount(namecoin_address, account)\n request :setaccount, namecoin_address, account\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = Account.find(params[:id])\n end", "def set_account\n @account = current_user.accounts.find(params[:id])\n end", "def user_account=(value)\n @user_account = value\n end", "def current_account=(account)\n set_session(account)\n @current_user = account_user_mapper.account_to_user(account)\n @current_account = account\n end", "def set_account\n @accounts = Account.find(params[:id])\n end", "def set_account\n @account = Account.find params[:id]\n end", "def set_owner(account)\n unless org = account.organization\n errors.add(:account, \"must have an organization\") and return false\n end\n update_attributes(:account_id => account.id, :organization_id => org.id)\n sql = \"account_id = #{account.id}, organization_id = #{org.id}\"\n self.pages.update_all( sql )\n self.entities.update_all( sql )\n self.entity_dates.update_all( sql )\n end", "def change_account(new_account)\n @current_account = new_account\n end", "def account\n @account ||= Account.find(accountRef)\n end", "def set_account\n account = Account.find(params[:id])\n redirect_to(accounts_url) unless current_user.admin? || account.sales_associate == current_user\n @account = account\n end", "def src_account=(account)\n raise InvalidType.new(MailAccount, account.class) unless account.is_a?(MailAccount)\n @src_account = account\n end", "def new_account=(account)\n @new_account = self.account_ids.include?(account.id) ? nil : account\n end", "def set_account\n @account = Account.find(params[:id])\n # authorize @accounts\n end", "def set_user_account\n @user_account = UserAccount.find(params[:id])\n end", "def set_user_account\n @user_account = UserAccount.find(params[:id])\n end", "def set_employee_acct\n #@employee_acct = current_account.meta\n end", "def set_account_user\n @account_user = ::User.in_account(current_user.account.id).find(params[:id])\n end", "def account(account_name)\n Bitbank::Account.new(self, account_name, nil, true)\n end", "def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end", "def set_a_account\n @a_account = AAccount.find(params[:id])\n end", "def set_account_user\n @account_user = AccountUser.find(params[:id])\n end" ]
[ "0.7619571", "0.7449623", "0.7309978", "0.7229922", "0.7229922", "0.69726574", "0.6969836", "0.69493276", "0.6892448", "0.68204236", "0.67833364", "0.6741396", "0.6741261", "0.67404133", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6725098", "0.6716792", "0.6678921", "0.6674108", "0.6643428", "0.6626487", "0.6559312", "0.65489495", "0.65412384", "0.6522601", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.65221334", "0.64352417", "0.6389174", "0.637857", "0.6374927", "0.6343398", "0.63424647", "0.63341004", "0.6302644", "0.6289962", "0.6285819", "0.6248144", "0.6228971", "0.6221288", "0.6189562", "0.61854947", "0.6172889", "0.616922", "0.61419463", "0.6116808", "0.6090908" ]
0.84498876
0
Converts user to a Struct::User and sets it.
def user=(user) @user = user ? Struct::User.new(user) : user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user\n @user = User.find(user_id)\n end", "def user=(user)\n check_user(user)\n set_user(user)\n # returns user\n end", "def user=(value)\n @user = value\n end", "def user=(value)\n @user = value\n end", "def user=(usr)\n raise 'You must pass a User class' unless usr.is_a?(User)\n @user = usr\n end", "def set_user(user)\n @user = user\n end", "def set_user(user)\n @user = user\n end", "def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend", "def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end", "def user=(user)\n self.email = user.email\n self.name = user.name\n end", "def set_user_user\n @user_user = User::User.find(params[:id])\n end", "def set_user\n @user = User.find(current_user)\n end", "def set_user\n @user = User.find(current_user)\n end", "def set_user\n @form_user = User.new(:email => self.user_email, :first_name => self.user_first_name,\n :last_name => self.user_last_name)\n @user = User.where(:email => self.user_email).first\n @new_user = false\n if @user.nil?\n @new_user = true\n @user = @form_user\n end\n end", "def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end", "def set_user\n id = params[:id] ? params[:id] : params[:user_id]\n @user = User.find(id)\n end", "def set(user_obj)\n # example code to set it\n # You could also set in DB i.e User.find(id).update_attributes(user_id: user_obj[:userId], settings: user_obj)\n @@user_storage[user_obj[:userId]] = user_obj\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def set_user(v)\n set_userinfo(v, @password)\n v\n end", "def set_user\n @user = User.find(user_params)\n end", "def set_user\n @user = User.find(user_params)\n end", "def user=(user)\n also_save = self.persisted? && !self.changed?\n self.user_uid = user.uid\n @_user = user\n self.save if also_save\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n user = params[:id].present? ? User.find(params[:id]) : User.new\n @user = UserPresenter.new(user, view_context)\n end", "def set_user\n @user = User.find(params[:id]) if params[:id].present?\n return if @user.present?\n @user = user\n end", "def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end", "def user=(the_user)\n authentication.user = the_user\n end", "def set_user\n \t@user = User.new\n end", "def set_user\n @user = User.find(params[:user][:id])\n end", "def set_user\n @user = @current_user\n end", "def set_user\n @user = User.find(params[:user_name])\n end", "def set_user\n @user = nil\n @user = User.find(params[:user_id]) if !params[:user_id].nil?\n end", "def set_user\n @user = User.find(params[:id]) || User.find(params[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def set_user\n @user = User.find(params[:user_id])\n end", "def user=(_user)\n self.user_id = _user.id\n\n _user\n end", "def user=(user)\n self.update_attributes(:user_id => user.id)\n end", "def set_user\n @user\n # @user = User.find(params[:id])\n end", "def set_user!(user)\n\t\tself.user_id = user.id\n\t\tself.save!\n\tend", "def set_user\n @user = User.find(params[:id])\n @user.initialize_users(@user)\n end", "def set_user\n @user = User.find(params[:id]).decorate\n\n end", "def set_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def set_user\n @user = User.find_by_token!(params[:id])\n end", "def set_user\n if session[:user_id].nil?\n @user = nil\n else\n @user = User.find(session[:user_id])\n end\n end", "def set_user\n @user = params[:id] ? User.find(params[:id]) : User.new(user_params)\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n\t\t\t@user = User.find(params[:id])\n\t\tend", "def set_user\n @user = User.find_by(name: params[:name]) || current_user\n end", "def set_user\n @user = if params[:user_id].nil?\n User.find(params[:id])\n else\n User.find(params[:user_id])\n end\n end", "def set_user\n @user ||= User.find(params[:user_id])\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def user(value = nil)\n value ? @user = value : @user\n end", "def set_user\n @user = current_user \n end", "def set_user\r\n @user = current_user\r\n end", "def set_user; end", "def set_user\n @user = User.find(params[:user_id])\n if @user.blank?\n res_not_found(:user)\n end\n end", "def set_user\n @user = User.find(params[:id])\n\t \n end", "def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end" ]
[ "0.7312901", "0.72290397", "0.72104454", "0.72104454", "0.71981764", "0.71824837", "0.71824837", "0.70357496", "0.7028903", "0.70286804", "0.69824094", "0.6982281", "0.6982281", "0.6965168", "0.69562954", "0.6934402", "0.6932778", "0.6912967", "0.6912967", "0.6911703", "0.6908344", "0.6908344", "0.690292", "0.68772036", "0.68772036", "0.68772036", "0.68772036", "0.68772036", "0.6872343", "0.6870263", "0.68633425", "0.685289", "0.6836415", "0.68234706", "0.68075335", "0.68034583", "0.67983216", "0.67904925", "0.6779954", "0.6779954", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.67703927", "0.6755459", "0.6747561", "0.6747309", "0.67413735", "0.67376035", "0.6722657", "0.67116004", "0.6693812", "0.66886115", "0.6677626", "0.6659229", "0.6657894", "0.6657894", "0.6657894", "0.66511697", "0.6648498", "0.6648147", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.6645726", "0.664422", "0.66411", "0.6640256", "0.66383374", "0.6632693", "0.66309875", "0.66297454", "0.6629325" ]
0.82027197
0
used for industry header
def name title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def industry; end", "def header_style(header); end", "def header; end", "def header; end", "def header; end", "def header_build\n header = \"customer name\" + @delimiter + \"gender\" + @delimiter\n header += \"age\" + @delimiter + \"birthday\" + @delimiter + \"cpf\" + @delimiter + \"id\" + @delimiter\n header += \"state\" + @delimiter + \"city\" + @delimiter + \"street\" + @delimiter + \"zip_code\" + @delimiter\n header += \"company name\" + @delimiter + \"industry\" + @delimiter + \"cnpj\"\n header\nend", "def arrange_representative_header header\n head={\"FIRST NAME\" => \"first_name\",\n \"LAST NAME\" => \"last_name\",\n \"EMAIL\" => \"email\",\n \"UIN\" => \"uin\",\n \"FULL ACADEMIC UNIT NAME\" => \"academic_unit_name\",\n \"COLLEGE\" => \"college\"\n }\n arranged_header=[]\n header.each do |k|\n arranged_header.push head[k]\n end\n return arranged_header\n end", "def product_header(product)\r\n product.product_name\r\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end", "def getHeader() @header1 end", "def sector_industry_label\n sector_name = industry.try(:sector).try(:name)\n industry_name = industry.try(:name)\n return \"\" unless industry_name && sector_name\n \"#{sector_name} / #{industry_name}\"\n end", "def header(format, ntrks, division)\n end", "def functional_group_header\n gs_elements = []\n gs_elements << 'GS'\n gs_elements << 'HP'\n gs_elements << payer_id \n gs_elements << '1000000'\n gs_elements << Time.now().strftime(\"%Y%m%d\") \n gs_elements << Time.now().strftime(\"%H%M\")\n gs_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record) \n gs_elements << 'X'\n gs_elements << ((!@output_version || @output_version == '4010') ? '004010X091A1' : '005010X221A1')\n gs_elements.join(@element_seperator)\n end", "def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @header=@header.flatten\n end", "def rations_headers\n [['#', 'Title', 'Price', 'Quantity', 'Full Price']]\n end", "def industry_group\n IndustryGroup.find_by(business_product: @business_product,\n business_type: @business_type,\n sic_code: @company_info.industry_code.to_s[0..2]).industry\n end", "def build_header\n header = [\n :county,\n :vtdname,\n :vtd,\n :fips,\n :area,\n :population,\n :id,\n :geosha,\n :fuzzy_boundary\n ]\n legend.dig(\"races\", \"elections\").each do |election_id, election_name|\n election = Election.find_by(name: election_name)\n election.offices.each do |office|\n race = \"#{election_name} #{office}\"\n header << \"#{race} District\" if office =~ /House|Senate/\n header << headers_for_race(race)\n end\n end\n header.flatten\n end", "def vendor\n @header.vendor\n end", "def header\n end", "def get_header(ins_company)\n header = ins_company.name + \"\\n\"\n header += !ins_company.insurance_co_id.blank? ? (ins_company.insurance_co_id + \"\\n\") : \"\"\n header += ins_company.address1 + \"\\n\"\n header += !ins_company.address2.blank? ? (ins_company.address2 + \"\\n\") : \"\"\n header += ins_company.city + \", \" + ins_company.state + \" \" + ins_company.zip\n text_box header, :at => [355,732], :height => 100, :width => 100\n end", "def industry\n fetch('company.industry')\n end", "def header article\r\n\t\t\"{ \\\"HS\\\":{\"\r\n\tend", "def header\n\t\tleft = bounds.left - 40\n right = bounds.right + 40\n full_width = bounds.width + 80\n bounding_box [left, bounds.top + 35], width: full_width, height: 60 do \n font \"Helvetica\"\n fill_color \"000000\"\n text @wo.requester.facility.name, align: :center, size: 20, style: :bold\n fill_color \"555555\"\n text \"Work Order \" + @wo.id.to_s, align: :center, size: 14, inline_format: :true, style: :bold\n\t\tend\n end", "def write_header() \n @builder.head do\n @builder.title('OmniFocus OPML Export')\n @builder.dateCreated(Time.now.httpdate)\n @builder.dateModified(Time.now.httpdate)\n# TODO @builder.ownerName(\"\")\n# TODO @builder.ownerEmail('example@example.com')\n end\n end", "def header_format; self.underline end", "def getAccountingRuleHeaderObjName\r\n\t\t\treturn \"mfiforce__Accounting_Rule_Header__c\"\r\n\t\tend", "def build_pdf_header(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def print_header\n \"#{\"Sl.\"} #{\"Description\".ljust(20)} #{\"Created time\".ljust(10)} #{\"Due by\".ljust(10)} #{\"Status\"}\"\n end", "def build_header \n pdf_writer.margins_in(1)\n if timespan == \"Weekly\"\n add_text \"Status Report for the Week of \" + Time.now.to_formatted_s(:date)\n else\n add_text \"Status Report for \" + Time.now.to_formatted_s(:date)\n end\n end", "def get_secondary_header\n text_box \"Secondary Insurance\", :at => [205, 752]\n end", "def header=(_arg0); end", "def normalize_header!\n @gsi.dsc = HeaderOption::DSC::TELETEXT_LEVEL_2\n @gsi.lc = @gsi.lc.to_i.to_s.rjust(2,'0')\n @gsi.tnb = @gsi.tnb.to_i.to_s.rjust(5,'0')\n @gsi.tns = @gsi.tns.to_i.to_s.rjust(5,'0')\n @gsi.tng = @gsi.tng.to_i.to_s.rjust(3,'0')\n @gsi.tcp = @gsi.tcp[0..1].to_i.to_s.ljust(2,'0') + \n @gsi.tcp[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcp[6..7].to_i.to_s.ljust(2,'0')\n @gsi.tcf = @gsi.tcf[0..1].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[2..3].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[4..5].to_i.to_s.ljust(2,'0') +\n @gsi.tcf[6..7].to_i.to_s.ljust(2,'0')\n @gsi.co = @gsi.co.upcase\n end", "def context_type_individual_category_header\n ContextTypeDef.new(\n :individual_category_header,\n [\n /\\s*(MASTER|M)\\s([23456789][50])\\s(maschi|femmi)/i,\n /\\s*(RI)\\s*((\\d{1,2}'\\d{2}.|\\d{2}.)\\d{2})/i\n ],\n :event_summary_header\n )\n end", "def email_update_header\n col = 18\n hdr = \"------------------------------------------------------------------------\\n\" +\n 'Design : '.rjust(col) + self.oi_instruction.design.directory_name + \"\\n\" +\n 'Category : '.rjust(col) + self.oi_instruction.oi_category_section.oi_category.name + \"\\n\" +\n 'Step : '.rjust(col) + self.oi_instruction.oi_category_section.name + \"\\n\" +\n 'Team Lead : '.rjust(col) + self.oi_instruction.user.name + \"\\n\" +\n 'Designer : '.rjust(col) + self.user.name + \"\\n\" +\n 'Date Assigned : '.rjust(col) + self.created_on.format_dd_mon_yy('timestamp') + \"\\n\" +\n 'Complete : '.rjust(col)\n if self.complete?\n hdr += \"Yes\\n\" +\n 'Completed On : '.rjust(col) + self.completed_on.format_dd_mon_yy('timestamp') + \"\\n\"\n else\n hdr += \"No\\n\"\n end\n\n if self.oi_instruction.oi_category_section.urls.size > 0\n label = true\n self.oi_instruction.oi_category_section.urls.each do |url|\n \n if label\n hdr += 'References : '.rjust(col)\n label = false\n else\n hdr += ' : '.rjust(col)\n end\n \n if url[:text] != ''\n hdr += url[:text] + \"\\n\" + ' : '.rjust(col) + url[:url] + \"\\n\"\n else\n hdr += url[:url] + \"\\n\"\n end\n \n end\n end\n\n hdr += \"------------------------------------------------------------------------\\n\"\n\n \n hdr\n \n end", "def thorins_company; end", "def generate_header_item(item)\n item\n end", "def section_header\n \n unless self.article_section.nil?\n return self.article_section.article_section_name\n else\n return \"\"\n end\n \n end", "def build_group_header \n pad(10) do\n add_text(data.name, :font_size => 14, :justification => :center) \n add_text(data.data.first.get(\"Address\"), :font_size => 12, :justification => :center)\n end\n data.remove_column(\"Address\") \n end", "def generate_header(provider = nil)\n cda_header = { identifier: { root: 'CypressRoot', extension: 'CypressExtension' },\n authors: [{ ids: [{ root: 'authorRoot', extension: 'authorExtension' }],\n device: { name: 'deviceName', model: 'deviceModel' },\n addresses: [], telecoms: [], time: nil,\n organization: { ids: [{ root: 'authorsOrganizationRoot', extension: 'authorsOrganizationExt' }], name: '' } }],\n custodian: { ids: [{ root: 'custodianRoot', extension: 'custodianExt' }],\n person: { given: '', family: '' }, organization: { ids: [{ root: 'custodianOrganizationRoot',\n extension: 'custodianOrganizationExt' }], name: '' } },\n legal_authenticator: { ids: [{ root: 'legalAuthenticatorRoot', extension: 'legalAuthenticatorExt' }], addresses: [],\n telecoms: [], time: nil,\n person: { given: nil, family: nil },\n organization: { ids: [{ root: 'legalAuthenticatorOrgRoot', extension: 'legalAuthenticatorOrgExt' }],\n name: '' } } }\n\n header = Qrda::Header.new(cda_header)\n\n header.identifier.root = UUID.generate\n header.authors.each { |a| a.time = Time.current }\n header.legal_authenticator.time = Time.current\n header.performers << provider\n\n header\n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 15\n pdf \n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 15\n pdf \n end", "def build_pdf_header2(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def build_pdf_header3(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def print_layout_header_list_items\n [{ code: :tare_reference },\n { code: :case_reference, placeholder: '<%CASE_REFERENCE%>' },\n { code: :version },\n { code: :reason, lookup: true, when: :pre_claim?, is: [false] },\n { code: :claim_desc, when: :reason, is: ['OTHER'] }]\n end", "def header_text\n @attributes[:header_text]\n end", "def site_header\n @attributes[:site_header]\n end", "def headers(spec)\n {\n :charge => charge,\n :parent_ion_mass => spec.parent_ion_mass(charge),\n :title => \"#{spec.sequence.gsub(/\\s+/, \"\")} (#{series.join(', ')})\"\n }\n end", "def company_code\n if self.yard.present? && self.yard.facility.present? && self.yard.facility.country.present?\n country = self.yard.facility.country\n \"COPART#{country.code}\".upcase\n else\n \"\"\n end\n end", "def interchange_control_header\n ['ISA', '00', (' ' * 10), '00', (' ' * 10), 'ZZ', payer_id.to_s.justify(15),\n 'ZZ', isa_08, Time.now().strftime(\"%y%m%d\"), Time.now().strftime(\"%H%M\"),\n ((!@output_version || @output_version == '4010') ? 'U' : '^'),\n ((!@output_version || @output_version == '4010') ? '00401' : '00501'),\n (@isa_record.isa_number.to_s.justify(9, '0') if @isa_record), '0', 'P', ':'].join(@element_seperator)\n end", "def subcontract_category; end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def build_pdf_header_rpt16(pdf)\n pdf.font \"Helvetica\" , :size => 6\n \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def industry_group\n industry_group_by_sic = get_industry_group(@sic_first)\n industry_group_missing =\n get_industry_group('missing')\n if industry_group_by_sic\n industry_group_by_sic.industry\n else\n industry_group_missing.industry\n end\n end", "def industry_group\n industry_group_by_sic = get_industry_group(@sic_first)\n industry_group_missing =\n get_industry_group('missing')\n if industry_group_by_sic\n industry_group_by_sic.industry\n else\n industry_group_missing.industry\n end\n end", "def store_special_offers_header\n $tracer.trace(__method__)\n return ToolTag.new(h2.className(create_ats_regex_string(\"ats-storespecialoffers\")), __method__)\n # return ToolTag.new(div.className(\"/col-1/\").h2, __method__)\n end", "def build_pdf_header4(pdf)\n pdf.font \"Helvetica\" , :size => 8\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers.length >= row ? client_data_headers[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers.length >= row ? invoice_headers[rows_index] : ['',''])\n end\n\n if rows.present?\n\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n\n\n pdf.move_down 25\n pdf \n end", "def is_header()\n\t\tend", "def header article\r\n\t\tarticle.attributes.keys.join(', ')\r\n\tend", "def getSecondHeader() @header2 end", "def draw_header\n draw_text(0,0, contents.width, line_height, Vocab::ITEM_EQUIP, Bitmap::ALIGN_CENTER)\n end", "def build_pdf_header4(pdf)\n pdf.font \"Helvetica\" , :size => 8\n\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n pdf.text \"FORMATO 13.1: REGISTRO DE INVENTARIO PERMANENTE VALORIZADO - DETALLE DEL INVENTARIO VALORIZADO \"\n pdf.text \"PERIODO : \" +@fecha1.to_s+ \" Hasta: \"+@fecha2.to_s , :size => 11 \n pdf.text \"RUC : 20555691263 \" \n pdf.text \"APELLIDOS Y NOMBRES, DENOMINACION O RAZON SOCIAL : GRUPO E & E S.A.C. \"\n pdf.text \"ESTABLECIMIENTO : ALMACEN\"\n\n pdf \n end", "def create_header(meta_data)\n station = meta_data.station\n start_date = meta_data.start_date\n @header = I18n.t(\"forecast_text.main.header_start\")\n @header.concat(station.name)\n @header.concat(I18n.t(\"forecast_text.main.header_conn\"))\n @header.concat(start_date.to_s)\n nil\n end", "def header_style\n @header_style ||= { :bg_color => '00', :fg_color => 'FF', :sz => 12, :alignment => { :horizontal => :center } }\n end", "def license\n @header.license\n end", "def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend", "def header_for_title\n output = \"-\" * @title.length\n end", "def parse_setext_header; end", "def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend", "def plugin_timesheet_views_timesheet_group_header(context = {})\n return \"<th width='8%'>#{l(:billing_invoice_title)}</th>\"\n end", "def print_layout_header\n { code: :claim_reason, # section code\n key: :title, # key for the title translation\n key_scope: %i[claim claim_payments claim_reason], # scope for the title translation\n divider: true, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: print_layout_header_list_items }\n end", "def header(_content)\n raise NotImplementedError\n end", "def generate_header(provider = nil)\n header = Qrda::Header.new(@@cda_header)\n\n header.identifier.root = UUID.generate\n header.authors.each {|a| a.time = Time.now}\n header.legal_authenticator.time = Time.now\n header.performers << provider\n\n header\n end", "def actual_header\n data.lines.first.chomp\n end", "def header\n @header ||= create_header\n end", "def header\n \"*#{super}*\"\n end", "def format_header(header, close: ':', upcase: true)\n header.squish!\n header[0] = header[0].upcase if upcase\n header += close\nend", "def header_code\n code = ''\n code << \"'<thead><tr>\"\n if table.selectable?\n code << '<th class=\"list-selector\"><input type=\"checkbox\" data-list-selector=\"all\" /></th>'\n disclaimer = '<tr class=\"selected-count\" style=\"display: none;\"><th colspan=\"1000\">\\'+ \"list.selected\".t + \\'</th></tr>'\n end\n table.columns.each do |column|\n next if column.is_a?(ActiveList::Definition::ActionColumn) && !column.use_single?\n code << \"<th data-list-column=\\\"#{column.options[:icon_name] || column.sort_id}\\\"\"\n code << \" data-list-column-cells=\\\"#{column.short_id}\\\"\"\n code << \" data-list-column-sort=\\\"'+(#{var_name(:params)}[:sort] != '#{column.sort_id}' ? 'asc' : #{var_name(:params)}[:dir] == 'asc' ? 'desc' : 'asc')+'\\\"\" if column.sortable?\n code << \" data-list-column-computation=\\\"#{column.computation_method}\\\"\" if column.computable?\n if table.selectable? && column.is_a?(ActiveList::Definition::DataColumn) && (column.options[:currency] || column.computable?)\n unit = \"''\"\n precision = \"''\"\n if column.options[:currency]\n unit = \"Nomen::Currency.find(#{column.currency_for(generator.records_variable_name + '.first').inspect} || 'EUR').symbol.to_s\"\n precision = \"Nomen::Currency.find(#{column.currency_for(generator.records_variable_name + '.first').inspect} || 'EUR').precision.to_s\"\n elsif column.computable?\n unit = \"#{generator.records_variable_name}.first.#{column.value_method}.symbol\"\n precision = \"'2'\"\n end\n code << \" data-list-column-unit-symbol=\\\"' + (#{generator.records_variable_name}.any? ? #{unit} : '') + '\\\"\"\n code << \" data-list-column-unit-precision=\\\"' + (#{generator.records_variable_name}.any? ? #{precision} : '') + '\\\"\"\n end\n code << \" class=\\\"#{column_classes(column, true, true)}\\\"\"\n code << '>'\n code << \"' + h(#{column.header_code}) + '\"\n code << '<i></i>'\n code << '</th>'\n end\n # code << \"<th class=\\\"spe\\\">#{menu_code}</th>\"\n code << '</tr>'\n code << (disclaimer || '')\n code << \"</thead>'\"\n code\n end", "def build_pdf_header9(pdf)\n pdf.font \"Helvetica\" , :size => 6 \n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.zone.now.to_s\n\n max_rows = [client_data_headers.length, invoice_headers.length, 0].max\n rows = []\n (1..max_rows).each do |row|\n rows_index = row - 1\n rows[rows_index] = []\n rows[rows_index] += (client_data_headers_rpt.length >= row ? client_data_headers_rpt[rows_index] : ['',''])\n rows[rows_index] += (invoice_headers_rpt.length >= row ? invoice_headers_rpt[rows_index] : ['',''])\n end\n\n if rows.present?\n pdf.table(rows, {\n :position => :center,\n :cell_style => {:border_width => 0},\n :width => pdf.bounds.width\n }) do\n columns([0, 2]).font_style = :bold\n\n end\n\n pdf.move_down 10\n\n end\n \n pdf \n end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def header_posicao_047_a_076\n\t\t\t\t\t''.adjust_size_to(30)\n\t\t\t\tend", "def context_type_category_header\n ContextTypeDef.new(\n :category_header,\n [\n /^\\s*(\\r\\n|\\n|$|\\Z|Torna a inizio pagina)/i, # matches any kind of newline, an empty line or a line with only invisible chars\n /(?<!\\dx)(50\\s|100\\s|200\\s|400\\s|800\\s|1500\\s) *(stile|misti|dorso|rana|farf|SL|DO|RA|FA|MI|MX|DF|DS|RN).*(maschi|femmi)/i,\n /\\s*-{10}-*/\n ]\n )\n end", "def role_header_text\n case @role\n when TECH\n 'Your Lab Technician Timesheets'\n when CHK_OUT\n 'Your Equipment Checkout Timesheets'\n when TA_GRADER\n 'Your Lab TA/Grader Timesheets'\n end\n end", "def header_color\n :red_on_black\n end", "def header_items\n [:datetime, :team]\n end", "def registration_and_operator_headers\n if partnership?\n partnership_headers(organisation)\n else\n @headers ||= I18n.t(\"admin.enrollment_exemptions.show.main.registration_and_operator.headers\").to_a\n end\n end", "def company_name\n self.well_info.company_name\n end", "def recip_heading\n\t\tidentity.name.titleize.pluralize\n\tend", "def unmappable_complex_headers\n [\n \"COVID-19 (Disease)--Complications\",\n \"COVID-19 (Disease)--Testing\",\n \"COVID-19 (Disease)--Treatment\",\n \"Feinberg School of Medicine--Buildings\",\n \"Illinois--History\",\n \"Illinois--Northern\"\n ]\n end", "def lecturer_header(fullname, gender, language, sheets)\n h = abstract_form.lecturer_header\n # if the desired lang/gender isn't available, try english/neutral\n # next. If that fails as well, take whatever comes first.\n h = h[language] || h[:en] || h.first[1]\n h = h[gender] || h[:both] || h.first[1]\n h.gsub(/#1/, fullname).gsub(/#2/, sheets.to_s)\n end", "def build_header_footer( interchange_name )\n\n header = <<-HEADER\n<?xml version=\"1.0\"?>\n<Interchange#{interchange_name} xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://ed-fi.org/0100\"\nxsi:schemaLocation=\"http://ed-fi.org/0100 ../../sli/edfi-schema/src/main/resources/edfiXsd-SLI/SLI-Interchange-#{interchange_name}.xsd\">\nHEADER\n\n footer = \"</Interchange#{interchange_name}>\"\n\n return header, footer\nend" ]
[ "0.7279813", "0.63672966", "0.62308156", "0.62308156", "0.62308156", "0.6222337", "0.62171245", "0.6211658", "0.6193455", "0.61454743", "0.61344755", "0.6118997", "0.61154854", "0.6097585", "0.60963506", "0.6076977", "0.6048664", "0.60416675", "0.6034486", "0.60245526", "0.6012318", "0.6008805", "0.5964994", "0.59447587", "0.5943608", "0.5938979", "0.5880472", "0.5848689", "0.584659", "0.5843491", "0.5825226", "0.5794291", "0.5785799", "0.5778878", "0.5777459", "0.5768421", "0.57642674", "0.5761423", "0.5748635", "0.5744509", "0.5743142", "0.5743142", "0.57419586", "0.5734995", "0.5714801", "0.57122225", "0.5708761", "0.5698925", "0.5692882", "0.56913507", "0.5685174", "0.5683797", "0.5682133", "0.5682133", "0.5681892", "0.5681892", "0.5679043", "0.56774557", "0.56767845", "0.5674733", "0.5668884", "0.56664413", "0.5663318", "0.5662719", "0.5641144", "0.563304", "0.56276876", "0.56197065", "0.56127566", "0.5605621", "0.560269", "0.5599847", "0.5598135", "0.5590442", "0.5585976", "0.5585346", "0.557906", "0.55780417", "0.5574717", "0.55674106", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.5563345", "0.55629325", "0.5558455", "0.55543125", "0.55541617", "0.55453926", "0.5538773", "0.55284876", "0.5527838", "0.552677", "0.5524809", "0.5522418" ]
0.0
-1
Save a certificate to a file. Remove all the content in the file if there is any before.
def load_x509_cert(cert_file, key_store) input_stream = java.io.BufferedInputStream.new(java.io.FileInputStream.new(cert_file)) cert_factory = java.security.cert.CertificateFactory.get_instance('X.509') cert_count = 0 #The file might contain multiple certs while input_stream.available > 0 begin cert = cert_factory.generate_certificate(input_stream) cert_count = cert_count + 1 # load_x509_cert(cert, 'neo4j.javadriver.trustedcert.', cert_count, key_store) rescue java.security.cert.CertificateException => e # This happens if there is whitespace at the end of the certificate - we load one cert, and then try and load a # second cert, at which point we fail return if !e.get_cause.nil? && e.get_cause.get_message == 'Empty input' raise java.io.IOException.new("Failed to load certificate from `#{cert_file.get_absolute_path}`: #{cert_count} : #{e.get_message}", e) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync\n @certificates.each do |certificate|\n certificate_path = File.join(@path, \"#{certificate.serial_number}.crt\")\n unless File.exist?(certificate_path)\n certificate.write_to(certificate_path)\n end\n end\n end", "def cert_file\n write_file(\"request-#{domain}.crt\", cert.to_pem)\n end", "def save_certificate(certificate)\n if !ENV['DYNO'].nil?\n Rails.logger.info('You are running this script on Heroku, please copy-paste certificates to your local machine')\n Rails.logger.info('and then follow https://devcenter.heroku.com/articles/ssl-endpoint guide:')\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-cert.pem ======\")\n puts certificate.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-key.pem ======\")\n puts certificate.request.private_key.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-chain.pem ======\")\n puts certificate.chain_to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-fullchain.pem ======\")\n puts certificate.fullchain_to_pem\n\n elsif File.directory?(File.join(Rails.root, CONFIG[:output_cert_dir]))\n Rails.logger.info('Saving certificates and key...')\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-cert.pem\"), certificate.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-key.pem\"), certificate.request.private_key.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-chain.pem\"), certificate.chain_to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-fullchain.pem\"), certificate.fullchain_to_pem)\n else\n Rails.logger.error(\"Output directory: '#{File.join(Rails.root, CONFIG[:output_cert_dir])}' does not exist!\")\n end\n end", "def client_cert_save(cert)\n # Get the cert path from the directory and name\n # Save the new cert in the certs directory on the client server\n write_file(resource[:cert_dir], resource[:cert_name],\n cert['data']['certificate'])\n\n # Get the private key path from the directory and name\n # Save the new private key in the tls directory on the client\n write_file(resource[:priv_key_dir], resource[:priv_key_name],\n cert['data']['private_key'])\n\n # NOTE: we specifically do NOT handle file owners + modes in here\n # if you need that functionality, please use the vault::cert resource\n end", "def make_ssl_cert_file(cert_file)\n\n uri = URI(@cert_source_uri)\n\n Net::HTTP.start(uri.host) { |http|\n resp = http.get(uri.path)\n open(cert_file, \"w\") { |file|\n file.write(resp.body)\n }\n }\n end", "def client_cert_save(cert)\n # Get the cert path from the directory and name\n cert_name = resource[:cert_name]\n cert_dir = resource[:new_cert_dir]\n # Save the new cert in the certs directory on the client server\n cert_path = File.join(cert_dir, cert_name)\n File.open(cert_path, 'w') do |f|\n f.write(cert['data']['certificate'])\n end\n\n # Get the private key path from the directory and name\n key_name = resource[:priv_key_name]\n key_dir = resource[:new_priv_key_dir]\n # Save the new private key in the tls directory on the client\n key_path = File.join(key_dir, key_name)\n File.open(key_path, 'w') do |f|\n f.write(cert['data']['private_key'])\n end\n\n # Change the owner and group of the newly created cert and key\n FileUtils.chown resource[:owner], resource[:group], [cert_path, key_path]\n end", "def ca_file\n return unless @ca_certs\n @ca_file ||= Tempfile.new('ca_file').tap do |tempfile|\n tempfile.write(@ca_certs)\n tempfile.close\n end\n end", "def client_cert_save(cert, priv_key)\n Puppet.debug('saving cert')\n key = OpenSSL::PKey.read(priv_key)\n x509_cert = OpenSSL::X509::Certificate.new(cert)\n name = resource[:cert_name]\n # PKCS12 private keys must be at least 4 characaters\n if resource[:priv_key_password] && resource[:priv_key_password].size >= 4\n password = resource[:priv_key_password]\n else\n # PKCS12 private keys require a password, so generate a random 16 character one\n Puppet.debug(\"vault_cert[#{resource[:cert_name]}] was either not given a private key password or it was less than 4 characters, automatically generating a private key password for you\")\n require 'securerandom'\n password = SecureRandom.alphanumeric(16)\n end\n pkcs12 = OpenSSL::PKCS12.create(password, name, key, x509_cert)\n pkcs12_der = pkcs12.to_der\n\n Puppet.debug(\"cert data: #{cert}\")\n\n file = Tempfile.new(resource[:cert_name])\n begin\n file.binmode\n file.write(pkcs12_der)\n # have to close file before Import-PfxCertificate can open it\n file.close\n\n cmd = <<-EOF\n $password = ConvertTo-SecureString -String '#{password}' -Force -AsPlainText\n Import-PfxCertificate -FilePath '#{file.path}' -CertStoreLocation '#{resource[:cert_dir]}' -Password $password\n EOF\n res = ps(cmd)\n Puppet.debug(\"Imported cert exitcode: #{res[:exitcode]} \")\n Puppet.debug(\"Imported cert stdout: #{res[:stdout]} \")\n Puppet.debug(\"Imported cert stderr: #{res[:stderr]} \")\n ensure\n file.close\n file.unlink\n end\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def delete(certificate_thumbprint)\n cert_delete(certstore_handler, certificate_thumbprint)\n end", "def cleanup_certificates(options)\n puts 'Cleaning up certificates...' if options[:verbose]\n AgentConfig.certs_files(\"*.{cert,key}\").each { |f| FileUtils.rm_f(f) } # requires that root_dir already known in AgentConfig\n end", "def close\n close_cert_store\n remove_finalizer\n end", "def save(domain, pair)\n crt = File.expand_path(\"#{domain}.crt\", dir)\n key = File.expand_path(\"#{domain}.key\", dir)\n File.open(crt, 'w') {|f| f.write(pair.cert) }\n File.open(key, 'w') {|f| f.write(pair.key) }\n [crt, key]\n end", "def save(file = '.cookies')\n File.write(file, to_a.to_yaml)\n end", "def certificate_file\n super\n end", "def move_existing_certificates\n Dir.glob(File.join(@omnibus_certs_dir, \"*\")) do |file|\n next if !valid?(file) || whitelisted?(file)\n\n if is_x509_certificate?(file)\n move_certificate(file)\n else\n raise_msg(file)\n end\n end\n end", "def certificate=(certificate); end", "def write_der(filename_or_io)\n write_data(filename_or_io, @cert.to_der)\n end", "def save_as(file, flatten = false)\n File.open(file, 'wb') { |f| f.write finalize flatten and f.close }\n end", "def write_pem(filename_or_io)\n write_data(filename_or_io, @cert.to_pem)\n end", "def remove_cert(cert={})\n request :delete, '/certs', cert\n end", "def force_to_file\n if @data && ! (@file && File.exist?(@file.to_s))\n fh = Tempfile.new([ \"conconv_force_to_file\", @suffix.to_s ])\n @force_to_file = @file = Pathname.new(fh.path)\n fh.write @data\n fh.close\n $stderr.puts \" force_to_file wrote #{@data.size} => #{fh.path.inspect}\" if @verbose\n end\n @file\n end", "def setClientCertificate(certificate)\n if (!(File.file?(certificate) && !File.zero?(certificate)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(certificate, \"setClientCertificate\", \"html-to-pdf\", \"The file must exist and not be empty.\", \"set_client_certificate\"), 470);\n end\n \n @files['client_certificate'] = certificate\n self\n end", "def test_storeAndSign\n ca = nil\n caserv = nil\n\n # make our CA server\n assert_nothing_raised {\n caserv = Puppet::Network::Handler.ca.new(:autosign => false)\n }\n\n # retrieve the actual ca object\n assert_nothing_raised {\n ca = caserv.ca\n }\n\n # make our test cert again\n key = nil\n csr = nil\n cert = nil\n hostname = \"test.domain.com\"\n assert_nothing_raised {\n cert = Puppet::SSLCertificates::Certificate.new(\n :name => \"anothertest.domain.com\"\n )\n }\n # and the CSR\n assert_nothing_raised {\n cert.mkcsr\n }\n\n # retrieve them\n certtext = nil\n assert_nothing_raised {\n certtext, cacerttext = caserv.getcert(\n cert.csr.to_s, \"test.reductivelabs.com\", \"127.0.0.1\"\n )\n }\n\n # verify we got nothing back, since autosign is off\n assert_equal(\"\", certtext)\n\n # now sign it manually, with the CA object\n x509 = nil\n assert_nothing_raised {\n x509, cacert = ca.sign(cert.csr)\n }\n\n # and write it out\n cert.cert = x509\n assert_nothing_raised {\n cert.write\n }\n\n assert(File.exists?(cert.certfile))\n\n # now get them again, and verify that we actually get them\n newtext = nil\n assert_nothing_raised {\n newtext, cacerttext = caserv.getcert(cert.csr.to_s)\n }\n\n assert(newtext)\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(newtext)\n }\n\n # Now verify that we can clean a given host's certs\n assert_nothing_raised {\n ca.clean(\"anothertest.domain.com\")\n }\n\n assert(!File.exists?(cert.certfile), \"Cert still exists after clean\")\n end", "def cert_dump(cert)\n return nil unless cert\n\n %x[echo \"#{cert_object(cert).to_pem}\" | openssl x509 -text -noout -nameopt oneline,-esc_msb 2>&1]\n end", "def write_pkcs12(filename_or_io, password, friendly_name = 'r509 pkcs12')\n if @key.nil?\n raise R509::R509Error, \"Writing a PKCS12 requires both key and cert\"\n end\n pkcs12 = OpenSSL::PKCS12.create(password, friendly_name, @key.key, @cert)\n write_data(filename_or_io, pkcs12.to_der)\n end", "def setClientCertificate(certificate)\n if (!(File.file?(certificate) && !File.zero?(certificate)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(certificate, \"setClientCertificate\", \"html-to-image\", \"The file must exist and not be empty.\", \"set_client_certificate\"), 470);\n end\n \n @files['client_certificate'] = certificate\n self\n end", "def save(filename, constraints = {})\n File.open(filename, \"wb\") { |io| write(io, constraints) }\n end", "def save(filename, constraints = {})\n File.open(filename, 'wb') { |io| write(io, constraints) }\n end", "def set_cert(cert_str)\n #if !has_cert?\n File.open(@cert_file_path, \"w\") do |f|\n f.write(cert_str)\n end\n\n # Do some sanity checks on the certificate\n begin\n # Check the certificate\n if !check_cert then\n FileUtils.rm_f(@cert_file_path)\n raise ActivatorIdentityCertException.new(is_invalid = true, is_incorrect = true)\n end\n\n # Check if the certificate matches the CSR content.\n if !check_cert_key_match_csr_key then\n FileUtils.rm_f(@cert_file_path)\n raise ActivatorIdentityCertException.new(is_invalid = false, is_incorrect = true)\n end\n \n rescue Exception => ex\n # This makes sure we can restart if there is an unknown exception.\n FileUtils.rm_f(@cert_file_path)\n raise ex\n end\n\n #else\n # raise ActivatorIdentityException.new(\"object read-only\")\n #end\n end", "def check_cert\n\t\t\t\tpath = File.join('/tmp','gistto.crt')\n\t\t\t\tunless File.exists? path\n\t\t\t\t\tFileUtils.cp File.join(File.expand_path('../../../extras', __FILE__),'gistto.crt'), '/tmp'\n\t\t\t\t\tabort \"Cert File can't be copied to temp dir\" unless File.exists? path\n\t\t\t\tend\n\t\t\t\tpath\n\t\t\tend", "def write_pkcs12(filename_or_io,password,friendly_name='r509 pkcs12')\n if @key.nil?\n raise R509::R509Error, \"Writing a PKCS12 requires both key and cert\"\n end\n pkcs12 = OpenSSL::PKCS12.create(password,friendly_name,@key.key,@cert)\n write_data(filename_or_io, pkcs12.to_der)\n end", "def clean_cert(node)\n if Puppet::SSL::CertificateAuthority.ca?\n Puppet::Face[:ca, :current].revoke(node)\n Puppet::Face[:ca, :current].destroy(node)\n Puppet.info \"#{node} certificates removed from ca\"\n else\n Puppet.info \"Not managing #{node} certs as this host is not a CA\"\n end\n end", "def add_keycert(keycert_file); end", "def clear_cert_store\n @cacerts_loaded = true # avoid lazy override\n @cert_store = X509::Store.new\n @cert_store._httpclient_cert_store_items.clear\n change_notify\n end", "def destroy\n if resource[:serial]\n serial_number = resource[:serial]\n elsif resource[:file]\n certificate_raw = File.read resource[:file]\n certificate_infos = OpenSSL::X509::Certificate.new(certificate_raw)\n serial_number = certificate_infos.serial.to_i\n end\n\n return false if serial_number.nil?\n\n certificate = client(resource).certificate(serial_number)\n result = certificate.delete\n\n handle(result)\n end", "def set_certificate_file(opts)\n opts = check_params(opts,[:certs])\n super(opts)\n end", "def create_certificate\n visit CREATE_CERT_URL\n wait_for_elements(\"form[name='certificateSave']\")\n\n Helper.log.info \"Creating a new code signing certificate\"\n\n # select certificate type\n if @type == DEVELOPMENT\n app_store_toggle = first(\"input#type-development\")\n else\n app_store_toggle = first(\"input#type-iosNoOCSP\") || first(\"input#type-iosOCSP\")\n end\n \n if !!app_store_toggle['disabled']\n # Limit of certificates already reached\n raise \"Could not create another certificate, reached the maximum number of available certificates.\".red\n end\n\n app_store_toggle.click\n\n click_next # submit the certificate type\n sleep 2\n click_next # information about how to upload the file (no action required on this step)\n\n cert_signing_request = Cert::SigningRequest.get_path\n Helper.log.info \"Uploading the cert signing request '#{cert_signing_request}'\"\n\n wait_for_elements(\"input[name='upload']\").first.set cert_signing_request # upload the cert signing request\n sleep 1\n click_next\n\n sleep 3\n\n while all(:css, '.loadingMessage').count > 0\n Helper.log.debug \"Waiting for iTC to generate the profile\"\n sleep 2\n end\n\n Helper.log.info \"Downloading newly generated certificate\"\n sleep 2\n\n # Now download the certificate\n download_button = wait_for_elements(\".button.small.blue\").first\n url = download_button['href']\n\n path = File.join(Cert.config[:output_path], \"certificate.cer\")\n download_url(url, path)\n\n certificate_id = url.match(/.*displayId=(.*)&type.*/)[1]\n\n ENV[\"CER_FILE_PATH\"] = path\n ENV[\"CER_CERTIFICATE_ID\"] = certificate_id\n Helper.log.info \"Successfully downloaded latest .cer file to '#{path}' (#{certificate_id})\".green\n\n Cert::KeychainImporter::import_file(path) unless Cert.config[:skip_keychain_import]\n rescue => ex\n error_occured(ex)\n end", "def save(filename)\n File.open(filename,'w') { |file| file << to_string }\n end", "def save!\n raise Informative, 'This XCScheme object was not initialized ' \\\n 'using a file path. Use save_as instead.' unless @file_path\n File.open(@file_path, 'w') do |f|\n f.write(to_s)\n end\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save_as(file)\n File.open(file, \"wb\") { |f| f.write to_s }\n end", "def save(filepath)\n File.open(filepath, \"w\") do |f|\n f.write((@proxies + @dead_proxies).to_yaml)\n end\n end", "def delete_signing_certificate(certificate_id, options={})\n request_hash = { 'CertificateId' => certificate_id }\n request_hash['UserName'] = options[:user_name] unless options[:user_name].right_blank?\n link = generate_request(\"DeleteSigningCertificate\", request_hash)\n request_info(link, RightHttp2xxParser.new(:logger => @logger))\n end", "def save_csr_data(csr_data_file)\n File.open(csr_data_file, \"w\") do |f|\n YAML.dump(@csr_data, f)\n end\n end", "def set_cert_file(http)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n cert_file = File.join(@app_path, \"cacert.pem\")\n\n #If cert file is not found, create one.\n if not File.exist?(cert_file)\n make_ssl_cert_file(cert_file)\n end\n http.ca_file = cert_file\n http\n end", "def delete_certificate(name)\n client.delete(\"/v1/auth/cert/certs/#{encode_path(name)}\")\n return true\n end", "def save!\n delete_file\n save\n end", "def save(flatten = false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten)\n File.rename tmp_file, @file\n end", "def save_file\n raise ArgumentError, 'Need a Path to save the file' if @path.nil?\n File.open(@path, 'w') do |f|\n f.write to_s\n end\n end", "def certificate_path\n\t\t\tFile.join(@root, \"#{@hostname}.crt\")\n\t\tend", "def save(path)\n begin\n pdf_content = URI.open(pdf_url).read\n File.open(path, 'wb') {|f| f.write pdf_content}\n rescue\n File.delete(path) if File.file? path\n raise\n end\n end", "def sign!(cert)\n openssl_cert = cert.cert # because model -> OpenSSL object\n openssl_cert.serial = self.next_serial\n cert.serial = self.next_serial\n openssl_cert.issuer = ca_cert.subject\n openssl_cert.sign private_key, OpenSSL::Digest::SHA1.new\n self.next_serial = self.next_serial + 1\n self.save\n nil\n end", "def certificate=(value)\n @certificate = value\n end", "def update_firefox_profile_with_certificates(profile, certificate_path, certificate_prefix = '')\n profile_path = profile.layout_on_disk\n \n # Create links to the certificate files in the profile directory\n ['cert8.db', 'key3.db', 'secmod.db'].each do |cert_file|\n source_file = \"#{certificate_prefix}#{cert_file}\"\n source_path = \"#{certificate_path}\" + File::SEPARATOR + source_file\n dest_path = profile_path + File::SEPARATOR + cert_file\n if(! File.exist?(source_path))\n raise \"Firefox cert db file #{source_path} does not exist.\"\n end\n FileUtils.cp(source_path, dest_path)\n end \n\n # Force the certificates to get pulled into the profile\n profile = Selenium::WebDriver::Firefox::Profile.new(profile_path)\n\n # Avoid Firefox certificate alerts\n profile[\"security.default_personal_cert\"] = 'Select Automatically'\n \n return profile\n end", "def write_file(client, filename, cipher)\n client.puts(encrypt(ACCEPT, cipher))\n File.open(@dir + '/' + filename, 'w') do |file|\n client.each_line do |data|\n line = decrypt(data, cipher)\n if line == END_TRANS; puts 'File saved'\n else file.write(line + \"\\n\")\n end\n end\n end\n client.close\n end", "def write_key!\n dir = Tinc.config['key_dir']\n File.open(\"#{dir}/#{node.mac}\", 'w') do |f|\n f.write(self.cert_data) \n end\n end", "def save(overwrite=true)\n write_file(overwrite, @filename)\n end", "def save_to_storage\n if save_attachment?\n # TODO: This overwrites the file if it exists, maybe have an allow_overwrite option?\n FileUtils.mkdir_p(File.dirname(full_filename))\n File.cp(temp_path, full_filename)\n File.chmod(attachment_options[:chmod] || 0644, full_filename)\n end\n @old_filename = nil\n true\n end", "def save_to_file(path = nil)\n 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 if !path\n path = Rails.root.join('tmp', filename)\n end\n ::File.open(path, 'wb') do |handle|\n handle.write file.content\n end\n path\n end", "def cert=(certificate)\n @cert = certificate\n # Try to guess a digest algorithm for signature creation\n case @cert.signature_algorithm\n when 'GOST R 34.11-94 with GOST R 34.10-2001'\n self.signature_digest_algorithm = :gostr3411\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'\n # Add clauses for other types of keys that require other digest algorithms and identifiers\n else # most common 'sha1WithRSAEncryption' type included here\n set_default_signature_method! # Reset any changes as they can become malformed\n end\n end", "def save_as(file_path, flatten: false)\n if @file_path == file_path\n save(flatten: flatten)\n else\n File.open(file_path, 'wb') { |f| f.write(finalize(flatten: flatten)) && f.close }\n end\n end", "def to_file(file)\n Utils.write_file(file, to_s)\n end", "def save(flatten: false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten: flatten)\n File.rename tmp_file, @file_path\n end", "def cert=(cert); end", "def to_file(file)\n Utils::write_file(file, to_s)\n end", "def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end", "def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end", "def cert_store=(cert_store); end", "def cert_store=(cert_store); end", "def other_certificate_file\n super\n end", "def save\n # get a new KEK\n kek = OpenSSL::Random.random_bytes(32)\n \n # set up a cipher to encrypt the keystore\n cipher = get_cipher\n cipher.encrypt(kek)\n iv = cipher.random_iv\n\n # dump the keystore and pad it with a random length\n ksdata = OpenSSL::Random.random_bytes(2)\n len = ksdata.unpack(\"n\").first\n ksdata << OpenSSL::Random.random_bytes(len)\n ksdata << Marshal.dump(@ks)\n\n # encrypt the keystore with its KEK\n ciphertext = cipher.update(ksdata)\n ciphertext << cipher.final\n\n # encrypt the KEK\n public_rsa = @config[:SSLPrivateKey].public_key\n encrypted_key = public_rsa.public_encrypt(kek)\n\n # write out the encrypted KEK, the IV and the ciphertext\n File.open(@config[:filename], \"w\") do |fp| \n fp << encrypted_key\n fp << iv\n fp << ciphertext\n end\n end", "def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end", "def save\n save_to_file(@output_file, @contents)\n end", "def destroy\n @certificate = Certificate.find(params[:id])\n @certificate.destroy\n\n respond_to do |format|\n format.html { redirect_to(certificates_url) }\n format.xml { head :ok }\n end\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def destroy\n # get the ca\n @authority = Certify::Authority.find(params[:certify_authority_id])\n\n # get the certificate\n @certificate = Certify::Certificate.find(params[:id])\n @certificate.destroy\n\n respond_to do |format|\n format.html { redirect_to certify_authority_path(@authority), notice: 'Certificate removed' }\n format.json { head :no_content }\n end\n end", "def save\n return if File.exists?(file)\n\n # Create parent directories\n FileUtils.mkdir_p(File.dirname(file))\n\n File.open(file, \"w\") do |f|\n f.write(compressed_contents)\n end\n\n puts \"Wrote blob #{file}\"\n end", "def ca_cert_file=(value)\n raise TypeError, 'ca_cert_file must be a String or respond_to #to_s' unless value.is_a?(String) || value.respond_to?(:to_s)\n \n @ca_cert_file = value.to_s\n end", "def create\n # Revoke the old cert before creating a new one\n revoke_cert if certificate && private_key && check_cert_exists\n new_cert = create_cert\n client_cert_save(new_cert)\n end", "def safe_file_write(filepath, content: nil)\n raise ArgumentError, '#write_to_file requires filepath' if nay? filepath\n\n ensure_paths_to_file(filepath)\n File.write(filepath, content)\n filepath\n end", "def certificate=(cert_metadata)\n if cert_metadata\n attributes[:certificate_valid_from] = time_or_original(cert_metadata[\"valid_from\"])\n attributes[:certificate_expires_at] = time_or_original(cert_metadata[\"expires_at\"])\n attributes[:certificate_issuer] = cert_metadata[\"issuer\"]\n attributes[:certificate_subject] = cert_metadata[\"subject\"]\n attributes[:certificate_enable_ssl3] = cert_metadata[\"sslv3\"]\n else\n attributes[:certificate_valid_from] = nil\n attributes[:certificate_expires_at] = nil\n attributes[:certificate_issuer] = nil\n attributes[:certificate_subject] = nil\n attributes[:certificate_enable_ssl3] = nil\n end\n end", "def certificate_without_head_foot\n @certificate_without_head_foot ||= read_certificate(\"certificate_without_head_foot\")\n end", "def store\n\t\t\t@store ||= OpenSSL::X509::Store.new.tap do |store|\n\t\t\t\tstore.add_cert(self.certificate)\n\t\t\tend\n\t\tend", "def save(file = nil)\n @file = file if file\n raise Error.new(Error::FileError) unless @file\n File.open(@file, 'w') do |f|\n f.puts(@prefix) if @prefix\n YAML.dump(@cfg, f)\n f.puts ''\n f.puts(@suffix) if @suffix\n end\n end", "def ca_file=(ca_file); end", "def ca_file=(ca_file); end", "def save(filename=@filename)\n backup_filename = filename + '~'\n File.delete(backup_filename) if File.exist? backup_filename\n FileUtils.mv(filename, backup_filename)\n File.open(filename, 'w') do |f|\n f.puts @header\n f.puts @body\n f.puts @gem_dependencies\n f.puts @dev_dependencies\n f.puts @footer\n end\n end", "def cert_store=(cert_store)\n @cert_store = cert_store\n change_notify\n end", "def destroy_certificate\n revoke_app_cert(params[:app_identifier], params[:cert_identifier])\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end", "def write_file(content, dir, file)\n filename = File.basename(file).gsub(/(\\.s?[ac]ss)+/, options[:extension])\n path = File.join(dir, filename)\n\n unless options[:noop]\n FileUtils.mkdir_p(dir)\n File.open(path, 'w') {|f| f.write(content) }\n end\n\n path\n end", "def cert_file_path\n File.expand_path(File.join(control.newrelic_root, 'cert', 'cacert.pem'))\n end", "def to_file\n replace_with_tempfile unless @tempfile_in\n flush\n self\n end", "def save_file\n FileUtils.mkdir_p(File.dirname(full_filename))\n FileUtils.cp(temp_path, full_filename)\n FileUtils.chmod(0644, full_filename)\n end", "def clear_file(path)\n File.open(path, 'w') {}\n end", "def destroy\n @certificate.destroy\n respond_to do |format|\n format.html { redirect_to certificates_path}\n format.json { head :no_content }\n end\n end", "def close(filename)\n clearpath = clear_filepath(filename)\n check_file_is_in_safe_dir(clearpath) if options[:portable]\n persist!\n\n @lock.encrypt(clearpath, secure_filepath(clearpath))\n\n info = files.fetch(clearpath, {}).merge(\n secure_file: secure_filepath(clearpath),\n last_closed: Time.now,\n safe: true\n )\n update_index(:files, files.merge(clearpath => info))\n end", "def create\n Puppet.debug('creating')\n\n # don't check priv_key here because priv_key isnt looked up via facts\n if resource[:cert]\n Puppet.debug('creating from exising cert')\n # user passed in the certificate data for us, use this\n cert = resource[:cert]\n priv_key = resource[:priv_key]\n else\n # create a new cert via Vault API\n Puppet.debug('creating from new cert from vault')\n new_cert = create_cert\n cert = new_cert['data']['certificate']\n priv_key = new_cert['data']['private_key']\n end\n\n thumbprint = nil\n serial_number = nil\n if cert\n Puppet.debug(\"computed new cert serial: #{serial_number}\")\n details = PuppetX::Encore::Vault::Util.cert_details(cert)\n thumbprint = details[:thumbprint]\n serial_number = details[:serial_number]\n end\n\n # if there is an existing cert with this cert_name(friendly name) that doesn't match our\n # thumbprint/serial, then destroy the old one, remove from trust store and create a new one\n if certificate_list && !certificate_list.empty? &&\n (certificate_list.size > 1 ||\n (certificate_list.first['thumbprint'] != thumbprint ||\n certificate_list.first['serial_number'] != serial_number))\n Puppet.debug(\"A certificate with the same cert name (FriendlyName) exists, but doesn't match our thumbprint and serial number, we're going to delete these old one(s)\")\n # NOTE: we _could_ try to keep some certs here, but this adds a ton of additional\n # complexity, like... which ones should we keep, what if the ones we're trying to\n # keep is expired, revoked, etc. Easiest thing is to just revoke and remove all\n # of the certs and make a new one.\n destroy\n\n # if we just destroyed all of the certs on the system, we need to make a new one\n # unless the cert and priv_key were given above\n unless cert && priv_key\n new_cert = create_cert\n cert = new_cert['data']['certificate']\n priv_key = new_cert['data']['private_key']\n end\n end\n\n # can only save/import the certificate into the cert store if we have\n # the cert and priv_key\n # this is important on a puppet run where we've read the existing certificate from\n # facts, but not the private key (private key isn't exposed in facts)\n # this way we can check on exist certs without overwriting them\n if cert\n if priv_key\n Puppet.debug('saving client cert to cert store')\n client_cert_save(cert, priv_key)\n else\n Puppet.info('not saving client cert because only have cert and not priv key')\n end\n else\n Puppet.debug('not saving client cert because cert and priv_key are both nil')\n end\n end" ]
[ "0.6537741", "0.6527521", "0.64083874", "0.631505", "0.6059651", "0.60592175", "0.6056657", "0.58367133", "0.5643589", "0.5643589", "0.5616639", "0.5603262", "0.5585423", "0.5552489", "0.5541129", "0.5497912", "0.5449088", "0.5433572", "0.5429138", "0.5413541", "0.5351649", "0.5329548", "0.5323104", "0.52962106", "0.52839804", "0.52763504", "0.5268229", "0.5261796", "0.5251641", "0.5243817", "0.52393186", "0.5226193", "0.52218115", "0.5181406", "0.5170253", "0.5165576", "0.51642084", "0.5162742", "0.5148087", "0.5140296", "0.510713", "0.50983876", "0.50983876", "0.5084152", "0.50804585", "0.50680816", "0.50671804", "0.50660175", "0.5062063", "0.50598824", "0.5047788", "0.5046591", "0.5039323", "0.50257516", "0.5018401", "0.50158346", "0.50113416", "0.4999967", "0.49949667", "0.49877533", "0.4968121", "0.49559778", "0.49549055", "0.4939293", "0.49344417", "0.49330148", "0.49307606", "0.49295655", "0.49295655", "0.49289492", "0.49289492", "0.49186635", "0.4914571", "0.4912071", "0.49110657", "0.490636", "0.49044436", "0.49021816", "0.4900617", "0.48980147", "0.48960125", "0.48777646", "0.48745722", "0.48603392", "0.48573568", "0.48569837", "0.484679", "0.484679", "0.4843204", "0.48358005", "0.483526", "0.4832335", "0.48164153", "0.48144495", "0.48118573", "0.48110846", "0.4801892", "0.47998235", "0.47993588", "0.47851768" ]
0.49588385
61
This sets the mode so OpenSSL knows to encrypt or decrypt, etc.
def initialize_cipher_for(mode) @cipher.send mode @cipher.key = @config['key'] @cipher.iv = @config['iv'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end", "def _setup(action)\n @cipher ||= OpenSSL::Cipher.new(@options[:cipher]) \n # Toggles encryption mode\n @cipher.send(action)\n @cipher.padding = @options[:padding]\n @cipher.key = @key.unpack('a2'*32).map{|x| x.hex}.pack('c'*32)\n end", "def cipher(cipher_mode, data)\n expect! cipher_mode => [ :decrypt, :encrypt ]\n\n case cipher_mode\n when :decrypt\n expect! data => /^envy:/\n cipher_op(:decrypt, data: Base64.decode64(data[5..-1]))\n when :encrypt\n \"envy:\" + Base64.strict_encode64(cipher_op(:encrypt, data: data))\n end\n end", "def cipher_mode=(cipher_type)\n if cipher_type == \"ecb\"\n @cipher_type_des = \"des-ecb\"\n @cipher_type_tdes = \"des-ede\"\n else\n @cipher_type_des = \"des-cbc\"\n @cipher_type_tdes = \"des-ede-cbc\"\n end\n end", "def set_peer_certificate_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def verify_mode=(mode)\n unless VERIFY_MODES.include? mode\n raise ArgumentError, \"Invalid SSL verify mode #{mode.inspect}\\n\" +\n \"Please specify one of #{VERIFY_MODES.inspect}\"\n end\n\n @verify_mode = mode\n end", "def encrypt_with\n log!\n prepare\n\n if mode_options.empty?\n raise Error, \"Encryption could not be performed for mode '#{mode}'\"\n end\n\n yield \"#{utility(:gpg)} #{base_options} #{mode_options}\", \".gpg\"\n ensure\n cleanup\n end", "def set_mode(mode)\n send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '')\n end", "def set_encryption_attributes\n @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches\n @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token\n @sorcery_config.encryption_provider.pepper = @sorcery_config.pepper if @sorcery_config.encryption_provider.respond_to?(:pepper) && @sorcery_config.pepper\n end", "def set_mode(m)\n @mode = m\n end", "def set_mode(new)\n @mode = new\n end", "def verify_mode=(verify_mode); end", "def verify_mode=(verify_mode); end", "def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end", "def cipher\n aes = OpenSSL::Cipher::Cipher.new(\"aes-#{@key_size}-cbc\")\n\n case @mode\n when :encrypt\n aes.encrypt\n when :decrypt\n aes.decrypt\n else\n raise(InvalidMode,\"invalid mode #{@mode}\")\n end\n\n aes.key = @key\n aes.iv = @iv\n\n yield aes if block_given?\n return aes\n end", "def ssl_cipher\n super\n end", "def mode=(a_mode)\n @@mode = a_mode.to_sym\n end", "def set_ssl_cipher(opts)\n opts = check_params(opts,[:ciphers])\n super(opts)\n end", "def cipher_type\n self.class.cipher_type(algorithm: algorithm, key_length: key_length, mode: mode)\n end", "def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end", "def set_mode mode\n @mode = mode\n @num_hashes = DEFAULT_NUM_HASHES\n\n if @mode == 64\n @length_size = DEFAULT_LENGTH_SIZE * 2\n @hashptr_size = DEFAULT_HASHPTR_SIZE * 2\n @format = \"Q<\"\n else\n @length_size = DEFAULT_LENGTH_SIZE\n @hashptr_size = DEFAULT_HASHPTR_SIZE\n @format = \"V\"\n end\n end", "def modssl_emulation_state\n super\n end", "def port_mode_set(idx, mode)\n port = $ts.dut.port_list[$idx_tx]\n conf = $ts.dut.call(\"mesa_qos_port_conf_get\", port)\n conf[\"key_type\"] = (\"MESA_VCAP_KEY_TYPE_\" + (mode[0] == \"N\" ? \"NORMAL\" : mode))\n conf[\"dmac_dip\"] = (mode == \"NORMAL_DST\" ? true : false)\n $ts.dut.call(\"mesa_qos_port_conf_set\", port, conf)\nend", "def mode=(mode)\n request.mode = mode\n end", "def attr_encrypted_options=(options)\n @attr_encrypted_options = options\n end", "def switch_mode!\n return cooked_mode! if raw_mode?\n\n raw_mode!\n end", "def connection_status_crypt_enable; end", "def cipher(key, iv, encrypt = true)\n mode = @modes[@mode] % (@key_len * 8)\n cipher = OpenSSL::Cipher.new(mode)\n encrypt ? cipher.encrypt : cipher.decrypt\n cipher.key = key\n cipher.iv = iv\n cipher\n end", "def mode=(mode)\n Nitro.mode = mode.to_sym\n end", "def openssl_verify_mode\n case verify_mode\n when :none then OpenSSL::SSL::VERIFY_NONE\n when :peer then OpenSSL::SSL::VERIFY_PEER\n when :fail_if_no_peer_cert then OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT\n when :client_once then OpenSSL::SSL::VERIFY_CLIENT_ONCE\n end\n end", "def new_cipher(direction, passwd, options = {})\n check_platform_can_encrypt!\n cipher = OpenSSL::Cipher::Cipher.new(CIPHER_TYPE)\n case direction\n when :encrypt\n cipher.encrypt\n when :decrypt\n cipher.decrypt\n else\n raise \"Bad cipher direction #{direction}\"\n end\n cipher.key = encrypt_key(passwd, options)\n cipher\n end", "def initialize(password, size=256, mode=\"cbc\")\n @password = password\n @size = size\n @mode = mode\n @cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{size}-#{mode}\")\n end", "def ssl_key_type=(key_type)\n raise \"Invalid ssl key type : '#{key_type}'...\" if key_type and !%w(PEM DER ENG).include?(key_type)\n set_option(:sslkeytype, key_type)\n end", "def set_binary_mode size=nil\n set_text_mode size\n end", "def encryption_method(config)\n method = config[\"encryption\"][\"method\"]\n case method.to_s\n when \"start_tls\", \"simple_tls\"\n method.to_sym\n when \"starttls\"\n :start_tls\n end\n end", "def set_stream_mode\n @stream_mode = true\n whdr TYPE_EXTRA, XT_STREAM_MODE\n @cache = { nil => 0 }\n end", "def peer_certification_mode\n super\n end", "def ssl_verify(mode)\n @ssl_verify = mode\n end", "def in_mode(mode)\n @mode = mode\n self\n end", "def mode= new_mode\n @gapi.update! mode: verify_mode(new_mode)\n end", "def mode_options\n @mode_options ||= begin\n s_opts = symmetric_options if mode != :asymmetric\n a_opts = asymmetric_options if mode != :symmetric\n [s_opts, a_opts].compact.join(\" \")\n end\n end", "def initialize(*)\n super\n\n @encrypted_env_key = \"ENCRYPTED_#{env_key}\"\n @encrypted_key_path = \"#{key_path}.enc\"\n end", "def set_access_mode(mode = :r)\n modes = [:r, :w, :rw, :x]\n raise ArgumentError, \"Mode must be one of #{modes}\" unless modes.include? mode\n case mode\n when :r\n self.access_mode = 0\n when :w\n self.access_mode = 1\n when :rw\n self.access_mode = 2\n when :x\n self.access_mode = 3\n end\n end", "def set_modssl_emulation_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end", "def snd_settle_mode=(mode)\n Cproton.pn_link_set_snd_settle_mode(@impl, mode)\n end", "def authorization_mode=(mode); end", "def strict_mode=(value); end", "def encrypted_options\n encrypt(construct_encrypted_options())\n end", "def mode=(new_mode)\n @mode , @previous_mode = new_mode, @mode\n build_chains() if @mode != @previous_mode && @previous_mode != nil && @previous_mode != \"\"\n end", "def strict_mode=(mode)\n @strict_mode = mode\n end", "def mode=(m)\n case m\n when :udp then attributes['mode'] = 'udp'\n else attributes['mode'] = 'tcp'\n end\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def in_mode(mode)\n\t\t@mode = mode\n\t\tself\n\tend", "def ssl_key_type=(key_type)\n raise \"Invalid ssl key type : '#{key_type}'...\" if key_type and !%w(PEM DER ENG).include?(key_type)\n set_option(OPTION_VALUES[:CURLOPT_SSLKEYTYPE], key_type)\n end", "def set_persistence_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def mode=(m)\n @mode = m.to_sym\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def with_mode(id, _options = {})\n orig = mode\n self.mode = id\n yield\n self.mode = orig\n end", "def encrypted=(boolean)\n @scheme = boolean ? 'https' : 'http'\n # Configure port if it hasn't already been configured\n @port = boolean ? 443 : 80\n end", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def new_cipher(direction, password, salt)\n cipher = OpenSSL::Cipher::Cipher.new(CIPHER_TYPE)\n direction == :encrypt ? cipher.encrypt : cipher.decrypt\n cipher.key = encrypt_key(password, salt)\n cipher\n end", "def default_blob_mode=(mode)\n @default_blob_mode = mode.to_sym\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def set_transparency_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def set_crypto_hooks\n\n Binding.setopt_crypto_hooks(\n self,\n method(:aes_encrypt),\n method(:aes_decrypt),\n method(:random),\n method(:hmac_sha_512),\n method(:hmac_sha_256),\n method(:hmac_hash),\n )\n end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def stream_mode\n set_stream_mode\n end", "def setup_ssl_auth\n super\n @client.ciphers = [\"DEFAULT:!DH\"]\n end", "def bin_mode=(bool)\n @telnet_options[:bin_mode] = bool\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def set_ssl_config(version, cipher_suite = nil)\n $log.debug(\"Setting ssl configuration #{version}, #{cipher_suite}\")\n self.use_ssl = true\n\n self.set_context = version\n if(self.respond_to?(:ssl_version)) # For Ruby 1.9\n self.ssl_version = version\n end\n self.ciphers = cipher_suite if(cipher_suite)\n disable_validations\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def initialize\n @edit_distance = 3\n @cipher_spec = \"AES-256-CBC\"\n @padding_byte_size = 32\n end", "def mode=(type)\n @mode = type.to_s\n end", "def ssl_cipher\n datastore['SSLCipher']\n end", "def update_robject\n super\n robject.content_type = @@encrypted_content_type if Ripple::Encryption.activated?\n end", "def secure_ssl=(_arg0); end", "def ssl_options=(_arg0); end", "def ssl_options=(_arg0); end", "def set_mode newmode\n @mode = newmode\n @view.set_mode newmode\n case newmode\n when :idle\n reset_all_stats\n end\n end", "def set_key_iv\r\n @cipher.key = @key_iv[:key]\r\n @cipher.iv = @key_iv[:iv]\r\n end", "def is_encrypted=(value)\n @is_encrypted = value\n end", "def ssl_engine(engine)\n ssl_warn_global(:ssl_engine)\n ssl_require!\n OpenSSL::Engine.load\n OpenSSL::Engine.by_id(engine)\n @set[:ssl_engine] = engine\n end", "def cipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.encrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def aes_ecb_internal(mode, buffer, key)\n raise 'Buffer must be composed of 16-byte chunks' unless (buffer.size % 16).zero?\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.send(mode)\n cipher.key = key.pack('C*')\n cipher.padding = 0 # decryption will otherwise fail\n result = cipher.update(buffer.pack('C*')) + cipher.final\n result.unpack('C*')\nend", "def encrypt; end", "def ssl_cipher_filter; end", "def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end", "def ssl_options\n replace_verify_mode(ssl)\n end", "def cooked_mode!\n switch_mode!(:cooked)\n end", "def switch_mode mode = \"unknown\"\n begin\n settings = YAML::load_file @settings_file\n @settings[:mode] = mode\n save_settings @settings\n shell.say \"Switched mode to: #{mode}.\"\n shell.say\n print_account\n rescue\n shell.say \"ERROR: Invalid #{@settings_file} settings file.\"\n end\n end", "def encrypt(*attributes) \n \tinclude ActiveCrypto::Encrypted\n \tbefore_save :encrypt_attributes\n \tafter_save :decrypt_attributes\n options=attributes.last.is_a?(Hash) ? attributes.pop : {}\n keyholder\n if options and options[:key]\n \t\t\t\tmodule_eval <<-\"end;\"\t\t\t\t \n \t\t\t\t\tdef session_key\n \t\t\t\t\t\t(send :#{options[:key]} ).send :session_key\n \t\t\t\t\tend\t \n \t\t\t\t\t@@external_key=true\n \t\t\t\tend;\n end\n\n base64_encode = (options and options[:base64])\n module_eval <<-\"end;\"\n def self.ezcrypto_base64?\n #{base64_encode.to_s}\n end\n end;\n \n self.encrypted_attributes=attributes\n end", "def edit(mode=@mode)\n\told_mode = @mode unless @mode == mode\n\t\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend", "def encryption_server; end", "def attr_encrypted_options\n @attr_encrypted_options ||= superclass.attr_encrypted_options.dup\n end", "def attr_encrypted_options\n @attr_encrypted_options ||= superclass.attr_encrypted_options.dup\n end" ]
[ "0.6709338", "0.65460825", "0.6397773", "0.635467", "0.61822665", "0.61617327", "0.61496496", "0.6148367", "0.60943794", "0.60300434", "0.59287816", "0.57963926", "0.57963926", "0.57930976", "0.57873386", "0.5780654", "0.57656914", "0.57390237", "0.57379", "0.5712116", "0.5706559", "0.5678417", "0.56654686", "0.5652809", "0.5645219", "0.56158626", "0.56126255", "0.5599648", "0.55887663", "0.5568619", "0.5546224", "0.55379486", "0.5534978", "0.5533841", "0.55158496", "0.55147344", "0.55108756", "0.55082345", "0.54988164", "0.54956377", "0.54836845", "0.54794294", "0.5473836", "0.5458789", "0.54341257", "0.54158425", "0.53879654", "0.5387127", "0.5368846", "0.5340262", "0.53339225", "0.5326409", "0.53198105", "0.5300889", "0.5296476", "0.5294583", "0.5292667", "0.52859616", "0.52859616", "0.5271054", "0.52540153", "0.5252774", "0.5229281", "0.52249354", "0.52219415", "0.5213078", "0.521021", "0.5203916", "0.5200351", "0.51888853", "0.5184693", "0.51831454", "0.51831454", "0.51831454", "0.5172843", "0.5166413", "0.5157226", "0.5148059", "0.5143905", "0.5130713", "0.51250786", "0.51249176", "0.51249176", "0.5121716", "0.51166", "0.5114845", "0.511263", "0.5112596", "0.5105572", "0.5102771", "0.508717", "0.5086571", "0.5085096", "0.5084162", "0.5080301", "0.5054913", "0.5052299", "0.5049117", "0.50464803", "0.50464803" ]
0.7027253
0
get every test to pass before coding runner below
def runner welcome game = initial_round until game > 21 do game = hit?(game) display_card_total(game) end end_game(game) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def test_cases; end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def running_test_case; end", "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend", "def my_tests\n end", "def tests; end", "def tests; end", "def passed_checks\n all_checks_which_pass\n end", "def passes\n count - failures - errors - skips\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def test_steps; end", "def test_steps; end", "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end", "def before_test(test); end", "def before_test(test); end", "def generate_alltest\n\n end", "def running_test_step; end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def testing_begin(files)\n end", "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend", "def run\n test_using_random_sample\n test_using_first_of\n end", "def done\n puts 'Done running tests'\n end", "def all_failing\n all(\"#qunit-tests .fail\")\n end", "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def test_step; end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def scenarios\n @runner.done_scenarios\n end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end", "def failures; end", "def failures; end", "def failures; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def test_case; end", "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def test_contains_13_eachsuit\n assert true == false\n end", "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end", "def test_setup\r\n \r\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def test_truth\n end", "def start_tests(files)\n end", "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_contains_four_eachface\n assert true == false\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\t@genopts.keep\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\t@elems.keep\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\t@idxs.keep\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def passes; end", "def passes; end", "def run_all\n run_suite(@suite)\n end", "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def final_test_methods\n return []\n end", "def check_all_here\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def testloop\n \n end", "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend", "def integration_test()\n return [\"all\"]\n end", "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing\n # ...\n end", "def passed?\n return @test_passed\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def run\n checks.each(&:run)\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def run_fe_tests\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end" ]
[ "0.7275367", "0.72012377", "0.7191292", "0.71326625", "0.7128869", "0.7035493", "0.68615764", "0.6822212", "0.6807081", "0.6791164", "0.6791164", "0.67651623", "0.6570472", "0.6553684", "0.65485567", "0.65461046", "0.6529981", "0.6459336", "0.64472514", "0.64472514", "0.64417815", "0.643361", "0.643361", "0.6429336", "0.6392527", "0.63646454", "0.63446635", "0.6338221", "0.6321568", "0.63006586", "0.6284046", "0.6276136", "0.62625813", "0.6260206", "0.6248236", "0.6236704", "0.62156725", "0.620084", "0.6200228", "0.61979204", "0.6197219", "0.619563", "0.6194052", "0.6193285", "0.6190417", "0.6190417", "0.6190417", "0.61895543", "0.6186312", "0.6171443", "0.6161009", "0.61582875", "0.61428964", "0.6136149", "0.6135334", "0.6135334", "0.6132495", "0.6132405", "0.61202425", "0.61126524", "0.6106808", "0.60882175", "0.6087337", "0.608716", "0.60843146", "0.60804", "0.60804", "0.60763645", "0.6076022", "0.6075976", "0.6072652", "0.6064899", "0.60518396", "0.6050178", "0.60422915", "0.6024515", "0.60225564", "0.60209924", "0.60179764", "0.6014065", "0.60128546", "0.60051364", "0.6002728", "0.6002728", "0.60017437", "0.5991716", "0.5991716", "0.5991716", "0.59846663", "0.5970318", "0.59693795", "0.5968506", "0.5966465", "0.5954567", "0.59536093", "0.5944166", "0.594219", "0.5941986", "0.594174", "0.5934003", "0.59288836" ]
0.0
-1
Runs the commandline utility, parsing arguments and displaying a list of objects
def run(*args) prepare_codebase(*args) context = API::List.new(codebase, @options) Output::List.new(@options, context.objects, context.grade_lists) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(args)\n if args.size > 0\n # show details of given commands\n show_details(args)\n else\n # print full list of commands\n list_commands\n end\n end", "def run(*args)\n optparse(*args)\n\n if ::RbConfig::CONFIG['host_os'] =~ /mingw|win32/\n @serializer ||= YARD::Serializers::StdoutSerializer.new\n else\n @serializer ||= YARD::Serializers::ProcessSerializer.new('less')\n end\n\n if @name.nil? || @name.strip.empty?\n print_usage\n return exit(1)\n end\n\n object = find_object(@name)\n if object\n print_object(object)\n else\n STDERR.puts \"No documentation for `#{@name}'\"\n return exit(1)\n end\n end", "def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end", "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all command line arguments\"\n puts \"-i or --info Display instructions on how to play\"\n puts \"-v or --version Display current application and Ruby version\"\n puts \"start Skip menu and immediately start a new game\"\n puts \"wins Print win counts\"\n puts \"\"\nend", "def help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Usage:\"\n puts \" bin/run [command]\"\n puts\n puts \"Available Commands:\"\n puts \" [list | l] <age=> <type=> list all available animals\"\n puts \" [create | c] <name=> <type=> create a animal with name\"\n puts \" [delete | d] <name=> delete a animal\"\n puts \" [search | s] <name=> search a animal\"\n puts \" [food | f] <name=> give food to a animal\"\n puts \" [wash | w] <name=> give a shower to a animal\"\n puts \" [alive | a] <name=> show if a animal is alive\"\n puts \" [help | h] help about commands\"\n puts \"\"\n puts \"Flags:\"\n puts \" -v, --version show the app version\"\n puts \"\"\n puts \"Use bin/run [command] --help for more information about a command.\"\n end", "def parse args=ARGV\n\t\t\tOptionParser.new do |opts|\n\t\t\t\t# Setup\n\t\t\t\tversion_path = File.expand_path('../../VERSION', File.dirname(__FILE__))\n\t\t\t\topts.version = File.exist?(version_path) ? File.read(version_path) : ''\n\t\t\t\t# Start of help text\n\t\t\t\topts.banner = 'Usage: tracking [mode]'\n\t\t\t\topts.separator ' display recent tasks'\n\t\t\t\topts.separator ' <task description> start a new task with the given text (spaces allowed)'\n\t\t\t\t# Modes\n\t\t\t\topts.on('-f', '--find', 'display all tasks that match a search query') do\n\t\t\t\t\tdisplay(:query => text_from_args)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-a', '--all', 'display all tasks') do\n\t\t\t\t\tdisplay(:max => :all)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-n', '--number integer', 'display n tasks') do |number_str|\n\t\t\t\t\tdisplay(:max => number_str.to_i)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-r', '--rename', 'rename the last task') do\n\t\t\t\t\tList.rename text_from_args\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-d', '--delete', 'delete the last task') do\n\t\t\t\t\tList.delete\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-c', '--clear', 'delete all tasks') do\n\t\t\t\t\tList.clear\n\t\t\t\t\tputs 'List cleared.'\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-h', '--help', 'display this help information') do\n\t\t\t\t\tputs opts\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend.parse! args\n\n\t\t\t# Basic modes (display and add)\n\t\t\tif args.count == 0\n\t\t\t\t# Display all tasks\n\t\t\t\tdisplay\n\t\t\telse\n\t\t\t\t# Start a new task\n\t\t\t\tList.add args.join(' ').gsub(\"\\t\",'')\n\t\t\t\tdisplay\n\t\t\tend\n\t\tend", "def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end", "def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end", "def run\n @arguments = ArgumentParser.get_arguments VALID_ARGUMENTS\n print_help if (@arguments[:options][:help])\n print_version if (@arguments[:options][:version])\n if (@arguments[:keywords][:export])\n handle_export\n elsif (@arguments[:keywords][:import])\n handle_import\n else\n print_help\n end\n end", "def command(arguments, _options = nil)\n person = Array(arguments).first\n raise 'missing person argument' unless person\n\n employee = Employee.get person\n display_analysis(employee)\n end", "def run(*args)\n if args.empty? || (args.size == 1 && %w(-h --help).include?(args.first))\n puts help\n else\n sparkline = Sparkline.new(args.map(&:to_f))\n puts sparkline.to_s\n end\n end", "def parse_args\n doc = <<DOCOPT\nschwifty saves and downloads objects from ipfs, keeping track of their hashes in a garbage collection file in ~/.ipfs/ipfs_pinned_objects.yaml and an objects file in ./ipfs_objects.yaml\n\nUsage:\n schwifty add <files>...\n schwifty bootstrap (--clear | <nodes>... | --file=<bootstrap_list_yaml>)\n schwifty get <files_or_hashes>...\n schwifty gc\n schwifty -h | --help\n schwifty --version\n\nOptions:\n -h --help Show this screen.\n --version Show version.\nDOCOPT\n begin\n Docopt.docopt(doc)\n rescue Docopt::Exit => e\n puts e.message\n exit\n end\n end", "def run\n if arguments = parse_arguments\n begin\n process(arguments)\n rescue RuntimeError => ex\n Console.puts ex.message, :red\n exit 1\n end\n else\n if show_help?\n show_help(nil, Console.width).each do |line|\n Console.puts line, :cyan\n end\n else\n show_usage(nil, Console.width).each do |line|\n Console.puts line, :yellow\n end\n end\n exit 2\n end\n end", "def main()\n case ARGV[0]\n when \"--list\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.list()\n when \"--delete\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.delete(ARGV[1])\n when \"--set\"\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, nil, MAX_LEVEL\n cd_source.set(ARGV[1], ARGV[2])\n when \"--help\", \"-h\"\n puts HELP_INFO\n exit 1\n else\n cd_source = CDSource.new CACHE_FILE, SOURCE_DIRS, ARGV[0], MAX_LEVEL\n cd_source.search()\n end\nend", "def run\n case\n when arg == 'legend' then models_formatter.display_legend\n when arg == 'application' then deploy_pack_formatter.show(:deploy_pack)\n when arg == 'models' then models_formatter.list\n when arg == 'processors' then processors_formatter.list\n when arg == 'dataflows' then dataflows_formatter.list\n when arg == 'jobs' then jobs_formatter.list \n when models_formatter.model?(arg)\n models_formatter.show(arg.constantize)\n when processor?(arg)\n processors_formatter.show(arg)\n when dataflow?(arg)\n dataflows_formatter.show(arg)\n when jobs_formatter.job?(arg)\n jobs_formatter.show(arg)\n when arg\n raise Wukong::Error.new(\"No such model, processor, dataflow, or job <#{arg}>\")\n else\n list_all\n end\n end", "def parse_command_line_args(args)\n opts = OptionParser.new do |opts|\n opts.banner = 'Usage: tbibtools [OPTIONS] [FILES] < IN > OUT'\n opts.separator ''\n opts.separator 'tbibtools is a free software with ABSOLUTELY NO WARRANTY under'\n opts.separator 'the terms of the GNU General Public License version 2 or newer.'\n opts.separator ''\n \n opts.on('-c', '--config=FILE', String, 'Configuration file') do |value|\n @configuration.config value\n end\n\n opts.on('-e', '--regexp=REGEXP', String, 'Display entries matching the regexp') do |value|\n @configuration.filter Regexp.new(value)\n end\n\n opts.on('-f', '--format=STRING', String, 'Re-format entries (order matters)') do |value|\n @configuration.format *value.split(/,/)\n end\n\n opts.on('--[no-]formatted', 'Unformatted output') do |bool|\n unless bool\n @configuration.entry_format = []\n @configuration.entry_format_default = []\n end\n end\n\n opts.on('-i', '--[no-]case-sensitive', 'Case insensitive') do |bool|\n @configuration.sort_case bool\n end\n \n opts.on('-l', '--format-list=[STRING]', String, 'Format string for list (implies --ls)') do |value|\n @configuration.shortcut_ls\n @configuration.list_format value if value\n end\n\n opts.on('--ls', 'Synonym for: -f list,stripPrelude (\"list\" implies \"unwrap\")') do |bool|\n @configuration.shortcut_ls if bool\n end\n\n opts.on('-o', '--output=FILE', String, 'Output file') do |value|\n @configuration.output value\n end\n\n opts.on('-P', '--strip-prelude', 'Strip the prelude: same as -f stripPrelude but helps to maintain the original formatting') do |bool|\n @configuration.strip_prelude\n end\n\n opts.on('-q', '--query=FIELD=REGEXP', String, 'Show entries for which field matches the regexp') do |value|\n field, rx = value.split(/=/, 2)\n @configuration.query field => Regexp.new(rx, Regexp::IGNORECASE)\n end\n\n opts.on('-s', '--sort=STRING', String, 'Sort (default: sort by key; key = _id, type = _type)') do |value|\n @configuration.sort_key value\n end\n\n opts.on('-S', '--[no-]expand-strings', 'Replace/expand strings') do |bool|\n @configuration.expand_strings bool\n end\n\n opts.on('--strip=FIELDS', String, 'Ignore/strip fields') do |value|\n @configuration.strip value.split(/,/)\n end\n\n opts.on('-u', '--unsorted', 'Unsorted output') do |bool|\n @configuration.sort_key nil\n end\n\n opts.separator ''\n opts.separator 'Other Options:'\n \n opts.on('--debug', Integer, 'Show debug messages') do |v|\n $DEBUG = true\n $VERBOSE = true\n end\n \n opts.on('-v', '--verbose', 'Run verbosely') do |v|\n $VERBOSE = true\n end\n \n opts.on('-h', '--help', 'Show this message') do\n puts opts\n exit 1\n end\n\n opts.separator ''\n opts.separator 'Available formats:'\n format_rx = /^(format|preprocess|head|body|tail)_/\n format_names = (['nnIsYear', 'sortCrossref', 'downcaseType', 'upcaseType'] + \n @configuration.methods.find_all{|m| m =~ format_rx}.collect{|m| m.sub(format_rx, '')}).uniq.sort.join(', ')\n opts.separator format_names\n\n opts.separator ''\n opts.separator 'Known format shortcuts:'\n acc = []\n @configuration.methods.find_all{|m| m =~ /^shortcut_/}.sort.each do |meth|\n fn = meth.sub(/^shortcut_/, '')\n fs = @configuration.send(meth, acc)\n opts.separator \"#{fn}: #{fs.join(',')}\"\n end\n end\n @configuration.input *opts.parse!(args)\n self\n end", "def run\r\n wordlist = Wordlist.new(@cmd)\r\n @cmd[:wordlist] = wordlist\r\n generator = Generator.new\r\n\r\n wordlist.print_wordfiles if @cmd[:list]\r\n\r\n if @cmd[:generate]\r\n generator.gen_multi(@cmd)\r\n elsif @cmd[:acrostic]\r\n generator.gen_acrostic(@cmd)\r\n end\r\n\r\n if generator.pass\r\n @cmd[:password] = generator.pass\r\n Printer.new(@cmd)\r\n end\r\n end", "def run(argv = ARGV)\n parser.parse(argv)\n end", "def usage\n puts \"Usage examples:\n ./dump_from_db.rb --headers OUTDIR\n ^ Dumps headings only into the dir OUTDIR\n ./dump_from_db.rb OUTDIR -file INFILE\n ^ Dumps projects listed in INFILE \n (id only, one per line) to OUTDIR\n ./dump_from_db.rb OUTDIR -list 1000 1001 1002\n ^ Dumps projects 1000, 1001, etc to OUTDIR.\"\nend", "def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend", "def cli(*args)\n CLI.new(args.flatten, self).execute\n end", "def cli(*args)\n CLI.new(args.flatten, self).execute\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n output_options if @options.verbose\n process_arguments \n start\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end \n end", "def run(*args)\n if args.include?('--help')\n log.puts \"Usage: yard list [yardoc_options]\"\n log.puts \"Takes the same arguments as yardoc. See yardoc --help\"\n else\n Yardoc.run('-c', '--list', *args)\n end\n end", "def execute(_type)\n puts \"Features packaged: #{List.features}\" if List.cli.data[:verbose]\n list(List.features)\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\\\n\\\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end\n end", "def run\n begin\n raise TooManyArgumentsError.new(@arguments) if @arguments.length > 1\n \n print_version if @options.version?\n scan if @options.scan?\n rename_given_file unless @arguments.empty?\n run_gui if @arguments.empty?\n \n raise Error\n rescue => e\n puts e.to_s\n \n exit(1)\n end\n end", "def command(arguments, _options = nil)\n entry = nil\n Array(arguments).each do |team_name|\n team = Team.find team_name\n raise \"no such team #{team_name}\" unless team\n\n team.members.each { |employee| entry = add_entry(entry, employee, team, team_name) }\n end\n end", "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "def run\n unless parsed_options? && arguments_valid? \n output_usage and return\n end\n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def main\n if ARGV.empty?\n puts \"Usage: ruby #{File.basename($0)} EPUBFILE [EPUBFILE ...]\"\n exit 1\n end\n\n puts make_catalog(ARGV)\nend", "def run\n process_args\n announcements\n results = get_gem_list_info.map {|gem| gem.join(\",\")}.join(\"\\n\")\n IO.write(@output, results)\n end", "def run\n if @list_doc_dirs then\n puts @doc_dirs\n elsif @interactive then\n interactive\n elsif @names.empty? then\n @display.list_known_classes class_cache.keys.sort\n else\n @names.each do |name|\n display_name name\n end\n end\n rescue NotFoundError => e\n abort e.message\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\\\n\\\\n\" if @options.verbose\n\n process_arguments \n process_command\n \n puts \"\\\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n\n if parsed_options? && arguments_valid? \n\n puts \"Start at #{Time.new.to_s}\\n\\n\" if @options.verbose\n\n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n\n puts \"\\nFinished at #{Time.new.to_s}\" if @options.verbose\n\n else\n output_usage\n end\n\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\\n\\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n os \n process_command\n \n puts \"\\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def parse_command_line(args)\n all_opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{PROGRAM_NAME} [OPTIONS] PASSWORD\"\n opts.separator ''\n\n opts.on(\n '-t',\n '--load-timeout [TIMEOUT_SECONDS]',\n Integer,\n 'Timeout in seconds to wait for',\n 'gitlab-rails console to load',\n 'and process the change.',\n \"Defaults to #{DEFAULT_LOAD_TIMEOUT} seconds.\"\n ) do |timeout|\n @options.load_timeout = timeout\n end\n\n opts.on(\n '-v',\n '--verbose',\n 'Print out debug info when processing.'\n ) do\n @options.debug = true\n end\n\n opts.on(\n '-h',\n '--help',\n 'Help Message'\n ) do\n puts opts\n @options.help_requested = true\n end\n end\n\n all_opts.parse!(args)\n\n unless @options.help_requested\n fail('ERROR: You must specify the password to set') if (ARGV.length < 1)\n\n @options.password = ARGV[0]\n fail('ERROR: Password cannot be empty') if @options.password.strip.empty?\n end\n end", "def show(args)\n\tputs \"Result = #{args}\"\nend", "def run\n\n\t\tif parsed_options? && arguments_valid?\n\n\t\t puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n\t\t output_options if @options.verbose # [Optional]\n\n\t\t process_arguments\n\t\t process_command\n\n\t\t puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n\t\telse\n\t\t output_usage\n\t\tend\n\n\tend", "def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\" if @options.verbose\n output_options if @options.verbose # [Optional]\n process_arguments\n # add parameters\n args = {}\n # TODO: use correct syntax for set\n args[:verbose] = @options.verbose if @options.verbose\n args[:input] = @options.input if @options.input\n args[:output] = @options.output if @options.output\n args[:map_name] = @options.map_name if @options.map_name\n args[:not_installed] = @options.cwd if @options.cwd\n \n program = Guy.new args\n program.work\n puts \"Finished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end \n end", "def parse_arguments(args)\n Trollop::with_standard_exception_handling argument_parser do\n if args.empty? || args.include?('-h') || args.include?('--help')\n raise Trollop::HelpNeeded\n elsif args.include?('--examples')\n print_examples\n end\n argument_parser.parse args\n end\n end", "def main\n arg_parser=GetoptLong.new\n arg_parser.set_options(\n [\"-e\", \"--exclude\", GetoptLong::REQUIRED_ARGUMENT],\n [\"-i\", \"--include\", GetoptLong::REQUIRED_ARGUMENT],\n [\"-h\", \"--headers\", GetoptLong::NO_ARGUMENT],\n [\"-u\", \"--usage\", GetoptLong::NO_ARGUMENT])\n\n arg_parser.each do |opt, arg|\n begin\n case opt\n when \"-u\"\n usage()\n exit(0);\n when \"-h\"\n printHeader\n when \"-i\"\n $includes.push(arg)\n when \"-e\"\n $excludes.push(arg)\n end\n rescue => err; puts err; break;\n end\n end\n\n # after all args if we still don't have a directory then show usage\n if (ARGV.length != 1)\n usage();\n end\n\n # convert strings to regexs once, rather than during filtering loop\n $excludes.collect! {|str| Regexp.new(str)}\n $includes.collect! {|str| Regexp.new(str)}\n\n processTags(getFiles(ARGV.shift))\n return\nend", "def parse(args)\n opts = OptionParser.new\n opts.banner = usage\n\n descriptions.each do |text|\n opts.separator ' ' + text\n end\n\n set_options(opts)\n parse_options(opts, args)\n end", "def show(*args)\n puts send_cmd \"show #{OptArg.parse(*args)}\"\n end", "def run(*args)\n cli.run(*args)\n end", "def parse_command_line\n OptionParser.new do |opts|\n opts.banner = \"Usage: ruby #{$0} [options]\"\n\n opts.on_head(\"-h\", \"--help\", \"Show this help message\") do\n puts opts\n exit\n end\n\n opts.on(\"-v\", \"--verbose\", \"Show all progress messages (INFO, DEBUG, WARNING, ERROR)\") do\n Logger.verbose = true\n end\n\n opts.on(\"-q\", \"--quiet\", \"Only show WARNING and ERROR messages\") do\n Logger.quiet = true\n end\n\n opts.on(\"--console\", \"Open up a console to query the source via rbgccxml\") do\n @requesting_console = true\n end\n\n opts.on(\"--clean\", \"Force a complete clean and rebuild of this extension\") do\n @force_rebuild = true\n end\n\n end.parse!\n end", "def list _args\n \"list _args;\" \n end", "def call(*args)\n puts parser.help\n exit 1\n end", "def initialize(argv)\n $main_args, $sub_command, $sub_args = split_main_and_subcommand(argv, command_list)\n\n if $main_args.include? '--verbose'\n $logger.level = Logger::DEBUG\n end\n\n $logger.info(\"CLI Parsed Inputs: #{$main_args.inspect} #{$sub_command.inspect} #{$sub_args.inspect}\")\n end", "def execute(sub_argv)\n require 'rubygems'\n\n $logger.info \"GemList, sub_argv = #{sub_argv}\"\n\n options = {}\n\n # Parse the options\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio gem_list'\n end\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"GemList command: #{argv.inspect} #{options.inspect}\")\n\n unless argv == []\n $logger.error 'Extra arguments passed to the gem_list command. Please refer to the help documentation.'\n return 1\n end\n\n begin\n embedded = []\n user = []\n Gem::Specification.find_all.each do |spec|\n if spec.gem_dir.chars.first == ':'\n embedded << spec\n else\n user << spec\n end\n end\n\n embedded.each do |spec|\n safe_puts \"#{spec.name} (#{spec.version}) '#{spec.gem_dir}'\"\n end\n\n user.each do |spec|\n safe_puts \"#{spec.name} (#{spec.version}) '#{spec.gem_dir}'\"\n end\n\n rescue => e\n $logger.error \"Error listing gems: #{e.message} in #{e.backtrace.join(\"\\n\")}\"\n exit e.exit_code\n end\n\n 0\n end", "def main(args=[])\n if args.empty?\n puts @prog_list.keys.sort.join(\", \")\n else\n puts \"Game Lessons Launcher, Args = [#{args.join(\",\")}]\"\n require @prog_list[args[0]]\n end\n rescue GamesLessonNotFoundError\n puts \"The program #{args[0]} was not found.\"\n end", "def cli_parse\n @command = nil\n\n cli @argv,\n \"-R --rules\" => lambda{ @command = :list },\n \"-H --help\" => lambda{ @command = :help },\n \"-a --auto\" => method(:watch=),\n \"-f --fresh\" => method(:fresh!),\n \"-s --script\" => method(:script=),\n \"-D --debug\" => method(:debug!)\n end", "def run(page_size:10)\n @page_size = page_size\n user_input = ''\n select_item_type\n\n while true # do CLI Loop\n @start_index = @end_index + 1 # Advance to next page of listings.\n @start_index = 0 if @start_index == Classifieds::Listing.all.size # Go back to beginning if end is reached.\n\n begin # Command input loop\n @end_index = @start_index + @page_size-1 # if page size changes inside this loop, adjust end index.\n @end_index = Classifieds::Listing.all.size-1 if @end_index >= Classifieds::Listing.all.size\n\n Classifieds::Listing.print_summary(@item_class, @start_index, @end_index) if user_input != 'h' # Display a page of listings.\n user_input = Classifieds::CLI.prompt 'Command (or h for help): ' # Get user input.\n exit if !process_user_input(user_input) # Process user input.\n end until user_input == '' # then display next page of summaries.\n end # do CLI loop\n end", "def cmd(options={})\n arguments\n end", "def printUsage\n puts \"Usage: cities.rb City1 City2 City3 City4 City5\"\t \nend", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-v:\\tVerbose output\"\n puts \"-d:\\tDownload latest build but don't install\"\n puts \"-i:\\tDownload and install latest build\"\n puts \"-u:\\tUpdate application to latest build\"\n puts \"-l:\\tGet local build date for application\"\n puts \"-r:\\tGet remote build date for application\"\n puts \"-p:\\tGet URL of download for latest package\"\n puts \"-c:\\tCompare local and remote build dates\"\n puts \"-a:\\tShow available packages\"\n puts \"-g:\\tUpdate Gatekeeper and Quarantine information so application can run\"\n puts \"-z:\\tClean up temporary directory (delete files older than \"+$mtime+\" days)\"\n puts \"-Z:\\tRemove existing application\"\n puts \"-C:\\tRemove crash reporter file\"\n puts \"-P:\\tPerform post install\"\n puts \"-q:\\tQuit application\"\n puts \"-s:\\tStart application\"\n puts\nend", "def printUsage\n \n print \"usage -- main.rb <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - MD output (.out, .xyz)\\n\"\n \n end", "def initialize(argv=[])\n super()\n #@text = Text.new(STDOUT, STDERR, STDIN, config)\n @text ||= Megam::Text.new(STDOUT, STDERR, STDIN, config)\n command_name_words = self.class.snake_case_name.split('_')\n\n # Mixlib::CLI ignores the embedded name_args\n\n @name_args = parse_options(argv)\n\n @name_args.delete(command_name_words.join('-'))\n\n @name_args.reject! { |name_arg| command_name_words.delete(name_arg) }\n\n # meg node run_list add requires that we have extra logic to handle\n # the case that command name words could be joined by an underscore :/\n command_name_words = command_name_words.join('_')\n @name_args.reject! { |name_arg| command_name_words == name_arg }\n if config[:help]\n msg opt_parser\n exit 1\n end\n\n # copy Mixlib::CLI over so that it cab be configured in meg.rb\n # config file\n Meggy::Config[:verbosity] = config[:verbosity]\n end", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\texit\n\tend\nend", "def run\n if @list_doc_dirs then\n puts @doc_dirs\n elsif @list then\n list_known_classes @names\n elsif @server then\n start_server\n elsif @interactive or @names.empty? then\n interactive\n else\n display_names @names\n end\n rescue NotFoundError => e\n abort e.message\n end", "def run\n begin\n process_arguments\n rescue ArgumentError\n output_usage\n end\n end", "def run(*args)\n parse_arguments(*args)\n\n if use_cache\n Registry.load!\n elsif parse\n YARD.parse(files, excluded)\n Registry.save(use_cache) if save_yardoc\n end\n\n print_statistics\n print_undocumented_objects\n\n abort if fail_on_warning && log.warned\n end", "def run\n # ARGV = [\"FoodDB.txt\", \"DietLog.txt\"]\n if( ARGV.length != 2 )\n puts \"Usage: ruby main.rb FoodDB.txt DietLog.txt\"\n end\n\t\n db = FoodDB.new( ARGV[0] )\n log = Log.new( ARGV[1], db )\n \n puts \"Welcome to the Diet Manager!\"\n printOptions\n \n # use STDIN.gets because .gets defaults input from file (ARGV)\n while command = STDIN.gets.chomp!\n case command\n\twhen \"0\"\n printAll( db )\n\twhen \"1\"\n\t printName( db )\n\twhen \"2\"\n\t findPrefix( db )\n when \"3\"\n\t newFood( db )\n\twhen \"4\"\n\t newRecipe( db )\n\twhen \"5\"\n\t showLog( log )\n\twhen \"6\"\n\t showToday( log )\n\twhen \"7\"\n\t showDate( log )\n\twhen \"8\"\n\t logToday( db, log )\n\twhen \"9\"\n\t logDate( db, log )\n\twhen \"10\"\n\t logRemove( log )\n\twhen \"11\"\n\t save( db, log, ARGV[0], ARGV[1] )\n\twhen \"12\"\n quit( db, log, ARGV[0], ARGV[1] )\n else\n puts \"Invalid Command.\"\n\tend\n\tprintOptions\n end\nend", "def command_list\n # system(\"clear\")\n puts \"Welcome to the Google Books CLI! Please choose from the following options: \"\n\n puts \" s: Search for a book\"\n puts \" v: View Reading List\"\n puts \" q: Exit Program\"\n puts \"\"\n input = gets.chomp.downcase\n # controls user input\n case input\n when \"s\"\n safe_search\n when \"v\"\n view_reading_list\n when \"q\"\n quit_program\n else\n system(\"clear\")\n puts \"It looks like you have entered an invalid command. Lets try again.\"\n puts \"\"\n puts \"\"\n end\n command_list\n end", "def parse\n\t\t\tif ARGV.empty?\n\t\t\t\tprint_targets \"SYNTAX: tbm <targets>\\n\\nWhere <targets> is a comma-separated list of:\"\n\t\t\telsif ARGV == ['--version']\n\t\t\t\tputs \"Tunnel Boring Machine v#{VERSION}\"\n\t\t\telse\n\t\t\t\tparse_targets( ARGV )\n\t\t\tend\n\t\tend", "def cli(commandline_arguments)\n CLITest.new(BIN_P).run(commandline_arguments)\n end", "def execute(args)\n # Analyze arguments\n remaining_args = @options.parse(args)\n if @display_help\n puts @options\n elsif (remaining_args.size > 2)\n puts 'Please specify just 1 file to be loaded on startup.'\n puts @options\n else\n activate_log_debug(true) if @debug\n log_info 'Loading GUI libraries...'\n require 'gtk2'\n Gdk::Threads.init\n require 'ruby-serial'\n require 'filesrebuilder/Model/Data'\n require 'filesrebuilder/GUIFactory'\n require 'filesrebuilder/GUIcontroller'\n require 'filesrebuilder/_Gtk/_object'\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n gui_factory = GUIFactory.new\n gui_controller = GUIController.new(gui_factory)\n gui_factory.gui_controller = gui_controller\n Gtk::Settings.default.gtk_button_images = true\n log_info 'Executing application...'\n main_widget = gui_factory.new_widget('Main')\n gui_controller.set_main_widget(main_widget)\n main_widget.show\n gui_controller.run_callback_dirline_progress_bars\n gui_controller.load_from_file(remaining_args[0]) if (remaining_args.size == 1)\n Gtk.main\n log_info 'Quitting application...'\n end\n end", "def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: webby [options] target [target args]'\n\n opts.separator ''\n\n desired_opts = %[--describe --prereqs --tasks --trace]\n app.standard_rake_options.each do |options|\n next unless desired_opts.include?(options.first)\n opts.on(*options)\n end\n opts.on('-o', '--options [PATTERN]',\n 'Show configuration options (matching optional pattern), then exit.') { |value|\n @command = [:show_options, value]\n }\n\n opts.separator ''\n opts.separator 'autobuild options:'\n\n opts.on('--web-server', 'Start a local web server') {\n cmd_line_options[:use_web_server] = true\n }\n opts.on('--no-web-server', 'Do not start a local web server') {\n cmd_line_options[:use_web_server] = false\n }\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) do\n @stdout.puts opts\n exit\n end\n opts.on_tail( '--version', 'show version' ) do\n @stdout.puts \"Webby #{::Webby::VERSION}\"\n exit\n end\n\n opts.parse! args\n\n ARGV.replace Array(args.shift)\n args.delete_if do |arg|\n if %r/^[A-Z_]+=/ =~ arg\n ARGV << arg\n next true\n end\n false\n end\n\n args\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n process_arguments \n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n else\n output_usage\n end\n end", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-a:\\tProcess all PDFs\"\n puts \"-d:\\tSet PDF directory\"\n puts \"-f:\\tProcess a file\"\n puts \"-l:\\tList all pdf files\"\n puts \"-p:\\tSet product\"\n puts \"-r:\\tSet release\"\n puts \"-o:\\tOutput to file\"\n puts \"-t:\\tOutput in TXT mode\"\n puts \"-c:\\tOutput in CSV mode\"\n puts \"-x:\\tOutput in XLS mode\"\n puts \"-v:\\tVerbose mode\"\n puts\n return\nend", "def run\n\t\tif parsed_options? && arguments_valid?\n\t\t\toutput_options if @options[:verbose]\n\t\t\toutput_arguments if @options[:verbose]\n\t\t\tprocess_arguments\n\t\t\tprocess_command\n\t\telse\n\t\t\toutput_usage\n\t\tend\n\tend", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "def usage()\n puts \"Usage: ./ruby_views JSON_file\"\n exit\nend", "def print_usage\n puts \"Usage: \" + File.basename($0)\n puts \" \" + File.basename($0) + \" -n N (N number of random people)\"\n puts \" \" + File.basename($0) + \" -g N (Groups of N random people)\"\n puts \" \" + File.basename($0) + \" -G N (N Groups of random people)\"\nend", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search before a date\\n\", \n\t\tFile.basename(__FILE__), \"before\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search after a date\\n\", \n\t\tFile.basename(__FILE__), \"after\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search for emails sent \"+\n\t\t\"on a day of the week\\n\",\n\t\tFile.basename(__FILE__), \"--day\", \"[day]\"\n\t\texit\n\tend\nend", "def run(arguments)\n parse(arguments)\n configure\n execute\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 usage\n puts\n puts \"ruby bj_play.rb [OPTIONS]\"\n puts\n puts \" -c, --cash [integer]:\"\n puts \" set the player's starting cash\"\n puts\n puts \" -d, --debug:\"\n puts \" debug mode; shows deck and dealer hands\"\n puts\n puts \" -h, --help:\"\n puts \" show help\"\n puts\nend", "def run\n\n if parsed_options? && arguments_valid? && client_configured?\n\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n output_options if @options.verbose # [Optional]\n\n process_arguments\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n else\n output_usage\n end\n\n end", "def run\n if parsed_options? && arguments_valid?\n log \"Start at #{DateTime.now}\\n\"\n output_options\n\n process_arguments\n process_command\n log \"Finished at #{DateTime.now}\"\n else\n output_usage\n end\n end", "def run(argv = ARGV)\n #p [:argv, argv]\n begin\n # cheating\n if argv.include?('-h') or argv.include?('--help')\n puts help_text\n else\n app = from_argv(argv)\n app.run\n end\n rescue Exception => e\n if exit_status == 0\n exit_status 1\n end\n puts \"\\nERROR: #{e}\"\n ensure\n exit(exit_status)\n end\n end", "def run_argv\n first, *other = ARGV\n ARGV.clear\n case first\n when 'favs', \"f\"\n display_favorites\n when '-new', \"-n\"\n \n add_to_favorites(other.join(' '))\n puts \"#{other.join(' ')} has been added to the list\"\n process_favorites\n when '-today', '-t'\n raise StandardError, \"Currently offline, connect the internet to see todays activities - check if online '-online' '-o'\" if @alive == false\n display_today_activity_name\n when '-weekend', '-w'\n raise StandardError, \"Currently offline, connect the internet to see the weekends activities - check if online '-online' '-o'\" if @alive == false\n display_weekend_activity_name\n when '-all', '-a'\n raise StandardError, \"Currently offline, connect the internet to see the list of activities - check if online '-online' '-o'\" if @alive == false\n display_today_activity_name\n display_today_activity_name\n when '-online', '-o'\n puts @alive\n when '-help', '-h'\n puts \"-today, -t Displays todays activities\"\n puts \"-weekend, -w Displays weekend activities\"\n puts \"-all, -a Displays all activities\"\n puts \"-new, -n Add your own favourite\"\n puts \"-online, -o Checks internet connection\"\n else\n puts 'Not a valid argument!'\n end\n File.write(@file_path, @processed_favs.uniq.to_json) \n end", "def parse(args)\n actions,urls,queries,styles = [],[],[],[]\n \n OptionParser.new do |opts|\n opts.banner = \"Usage: rubium.rb [options]\"\n \n opts.on(\"-u x,y,z\", \"--[no-]url x,y,z\",\n Array, \"Comma delimited URL strings for which to navigate to\") { |u| urls = u }\n \n opts.on(\"-q x,y,z\", \"--[no-]query x,y,z\",\n Array, \"Comma delimited query strings specifying the DOM node to inspect\") { |q| queries = q }\n \n opts.on(\"-s x,y,z\", \"--[no-]style x,y,z\",\n Array, \"Comma delimited strings with the CSS style in inspect\") { |s| styles = s }\n\n opts.on_tail(\"-v\", \"--version\", \"Show version\") do\n puts \"@1321\"\n exit\n end\n \n end.parse!\n \n urls.each do |url|\n queries.each do |query|\n styles.each do |style|\n actions.push( @ref.new(url,query,style) )\n end\n end\n end\n \n return actions\n end", "def command_parse(argv)\n end", "def cli(commandline_arguments)\n CLITest.new(BINARY).run(commandline_arguments)\n end", "def main(argv)\n # override this; no default action in main\n end", "def start_point_ls\n help = [\n '',\n \"Use: #{me} start-point [OPTIONS] ls\",\n '',\n 'Lists the names of all cyber-dojo start-points',\n '',\n minitab + '--quiet Only display start-point names'\n ]\n\n if ARGV[2] == '--help'\n show help\n exit succeeded\n end\n\n # As of docker 1.12.0 there is no [--filter label=LABEL]\n # option on the [docker volume ls] command.\n # So I have to inspect all volumes.\n # Could be slow for lots of volumes.\n\n names = run(\"docker volume ls --quiet\").split\n names = names.select{ |name| cyber_dojo_volume?(name) }\n\n if ARGV[2] == '--quiet'\n names.each { |name| puts name }\n else\n\n unless ARGV[2].nil?\n STDERR.puts \"FAILED: unknown argument [#{ARGV[2]}]\"\n exit failed\n end\n\n types = names.map { |name| cyber_dojo_type(name) }\n urls = names.map { |name| cyber_dojo_label(name) }\n\n headings = { :name => 'NAME', :type => 'TYPE', :url => 'SRC' }\n\n gap = 3\n max_name = ([headings[:name]] + names).max_by(&:length).length + gap\n max_type = ([headings[:type]] + types).max_by(&:length).length + gap\n max_url = ([headings[:url ]] + urls ).max_by(&:length).length + gap\n\n spacer = lambda { |max,s| s + (space * (max - s.length)) }\n\n name = spacer.call(max_name, headings[:name])\n type = spacer.call(max_type, headings[:type])\n url = spacer.call(max_url , headings[:url ])\n unless names.empty?\n puts name + type + url\n end\n names.length.times do |n|\n name = spacer.call(max_name, names[n])\n type = spacer.call(max_type, types[n])\n url = spacer.call(max_url , urls[n])\n puts name + type + url\n end\n end\nend", "def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend", "def run\n # puts arguments_valid?\n if parsed_options?\n puts \"Start at #{DateTime.now}\" if verbose?\n\n output_options if verbose?\n\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if verbose?\n else\n puts 'The options passed are not valid!'\n end\n end", "def run(args)\n safely_mkdir(MAIN_DIR)\n safely_mkdir(MOD_DIR)\n safely_mkdir(PACK_DIR)\n\n return HELP_TEXT if args.include?('-h') || args.include?('--help')\n return VERSION if args.include?('-v') || args.include?('--version')\n\n case args[0]\n when 'help'\n return HELP_COMMANDS[args[1].to_sym] if HELP_COMMANDS.key?(args[1].to_sym)\n return HELP_TEXT\n when 'fetch'\n return CommandFetch.run(args[1])\n when 'manifest'\n return CommandFetch.install_manifest(args[1])\n when 'installmod'\n return CommandInstall.run_mod(args[1])\n when 'installpack'\n return CommandInstall.run_pack(args[1]).to_s # remove\n else\n end\n end", "def main\n VoteParser.vote_arg_count_validator ARGV\n input = VoteParser.init(ARGV[0], ARGV[1])\n # noinspection RubyMismatchedParameterType\n # @type [Hash{Symbol=>Integer,String,Hash{String}]\n processed_values = VoteParser.process_votes(input[:Votes], input[:TokenMapping])\n # noinspection RubyMismatchedParameterType\n election_report = OutputPrinter.vote_report(\n processed_values[:TotalVoterCount],\n input[:Cols],\n processed_values[:VoteCounts]\n )\n OutputPrinter.write_output(election_report, processed_values[:Warning], ARGV[2])\nend", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n if process_arguments == false\n return\n end\n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def listObjects _obj, _args\n \"_obj listObjects _args;\" \n end" ]
[ "0.69529134", "0.6587462", "0.6411123", "0.6406293", "0.64051896", "0.6287235", "0.62726074", "0.61937386", "0.61896104", "0.6184226", "0.614026", "0.6097653", "0.6094382", "0.60925066", "0.6060161", "0.6041509", "0.6038415", "0.60354155", "0.5993843", "0.5983719", "0.5981085", "0.5981085", "0.5981064", "0.5976679", "0.59759367", "0.5967887", "0.5962234", "0.5947776", "0.5927976", "0.5912323", "0.5905749", "0.5905749", "0.5905749", "0.5905749", "0.5905749", "0.5905749", "0.5875477", "0.58680487", "0.58632046", "0.58628136", "0.5857057", "0.585422", "0.5853211", "0.58490765", "0.58490616", "0.5846695", "0.5845434", "0.58375746", "0.5837119", "0.5826198", "0.5825002", "0.5818657", "0.5818641", "0.5787803", "0.5781114", "0.57782054", "0.5775704", "0.5772184", "0.5759007", "0.57571715", "0.5752697", "0.57491153", "0.57425755", "0.57407326", "0.5732729", "0.5727788", "0.57265544", "0.57230043", "0.5720633", "0.5716247", "0.5716039", "0.5710974", "0.5707094", "0.5705852", "0.5705556", "0.5698137", "0.56964856", "0.56861424", "0.56841683", "0.5682566", "0.56763357", "0.56756294", "0.56746453", "0.567458", "0.56725484", "0.5671575", "0.5663933", "0.5659557", "0.5644174", "0.56384397", "0.56329805", "0.56321156", "0.56319284", "0.5631513", "0.5626891", "0.56257975", "0.562503", "0.56248355", "0.56219625", "0.56151175" ]
0.6394929
5
Initialize a new entity Provide the entity's attributes as key/value pairs in +kwargs+. Any attributes you provide will be duplicated and frozen, so you need not worry about later modifications to any values passed in.
def initialize(**kwargs) assert_required_attributes(kwargs) assert_no_extra_attributes(kwargs) @attributes = Valuables::DeepFreeze.deep_freeze(kwargs) @hash = self.class.hash ^ @attributes.hash freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(attrs = {})\n instance = super()\n instance.load_attributes!\n instance.update(attrs)\n instance\n end", "def new_entity(options, &b)\n @entity_class.new(self, options, &b)\n end", "def initialize(*args)\n @args = args\n assign_attributes\n end", "def initialize(args = {})\n @attributes = {}\n args.each do |k, v|\n self.send :\"#{k.to_s}=\", v\n end\n\n end", "def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end", "def initialize(*args)\n @entity, @period, @project_id, @with_details, @engine_version, @mocked_data, @simulate_draft = *args\n end", "def create\n @entity = Entity.new(params[:databaseformalizer_entity])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize_properties_with_values_from_owner(entity)\n entity\n end", "def initialize(atts = nil)\n initialize_attributes\n self.update_attributes(atts || {})\n end", "def initialize(data={})\n if data.is_a?(Hash)\n @data = Hashie::Mash.new(data)\n elsif data.is_a?(Entity)\n @data = Hashie::Mash.new(data.data)\n else\n raise ArgumentError.new(\"data must be a Hash or Entity.\")\n end\n end", "def initialize(args)\n @attributes = args\n end", "def initialize(attrs={})\n from_hash(attrs)\n end", "def initialize(attrs = {})\n @attributes = {}.with_indifferent_access\n process(defaults.merge(attrs))\n @new_record = true if id.nil?\n generate_key\n end", "def initialize(attrs = {})\n super nil\n attrs.each_pair do |field, value|\n self[field] = value\n end\n end", "def initialize(atts = {})\n @attributes = {}\n @embedding = {}\n @_memo = {}\n update_attributes(model.defaults.merge(atts))\n end", "def new(attrs = {})\n obj = self.model.new\n attrs.each do |k,v|\n obj.send(\"#{k}=\", v)\n end\n obj\n end", "def initialize( attrs = {} )\n @attributes = self.class.__properties.merge( attrs ).with_indifferent_access\n end", "def initialize(*args)\n params = args[0]\n attribute_keys.each { |k| self.__send__(\"#{k}=\", params[k]) if params.key?(k) } if params\n end", "def initialize(*args)\n @attributes = HashWithIndifferentAccess[ self.class.attribute_names.zip([]) ]\n @attributes_cache = HashWithIndifferentAccess.new\n @previously_changed = HashWithIndifferentAccess.new\n @changed_attributes = HashWithIndifferentAccess.new\n super()\n end", "def initialize(attrs = {})\n if attrs.respond_to?(:with_indifferent_access)\n attrs = attrs.with_indifferent_access\n end\n @id = attrs.delete(:id)\n @_key = attrs.delete(:_key)\n @_value = attrs.delete(:_value)\n @_doc = attrs.delete(:_doc)\n @_meta = attrs.delete(:_meta)\n @_attributes = ::Hash.new do |h, k|\n default = self.class.attributes[k]\n h[k] = if default.respond_to?(:call)\n default.call\n else\n default\n end\n end\n update_attributes(@_doc || attrs)\n end", "def initialize_attributes(attributes); end", "def create(attrs = {})\n super(attrs)\n end", "def initialize(client, attributes = {})\n super()\n\n @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)\n @saved_attributes = ActiveSupport::HashWithIndifferentAccess.new\n self.id = @attributes.delete(:id)\n\n self.client = client\n\n mark_as_saved! if id.present?\n end", "def initialize new_attributes = {}\n _assign_attributes new_attributes\n end", "def initialize(params)\n @entity_type = params[\"entity_type\"]\n @params = params\n @params[:form_data] = {}\n @entity_config = nil\n end", "def initialize(attributes={})\n attributes.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n @attributes = attributes\n end", "def initialize attr={}\n super\n self.attributes = attr\n end", "def initialize(attributes = {})\n\t\tsuper # must allow the active record to initialize!\n\t\tattributes.each do |name, value|\n\t\t\tsend(\"#{name}=\", value)\n\t\tend\n\tend", "def initialize(params = {})\n self.attributes = params\n end", "def initialize *args\n @attributes = {}\n opts = args.last.is_a?(Hash) ? args.pop : {}\n each_with_index { |(name, _), i| send \"#{name}=\", args[i] } unless args.empty?\n opts.each { |name, value| send \"#{name}=\", value }\n end", "def initialize (attrs = {})\n @attributes = {}\n @json_attributes = {}\n self.attributes = attrs\n end", "def initialize(attrs={})\n load_attributes!(attrs)\n end", "def initialize(attrs = nil)\n @new_record = true\n @attributes ||= {}\n process_attributes(attrs) do\n yield(self) if block_given?\n end\n # run_callbacks(:initialize) unless _initialize_callbacks.empty?\n # raise ::TinyDyno::Errors::MissingHashKey.new(self.name) unless @hash_key.is_a?(Hash)\n end", "def initialize(attrs = {})\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n @attributes_before_type_cast ||= {}\n\n attrs_with_defaults = self.class.attributes.each_with_object({}) do |(attribute, options), res|\n if attrs.key?(attribute)\n res[attribute] = attrs[attribute]\n elsif options.key?(:default)\n res[attribute] = evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end", "def initialize(attrs={})\n attrs.each {|k,v| send(\"#{k}=\", v)}\n end", "def initialize(**attributes)\n @attr = {}\n attributes\n end", "def initialize(attributes={})\n self.class.attr_reader *attributes.keys\n @attributes = attributes.with_indifferent_access\n end", "def initialize(attrs = { })\n if attrs.present?\n attrs.each do |k, v|\n self.send(:\"#{k}=\", v)\n end\n end\n end", "def initialize(attributes={})\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end", "def initialize(attrs = {})\n # we need this hack for Rails 4.0 only\n # because `run_callbacks` calls `attributes` getter while it is still nil\n @attributes = {}\n\n run_callbacks :initialize do\n @new_record = true\n @attributes ||= {}\n @associations ||= {}\n\n self.class.attributes.each do |_, options|\n if options[:type].is_a?(Class) && options[:default]\n raise 'Dynamoid class-type fields do not support default values'\n end\n end\n\n attrs_with_defaults = {}\n self.class.attributes.each do |attribute, options|\n attrs_with_defaults[attribute] = if attrs.key?(attribute)\n attrs[attribute]\n elsif options.key?(:default)\n evaluate_default_value(options[:default])\n end\n end\n\n attrs_virtual = attrs.slice(*(attrs.keys - self.class.attributes.keys))\n\n load(attrs_with_defaults.merge(attrs_virtual))\n end\n end", "def from_hash(attrs)\n object = self.new\n \n attrs.each do |attribute, value|\n object.send(\"#{attribute}=\", value)\n end\n \n object\n end", "def initialize(attributes)\n attributes.each do |k,v|\n send(\"#{k}=\", v)\n end\n end", "def initialize(attributes)\n attributes.each do |k,v|\n send(\"#{k}=\", v)\n end\n end", "def initialize(attributes = {})\n attributes.each do |key, value|\n send \"#{key}=\", value\n end\n end", "def initialize(params={})super(params)\n # Define accessor and query methods for each attribute.\n attrs.each do |attribute|\n self.class.send :attr_accessor, attribute\n define_attr_query attribute\n end\n\n # Set instance variables and initialize @attributes with any\n # attribute values that were passed in the params hash.\n @attributes = {}\n params.each do |k,v|\n if attrs.include? k.to_s\n send(\"#{k}=\", v)\n @attributes[k] = v\n end\n end\n end", "def initialize(key, data={})\n \n @path = model.build_path(key)\n @metadata = {}\n \n # Store the properties defined in the model in the metadata\n properties.each do |property_name, property|\n @metadata.store(property.name, '')\n end\n \n # Assign the values\n self.attributes=(data)\n \n end", "def initialize(attributes)\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end", "def initialize(attributes = {})\n assign_attributes(attributes) if attributes\n\n super()\n end", "def initialize(attributes = {})\n super # must allow the active record to initialize!\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes = HashWithIndifferentAccess.new(attributes)\n attributes.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n end\n end", "def create(attrs)\n super(attrs)\n end", "def create(attrs)\n super(attrs)\n end", "def create(attrs)\n super(attrs)\n end", "def create(attrs)\n super(attrs)\n end", "def initialize(**args)\n args[:_id] = args[:id] if args[:id]\n\n if RUBY_PLATFORM == 'opal'\n args = args.symbolize_keys\n end\n\n # trace __FILE__, __LINE__, self, __method__, \" : args.class=#{args.class} args=#{args}\"\n # trace __FILE__, __LINE__, self, __method__, \" : attrs=#{self.class.attrs}\"\n @from_db = !!args.delete(:__from_db__)\n @deleted = false\n\n # set unique id if not already done so\n args[:_id] ||= uuid\n\n # collate any local_attr in args\n local_attrs = {}\n self.class.association_local_attrs.each do |attr|\n arg = args.delete(attr)\n local_attrs[attr] = arg if arg\n end\n\n # call super with remaining args\n super(**args)\n\n # now assign any local_attr\n local_attrs.each do |key, value|\n # use write method to ensure foreign_key set\n send(:\"#{key}=\", value)\n end\n\n # trace __FILE__, __LINE__, self, __method__\n\n # tidy up associations\n self.class.associations.each do |_type, associations|\n associations.each do | association |\n association.on_initialize(self)\n end\n end\n\n # trace __FILE__, __LINE__, self, __method__\n end", "def initialize(attributes = {}, persisted = false)\n # initialize embedded attributes\n attributes = attributes.with_indifferent_access\n attributes[:account] ||= {}\n super(attributes, persisted)\n end", "def initialize(kwargs = {})\n super({})\n DEFAULTS.merge(**kwargs).each { |k,v| self[k] = v }\n end", "def initialize(attributes = {})\n @attributes = attributes\n super @attributes.slice(*self.class.special_attrs).merge(data: @attributes.except(*self.class.special_attrs))\n end", "def initialize(attributes = {})\n attributes.each { |key, value| send(\"#{key}=\", value) }\n end", "def initialize(attributes = {})\n attributes.each { |key, value| send(\"#{key}=\", value) }\n end", "def initialize(attrs = {})\n attrs = attrs.dup.stringify_keys!\n @lon = attrs['lon'].to_f rescue nil\n @lat = attrs['lat'].to_f rescue nil\n super(attrs)\n end", "def initialize(json)\n @id = json[:id]\n @entity_id = json[:entity_id]\n @role_id = json[:role_id]\n @destroy = false\n end", "def initialize(obj, attributes = nil)\n @obj = obj\n @attributes = attributes || obj.to_h.keys\n end", "def initialize(attrs = {})\n self.attributes = {}\n attrs.each {|attribute, value| self.send(\"#{attribute}=\", value)}\n end", "def initialize(hash={})\n self.attributes = hash\n end", "def initialize(attributes)\n attributes.each do |k,v|\n send(\"#{k}=\", v) if respond_to?(\"#{k}=\")\n end\n end", "def initialize (attributes)\n attributes.each do |key, value|\n self.send((\"#{key}=\"), value)\n end\n end", "def initialize(attributes = {})\r\n super # initialize active record.\r\n\r\n attributes.each do |name, value|\r\n send(\"#{name}=\", value)\r\n end\r\n end", "def initialize(attributes = {})\r\n super # initialize active record.\r\n\r\n attributes.each do |name, value|\r\n send(\"#{name}=\", value)\r\n end\r\n end", "def initialize(attributes = {})\r\n super # initialize active record.\r\n\r\n attributes.each do |name, value|\r\n send(\"#{name}=\", value)\r\n end\r\n end", "def initialize(args={})\n # could have problem where everything blank, or you could make save fail if not have an attribute\n #? formatting below?\n @name = args[:name] || \"\"\n @cuisine = args[:cuisine] || \"\"\n @price = args[:price] || \"\"\n end", "def build(properties = {})\n entity = self.class.entity_class.new(:session => session)\n\n entity.update_properties(properties)\n entity.partial = false\n\n self.append(entity)\n initialize_properties_with_values_from_owner(entity)\n\n entity\n end", "def initialize(attributes = {})\n# puts attributes\n attributes = attributes.reduce({}){ |hash, (k, v)|\n key = k.to_s.underscore\n hash = hash.merge( key => v ) if @@fields.find_index(key.to_sym)\n hash\n }\n HashWithIndifferentAccess.new(attributes)\n attributes.each do |k,v|\n self.send (k + '=').to_sym, v # grazie, DM\n end\n super\n raise ArgumentError.new(\"Citation ID can't be nil\") if self.citation_id.nil?\n raise ArgumentError.new(\"Citation type can't be nil. CitationID: #{self.citation_id}\") if self.citation_type.nil?\n raise ArgumentError.new(\"Citation type must be JOURNAL or NON JOURNAL. CitationID: #{self.citation_id}\") if self.citation_type != \"JOURNAL\" && self.citation_type != \"NON_JOURNAL\"\n raise ArgumentError.new(\"Citation must have a title. CitationID: #{self.citation_id}\") if self.title.nil?\n end", "def initialize(attrs = {})\n @id = attrs[:id]\n @title = attrs[:title]\n @body = attrs[:body]\n @user_id = attrs[:user_id]\n end", "def initialize(attributes = {})\n attributes ||= {}\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize *args\n if args.first.is_a?(Hash) && (house_attrs=(args.first[:house] || args.first[:house_attributes])).is_a?(Hash)\n street = if house_attrs[:street_id]\n Street.find house_attrs[:street_id]\n elsif house_attrs[:street]\n Street.find_by_name house_attrs[:street]\n else\n nil\n end\n\n house = if street\n House.find_or_initialize_by_street_id_and_number(\n street.id,\n house_attrs[:number]\n )\n else\n House.new(\n :number => house_attrs[:number]\n )\n end\n\n args[0] = args.first.dup\n args.first[:house] = house\n args.first.delete :house_attributes\n end\n super(*args)\n end", "def initialize *args\n if respond_to? :before_init\n warn 'before_init is deprecated. please define process_init_args class method'\n else\n hash = self.class.process_init_args(*args)\n end\n\n unless hash && hash.kind_of?(Hash)\n raise ArgumentError, \"#{hash.inspect} was wrong as arguments. please specify kind of Hash instance\"\n end\n\n # allow String or Symbol for key\n tmp_hash = {}\n hash.each do |key,val|\n tmp_hash[key.to_s] = val\n end\n hash = tmp_hash\n\n hash.each do |key, val|\n if attribute_of[key]\n attribute_of[key].set val\n end\n end\n\n attribute_of.each do |key, val|\n next if val.class.lazy?\n raise AttrRequiredError, \"param: :#{key} is required to #{hash.inspect}\" if !val.class.optional? && !val.get\n end\n\n after_init\n end", "def new(&block)\n assign_attributes if params[model_identifier]\n respond_with(entry, &block)\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes={})\n attributes.each do |name, value|\n send(\"#{name}=\", value)\n end\n end", "def initialize(attributes = {})\n attributes.each_pair do |k, v|\n send(\"#{k}=\", v) if PARAMETER_MAPPING.key?(k)\n end\n end", "def initialize(*attrs)\n # Sets all attributes as instance variables from the params (note this could also be done easily by using an OpenStruct)\n ATTRS.each do |key|\n instance_variable_set(\"@#{key}\", attrs.first[key])\n end\n end", "def initialize(*args)\n\t\t\t\t\tself.track_changed_attributes = true\n\t\t\t\t\tself.changed_attributes_aado = []\n\n\t\t\t\t\tsuper(*args)\n\t\t\t\t\t\n\t\t\t\t\trequire \"obdb/AR_DatabaseObject\"\t# its here because of a circular reference problem\n\t\t\t\t\tself.database_object = DatabaseObject.create_do(self.class, self.id, self)\n\t\t\t\tend", "def initialize(attrs={})\n @attrs = attrs\n end", "def initialize(attrs={})\n @attrs = attrs\n end", "def initialize(attrs = nil)\n preinitialize(attrs)\n @attributes = attributes_from_column_definition\n self.attributes = attrs unless attrs.nil?\n end", "def initialize(args)\n if args.length == 1 then\n # assume the json object was passed\n setup_attributes(args[0])\n else\n # otherwise assume normal construction according to the order for the json attributes \n self.class.json_attributes.each_with_index do |attribute, i|\n underscored = attribute.to_s.underscore\n raise ArgumentError(\"You must pass #{attribute} as argument #{i+1}\") if self.class.json_attributes.length <= i \n self.send(\"#{underscored}=\", args[i])\n end\n end\n end", "def entity=newe\n if newe # Propogate the entity's identifying info to the rest of the item\n self.id = newe.id\n self.klass = newe.class\n end\n @entity = newe\n end", "def initialize(attributes = {})\n attributes.each_pair do |field, value|\n __send__(field.__setter__, value)\n end\n end", "def initialize(attributes={})\n super\n end", "def initialize(attributes={})\n super\n end", "def initialize(attributes={})\n super\n end", "def initialize(attrs = {})\n load_attributes(attrs)\n load_properties(attrs)\n end", "def initialize(*args)\n args.each do |arg|\n if arg.kind_of? Hash\n arg.each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end\n end\n end", "def create(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.id = self.class.rpc_execute('create', vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def initialize(attributes = nil)\n assign_attributes(attributes)\n super()\n end", "def initialize(attrs={})\n @attrs = attrs || {}\n end" ]
[ "0.6690786", "0.6681181", "0.647689", "0.63971376", "0.6360924", "0.63492763", "0.6345636", "0.63408333", "0.63069004", "0.62994134", "0.625711", "0.6253319", "0.6234773", "0.6233987", "0.62219816", "0.62080634", "0.61976314", "0.61968935", "0.6192983", "0.61902946", "0.61750996", "0.61564577", "0.6128354", "0.612187", "0.6118332", "0.6101169", "0.609707", "0.60819143", "0.60784125", "0.60695493", "0.6061314", "0.60534966", "0.6019746", "0.6013876", "0.60095704", "0.60052884", "0.600106", "0.5995613", "0.59889346", "0.5987922", "0.5986362", "0.5958446", "0.5958446", "0.595685", "0.59523034", "0.59507275", "0.5950419", "0.5949471", "0.5938853", "0.5937878", "0.5928781", "0.5928781", "0.5928781", "0.5928781", "0.5918423", "0.5909017", "0.5897445", "0.58954054", "0.58775145", "0.58775145", "0.5877222", "0.5875404", "0.58708376", "0.5869738", "0.5864971", "0.5862285", "0.58611214", "0.5854562", "0.5854562", "0.5854562", "0.58541644", "0.58523124", "0.58501196", "0.5840327", "0.5839023", "0.5837493", "0.583585", "0.58344936", "0.58312106", "0.58312106", "0.58312106", "0.58312106", "0.5830094", "0.5828688", "0.58231395", "0.5820723", "0.58204854", "0.58204854", "0.58188325", "0.58159053", "0.58139324", "0.58134586", "0.5810446", "0.5810446", "0.5810446", "0.580974", "0.58072317", "0.5805911", "0.58052343", "0.5805048" ]
0.64567107
3
Compare two objects Two entities are considered equal if they are instances of the same class and their internal attributes are equal.
def ==(other) self.class == other.class && attributes == other.attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end", "def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end", "def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end", "def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end", "def ==(other)\n attributes == other.attributes\n end", "def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end", "def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end", "def eql?(other)\n self.class == other.class && self.id == other.id\n end", "def ==(other)\n other.present? && self.attributes == other.attributes\n end", "def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end", "def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n self.id == other.id\n end", "def ==(other)\n self.class == other.class &&\n self.id == other.id\n end", "def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end", "def ==(other)\n self.id == other.id && self.class == other.class\n end", "def == other\n self.object_id == other.object_id\n end", "def objects_equal?(other)\n other.is_a?(Linkage::MetaObject) && other.object == self.object\n end", "def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end", "def ==(other)\n self.class==other.class && self.hash==other.hash\n end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def eql?(other) self.class == other.class and target==other.target and source==other.source; end", "def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end", "def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end", "def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end", "def ==(other)\n if self.class.attribute_names.include?('id')\n if other.is_a?(::Numeric)\n id == other\n elsif other.class == self.class\n id == other.id\n else\n false\n end\n else\n self.inspect == other.inspect\n end\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def ==(other)\n @klass == other.klass && @version == other.version && @timestamp == other.timestamp\n end", "def ==(other)\n self.class == other.class\n end", "def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end", "def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n ova = other.instance_variables\n iv = instance_variables\n return false if ova.size != iv.size\n iv.each do |vid|\n return false if instance_variable_get(vid) != other.instance_variable_get(vid)\n end\n true\n end", "def ==(other)\n other.kind_of?(model) &&\n __persist_attributes == other.__persist_attributes &&\n other.attributes[model.__parent_key] == @attributes[model.__parent_key]\n end", "def == other\n self.class == other.class && self.name == other.name\n end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end", "def ===(other)\n self.object_id == other.object_id\n end", "def ==(other)\n self.class == other.class && id == other.id\n end", "def ==(other)\n self.class == other.class and\n self.name == other.name\n end", "def eql?(other)\n self.class === other and @version == other._version\n end", "def eql?(other)\n self.class === other and @version == other._version\n end", "def == (other)\n return true if self.equal?(other)\n return false if self.class != other.class\n self.class.fields.all? { |f| self.field_get(f) == other.field_get(f) }\n end", "def eql?(other)\n self.class === other and @version == other.version\n end", "def ==(other)\n self.class == other.class\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 ==(other)\n super\n end", "def ==(other)\n super\n end", "def eql? other\n self.class === other and @version == other.version\n end", "def eql?(other)\n return false unless self.class.eql?(other.class)\n instance_variables.map do |var|\n instance_variable_get(var).eql?(other.instance_variable_get(var))\n end.all?\n end", "def eql?( other )\n\t\treturn false unless other.class.eql?( self.class )\n\t\treturn self.hash == other.hash\n\tend", "def ==(other)\n return false unless other.is_a?(Entity)\n self.id == other.id\n end", "def object_equal(obj1, obj2)\n vars1 = obj1.instance_variables\n vars2 = obj2.instance_variables\n return false unless vars1.length == vars2.length\n # if they don't have exactly the same instance_variables names then return false\n return false unless vars1.map(&:to_s).sort.to_s == vars2.map(&:to_s).sort.to_s\n\n equal = true\n some(vars1, proc { |v|\n val1 = obj1.instance_variable_get(v)\n val2 = obj2.instance_variable_get(v)\n if val1 != val2\n equal = false\n true\n else\n false\n end\n })\n equal\nend", "def objects_equal?(x, y)\n if x.nil?\n y.nil?\n elsif y.nil?\n nil\n elsif x.is_a?(Hash)\n return nil unless y.is_a?(Hash)\n return nil unless x.size == y.size\n x.each do|k, v|\n return nil unless objects_equal?(v, y[k])\n end\n true\n elsif x.is_a?(Array)\n return nil unless y.is_a?(Array)\n return nil unless x.size == y.size\n for i in 0..x.size\n return nil unless objects_equal?(x[i], y[i])\n end\n true\n else\n return nil if y.is_a?(Hash) || y.is_a?(Array)\n x == y\n end\n end", "def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end", "def ==(other)\n super\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def == other\n self.id == other.id\n end", "def ==(other)\n return false unless other.is_a?(Document)\n @attributes.except(:modified_at).except(:created_at) ==\n other.attributes.except(:modified_at).except(:created_at)\n end", "def eql?(other)\n self.class.eql?(other.class) &&\n self._name.eql?(other._name) &&\n self._type.eql?(other._type) &&\n self._klass.eql?(other._klass)\n end", "def ==(other)\n return true if equal?(other)\n return false if kind_of_inverse?(other)\n other.respond_to?(:cmp_repository?, true) &&\n other.respond_to?(:cmp_model?, true) &&\n other.respond_to?(:cmp_key?, true) &&\n other.respond_to?(:query) &&\n cmp?(other, :==)\n end", "def eql?(other)\n self.class == other.class and self == other\n end", "def ==(other)\n other.kind_of?(model) && other.hash == hash\n end", "def ==(other)\n other.is_a?(self.class) &&\n self.id == other.id &&\n self.storage_key == other.storage_key\n end", "def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end", "def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end", "def ==(other)\n return false if self.class != other.class\n fields.all? do |field|\n name = field[:name]\n instance_variable_get(name) ==\n other.instance_variable_get(name)\n end\n end", "def eql?(other)\n self.class.eql?(other.class) &&\n @primary_keys == other.primary_keys &&\n @columns == other.columns &&\n @with == other.with\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 ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\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 eql?(other)\n self.class == other.class && self == other\n end", "def equal?(other)\n object_id == other.object_id\n end", "def ==(other)\n if equal?(other)\n return true\n end\n\n unless other.respond_to?(:model) && other.respond_to?(:name)\n return false\n end\n\n cmp?(other, :==)\n end", "def eql?(other)\n super\n end", "def eql?(other)\n super\n end", "def ==(other)\n self.to_hash == other.to_hash\n end", "def ==(other)\n a = to_h\n b = other.to_h\n a.delete(:_id)\n b.delete(:_id)\n a == b\n end", "def eql?(other)\n return self.instance_variables.all?{ |v|\n self.instance_variable_get(v).hash == other.instance_variable_get(v).hash\n }\n end", "def ==(other)\n return false unless other.class == self.class\n\n to_h == other.to_h\n end", "def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end", "def ==(other)\n [:id, :type, :name, :votes, :duration, :rating, :release_date, :genres, :plot, :under_development].all? do |m|\n other.respond_to?(m) && self.public_send(m) == other.public_send(m)\n end\n end", "def ==(other); false; end", "def eql?(other)\n other.is_a?(Resource) && entity.eql?(other.entity)\n end", "def eql?(other)\n instance_of?(other.class) && id.eql?(other.id)\n end", "def ==(other)\n other = self.class.new(other) unless other.class == self.class\n normalized == other.normalized\n end", "def ==(other)\n if equal?(other)\n return true\n end\n\n unless [ :repository, :model, :fields, :links, :conditions, :order, :offset, :limit, :reload?, :unique?, :add_reversed? ].all? { |method| other.respond_to?(method) }\n return false\n end\n\n cmp?(other, :==)\n end", "def ==(other); [TrueClass,FalseClass]; end", "def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end", "def eql? other\n object_id == other.object_id || \n (self.class == other.class &&\n specification == other.specification && \n candidate_types == other.candidate_types && \n candidate_types_excluded == other.candidate_types_excluded && \n candidate_objects == other.candidate_objects && \n join_points_matched == other.join_points_matched &&\n join_points_not_matched == other.join_points_not_matched)\n end", "def ==(another_instance)\n self._id && self._id == another_instance._id\n end", "def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end", "def eql?(other)\n (other.kind_of?(self.class) && !self.id.nil? && self.id == other.id)\n end", "def ==(other)\r\n self.id == other.id\r\n end", "def eql?(other)\r\n other.class == self.class && other.hash == self.hash && _eql?(other)\r\n end", "def ==(other)\n if equal?(other)\n return true\n end\n\n unless other.respond_to?(:name)\n return false\n end\n\n unless other.respond_to?(:options)\n return false\n end\n\n unless other.respond_to?(:resource_naming_convention)\n return false\n end\n\n unless other.respond_to?(:field_naming_convention)\n return false\n end\n\n cmp?(other, :==)\n end", "def ==(other)\n self.class == other.class &&\n name == other.name &&\n age == other.age &&\n gender == other.gender &&\n species == other.species &&\n toys == other.toys\n end" ]
[ "0.75393826", "0.75390065", "0.74138546", "0.72987914", "0.7130778", "0.71167606", "0.7114481", "0.70684105", "0.70654154", "0.7048141", "0.7005528", "0.69997495", "0.69993824", "0.69993824", "0.699171", "0.69691557", "0.695095", "0.6949943", "0.6941152", "0.6933629", "0.6930033", "0.6930033", "0.6883376", "0.6883094", "0.6878448", "0.68301255", "0.68124074", "0.6809018", "0.6800612", "0.67723626", "0.6770849", "0.6768172", "0.6746078", "0.6711923", "0.6711229", "0.6710724", "0.67041147", "0.66919214", "0.6682985", "0.6682985", "0.66759586", "0.66742915", "0.6661319", "0.6661189", "0.666046", "0.666046", "0.66578317", "0.66377974", "0.6637379", "0.663518", "0.6630374", "0.6627073", "0.66213626", "0.66111314", "0.6610757", "0.6610757", "0.6610757", "0.6608522", "0.6608156", "0.66033345", "0.6596081", "0.65943456", "0.65901864", "0.6585778", "0.65799737", "0.6576073", "0.6573065", "0.6563523", "0.65627", "0.65627", "0.65627", "0.65627", "0.655659", "0.6550814", "0.65374684", "0.65256935", "0.6524708", "0.6516276", "0.6516276", "0.65130025", "0.6511839", "0.65019673", "0.64833957", "0.64778924", "0.64760995", "0.6470223", "0.64670265", "0.6460031", "0.64578646", "0.64573836", "0.6448275", "0.6444797", "0.6439362", "0.6438253", "0.6434852", "0.64306056", "0.6427756", "0.64257765", "0.64252317", "0.6422131" ]
0.73919934
3
Get a Hash representation of this entity.
def to_h @attributes.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n to_h.hash ^ self.class.hash\n end", "def to_hash\n @hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def to_hash\n @hash\n end", "def to_hash\n @hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_a.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n data.hash\n end", "def hash\n self.respond_to?(:id) && self.id ? self.id.to_i : self.to_hash.hash\n end", "def hash\n id.hash\n end", "def hash\n\n self.h.fei.hash\n end", "def to_hash\n @_hash_\n end", "def hash\n @hash.hash\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def hash\n model.hash + key.hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n @id.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def to_h\n @hash.dup\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def to_h\n Hash[ self ]\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n guid.hash\n end", "def to_hash\n return self\n end", "def hash\n return @id.hash\n end", "def to_hash() end", "def hash\n @value.hash\n end", "def to_h\n @hash\n end", "def to_h\n @hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n [self.class, to_s].hash\n end", "def as_hash\n @hash\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def to_h\n @hash.dup\n end", "def hash\n value_id.hash\n end", "def hash\n bytes.hash\n end", "def hash\n @hash\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def to_hash\n to_a.hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n [self.class, to_s].hash\n end", "def hash\n @hash || calculate_hash!\n end", "def to_h\n @_hash.dup\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id\n end", "def hash\n address.hash\n end", "def hash\n @orig.hash\n end", "def hash\n @orig.hash\n end", "def hash\n @orig.hash\n end", "def hash\n return @revision.hash if @revision\n return object_id\n end", "def hash\n\t\tvalue.hash\n\tend", "def to_hash\n @hash.dup\n end", "def hash\n value.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def to_hash\n object\n end", "def to_hash\n @data.to_hash\n end", "def hash\n self.state.hash\n end", "def to_hash()\n @data\n end", "def hash\n @id\n end", "def to_hash\n @data\n end", "def hash\n @__set.to_a.hash\n end", "def hash\n state.hash\n end", "def hash\n state.hash\n end", "def hash\n self.class.name.hash\n end", "def to_hash\n @data\n end", "def hash\n element.hash\n end", "def to_h\n\n @h\n end", "def hash\n\t\t[@id].hash\n\tend", "def hash\n @table.hash\n end", "def hash\n @id\n end", "def hash\n [self[0], self[1]].hash\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n\t\treturn [ self.class, self.dn ].hash\n\tend", "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def to_hash\n @content.to_hash\n end", "def hash\n dn.hash\n end", "def to_hash\n Hash[self]\n end" ]
[ "0.73462594", "0.7314015", "0.7289408", "0.7273738", "0.7247071", "0.7247071", "0.7187254", "0.7167623", "0.71173775", "0.71070355", "0.7053994", "0.70317984", "0.7020842", "0.70050204", "0.70035464", "0.6988443", "0.690898", "0.69039774", "0.6900695", "0.6895311", "0.6895311", "0.6895311", "0.6893169", "0.68890643", "0.6873852", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.68677545", "0.6867718", "0.6857769", "0.68537295", "0.68537295", "0.68537295", "0.68507004", "0.68437517", "0.68429613", "0.6837462", "0.6825691", "0.6811109", "0.6809414", "0.6809414", "0.67875546", "0.6771512", "0.6757218", "0.67485625", "0.67430043", "0.6734943", "0.672226", "0.67160136", "0.6672265", "0.6649741", "0.66470855", "0.66470855", "0.66443855", "0.6621092", "0.6605501", "0.65999246", "0.6598746", "0.6598746", "0.6597894", "0.6593794", "0.6587164", "0.6587164", "0.6587164", "0.6583501", "0.6580753", "0.6563614", "0.6554763", "0.65455914", "0.65455914", "0.65455914", "0.65408546", "0.6520158", "0.6508222", "0.6506448", "0.6501032", "0.6496043", "0.64950645", "0.64845043", "0.64845043", "0.6469083", "0.6468077", "0.64583904", "0.6452918", "0.6434804", "0.64174753", "0.64133054", "0.64041966", "0.63934124", "0.6388347", "0.63877004", "0.63877004", "0.638684", "0.63764495", "0.6375918" ]
0.0
-1
def set_defaults self.badge ||= " end we can call the concern here
def set_defaults self.badge ||= Placeholder.image_generator(height: '150', width: '150') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n self.badge ||= Placeholder.image_generator(height: '250', width: '250') \n end", "def defaults!\n @badge_enabled = true\n @badge_position = 'top-left'\n @page_size = 25\n @webpacker_enabled = true\n end", "def set_default_values_skill\n self.badge ||= Placeholder.image_generator(height: 250, width: 250) # self.=> is similar to 'this' keyword. referencing this specific skill.\n #if main_image is nil put my default value else put users inputted image value\n #setting default values for images\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def badge; end", "def set_defaults\n end", "def set_defaults\n end", "def default_values!\n self.name ||= 'DEFAULT ACHIEVEMENT'\n self.description ||= 'This is a default achievement.'\n end", "def default_values\n self.hearts_count = 1\n end", "def set_default\n end", "def for_badge(badge); end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def defaults!; end", "def defaults!; end", "def set_defaults\n super\n self.extended_useful_life_months ||= 0\n self.extended_useful_life_miles ||= 0\n end", "def set_defaults\n self.featured ||= 1\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def default!\n self.severity = :DEFAULT\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def defaults\n super\n end", "def required_defaults; end", "def set_defaults\n super\n self.seating_capacity ||= 0\n self.standing_capacity ||= 0\n self.wheelchair_capacity ||= 0\n end", "def set_option_default(option)\n\t\tvalue = nil\n\t\tcase option\n\t\twhen 'badge'\n\t\t\tvalue = 1\n\t\telse\n\t\t\traise \"Option not supported: #{option_name}\"\n\t\tend\n\t\tdebug_log \"Setting default for option: #{option}\"\n\t\tset_option(option, value)\n\tend", "def set_defaults\n self.notification_id ||= Thrive::Util::Uuid.generate\n self.state = 'new' unless state\n end", "def set_defaults\n super\n self.replacement_status_type ||= ReplacementStatusType.find_by(:name => \"By Policy\")\n end", "def set_defaults\n #self.required_by_manufacturer ||= true\n end", "def badges\n end", "def set_defaults\n self.balance ||= 0\n end", "def default_values\n self.communication_email ||= self.email\n end", "def set_defaults\n self.availability ||=false\n self.email ||= @profile.user.email\n end", "def default_values\n self.subtype ||= \"registered\"\n self.status ||= \"NEW\"\n end", "def set_defaults\n self.active ||= true\n end", "def set_default_values\n self.eligibility_counter = 0\n self.posts_count = 0\n end", "def set_defaults\n self.issue_status_type_id ||= 1\n end", "def set_defaults\n\t\tself.main_image ||= PlaceholderConcern.image_generator(height: '200', width: '300')\n self.sport_icon ||= PlaceholderConcern.image_generator(height: '40', width: '40')\n\tend", "def defaults\n self.status ||= UNKNOWN\n end", "def default_values\n \t self.status ||= '0'\n \tend", "def set_defaults\n # should set the default based on category\n if self.fta_asset_category.try(:name) == 'Facilities'\n self.useful_life_benchmark ||= 3\n self.useful_life_benchmark_unit ||= 'condition_rating'\n elsif self.fta_asset_category.try(:name) != 'Infrastructure'\n self.useful_life_benchmark ||= self.asset_level.try(:default_useful_life_benchmark)\n self.useful_life_benchmark_unit ||= self.asset_level.try(:useful_life_benchmark_unit)\n end\n\n self.useful_life_benchmark_locked = self.useful_life_benchmark_locked.nil? ? false : self.useful_life_benchmark_locked\n\n if self.fta_asset_category.try(:name) == 'Infrastructure'\n self.pcnt_goal ||= 10\n else\n self.pcnt_goal ||= 0\n end\n\n self.pcnt_goal_locked = self.pcnt_goal_locked.nil? ? false : self.pcnt_goal_locked\n\n end", "def set_defaults\n self.verified = true\n end", "def set_defaults\n self.active ||= false\n end", "def set_defaults\n self.country ||= 'Sverige'\n end", "def set_default_attributes\n self.quantity = 1\n\n case self.purchasable.class\n when Package\n self.description = \"Upgrade package to #{self.purchasable.name}\"\n # Hitung kekurangan dari paket sebelumnya\n old_package = self.invoice.contest_upgrade.old_package\n new_package = self.invoice.contest_upgrade.new_package\n price = new_package.calculate_sell_price - old_package.calculate_sell_price\n self.upgrade_price = price\n self.transaction_fee = 300000\n when Feature\n self.description = \"Upgrade feature to #{self.purchasable.name}\"\n if !self.free_upgrade\n self.upgrade_price = self.purchasable.price\n else\n self.upgrade_price = 0\n end\n end\n\n end", "def default!(defaults = {})\n replace(defaults.merge(self))\n end", "def default\n end", "def set_default_options\n end", "def default_data\n end", "def defaults\n self.leaver ||= 0\n end", "def badge_level_up \n\t\tbadge_level_up_aux(\"Commenter\",\"commenter\",\"comments\")\n\tend", "def default_values\n if self.status.nil?\n self.status = 1\n end\n end", "def method_missing(*args)\n default\n end", "def default; end", "def default; end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n self.extra_bonus_exp ||= 0\n end", "def set_defaults\n self.condition_estimation_type_id ||= 1\n self.condition_threshold ||= 2.5\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def default_options; end", "def default_options; end", "def default_options; end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_defaults\n self.rate ||= 0\n end", "def set_defaults\n self.state ||= 'ACTIVE'\n self.account_user_id ||= Gizmo::Util::Uuid.generate\n self.is_owner ||= false\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n self.show_in_dashboard = self.show_in_dashboard.nil? ? true : self.show_in_dashboard\n self.system_activity = self.system_activity.nil? ? false : self.system_activity\n self.frequency_quantity ||= 1\n end", "def with_defaults(defaults); end", "def set_defaults\n self.annual_inflation_rate ||= 1.1\n self.pcnt_residual_value ||= 0\n self.condition_rollup_weight ||= 0\n end", "def badge_level_up\n\t\tbadge_level_up_aux(\"Birdman\",\"bird\",\"following\",\"follower\") #devo passare il parametro follower poichè non si chiama \"user\" come negli altri casi di badges\n\tend", "def set_defaults\n super\n self.indian_tribe ||= false\n end", "def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def set_badge\n @badge = Badge.friendly.find(params[:id])\n authorize @badge\n end", "def default_options; {} end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def defaults\n self.class.defaults #.merge(@defaults || {})\n end", "def default_values\n if self.code.blank?\n self.code = get_unique_pmu_code\n self.confirmed = false\n end\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def defaults\n self.behaviour_evaluated = false if self.behaviour_evaluated.nil?\n self.special_needs_ok = false if self.special_needs_ok.nil?\n self.long_term_resident = false if self.long_term_resident.nil?\n self.senior = false if self.senior.nil?\n end", "def set_defaults\n self.why_text ||= \"\"\n self.why_source ||= \"\"\n end", "def default_values #to set the status as pending and creation date as defaults \n\tif (self.status).nil?\n\t\tself.status ||= \"Pending\"\n\t\tself.application_date = Date.today\n\tend\nend", "def check_default metric;\n @check_default = metric\n end", "def default=(_); end" ]
[ "0.7531255", "0.7097636", "0.6680987", "0.6666321", "0.6666321", "0.6666321", "0.6666321", "0.6666321", "0.6666321", "0.66328174", "0.6608102", "0.6608102", "0.6511401", "0.65053445", "0.64164084", "0.6379893", "0.62925607", "0.62925607", "0.628346", "0.628346", "0.62681466", "0.62564814", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6251097", "0.6242606", "0.6198279", "0.6198279", "0.61824006", "0.6151899", "0.6101901", "0.60957175", "0.60869133", "0.60852957", "0.6064304", "0.6041312", "0.6040717", "0.6024319", "0.6024077", "0.6016852", "0.59985614", "0.5989423", "0.5970342", "0.59498465", "0.593465", "0.59229547", "0.59205157", "0.59173185", "0.59021044", "0.58782434", "0.58263475", "0.5818523", "0.58167356", "0.5787109", "0.57868123", "0.57860184", "0.57814115", "0.57674015", "0.5763784", "0.5762818", "0.5762818", "0.5751776", "0.5733564", "0.57304394", "0.5724554", "0.5724554", "0.5724554", "0.57236457", "0.57236457", "0.57236457", "0.5722429", "0.5722429", "0.571463", "0.57050645", "0.57009506", "0.57006645", "0.56688535", "0.56612635", "0.56537056", "0.5647887", "0.56426704", "0.5639606", "0.5637401", "0.56341976", "0.5618117", "0.5616395", "0.5614901", "0.5614901", "0.56091255", "0.5604816", "0.5604139", "0.55996454", "0.55993116" ]
0.75497967
0
Agrega enlaces de notas
def enlaces_notas resumen mensaje = "" notas = resumen.notas.order "updated_at DESC" if notas.count > 0 notas.each_with_index do |nota,i| mensaje += link_nota nota mensaje += "-" if i < resumen.notas.count-1 end end return mensaje end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comisiones_asignadas\n asunto.comisiones if asunto\n end", "def notificaciones\n end", "def solicitudes_atrasadas\n end", "def incluir_inicial\n ['casoid', 'fecha', 'ubicaciones', 'presponsables',\n 'tipificacion', 'victimas', 'memo']\n end", "def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end", "def incluir_inicial\n return ['casoid', 'contacto', 'fecharec', 'oficina', \n 'nusuario', 'fecha', 'expulsion',\n 'llegada', 'ultimaatencion_fecha', 'memo'\n ]\n end", "def noticias\n @vocalia = Vocalium.find(params[:id])\n @actual = \"Vocalia\"\n @noticias = Seccion.find(@vocalia.seccion_id).posts\n end", "def contando\n tags = Tag.find(:all)\n \n for tag in tags\n tag.ocurrencias = contador tag.descripcion \n tag.enlazados = Enlace.count(:all, :conditions =>['tag_id = ?', tag.id])\n \n tag.save\n end \n end", "def agregar_asignatura\n @titulo = \"Agregar asignatura\"\n @seccion = \"Asignaturas\"\n @carreras = [\"Biología\", \"Computación\", \"Geoquímica\", \"Física\", \"Matemática\", \"Química\", \"Complementaria\"]\n @clasificaciones = [\"Semestre I\", \"Semestre II\", \"Semestre III\", \"Semestre IV\", \"Semestre V\", \n \"Semestre VI\", \"Semestre VII\", \"Semestre VIII\", \"Semestre IX\", \"Semestre X\"]\n @menciones = []\n\n @tipos = [\"Obligatoria\",\"Electiva\", \"Obligatoria optativa\", \"Complementaria\", \"Otra\"]\n @a = __es_codigo_de_asignatura?(\"17744144\")\n end", "def notations; end", "def titulo_guia\n titulo = []\n\n t = Especie.find(params[:especie_id])\n a = t.adicional\n\n tipo_region = params[:tipo_region] == \"anp\" ? \"ANP \" : \"Municipio de \"\n \n if a.nombre_comun_principal.present?\n titulo[0] = \"Guía de #{a.nombre_comun_principal}\"\n else\n titulo[0] = \"Guía de #{t.nombre_cientifico}\"\n end\n\n titulo[1] = tipo_region + params[:nombre_region]\n titulo\n end", "def annonce_perso\n clear\n notice \"=== Annonce sur philippeperret.fr ===\"\n if informations[:annonce_perso]\n yesNo(MSG(:already_annonce_on_perso)) || return\n end\n\n notice <<-EOT\n(la diffusion — publique — de la vidéo a été contrôlée)\n\nJe vais ouvrir le site perso, à la rubrique Scrivener.\nEt je t'indique ensuite la démarche à suivre.\n\n EOT\n Clipboard.copy(titre)\n sleep 2.5\n Clipboard.copy(video_url)\n sleep 2.5\n open_site_perso\n\n\n notice <<-EOT\n\nPour procéder à l'opération :\n\n * passe en édition à l'aide du lien 'connexion' tout\n en bas de page,\n * repère ou crée la rubrique où peut aller ce nouveau\n tutoriel,\n * duplique l'élément qui sert d'interligne entre les\n tutoriels,\n * duplique un tutoriel proche,\n Attention : la duplication n'est pas facile : il faut\n glisser la souris sur l'élément jusqu'à voir apparaitre\n 'Modifier les colonnes', puis cliquer sur ce texte,\n et déplacer à l'aide de la poignée,\n * déplace-le à l'endroit voulu,\n * passe-le en édition,\n * sélectionne la vidéo et change l'url pour avoir la nouvelle\n (que j'ai mise dans le presse-papier),\n * sélectionne le texte et remplace-le par le titre\n “#{titre}”\n que j'ai placé dans PasteBox,\n * supprime le style (gomme) et mets la taille à 28px,\n * lie-le avec le lien :\n #{video_url}\n que j'ai aussi placé dans PasteBox.\n\n EOT\n\n # Marquer l'annonce déposée ?\n if yesNo(\"Dois-je marquer la publication faite sur ton site perso ?\")\n informations.set(annonce_perso: true)\n save_last_logic_step\n end\n\n end", "def ingresar_detalle_en_venta(detalle_venta,venta)\n if venta[:esta_vacio]\n venta[:tope] = detalle_venta\n venta[:final] = detalle_venta\n venta[:esta_vacio] = false\n venta[:size] +=1\n venta[:max]-=1\n else\n final = venta[:final]\n final[:siguiente] = detalle_venta\n venta[:final] = detalle_venta\n venta[:size]+=1\n venta[:max]-=1\n end\nend", "def discursarnolocal(pessoa, lugar)\n \"#{pessoa} discursou no #{lugar}\"\nend", "def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "def index\n @notificacoes = Notificacao.nao_vista\n end", "def guardar_todo\n tags = Tag.find(:all, :conditions=>['enlazados=0 OR enlazados!=ocurrencias']) #Hallamos todas la palabras clave\n actualizaciones=0 \n for tag in tags\n actualizaciones+=guardando tag\n enlazar tag.id\n end\n \n contando\n \n mensaje='N&uacute;mero de links guardados correctamente: <strong>'+actualizaciones.to_s+'</strong><br/>' \n flash[:notice] = mensaje\n \n respond_to do |format|\n format.html { redirect_to(admin_tags_path) }\n format.xml { head :ok }\n end\n end", "def set_listas\n #@locais = Local.all.map{|l| [l.nome,l.id]}\n @locais = Local.all\n @periodos = ['Manhã','Tarde','Noite']\n @publicos = ['Infantil','Adulto']\n end", "def guardar_notas_30\n exitoso_global = true\n exitoso_local = true\n nota_float = -2\n historial = nil\n @tipo_nivel_id = session[:tipo_nivel_id]\n \n arreglo = [{:nota1 => HistorialAcademico::EXAMENESCRITO1},\n {:nota2 => HistorialAcademico::EXAMENESCRITO2},\n {:nota3 => HistorialAcademico::EXAMENORAL},\n {:nota4 => HistorialAcademico::OTRAS},\n {:notafinal => \"nota_final\"}]\n\n arreglo.each{|a|\n params[a.keys[0]].each_with_index{|nota,i|\n exitoso_local = true\n historial = HistorialAcademico.where(:usuario_ci => nota[0],\n :periodo_id => session[:periodo_id],\n :idioma_id => session[:idioma_id],\n :tipo_estado_inscripcion_id => \"INS\",\n :tipo_categoria_id => session[:tipo_categoria_id],\n :tipo_nivel_id => session[:tipo_nivel_id],\n :seccion_numero => session[:seccion_numero]\n ).limit(1).first \n \n if nota[1].upcase==\"PI\"\n nota_float = -1\n else\n begin\n nota_float = Float(nota[1].gsub(\",\",\".\"))\n rescue\n exitoso_local = exitoso_global = false\n end\n end\n \n if exitoso_local \n if a[a.keys[0]] != \"nota_final\"\n nota_individual = historial.nota_en_evaluacion(a[a.keys[0]])\n nota_individual.nota = nota_float\n nota_individual.save\n else\n historial.nota_final = nota_float\n historial.save\n end\n end\n }\n }\n \n if !exitoso_global\n flash[:mensaje] = \"Los datos han sido guardados, pero existen algunas notas inválidas o incompletas\"\n @historiales,@usuarios = historiales_usuarios\n historial = @historiales.first\n @titulo_pagina = \"Calificar sección\"\n @curso = \"#{Seccion.idioma(historial.idioma_id)}\"\n @horario = Seccion.horario(session)\n @nivel = historial.tipo_nivel.descripcion\n @seccion = session[:seccion_numero]\n @periodo = historial.periodo\n @periodo_transicion = Periodo::PERIODO_TRANSICION_NOTAS_PARCIALES\n\n @periodo_30 = Periodo::PERIODO_30 \n info_bitacora(\"La seccion #{session[:seccion_numero]} del curso #{Seccion.idioma(historial.idioma_id)} del horario #{Seccion.horario(session)} no fue calificada por completo, periodo #{session[:parametros][:periodo_calificacion]}\")\n render :action => \"buscar_estudiantes\"\n return\n else\n historial.seccion.guardar_datos_calificacion(session[:usuario].ci)\n if session[:administrador] == nil\n historial.seccion.verificar_calificaciones_completas\n end\n #bitacora\n params[:notafinal].each{ |pa| \n historial = HistorialAcademico.where(:usuario_ci => pa[0],\n :periodo_id => session[:periodo_id],\n :idioma_id => session[:idioma_id],\n :tipo_estado_inscripcion_id => \"INS\",\n :tipo_categoria_id => session[:tipo_categoria_id],\n :tipo_nivel_id => session[:tipo_nivel_id],\n :seccion_numero => session[:seccion_numero]\n ).limit(1).first \n historial.cambiar_estado_calificacion(session[:tipo_categoria_id]) \n info_bitacora(\"Usuario #{session[:usuario].nombre_completo} calificó al estudiante #{historial.usuario_ci} del curso #{Seccion.idioma(historial.idioma_id)}, horario #{Seccion.horario(session)}, seccion #{session[:seccion_numero]}, con las siguientes notas: E1 = #{historial.nota_en_evaluacion(HistorialAcademico::EXAMENESCRITO1).nota}, E2 = #{historial.nota_en_evaluacion(HistorialAcademico::EXAMENESCRITO2).nota}, EOral = #{historial.nota_en_evaluacion(HistorialAcademico::EXAMENORAL).nota}, Otras = E1 = #{historial.nota_en_evaluacion(HistorialAcademico::OTRAS).nota}, nota final = #{historial.nota_final}, periodo #{session[:parametros][:periodo_calificacion]}\")\n }\n info_bitacora(\"La seccion #{session[:seccion_numero]} del curso #{Seccion.idioma(historial.idioma_id)} del horario #{Seccion.horario(session)} fue calificada por el usuario #{session[:usuario].nombre_completo}, periodo #{session[:parametros][:periodo_calificacion]}\")\n #fin bitacora\n redirect_to :action => \"mostrar_calificaciones\"\n end\n end", "def IniciaArea\n\t\t@Lojaq = Admloja.all\n\t\tif @Lojaq.size != 1\t# Se não houver exatamente um registro\n\t\t\t@loja = Admloja.all\n\t\t\t# @loja.delete.all\n\t\t\t# Admloja.delete\n\t\t\t@Novo = Admloja.new\n\t\telse\n\t\t\treturn\n\t\tend\n\n\t\t@Novo.nome = \"MINI LOJA VIRTUAL\"\n\t\t@Novo.cnpj = \"33014556000196\"\n\t\t@Novo.endereco = \"Rua José Dias, 1024\"\n\t\t@Novo.cidade = \"São José dos Campos\"\n\t\t@Novo.bairro = \"Jd. Aquarius\"\n\t\t@Novo.estado = \"SP\"\n\t\t@Novo.tel = \"1212341234\"\n\t\t@Novo.fax = \"1243214321\"\n\t\t@Novo.cel = \"1212345678\"\n\t\t@Novo.email = \"lojavirtual@modelo.com\"\n\t\t@Novo.password = \"175a6350f1f49ed49ab438ab6b2e0e45f6d3b8f9\"\t# senha\n\t\t@Novo.pagadm = 6\n\t\t@Novo.pagloja = 12\n\t\t@Novo.mcab = 1\n\t\t@Novo.maxsec = 0\n\t\t@Novo.maxdep = 0\n\t\t@Novo.upreco = 1\n\t\t@Novo.udesconto = 0\n\t\t@Novo.ufrete = 1\n\t\t@Novo.freefrete = 150\n\t\t@Novo.rodape = \"<strong> ESTE É O RODAPÉ DA LOJA VIRTUAL </STRONG>\"\n\t\t@Novo.cabecalho = '<div class=\"destaque\"><center>Aproveite as promoções da Loja Virtual! <br>Todos os produtos foram cuidadosamente selecionados pra você!<br>Conforto, Segurança e Tecnologia, <br>agora você encontra aqui!!!<br></div>'\n\t\t@Novo.cep = \"12345691\"\n\t\t@Novo.complemento = \"\"\n\t\t@Novo.cpostal = \"\"\t\t\n\t\t@Novo.save\n\t\treturn\n\tend", "def pessoavaidois(lugar)\n \"indo para \" + lugar\nend", "def prepara_form\n @enderecos = Endereco.order :rua\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end", "def asignar_titulo_propiedad()\n \n end", "def notacion(columna, fila)\n ambiguedades = @tablero.movibles_a(columna, fila).select do |pieza|\n (@columna != pieza.columna or @fila != pieza.fila) and @color == pieza.color and self.class == pieza.class\n end\n\n notacion = inicial\n if ambiguedades.any? { |pieza| @fila == pieza.fila } and ambiguedades.any? { |pieza| @columna == pieza.columna }\n notacion << \"#{@columna.to_lttr}#{@fila}\"\n elsif ambiguedades.any? { |pieza| @columna == pieza.columna }\n notacion << \"#{@fila}\"\n elsif !ambiguedades.empty?\n notacion << \"#{@columna.to_lttr}\"\n end\n\n notacion << \"x\" if @tablero[columna][fila]\n notacion << \"#{columna.to_lttr}#{fila}\"\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end", "def full_descripcion \n \"#{asunto.nombre} - \"+\"#{nombre}\" \n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end", "def pontosanunciante\n\n\t\tUsuario.find(self.id_usuario).meuspontos\n\n\tend", "def impuestos_municipales\n npad(0, 15)\n end", "def gaceta\n %Q(gaceta #{publicacion} del #{I18n.l publicacion_fecha})\n end", "def citas_agendadas(año, semana)\n init = Date.commercial(year = año, cweek = semana)\n citas = self.schedules.where(date: (init)..(init + 5.days))\n\n semanario = {}\n\n citas.each do |c|\n if semanario[c.date.strftime('%u').to_i].nil? \n semanario[c.date.strftime('%u').to_i] = []\n end\n semanario[c.date.strftime('%u').to_i].append( c.date.strftime('%H').to_i )\n end\n\n semanario\n end", "def initialize(nome, comentario)\n @nome = nome\n @comentario = comentario\n @estrelando = []\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # zeros 2\n # conta corrente 7\n # digito da conta 1\n # complemento 6\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "def telefones\n self.contato_telefones.map{|a| \"(#{a.ddd}) #{a.numero}\"}\n end", "def jugadas_posibles\n Array.new.tap do |jugadas_posibles|\n (1..8).each do |columna|\n (1..8).each do |fila|\n jugadas_posibles << [columna, fila] if puede_moverse?(columna, fila)\n end\n end\n end\n end", "def nota_params\n params.require(:nota).permit(:nota, :pesquisa_id)\n end", "def complemento\n \"#{''.rjust(286, ' ')}#{sequencial_remessa}\"\n end", "def index\n @nota_alunos = NotaAluno.all\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 preenche_parcelas_recorrencia\n return unless recorrencia\n \n if recorrencia.tipo == 'por'\n recorrencia.data_inicial = data\n recorrencia.parcelas = recorrencia.descobre_parcelas\n else\n recorrencia.parcelas = nil\n end\n end", "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "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 pantallaPuntosRondas\n\t\tpuntos = \"\"\n\t\trondas = \"\"\n\n\t\t# Limpiamos pantalla\n\t\t@app.clear\n\t\t@app.background \"fondo.jpg\"\n\n\t\t@boxes = @app.stack :top => \"180\", :left => \"330\"\n\t\t@boxes.para \"Rondas\"\n\t\t@r = @boxes.edit_line\n \t@boxes.para \"Puntos\"\n \t@pu = @boxes.edit_line\n \t@enviar = @boxes.button \"OK\"\n \t@enviar.click do\n\t \t@rondas = @r.text\n\t\t\t@puntos = @pu.text\n\t\t\tif (@rondas == \"\" and @puntos == \"\")\n\t\t\t\t@boxes.append \"Debe indicar un numero de rondas o puntos.\"\n\t\t\telse\n\t\t\t\tpantallaJuego\n\t\t\tend\n\t\tend\n \t\n\tend", "def lesen\r\n @posteingang.each{|x| puts x + \"\\n\"}\r\n end", "def obtener\narray = Tarea.all\n \n @@tareas = Array.new\n array.each{|x| @@tareas.push(x) if /#{@@usuario}/.match(x[\"title\"])}\n\n @@tareas.each do |x|\nstring = x[\"title\"].split\n string.pop\nx[\"title\"] = string.join(\" \")\n\n\n end\n #esto es para que no quede una tarea vacia al principio, la cual es la correspondiente login\n@@tareas.shift\n @@tareas\n\nend", "def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end", "def notifica(comentario)\n @comentario = comentario \n mail :to => comentario.comentable.user.email,\n :reply_to => comentario.user.email,\n :bcc => comentario.comentable.comentarios.map{|c| c.user.email}.uniq,\n :subject => \"[MBAcentrum.com] Nuevo comentario sobre #{comentario.comentable}\"\n \n end", "def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end", "def get_usoterreno\n aux = 0.0\n @contenido.each do |alimento|\n aux += alimento.ground\n end\n @usoterreno = aux\n end", "def inject(obj)\n obj.instance_eval do\n\n def cedente\n self.contribuicao.instituicao.nome.to_s.remover_acentos\n end\n\n def dados_sacado\n dados = \"\"\n cidade_uf = self.contribuicao.pessoa.cidade ? self.contribuicao.pessoa.cidade.nome.as_campo(15) : \"\".as_campo(15)\n cidade_uf += self.contribuicao.pessoa.cidade ? self.contribuicao.pessoa.cidade.estado.sigla.as_campo(2) : \"\".as_campo(2)\n # NOME - 35\n dados += self.contribuicao.pessoa.nome ? self.contribuicao.pessoa.nome.as_campo(35) : \"\".as_campo(35)\n # ENDERECO - 40\n dados += self.contribuicao.pessoa.endereco_minimo.as_campo(40)\n if self.contribuicao.pessoa.endereco.blank?\n # BAIRRO - 12\n dados += self.contribuicao.pessoa.endereco_cobranca_bairro ? self.contribuicao.pessoa.endereco_cobranca_bairro.as_campo(12) : \"\".as_campo(12)\n # CIDADE - 15 e UF - 2\n dados += cidade_uf\n # CEP - 8\n dados += self.contribuicao.pessoa.endereco_cobranca_cep ? self.contribuicao.pessoa.endereco_cobranca_cep.as_campo(8) : \"\".as_campo(8)\n else\n # BAIRRO - 12\n dados += self.contribuicao.pessoa.bairro ? self.contribuicao.pessoa.bairro.as_campo(12) : \"\".as_campo(12)\n # CIDADE - 15 e UF - 2\n dados += cidade_uf\n # CEP - 8\n dados += self.contribuicao.pessoa.cep ? self.contribuicao.pessoa.cep.as_campo(8) : \"\".as_campo(8)\n end\n # REGISTRO - 6 + CAMPO LIVRE - 20\n dados += 0.as_campo(6,0) + CAMPO_LIVRE_20 + \" \".as_campo(5)\n dados += self.contribuicao.pessoa.cpf ? self.contribuicao.pessoa.cpf.to_i.as_campo(15,0) : 0.as_campo(15,0)\n dados += \" \"\n dados.remover_acentos\n end\n\n def vencimento\n self.data_referencia\n end\n\n # Formacao do nosso numero\n # {XXXXXXXXXX}-{D}\n # {XXXXXXXXXX} -> ID DA CONTRIBUICAO\n # {D} -> Digito verificador mod11(Codigo da agencia cedente + ID DA CONTRIBUICAO)\n def nosso_numero\n self.id.as_campo(10,0).to_s\n end\n\n def digito_nosso_numero\n (agencia.as_campo(4).to_s + nosso_numero).modulo11_mercantil { |valor| [0,1].include?(valor) ? 0 : (11 - valor) }\n end\n\n def valor_documento\n self.valor\n end\n\n def numero_carteira\n \"06\"\n end\n\n def quantidade_moeda\n \"000000000000000\"\n end\n\n def especie_documento\n \"OU\"\n end\n\n def aceite\n \"N\"\n end\n\n def instrucoes_bancarias\n instrucoes = \"\"\n if self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias\n (0..5).each do |ix|\n instrucoes += (self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias.split(Conta::QUEBRA_INSTRUCAO_BANCARIA)[ix]).to_s.as_campo(70)\n end\n end\n instrucoes.remover_acentos\n end\n\n def instrucoes_sacado\n instrucoes = \"\"\n if self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias\n (0..2).each do |ix|\n instrucoes += (self.contribuicao.contrato_cobranca.conta.instrucoes_sacado.split(Conta::QUEBRA_INSTRUCAO_SACADO)[ix]).to_s.as_campo(40)\n end\n end\n instrucoes.remover_acentos\n end\n\n def mensagem_sacado\n # mensagem = \"Pagamento referente a manutencao de menores carentes assistidas pela Cidade dos Meninos Sao Vicente de Paulo.\".as_campo(130)\n mensagem = \"\".as_campo(130)\n # mensagem += \"visite nosso site:www.redesolidariedade.org.br ou (31)3228-9236\".as_campo(130)\n mensagem += \"\".as_campo(130)\n # mensagem += \"Ser anjo e voce ser capaz de iluminar no momento em que o outro e trevas!\".as_campo(130)\n mensagem += \"\".as_campo(130)\n mensagem += \"\".as_campo(1560)\n end\n\n def agencia\n self.contribuicao.contrato_cobranca ? self.contribuicao.contrato_cobranca.conta.agencia.to_f.as_campo(4,0) : 0.as_campo(4,0)\n end\n\n def codigo_cedente\n self.contribuicao.contrato_cobranca ? self.contribuicao.contrato_cobranca.numero_contrato.to_f.as_campo(9,0) : 0.as_campo(9,0)\n end\n\n def cnpj_cedente\n self.contribuicao.contrato_cobranca.conta.cnpj.gsub(/\\.|\\/|\\-|\\s/,'').as_campo(14)\n end\n\n def indicador_ano\n \"S\"\n end\n\n def instrucao_codificada\n \"0000\"\n end\n\n end\n end", "def index\n @notificaciones = Notificacione.all\n end", "def reactivacion\r\n\t\tif session[:usuario_id]\r\n\t\t\tenti = Usuarioentidad.where(usuario_id: session[:usuario_id]).take\r\n\t\tend\r\n\t\t#Solamente el consejo de facultad tiene la posibilidad de reactivar instructores\r\n\t\tif session[:usuario_id] && session[:entidad] == true && enti.entidad_id == 13\r\n\t\t\tsession[:adecuacion_id] = nil\r\n\t\t\tsession[:plan_id] = nil\r\n\t\t\tsession[:instructorName] = nil\r\n\t\t\tsession[:informe_id]=nil\r\n\t\t\t@cjpTipo=Usuario.find(session[:usuario_id]).tipo\r\n\t\t\t@nombre = session[:nombre_usuario]\r\n\t\t\t@usu=Usuarioentidad.where(entidad_id: session[:entidad_id]).take\r\n\t\t\t@entidad_escuela_id= @usu.escuela_id\r\n\t\t\t@usuarios = Usuario.where(activo: 0).all\r\n\t\t\t@instructores = []\r\n\t\t\tcpcontador = 0\r\n\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t@instructores[cpcontador][0] = \"Seleccione el instructor\"\r\n\t\t\t@instructores[cpcontador][1] = 0\r\n\t\t\tcpcontador = cpcontador + 1\r\n\r\n\t\t\t@usuarios.each do |usuari|\t\t#Arreglo con los usuarios inahibilitados\r\n\t\t\t\tcppersona = Persona.find_by usuario_id: usuari.id\r\n\t\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t\t@instructores[cpcontador][0] = cppersona.nombres.to_s.split.map(&:capitalize).join(' ') + \" \" + cppersona.apellidos.to_s.split.map(&:capitalize).join(' ')\r\n\t\t\t\t@instructores[cpcontador][1] = usuari.id\r\n\t\t\t\tcpcontador = cpcontador + 1\r\n\t\t\tend\r\n\r\n\t\t\ti = 1\r\n\t\t\tj = 1\r\n\t\t\tnombre = \"hola\"\r\n\t\t\tcpid = 1\r\n\r\n\t\t\t#Ordena los nombres por orden alfabetico (Ordenamiento Burbuja)\r\n\t\t\twhile i < cpcontador do\r\n\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\tj = i + 1\r\n\t\t\t\twhile j < cpcontador do\r\n\r\n\t\t\t\t\tif @instructores[j][0] < nombre\r\n\t\t\t\t\t\t@instructores[i][0] = @instructores[j][0]\r\n\t\t\t\t\t\t@instructores[i][1] = @instructores[j][1]\r\n\t\t\t\t\t\t@instructores[j][0] = nombre\r\n\t\t\t\t\t\t@instructores[j][1] = cpid\r\n\t\t\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\tj +=1\r\n\t\t\t\tend\r\n\t\t\t\ti +=1\r\n\t\t\tend\r\n\r\n\t\telse\r\n\t\t\tredirect_to controller:\"forminst\", action: \"index\"\r\n\t\tend\r\n\tend", "def notadisciplinare_params\n params.require(:notadisciplinare).permit(:data, :oggetto, :docenza_id, :alunno_id)\n end", "def create\n @nota = Nota.new(params[:nota]) \n \n #@nota.lote_id = 172\n \n respond_to do |format|\n if @nota.save\n flash[:notice] = 'Nota was successfully created.'\n format.html { redirect_to(@nota) }\n format.xml { render :xml => @nota, :status => :created, :location => @nota }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nota.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rever(artigo, pessoa, nota)\n atual = State.new(anterior: self)\n\n #precondicao\n raise \"artigo_nao_submetido\" unless atual.submetidos.include? artigo\n\n #liveness\n artigo.avaliar! pessoa, nota\n\n atual\n end", "def place_boutons_pour_balise_in code\n file_url = \"analyse/#{id}/show\"\n code.gsub(/<(h[2-6])(?:.*?)id=\"(.+?)\"(?:.*?)>(.+?)<\\/\\1>/){\n tout = $&.freeze\n titre_id = $2.freeze\n titre_nom = $3.freeze\n titre_complet = \"Analyse de #{titre}, #{titre_nom}\"\n relative_url = \"#{file_url}##{titre_id}\"\n absolute_url = \"#{site.distant_url}/#{relative_url}\"\n clips = [\"'BRUT': '#{relative_url}'\"]\n clips << \"'MD Loc': '[#{titre_nom}](#{relative_url})'\"\n clips << \"'MD Dist':'[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Markdown': '[#{titre_complet}](#{absolute_url})'\"\n clips << \"'Mail': 'ALINK[#{absolute_url},#{titre_complet}]'\"\n clips = \"{#{clips.join(',')}}\"\n box = \"&lt;lien&gt;\".in_a(onclick:\"UI.clip(#{clips})\").in_div(class:'fright small')\n \"<ADMIN>#{box}#{tout}</ADMIN>\"\n }\n end", "def default_place\n [:noplace, :baduelle, :baltimora];\n end", "def to_s\n \"#{bairro} #{logradouro} #{complemento} #{lote}, #{cidade} - #{cidade.estado}\"\n end", "def cifra_vigenere(llave)\n cifrado = \"\"\n longitud = @texto.length\n 0.upto(longitud-1) do |j|\n i = j % (llave.size)\n alfabeto_ver = corrimiento(llave[i])\n car_cifrar = \"\" << @texto[j]\n posicion = MINUSCULAS.index(car_cifrar)\n a = alfabeto_ver[posicion]\n cifrado.concat(a)\n end\n @manejador.guardar_archivo(\"#{VIG_EN}\", cifrado)\n puts cifrado\n end", "def initialize(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\tsuper(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\t@emisiones_gei = 0\n\t\t@area_terreno_m2 = 0\n\tend", "def show\n @asignatura = params[:asignatura]\n @notas = current_user.notas.where(asignatura: @asignatura)\n @user = current_user\n end", "def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end", "def index\n @notas = current_user.asignaturas.all\n @user = current_user\n end", "def set_nota_aluno\n @nota_aluno = NotaAluno.find(params[:id])\n end", "def get_energia_lipidos\n\t\t\t\t@lipidos * 9\n\t\t\tend", "def zuruecksetzen()\n end", "def texte_aide\n <<-EOT\n=== Aide pour les notifications ===\\033[0m\n\nAjouter une notification\n #{jaune('add \"<notification>\" \"AAAA MM JJ\"[ \"titre\"]')}\n\n Note : la date peut être définie soit par JJ/MM/AAAA,\n soit par JJ MM AAAA, soit 'AAAA MM J' ou\n 'AAAA/M/J', peu importe.\n\nSupprimer une notification\n #{jaune('remove/delete <id notification>')}\n\nVoir toutes les informations de la notification\n #{jaune('show <id notification>')}\n\n(Re)définir les attributs d'une notification\n #{jaune('set <id notification> m=\"message\" t=\"titre\" d=\"AAAA MM JJ\"')}\n\nQuitter\n #{jaune('q/quit/quitter')}\n\n EOT\n end", "def add_nova_entidade\r\n\t\tif (Gosu::milliseconds - @ultimo_tempo ) / rand(20 ... 2500) == 1 \r\n\t\t\ttipo_proj = rand(0 ... Meteoros.length )\r\n\t\t\timg_size = Gosu::Image.new(Meteoros[rand(0 ... Meteoros.length )]).width\r\n\t\t\t@entidades << Projetil.new( rand(4 ... (Std_Width_Game-(2*img_size))) , 1, 0, Gosu::Image.new(Meteoros[tipo_proj]), rand(50 ... 300), Meteoros[tipo_proj])\r\n\t\t\t@ultimo_tempo = Gosu::milliseconds\r\n\t\tend\r\n\tend", "def nota_aluno_params\n params.require(:nota_aluno).permit(:nome_do_aluno, :nota_g1, :nota_g2, :sub_g1, :sub_g2, :data_prova)\n end", "def informe(actual,todos)\r\n if jugador_correcto(actual,todos)\r\n Diario.instance.ocurre_evento(\"Jugador: \" + todos.at(actual).nombre + \" recibe sorpresa \" + @texto)\r\n end\r\n end", "def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend", "def to_s\n \"#{get_titulo} #{get_porcentaje}\\n#{get_conjunto_platos}\\nV.C.T. | % #{get_vct} | #{get_proteinas} - #{get_grasas} - #{get_hidratos}\" \n end", "def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end", "def lancamentos_para_efetivar\n\t\t@entries = []\n\t\tself.categories.each do |c|\n\t\t\tc.lancamentos_ate_mes(Date.today).each do |e|\n\t\t\t\tif(e.mes_nao_efetivado(Date.today))\n\t\t\t\t\t@entries << e\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@entries\n\tend", "def nombre_enfants\n \n enfants = 0\n \n self.membres.each {\n |m|\n enfants += (age_at(Date.today, m.date_de_naissance) > 12 ? 0:1)\n }\n\n return enfants\n \n end", "def notificacao_params\n params.require(:notificacao).permit(:texto, :motivo, :state, :origem_id, :entidade_id, :posto_id)\n end", "def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\n end", "def cobranca_interna_formatada\n\t\t\t\tcobranca_interna = { '21' => '21 – Cobrança Interna Com Registro', '22' => '22 – Cobrança Interna sem registro' }\n\t\t\t\tcobranca_interna[carteira.to_s]\n\t\t\tend", "def suivre; end", "def status_da_divulgacao(topico)\n end", "def llenar_productos\n self.productos = self.clase.descripcion unless self.clase.nil?\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 excede_control_de_pago_x_ticket_x_parlay(last_tickect_current_user, entrada) # define el monto maximo a sacar por parlay, ej. pago max para tripletas, cuartetas etc.. no por ticket sino por tipo de ticket parlay ok\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0 # inicializacion de variable de sumatoria en cero ok.\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limiteglobal.to_i\n\n #acabo de conseguir el limite global de ese parlay en curso, ahora buscar la sumatoria de todos las jugadalots.posiblepago de los ticket activo de hoy y ver si no sbobrepara ese limiet ok\n t_ids = Ticket.today.where(:activo => \"si\", :parlay => tipo_jugada.to_s ).ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_jugadas_a_sumar = Jugadalot.where(:ticket_id => t_ids)# POstgres casting sum string error ok..sum(:posiblepago).to_i\n \n if not @listado_jugadas_a_sumar.nil?\n @listado_jugadas_a_sumar.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += jugada.posiblepago.to_i\n end\n end\n\n \n\n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n #@sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0\n #t.each do |ticket|\n # @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n #end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay.to_i <= control_monto_max_pago.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end", "def verifcar_alguna_pelea_abierta_antes_pago_any_ticket (ticket)\n #todas peleas cerrada implica cero peleas abiertas ok.\n\n @jugadalots = Jugadalot.where(:ticket_id => ticket.id) # todas las jugadas de ese ticket\n @alguna_pelea_abierta = false\n @peleas_abierta = [] # listado de peleas cerradas array\n\n @jugadalots.each do |jugada|\n \n #verifcar que todas las jugadas de ese ticket esten cerrada (peleas cerradas de ese ticket de esa fecha de esa lina de ese dia ok)\n linea_pelea = Lineat.by_day(jugada.created_at.to_date).where(:pelea => jugada.pelea.to_i).first || [] # \n if linea_pelea.status == \"abierta\"\n @peleas_abierta << linea_pelea.pelea # 3, 4 etc cerradas\n end\n \n end\n\n if @peleas_abierta.empty? # si esta vacio no hay niguna pelea cerrada\n return false \n else\n return @peleas_abierta # retorna las peleas abiertas\n end \n\n\n end", "def set_nota_tecnica\n @nota_tecnica = NotaTecnica.find(params[:id])\n end", "def titulares_serial\n Representante.find(self.titular_ids_serial).map(&:nombre)\n end", "def add_news noticia\n\t\tnoticia.each do |n|\n\t\t\t@@news << n\n\t\tend\n\n\tend", "def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend", "def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend", "def noticia_params\n params.require(:noticia).permit(:titulo, :texto, :semestre, :fecha, :imagen_url)\n end", "def des_cifra_vigenere(llave)\n claro = \"\"\n longitud = @texto.length\n @texto.chomp!\n 0.upto(longitud - 2) do |i|\n j = i % (llave.size)\n alfabeto_ver = corrimiento(llave[j])\n car_cifrado = \"\" << @texto[i]\n posicion = alfabeto_ver.index(car_cifrado)\n b = MINUSCULAS[posicion]\n claro.concat(b)\n end\n @manejador.guardar_archivo(\"#{VIG_DES}\", claro)\n puts claro\n end", "def to_s\n \t\t\t\"(Nombre:#{@nombre},Proteinas:#{@proteinas},Carbohidratos:#{@carbohidratos},Lipidos:#{@Lipidos},Gei:#{@gei},Terreno:#{@terreno})\"\n \t\t\n\t\tend", "def crear_indice_respuestas_dudas respuestas_dudas\n texto = ''\n respuestas_dudas.each_with_index do |respuesta_duda, indice|\n texto += \" (*#{indice}*) (#{respuesta_duda.usuario.nombre_usuario}): \\t #{respuesta_duda.contenido}\\n\"\n end\n texto\n end", "def panier_en_vente\n \t@paniers_ = Panier.where('revendeur_id = ? AND deleted = 0', self.id)\n \t@paniers= []\n \t@paniers_.each do |panier|\n \t\tif panier.has_declinaison\n \t\t\t@paniers << panier\n \t\tend\n \tend\n \t\n \treturn @paniers.count\n end", "def encomenda_params\n params.fetch(:encomenda, {})\n params.permit(:lote_id, :responsavel, :endereco, :celular, :produto)\n end" ]
[ "0.6699505", "0.65446395", "0.60493153", "0.5985316", "0.5908733", "0.57849526", "0.57509387", "0.57341427", "0.57105327", "0.5666349", "0.5615516", "0.5561488", "0.5508755", "0.5471767", "0.5462504", "0.5449848", "0.5427775", "0.54254746", "0.54253733", "0.5424888", "0.54212403", "0.5412472", "0.5394727", "0.53795016", "0.5357678", "0.53367215", "0.53299385", "0.5323774", "0.5304788", "0.5304788", "0.53023964", "0.5286113", "0.5276776", "0.5273395", "0.52247894", "0.52196586", "0.5217596", "0.52138275", "0.51968706", "0.51944846", "0.518661", "0.5159215", "0.51540613", "0.5152365", "0.513696", "0.51366687", "0.5135236", "0.5133818", "0.5127977", "0.5127364", "0.51261055", "0.51247466", "0.5122909", "0.51114035", "0.5110212", "0.5103406", "0.50947213", "0.50784576", "0.50723124", "0.5070257", "0.5069252", "0.5064486", "0.50637704", "0.50551057", "0.5054907", "0.5053264", "0.5041907", "0.5037602", "0.5032951", "0.5032579", "0.5023265", "0.50213486", "0.50165784", "0.5015718", "0.5014382", "0.50094193", "0.500629", "0.50021154", "0.49989304", "0.4996905", "0.49947056", "0.49930844", "0.4990948", "0.49888793", "0.49885866", "0.49816364", "0.49759233", "0.49757123", "0.49731883", "0.4968402", "0.49638793", "0.49632537", "0.49629644", "0.49629644", "0.49607", "0.4956357", "0.49551225", "0.49546802", "0.49539006", "0.49517503" ]
0.74527264
0
Init params Author: Aniket Date: 06/07/2018 Reviewed By:
def init_params(parmas) @client_id = parmas[:client_id] @client = Client.get_from_memcache(@client_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @params = {}\n end", "def initialize params = nil\n \n end", "def initialize(params)\n @params = params \n end", "def initialize_parameters\n @omdb_params = [:i, :t, :type, :y, :plot, :r, :tomates, :callback, :v, :s] \n end", "def initialize(title, author)\n# stores title and author as instance variables\n @title = title \n @author = author\n# sets instance variables, @status and @borrower, to default values.\n @status = \"available\"\n @borrower = nil\n end", "def initialize\n @params = {} # Mimics params hash available within controllers in rails app\n end", "def initialize\n super()\n @params = {}\n end", "def initialize(params)\n @params = params\n end", "def initialize(params)\n @params = params\n end", "def initialize(params = {})\n parameters(params)\n end", "def init\n\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def init_params(params)\n @client_id = params[:client_id]\n @user_extended_detail_id = params[:user_extended_details_id]\n @reprocess = params[:reprocess].to_i\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize_parameters\n []\n end", "def init_data\n end", "def init_parameters\n @filters = []\n @sorts = {}\n @columns = {}\n @extra_fields = []\n @exporting = {}\n @operations = []\n @macro = Macro.new\n end", "def parse_init_params\n VALID_PARAMS.each do |param|\n default_const = param.to_s.upcase\n\n val = @params[param] || FuzzyNotes::Defaults.const_get(default_const)\n instance_variable_set(\"@#{param}\", val) \n end\n end", "def initialize(param)\n if param.is_a?(Hash)\n @fields = build_model(param)\n @fields.default = ''\n else\n @fields = Hash.new('')\n @fields['cff-version'] = DEFAULT_SPEC_VERSION\n @fields['message'] = DEFAULT_MESSAGE\n @fields['title'] = param\n end\n\n %w[authors contact keywords references].each do |field|\n @fields[field] = [] if @fields[field].empty?\n end\n end", "def initialize (params = {}) # Get a value from the \"new\" call, or set a default\n # @id = \"000000000\", @name = \"Unknown_name\", @mut_phen = \"Unknown_mutant_phenotype\", @linked_to = \"Not_linked_to_any_other_gene\"\n @id = params.fetch(:id, \"000000000\")\n @name = params.fetch(:name, \"Unknown_name\") \n @mut_phen = params.fetch(:mut_phen, \"Unknown_mutant_phenotype\")\n @linked_to = params.fetch(:linked_to, \"Not_linked_to_any_other_gene\")\n end", "def init_params(params)\n @params = params\n @client_id = params[:client_id].to_i\n @event_source = params[:event_source]\n @event_name = params[:event_name]\n @event_data = params[:event_data]\n @event_timestamp = params[:event_timestamp].to_i\n\n @filtered_webhook_settings = []\n @event_obj = {}\n @lock_id = nil\n end", "def initialize\n\t\t\n\tend", "def initialize(details)\r\n\t\t@name=details[:name]\r\n\t\t@language=details[:language]\r\n\t\t@release_date=details[:release_date]\r\n\tend", "def init_params(params)\n @client_id = params[:client_id]\n\n @edit_kyc_id = params[:edit_kyc_id]\n\n @user_extended_detail_id = params[:user_extended_detail_id]\n\n @user_kyc_detail_id = params[:user_kyc_detail_id]\n\n @admin_email = params[:admin_email]\n\n @user_id = params[:user_id]\n\n @client = Client.get_from_memcache(@client_id)\n end", "def init_params(params)\n\n @parent_id = params[:parent_id]\n\n @critical_chain_interaction_log = nil\n @client_id = nil\n\n end", "def init_params(params)\n @client_id = params[:client_id]\n @user_id = params[:user_id]\n @action = params[:action]\n @action_timestamp = params[:action_timestamp]\n\n @admin_id = params[:admin_id]\n @case_id = params[:case_id]\n # NOTE: Called from two places, one time it's hash with indifferent access and another is normal hash\n # so following line is required and can't be changed. Talk to Sunil, before you touch it.\n @extra_data = params[:extra_data].present? ? params[:extra_data].deep_symbolize_keys : nil\n\n @client = Client.get_from_memcache(@client_id)\n @e_extra_data = nil\n end", "def initialize(params=nil)\r\n super\r\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def at_init\n\n\t\tend", "def initialize(params=nil)\n if params\n @title = params['title']\n @address = params['address']\n end\n end", "def initialize(title:, author:, release_date:, publisher:, isbn:)\n @title = title\n @author = author\n @release_date = release_date\n @publisher = publisher\n @isbn = isbn\n end", "def initialize\r\n\r\n end", "def initialize(params={})\n #switch between both internal and external views of id and population\n @id = params[:_id].nil? ? params[:id] : params[:_id].to_s\n @number = params[:number].to_i\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @gender = params[:gender]\n @group = params[:group]\n @secs = params[:secs].to_i\n end", "def init_params(params)\n @params = params\n @csv_report_job_id = params[:csv_report_job_id]\n\n @csv_report_job = nil\n @admin = nil\n @client_id = nil\n @client = nil\n\n @has_data = nil\n end", "def initialize\n \n end", "def initialize(params = {})\n @source = params.delete(:source)\n @current_user = params.delete(:current_user)\n @params = params\n end", "def initialize(params ={})\n super\n @url=params.fetch(:URL)\n @a_date=params.fetch(:a_date)\n @medium=params.fetch(:medium)\n end", "def initialize(params)\n setMake(params[:make]);\n setModel(params[:model]);\n setYear(params[:year]);\n commitCar!();\n\n end", "def initialize(params={})\n #switch between both internal and external views of id and population\n @id=params[:_id].nil? ? params[:id] : params[:_id]\n @city=params[:city]\n @state=params[:state]\n @population=params[:pop].nil? ? params[:population] : params[:pop]\n end", "def initialize(params={})\n #switch between both internal and external views of id and population\n @id=params[:_id].nil? ? params[:id] : params[:_id]\n @city=params[:city]\n @state=params[:state]\n @population=params[:pop].nil? ? params[:population] : params[:pop]\n end", "def initialize(params)\n @customer_id = params['customer_id'].to_i\n @film_id = params['film_id'].to_i\n @cinema = params['cinema']\n @type = params['type']\n end", "def initialize (params = {})\n @seed_stock = params.fetch(:seed_stock, []) #gives default value\n @mutant_gene_id = params.fetch(:mutant_gene_id, []) \n @last_planted = params.fetch(:last_planted, []) \n @storage = params.fetch(:storage, [])\n @grams_remaining = params.fetch(:grams_remaining, []) \n end", "def initialize(params)\n\t\t\t@params=params\n\t\t\t@facility_code = params[:facility_code]\n\t \t@member_id=params[:member_id]\n\t\t\t@table_number=params[:table_number]\n\t\t\t@steward=params[:steward]\n\t\t\t@waitor=params[:waitor]\n\t\tend", "def pre_initialize\n end", "def initialize(params)\n @id = params[:id]\n @nombre = params[:nombre]\n @genero = params[:genero]\n @id_tropicos = params[:id_tropicos]\n @color1 = params[:color1]\n @color2 = params[:color2]\n @forma_vida1 = params[:forma_vida1]\n @forma_vida2 = params[:forma_vida2]\n @descripcion_es = params[:descripcion_es]\n @descripcion_en = params[:descripcion_en]\n @distribucion_es = params[:distribucion_es]\n @distribucion_en = params[:distribucion_en]\n @thumbnail = params[:thumbnail]\n end", "def initialize (params = {})\n @gene_name = params.fetch(:gene_name,\"unknown\")\n @gene_phenotype = params.fetch(:gene_phenotype, \"unknown\") \n @gene_links = params.fetch(:gene_links, []) \n @gene_id = params.fetch(:gene_id,\"AT0G00000\") #gives default value\n\n end", "def initialize(params={})\n # there has GOT to be some better way to clean this up ...\n params['categories'] = params.delete('challenge_categories__r') if params['challenge_categories__r']\n params['participants'] = params.delete('challenge_participants__r') if params['challenge_participants__r']\n params['community'] = params.delete('community__r') if params['community__r']\n params['terms_of_service'] = params.delete('terms_of_service__r') if params['terms_of_service__r']\n params['challenge_comments'] = params.delete('challenge_comments__r') if params['challenge_comments__r']\n params['challenge_reviewers'] = params.delete('challenge_reviewers__r') if params['challenge_reviewers__r']\n params['challenge_comment_notifiers'] = params.delete('challenge_comment_notifiers__r') if params['challenge_comment_notifiers__r']\n params['challenge_prizes'] = params.delete('challenge_prizes__r') if params['challenge_prizes__r']\n params['assets'] = params.delete('assets__r') if params['assets__r']\n params['platforms'] = params.delete('challenge_platforms__r') if params['challenge_platforms__r']\n params['technologies'] = params.delete('challenge_technologies__r') if params['challenge_technologies__r']\n\n # these fields need extra cleaning as they should only output arrays of strings\n # they also have an awful lot of duplication that can benefit with a bit of refactoring\n params['challenge_reviewers'] = params['challenge_reviewers'].map do |entry|\n entry['member__r']['name']\n end if params['challenge_reviewers']\n\n params['challenge_comment_notifiers'] = params['challenge_comment_notifiers'].map do |entry|\n entry['member__r']['name']\n end if params['challenge_comment_notifiers']\n\n params['challenge_prizes'] = params['challenge_prizes'].records.map do |entry|\n prize = \"$#{Integer(entry['prize'])}\" rescue entry['prize'].to_s\n { place: entry['place'].to_i.ordinalize, prize: prize, points: entry['points'] || '', value: entry['value'] || '' }\n end if params['challenge_prizes']\n\n # params['assets'] = params['assets'].map do |entry|\n # entry['filename']\n # end if params['assets']\n\n super(params)\n end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def initialize(params)\n @ticket_id = params['TicketID']\n @lock_id = params['LockID']\n @real_till_time_not_used = params['RealTillTimeNotUsed']\n @changed = params['Changed']\n @customer_user_id = params['CustomerUserID']\n @queue_id = params['QueueID']\n @escalation_solution_time = params['EscalationSolutionTime']\n @owner_id = params['OwnerID']\n @unlock_timeout = params['UnlockTimeout']\n @priority_id = params['PriorityID']\n @escalation_time = params['EscalationTime']\n @type = params['Type']\n @queue = params['Queue']\n @escalation_response_time = params['EscalationResponseTime']\n @escalation_update_time = params['EscalationUpdateTime']\n @customer_id = params['CustomerID']\n @age = params['Age']\n @until_time = params['UntilTime']\n @responsible = params['Responsible']\n @lock = params['Lock']\n @priority = params['Priority']\n @state_id = params['StateID']\n @created_by = params['CreateBy']\n @state = params['State']\n @type_id = params['TypeID']\n @ticket_number = params['TicketNumber']\n @group_id = params['GroupID']\n @created = params['Created']\n @service_id = params['ServiceID']\n @owner = params['Owner']\n @slaid = params['SLAID']\n @state_type = params['StateType']\n @title = params['Title']\n @responsible_id = params['ResponsibleID']\n @create_tim_nix = params['CreateTimeUnix']\n @changed_by = params['ChnageBy']\n @archive_flag = params['ArchiveFlag']\n end", "def initialize(title:, ready_in_minutes:, servings:, source_url:) #key,value method so arguments dont have to be place in specific orders \n self.title = title #set it to self. to be able to make custom changes if i wanted to in the futre ex:upcase, downcase\n self.ready_in_minutes = ready_in_minutes\n self.servings = servings\n self.source_url = source_url\n \n self.save\n \n end", "def initialize(params)\n @api = params.fetch(:api)\n @id = params.fetch(:id)\n @date = params.fetch(:date)\n end", "def init_params(params)\n # Rails.logger.info(\"-- init_params params: #{params.inspect}\")\n @client_id = params[:client_id]\n @user_id = params[:user_id].to_i\n @user_extended_detail_id = params[:user_extended_detail_id]\n @action = params[:action]\n @action_timestamp = params[:action_timestamp]\n @event = params[:event]\n\n @client = Client.get_from_memcache(@client_id)\n\n @user = User.using_client_shard(client: @client).find(@user_id)\n @user_extended_detail = UserExtendedDetail.using_client_shard(client: @client).find(@user_extended_detail_id)\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n Rails.logger.info(\"-- init_params @user_extended_detail: #{@user_extended_detail.id}\")\n end", "def initialize(params)\n super\n\n @email = @params[:email]\n @name = @params[:name]\n end", "def initialize(title, author)\n @title = title\n @author = author\nend", "def create_params\n herbarium_params.merge(\n name: \" Burbank <blah> Herbarium \",\n code: \"BH \",\n place_name: \"Burbank, California, USA\",\n email: \"curator@bh.org\",\n mailing_address: \"New Herbarium\\n1234 Figueroa\\nBurbank, CA, 91234\\n\\n\\n\",\n description: \"\\nSpecializes in local macrofungi. <http:blah>\\n\"\n )\n end", "def initialize(params)\n self.cc = params[:cc]\n self.month = params[:month]\n self.year = params[:year]\n self.fname = params[:fname]\n self.lname = params[:lname]\n self.cvv params[:cvv]\n end", "def Init()\n end", "def initialize(attributes={}) #can set instance variables when creating the instance\n @name = attributes[:name]\n @major = attributes[:major]\n @course = attributes[:course]\n @grade = attributes[:grade]\n end", "def global_params\n [:publication_type_id, :is_draft, :is_deleted, :created_at, :created_by, :updated_by, :biblreviewed_at, :biblreviewed_by, :bibl_review_postponed_until, :bibl_review_postpone_comment, :content_type, :xml, :datasource, :sourceid, :ref_value]\n end", "def initialize(params={})\n @id = params[:id]\n @name = params[:name]\n @population = params[:population]\n @capital = params[:capital]\n @area = params[:area]\n end", "def initialize(params={})\n @full_name = params[:full_name]\n @course_name = params[:course_name]\n @grade_level = params[:grade_level]\n end", "def initialize(data)\n @parms = data\n end", "def init(options = {})\n\t\tdefaults = {:year => Constant.constants[:cur_year], :status => 'Accepted', :id=>Mentee.new_id}\n \t\toptions = defaults.merge(options)\n \t\tputs options\n\t \toptions.keys.each do |attribute|\n\t \tself[attribute] = options[attribute] \t\n\t \tend\n\t \t#puts self.attributes\n\tend", "def initialize(params={})\n @id = params['id']\n @userId = params['userId']\n @title = params['title']\n @body = params['body']\n end", "def init\n\nend", "def user_init; end", "def initialize_data\n end", "def pre_initialize; end", "def initialize(title: title, description: description, url: url = \"google.com\") #better way\n\t\t@title = title\n\t\t@description = description\n\t\t@url = url\n\tend", "def initialize(title: title, description: description, url: url = \"google.com\") #better way\n\t\t@title = title\n\t\t@description = description\n\t\t@url = url\n\tend", "def initialize(params)\n @first_name = params[:user][:first_name]\n @last_name = params[:user][:last_name]\n @company_name = params[:user][:company][:company_name]\n @email = params[:user][:email]\n @password = params[:user][:password]\n end", "def initialize\n init\n end", "def initialize(params = nil)\n @params = params\n @state = {}\n end", "def initialize(details) #details will now be a hash\n\n@name = details[:name]\n@language = details[:language]\n@release_date = details[:release_date]\nend", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end" ]
[ "0.706322", "0.70498246", "0.69087195", "0.68912333", "0.68797237", "0.6858602", "0.67866516", "0.67726153", "0.67726153", "0.6769008", "0.6738238", "0.66774255", "0.66774255", "0.66774255", "0.66774255", "0.66749775", "0.6651916", "0.6651916", "0.6651916", "0.66503996", "0.6646916", "0.6638301", "0.6633283", "0.66266745", "0.66186786", "0.66089875", "0.6608436", "0.6604661", "0.659875", "0.6588549", "0.6583633", "0.65788496", "0.657247", "0.657247", "0.65679175", "0.65594906", "0.6552113", "0.6537963", "0.6536056", "0.65288895", "0.65211415", "0.6500066", "0.6498416", "0.6494565", "0.6487245", "0.6487245", "0.64791304", "0.6478004", "0.6474326", "0.6473168", "0.64638245", "0.6456038", "0.64279443", "0.6420464", "0.6420464", "0.6420464", "0.6420464", "0.6420464", "0.6420464", "0.6420464", "0.6420464", "0.6418544", "0.6412806", "0.6412605", "0.64117587", "0.63991374", "0.6394639", "0.6382108", "0.6370103", "0.6364223", "0.63597226", "0.6357472", "0.6356006", "0.6352715", "0.63449615", "0.63441515", "0.63437647", "0.634344", "0.6331126", "0.6328954", "0.6327017", "0.63211846", "0.63211846", "0.63193595", "0.63189834", "0.63157994", "0.63137645", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228", "0.631228" ]
0.0
-1
Trigger auto_approve_update rescue task for users Author: Tejas Date: 12/07/2018 Reviewed By:
def process_user_kyc_details UserKycDetail.using_client_shard(client: @client). where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status, admin_status: GlobalConstant::UserKycDetail.unprocessed_admin_status). order({id: :desc}). find_in_batches(batch_size: 100) do |ukds| ukds.each do |ukd| if (!ukd.has_been_auto_approved?) trigger_auto_approve_update_rescue_task(ukd.user_extended_detail_id) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_auto_approve_update_rescue_task(user_extended_details_id)\n BgJob.enqueue(\n AutoApproveUpdateJob,\n {\n client_id: @client_id,\n reprocess: 1,\n user_extended_details_id: user_extended_details_id\n }\n )\n Rails.logger.info(\"---- enqueue_job AutoApproveUpdateJob for ued_id-#{user_extended_details_id} done\")\n end", "def auto_approve!\n update_attribute(:approved_at,DateTime.now)\n update_attribute(:approved_by, User.APPLICATION)\n write_key!\n end", "def alteration_approve\n UserNotifier.deliver_in_process(self, user)\n end", "def auto_approve\n if !self.auto_approved && self.approval_status.nil?\n UserMailer.auto_approved_email(self).deliver\n self.auto_approved = true\n self.approval_status = true\n self.save\n end\n end", "def accept!(user_id)\n if self.approved_at.nil?\n # Approvability::Notifier.confirm_approval(self).deliver # Send an email to the contributor\n self.update_attributes(rejected_at: nil, approved_at: Time.now, user: user_id)\n end\n self\n end", "def escalate_approval\n if !self.user.manager_id.nil?\n if self.manager.manager_id.nil?\n self.auto_approve()\n else\n UserMailer.escalate_approval_email(self).deliver\n self.is_escalated = true\n self.save\n end\n end\n end", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target_user.approval_status == User::ApprovalStatusApproved\n target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n\n # if target_user.approval_status == User::ApprovalStatusApproved\n # if target_user.company_buyer_entities.any?{ |x| x.approval_status == CompanyBuyerEntity::ApprovalStatusPending}\n # target_user.update(comment: comment, approval_date_time: DateTime.current)\n # else\n # target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n # end\n\n if approval_status == User::ApprovalStatusApproved\n UserMailer.approval_email(target_user).deliver_later\n elsif approval_status == User::ApprovalStatusReject\n UserMailer.reject_email(target_user).deliver_later\n end\n result_json = {user_base_info: target_user}\n result_json\n end", "def send_outstanding_alert_to_approver(agency, user)\n setup_email\n body[:agency] = agency\n body[:user] = user\n recipients user.email\n subject \"Timesheet Approval Reminder\"\n end", "def approval_needed(user)\n @user = user\n\n mail to: ENV['ADMIN_EMAIL'], subject: \"User wants approval for Thumbline Set List\"\n end", "def auto_approve_type\n 'auto'\n end", "def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end", "def approve(user)\n if !self.approved?\n self.approved = true\n self.manager = user\n self.approved_at = Time.now\n end\n end", "def update_from_params(params, user)\n super_return_value = super\n if %w[InformalHearingPresentationTask IhpColocatedTask].include?(type) &&\n params[:status] == Constants.TASK_STATUSES.completed\n MetricsService.record(\"Sending VSO IHP complete notification to VA Notify for #{appeal.class} \"\\\n \"ID #{appeal.id}\",\n service: nil,\n name: \"AppellantNotification.notify_appellant\") do\n AppellantNotification.notify_appellant(appeal, @@template_name)\n end\n end\n super_return_value\n end", "def approve(user)\n set_attachments\n\n @user = user\n mail(to: @user.email, subject: \"Cuenta Activada @ Social Target - Its time to go social\")\n end", "def approve!\n self.approved_at = Time.now\n registration.approve\n save!\n end", "def auto_approve\n user=photo.user or return nil\n if user.admin?\n photo.approver_id=user.id\n photo.status = Photo::STATUS_APPROVED\n end\n end", "def check_auto_assignees!(user)\r\n # exception for agreement document type\r\n # check_auto_assignees_exception!(user)\r\n\r\n # ignore inner documents\r\n return if self.direction == INNER\r\n # calculate auto assingees\r\n receiver_ids = self.motions.where(status: CURRENT, receiver_type: 'HR::Employee').to_a.map{ |motion| motion.receiver_user }.flatten.map{|user| user.id}.uniq\r\n auto_assignee_ids = Sys::UserRelation.where(role: ROLE_AUTO_ASSIGNEE).where('USER_ID IN (?)', receiver_ids).to_a.map{ |rel| rel.related_id }.uniq\r\n # process each auto-assignee\r\n send_type_direction = Document::ResponseTypeDirection::SEND\r\n send_type = Document::ResponseType.where(direction: send_type_direction, role: ROLE_AUTO_ASSIGNEE).first\r\n auto_assignee_ids.each do |auto_assignee_id|\r\n unless self.motions.where(receiver_user_id: auto_assignee_id).any?\r\n motion = Document::Motion.create!(document: self, parent: nil, is_new: 1, ordering: Document::Motion::ORDERING_AUTO_ASIGNEE,\r\n send_type: send_type, sender_user: user, receiver_user_id: auto_assignee_id, receiver_role: ROLE_ASSIGNEE, status: SENT,\r\n sent_at: Time.now, received_at: Time.now)\r\n if motion.should_be_current?\r\n motion.update_attributes!(status: CURRENT)\r\n end\r\n docuser = Document::User.create!(document: self, user_id: auto_assignee_id, is_new: 1, is_changed: 1)\r\n end\r\n end\r\n end", "def perform(params)\n # manual auto approve should never call this job\n init_params(params)\n\n r = fetch_and_validate_models\n return if !r\n\n compute_auto_approval\n\n failed_reason_count = (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.auto_approve_fail_reasons).count\n\n if failed_reason_count == 0 && @client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type\n # qualify service call\n qualify_params = {\n id: @user_kyc_detail.id,\n admin_id: Admin::AUTO_APPROVE_ADMIN_ID,\n client_id: @user_kyc_detail.client_id,\n client: @client,\n is_auto_approve: true\n }\n\n service_response = AdminManagement::Kyc::AdminAction::ApproveDetails.new(qualify_params).perform\n\n ApplicationMailer.notify(\n body: 'Unable to Auto Approve a valid case',\n data: {\n user_extended_detail_id: @user_extended_detail_id,\n user_kyc_comparison_detail_id: @user_kyc_comparison_detail.id\n },\n subject: 'Unable to Auto Approve a valid case'\n ).deliver if !service_response.success?\n\n else\n send_manual_review_needed_email\n end\n\n @user_kyc_comparison_detail.client_kyc_pass_settings_id = @client_kyc_pass_setting.id\n @user_kyc_comparison_detail.save!\n end", "def send_recover_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: false)\n end", "def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end", "def alter\n UserNotifier.deliver_user_review(self, user)\n end", "def approve_user(user_id)\n post(\"/users/#{user_id}/approve\")\n end", "def notify_status_approved(user, redemption)\n @redemption = redemption\n @reward = redemption.reward\n @approver = redemption.approver\n @user = user\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_approved\", reward_title: redemption.reward.title))\n end", "def approve_user\n user = User.find(params[:id])\n user.update_attributes(coop_id: params[:coop_id])\n flash[:success] = \"#{user.name} has been admitted to \\\n #{Coop.find(user.coop_id).name}. Thanks MemCo!\"\n\n redirect_to root_url\n notify_user_approval(user, params[:coop_id])\n end", "def enable_auto_approve\n add option: \"-auto-approve=true\"\n end", "def update\n @users = User.find(params[:id])\n if params[:approved]\n if current_user && current_user.is_admin?\n if @users.update(user_params)\n # Tell the UserMailer to send a welcome email after approval\n UserMailer.user_approved(@users).deliver_later\n render json: { status: 200, msg: 'User details have been updated.' }\n end\n else\n render json: { error: 'You are not authorized to modify this data'} , status: 401\n end\n else\n if @users.update(user_params)\n render json: { status: 200, msg: 'User details have been updated.' }\n end\n end\n end", "def approve\n # raise @user.inspect\n @initiatives = Initiative.find(params[:id])\n @initiatives.is_approved = !@initiatives.is_approved?\n @initiatives.update_column(:is_approved,true) \n # if @initiatives.is_approved\n @user= User.find_by_id(@initiatives.user_id)\n reputation_count = @user.reputation\n @initiatives1 = @user.update_column(:reputation,reputation_count+10)\n # end\n @initiatives.save!\n \n redirect_to :back\n end", "def approve\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.organization.update_attribute(:approved, true)\n n.actor.update_attribute(:approved, true)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end", "def update_user_info!\n if REQUIRES_PARENT_APPROVAL\n ::Users::Notifications::IsWaitingForApproval.update_approval_notification!(self.user)\n else\n ::Users::Notifications::ChildNewItem.update_notification!(self)\n end\n self.user.recalculate_item_count!\n end", "def send_active_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: true)\n end", "def check_auto_assignees_exception!(user)\r\n return unless AUTO_ASSIGNEE_EXCEPTION_DOCTYPES.include?(self.type_id)\r\n unless self.motions.where(receiver_user_id: AUTO_ASSIGNEE_EXCEPTION).any?\r\n send_type = Document::ResponseType.find(AUTO_ASSIGNEE_EXCEPTION_RESPONSE_TYPE)\r\n motion = Document::Motion.create!(document: self, parent: nil, is_new: 1, ordering: Document::Motion::ORDERING_AUTO_ASIGNEE_EXCEPTION,\r\n send_type: send_type, sender_user: user, receiver_user_id: AUTO_ASSIGNEE_EXCEPTION, receiver_role: ROLE_ASSIGNEE, status: SENT,\r\n sent_at: Time.now, received_at: Time.now)\r\n if motion.should_be_current?\r\n motion.update_attributes!(status: CURRENT)\r\n end\r\n docuser = Document::User.create!(document: self, user_id: AUTO_ASSIGNEE_EXCEPTION, is_new: 1, is_changed: 1)\r\n end\r\n end", "def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end", "def approve_user\n @user = User.find(params[:id])\n\n @user.approved_torcida = true\n @user.save(validate: false)\n redirect_to root_path\n end", "def auto_approve?\n return user.auto_approve_comment?\n end", "def approve!\n raise 'not pending' unless self.status == 'PENDING'\n\n transaction do\n self.status = 'APPROVED'\n self.save!\n overlapping_pending_requests.update_all(status: 'DENIED')\n end\n end", "def notify_user_approval(user, coop_id)\n UserMailer.notify_user_approval(user, user.coop_id).deliver_now\n end", "def post_approve_email\n NotificationMailer.post_approve_email('default@email.com')\n end", "def approve\n @reservation.is_approved = true\n @reservation.status = :approved\n @reservation.admin_response_time = Time.now\n respond_to do |format|\n if @reservation.save\n notify_approved\n format.html { redirect_to @reservation, flash: { success: 'Reservation has been approved' } }\n format.json { render :show, status: :ok, location: @reservation }\n else\n respond_to_errors :show, format\n end\n end\n end", "def submitForApproval(period=nil, comment='', name=@username)\n if period.nil? then\n # First day of work week\n cur = currentApprovalStatus(nil, name)\n period = cur.access 'period.dateFrom'\n end\n verbose \"Submitting timesheet for #{period}\"\n post('timesheet-approval/', {\n :user=>{\n :name=>name,\n },\n :period=>{\n :dateFrom=>period,\n },\n :action=>{\n :name=>:submit,\n :comment=>comment,\n }\n }) unless $cfg['tool.dry']\n end", "def approve_me\n self.update!(status: 'APPROVED')\n end", "def district_approve(user, date)\n\t raise \"Can't approve this, as it has already been approved for recording at the district\" if self.credit_transmittal_batch_id\n\t \n\t self.district_finalize_approved = true\n self.district_finalize_approved_by = user.last_name_first\n self.district_finalize_approved_on = date\n\n # set denormalized credits info\n denormalize_credit\n \n save!\n\n self.child_credit_assignments.each do |ca|\n if ca.denormalize_credit\n ca.save\n end\n end\n\tend", "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def send_approve_email\n 'send_approve_email'\n end", "def approve!\n\t\tif self.status == \"active\"\n\t\t\traise \"ERROR in approving an already active member\"\n\t\telsif self.status == \"rejected\"\n\t\t\traise \"ERROR cannot approve rejected member\"\n\t\telse\n\t\t\tself.update!(status: \"active\")\n\t\tend\n\tend", "def project_approval(user)\n @user = user\n mail to: @user.email, subject: \"Approval of requested project at Freelancer.com\"\n end", "def process_self_audit_update(result_update, design_check, user)\n\n if design_check.designer_result == \"None\"\n\n self.update_self_check_count\n \n if self.designer_complete?\n AuditMailer.self_audit_complete(self).deliver\n AuditMailer.final_review_warning(self.design).deliver\n end\n \n self.reload\n \n end\n\n design_check.update_designer_result(result_update, user)\n \n end", "def update\n @ticket.approved_at = Time.now\n \n if @ticket.update(ticket_params)\n \n # Add customer feedback to Notes\n if @ticket.approval_feedback.present?\n @ticket.notes.create(\n note_type: :from_customer,\n note: @ticket.approval_feedback\n )\n end\n \n # Email approval\n Ticket::CustomerMailer.ticket_approval_email(@ticket).deliver_later\n \n message = if @ticket.approved?\n 'Thanks for approving our work.'\n else\n 'Thank you for your feedback.'\n end\n message += \" A confirmation will be emailed to #{@ticket.approval_email}.\"\n \n redirect_to ticket_approval_path, notice: message\n else\n approval_confirm\n end\n end", "def set_approver!(_ctx, user:, performer:, **)\n user.update!(approver_id: performer)\n end", "def dean_approve_awards(user)\n for award in awards.valid\n award.update_attribute(:amount_awarded, award.amount_requested) if award.amount_awarded.blank?\n award.update_attribute(:amount_awarded_user_id, user.id)\n end\n update_attribute(:approved_at, Time.now)\n end", "def approve_with_notify(swimming_buddy, shares_passages = false, shares_trainings = false, shares_calendars = false)\n if @user.approve(swimming_buddy, shares_passages, shares_trainings, shares_calendars)\n NewsFeed.create_social_approve_feed(@user, swimming_buddy)\n # TODO: Create also achievement row accordingly?\n end\n end", "def update_auto_approve_setting\n service_response = ClientManagement::UpdateAutoApproveSetting.new(params).perform\n render_api_response(service_response)\n end", "def approve_institution\n user = User.find_by_username(params[:username])\n raise ActiveRecord::RecordNotFound unless user\n\n command = ApproveUserInstitutionCommand.new(user, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"Institution change approved for user #{user.username}.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end", "def do_patch_modification_users\n dauto = nil\n autorised = begin\n if dpaie = try_paiement_unan\n dauto = {\n start_time: dpaie[:created_at],\n end_time: dpaie[:created_at] + (365+366).days,\n raison: \"UNANUNSCRIPT\"\n }\n true\n elsif dpaie = try_paiement_abonnement\n dauto = {\n start_time: dpaie[:created_at],\n end_time: dpaie[:created_at] + 365.days,\n raison: \"ABONNEMENT UN AN\"\n }\n true\n elsif icarien_actif?\n dauto = {\n start_time: Time.now.to_i - 10,\n end_time: nil,\n raison: \"ICARIEN ACTIF\"\n }\n true\n else\n false\n end\n end\n\n if autorised && dauto\n table_autorisations.insert(dauto.merge!(user_id: id, created_at: Time.now.to_i, updated_at: Time.now.to_i))\n debug \"USER AUTORISÉ : #{pseudo} (##{id}) : #{dauto.inspect}\"\n reset_autorisations\n end\n return autorised\n end", "def approve\n User.where(id: params[:user_ids]).update_all(approved: true)\n\n respond_to do |format|\n format.html { redirect_to users_url(filter: \"unapproved\"), notice: 'Benutzer wurden freigeschaltet.' }\n format.json { head :no_content }\n end\n end", "def approve\n respond_to do |format|\n if @version.approve!(current_user)\n UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end", "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end", "def perform\n User.where(id: @bug.notify_on_deploy).each do |user|\n NotificationMailer.deploy(@bug, user).deliver\n end\n end", "def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end", "def user_updated_by_admin user\n data = {\n category: 'Users',\n action: 'Updated by Admin',\n label: user.email,\n value: nil,\n bounce: true,\n }\n\n create_event data\n end", "def update\n @user = User.find(params[:id])\n\n if params[:user].has_key?(:is_admin) && current_user.is_admin\n @user.is_admin = params[:user][:is_admin]\n end\n @user.assign_attributes(params[:user])\n did_save = @user.save\n \n if @user.fix_ude_approval_order_gaps?\n flash[:alert] = 'There were gaps in the approval order that have been automatically corrected'\n end\n\n\n respond_to do |format|\n if did_save \n prepare_contacts\n flash[:notice] = 'Changes have been saved'\n format.html { render :action=>:show }\n format.json { head :ok }\n else\n prepare_contacts\n format.html { render :action=>:show }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n \n end\n end", "def mark_lead_approved(event)\n if event.job.lead && event.job.lead.approved_at.nil?\n event.job.lead.update(approved_at: Time.now.utc)\n end\n end", "def approve_clutch\n @clutch.approved = !@clutch.approved\n if @clutch.save\n redirect_to users_path\n else\n redirect_to users_path, alert: \"Error! Failed to Approve!\"\n end\n end", "def send_mail_to_attendees_on_update\n if self.category.eql?(\"appointment\")\n if self.changed.include?(\"start_date\") or self.changed.include?(\"attendees_emails\") or self.changed.include?(\"repeat\") or self.changed.include?(\"count\") or self.changed.include?(\"until\")\n user = self.matter_people.assignee\n if self.attendees_emails\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_update_notificaton_to_attendees(user, self, i)\n end\n end\n\n true\n end\n end\n end", "def date_approval=(date)\n super parse_date(date)\n end", "def edit_tracker_usecase\n @user=find_user\n if @user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n format.html { redirect_to show_tracker_use_url(@tracker.id) }\n else\n format.html { redirect_to trackers_path }\n end\n end\n\n else\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def approve!\n self.approved = true\n self.save\n end", "def approve\n #get profile, and profile owner\n presenter = find_presenter\n profile = presenter.presenter_profile\n \n #check status of profile\n #if waiting for admin approval\n if profile.status == \"pending_admin\"\n #check if logged in user is an admin\n if current_user.user_type == \"admin\"\n if profile.approve\n flash[:info] = \"This profile has been approved\"\n Notification.send_message(presenter.user, \"Your profile changes have been approved.\", presenter_profile_path(presenter), :system)\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n \n else #Incorrect user\n flash[:info] = \"Profile changes are waiting for approval from admin.\"\n redirect_to root_url\n end\n\n #if waiting for profile owner approval\n elsif profile.status == \"pending_presenter\"\n #check if logged in presenter is profile owner\n if presenter == current_user.presenter\n if profile.approve\n flash[:info] = \"Your profile has been approved\"\n redirect_to presenter_profile_path(presenter)\n else\n flash[:danger] = \"Something went wrong\"\n redirect_to presenter_profile_path(presenter)\n end\n else #incorrect user\n flash[:info] = \"Profile changes are waiting approval from presenter\"\n redirect_to presenter_profile_path(presenter)\n end\n\n else #profile is already approved\n flash[:warning] = \"Profile is already approved\"\n redirect_to root_url\n end\n end", "def send_outstanding_alert_to_contractor(agency, user)\n setup_email\n body[:agency] = agency\n body[:user] = user\n recipients user.email\n subject \"Timesheet Submission Reminder\"\n end", "def send_manual_review_needed_email\n return if (@reprocess == 1) || !@user_kyc_detail.send_manual_review_needed_email?\n\n review_type = (@client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type) &&\n (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.ocr_fr_review_type_failed_reasons).present? ?\n GlobalConstant::PepoCampaigns.ocr_fr_failed_review_type :\n GlobalConstant::PepoCampaigns.manual_review_type\n\n template_variables = {\n case_id: @user_kyc_detail.id,\n full_name: @user_extended_detail.get_full_name,\n review_type: review_type\n }\n\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_comparison_detail.client_id,\n GlobalConstant::Admin.manual_review_needed_notification_type\n )\n\n admin_emails.each do |admin_email|\n ::Email::HookCreator::SendTransactionalMail.new(\n client_id: ::Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: ::GlobalConstant::PepoCampaigns.manual_review_needed_template,\n template_vars: template_variables\n ).perform\n\n end\n\n end", "def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def approve\n self.status = \"approved\"\n self.save\n\n start_d, end_d = DateTime.parse(begin_date.to_s), DateTime.parse(end_date.to_s)\n\n other_requests = CatRentalRequest.where(:cat_id => cat_id).where(\"id != ?\", id).all\n other_requests.each do |request|\n b_date, e_date = parse_dates(request.begin_date, request.end_date)\n\n if (b_date..e_date).any?{|d| (start_d..end_d).include?(d)}\n CatRentalRequest.find(request.id).update_attributes(:status => \"denied\")\n CatRentalRequest.find(request.id).save!(:validate => false)\n end\n end\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"consigndotnyc@gmail.com\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def reject!(user_id)\n if self.rejected_at.nil?\n self.update_attributes(rejected_at: Time.now, approved_at: nil, user: user_id)\n end\n self\n end", "def thursday_update(user)\n @user = user\n @compliment = random_compliment\n mail( to: @user.email,\n subject: 'Weekly Job Update - MonkeyCage' )\n end", "def update\n @task.task_type = params[:task_type]\n @task.title = build_title(params[:task_type], params[:task][:course_id])\n # Try to convert the date supplied to a valid date. Otherwise, we use the current dt\n begin\n @task.due_date = DateTime.parse(params[:due_date])\n rescue\n @task.due_date = DateTime.now\n end\n respond_to do |format|\n if(confirm_same_user(@task.user_id) && @task.update(task_params))\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def notify_requester(needs_review, comment)\n if proposal.requester != comment.user\n if needs_review == true\n ProposalMailer.\n proposal_updated_needs_re_review(proposal.requester, proposal, comment).\n deliver_later\n else\n ProposalMailer.\n proposal_updated_no_action_required(proposal.requester, proposal, comment).\n deliver_later\n end\n end\n end", "def approve_user\n users_to_be_approved = params[:users_to_be_approved]\n users_to_be_rejected = params[:users_to_be_rejected]\n\n approve = params[:approve]\n\n flash[:notice] = \"\"\n\n #This block is to handle the users to be approved ...\n unless users_to_be_approved.nil?\n users_to_be_approved = users_to_be_approved.map(&:to_i)\n User.find(users_to_be_approved).each do |each_user|\n each_user.update_attribute('approved',true)\n Thread.new{\n UserNotifications.deliver_user_approved(each_user)\n }\n# puts \"#{each_user.full_name} approved ...\"\n end\n\n flash[:notice] += \"#{users_to_be_approved.length} users Successfully Approved\"\n \n else\n flash[:notice] += \"No Users Selected for Approval\"\n end\n #Till Here\n\n #This block is to handle the users to be rejected ...\n unless users_to_be_rejected.nil?\n users_to_be_rejected = users_to_be_rejected.map(&:to_i)\n User.find(users_to_be_rejected).each do |each_user|\n each_user.update_attribute('approved',false)\n end\n\n flash[:notice] += \"</br>#{users_to_be_rejected.length} users Successfully Rejected\"\n else\n flash[:notice] += \"</br>No Users Selected for Rejection\"\n end\n #Till Here\n\n @users = User.approved\n @users_to_be_approved = User.to_be_approved\n\n respond_to do |format|\n format.html {redirect_to :index}\n format.js\n end\n\n end", "def update\n puts params\n @question = Question.find(params[:id])\n if params[:commit] == 'Answer'\n @question.resolved = true\n @question.end_time = Time.now\n @question.username = current_user.email.split('@')[0]\n if @question.update(update_question_params)\n redirect_to solve_path\n end\n end\n\n if params[:commit] == 'Escalate'\n @question.escalated = true\n @escalate = @question.escalatings.create();\n @question.save\n @escalate.username = current_user.email.split('@')[0]\n @escalate.save\n redirect_to solve_path\n end \n \n end", "def edit_usecase_file\n find_user\n if !@user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n if @use_case.update_attributes(params[:use_case])\n if (!params[:use_case][:status].nil?)\n\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(current_user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n find_user\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n redirect_to show_file_uses_url(@file.id)\n else\n redirect_to project_files_path\n end\n\n else\n\n\n flash[:notice]= t(:usecase_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def notify_approver(item)\n @item = item\n @url = case @item.class.name\n when 'Program'\n program_url(@item)\n when 'Event'\n event_url(@item)\n end\n mail(subject: \"#{@item.name} may need your approval\")\n end", "def update\n\n old_assigned_to_user = @request.assigned_to_user.to_s \n new_assigned_to_user = params[:request][:assigned_to_user]\n\n respond_to do |format|\n\n params[:request][:issue_ids] ||= []\n if @request.update(request_params)\n\n # save new comments\n if params[:request][:comment] != nil\n comment = @request.comments.create\n comment.comment = params[:request][:comment]\n comment.user_id = current_user.id\n comment.save\n # make sure updated_at gets updated\n @request.touch\n end\n \n if current_user.worker?\n if params[:status] == \"approved\"\n @request.approved!\n elsif params[:status] == \"completed\"\n @request.completed!\n @request.requester!\n end \n elsif current_user.approver?\n if params[:status] == \"approved\"\n @request.approved!\n @request.worker!\n elsif params[:status] == \"disapproved\"\n @request.disapproved!\n @request.requester!\n end \n\n else\n add_issues_to_request \n end\n\n # send email notification when assigned_to_user field has changed\n if old_assigned_to_user != new_assigned_to_user && !new_assigned_to_user.nil?\n RequestMailer.assignee_email(@request).deliver_later\n end\n\n\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def dmail_inactive_approvers!\n days_until_next_month = (Date.current.next_month.beginning_of_month - Date.current).to_i\n return unless days_until_next_month <= 21\n\n inactive_approvers.each do |user|\n Dmail.create_automated(to: user, title: \"You will lose approval privileges soon\", body: <<~BODY)\n You've approved fewer than #{MINIMUM_APPROVALS} posts in the past\n #{APPROVAL_PERIOD.inspect}. You will lose your approval privileges in\n #{days_until_next_month} #{\"day\".pluralize(days_until_next_month)}\n unless you have approved at least #{MINIMUM_APPROVALS} posts by the end\n of the month.\n BODY\n end\n end", "def user_update(user_id)\n trade_lines.each do |x|\n if x.inventory_own.user_id != user_id\n x.user_from_accepted = false \n else\n x.user_from_accepted = true\n end\n x.save\n end\n end", "def approve\n @reservation.update_attribute(:status, 1)\n ReservationMailer.approve_request(@reservation).deliver\n redirect_to received_reservations_path + \"#\" + params[:current_tab]\n end", "def update_if_necessary(params)\n update_needed = false \n \n if !params[:daily_email].nil? &&\n self.daily_email_reminder_enabled != params[:daily_email]\n update_needed = true\n self.daily_email_reminder_enabled = params[:daily_email]\n end\n\n if !params[:email].nil? && \n self.email != params[:email]\n update_needed = true\n self.email = params[:email]\n end\n\n if update_needed\n self.save\n end\n end", "def prune!\n inactive_approvers.each do |user|\n CurrentUser.scoped(User.system) do\n user.update!(level: User::Levels::CONTRIBUTOR)\n user.feedback.create!(category: \"neutral\", body: \"Lost approval privileges\", creator: User.system, disable_dmail_notification: true)\n\n Dmail.create_automated(\n to_id: user.id,\n title: \"Approver inactivity\",\n body: \"You've approved fewer than #{MINIMUM_APPROVALS} posts in the past #{APPROVAL_PERIOD.inspect}. In order to make sure the list of active approvers is up-to-date, you have lost your approval privileges. If you wish to dispute this, you can message an admin to have your permission reinstated.\"\n )\n end\n end\n end", "def edit_requirement_tracker\n find_user\n if !@user.nil?\n\n status=@req.status\n\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\") or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@project_req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@project_req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n redirect_to show_tracker_req_url(@tracker.id)\n else\n redirect_to trackers_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def update!(**args)\n @escalate_to = args[:escalate_to] if args.key?(:escalate_to)\n @executed_by = args[:executed_by] if args.key?(:executed_by)\n @reason = args[:reason] if args.key?(:reason)\n end", "def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end", "def send_update_or_cancel_appt_email(appt_id, appt_params)\n if appt_params[:status] == 'Scheduled'\n AppointmentMailer.delay.appointment_update_for_tutor(appt_id)\n AppointmentMailer.delay.appointment_update_for_student(appt_id)\n end\n if appt_params[:status] == 'Cancelled'\n AppointmentMailer.delay.appointment_cancellation_for_tutor(appt_id)\n AppointmentMailer.delay.appointment_cancellation_for_student(appt_id)\n end\n end", "def updater(user)\n # self.updated_by_id = user.id\n\n ur = self.users_roles\n ur.each do |u|\n if u.created_at == nil then\n u.created_at = DateTime.now\n u.created_by_id = self.id\n end\n\n end\n self.save\n end", "def approve_request\n puts \"............. AccountmanagerController::approve_request \"+params[:user_id].to_s\n # Change the user type to be a member of SRDR\n user_id = params[:user_id].to_i\n @user = User.find(:first, :conditions=>[\"id = ?\",user_id])\n @user.user_type = \"member\"\n @user.save\n\n # Move the registration status to APPROVED\n @registration = Registar.find(:first, :conditions=>[\"login = ?\",@user.login])\n @registration.status = \"APPROVED\"\n @registration.save\n\n # Add Organization if it does not already exist\n @organization = Organizations.find(:first, :conditions=>[\"name = ?\",@user.organization])\n if @organization.nil? &&\n !@user.organization.nil? &&\n (@user.organization.length > 0)\n @organization = Organizations.new\n @organization.name = params[\"organization\"]\n @organization.contact_name = \"No Contact\"\n @organization.save\n else\n # Set default organization for this user\n @organization = Organizations.new\n @organization.name = \"TMC EPC\"\n @organization.contact_name = \"No Contact\"\n @organization.save\n end\n\n # Now setup the user's organization role\n @userorgroles = UserOrganizationRole.new\n @userorgroles.user_id = @user.id\n @userorgroles.role = \"contributor\"\n @userorgroles.status = \"VALID\"\n @userorgroles.organization_id = @organization.id\n @userorgroles.save\n\n # Send E-mail notification of approval to the user\n #ConfirmationMailer.notifyApproval(@registration).deliver\n\n # Go back to user list - added to SRDR-Dev only\n redirect_to \"/home/user_list\"\n end", "def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def update\n @questionnaire.user_approval_date = Time.now\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n previous_completed = @task.completed\n previous_deadline = @task.deadline\n previous_owner = @task.user\n new_owner = User.find_by(id: params[:task][:user_id])\n task_owner = @task.user\n project = @task.milestone.project\n success = @task.milestone.success\n\n #you can STILL edit tasks when the project becomes a success\n if project.present?\n project_owner = @task.milestone.project.user\n else\n success_owner = @task.milestone.success.leader\n end\n\n if !params[:task][:deadline].nil?\n new_deadline = params[:task][:deadline]\n if new_deadline != previous_deadline && current_user != task_owner\n task_owner.notify(\"alert\", \"#{view_context.link_to current_user.full_name, current_user} changed the due date of\n #{view_context.link_to @task.description, @task.milestone.project} to #{new_deadline}\")\n end\n end\n\n #Notify a task was completed\n if params[:task][:completed] == \"true\" && current_user != task_owner\n task_owner.notify(\"alert\", \"Your task '#{@task.description}' in #{view_context.link_to project.title, project} was completed by #{view_context.link_to current_user.full_name, current_user}\")\n end\n\n #notifies user they have a new task\n if !new_owner.nil? && new_owner != current_user && new_owner != task_owner\n if @task.milestone.project.present?\n new_owner.notify(\"alert\", \"You were assigned to a task in the project #{view_context.link_to @task.milestone.project.title, project}\")\n else\n new_owner.notify(\"alert\", \"You were assigned to a task in the success #{view_context.link_to @task.milestone.success.title, success}\")\n end\n end\n\n modified_params = task_params.clone\n if modified_params[:completed] == \"true\"\n modified_params.merge!({completed_at: DateTime.now})\n next_task = Task.find_by_position_and_milestone_id((@task.position - 1), @task.milestone_id)\n if next_task.present?\n next_task.ball_is_in_your_court(@task) if next_task.user.present? && next_task.crucial == true\n end\n elsif modified_params[:completed] == \"false\"\n modified_params.merge!({completed_at: nil})\n end\n\n respond_to do |format|\n if @task.update_attributes(modified_params)\n @task.create_activities(previous_completed, previous_deadline, previous_owner, current_user)\n\n # during update, if there is 1 last task remaining already and someone is updating client's remaining incomplete task the project owner will be notified every time\n # user!=project_owner ensures that if the changes are made by the project_owner, client is not notified (since client can see it)\n if @task.milestone.tasks.where(completed: false).size==1 && (task_owner!=project_owner || task_owner!=project_owner) && params[:task][:completed]\n\n # if never_alerted (which should be a boolean that shows if there already was a notification from this task)\n if project.present?\n project_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, project} is completed!\")\n else\n success_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, success} is completed!\")\n end\n end\n\n # user id gets saved as 0 sometimes when being set as nil. this changes it back\n if @task.user_id == 0\n @task.update_attributes(user_id: nil)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n if project.present?\n format.html { redirect_to project, notice: 'Task was successfully updated.' }\n else\n format.html { redirect_to success, notice: 'Task was successfully updated.' }\n end\n format.json { respond_with_bip(@task) }\n else\n if project.present?\n format.html { redirect_to project, alert: @task.errors.full_messages.to_sentence }\n else\n format.html { redirect_to success, alert: @task.errors.full_messages.to_sentence }\n end\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def deny_users(deny_ids)\n deny_ids.each do |id|\n user = User.find(id)\n if user.update_attributes({approval: -1}, as: :admin)\n @@message = \"The users have been denied.\"\n end\n end\n end" ]
[ "0.705809", "0.70130646", "0.6508065", "0.6465678", "0.6300665", "0.6278232", "0.6221501", "0.6195856", "0.6142169", "0.6118958", "0.60702586", "0.60666263", "0.60202366", "0.60108733", "0.6000856", "0.59855175", "0.5981225", "0.59782726", "0.595893", "0.588726", "0.5870462", "0.5855939", "0.58523244", "0.5829834", "0.5810672", "0.5776488", "0.5770583", "0.5766287", "0.5745026", "0.56889653", "0.56865686", "0.5664032", "0.56627595", "0.56384784", "0.56329894", "0.56308144", "0.56144214", "0.56128526", "0.5605079", "0.5594964", "0.5587652", "0.55775005", "0.55756396", "0.5573355", "0.5566281", "0.5562919", "0.5559231", "0.55566937", "0.5543426", "0.5541997", "0.5534031", "0.55317414", "0.5526377", "0.5525219", "0.5509582", "0.549978", "0.5487246", "0.54828006", "0.54462564", "0.5438762", "0.54316384", "0.54310036", "0.543076", "0.5419273", "0.5400455", "0.5397046", "0.53959686", "0.5389077", "0.53789115", "0.5377716", "0.537484", "0.5368792", "0.5362856", "0.5360203", "0.53525853", "0.534709", "0.5344574", "0.5338911", "0.53317124", "0.5325248", "0.53154963", "0.5314404", "0.5308584", "0.5305082", "0.530016", "0.52963775", "0.5295115", "0.5294204", "0.5275418", "0.525851", "0.52469045", "0.5241934", "0.52363104", "0.5235278", "0.52347356", "0.52323604", "0.5223813", "0.52141947", "0.52135265", "0.5212117" ]
0.5436844
60
Trigger auto approve update rescue task Author: Aniket Date: 06/07/2018 Reviewed By:
def trigger_auto_approve_update_rescue_task(user_extended_details_id) BgJob.enqueue( AutoApproveUpdateJob, { client_id: @client_id, reprocess: 1, user_extended_details_id: user_extended_details_id } ) Rails.logger.info("---- enqueue_job AutoApproveUpdateJob for ued_id-#{user_extended_details_id} done") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_approve!\n update_attribute(:approved_at,DateTime.now)\n update_attribute(:approved_by, User.APPLICATION)\n write_key!\n end", "def auto_approve\n if !self.auto_approved && self.approval_status.nil?\n UserMailer.auto_approved_email(self).deliver\n self.auto_approved = true\n self.approval_status = true\n self.save\n end\n end", "def auto_approve_type\n 'auto'\n end", "def alteration_approve\n UserNotifier.deliver_in_process(self, user)\n end", "def auto_approve\n user=photo.user or return nil\n if user.admin?\n photo.approver_id=user.id\n photo.status = Photo::STATUS_APPROVED\n end\n end", "def escalate_approval\n if !self.user.manager_id.nil?\n if self.manager.manager_id.nil?\n self.auto_approve()\n else\n UserMailer.escalate_approval_email(self).deliver\n self.is_escalated = true\n self.save\n end\n end\n end", "def approve!\n self.approved_at = Time.now\n registration.approve\n save!\n end", "def enable_auto_approve\n add option: \"-auto-approve=true\"\n end", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def approve!\n raise 'not pending' unless self.status == 'PENDING'\n\n transaction do\n self.status = 'APPROVED'\n self.save!\n overlapping_pending_requests.update_all(status: 'DENIED')\n end\n end", "def approve!\n self.approved = true\n self.save\n end", "def approve\n self.update(status: \"APPROVED\")\n end", "def approve_me\n self.update!(status: 'APPROVED')\n end", "def update_auto_approve_setting\n service_response = ClientManagement::UpdateAutoApproveSetting.new(params).perform\n render_api_response(service_response)\n end", "def approve\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.organization.update_attribute(:approved, true)\n n.actor.update_attribute(:approved, true)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def approve\n @reservation.is_approved = true\n @reservation.status = :approved\n @reservation.admin_response_time = Time.now\n respond_to do |format|\n if @reservation.save\n notify_approved\n format.html { redirect_to @reservation, flash: { success: 'Reservation has been approved' } }\n format.json { render :show, status: :ok, location: @reservation }\n else\n respond_to_errors :show, format\n end\n end\n end", "def update\n @task = @pickup.tasks.find(params[:id])\n\n if @task.update_status(params[:commit], current_user, params[:task][:comments])\n donemark \"#{@task.name} #{@task.status}.\"\n audit \"Pickup \\\"#{@pickup.name}\\\" task #{@task.name} #{@task.status}\", :auditable => @pickup\n else\n errormark \"Unable to update task.\"\n end\n\n redirect_to :action => 'index'\n end", "def send_approve_email\n 'send_approve_email'\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def update\n @ticket.approved_at = Time.now\n \n if @ticket.update(ticket_params)\n \n # Add customer feedback to Notes\n if @ticket.approval_feedback.present?\n @ticket.notes.create(\n note_type: :from_customer,\n note: @ticket.approval_feedback\n )\n end\n \n # Email approval\n Ticket::CustomerMailer.ticket_approval_email(@ticket).deliver_later\n \n message = if @ticket.approved?\n 'Thanks for approving our work.'\n else\n 'Thank you for your feedback.'\n end\n message += \" A confirmation will be emailed to #{@ticket.approval_email}.\"\n \n redirect_to ticket_approval_path, notice: message\n else\n approval_confirm\n end\n end", "def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end", "def update_from_params(params, user)\n super_return_value = super\n if %w[InformalHearingPresentationTask IhpColocatedTask].include?(type) &&\n params[:status] == Constants.TASK_STATUSES.completed\n MetricsService.record(\"Sending VSO IHP complete notification to VA Notify for #{appeal.class} \"\\\n \"ID #{appeal.id}\",\n service: nil,\n name: \"AppellantNotification.notify_appellant\") do\n AppellantNotification.notify_appellant(appeal, @@template_name)\n end\n end\n super_return_value\n end", "def click(event)\n data = {\n agenda: Agenda.file,\n initials: User.initials,\n attach: @@item.attach,\n request: request\n }\n\n @disabled = true\n Pending.update 'approve', data do |pending|\n @disabled = false\n end\n end", "def perform(params)\n # manual auto approve should never call this job\n init_params(params)\n\n r = fetch_and_validate_models\n return if !r\n\n compute_auto_approval\n\n failed_reason_count = (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.auto_approve_fail_reasons).count\n\n if failed_reason_count == 0 && @client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type\n # qualify service call\n qualify_params = {\n id: @user_kyc_detail.id,\n admin_id: Admin::AUTO_APPROVE_ADMIN_ID,\n client_id: @user_kyc_detail.client_id,\n client: @client,\n is_auto_approve: true\n }\n\n service_response = AdminManagement::Kyc::AdminAction::ApproveDetails.new(qualify_params).perform\n\n ApplicationMailer.notify(\n body: 'Unable to Auto Approve a valid case',\n data: {\n user_extended_detail_id: @user_extended_detail_id,\n user_kyc_comparison_detail_id: @user_kyc_comparison_detail.id\n },\n subject: 'Unable to Auto Approve a valid case'\n ).deliver if !service_response.success?\n\n else\n send_manual_review_needed_email\n end\n\n @user_kyc_comparison_detail.client_kyc_pass_settings_id = @client_kyc_pass_setting.id\n @user_kyc_comparison_detail.save!\n end", "def approve!\n\t\tif self.status == \"active\"\n\t\t\traise \"ERROR in approving an already active member\"\n\t\telsif self.status == \"rejected\"\n\t\t\traise \"ERROR cannot approve rejected member\"\n\t\telse\n\t\t\tself.update!(status: \"active\")\n\t\tend\n\tend", "def accept!(user_id)\n if self.approved_at.nil?\n # Approvability::Notifier.confirm_approval(self).deliver # Send an email to the contributor\n self.update_attributes(rejected_at: nil, approved_at: Time.now, user: user_id)\n end\n self\n end", "def mark_lead_approved(event)\n if event.job.lead && event.job.lead.approved_at.nil?\n event.job.lead.update(approved_at: Time.now.utc)\n end\n end", "def update\n puts params\n @question = Question.find(params[:id])\n if params[:commit] == 'Answer'\n @question.resolved = true\n @question.end_time = Time.now\n @question.username = current_user.email.split('@')[0]\n if @question.update(update_question_params)\n redirect_to solve_path\n end\n end\n\n if params[:commit] == 'Escalate'\n @question.escalated = true\n @escalate = @question.escalatings.create();\n @question.save\n @escalate.username = current_user.email.split('@')[0]\n @escalate.save\n redirect_to solve_path\n end \n \n end", "def approve\n respond_to do |format|\n if @version.approve!(current_user)\n UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end", "def post_approve_email\n NotificationMailer.post_approve_email('default@email.com')\n end", "def approve!\n update_attribute(:active, true)\n end", "def approve\n # raise @user.inspect\n @initiatives = Initiative.find(params[:id])\n @initiatives.is_approved = !@initiatives.is_approved?\n @initiatives.update_column(:is_approved,true) \n # if @initiatives.is_approved\n @user= User.find_by_id(@initiatives.user_id)\n reputation_count = @user.reputation\n @initiatives1 = @user.update_column(:reputation,reputation_count+10)\n # end\n @initiatives.save!\n \n redirect_to :back\n end", "def approve\n get_event\n @application.update_attributes(status: 'approved')\n add_to_approved_tickets_count\n redirect_to admin_event_path(@application.event_id),\n notice: \"#{ @application.name}'s application has been approved\"\n end", "def notify_status_approved(user, redemption)\n @redemption = redemption\n @reward = redemption.reward\n @approver = redemption.approver\n @user = user\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_approved\", reward_title: redemption.reward.title))\n end", "def send_recover_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: false)\n end", "def update\n previous_completed = @task.completed\n previous_deadline = @task.deadline\n previous_owner = @task.user\n new_owner = User.find_by(id: params[:task][:user_id])\n task_owner = @task.user\n project = @task.milestone.project\n success = @task.milestone.success\n\n #you can STILL edit tasks when the project becomes a success\n if project.present?\n project_owner = @task.milestone.project.user\n else\n success_owner = @task.milestone.success.leader\n end\n\n if !params[:task][:deadline].nil?\n new_deadline = params[:task][:deadline]\n if new_deadline != previous_deadline && current_user != task_owner\n task_owner.notify(\"alert\", \"#{view_context.link_to current_user.full_name, current_user} changed the due date of\n #{view_context.link_to @task.description, @task.milestone.project} to #{new_deadline}\")\n end\n end\n\n #Notify a task was completed\n if params[:task][:completed] == \"true\" && current_user != task_owner\n task_owner.notify(\"alert\", \"Your task '#{@task.description}' in #{view_context.link_to project.title, project} was completed by #{view_context.link_to current_user.full_name, current_user}\")\n end\n\n #notifies user they have a new task\n if !new_owner.nil? && new_owner != current_user && new_owner != task_owner\n if @task.milestone.project.present?\n new_owner.notify(\"alert\", \"You were assigned to a task in the project #{view_context.link_to @task.milestone.project.title, project}\")\n else\n new_owner.notify(\"alert\", \"You were assigned to a task in the success #{view_context.link_to @task.milestone.success.title, success}\")\n end\n end\n\n modified_params = task_params.clone\n if modified_params[:completed] == \"true\"\n modified_params.merge!({completed_at: DateTime.now})\n next_task = Task.find_by_position_and_milestone_id((@task.position - 1), @task.milestone_id)\n if next_task.present?\n next_task.ball_is_in_your_court(@task) if next_task.user.present? && next_task.crucial == true\n end\n elsif modified_params[:completed] == \"false\"\n modified_params.merge!({completed_at: nil})\n end\n\n respond_to do |format|\n if @task.update_attributes(modified_params)\n @task.create_activities(previous_completed, previous_deadline, previous_owner, current_user)\n\n # during update, if there is 1 last task remaining already and someone is updating client's remaining incomplete task the project owner will be notified every time\n # user!=project_owner ensures that if the changes are made by the project_owner, client is not notified (since client can see it)\n if @task.milestone.tasks.where(completed: false).size==1 && (task_owner!=project_owner || task_owner!=project_owner) && params[:task][:completed]\n\n # if never_alerted (which should be a boolean that shows if there already was a notification from this task)\n if project.present?\n project_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, project} is completed!\")\n else\n success_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, success} is completed!\")\n end\n end\n\n # user id gets saved as 0 sometimes when being set as nil. this changes it back\n if @task.user_id == 0\n @task.update_attributes(user_id: nil)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n if project.present?\n format.html { redirect_to project, notice: 'Task was successfully updated.' }\n else\n format.html { redirect_to success, notice: 'Task was successfully updated.' }\n end\n format.json { respond_with_bip(@task) }\n else\n if project.present?\n format.html { redirect_to project, alert: @task.errors.full_messages.to_sentence }\n else\n format.html { redirect_to success, alert: @task.errors.full_messages.to_sentence }\n end\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end", "def approve(user)\n set_attachments\n\n @user = user\n mail(to: @user.email, subject: \"Cuenta Activada @ Social Target - Its time to go social\")\n end", "def approve\n @reservation.update_attribute(:status, 1)\n ReservationMailer.approve_request(@reservation).deliver\n redirect_to received_reservations_path + \"#\" + params[:current_tab]\n end", "def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end", "def approve(user)\n if !self.approved?\n self.approved = true\n self.manager = user\n self.approved_at = Time.now\n end\n end", "def approve_clutch\n @clutch.approved = !@clutch.approved\n if @clutch.save\n redirect_to users_path\n else\n redirect_to users_path, alert: \"Error! Failed to Approve!\"\n end\n end", "def approve\n set_service_request_status(ServiceProvider, ServiceRequest.statuses[:approved])\n\n # notify client\n NotificationsService.send_notification(@current_user, @service_request.service.client, NOTIFICATION_TYPE[:approved_your_request], @service_request.service_id)\n end", "def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end", "def update_task\n authorize!(:update_task,current_user)unless current_user.role?(:secretary)\n data=params\n @note_priority =(data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0'))? 1 : 2\n @task = UserTask.find(data[:id].to_i)\n @com_notes_entries = Communication.find(data[:task][:note_id].to_i)\n if data[:commit].eql?(\"Save & Exit\")\n respond_to do |format|\n # Below mention transaction block basically revert Task entry and even revert the Communication to update.\n # Added by Ajay Arsud Date:09 Sept 2010\n UserTask.transaction do\n if @task.update_attributes(data[:task].merge!(:assigned_to_user_id => @current_user.id))\n @com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))\n flash[:notice] = \"#{t(:text_task)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_saved)}\"\n format.html {redirect_to physical_liviaservices_livia_secretaries_url}\n else\n flash[:error] = t(:flash_task_error)\n format.html {redirect_to physical_liviaservices_livia_secretaries_url}\n end\n end\n end\n elsif data[:commit].eql?(\"Assign To\")\n # Below mention transaction block basically revert Task entry and even revert the Communication to update.\n # Added by Ajay Arsud Date:09 Sept 2010\n UserTask.transaction do\n @task.update_attributes(data[:task])\n @task.update_attributes(:priority => @note_priority,:assigned_to_user_id => data[:task][:assigned_to_user_id])\n respond_to do |format|\n if @task.save\n data[:com_notes_entries][:note_priority] = @note_priority\n @com_notes_entries.update_attributes(data[:com_notes_entries])\n flash[:notice] = \"#{t(:text_task)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_assigned)}\"\n format.html { redirect_to physical_liviaservices_livia_secretaries_url }\n else\n flash[:error] = t(:flash_task_type)\n format.html { redirect_to physical_liviaservices_livia_secretaries_url }\n end\n end\n end\n elsif data[:commit].eql?(\"Complete Task\")\n # Below mention transaction block basically revert Task entry and even revert the Communication to update.\n # Added by Ajay Arsud Date:09 Sept 2010\n UserTask.transaction do\n @task.update_attributes(data[:task].merge!(:status => 'complete',:completed_at =>Time.now,:completed_by_user_id => @current_user.id,:assigned_to_user_id => @current_user.id))\n respond_to do |format|\n if @task.save\n if data[:com_notes_entries][:note_priority] == 0 ||data[:com_notes_entries][:note_priority].eql?('0')\n @note_priority = 1\n else\n @note_priority = 2\n end\n @com_notes_entries.update_attributes(data[:com_notes_entries].merge!(:note_priority=>@note_priority))\n flash[:notice] = \"#{t(:text_task)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_completed)}\"\n format.html { redirect_to physical_liviaservices_livia_secretaries_url }\n else\n flash[:error] = t(:flash_task_type)\n format.html { redirect_to physical_liviaservices_livia_secretaries_url }\n end\n end\n end\n end \n end", "def approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target_user.approval_status == User::ApprovalStatusApproved\n target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n\n # if target_user.approval_status == User::ApprovalStatusApproved\n # if target_user.company_buyer_entities.any?{ |x| x.approval_status == CompanyBuyerEntity::ApprovalStatusPending}\n # target_user.update(comment: comment, approval_date_time: DateTime.current)\n # else\n # target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n # end\n\n if approval_status == User::ApprovalStatusApproved\n UserMailer.approval_email(target_user).deliver_later\n elsif approval_status == User::ApprovalStatusReject\n UserMailer.reject_email(target_user).deliver_later\n end\n result_json = {user_base_info: target_user}\n result_json\n end", "def approvepm\n @timesheet_task = TimesheetTask.find(params[:id])\n if @timesheet_task.status_timesheet_id == 2 # Pending PM\n @timesheet_task.update(status_timesheet_id: 4)\n flash.now[:success] = \"Timesheet have been approved by PM.\"\n end\n render 'datarow'\n end", "def force_update\n begin\n # force retailer change\n if params['target_retailer_id'].present?\n new_retailer = Spree::Retailer.find(params['target_retailer_id'])\n @order.retailer = new_retailer\n end\n\n # force acceptance\n if params['accepted'].present? and params['accepted'] == 'yes'\n @order.update_attribute(:accepted_at, Time.now)\n end\n\n flash[:notice] = 'Forced updates were made to the order.'\n rescue\n flash[:error] = 'Updates could not be applied'\n end\n redirect_to admin_order_path(@order)\n end", "def disapprove\n self.approved = false\n end", "def record_submission\n transaction do\n task.update_attributes(completed_at: DateTime.now)\n project.signal_or_raise!(:accept_proposal, nil, self)\n end\n end", "def auto_approve?\n return user.auto_approve_comment?\n end", "def update\n @task.task_type = params[:task_type]\n @task.title = build_title(params[:task_type], params[:task][:course_id])\n # Try to convert the date supplied to a valid date. Otherwise, we use the current dt\n begin\n @task.due_date = DateTime.parse(params[:due_date])\n rescue\n @task.due_date = DateTime.now\n end\n respond_to do |format|\n if(confirm_same_user(@task.user_id) && @task.update(task_params))\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def approve\n if self.status == \"pending_presenter\" || self.status == \"pending_admin\"\n \n #move edit columns to permanent columns\n self.bio = self.bio_edit\n if self.picture_edit_stored?\n self.picture = self.picture_edit\n end\n\n #clear edit columns\n self.bio_edit = ''\n self.picture_edit = nil\n \n #update status to approved\n self.status = :approved\n return self.save\n else\n return false\n end\n end", "def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end", "def approve_mr\n body = \"approved this merge request\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'approved'))\n end", "def act_on_ok\n if body['message'] == 'Approval successful.'\n output(\n event: 'success',\n message: message_text,\n uuid: body['uuid'],\n accession: payloads.first[:output][:accession]\n )\n else\n Rails.logger.error(\"Approve transfer Job failed with: #{message_text}\")\n output(event: 'failed', message: message_text)\n fail!\n end\n end", "def update\n if @transaction.update(transaction_params)\n\n # implement all admin approved transactions here.\n if @transaction.kind == 'withdraw' and @transaction.status == 'approved' and @transaction.processed == false\n account = Account.find(@transaction.account_id)\n if account.balance > @transaction.amount\n account.balance -= @transaction.amount\n account.save\n @transaction.eff_date = Time.current\n @transaction.processed = true\n @transaction.save\n user_to_mail = User.find(Account.find(@transaction.account_id).user_id)\n UserMailer.transaction_email(user_to_mail, @transaction).deliver_later\n end\n elsif @transaction.kind == 'deposit' and @transaction.status == 'approved' and @transaction.processed == false\n account = Account.find(@transaction.account_id)\n account.balance += @transaction.amount\n account.save\n @transaction.eff_date = Time.current\n @transaction.processed = true\n @transaction.save\n user_to_mail = User.find(Account.find(@transaction.account_id).user_id)\n UserMailer.transaction_email(user_to_mail, @transaction).deliver_later\n elsif @transaction.kind == 'borrow' and @transaction.status == 'approved' and @transaction.processed == false\n account1 = Account.find(@transaction.from)\n account2 = Account.find(@transaction.to)\n if account1.balance > @transaction.amount\n account1.balance -= @transaction.amount\n account2.balance += @transaction.amount\n account1.save\n account2.save\n @transaction.start_date = Time.current\n @transaction.eff_date = Time.current\n @transaction.status = 'approved'\n @transaction.processed = true\n @transaction.account_id = account1.id\n @transaction.save\n sender = User.find(Account.find(@transaction.from).user_id)\n recipient = User.find(Account.find(@transaction.to).user_id)\n UserMailer.transaction_email(sender, @transaction).deliver_later\n UserMailer.transaction_email(recipient, @transaction).deliver_later\n end\n end\n\n redirect_to @transaction, notice: 'Transaction was successfully updated.', id: @transaction.id\n else\n render :edit\n end\n end", "def process_self_audit_update(result_update, design_check, user)\n\n if design_check.designer_result == \"None\"\n\n self.update_self_check_count\n \n if self.designer_complete?\n AuditMailer.self_audit_complete(self).deliver\n AuditMailer.final_review_warning(self.design).deliver\n end\n \n self.reload\n \n end\n\n design_check.update_designer_result(result_update, user)\n \n end", "def approve\n email = Email.find(params[:id])\n email.state = \"Approved\"\n # Send email\n if email.save!\n email.send_email!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def update\n @task = Task.find(params[:id])\n oldtaskname = @task.name\n if @task\n if request.referrer && URI(request.referrer).path == edit_task_path(@task) && (task_params[:name] == nil|| task_params[:name] == \"\")\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n else\n oldcomplete = @task.complete\n oldassignee = @task.assignedto\n users = Project.find_by_id(@task.projectid).allshares.split(\",\")\n found = false\n if @task.assignedto == nil\n @task.assignedto = \"None\"\n end\n if task_params[:assignedto] == nil || task_params[:assignedto] == \"\"\n task_params[:assignedto] = @task.assignedto\n end\n if !(users.include? task_params[:assignedto])\n task_params[:assignedto] = @task.assignedto\n end\n # if task_params[:label] == nil || task_params[:label] == \"\"\n # @task.label = 0\n # end\n @task.update(task_params)\n @task.save!\n if @task.assignedto != oldassignee\n if @task.assignedto != \"None\"\n assignemail = \"\"\n users.each do |user|\n us = User.find_by_id(user)\n if us\n if (us.firstname + \" \" + us.lastname) == @task.assignedto\n if us.noemail != true\n assignemail = us.name\n end\n end\n end\n end\n send_assignment(@task, assignemail)\n\n end\n end\n\n if @task.complete == true && @task.complete != oldcomplete\n mark_complete(@task)\n elsif @task.complete == false\n mark_incomplete(@task)\n end\n\n respond_to do |format|\n if @task\n if oldcomplete == false && @task.complete == true\n @task.datecomplete = @task.updated_at\n elsif oldcomplete == true && @task.complete == false\n @task.datecomplete = nil\n end\n @task.save!\n flash[:alert] = 'Task was successfully updated.'\n if request.referrer && URI(request.referrer).path != edit_task_path(@task)\n format.html { redirect_to request.referrer }\n format.mobile { redirect_to request.referrer, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n elsif request.referrer && URI(request.referrer).path == edit_task_path(@task)\n format.html { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to project_path(@task.projectid), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.mobile { redirect_to task_path(@task.id), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n flash[:error] = \"You must enter a name for a task\"\n redirect_to edit_task_path(@task.id)\n end\n end", "def review_task \n\t\t@data[:task_approver] = @task.approver.try(:full_name)\n\t\t@data[:task_name] = @task.title\n @data[:task_type] = @task.class.to_s.downcase\n\t\t@data[:task_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:recipient_names] = recipient_names\n @template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_task]\n\t\ttrigger_mail\n\tend", "def notify_approver(item)\n @item = item\n @url = case @item.class.name\n when 'Program'\n program_url(@item)\n when 'Event'\n event_url(@item)\n end\n mail(subject: \"#{@item.name} may need your approval\")\n end", "def approval_needed(user)\n @user = user\n\n mail to: ENV['ADMIN_EMAIL'], subject: \"User wants approval for Thumbline Set List\"\n end", "def send_active_needs_approval_email\n Users::SendNeedsApprovalEmailJob.perform_later(user_id: self.id, active: true)\n end", "def set_approval\n self.sanctuary? ? self.approved = false : self.approved = true\n end", "def apply_approve\n \t# condition for check the cancelled flag then update flag as false else update only apply approve\n @product.cancelled ? @product.update(apply_approve: true,cancelled: false) : @product.update(apply_approve: true)\n @product.update(apply_approve: true)\n respond_to do |format|\n format.html { redirect_to publish_product_url(@product)}\n format.json { head :no_content }\n end\n end", "def approve\n return nil if current_stage.stage != 'verify'\n raise 'Must run AutomateSoup.setup first' if AutomateSoup.url.nil? || AutomateSoup.credentials.nil?\n raise \"Approve link not available, #{links.inspect}\" if links.nil? || links['approve'].nil? || links['approve']['href'].nil?\n url = links['approve']['href']\n url = \"#{AutomateSoup.url}#{url}\" unless url.include?('http')\n res = AutomateSoup::Rest.post(\n url: url,\n username: AutomateSoup.credentials.username,\n token: AutomateSoup.credentials.token\n )\n raise \"Failed to approve change: #{res.code}\" if res.code != '204'\n true\n end", "def approve!(options = {})\n persist = options.fetch(:persist, true)\n transaction do\n self.approved = true\n self.approved_at = Time.now\n save! if persist\n AfterApprovalJob.enqueue(self.id)\n end\n end", "def save\n self.approved = true\n super\n end", "def ticket_approved\n TaskMailer.with(task: Task.first).ticket_approved\n end", "def district_approve(user, date)\n\t raise \"Can't approve this, as it has already been approved for recording at the district\" if self.credit_transmittal_batch_id\n\t \n\t self.district_finalize_approved = true\n self.district_finalize_approved_by = user.last_name_first\n self.district_finalize_approved_on = date\n\n # set denormalized credits info\n denormalize_credit\n \n save!\n\n self.child_credit_assignments.each do |ca|\n if ca.denormalize_credit\n ca.save\n end\n end\n\tend", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def approve!\n self.update_attribute(:status, APPROVED)\n self.registration.update_attribute(:status, Registration::VERIFIED) if self.registration\n end", "def update\n approving = false\n @design_change = DesignChange.find(params[:id])\n if @design_change.approving_change?(params[:design_change][:approved] == '1')\n @design_change.approve(@logged_in_user)\n approving = true\n end\n \n respond_to do |format|\n if @design_change.update_attributes(params[:design_change])\n if approving\n flash['notice'] = \"Approval recorded for the schedule change.\"\n else\n flash['notice'] = \"Schedule change was successfully updated.\"\n end\n format.html { redirect_to(:controller => 'design_changes',\n :action => 'index',\n :id => @design_change.design.id) }\n format.xml { head :ok }\n else\n @design = @design_change.design\n if @logged_in_user.is_designer?\n @change_classes = ChangeClass.find_all_active_designer_change_classes\n else\n @change_classes = ChangeClass.find_all_active_manager_change_classes\n end\n format.html { render :action => \"new\" }\n format.xml { render :xml => @design_change.errors, :status => :unprocessable_entity }\n end\n end\n end", "def approve_user\n user = User.find(params[:id])\n user.update_attributes(coop_id: params[:coop_id])\n flash[:success] = \"#{user.name} has been admitted to \\\n #{Coop.find(user.coop_id).name}. Thanks MemCo!\"\n\n redirect_to root_url\n notify_user_approval(user, params[:coop_id])\n end", "def status\n @post = Post.find(params[:id])\n @post.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Advertisement is approved!\"\n redirect_to admin_home_path\n end", "def send_outstanding_alert_to_approver(agency, user)\n setup_email\n body[:agency] = agency\n body[:user] = user\n recipients user.email\n subject \"Timesheet Approval Reminder\"\n end", "def approve \n\t\t@complaint = Complaint.find(params[:id])\n\t\t@complaint.approved = 1\n\t\t#@birth.approved_on = Time.now.strftime\n\t\n\t\tif @complaint.update_attributes(params[:complaint])\n\t\t\tflash[:notice] = 'complaint Record successfully approved.'\n\t\t\tredirect_to :action => 'list'\n\t\telse\n\t\t\trender :action => 'show'\n\t\tend\n\tend", "def approve_with_notify(swimming_buddy, shares_passages = false, shares_trainings = false, shares_calendars = false)\n if @user.approve(swimming_buddy, shares_passages, shares_trainings, shares_calendars)\n NewsFeed.create_social_approve_feed(@user, swimming_buddy)\n # TODO: Create also achievement row accordingly?\n end\n end", "def approve\n logger.info(\"in approvals controller: approve\")\n\n logger.info(\"in approvals controller: approve?\")\n if @changeset.approved?\n logger.info(\"in approvals controller: approve? yep!\")\n flash[:notice] = l(:approved_already)\n else\n logger.info(\"in approvals controller: approve? nope!\")\n begin\n @changeset.approve(User.current)\n\n logger.info(\"User #{User.current.login} approved revision ##{@changeset.revision} in repository #{@changeset.repository.url}\")\n flash[:notice] = l(:revision_approved, :rev => \"#{@changeset.revision}\")\n\n rescue => e\n flash[:error] = e.message\n end\n end\n\n respond_to do |format|\n format.html { redirect_to request.referer || '/' }\n format.js\n format.api\n end\n end", "def approve\n transition_to :approved\n end", "def edit_requirement_file\n find_user\n if !@user.nil?\n status=@req.status\n assign_project\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n find_user\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n redirect_to show_file_reqs_url(@file.id)\n else\n redirect_to project_files_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def collection_approve(work, collection)\n work.collection_items.each do |ci|\n next unless ci.collection == collection\n ci.update_attribute(:collection_approval_status, CollectionItem::APPROVED)\n ci.update_attribute(:user_approval_status, CollectionItem::APPROVED)\n ci.save\n end\n end", "def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end", "def change_task_status\n\n statuses = ['done', 'done_confirmed']\n\n if statuses.include? params[:status]\n @entity = Task.find(params[:id])\n concierge = User.find(@entity.concierge_id)\n suggestion = TaskSuggestion.find(@entity.suggestion_id) if @entity.suggestion_id.present?\n\n if params[:status].eql?('done')\n\n unless @entity.done?\n\n @entity.update_attributes(status: 'done', fact_end: Date.current)\n UserMailer.done_task_astra(@entity.owner.email, \"#{@current_user.first_name} #{@current_user.last_name}\",\n @entity.title).deliver\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name} — completed your task, please confirm\"\n\n message_params = [\n recipient_id: @entity.owner_id,\n author_id: @current_user.id,\n message_body: message_body,\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.owner_id #author_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n suggestion.update_attribute(:hire_read, false) if suggestion.present?\n\n Message.create(message_params)\n\n feed = FeedNotification.new(feed_params)\n\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n\n elsif params[:status].eql?('done_confirmed')\n\n unless @entity.done_confirm?\n\n @entity.update_attributes(status: 'done_confirmed', completed_at: Time.now, fact_end: Date.current)\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name}: Has confirmed your work.\" if params[:status].eql?('done_confirmed')\n pdf = @entity.generate_pdf_invoice\n @entity.order_changes_confirmed.each do |line|\n @entity.generate_pdf_change_order_invoice(line)\n end\n @entity.checked_completed_quota\n SendInvoiceToQuickBooksJob.perform_async(@entity.id)\n UserMailer.confirm_task(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.confirm_task_astra(Settings['email.invoices'], @entity.id, @entity.title).deliver if pdf.present?\n message_params = [\n recipient_id: @entity.concierge_id,\n author_id: @current_user.id,\n task_id: @entity.id,\n message_body: message_body,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.concierge_id #recipient_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n Message.create(message_params)\n\n # Message.create(\n # author_id: @entity.owner_id,\n # recipient_id: @entity.concierge_id,\n # message_body: \"You 've been raited!\",\n # task_id: @entity.id,\n # rating: true,\n # system: true,\n # give_a_rate: true,\n # suggestion_id: @entity.suggestion_id\n # )\n\n favourites_tasks = FavoriteTask.where(task_id: @entity.id)\n favourites_tasks.destroy_all\n\n #concierge.update_attribute(:balance, concierge.balance.to_f + @entity.budget.to_f) #Added\n #TaskPayment.create(user_id: @entity.concierge_id, concierge: true, task_id: @entity.id , budget: @entity.budget.to_f)\n\n feed = FeedNotification.create(feed_params)\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n end\n\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['wrong task status']}}, :status => 500\n end\n end", "def update!(**args)\n @approved = args[:approved] if args.key?(:approved)\n end", "def update\n begin\n data = params\n data[:lawyer_email] = \"mkd@ddiplaw.com\" if data[:lawyer_email].eql?(\"mdickinson@mdick.liviaservices.com\")\n data.delete(:action)\n data.delete(:controller)\n data[:start_date] = data[:start_date].to_date if data[:start_date]\n data[:end_date] = data[:end_date].to_date if data[:end_date]\n attributes = data\n @task = MatterTask.find_by_zimbra_task_id_and_lawyer_email_and_category(attributes[:zimbra_task_id], attributes[:lawyer_email], \"todo\")\n if @task\n attributes[:zimbra_task_status] = true\n # if the task is completed at zimbra mark it's completion in the portal also -- Mandeep (21/04/10).\n if attributes[:progress].eql?(\"COMP\") && attributes[:progress_percentage].eql?(\"100\")\n attributes.merge!({:completed => true, :completed_at => Time.zone.now.to_date})\n end\n # if the task is changed from completed to other, need to change it in portal -- Ketki (23/09/2010).\n if @task.completed and !attributes[:progress].eql?(\"COMP\")\n attributes.merge!({:completed => false, :completed_at => nil}) \n end\n @task.progress = attributes[:progress]\n @task.progress_percentage = attributes[:progress_percentage]\n data[:name] = CGI.unescape(data[:name])\n matter_name = Matter.find(@task.matter_id).name\n data[:name].slice!(\"<#{matter_name}>\")\n if(data[:description] != \"null\")\n data[:description] =CGI.unescape(data[:description])\n end\n if @task.update_attributes(attributes)\n render :xml=>{:success => \"Task is sucessfully updated\"} \n else\n render :xml=>{:error => @task.errors}\n end\n else\n @task = ZimbraActivity.find_by_zimbra_task_id(data[:zimbra_task_id])\n if @task\n data = ZimbraActivity.zimbra_task_params(data)\n data[:name] = CGI.unescape(data[:name])\n if @task.update_attributes(data)\n render :xml=>{:success => \"Task is sucessfully created\"}\n else\n render :xml=>{:error => @task.errors}\n end\n else\n render :xml => \"Hash not found\"\n end\n end\n rescue Exception=>e\n render :xml=>{:error=>e}\n end\n end", "def on_pending_entry(prev_state, event)\n if self.cart.all_approvals_received?\n self.approve!\n end\n end", "def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end", "def update\n @appointment = Appointment.find(params[:id])\n if @appointment.update_attributes(params[:appointment])\n @appointment.approve_status = 1\n @appointment.save\n UserMailer.appointment_pending(@appointment).deliver\n redirect_to \"/appointments\"\n else\n render :edit\n end\n end", "def update\n if @issue.update(issue_params)\n \n \n if @issue.status == 'Resolved'\n # send email \n @issue.resolved\n end\n \n \n \n redirect_to admin_issue_path( @issue)\n \n else\n redirect_to edit_admin_issue_path( @issue)\n end\n end", "def edit_requirement_tracker\n find_user\n if !@user.nil?\n\n status=@req.status\n\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\") or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@project_req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@project_req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n redirect_to show_tracker_req_url(@tracker.id)\n else\n redirect_to trackers_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def update\n @questionnaire.user_approval_date = Time.now\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve(options = {})\n commit_api.approve(hash, options)\n end", "def send_update_or_cancel_appt_email(appt_id, appt_params)\n if appt_params[:status] == 'Scheduled'\n AppointmentMailer.delay.appointment_update_for_tutor(appt_id)\n AppointmentMailer.delay.appointment_update_for_student(appt_id)\n end\n if appt_params[:status] == 'Cancelled'\n AppointmentMailer.delay.appointment_cancellation_for_tutor(appt_id)\n AppointmentMailer.delay.appointment_cancellation_for_student(appt_id)\n end\n end", "def change_resource_status\n @resource_transportation_booking = ResourceTransportationBooking.find(params[:id])\n\n if params[:approve_status] == \"Approved\"\n \n approve_scenario(params[:id],params[:vehicle][:id])\n @resource_transportation_booking.update_attribute(:remarks, params[:remarks_approver])\n elsif params[:approve_status] == \"Processed\"\n\n if params[:driver][:name] && params[:driver][:name] != ''\n process_scenario_alternate_driver(params[:id],params[:driver][:name])\n else\n @resource_transportation_booking.update_attribute(:status,\"Processed\")\n end\n @resource_transportation_booking.update_attribute(:remarks, params[:remarks_approver])\n agency = Agency.find(@resource_transportation_booking.agency_store.agency_id)\n if !agency.user_id.nil?\n UserMailer.send_mail_to_resource_manager_for_transport_booking(agency.user,@resource_transportation_booking).deliver #if agency && agency.user #if resource_manager && resource_manager.user && !resource_manager.user.blank?\n end\n\n elsif params[:approve_status] == \"Returned\"\n return_scenario(params[:id])\n elsif params[:approve_status] == \"Declined\"\n if @resource_transportation_booking.status == \"Approved\"\n decline_scenario(params[:id])\n end\n @resource_transportation_booking.update_attribute(:status,'Declined')\n end\n\n redirect_to(approve_request_resource_transportation_bookings_path, :notice => 'Transport Booking Status has been successfully updated.')\n end", "def perform(*args)\n user_id, task_id, task_type, empirical_value, obi, from = args[0][0][0], args[0][0][1], args[0][0][2], args[0][0][3], args[0][0][4], args[0][0][5]\n empirical_value = empirical_value.to_i\n obi = obi.to_i\n user = Core::User.find_by(id: user_id)\n return p \"#{Time.now}————————>error---------------->用户不对!\" unless user.present?\n size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n case task_type\n when 'Shop::DynamicComment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::DynamicComment.find_by(id: task_id)\n comment.dynamic.topic.shop_task.get_obi user\n comment.dynamic.topic.shop_task.increment!(:participants)\n when 'Shop::VoteResult'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n vote_result = Shop::VoteResult.find_by(id: task_id)\n vote_result.resource.topic.shop_task.get_obi user\n vote_result.resource.topic.shop_task.increment!(:participants)\n when 'Shop::TopicDynamic'\n topic = Shop::TopicDynamic.find_by(id: task_id).topic\n if from.match(/._share/)\n topic.shop_task.share_state[\"#{Shop::Topic}:#{user.id}\"] += 1\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size #分享次数\n\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n #创建动态\n create_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"create_topic_dynamic\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #点赞\n like_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"self\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #被别人点赞次数\n liked_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"other\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n\n if (from == 'self' && like_size <= 5) || (from == 'other' && liked_size <= 50) || from == 'create_topic_dynamic' && create_size <= 5\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n if from == 'self' || from == \"create_topic_dynamic\"\n topic.shop_task.get_obi user\n topic.shop_task.increment!(:participants)\n end\n when 'Shop::Comment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::Comment.find_by(id: task_id)\n comment.task.shop_task.get_obi user\n comment.task.shop_task.increment!(:participants)\n when 'Shop::FundingOrder'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::FundingOrder.find_by(id: task_id)\n task = order.owhat_product.shop_task\n #task.increment!(:participants)\n task.get_obi(user)\n when 'Shop::Order'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::Order.find_by(id: task_id)\n order.order_items.each do |item|\n #item.owhat_product.shop_task.increment!(:participants)\n item.owhat_product.shop_task.get_obi(user)\n end\n when 'Core::User', 'Core::Star', 'Qa::Poster', \"Shop::Event\", \"Shop::Product\", \"Shop::Topic\", \"Shop::Media\", \"Shop::Subject\", \"Shop::Funding\"\n if from.match(/._share/)\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.share_state[\"#{task.shop_type}:#{user.id}\"] += 1\n task.get_obi(user, type: 'share')\n end\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n else\n #发任务暂时不送O元 包含媒体任务参与 打卡任务\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.get_obi user\n task.increment!(:participants)\n end\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n\n level, obi = user.update_obi_and_empirical_value(user.empirical_value, user)\n unless user.level == level\n Core::TaskAward.create(user_id: user_id, task_id: user.id, task_type: user.class, empirical_value: 0, obi: (obi - user.obi), from: 'level_up')\n user.update(level: level, obi: obi)\n end\n end", "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def change_status_to_in_progress\n user = User.find_by(id: params[:user_id])\n user.send_issue_assigned_email\n issue = Issue.find_by(id: params[:id])\n expert = User.find_by(id: params[:expert_id])\n issue.update_attributes(status: \"inprogress\", expert_id: expert.id)\n flash[:success] = \"Issue status changed to in progress! Assigned to #{expert.username}\"\n redirect_to issues_path\n end", "def confirm_task\n\n @entity = Task.find(params[:id])\n concierge = User.find(params[:user_id])\n\n budget = @entity.budget\n\n if @entity.tender?\n budget = TaskSuggestion.find(params[:suggestion_id]).price unless params[:budget].present?\n end\n\n budget = params[:budget] if params[:budget].present?\n\n pending_tasks = UsersPendingsTask.where(task_id: @entity.id)\n pending_tasks.destroy_all unless pending_tasks.nil?\n\n unless @entity.accepted?\n\n #if @current_user.balance.to_f >= calculate_surcharge(@entity.budget, budget) #(budget + (budget.to_i*10)/100).to_f\n # @current_user.update_attribute(:balance, @current_user.balance.to_f - calculate_surcharge(@entity.budget, budget)) unless budget.to_f < @entity.budget.to_f #(budget + (budget.to_i*10)/100))\n\n if @entity.owner?(@current_user) && params.has_key?(:user_id) # && @entity.accepted?\n #if budget.to_f < @entity.budget.to_f # Do a return of money to hire balance\n\n # @current_user.update_attribute(:balance, @current_user.balance + (@entity.budget.to_f - budget.to_f))\n #@current_user.increase_balance(@entity.budget) #budget - (budget.to_i*10)/100) #@entity not budget\n # end\n\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: current_resource_owner.id,\n recipient_id: concierge.id,\n message_body: \"Congratulations! #{concierge.first_name} #{concierge.last_name}: Your bid was accepted.\",\n task_id: @entity.id,\n system: true,\n suggestion_id: params[:suggestion_id]\n )\n\n feed = FeedNotification.create(\n owner_id: @current_user.id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"Congratulations! #{concierge.first_name} #{concierge.last_name}: Your bid was accepted. \",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n\n\n #TaskPayment.create(user_id: concierge.id, concierge: true, task_id: @entity.id , budget: @entity.budget.to_f)\n\n render 'api/tasks/show'\n\n else\n unless @entity.tender?\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task_conc(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: @entity.concierge_id,\n recipient_id: @entity.owner_id,\n message_body: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n )\n\n feed = FeedNotification.create(\n owner_id: @entity.concierge_id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['missed param user_id']}}, :status => 500\n end\n\n\n end\n # else\n # render :json => { message: [ 'not enough money' ]}, :status => 500\n # end\n\n else\n unless @entity.tender?\n @entity.update_attributes(status: 'confirmed', concierge_id: concierge.id,\n suggestion_id: params[:suggestion_id], budget: budget,\n confirmed_at: Time.now, fact_start: Date.current)\n pdf = @entity.generate_pdf\n UserMailer.accepted_task_conc(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.accepted_task_astra(Settings['email.work_order'], @entity.id, @entity.title).deliver if pdf.present?\n message = Message.create(\n author_id: @entity.concierge_id,\n recipient_id: @entity.owner_id,\n message_body: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n )\n\n feed = FeedNotification.create(\n owner_id: @entity.concierge_id,\n user_id: message.recipient_id,\n task_title: @entity.title,\n message: \"#{@entity.concierge.first_name} #{@entity.concierge.last_name} has accepted your work offer\",\n notification_type: 'new_message',\n task_id: @entity.id,\n suggestion_id: @entity.suggestion_id,\n task_owner_id: @entity.owner_id\n )\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['task already confirmed']}}, :status => 500\n end\n\n end\n end" ]
[ "0.7300589", "0.6860544", "0.66208094", "0.6579514", "0.6537604", "0.64907944", "0.6414515", "0.6392691", "0.63433105", "0.63322794", "0.63170993", "0.6307723", "0.6301542", "0.62309974", "0.62107265", "0.61708796", "0.61656624", "0.6159551", "0.6159291", "0.61283183", "0.61176085", "0.61017436", "0.6091261", "0.6024397", "0.60234666", "0.60061634", "0.60055125", "0.6001703", "0.5979686", "0.5977925", "0.59722465", "0.59572744", "0.59517413", "0.59437025", "0.59364945", "0.59261906", "0.5922629", "0.592167", "0.5920913", "0.5866494", "0.58604616", "0.5857385", "0.58505785", "0.5843369", "0.5835512", "0.5810149", "0.5806909", "0.57879394", "0.5784958", "0.57793057", "0.5778754", "0.57776415", "0.5769712", "0.5764881", "0.57517177", "0.5751154", "0.5749526", "0.57278246", "0.57188237", "0.57157195", "0.5691645", "0.56902766", "0.56884557", "0.56808245", "0.5678656", "0.5670549", "0.56692386", "0.5669187", "0.56664735", "0.5658256", "0.5643639", "0.56403327", "0.5635693", "0.5634696", "0.56330436", "0.5632468", "0.5626931", "0.5621012", "0.5616734", "0.561526", "0.5614693", "0.5609461", "0.5597092", "0.55948484", "0.5590887", "0.55907637", "0.5587566", "0.5582471", "0.558076", "0.55790687", "0.55775684", "0.55702937", "0.55685467", "0.55623156", "0.55590403", "0.5554514", "0.55509734", "0.554605", "0.55443764", "0.5542351" ]
0.73774314
0
Force UTF16 string encoding when anonymous bytes are naively read in, then encode for UTF8, which the user expects
def get self.data.force_encoding(Encoding::UTF_16BE).encode(Encoding::UTF_8) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend", "def fix_utf_errors\n self.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode('UTF-8', 'UTF-16')\n end", "def fix_encoding!(str)\n\t#str.force_encoding(\"UTF-8\")\n\t#pp str.encoding, str.valid_encoding?\n\tstr.encode!(\"UTF-16BE\", :invalid=>:replace, :replace=>\"?\")\n\tstr.encode!(\"UTF-8\")\nend", "def to_utf8(raw_text)\n if raw_text.platform_id == 1 && raw_text.encoding_id == 0\n return raw_text\n else\n begin\n raw_text.encode(\"UTF-8\", \"UTF-16BE\")\n rescue\n raw_text\n end\n end\n end", "def transcode(str)\n str.force_encoding('UTF-8')\nend", "def utf8_safe\n encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end", "def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :universal_newline => true)\nend", "def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end", "def fix_utf8\n str = force_encoding(\"UTF-8\")\n return str if str.valid_encoding?\n\n str.encode(\"UTF-8\", \"binary\",\n invalid: :replace, undef: :replace, replace: \"\")\n end", "def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end", "def force_utf32; end", "def force_utf32; end", "def force_utf32; end", "def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\", self).first + \"\\x00\\x00\"\r\n end", "def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end", "def force_utf8(buf) \n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil) \n end", "def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def to_utf8; convert_format(ASCII8BIT, UTF8); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf8(buf)\n return buf if buf.valid_encoding?\n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil)\n end", "def clean(str)\n st = str.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')\n return st.encode('UTF-8', 'UTF-16')\nend", "def transcode_to_utf8(s)\n unless s.nil?\n s.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end", "def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end", "def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end", "def to_ascii; convert_format(UTF8, ASCII8BIT);end", "def force_to_utf8(text)\n ActiveSupport::Multibyte::Unicode.tidy_bytes(text)\n end", "def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.upcase\nend", "def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end", "def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end", "def to_utf8!; replace(to_utf8); end", "def force_encoding(string)\n string.force_encoding(encoding)\n end", "def fix_encoding(str)\n str.force_encoding(Encoding.default_external) if str.respond_to?(:force_encoding)\n str\nend", "def str_to_uni_z(str)\n enc = str.encode('UTF-16LE').force_encoding('binary')\n enc += \"\\x00\\x00\"\n return enc\n end", "def to_utf8(v)\n return v unless v.is_a?(String)\n return v if (enc = v.encoding) == (utf = Encoding::UTF_8)\n Encoding::Converter.new(enc, utf).convert(v) rescue v.dup.force_encoding(utf)\nend", "def force_utf8_encoding(msg)\n msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg\nend", "def toutf16; Kconv.toutf16(self) end", "def force_encoding(*); self; end", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def uC\n self.force_encoding('UTF-16LE').encode('UTF-8').strip\n end", "def toUtf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\nend", "def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end", "def utf8(string)\n string.force_encoding('utf-8') unless string.nil?\n end", "def force_encoding(enc)\n end", "def process_encoding(source)\n source.force_encoding(Encoding::UTF_8)\n end", "def force_to_ascii s\n out = \"\"\n s.each_byte do |b|\n if (b & 128) != 0\n out << \"\\\\x#{b.to_s 16}\"\n else\n out << b.chr\n end\n end\n #out.force_encoding Encoding::UTF_8 if in_ruby19_hell? # not necessary?\n out\n end", "def force_encoding(*args) settings.force_encoding(*args) end", "def plaintext_utf8(delim=\"\\n\")\n plaintext(delim).encode('UTF-8', invalid: :replace, undef: :replace, \n replace: '?')\n end", "def encode_string_ex; end", "def to_utf8(str)\n str = str.force_encoding(ENCODING)\n return str if str.valid_encoding?\n str.encode(ENCODING, 'binary', invalid: :replace, undef: :replace,\n replace: '')\n end", "def test_encoded_in_change_out\n doc = Document.new( @encoded )\n doc.xml_decl.encoding = \"UTF-8\"\n assert_equal(\"UTF-8\", doc.encoding)\n REXML::Formatters::Default.new.write( doc.root, out=\"\" )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n char = XPath.first( doc, \"/a/b/text()\" ).to_s\n char.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"ĉ\".b, char )\n end", "def force_default_encoding; end", "def to_utf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\n end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def to_utf8(s)\n return nil if s.nil?\n\n # Attempt to politely transcode the string.\n s.encode(\"UTF-8\").scrub\n rescue\n # If that doesn't work, then overwrite the existing encoding and\n # clobber any strange characters.\n s.force_encoding(\"UTF-8\").scrub\n end", "def force_default_encoding=(_arg0); end", "def set(string)\n self.data = string.encode(Encoding::UTF_16BE)\n end", "def from_utf16_buffer\r\n self[0..index(\"\\0\\0\\0\")+2].from_utf16\r\n end", "def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end", "def translate_data(data)\n if data[0..3] == \"\\x4c\\x6f\\xa7\\x94\"\n # EBCDIC\n data = _ebcdic_to_ascii(data)\n elsif data[0..3] == \"\\x00\\x3c\\x00\\x3f\"\n # UTF-16BE\n data = uconvert(data, 'utf-16be', 'utf-8')\n elsif data.size >= 4 and data[0..1] == \"\\xfe\\xff\" and data[2..3] != \"\\x00\\x00\"\n # UTF-16BE with BOM\n data = uconvert(data[2..-1], 'utf-16be', 'utf-8')\n elsif data[0..3] == \"\\x3c\\x00\\x3f\\x00\"\n # UTF-16LE\n data = uconvert(data, 'utf-16le', 'utf-8')\n elsif data.size >=4 and data[0..1] == \"\\xff\\xfe\" and data[2..3] != \"\\x00\\x00\"\n # UTF-16LE with BOM\n data = uconvert(data[2..-1], 'utf-16le', 'utf-8')\n elsif data[0..3] == \"\\x00\\x00\\x00\\x3c\"\n # UTF-32BE\n data = uconvert(data, 'utf-32be', 'utf-8')\n elsif data[0..3] == \"\\x3c\\x00\\x00\\x00\"\n # UTF-32LE\n data = uconvert(data, 'utf-32le', 'utf-8')\n elsif data[0..3] == \"\\x00\\x00\\xfe\\xff\"\n # UTF-32BE with BOM\n data = uconvert(data[4..-1], 'utf-32BE', 'utf-8')\n elsif data[0..3] == \"\\xff\\xfe\\x00\\x00\"\n # UTF-32LE with BOM\n data = uconvert(data[4..-1], 'utf-32LE', 'utf-8')\n elsif data[0..2] == \"\\xef\\xbb\\xbf\"\n # UTF-8 with BOM\n data = data[3..-1]\n else\n # ASCII-compatible\n end\n return data\nend", "def from_utf16\r\n ret = Iconv.iconv(\"utf-8\", \"utf-16le\", self).first\r\n if ret[-1] == 0\r\n ret = ret[0..-2]\r\n end\r\n end", "def force_header_encoding(s); s.tap { s.force_encoding('UTF-8') }; end", "def to_utf8(mixed)\n if mixed.kind_of? Array\n mixed.each {|elem| to_utf8(elem)}\n else mixed.kind_of? String\n charset = NKF.guess(mixed).name\n charset == \"UTF-8\" ? mixed : mixed.encode!(\"UTF-8\", charset)\n end\n mixed\n end", "def test_encoded_in_different_out\n doc = Document.new( @encoded )\n REXML::Formatters::Default.new.write( doc.root, Output.new( out=\"\", \"UTF-8\" ) )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n end", "def force_encoding(enc)\n @enml.to_s.encode(enc)\n end", "def write_utf16be_string(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n return -1 if (args.size < 3) # Check the number of args\n\n record = 0x00FD # Record identifier\n length = 0x000A # Bytes to follow\n\n row = args[0] # Zero indexed row\n col = args[1] # Zero indexed column\n strlen = args[2].length\n str = args[2]\n xf = xf_record_index(row, col, args[3]) # The cell format\n encoding = 0x1\n str_error = 0\n\n # Check that row and col are valid and store max and min values\n return -2 if check_dimensions(row, col) != 0\n\n # Limit the utf16 string to the max number of chars (not bytes).\n if strlen > 32767* 2\n str = str[0..32767*2]\n str_error = -3\n end\n\n num_bytes = str.length\n num_chars = (num_bytes / 2).to_i\n\n # Check for a valid 2-byte char string.\n raise \"Uneven number of bytes in Unicode string\" if num_bytes % 2 != 0\n\n # Change from UTF16 big-endian to little endian\n str = str.unpack('n*').pack('v*')\n\n # Add the encoding and length header to the string.\n str_header = [num_chars, encoding].pack(\"vC\")\n str = str_header + str\n\n unless @str_table[str]\n @str_table[str] = str_unique\n add_str_unique(1)\n end\n\n add_str_total(1)\n \n header = [record, length].pack(\"vv\")\n data = [row, col, xf, @str_table[str]].pack(\"vvvV\")\n\n # Store the data or write immediately depending on the compatibility mode.\n if @compatibility != 0\n tmp = []\n tmp[col] = header + data\n @table[row] = tmp\n else\n append(header, data)\n end\n\n return str_error\n end", "def ascii_only!\n original_encoding = self.encoding\n encode!(\"US-ASCII\", invalid: :replace, undef: :replace, replace: \"\")\n encode!(original_encoding.name)\n end", "def clean\n self.encode!('UTF-8', :invalid => :replace, :undef => :replace, replace: '')\n end", "def writeencoding; end", "def toutf16(str)\n ::NKF::nkf('-w16m', str)\n end", "def to_utf8(str)\n str.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end", "def uniz_to_str(uniz)\n uniz.force_encoding('UTF-16LE').encode('UTF-8')\n end", "def encode_string; end", "def fix(v)\n v.force_encoding('CP1251').encode('UTF-8')\nend", "def fix_utf8(s=nil)\n s=self if s.nil? #if we are included\n if String.method_defined?(:scrub)\n #Ruby 2.1\n #cf http://ruby-doc.org/core-2.1.0/String.html#method-i-scrub\n return s.scrub {|bytes| '<'+bytes.unpack('H*')[0]+'>' }\n else\n return DR::Encoding.to_utf8(s)\n end\n end", "def sanitize_string(string)\n return string.encode(\"UTF-16BE\", :invalid=>:replace, :undef => :replace, :replace=>\"?\")\n .encode(\"UTF-8\")\n .gsub(/[\\u0080-\\u009F]/) {|x| x.getbyte(1).chr.force_encoding('windows-1252').encode('utf-8') }\n .gsub(/\\\"/, \"\\\\\\\"\") # escape double quotes in string\n end", "def force_encoding(s, encoding)\n if s.respond_to?(:force_encoding)\n s.force_encoding(encoding)\n else\n s\n end\n end", "def normalize_string(str)\n if str.respond_to?(:encoding)\n # These are to fix strings generated by the WriteExcel gem\n # which force encodes utf-8 to these two formats in different\n # places (As of v1.0.4).\n if str.encoding == Encoding::UTF_8\n input_encoding = nil\n input_encoding = Encoding::UTF_16LE if str.size > 1 && str[1] == \"\\0\"\n input_encoding = Encoding::UTF_16BE if !input_encoding && str.size > 0 && str[0] == \"\\0\"\n if input_encoding\n force_value = String.new(str).force_encoding(input_encoding)\n str = force_value.encode(Encoding::UTF_8) if force_value.valid_encoding?\n end\n end\n\n str = str.encode(@output_encoding, 'binary', undef: :replace) if @output_encoding && str.encoding != @output_encoding\n end\n\n str\n end", "def to_utf (str)\n encoded_str = ''\n str.split('').each {|char| \n encoded_char = char.encode('UTF-8')\n encoded_char.bytes.each {|byte|\n encoded_str << \"%#{byte.to_s(16)}\"\n }\n }\n return encoded_str\nend", "def convert_encoding(content); end", "def default_encoding\n Encoding::UTF_8\n end", "def suppress_encoding; end", "def to_utf8(str)\n str.encode(Encoding::UTF_8)\n end", "def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(map(&:utf8))\n else\n self\n end\n end", "def try_utf8!(string, encoding = ::Encoding::UTF_8)\n return nil unless string\n string.force_encoding(::Encoding::ASCII_8BIT) unless string.force_encoding(encoding).valid_encoding?\n string\n end", "def iconv() end", "def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.gsub!(\"\\r\\n\", \"\\n\")\n # string.chomp!\n string\n end", "def ensure_correct_encoding!(val)\n if @eval_string.empty? &&\n val.respond_to?(:encoding) &&\n val.encoding != @eval_string.encoding\n @eval_string.force_encoding(val.encoding)\n end\n end", "def string_encoder\n return string if string.valid_encoding?\n str = string\n Encoding.list.each do |e|\n begin\n str.force_encoding(e.name)\n tmp_string = str.encode('UTF-8')\n return tmp_string if tmp_string.valid_encoding?\n rescue\n Rails.logger.debug { \"Rescue -> #{e.name}\" } if defined?(::Rails)\n end\n end\n\n impossible_encoding\n\n string\n end", "def encode_string(str)\n str = str.to_s.encode('UTF-8')\n\n # Force to binary, when assembling the packet\n str.force_encoding('ASCII-8BIT')\n encode_short(str.bytesize) + str\n end", "def encoding; end" ]
[ "0.78899014", "0.74937373", "0.7480982", "0.7220402", "0.70552665", "0.7027902", "0.7014402", "0.69959253", "0.6959735", "0.6914557", "0.691258", "0.68998337", "0.68998337", "0.68998337", "0.68809843", "0.68669957", "0.6855419", "0.68419796", "0.68244076", "0.68205", "0.68205", "0.68205", "0.6766382", "0.67150515", "0.66867536", "0.66818404", "0.66818404", "0.66710913", "0.6656095", "0.6643417", "0.66326725", "0.65581506", "0.6556902", "0.65564996", "0.65533835", "0.65520483", "0.64989173", "0.64942914", "0.64930373", "0.64909655", "0.6473621", "0.6473621", "0.64623314", "0.6439071", "0.641283", "0.6398722", "0.6384349", "0.6384075", "0.6373908", "0.63728446", "0.6339225", "0.6333338", "0.6331956", "0.63194007", "0.6311231", "0.6299205", "0.62685657", "0.62685657", "0.626799", "0.626799", "0.626799", "0.626799", "0.626799", "0.62609607", "0.62572044", "0.62556034", "0.6251608", "0.6235816", "0.6220473", "0.6212787", "0.621155", "0.62089574", "0.62058175", "0.6178837", "0.61737084", "0.61640304", "0.61607254", "0.6160541", "0.6159815", "0.6158239", "0.6154733", "0.6149069", "0.61477256", "0.61461246", "0.6144379", "0.6123425", "0.6119919", "0.6115726", "0.6114163", "0.6098107", "0.60970294", "0.60924983", "0.6080664", "0.6073102", "0.6064539", "0.6063358", "0.6062001", "0.60529876", "0.60496014", "0.60478884" ]
0.6335779
51
Expect to receive UTF8 string when setting
def set(string) self.data = string.encode(Encoding::UTF_16BE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def utf8(string)\n string.force_encoding('utf-8') unless string.nil?\n end", "def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end", "def test_encoding\n assert_equal 'UTF-8', @conn.encoding\n end", "def test_encoding\n assert_equal \"UTF-8\", @conn.encoding\n end", "def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end", "def default_encoding\n Encoding::UTF_8\n end", "def force_default_encoding=(_arg0); end", "def force_encoding(*args) settings.force_encoding(*args) end", "def default_encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def force_utf8_encoding(msg)\n msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg\nend", "def set_encoding\n Encoding.default_external = Encoding::UTF_8\n Encoding.default_internal = Encoding::UTF_8\n nil\n end", "def transcode(str)\n str.force_encoding('UTF-8')\nend", "def force_utf8(buf) \n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil) \n end", "def meta_encoding=(encoding); end", "def meta_encoding=(encoding); end", "def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end", "def charset=(_); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf8(buf)\n return buf if buf.valid_encoding?\n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil)\n end", "def default_encoding; end", "def default_encoding; end", "def force_default_encoding; end", "def valid_utf8?(str)\n @connection.valid_utf8?(str)\n end", "def force_encoding(*); self; end", "def test_encoded_in_change_out\n doc = Document.new( @encoded )\n doc.xml_decl.encoding = \"UTF-8\"\n assert_equal(\"UTF-8\", doc.encoding)\n REXML::Formatters::Default.new.write( doc.root, out=\"\" )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n char = XPath.first( doc, \"/a/b/text()\" ).to_s\n char.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"ĉ\".b, char )\n end", "def enc_utf8\n\n @@enc_utf8 ||= \n ( Encoding.find( \"utf-8\" ) or raise \"No utf-8 encoding found (?!)\" )\nend", "def string=(val)\n if val.respond_to? :encoding\n @encoding = val.encoding.to_s\n end\n\n set_basic_string internal_string(val, @encoding)\n end", "def encoding=(enc); end", "def isutf8;\tKconv.isutf8(self) end", "def process_encoding(source)\n source.force_encoding(Encoding::UTF_8)\n end", "def charset=(charset); end", "def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def charset=(_arg0); end", "def to_utf8!; replace(to_utf8); end", "def try_utf8!(string, encoding = ::Encoding::UTF_8)\n return nil unless string\n string.force_encoding(::Encoding::ASCII_8BIT) unless string.force_encoding(encoding).valid_encoding?\n string\n end", "def ensure_correct_encoding!(val)\n if @eval_string.empty? &&\n val.respond_to?(:encoding) &&\n val.encoding != @eval_string.encoding\n @eval_string.force_encoding(val.encoding)\n end\n end", "def test_serialize_non_ascii_data_to_json\n data = {\"foo\" => \"\\u3042\\u4e9c\\u03b1\"}\n driver = create_driver('')\n assert_equal(%q({\"foo\":\"\\u3042\\u4e9c\\u03b1\"}), driver.instance.to_json(data))\n end", "def meta_encoding; end", "def meta_encoding; end", "def force_to_utf8(text)\n ActiveSupport::Multibyte::Unicode.tidy_bytes(text)\n end", "def test_sdbm\n key = 'あいうえおかきくけこ'\n val = 'たちつてとなにぬねの'\n @tag.tag_db[key] = val\n assert_equal val, @tag.tag_db[key].force_encoding(Encoding::UTF_8)\n end", "def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend", "def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(map(&:utf8))\n else\n self\n end\n end", "def force_encoding(string)\n string.force_encoding(encoding)\n end", "def encoding(encoding); end", "def force_utf8_encoding(msg)\n msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg\n rescue StandardError\n nil\n end", "def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end", "def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end", "def transcode_to_utf8(s)\n unless s.nil?\n s.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end", "def force_utf32; end", "def force_utf32; end", "def force_utf32; end", "def set_encoding\n Regexp.new(source.force_encoding('UTF-8'), Regexp::FIXEDENCODING | options)\n end", "def fix_encoding(output)\n output[/test/] # Running a regexp on the string throws error if it's not UTF-8\n rescue ArgumentError\n output.force_encoding(\"ISO-8859-1\")\n end", "def to_utf8(str)\n str.encode(Encoding::UTF_8)\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def is_utf8?\n ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)\n end", "def charset\n 'UTF8'\n end", "def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end", "def check_utf8\n if params.has_key? 'utf8' and params['utf8'] != '✓'\n render text: 'Bad Request', status: 400\n end\n end", "def fix_utf8\n str = force_encoding(\"UTF-8\")\n return str if str.valid_encoding?\n\n str.encode(\"UTF-8\", \"binary\",\n invalid: :replace, undef: :replace, replace: \"\")\n end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def fix_encoding!(str)\n\t#str.force_encoding(\"UTF-8\")\n\t#pp str.encoding, str.valid_encoding?\n\tstr.encode!(\"UTF-16BE\", :invalid=>:replace, :replace=>\"?\")\n\tstr.encode!(\"UTF-8\")\nend", "def to_utf8; convert_format(ASCII8BIT, UTF8); end", "def fix_encoding(str)\n str.force_encoding(Encoding.default_external) if str.respond_to?(:force_encoding)\n str\nend", "def to_utf8(str)\n str.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def plaintext_utf8(delim=\"\\n\")\n plaintext(delim).encode('UTF-8', invalid: :replace, undef: :replace, \n replace: '?')\n end", "def to_utf8(v)\n return v unless v.is_a?(String)\n return v if (enc = v.encoding) == (utf = Encoding::UTF_8)\n Encoding::Converter.new(enc, utf).convert(v) rescue v.dup.force_encoding(utf)\nend", "def encodings; end", "def accept_encoding=(value)\n Curl.set_option(:accept_encoding, value_for(value, :string), handle)\n end", "def ignore_encoding_error; end", "def minimal_set_encoding\n res1=self.hyphenated_set_encoding\n res2=self.set_escaped\n res1.size < res2.size ? res1 : res2\n end", "def valid_utf8?(str)\n valid_utf8_bson?(str)\n end" ]
[ "0.6913763", "0.67741346", "0.67557776", "0.6625959", "0.66149884", "0.66134", "0.6578945", "0.65160954", "0.6487461", "0.64853054", "0.6475338", "0.6475338", "0.6475338", "0.6475338", "0.6475338", "0.64747447", "0.64747447", "0.6444483", "0.64355934", "0.64279175", "0.6418662", "0.6401173", "0.6401173", "0.63817453", "0.63511676", "0.6328026", "0.6328026", "0.6328026", "0.6317902", "0.6316475", "0.6316475", "0.6310146", "0.6299287", "0.62326133", "0.6227167", "0.6214447", "0.61863214", "0.61821127", "0.61758715", "0.6174747", "0.6170475", "0.6157224", "0.6154507", "0.6142304", "0.61292434", "0.6121848", "0.60929424", "0.60887736", "0.60887736", "0.6088243", "0.6086521", "0.6082399", "0.6078069", "0.6076021", "0.60716945", "0.60645926", "0.6062618", "0.6062618", "0.60561913", "0.6051663", "0.6051663", "0.6051663", "0.60469353", "0.6033336", "0.6021526", "0.60128695", "0.60128695", "0.60123223", "0.5990869", "0.5988824", "0.5964508", "0.595511", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.59347045", "0.5925356", "0.5918401", "0.5913397", "0.59127235", "0.59071845", "0.59071845", "0.58978134", "0.5893642", "0.5881612", "0.5876127", "0.5866488", "0.58636624", "0.58558345" ]
0.6561136
7