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 |
---|---|---|---|---|---|---|
Used to perform a single click on this view in the remote application | def click()
mouse_down
mouse_up
stall :click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n `#@native.click()`\n end",
"def click\n @mech.click self\n end",
"def action\n trigger :click\n end",
"def click; end",
"def click; end",
"def click; end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def item_was_clicked(sender)\n # Find the selected Link instance via the array controller and get its url attribute\n url_string = array_controller.selectedObjects.first.url\n if url_string\n # convert the url into a NSURL instance and open it in the browser.\n url = NSURL.URLWithString(url_string)\n NSWorkspace.sharedWorkspace.openURL(url)\n end\n end",
"def on_click\n\t\tend",
"def clicked\n if @alert_view != nil\n @alert_view.clicked\n else\n @current_view.clicked\n end\n end",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def basic_click()\n scroll_to_visible\n @driver.sc_basic_click action_target, *action_locator_args\n stall :click\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def click\n root_node.click\n end",
"def click\n raise \"Must implement custom click method.\"\n end",
"def clicked\n router.navigated\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def click_view_website\n view_website_link.click\n end",
"def click\n @_node.click\n @_node.getPage.getWebClient.waitForBackgroundJavaScriptStartingBefore(3000)\n end",
"def click\n `#{@el}.click() || Opal.nil`\n end",
"def clicked(e)\n \n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def click(link); end",
"def clicked;end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def click_with_rest!(publisher_app)\n rest_request(:get, get_click_url(publisher_app), format: :html)\n click\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def view(name, locator)\n define_method(name) do\n platform.click_view(locator)\n end\n end",
"def choose_first_click; end",
"def onItemClick(parent, view, position, id)\n selectItem(position)\n end",
"def click(type, query)\n browser.send(type, query).click\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def execute\n view.add_control target, controller.current_view.instance\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def clicked(mouse_event)\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def click_act_as_link\n act_as_link.click\n sleep(10)\n end",
"def clicked\n @return.clicked\n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def question_login_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::LoginAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def show()\n @view__.show\n self\n end",
"def click_settings\n settings.click\n end",
"def complete_click(publisher_app)\n click_with_rest! publisher_app\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def click_on_a_button(selector)\n\n click_button(selector)\n\n end",
"def view_modal\n handle_view\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def switchto_listview()\n\t\t@browser.button(:class, \"btn icon-list-view\").click\n\tend",
"def buttonOpenModal__clicked(*argv)\n ModalWindow.new.show_glade(self) # self = parent, so always on top of parent\n end",
"def js_click\n href = node.attributes['onclick'].to_s.match(/location.href='(.*)'/)[1]\n full_uri = URI::HTTP.build({scheme: page.uri.scheme, host: page.uri.host, path: href})\n mech.get(full_uri)\n end",
"def classic_button_click\n MenuControllerContracts.invariant(self)\n @game_state_model::game_type = :classic\n @game_state_model::game_mode_logic = GameLogic::ClassicRules.new(@game_state_model)\n @current_view = @views[1]\n MenuControllerContracts.invariant(self)\n end",
"def click_approach_link\n click APPROACH_LINK\n end",
"def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end",
"def activate_tab_with_click\n click\n \n # No event yet so just cheat and sleep\n sleep(0.1);\n end",
"def click\n @sign_in.click\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click_start_now_button\n click_link(@start_now_button_text)\n end",
"def click(name, tag)\n click_on_button(name, tag, @klass)\n end",
"def click_on(*args, context: page)\n label = self.class.labels[args[0]] # attempt to get the label\n context = context.element if context.respond_to? :element\n label.present? ? context.click_on(label) : context.click_on(*args)\n end",
"def click_button(atrans,acftrans)\r\n sleep 2\r\n hwnd = client.railgun.user32.FindWindowW(nil, \"Microsoft Outlook\")\r\n if hwnd != 0\r\n hwndChildCk = client.railgun.user32.FindWindowExW(hwnd['return'], nil, \"Button\", \"&#{acftrans}\")\r\n client.railgun.user32.SendMessageW(hwndChildCk['return'], 0x00F1, 1, nil)\r\n client.railgun.user32.SetCursorPos(707,475)\r\n client.railgun.user32.mouse_event(0x0002,719,502,nil,nil) \r\n client.railgun.user32.mouse_event(0x0004,719,502,nil,nil)\r\n client.railgun.user32.SetCursorPos(710,499)\r\n client.railgun.user32.mouse_event(0x0002,710,499,nil,nil)\r\n client.railgun.user32.mouse_event(0x0004,710,499,nil,nil)\r\n else\r\n print_error(\"Error while clicking on the Outlook security notification. Window could not be found\")\r\n end\r\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def click\n webapp = Webapp.find(params[:id])\n webapp.increment_nb_click(:element => params[:element])\n render :status => 200, :nothing => true\n end",
"def link_account_click\n link_account_button.click\n end",
"def click_on_x_button\n\n page.find(X_BUTTON).click\n sleep(THREAD_SLEEP_1)\n\n end",
"def on_click(elem)\n elem.fire_event('onClick')\n end",
"def on_click(&block)\n click_handlers << block\n self\n end",
"def choose_one_way\n get_elem_and_click(:id, ONE_WAY)\n end",
"def show_view\n\t\tvue_borne.window.show_all\n\tend",
"def growl_onClicked(sender, context)\n\t\tdebug('hello')\n\t\tdom = ''\n\t\t#get link from context\n\t\t@mailboxes.each do |mbox|\n\t\t\tif (mbox[:name] == context.to_s)\n\t\t\t\tdom = mbox[:link]\n\t\t\tend\n\t\tend\n\t\tdebug(\"Found Link: #{dom} from context: #{context}\")\n\t\t\n\t\t@res = `open #{dom}`\n\t\texit_smoothly(context)\n\tend",
"def click_button(button)\n append_to_script \"click_button \\\"#{button}\\\"\"\n end",
"def onClick(dialog, which)\n end",
"def click_button(button = T.unsafe(nil)); end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def otto_button_click\n MenuControllerContracts.invariant(self)\n @game_state_model::game_type = :otto\n @game_state_model::game_mode_logic = GameLogic::OttoRules.new(@game_state_model)\n @current_view = @views[1]\n MenuControllerContracts.invariant(self)\n end",
"def click_new_post\n click NEW_POST_BUTTON\n end",
"def click_element(mixpath)\n get_element(mixpath).click\n end",
"def click_element(mixpath)\n get_element(mixpath).click\n end",
"def doubleClick\n\t@selenium.double_click(@locator)\n end"
] | [
"0.7851789",
"0.7331209",
"0.7267243",
"0.70068026",
"0.69055134",
"0.6712826",
"0.6712826",
"0.6712826",
"0.66349316",
"0.6542265",
"0.6498272",
"0.64977866",
"0.64418554",
"0.64115185",
"0.6405271",
"0.6405271",
"0.6403231",
"0.63779926",
"0.6377938",
"0.63176066",
"0.62931335",
"0.6256786",
"0.6254482",
"0.6242218",
"0.6224594",
"0.62130123",
"0.61552763",
"0.6142512",
"0.614161",
"0.612424",
"0.61062795",
"0.60168463",
"0.5957948",
"0.58868086",
"0.5873531",
"0.58703953",
"0.5865808",
"0.585431",
"0.5831553",
"0.5815408",
"0.5811501",
"0.57998234",
"0.5797455",
"0.579008",
"0.5787137",
"0.57821524",
"0.57761276",
"0.57647395",
"0.5745514",
"0.5733162",
"0.5729757",
"0.57255226",
"0.569922",
"0.5698302",
"0.56953084",
"0.56763464",
"0.56752264",
"0.5663281",
"0.5656467",
"0.5648836",
"0.5641274",
"0.5640452",
"0.56298095",
"0.5627132",
"0.5620393",
"0.5609597",
"0.560742",
"0.560711",
"0.5589402",
"0.5577771",
"0.55502915",
"0.55500776",
"0.55500174",
"0.5528954",
"0.5522551",
"0.5521064",
"0.55118465",
"0.550594",
"0.5503997",
"0.55026877",
"0.54927063",
"0.5470891",
"0.54686457",
"0.54596245",
"0.54444",
"0.5443374",
"0.54380727",
"0.54378974",
"0.5436547",
"0.5434011",
"0.54233503",
"0.5421197",
"0.5419764",
"0.54193944",
"0.5414308",
"0.54130965",
"0.540772",
"0.5404206",
"0.5404206",
"0.53997064"
] | 0.6213732 | 25 |
Used to perform a single right click on this view in the remote application | def right_click()
right_mouse_down
right_mouse_up
stall :right_click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def click\n `#@native.click()`\n end",
"def click\n `#@native.click()`\n self\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def mouseButton()\n @view__.mouseButton\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def action\n trigger :click\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def click\n root_node.click\n end",
"def click\n @mech.click self\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def click; end",
"def click; end",
"def click; end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def item_was_clicked(sender)\n # Find the selected Link instance via the array controller and get its url attribute\n url_string = array_controller.selectedObjects.first.url\n if url_string\n # convert the url into a NSURL instance and open it in the browser.\n url = NSURL.URLWithString(url_string)\n NSWorkspace.sharedWorkspace.openURL(url)\n end\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def mouse_clicked(event)\n \n puts \"IN schemasTreeTable_mouse_clicked : #{event.inspect}\"\n puts \"MOUSE #{event.class} : #{event.getClickCount} : BUTTON #{event.getButton}\"\n\n # Double Click => EDIT\n if(event.getClickCount == 2)\n puts \"edit\"\n \n elsif( event.getButton == java.awt.event.MouseEvent::BUTTON3)\n \n transfer[:event] = event\n\n listener = PopupActionListener.new( self )\n\n items = [\"Select All\", \"Clear\"]\n\n listener.add_callback_method(\"Select All\", :select_all_action_performed )\n\n listener.add_callback(\"Clear\") do\n puts \"CLEAR SCHEMA SELECTION\"\n end\n\n pmenu = PopupMenuController.create_instance\n\n pmenu.open(event, items, listener )\n end\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def onLButtonDown(flags,x,y,view)\n pickpoint=@ip.position\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end",
"def right_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n action.move_to(element, x, y).context_click.perform\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def click\n raise \"Must implement custom click method.\"\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def basic_click()\n scroll_to_visible\n @driver.sc_basic_click action_target, *action_locator_args\n stall :click\n end",
"def onItemClick(parent, view, position, id)\n selectItem(position)\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def ctrlShow _obj, _args\n \"_obj ctrlShow _args;\" \n end",
"def click\n `#{@el}.click() || Opal.nil`\n end",
"def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def click_view_website\n view_website_link.click\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def clicked(e)\n \n end",
"def openContextPopup(pos, wItem)\n poRow = wItem.row\n poColumn = wItem.column\n process = taskItemAtRow(wItem.row).process\n\n menu = Qt::Menu.new\n insertDefaultActions(menu, poColumn, process)\n createPlayerMenu(menu, poColumn, process)\n action = menu.exec(pos)\n if action then\n $log.code { \"execute : '#{action.data.toString}'\" }\n cmd, exe = action.data.toString.split(/@/, 2)\n $log.code { \"cmd(#{cmd}), exe(#{exe})\" }\n if cmd =~ /^play/\n playMedia(cmd, process, exe)\n elsif self.respond_to?(cmd)\n self.method(cmd).call(process, wItem)\n else\n $log.warn { \"No method #{cmd} in contextmenu.\" }\n end\n end\n menu.deleteLater\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def switchto_listview()\n\t\t@browser.button(:class, \"btn icon-list-view\").click\n\tend",
"def clicked;end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def clicked(mouse_event)\n end",
"def on_click\n\t\tend",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def TreeView_Select(hwnd, hitem, code) send_treeview_message(hwnd, :SELECTITEM, wparam: code, lparam: hitem) end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end",
"def clicked\n router.navigated\n end",
"def open_menu\n touch_screen_element menu_icon\n end",
"def execute\n view.add_control target, controller.current_view.instance\n end",
"def question_help_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectAllAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def select_menu_item app, *path\n app.application.select_menu_item *path\n end",
"def clicked\n if @alert_view != nil\n @alert_view.clicked\n else\n @current_view.clicked\n end\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def TreeView_SelectItem(hwnd, hitem) TreeView_Select(hwnd, hitem, TreeViewGetNextItem[:CARET]) end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end",
"def TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TreeViewGetNextItem[:DROPHILITE]) end",
"def press_menu\n driver.pressQuickMenuItem(text, true);\n end",
"def action_target()\n \n end",
"def question_login_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::LoginAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def send_command_to_list_view(command, arg1 = \"\", arg2 = \"\")\n Control.functions[__method__] ||= AU3_Function.new(\"ControlListView\", 'SSSSSSPI')\n buffer = \" \" * BUFFER_SIZE\n buffer.wide!\n Control.functions[__method__].call(@title.wide, @text.wide, @c_id.wide, command.wide, arg1.to_s.wide, arg2.to_s.wide, buffer, BUFFER_SIZE - 1)\n raise(Au3Error, \"Unknown error occured when sending '#{command}' to '#{@c_id}' in '#{@title}'! Maybe an invalid window?\") if AutoItX3.last_error == 1\n buffer.normal.strip\n end",
"def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end",
"def open_menu_with_rightclick(element, menu_name)\n wait_start\n element.right_click\n wait_for_menu_shown(menu_name)\n end",
"def right_click_tree(tree, *path_elements)\n path = tree_path(path_elements)\n append_to_script \"right_click_tree \\\"#{tree}\\\",#{path}\"\n end",
"def leftClicked\n\t\t@first.leftClicked\n\tend",
"def onDoubleClick _obj, _args\n \"_obj onDoubleClick _args;\" \n end",
"def click_run_file_dialog_popup(title)\n click_button_popup(title, \"&Run\")\nend",
"def view_root_admin_detail(search_key)\n find(:xpath, \"//a[text()='#{search_key}']\").click\n end",
"def show_com_menu\n TactBattleManager.selecting(true)\n show_tb_command_window_tb\n end",
"def window_action(action)\n @@logger.an_event.debug \"action #{action}\"\n title = fetch(\"window.top.document.title\")\n @@logger.an_event.debug \"title #{title}\"\n title = prepare_window_action(title)\n @@logger.an_event.debug \"title #{title}\"\n\n exec_command(\"windowAction\", {\"action\" => action, \"title\" => title})\n end",
"def click(type, query)\n browser.send(type, query).click\n end",
"def viewer\n admin\n end",
"def mouseX()\n @view__.mouseX\n end",
"def hotkey\n @link.HotKey\n end",
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def right_click_list(list, item_index)\n append_to_script \"right_click_list \\\"#{list}\\\" , \\\"#{item_index}\\\"\"\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def open_lid()\n \"Click the <b>Open Lid</b> button\"\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def menu_press( menu_label )\n %x{osascript<<APPLESCRIPT\n activate application \"iPhone Simulator\"\n tell application \"System Events\"\n \tclick menu item \"#{menu_label}\" of menu \"#{Localize.t(:hardware)}\" of menu bar of process \"#{Localize.t(:iphone_simulator)}\"\n end tell\n APPLESCRIPT} \n end",
"def doubleClick\n\t@selenium.double_click(@locator)\n end"
] | [
"0.69611996",
"0.6806256",
"0.66562665",
"0.64541644",
"0.63785434",
"0.6358608",
"0.630985",
"0.63055325",
"0.6230192",
"0.6185122",
"0.616992",
"0.6126149",
"0.5999554",
"0.59909505",
"0.5973776",
"0.59367365",
"0.5917623",
"0.5895321",
"0.5859786",
"0.5852538",
"0.5851412",
"0.5851412",
"0.582955",
"0.5815732",
"0.579581",
"0.579581",
"0.579581",
"0.579311",
"0.57887363",
"0.5762672",
"0.56907946",
"0.5684917",
"0.56779706",
"0.5632045",
"0.55983853",
"0.55433035",
"0.5538202",
"0.5526025",
"0.5523455",
"0.55139065",
"0.5487628",
"0.5474615",
"0.54683936",
"0.5463639",
"0.5457557",
"0.54498124",
"0.5422613",
"0.5421298",
"0.5409653",
"0.539517",
"0.53938055",
"0.53679615",
"0.5360694",
"0.5348436",
"0.5347233",
"0.53405035",
"0.5331601",
"0.5329296",
"0.532214",
"0.5315219",
"0.5305004",
"0.5295081",
"0.5295081",
"0.52674395",
"0.5259318",
"0.52552956",
"0.5244661",
"0.5240483",
"0.5224951",
"0.52244365",
"0.52156204",
"0.5206101",
"0.52011955",
"0.51880497",
"0.5176864",
"0.51647514",
"0.5159254",
"0.5147105",
"0.5145213",
"0.51450425",
"0.51418495",
"0.5134611",
"0.5134241",
"0.51256484",
"0.5119566",
"0.51091003",
"0.5102559",
"0.50996405",
"0.50987726",
"0.50968724",
"0.5088667",
"0.50858784",
"0.50830775",
"0.5082457",
"0.5074955",
"0.5074955",
"0.507495",
"0.50688785",
"0.5067074",
"0.5059405"
] | 0.6970275 | 0 |
Used to perform a single basic click on this view in the remote application | def basic_click()
scroll_to_visible
@driver.sc_basic_click action_target, *action_locator_args
stall :click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n `#@native.click()`\n end",
"def action\n trigger :click\n end",
"def click\n @mech.click self\n end",
"def click; end",
"def click; end",
"def click; end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def on_click\n\t\tend",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def click\n raise \"Must implement custom click method.\"\n end",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def click\n root_node.click\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click_view_website\n view_website_link.click\n end",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def click\n `#{@el}.click() || Opal.nil`\n end",
"def click\n @_node.click\n @_node.getPage.getWebClient.waitForBackgroundJavaScriptStartingBefore(3000)\n end",
"def clicked\n if @alert_view != nil\n @alert_view.clicked\n else\n @current_view.clicked\n end\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def click(link); end",
"def click_with_rest!(publisher_app)\n rest_request(:get, get_click_url(publisher_app), format: :html)\n click\n end",
"def clicked(e)\n \n end",
"def clicked;end",
"def item_was_clicked(sender)\n # Find the selected Link instance via the array controller and get its url attribute\n url_string = array_controller.selectedObjects.first.url\n if url_string\n # convert the url into a NSURL instance and open it in the browser.\n url = NSURL.URLWithString(url_string)\n NSWorkspace.sharedWorkspace.openURL(url)\n end\n end",
"def clicked\n router.navigated\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def view(name, locator)\n define_method(name) do\n platform.click_view(locator)\n end\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def choose_first_click; end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def click(type, query)\n browser.send(type, query).click\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def show()\n @view__.show\n self\n end",
"def execute\n view.add_control target, controller.current_view.instance\n end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def clicked(mouse_event)\n end",
"def js_click\n href = node.attributes['onclick'].to_s.match(/location.href='(.*)'/)[1]\n full_uri = URI::HTTP.build({scheme: page.uri.scheme, host: page.uri.host, path: href})\n mech.get(full_uri)\n end",
"def complete_click(publisher_app)\n click_with_rest! publisher_app\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def classic_button_click\n MenuControllerContracts.invariant(self)\n @game_state_model::game_type = :classic\n @game_state_model::game_mode_logic = GameLogic::ClassicRules.new(@game_state_model)\n @current_view = @views[1]\n MenuControllerContracts.invariant(self)\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def click_act_as_link\n act_as_link.click\n sleep(10)\n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def show_view\n\t\tvue_borne.window.show_all\n\tend",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def question_login_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::LoginAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def click(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, false, o1, o2, o3, o4, o5)\nend",
"def switchto_listview()\n\t\t@browser.button(:class, \"btn icon-list-view\").click\n\tend",
"def onItemClick(parent, view, position, id)\n selectItem(position)\n end",
"def click_settings\n settings.click\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def click_approach_link\n click APPROACH_LINK\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def clicked\n @return.clicked\n end",
"def question_help_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectAllAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def click_button(button = T.unsafe(nil)); end",
"def click(name, tag)\n click_on_button(name, tag, @klass)\n end",
"def click_start_now_button\n click_link(@start_now_button_text)\n end",
"def click_on_a_button(selector)\n\n click_button(selector)\n\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def goto\n navigate_application_to \"Report=>Custom Views\"\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def click_button(button)\n append_to_script \"click_button \\\"#{button}\\\"\"\n end",
"def click_on_event option\n visits event_path(option.event)\n clicks_link option.description\n end",
"def activate_tab_with_click\n click\n \n # No event yet so just cheat and sleep\n sleep(0.1);\n end",
"def click_on_x_button\n\n page.find(X_BUTTON).click\n sleep(THREAD_SLEEP_1)\n\n end",
"def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend",
"def click_new_post\n click NEW_POST_BUTTON\n end",
"def set_as_default_view\n frm.link(:text=>\"Set as Default View\").click\n end",
"def view_modal\n handle_view\n end",
"def click\n @sign_in.click\n end",
"def growl_onClicked(sender, context)\n\t\tdebug('hello')\n\t\tdom = ''\n\t\t#get link from context\n\t\t@mailboxes.each do |mbox|\n\t\t\tif (mbox[:name] == context.to_s)\n\t\t\t\tdom = mbox[:link]\n\t\t\tend\n\t\tend\n\t\tdebug(\"Found Link: #{dom} from context: #{context}\")\n\t\t\n\t\t@res = `open #{dom}`\n\t\texit_smoothly(context)\n\tend",
"def action\n puts \"use command!\\n\\n\"\n end",
"def click\n webapp = Webapp.find(params[:id])\n webapp.increment_nb_click(:element => params[:element])\n render :status => 200, :nothing => true\n end",
"def on_click(elem)\n elem.fire_event('onClick')\n end",
"def context_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def action\n driver.action\n end",
"def click_button(atrans,acftrans)\r\n sleep 2\r\n hwnd = client.railgun.user32.FindWindowW(nil, \"Microsoft Outlook\")\r\n if hwnd != 0\r\n hwndChildCk = client.railgun.user32.FindWindowExW(hwnd['return'], nil, \"Button\", \"&#{acftrans}\")\r\n client.railgun.user32.SendMessageW(hwndChildCk['return'], 0x00F1, 1, nil)\r\n client.railgun.user32.SetCursorPos(707,475)\r\n client.railgun.user32.mouse_event(0x0002,719,502,nil,nil) \r\n client.railgun.user32.mouse_event(0x0004,719,502,nil,nil)\r\n client.railgun.user32.SetCursorPos(710,499)\r\n client.railgun.user32.mouse_event(0x0002,710,499,nil,nil)\r\n client.railgun.user32.mouse_event(0x0004,710,499,nil,nil)\r\n else\r\n print_error(\"Error while clicking on the Outlook security notification. Window could not be found\")\r\n end\r\n end",
"def onClick(dialog, which)\n end",
"def show()\n view.show\n end"
] | [
"0.79658914",
"0.7399428",
"0.73979634",
"0.7080815",
"0.69916844",
"0.69690925",
"0.69690925",
"0.69690925",
"0.66622967",
"0.6624738",
"0.66089916",
"0.6590496",
"0.651034",
"0.6488527",
"0.6451603",
"0.64472383",
"0.64472383",
"0.6390206",
"0.6388577",
"0.63356143",
"0.6322899",
"0.63037616",
"0.63029075",
"0.62662953",
"0.6202417",
"0.62010986",
"0.61947656",
"0.6193577",
"0.6153195",
"0.61500144",
"0.6110078",
"0.60443074",
"0.6043456",
"0.6024285",
"0.5997549",
"0.5909971",
"0.5904352",
"0.5898358",
"0.5894438",
"0.5885887",
"0.58588165",
"0.5849369",
"0.58004934",
"0.57907575",
"0.5776565",
"0.5774859",
"0.57684964",
"0.5752734",
"0.5743342",
"0.5736903",
"0.5724454",
"0.5711004",
"0.5704594",
"0.5699931",
"0.56982076",
"0.5690349",
"0.56812024",
"0.5672972",
"0.56601363",
"0.56481236",
"0.5633371",
"0.5621357",
"0.5615668",
"0.5612853",
"0.56117046",
"0.5608745",
"0.56063014",
"0.5603113",
"0.56003785",
"0.55997986",
"0.5594884",
"0.5593954",
"0.5593214",
"0.5583114",
"0.5574218",
"0.5564722",
"0.55541015",
"0.5548991",
"0.5523623",
"0.5515996",
"0.5513706",
"0.5506719",
"0.5497315",
"0.54921824",
"0.54848605",
"0.54816145",
"0.54800457",
"0.54772794",
"0.5476432",
"0.5475801",
"0.54701996",
"0.54696137",
"0.5466972",
"0.5453002",
"0.54376966",
"0.5437239",
"0.5428164",
"0.542795",
"0.54255605",
"0.54177547"
] | 0.70629334 | 4 |
Used to perform a mouse wheel action on the xaxis | def mouse_wheel_delta_x(delta)
@driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args
stall :mouse_wheel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scroll_mouse(x_amount, y_amount)\n send_request RequestMessage.new(mouse_wheel_message: MouseWheel.new(x_scroll: x_amount, y_scroll: y_amount))\n end",
"def mouse_x\n end",
"def mouse_x_update(val)\n $mouse_x += val\n sc_osc \"/n_set\", $synth_g, \"x\", $mouse_x\nend",
"def mouseX; end",
"def mouse_x=(value); self.set_mouse_x(value); end",
"def update_mouse_index\n delta = -Mouse.wheel\n update_mouse_delta_index(delta)\n Mouse.wheel = 0\n return false\n end",
"def xaxis\n end",
"def move_home_x\n @axis_x.move_home()\n @axis_x.disable_motor()\n end",
"def mouse_moved\n modulate_amount = map1d(mouse_y, (0..height), (220..1))\n modulate_frequency = map1d(mouse_x, (0..width), (0.1..100)) \n fm.frequency.set_last_value(modulate_frequency )\n fm.amplitude.set_last_value(modulate_amount)\nend",
"def update_mouse_index\n delta = -Mouse.wheel\n update_mouse_delta_index(delta) unless @list_item.size == 1\n Mouse.wheel = 0\n return false\n end",
"def mouse_x; mouseX; end",
"def mouse_x; mouseX; end",
"def update\n super\n # Scroll\n if self.active\n scroll_max = [self.contents.width - (self.width - 32), 0].max\n if Input.press?(Input::Y)\n self.ox = [self.ox - (self.width - 32), 0].max\n elsif Input.press?(Input::Z)\n self.ox = [self.ox + (self.width - 32), scroll_max].min\n end\n end\n end",
"def _entry_5_xscrollcommand(*args)\n\n end",
"def wheel_inputs; end",
"def _entry_4_xscrollcommand(*args)\n\n end",
"def mouse_wheel_delta_y(delta)\n @driver.sc_mouse_wheel_delta_y action_target, delta, *action_locator_args\n stall :mouse_wheel\n end",
"def _entry_1_xscrollcommand(*args)\n\n end",
"def _entry_1_xscrollcommand(*args)\n\n end",
"def mouseX()\n @view__.mouseX\n end",
"def _entry_6_xscrollcommand(*args)\n\n end",
"def _entry_3_xscrollcommand(*args)\n\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def update_mouse\n @my = Mouse.y\n unless Mouse.wheel == 0\n Mouse.wheel > 0 ? update_cursor_up : update_cursor_down\n return Mouse.wheel = 0\n end\n return unless simple_mouse_in?\n\n @texts.stack.each_with_index do |text, i|\n next unless text.simple_mouse_in?\n\n if @index < i\n update_cursor_down while @index < i\n elsif @index > i\n update_cursor_up while @index > i\n end\n break\n end\n end",
"def ibooks_scroll_axis(val)\n @book.ibooks_scroll_axis = val\n end",
"def _listbox_1_xscrollcommand(*args)\n\n end",
"def _entry_2_xscrollcommand(*args)\n\n end",
"def draw_wheel(center, dist)\r\n \r\n draw_circle(center, $normVec, $axelRadius)\r\n draw_circle(center, $normVec, dist + $outerRadius)\r\n attachPoint = Geom::Point3d.new(center[0] + dist, center[1], center[2])\r\n UI.messagebox attachPoint\r\n draw_circle(attachPoint, $normVec, $axelRadius)\r\n\r\nend",
"def mouse_y\n end",
"def mouse_moved(x,y)\n\t\t[\n\t\t\t# @live_wrapper,\n\t\t\t@input_test,\n\t\t].each do |dynamic_obj|\n\t\t\tdynamic_obj.mouse_moved x,y\n\t\tend\n\tend",
"def update\n super\n if self.active\n if !horizontal_scroll\n # Scroll vertically\n scroll_max = [self.contents.height - (self.height - 32), 0].max\n if Input.press?(Input::UP)\n self.oy = [self.oy - self.scroll_speed, 0].max\n elsif Input.press?(Input::DOWN)\n self.oy = [self.oy + self.scroll_speed, scroll_max].min\n elsif Input.repeat?(Input::L)\n self.oy = [self.oy - (self.height - 32), 0].max\n elsif Input.repeat?(Input::R)\n self.oy = [self.oy + (self.height - 32), scroll_max].min\n end\n else\n # Scroll horizontally\n scroll_max = [self.contents.width - (self.width - 32), 0].max\n if Input.press?(Input::LEFT)\n self.ox = [self.ox - self.scroll_speed, 0].max\n elsif Input.press?(Input::RIGHT)\n self.ox = [self.ox + self.scroll_speed, scroll_max].min\n elsif Input.repeat?(Input::L)\n self.ox = [self.ox - (self.width - 32), 0].max\n elsif Input.repeat?(Input::R)\n self.ox = [self.ox + (self.width - 32), scroll_max].min\n end\n end\n end\n end",
"def mouseDragged event\n end",
"def mouse_up *args; end",
"def mouse_motion *args\n\t\t\tevent(:mouse_motion, nil, *args)\n\t\tend",
"def on_mouse_move(new_point)\n end",
"def mouse_press *args\n\t\t\tevent(:mouse_press, *args)\n\t\tend",
"def tick args\n tick_instructions args, \"Sample app shows how mouse events are registered and how to measure elapsed time.\"\n x = 460\n\n args.outputs.labels << small_label(args, x, 11, \"Mouse input: args.inputs.mouse\")\n\n if args.inputs.mouse.click\n args.state.last_mouse_click = args.inputs.mouse.click\n end\n\n if args.state.last_mouse_click\n click = args.state.last_mouse_click\n args.outputs.labels << small_label(args, x, 12, \"Mouse click happened at: #{click.created_at}\")\n args.outputs.labels << small_label(args, x, 13, \"Mouse clicked #{click.created_at_elapsed} ticks ago\")\n args.outputs.labels << small_label(args, x, 14, \"Mouse click location: #{click.point.x}, #{click.point.y}\")\n else\n args.outputs.labels << small_label(args, x, 12, \"Mouse click has not occurred yet.\")\n args.outputs.labels << small_label(args, x, 13, \"Please click mouse.\")\n end\nend",
"def update_x(x_speed)\n\t\t@x += x_speed\n\t\t@prawn.x += x_speed\n\tend",
"def pmouseX()\n @view__.pmouseX\n end",
"def update_mouse_ctrl\n if @mode != :select\n update_mouse_ctrl_buttons(@base_ui.ctrl, Actions, @base_ui.win_text_visible?)\n else\n update_mouse_ctrl_buttons(@base_ui.ctrl, [:action_X], false)\n end\n end",
"def add_wheel_input(name); end",
"def set_x_axis(params = {})\n @x_axis = convert_axis_args(@x_axis, params)\n end",
"def scroll_left\n self.scroll[:x]\n end",
"def update\n super\n # Process mouse operations if mouse is on screen and custom method implemented\n #if $mouse.on_screen? and @active_mod_on\n # if mouse_on_window?\n # Mouse.window_add(self)\n # end\n #end\n end",
"def tick event\n raise NotImplementedError, \"Subclass responsibility to implement #tick\"\n end",
"def update\n if Input.repeat?(:DOWN)\n update_cursor_down\n elsif Input.repeat?(:UP)\n update_cursor_up\n elsif @my != Mouse.y || Mouse.wheel != 0\n update_mouse\n end\n super\n end",
"def show_x_axis\n false\n end",
"def set_mouse_factors(factorX, factorY); end",
"def mouse_dragged(x, y)\n window_point = Geo3d::Vector.new(x,y)\n\n @sphere_point_when[:mouse_draged] = window_to_sphere_space(window_point)\n end",
"def mouse_up()\n mouse_up_at :center, :center\n end",
"def tick\n end",
"def mouse_pressed(x, y)\n window_point = Geo3d::Vector.new(x,y)\n\n @sphere_point_when[:mouse_down] = window_to_sphere_space(window_point)\n @sphere_point_when[:mouse_draged] = @sphere_point_when[:mouse_down]\n end",
"def delete_x_axis\n self.GetXaxis.SetLabelOffset(999)\n self.GetXaxis.SetTitleOffset(999)\n end",
"def mill_pump_wheel_lid(pCent_x, pCent_y)\r\n # # # # # # # # # # # # # #\r\n print \"(mill_pump_wheel_lid)\\n\" \r\n mill.retract()\r\n \r\n print \"(L995 - shaft_diam = \", shaft_diam, \")\\n\"\r\n \r\n mill_impeller_axel(pCent_x, pCent_y, mirrored=false, pBegZ=0, pEndZ=nil)\r\n \r\n \r\n # Coutout job with the last \r\n mill.retract()\r\n \r\n # TODO: change this over to cutout that leaves tabs\r\n spiral_down_circle(mill = mill, \r\n x = pCent_x,\r\n y = pCent_y, \r\n diam = cutout_diam, \r\n beg_z=0, \r\n end_z=drill_through_depth * 0.97, \r\n adjust_for_bit_radius=false, \r\n outside=true, \r\n auto_speed_adjust=false)\r\n \r\n mill.retract()\r\n mill.home() \r\n \r\n \r\n end",
"def mouseY; end",
"def move_mouse(x_delta, y_delta)\n send_request RequestMessage.new(mouse_event_message: MouseEvent.new(x_delta: x_delta, y_delta: y_delta))\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def mouse_down()\n mouse_down_at :center, :center\n end",
"def ctrlAutoScrollSpeed _args\n \"ctrlAutoScrollSpeed _args;\" \n end",
"def tick(events)\n end",
"def mousemove_relative(x, y)\n @logger.info(\"mousemove not supported\")\n end",
"def scrollLeft\n `#{@el}.scrollLeft`\n end",
"def axes\n end",
"def mouse_action\n @all_window.each.with_index do |window, i|\n next unless window.visible && window.simple_mouse_in?\n @index = i\n refresh\n action\n end\n end",
"def speed\n # speeds should be between 1 and 2\n @window.mouse_y_percent\n end",
"def set_x_axis(params = {})\n @date_category = true if ptrue?(params[:date_axis])\n @x_axis.merge_with_hash(params)\n end",
"def Pager_ForwardMouse(hwnd, bForward) send_pager_message(hwnd, :FORWARDMOUSE, wparam: bForward) end",
"def tick args\r\n # The addition and subtraction in the first two parameters of the label and solid\r\n # ensure that the outputs don't overlap each other. Try removing them and see what happens.\r\n pos = args.inputs.mouse.position # stores coordinates of mouse's position\r\n args.state.enemies ||= []\r\n cal_enemy args\r\n render_enemies args\r\n click_instruction args\r\n tick_instructions args, \"Mouse Trainning Program\"\r\nend",
"def set_mouse_speed pixels\r\n command 'setMouseSpeed', pixels\r\n end",
"def mouse_in(mouse_event)\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def joyaxis( axis )\n return AndTrigger.new( InstanceOfTrigger.new( JoystickAxisMoved ),\n AttrTrigger.new(:joystick_id => 0,\n :axis => axis))\nend",
"def onKeyDown(key, repeat, flags, view)\n## puts \"onKeyDown called\"\n ## Check for Arrow keys to toggle axis lock\n case key \n when VK_RIGHT ## Right arrow key pressed: toggle red axis lock on/off\n if @@axis_lock == X_AXIS then ## Red axis lock was on: turn all axis locks off\n @@axis_lock = NO_LOCK\n @cursor_text = \"\\n\\n\" + @profile[1]\n else\n @@axis_lock = X_AXIS ## turn red axis lock on\n ## Reset long axis to axis lock and recalculate @vec5\n @reported_normal = @@axis_lock\n @vec5 = Z_AXIS.cross @reported_normal\n @cursor_text = \"\\n\\n\" + @profile[1] + \"\\nX locked\"\n end\n when VK_LEFT ## Left arrow key pressed: toggle green axis lock on/off\n if @@axis_lock == Y_AXIS then ## Y-axis lock was on: turn all axis locks off\n @@axis_lock = NO_LOCK\n @cursor_text = \"\\n\\n\" + @profile[1]\n else\n @@axis_lock = Y_AXIS ## turn green axis lock on\n ## Reset long axis to axis lock and recalculate @vec5\n @reported_normal = @@axis_lock\n @vec5 = Z_AXIS.cross @reported_normal\n @cursor_text = \"\\n\\n\" + @profile[1] + \"\\nY locked\"\n end\n ##view.refresh\n when VK_DOWN ## Down arrow key pressed: toggle blue axis lock on/off\n if @@axis_lock == Z_AXIS then ## Axis lock was on: turn all axis locks off\n @@axis_lock = NO_LOCK\n @cursor_text = \"\\n\\n\" + @profile[1]\n else\n @@axis_lock = Z_AXIS ## turn blue axis lock on\n ## Reset long axis to axis lock \n @reported_normal = @@axis_lock\n @vec5 = Y_AXIS\n @cursor_text = \"\\n\\n\" + @profile[1] + \"\\nZ locked\"\n end\n when VK_UP ## Up arrow key pressed: toggle blue axis lock on/off\n if @@axis_lock == Z_AXIS then ## Axis lock was on: turn all axis locks off\n @@axis_lock = NO_LOCK\n else\n @@axis_lock = Z_AXIS ## turn blue axis lock on\n ## Reset long axis to axis lock and recalculate @vec5\n @reported_normal = @@axis_lock\n @vec5 = Y_AXIS\n @cursor_text = \"\\n\\n\" + @profile[1] + \"\\nZ locked\"\n end\n when CONSTRAIN_MODIFIER_KEY\n if( repeat == 1 )\n @shift_down_time = Time.now\n## puts \"CONSTRAINED\"\n ## if we already have an inference lock, then unlock it\n if( view.inference_locked? )\n ## calling lock_inference with no arguments actually unlocks\n view.lock_inference\n elsif( @state == 0 && @ip1.valid? )\n view.lock_inference @ip1\n view.line_width = 3\n elsif( @state <= 2 && @ip2.valid? )\n view.lock_inference @ip2, @ip1\n view.line_width = 3\n end\n end\n when 9 ## Tab key: Cycle through flipX, flipY, flipXY, noflip\n## puts \"@state = \" + @state.to_s\n if @state == 1 ## Only applicable when cross-section has been drawn\n @flip = (@flip + 1)%4 \n\n ## puts \"flip state = \" + @flip.to_s\n ##Reorient inserted profile\n ##If needed, flip profile in x, y, or both directions\n ## if @comp_defn.instances[-1] ## don't try unless there's something created \n ## case @flip \n ## when 0 ## flip X\n ## @comp_defn.instances[-1].transform! flip_x\n ## when 1 ## flip Y\n ## @comp_defn.instances[-1].transform! flip_y\n ## when 2 ## flip X & Y (Y was already flipped) \n ## @comp_defn.instances[-1].transform! flip_x \n ## when 3 ## flip back to original\n ## @comp_defn.instances[-1].transform! flip_y\n ## end ## case @flip\n ## end ## if@comp_defn.instances[-1]\n end ## if @state\n end ## case key\n\n ## puts\"Selected axis = \" + @@axis_lock.inspect.to_s\n ## force change of cursor on screen\n self.onSetCursor() \n false\n\n end",
"def update_basic\n cursor_update\n mouse_cursor\n \n checkLeftClick()\n checkClickHover()\n end",
"def update_accel\n user_controlling = false\n if user_controlling\n x, y = 0,0\n x -= 1 if @keys.include?( :left )\n x += 1 if @keys.include?( :right )\n y -= 1 if @keys.include?( :up ) # up is down in screen coordinates\n y += 1 if @keys.include?( :down )\n x *= @accel\n y *= @accel\n # Scale to the acceleration rate. This is a bit unrealistic, since\n # it doesn't consider magnitude of x and y combined (diagonal).\n @ax, @ay = x, y\n else\n @ax, @ay = @accel, @accel\n end\n end",
"def scrollUp\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, 20, 0, Qt::LEFT_BUTTON)\n end",
"def picture_scroll_x(ids, speed = nil)\n return pictures[ids].scroll_speed_x unless speed\n select_pictures(ids).each {|id| pictures[id].scroll_speed_x = speed}\n end",
"def tick args\n drtouch = DRTouch.new\n drtouch.init\n drtouch.update\n \n args.outputs.background_color = [ 0, 0, 0, 255 ]\n \n args.outputs.primitives << {\n x: 320,\n y: 16.from_top,\n text: \"TAP AND MOVE YOUR FINGER OVER THE SCREEN\",\n size_enum: 6,\n r: 255,\n g: 255,\n b: 255,\n a: 255,\n }.label\n \n if drtouch.down(0)\n pos = drtouch.pos(0)\n \n args.outputs.primitives << {\n x: pos.x,\n y: pos.y,\n w: 50,\n h: 50,\n r: 34,\n g: 155,\n b: 255,\n a: 255,\n }.solid\n \n args.outputs.primitives << {\n x: 16,\n y: 8.from_top,\n text: \"x1: #{pos.x}, y1: #{pos.y}\",\n size_enum: 2,\n r: 255,\n g: 0,\n b: 0,\n a: 255\n }.label\n end\nend",
"def set_mouse_pos _x, _y\n send_cmd(\"set_mouse_pos #{_x} #{_y}\")\n end",
"def setMousePosition _args\n \"setMousePosition _args;\" \n end",
"def update_mouse_delta_index(delta)\n new_index = (@index + delta).clamp(0, @scroll_bar.max_index)\n delta = new_index - @index\n return if delta == 0\n if delta.abs < 5\n @index = new_index if delta.abs == 1\n animate_list_index_change(delta)\n else\n @index = new_index\n update_item_button_list\n update_info\n @scroll_bar.index = @index\n end\n end",
"def right_mouse_up()\n right_mouse_up_at :center, :center\n end",
"def update\n @prev_down = @down.clone\n @down = @next_down.clone\n @next_down.delete_if { |_, v| v.zero? }\n @dbl_click.clear\n\n if @click\n @click[:action].call\n @click = nil\n end\n\n @dbl_click_timer.each do |k, v|\n if v < G.double_click_delay\n @dbl_click_timer[k] += 1\n else\n @dbl_click_timer.delete(k)\n end\n end\n\n %i[left middle right].each do |key|\n if @down[key]\n @dbl_click[key] = true if @dbl_click_timer[key]\n @dbl_click_timer.delete(key)\n elsif @prev_down[key]\n @dbl_click_timer[key] = 0\n end\n end\n\n @x = G.window.mouse_x.round\n @y = G.window.mouse_y.round\n end",
"def on_mouse_motion(evt)\n if evt.left_is_down()\n @dragging = true\n x=evt.get_x ; y=evt.get_y \n idx=coords_to_idx(x,y, @cursor.area)\n if idx \n idx = @data.size unless @data[idx]\n @last_pos ||= self.cur_pos\n self.cur_pos = idx\n expand_selection(idx)\n refresh\n end\n else\n evt.skip()\n return\n end\n end",
"def ctrlSetAutoScrollSpeed _obj, _args\n \"_obj ctrlSetAutoScrollSpeed _args;\" \n end",
"def mouse_pressed\n super\n\n if mouse_button == RIGHT\n @right_mouse_down_x = mouseX\n @right_mouse_down_y = mouseY\n end\n end",
"def set_mouse_position(x, y); end",
"def lock_axis( key, ip, view )\r\n # Determine what axis to process.\r\n case key\r\n when VK_RIGHT\r\n axis = @axes.x\r\n when VK_LEFT\r\n axis = @axes.y\r\n when VK_UP, VK_DOWN\r\n axis = @axes.z\r\n else\r\n return false\r\n end\r\n # Determine if lock is set, changed or released.\r\n if axis && @axis_lock && @axis_lock.parallel?( axis )\r\n # Released\r\n @axis_lock = nil\r\n else\r\n # Changed / Set\r\n @axis_lock = axis\r\n end\r\n # Special handling of arrow keys that trigger axis lock.\r\n if @axis_lock\r\n # For axis lock an InputPoint is generated in order to be able to\r\n # lock the inference - it accept only InputPoint objects.\r\n ip2 = Sketchup::InputPoint.new( ip.position.offset( @axis_lock ) )\r\n view.lock_inference( ip, ip2 )\r\n else\r\n # Release lock.\r\n view.lock_inference\r\n end\r\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def x=(value)\n return until @x != value\n @x = value\n @window.need_redraw = true\n end",
"def scroll_by(delta_x, delta_y, device: T.unsafe(nil)); end",
"def mouse_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 11, \"Mouse input: inputs.mouse\")\n\n if inputs.mouse.click # if click has a value and is not nil\n state.last_mouse_click = inputs.mouse.click # coordinates of click are stored\n end\n\n if state.last_mouse_click # if mouse is clicked (has coordinates as value)\n # outputs the time (frame) the click occurred, as well as how many frames have passed since the event\n outputs.labels << small_label(x, 12, \"Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}\")\n # outputs coordinates of click\n outputs.labels << small_label(x, 13, \"Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}\")\n else # otherwise if the mouse has not been clicked\n outputs.labels << small_label(x, 12, \"Mouse click has not occurred yet.\")\n outputs.labels << small_label(x, 13, \"Please click mouse.\")\n end\n end",
"def drag_x(object,limit_x=nil,limit_width=nil)\\\n return false if !defined?(object.x)\n if self.leftPress?(object)\n if @object_ox.nil?\n @object_ox = @x - object.x\n end\n object.x = @x - @object_ox\n object.x = limit_x if limit_x && object.xlimit_width\n else\n @object_ox=nil\n end\n end",
"def fire_events_for_mouse_movement\n current_state.each {|cs| cs.fire_events_for_mouse_movement }\n end",
"def x=(x)\n super(x)\n @selectable_window.x = x\n end",
"def click_on(id, x, y)\n # Get the position of this window id\n position = get_position(id)\n # Add the [x, y] passed in by get_position to our x and y\n x += position[0]\n y += position[1]\n # Move the mouse to (x, y), then click\n xdotool \"mousemove #{x} #{y}\"\n xdotool \"click 1\"\n # sleep $sleep_time\nend",
"def check_click\n return false unless Mouse.press?(:left)\n\n # Get viewport coords\n mx, my = @viewport.translate_mouse_coords\n trigger = Mouse.trigger?(:left)\n # Process slider dragging\n return true if update_slider_dragging(mx, my, trigger)\n\n # Process buttons\n return update_buttons_input(mx, my, trigger)\n end",
"def mouse_move locator\r\n command 'mouseMove', locator\r\n end",
"def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend",
"def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend"
] | [
"0.6770733",
"0.6498436",
"0.63490856",
"0.6292921",
"0.6154801",
"0.60555744",
"0.60477966",
"0.6037942",
"0.6001609",
"0.59388274",
"0.591052",
"0.591052",
"0.5729326",
"0.5668674",
"0.5656004",
"0.5642068",
"0.5602431",
"0.55874383",
"0.55874383",
"0.5560465",
"0.55550665",
"0.55487925",
"0.54931796",
"0.5491113",
"0.54421467",
"0.5389635",
"0.5378108",
"0.5314861",
"0.5272022",
"0.52697897",
"0.5265933",
"0.5247732",
"0.52359796",
"0.5226513",
"0.5221337",
"0.5199597",
"0.5197106",
"0.5191903",
"0.51773745",
"0.51754737",
"0.5141734",
"0.5132105",
"0.5131364",
"0.51132274",
"0.51125485",
"0.5093934",
"0.5082443",
"0.5081068",
"0.5048995",
"0.50440437",
"0.5012943",
"0.5010497",
"0.5006368",
"0.5005813",
"0.5000379",
"0.49965084",
"0.49940977",
"0.4990756",
"0.4990093",
"0.49728072",
"0.49522763",
"0.49116755",
"0.49086052",
"0.4908333",
"0.48968783",
"0.48684657",
"0.48627514",
"0.48507097",
"0.48477826",
"0.48379132",
"0.48347467",
"0.48264447",
"0.48250154",
"0.4820862",
"0.48187968",
"0.48116976",
"0.48111936",
"0.48038855",
"0.48014298",
"0.47848618",
"0.47844642",
"0.4780604",
"0.47769782",
"0.47740594",
"0.477001",
"0.4768136",
"0.47665685",
"0.4756847",
"0.4756467",
"0.47493288",
"0.47387296",
"0.47336414",
"0.47219688",
"0.47197202",
"0.4719509",
"0.47117126",
"0.47111818",
"0.4707981",
"0.46989682",
"0.46989682"
] | 0.7761264 | 0 |
Used to perform a mouse wheel action on the yaxis | def mouse_wheel_delta_y(delta)
@driver.sc_mouse_wheel_delta_y action_target, delta, *action_locator_args
stall :mouse_wheel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_y\n end",
"def move_home_y\n @axis_y.move_home()\n @axis_y.disable_motor()\n end",
"def mouseY; end",
"def yaxis\n end",
"def mouse_moved\n modulate_amount = map1d(mouse_y, (0..height), (220..1))\n modulate_frequency = map1d(mouse_x, (0..width), (0.1..100)) \n fm.frequency.set_last_value(modulate_frequency )\n fm.amplitude.set_last_value(modulate_amount)\nend",
"def speed\n # speeds should be between 1 and 2\n @window.mouse_y_percent\n end",
"def scroll_mouse(x_amount, y_amount)\n send_request RequestMessage.new(mouse_wheel_message: MouseWheel.new(x_scroll: x_amount, y_scroll: y_amount))\n end",
"def update_mouse\n @my = Mouse.y\n unless Mouse.wheel == 0\n Mouse.wheel > 0 ? update_cursor_up : update_cursor_down\n return Mouse.wheel = 0\n end\n return unless simple_mouse_in?\n\n @texts.stack.each_with_index do |text, i|\n next unless text.simple_mouse_in?\n\n if @index < i\n update_cursor_down while @index < i\n elsif @index > i\n update_cursor_up while @index > i\n end\n break\n end\n end",
"def joyaxis( axis )\n return AndTrigger.new( InstanceOfTrigger.new( JoystickAxisMoved ),\n AttrTrigger.new(:joystick_id => 0,\n :axis => axis))\nend",
"def set_y_axis(params = {})\n @y_axis = convert_axis_args(@y_axis, params)\n end",
"def update_y(y_speed)\n\t\t@y += y_speed\n\t\t@prawn.y += y_speed \n\tend",
"def update_mouse_index\n delta = -Mouse.wheel\n update_mouse_delta_index(delta)\n Mouse.wheel = 0\n return false\n end",
"def set_y2_axis(params = {})\n @y2_axis = convert_axis_args(@y2_axis, params)\n end",
"def _listbox_1_yscrollcommand(*args)\n\n end",
"def update\n if Input.repeat?(:DOWN)\n update_cursor_down\n elsif Input.repeat?(:UP)\n update_cursor_up\n elsif @my != Mouse.y || Mouse.wheel != 0\n update_mouse\n end\n super\n end",
"def ibooks_scroll_axis(val)\n @book.ibooks_scroll_axis = val\n end",
"def update\n super\n # Scroll\n if self.active\n scroll_max = [self.contents.width - (self.width - 32), 0].max\n if Input.press?(Input::Y)\n self.ox = [self.ox - (self.width - 32), 0].max\n elsif Input.press?(Input::Z)\n self.ox = [self.ox + (self.width - 32), scroll_max].min\n end\n end\n end",
"def show_y_axis\n false\n end",
"def scroll_y=(y)\n\t\tcheck_integer(y)\n\t\t@scroll_y = y\n\tend",
"def update_mouse_index\n delta = -Mouse.wheel\n update_mouse_delta_index(delta) unless @list_item.size == 1\n Mouse.wheel = 0\n return false\n end",
"def mouse_wheel_delta_x(delta)\n @driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args\n stall :mouse_wheel\n end",
"def mouseY()\n @view__.mouseY\n end",
"def reversedMouseY \n \"reversedMouseY\" \n end",
"def wheel_inputs; end",
"def set_y2_axis(params = {})\n @date_category = true if ptrue?(params[:date_axis])\n @y2_axis.merge_with_hash(params)\n end",
"def update\n super\n if self.active\n if !horizontal_scroll\n # Scroll vertically\n scroll_max = [self.contents.height - (self.height - 32), 0].max\n if Input.press?(Input::UP)\n self.oy = [self.oy - self.scroll_speed, 0].max\n elsif Input.press?(Input::DOWN)\n self.oy = [self.oy + self.scroll_speed, scroll_max].min\n elsif Input.repeat?(Input::L)\n self.oy = [self.oy - (self.height - 32), 0].max\n elsif Input.repeat?(Input::R)\n self.oy = [self.oy + (self.height - 32), scroll_max].min\n end\n else\n # Scroll horizontally\n scroll_max = [self.contents.width - (self.width - 32), 0].max\n if Input.press?(Input::LEFT)\n self.ox = [self.ox - self.scroll_speed, 0].max\n elsif Input.press?(Input::RIGHT)\n self.ox = [self.ox + self.scroll_speed, scroll_max].min\n elsif Input.repeat?(Input::L)\n self.ox = [self.ox - (self.width - 32), 0].max\n elsif Input.repeat?(Input::R)\n self.ox = [self.ox + (self.width - 32), scroll_max].min\n end\n end\n end\n end",
"def set_y_axis(params = {})\n @date_category = true if ptrue?(params[:date_axis])\n @y_axis.merge_with_hash(params)\n end",
"def mouse_up *args; end",
"def y=(value)\n @background.y = value\n @bar.y = value + @by\n end",
"def ylabel(label)\n @methods[:y_axis_label] = label\n end",
"def right_mouse_up()\n right_mouse_up_at :center, :center\n end",
"def set_mouse_speed pixels\r\n command 'setMouseSpeed', pixels\r\n end",
"def ctrlAutoScrollSpeed _args\n \"ctrlAutoScrollSpeed _args;\" \n end",
"def y=(value)\n super\n update_background\n end",
"def get_y_axis_labels\n 5\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def num_wheels\n\t\tNUM_WHEELS\n\tend",
"def update\n @prev_down = @down.clone\n @down = @next_down.clone\n @next_down.delete_if { |_, v| v.zero? }\n @dbl_click.clear\n\n if @click\n @click[:action].call\n @click = nil\n end\n\n @dbl_click_timer.each do |k, v|\n if v < G.double_click_delay\n @dbl_click_timer[k] += 1\n else\n @dbl_click_timer.delete(k)\n end\n end\n\n %i[left middle right].each do |key|\n if @down[key]\n @dbl_click[key] = true if @dbl_click_timer[key]\n @dbl_click_timer.delete(key)\n elsif @prev_down[key]\n @dbl_click_timer[key] = 0\n end\n end\n\n @x = G.window.mouse_x.round\n @y = G.window.mouse_y.round\n end",
"def adjust_y(obj)\n dist = Graphics.height/2 - obj.y\n return (@y * @zoom) + (dist * (@zoom - 1.0))\n end",
"def pmouseY()\n @view__.pmouseY\n end",
"def mouse_down()\n mouse_down_at :center, :center\n end",
"def y=(value)\n super\n update_cursor\n end",
"def scrollDown\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, h-20, 0, Qt::LEFT_BUTTON)\n end",
"def mouse_up()\n mouse_up_at :center, :center\n end",
"def setY(y)\n @y = y\n end",
"def yview_scroll(number, what)\n execute_only(:yview, :scroll, number, what)\n end",
"def vector_y max_value = 1\n max_value * Math.sin(self.to_radians)\n end",
"def ctrlSetAutoScrollSpeed _obj, _args\n \"_obj ctrlSetAutoScrollSpeed _args;\" \n end",
"def text_scroll_y(id, value = nil)\n Game_Screen.get.texts[id].scroll_speed_y = value if value\n Game_Screen.get.texts[id].scroll_speed_y\n end",
"def move_y(val)\n update(val, x)\n apply_pos\n end",
"def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end",
"def cursor_y\n return 2\n end",
"def adjust_y(y)\n if loop_vertical? and y < @display_y - @margin_y\n return y - @display_y + @map.height * 256\n else\n return y - @display_y\n end\n end",
"def set_custom_window_y(window)\n @opt_y -= window.height\n window.y = @opt_y\n end",
"def accelBackward\n @vel_y += @VELOCITY\n end",
"def update_scroll_down(last_real_y)\r\n # If character moves down and is positioned lower than the center\r\n # of the screen\r\n if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y\r\n # Scroll map down\r\n $game_map.scroll_down(@real_y - last_real_y)\r\n end\r\n end",
"def y=(y)\n super(y)\n @selectable_window.y = y+@header_height+8\n end",
"def mouse_x_update(val)\n $mouse_x += val\n sc_osc \"/n_set\", $synth_g, \"x\", $mouse_x\nend",
"def update_scroll_bar\n @scroll_bar.max_index = @last_index\n end",
"def update_two_player\n # if moving up\n if Input.press?(Input::SHIFT)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::CTRL)\n self.y += 4 unless self.ey >= 480\n end\n end",
"def draw_wheel(center, dist)\r\n \r\n draw_circle(center, $normVec, $axelRadius)\r\n draw_circle(center, $normVec, dist + $outerRadius)\r\n attachPoint = Geom::Point3d.new(center[0] + dist, center[1], center[2])\r\n UI.messagebox attachPoint\r\n draw_circle(attachPoint, $normVec, $axelRadius)\r\n\r\nend",
"def actual_y_position\n return adjust_y_to_zoom(@actual_y + set_adjust[1])\n end",
"def scroll_by(delta_x, delta_y, device: T.unsafe(nil)); end",
"def mouse_moved(x,y)\n\t\t[\n\t\t\t# @live_wrapper,\n\t\t\t@input_test,\n\t\t].each do |dynamic_obj|\n\t\t\tdynamic_obj.mouse_moved x,y\n\t\tend\n\tend",
"def axes\n end",
"def wheel_count\n 2\n end",
"def y=(y)\n @screen_y = y\n end",
"def mouse_released(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.notSupported('Use webdriver directly to perform a mouse_released event')\nend",
"def tick args\n tick_instructions args, \"Sample app shows how mouse events are registered and how to measure elapsed time.\"\n x = 460\n\n args.outputs.labels << small_label(args, x, 11, \"Mouse input: args.inputs.mouse\")\n\n if args.inputs.mouse.click\n args.state.last_mouse_click = args.inputs.mouse.click\n end\n\n if args.state.last_mouse_click\n click = args.state.last_mouse_click\n args.outputs.labels << small_label(args, x, 12, \"Mouse click happened at: #{click.created_at}\")\n args.outputs.labels << small_label(args, x, 13, \"Mouse clicked #{click.created_at_elapsed} ticks ago\")\n args.outputs.labels << small_label(args, x, 14, \"Mouse click location: #{click.point.x}, #{click.point.y}\")\n else\n args.outputs.labels << small_label(args, x, 12, \"Mouse click has not occurred yet.\")\n args.outputs.labels << small_label(args, x, 13, \"Please click mouse.\")\n end\nend",
"def mouse_out(mouse_event)\n end",
"def update\n super\n #==========================================================================\n # Here we check for action from the directional keys - scrolling between\n # pages and up/down within a page, if applicable. It also updates the\n # page number display at the bottom of the window.\n #==========================================================================\n process_cursor_move\n @scrolldata.each_value { |v| v.update } if @scrolldata\n end",
"def scroll_speed() 6 end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def point_y(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_point_y(@handle.ptr, index)\n result\n end",
"def y=(value)\n end",
"def y_with_direction(y, direction)\n return round_y(y + (direction == 2 ? 1 : direction == 8 ? -1 : 0))\n end",
"def draw_scroll\n y = @draw_y and @draw_y = contents_height / line_height\n super\n @draw_y = y\n end",
"def update_vel( dt )\n @vx = update_vel_axis( @vx, @ax, dt )\n @vy = update_vel_axis( @vy, @ay, dt )\n end",
"def screen_y\n return @sy - ((@index+1)*@speed_y)\n end",
"def add_wheel_input(name); end",
"def test_yaxis_api_example\n v = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, 10\n edge = edgearray[0]\n arccurve = edge.curve\n v = arccurve.yaxis\n end\n expected_yaxis = Geom::Vector3d.new 0,10,0\n assert_equal(expected_yaxis, v,\n 'Failed in test_yaxis' )\n end",
"def draw_y_labels\n stagger = y_label_font_size + 5\n if show_y_labels\n label_height = field_height\n\n count = 0\n y_offset = @graph_height + y_label_offset( label_height )\n y_offset += font_size/1.2 unless rotate_y_labels\n for label in get_y_labels\n y = y_offset - (label_height * count)\n x = rotate_y_labels ? 0 : -3\n\n if stagger_y_labels and count % 2 == 1\n x -= stagger\n @graph.add_element( \"path\", {\n \"d\" => \"M#{x} #{y} h#{stagger}\",\n \"class\" => \"staggerGuideLine\"\n })\n end\n\n text = @graph.add_element( \"text\", {\n \"x\" => x.to_s,\n \"y\" => y.to_s,\n \"class\" => \"yAxisLabels\"\n })\n text.text = label.to_s\n if rotate_y_labels\n text.attributes[\"transform\"] = \"translate( -#{font_size} 0 ) \"+\n \"rotate( 90 #{x} #{y} ) \"\n text.attributes[\"style\"] = \"text-anchor: middle\"\n else\n text.attributes[\"y\"] = (y - (y_label_font_size/2)).to_s\n text.attributes[\"style\"] = \"text-anchor: end\"\n end\n draw_y_guidelines( label_height, count ) if show_y_guidelines\n count += 1\n end\n end\n end",
"def update\n super\n # Process mouse operations if mouse is on screen and custom method implemented\n #if $mouse.on_screen? and @active_mod_on\n # if mouse_on_window?\n # Mouse.window_add(self)\n # end\n #end\n end",
"def update_vel_axis( v, a, dt )\n # Apply slowdown if not accelerating.\n if a == 0\n if v > 0\n v -= @slowdown * dt\n v = 0 if v < 0\n elsif v < 0\n v += @slowdown * dt\n v = 0 if v > 0\n end\n end\n # Apply acceleration\n v += a * dt\n # Clamp speed so it doesn't go too fast.\n v = @max_speed if v > @max_speed\n v = -@max_speed if v < -@max_speed\n return v\n end",
"def tick\n end",
"def y=(new_y)\n @y = new_y.to_f if new_y\n end",
"def pinch direction, magnification = 1, obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.pinch direction, magnification\n sleep wait\n end",
"def drag_y(object,limit_y=nil,limit_height=nil)\n return false if !defined?(object.y)\n if self.leftPress?(object)\n if @object_oy.nil?\n @object_oy = @y - object.y\n end\n object.y = @y - @object_oy\n object.y = limit_y if limit_y && object.ylimit_height\n else\n @object_oy=nil\n end\n end",
"def picture_scroll_y(ids, speed = nil)\n return pictures[ids].scroll_speed_y unless speed\n select_pictures(ids).each {|id| pictures[id].scroll_speed_y = speed}\n end",
"def mill_pump_wheel_lid(pCent_x, pCent_y)\r\n # # # # # # # # # # # # # #\r\n print \"(mill_pump_wheel_lid)\\n\" \r\n mill.retract()\r\n \r\n print \"(L995 - shaft_diam = \", shaft_diam, \")\\n\"\r\n \r\n mill_impeller_axel(pCent_x, pCent_y, mirrored=false, pBegZ=0, pEndZ=nil)\r\n \r\n \r\n # Coutout job with the last \r\n mill.retract()\r\n \r\n # TODO: change this over to cutout that leaves tabs\r\n spiral_down_circle(mill = mill, \r\n x = pCent_x,\r\n y = pCent_y, \r\n diam = cutout_diam, \r\n beg_z=0, \r\n end_z=drill_through_depth * 0.97, \r\n adjust_for_bit_radius=false, \r\n outside=true, \r\n auto_speed_adjust=false)\r\n \r\n mill.retract()\r\n mill.home() \r\n \r\n \r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def scrollUp\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, 20, 0, Qt::LEFT_BUTTON)\n end",
"def ui_max_y\n\t\t\t\tCurses.rows\n\t\t\tend",
"def mouseX; end",
"def y_offset; end",
"def test_verticalScrollSpeed\n w = Window_Scrollable.new(0,192,640,96, 2)\n w.contents = Bitmap.update_bitmap_size(w.contents, w.contents.width, 192)\n c = CLabel.new(w.contents, Rect.new(0, 0, w.contents.width, 24), MULTILINE_TEXT)\n c.multiline = true\n c.draw()\n @windows.push(w)\n return true\n end",
"def move_down\n if @value < @options\n @y += 50\n @value += 1\n end\n end",
"def mouse\n r = SDL::Mouse.state\n r[1] = h-r[1]\n r\n end",
"def scroll_down(distance)\n if loop_vertical?\n @display_y += distance\n @display_y %= @map.height * 256\n @parallax_y += distance\n else\n last_y = @display_y\n @display_y = [@display_y + distance, (height - 13) * 256].min\n @parallax_y += @display_y - last_y\n end\n end"
] | [
"0.6374681",
"0.61653805",
"0.61569786",
"0.61246145",
"0.6017624",
"0.59153116",
"0.58866054",
"0.5867629",
"0.5809054",
"0.5772996",
"0.57716495",
"0.5763039",
"0.5592902",
"0.5578934",
"0.5560531",
"0.55119735",
"0.55083764",
"0.54832613",
"0.54794395",
"0.5450281",
"0.5444875",
"0.53458583",
"0.5337261",
"0.5321193",
"0.527104",
"0.52662146",
"0.52634096",
"0.5195911",
"0.51142305",
"0.51096565",
"0.50645816",
"0.50587416",
"0.50405425",
"0.5039238",
"0.5029176",
"0.50212896",
"0.5012215",
"0.5001202",
"0.4997464",
"0.49899012",
"0.4988376",
"0.4982531",
"0.4926407",
"0.49260196",
"0.49152717",
"0.49144387",
"0.49105254",
"0.49041238",
"0.48956943",
"0.4893873",
"0.487998",
"0.48609027",
"0.48606125",
"0.48599756",
"0.4856145",
"0.485553",
"0.48430666",
"0.48385307",
"0.48358586",
"0.48291102",
"0.4821474",
"0.48207125",
"0.48065832",
"0.48059508",
"0.47893557",
"0.47868362",
"0.47613436",
"0.4758457",
"0.4737387",
"0.47372493",
"0.4732668",
"0.47325936",
"0.47052994",
"0.46950406",
"0.4692058",
"0.4688582",
"0.46862265",
"0.4683904",
"0.4683269",
"0.46826607",
"0.4682102",
"0.46744698",
"0.4666124",
"0.46659645",
"0.46653774",
"0.46503088",
"0.46488935",
"0.4645721",
"0.46389613",
"0.46370968",
"0.4636783",
"0.4636783",
"0.46288165",
"0.46239582",
"0.4618768",
"0.4604606",
"0.45988807",
"0.4591707",
"0.4589507",
"0.45860708"
] | 0.7782795 | 0 |
Used to perform a key down on this view in the remote application You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.key_down 'a' key down for printable character 'a' view.key_down :delete key down for function key delete view.key_down :meta_key key down for the meta key | def key_down(key)
focus
@driver.sc_key_down action_target, key, *action_locator_args
stall :key_down
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def down(key)\n key = normalize_keys(Array(key)).first\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: type, **key)\n self\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down_event _value\n send_cmd(\"key_down_event #{_value}\")\n end",
"def alt_key_down\r\n command 'altKeyDown'\r\n end",
"def button_down(key)\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def key_down key\n @keys.push key\n end",
"def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end",
"def scroll_down\n ESC + 'D'\n end",
"def activate_down(key)\n key_down.activate(key)\n key_held.deactivate(key)\n key_up.deactivate(key)\n end",
"def meta_key_down\r\n command 'metaKeyDown'\r\n end",
"def alt_key_up\r\n command 'altKeyUp'\r\n end",
"def shift_key_down\r\n command 'shiftKeyDown'\r\n end",
"def while_key_down *args\n\t\t\tevent(:while_key_down, *args)\n\t\tend",
"def up(key)\n description = key_description_for_string key\n\n @modifiers &= ~(modifier_bit description[:key])\n @_pressed_keys.delete description[:code]\n\n client.command(\n Protocol::Input.dispatch_key_event(\n type: 'keyUp',\n modifiers: modifiers,\n key: description[:key],\n windows_virtual_key_code: description[:key_code],\n code: description[:code],\n location: description[:location]\n )\n ).wait!\n end",
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def key_down?(key)\n @down.index(key)\n end",
"def keystroke(character, *special_keys)\n special_keys = [\"command\"] if special_keys.length == 0\n special_keys_as_applescript_array = special_keys.map { |k|\n \"#{k} down\"\n }.join(\", \")\n execute_applescript(%Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n keystroke \"#{character}\" using {#{special_keys_as_applescript_array}}\n end\n end tell\n ')\n end",
"def keys_down? *key_symbols\n key_symbols.each do |key_symbol|\n return false unless key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return true\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def control_key_up\r\n command 'controlKeyUp'\r\n end",
"def keyDown(the_event)\n\n\t\tcharacters = the_event.characters\n\n\t\tif characters.length > 0 then\n\t\t\tfirst_character = characters[0]\n\t\t\tcase first_character\n\t\t\twhen 'h'\t\t# toggle help\n\t\t\t\t@draw_help_flag\t= !@draw_help_flag\n\t\t\t\tsetNeedsDisplay true\n\n\t\t\twhen 'c'\t\t# toggle caps\n\t\t\t\t@draw_capacities_flag\t= !@draw_capacities_flag\n\t\t\t\tsetNeedsDisplay true\n\n\t\t\tend\n\t\tend\n\n\tend",
"def button_down(id)\n key = self.get_key(id)\n if key != nil\n @game.state.command(key)\n \n # allow repeated movement...checked by update below\n if key.direction != nil\n @last_move = key\n @last_move_time = Gosu::milliseconds\n end\n end\n end",
"def onKeyDown(key, repeat, flags, view)\r\n if key == VK_END # toggle zig direction\r\n toggle_direc_flag()\r\n end\r\n if key == VK_HOME # toggle use of flood fill\r\n @flood = !@flood\r\n if (@flood)\r\n @statusmsg = @statusmsgBase2 + \"FLOOD #{@stepover_percent}%\"\r\n else\r\n @statusmsg = @statusmsgBase + \"StepOver #{@stepover_percent}%\"\r\n end\r\n Sketchup::set_status_text(@statusmsg, SB_PROMPT)\r\n end\r\n\r\n if (key == VK_SHIFT)\r\n @keyflag = 1\r\n else\r\n if (key == VK_CONTROL)\r\n @keyflag = 2\r\n else\r\n super #process other keys for depth selection\r\n end\r\n end\r\n end",
"def dec(key)\n \n end",
"def button_down(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n\r\n # Check if the player sprite can jump\r\n if [1,3,4,5,6].include?(get_tile_info(@player.get_x,\r\n @player.get_y,:down)) then\r\n\r\n # Call the jump function\r\n @player.jump\r\n\r\n # Player still might have a chance to \"double\" jump\r\n elsif @player.get_fall < 5 then\r\n @player.jump\r\n end\r\n end\r\n end",
"def type(*keys)\n keys = normalize_keys(Array(keys))\n\n keys.each do |key|\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", type: type, **key)\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n end\n\n self\n end",
"def move_down(n); print \"\\e[#{n}B\" end",
"def any_key_down? *key_symbols\n key_symbols.each do |key_symbol|\n return true if key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return false\n end",
"def button_down; end",
"def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end",
"def pointer_down(button = T.unsafe(nil), device: T.unsafe(nil), **opts); end",
"def button_down(id)\n puts \"#{id}=>#{button_id_to_char(id)}\"\n end",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\nend",
"def deActivateKey _args\n \"deActivateKey _args;\" \n end",
"def decrby(key, decrement)\n send_command([:decrby, key, Integer(decrement)])\n end",
"def down(distance = 1)\n ConsoleGlitter.escape(\"#{distance}B\")\n end",
"def shift_key_up\r\n command 'shiftKeyUp'\r\n end",
"def onKeyDown(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY && repeat == 1 )\n @shift_down_time = Time.now\n \n # if we already have an inference lock, then unlock it\n if( view.inference_locked? )\n # calling lock_inference with no arguments actually unlocks\n view.lock_inference\n elsif( @state == 0 && @ip1.valid? )\n view.lock_inference @ip1\n elsif( @state == 1 && @ip2.valid? )\n view.lock_inference @ip2, @ip1\n end\n end\n end",
"def key_up(key)\n focus\n @driver.sc_key_up action_target, key, *action_locator_args\n stall :key_up\n end",
"def scroll_down(n); puts \"\\e[#{n}T\" end",
"def onKeyDown(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY && repeat == 1 )\n @shift_down_time = Time.now\n\n # if we already have an inference lock, then unlock it\n if( view.inference_locked? )\n # calling lock_inference with no arguments actually unlocks\n view.lock_inference\n elsif( @state == 0 && @ip1.valid? )\n view.lock_inference @ip1\n elsif( @state == 1 && @ip2.valid? )\n view.lock_inference @ip2, @ip1\n end\n end\n end",
"def long_press_keycode(key, metastate: [], flags: [])\n @bridge.long_press_keycode(key, metastate: metastate, flags: flags)\n end",
"def long_press_keycode(key, metastate: [], flags: [])\n @bridge.long_press_keycode(key, metastate: metastate, flags: flags)\n end",
"def down_key\n @last = @choice\n @choice = (@choice < 2 ? @choice += 1 : 0)\n @choice_sound.play(1, 0.5, false)\n end",
"def onKeyDown(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY && repeat == 1 )\n @shift_down_time = Time.now\n \n # if we already have an inference lock, then unlock it\n if( view.inference_locked? )\n # calling lock_inference with no arguments actually unlocks\n view.lock_inference\n elsif( @state == 0 && @ip1.valid? )\n view.lock_inference @ip1\n elsif( @state == 1 && @ip2.valid? )\n view.lock_inference @ip2, @ip1\n end\n end\nend",
"def down(spaces=1)\n \"\\e[#{spaces.to_i}B\"\n end",
"def getdel(key)\n send_command([:getdel, key])\n end",
"def down\n updown_command :detach\n end",
"def cursor_down(wrap = false)\n if row == row_max - 1\n deactivate\n @@last_command_symbol = current_symbol\n call_handler(:formation)\n else\n super\n end\n end",
"def button_down(id)\n case id\n when Gosu::KbEscape\n exit\n end\n end",
"def process_key(key)\n case KeyHelper.key_symbol(key)\n when :up\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu - 1) % @items.size\n when :down\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu + 1) % @items.size\n when :enter\n # Erase body after call\n @past_menu = nil\n term.echo\n return :break, @items[@cur_menu].menu\n end\n\n return if key[0] != Ncurses::OK\n @items.each_with_index do |item, i|\n next unless key[2] =~ item.shortcut_regex\n @past_menu = @cur_menu\n @cur_menu = i\n end\n end",
"def button_down(id); end",
"def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend",
"def key_release *args\n\t\t\tevent(:key_release, *args)\n\t\tend",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\n end",
"def button_down id\n end",
"def button_down(id)\n end",
"def cursor_down(wrap = false)\n Sound.play_cursor\n Input.update\n deactivate\n call_handler(:down)\n end",
"def scroll_down(distance = 1)\n ConsoleGlitter.escape(\"#{distance}T\")\n end",
"def button_down(id)\n super(id)\n unless @buttons_down.include?(id)\n @input_lag = INPUT_LAG\n @buttons_down << id\n end\n return unless PRINT_INPUT_KEY\n #print(\"Buttons currently held down: #{@buttons_down} T:#{@triggered}\\n\")\n print(\"Window button pressed: (#{id}) which is (#{self.get_input_symbol(id).to_s})\\n\")\n end",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\n end",
"def _rl_unget_char(key)\r\n if (ibuffer_space()!=0)\r\n @pop_index-=1\r\n if (@pop_index < 0)\r\n @pop_index = @ibuffer_len - 1\r\n end\r\n @ibuffer[@pop_index] = key\r\n return (1)\r\n end\r\n return (0)\r\n end",
"def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end",
"def key_converter(key)\n if Atoa::Keyboard_Type\n case key\n when A then return 'A'\n when B then return 'B'\n when C then return 'C'\n when X then return 'X'\n when Y then return 'Y'\n when Z then return 'Z'\n when L then return 'R'\n when R then return 'L'\n end\n else\n case key\n when A then return 'Z'\n when B then return 'X'\n when C then return 'C'\n when X then return 'D'\n when Y then return 'S'\n when Z then return 'A'\n when L then return 'Q'\n when R then return 'W'\n end\n end\n case key\n when UP then return '↑'\n when DOWN then return '↓'\n when LEFT then return '←'\n when RIGHT then return '→'\n end\n end",
"def onKeyDown(key, repeat, flags, view)\n #puts \"onKeyDown: #{key}, #{flags}\"\n return if repeat > 1\n self.set_flags flags\n \n case( key )\n when VK_LEFT\n @keys |= LEFT_ARROW\n when VK_RIGHT\n @keys |= RIGHT_ARROW\n when VK_UP\n @keys |= UP_ARROW\n when VK_DOWN\n @keys |= DOWN_ARROW\n when '+'[0]\n @@speed += 1.0\n when '-'[0]\n @@speed -= 1.0\n @@speed = 1.0 if @@speed < 1.0\n else\n return\n end\n @speedx = @@speed\n @speedy = @@speed\n \n # get the distance from the camera to what we are looking at to control the speed\n @distance_to_target = self.guess_target_distance view\n \n view.animation = self\n view.dynamic = 3\nend",
"def on_key(ch)\n end",
"def hotkey=(key)\n @link.HotKey = key\n end",
"def button_down(id)\n\t\t\n\t\t# Exit on escape\n\t\tif id == Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\t\t\n\t\t# Cursor Movement\n\t\t# NSEW = 0123\n\t\tif id == Gosu::KbUp\n\t\t\t@player.move(0)\n\t\tend\n\t\tif id == Gosu::KbDown\n\t\t\t@player.move(1)\n\t\tend\n\t\tif id == Gosu::KbRight\n\t\t\t@player.move(2)\n\t\tend\n\t\tif id == Gosu::KbLeft\n\t\t\t@player.move(3)\n\t\tend\n\t\t\n\t\t# Camera Movement\n\t\t# These should probably be farther from the load/save keys heh\n\t\tif id == Gosu::KbI\n\t\t\tif @zoom\n\t\t\t\t@camera_y -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbK\n\t\t\tif @zoom\n\t\t\t\t@camera_y += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbJ\n\t\t\tif @zoom\n\t\t\t\t@camera_x -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbL\n\t\t\tif @zoom\n\t\t\t\t@camera_x += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbM # Toggle lame, janky zoom\n\t\t\t@zoom = !@zoom\n\n\t\t\t# If we're turning zoom on, set the camera so it zooms\n\t\t\t# to the area the cursor is at, if we're turning zoom off\n\t\t\t# then just reset the camera to show the full editor field.\n\t\t\tif @zoom\n\t\t\t\t@camera_x = @player.x\n\t\t\t\t@camera_y = @player.y\n\t\t\telse\n\t\t\t\t@camera_x = 0\n\t\t\t\t@camera_y = 0\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t\t# Editor Functions\n\t\tif id == Gosu::KbQ # Scroll left through sprites\n\t\t\t@player.change(1)\n\t\tend\n\t\tif id == Gosu::KbW # Scroll right through sprites\n\t\t\t@player.change(2)\n\t\tend\n\t\tif id == Gosu::KbA # Place a tile as a world tile\n\t\t\t@player.place(1)\n\t\tend\n\t\tif id == Gosu::KbS # Place a tile as a prop, draw above world tiles\n\t\t\t@player.place(2)\n\t\tend\n\t\tif id == Gosu::KbD # Clear a tiles world/prop/collision info, setting it to nil\n\t\t\t@player.place(3)\n\t\tend\n\t\tif id == Gosu::KbZ # Mark a tile for collision, only drawn in the editor\n\t\t\t@player.place(4)\n\t\tend\n\t\tif id == Gosu::KbX # Turn on/off drawing of the red cross-circle that shows where colliders are\n\t\t\t@map.draw_colliders?\n\t\tend\n\t\t\n\t\t# Save / Load Functions (Still Experimental, but working)\n\t\t# Make sure that the file you're trying to load was made\n\t\t# by the same version of Tyle you're using now, else oddness.\n\t\tif id == Gosu::KbO and DEBUG\n\t\t\t@map.save(FILENAME)\n\t\tend\n\t\tif id == Gosu::KbP and DEBUG\n\t\t\t@map.load(FILENAME)\n\t\tend\n\t\t\n\tend",
"def on_down(x: nil, y: nil, position: nil)\n if on_grid?\n change_grid(x: x, y: y, color: @colors.down)\n else\n change_command(position: position, color: @colors.down)\n end\n end",
"def button_down(id)\n\t\t@controller.button_down(id) if @controller\n\tend",
"def getch\n map_key(key_press)\n end",
"def removeHotkey(key, modifiers)\n Env.removeHotkey key, modifiers\n end",
"def removeHotkey(key, modifiers)\n Env.removeHotkey key, modifiers\n end",
"def down(n = nil)\n CSI + \"#{(n || 1)}B\"\n end",
"def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend",
"def draw_key(key)\n x = Combo_Command_Position[key][0]\n y = Combo_Command_Position[key][1]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(key)]\n self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, y, 24, 32, Input.key_converter(key))\n end\n end",
"def hotkey\n @link.HotKey\n end",
"def down\n cursor.down\n\n refresh\n end",
"def button_down(id)\n fire :button_down, id\n end",
"def meta_key_up\r\n command 'metaKeyUp'\r\n end",
"def keyctrl_d(*)\n @stop = true\n end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def hide_keyboard(strategy = :tapOutside, key = nil)\n opts = {}\n opts[:strategy] = strategy if strategy\n opts[:key] = key if key\n\n bridge.hide_keyboard opts\n end",
"def button_down(id)\n if id == Gosu::KbQ\n close\n elsif id == Gosu::KbEscape\n if @state == :menu\n close\n elsif @state == :instructions\n @state = :menu\n else\n @state = :menu\n @paused = true\n end\n elsif id == Gosu::KbLeftAlt\n if @state == :game\n @player.toggle_pogo\n end\n elsif id == Gosu::KbLeftShift\n if @state == :game\n @player.sprint\n end\n elsif id == Gosu::KbSpace\n if @state == :game && !button_down?(Gosu::KbDown)\n @player.shoot(:sideways)\n elsif @state == :game && button_down?(Gosu::KbDown)\n @player.shoot(:down)\n end\n elsif id == Gosu::KbDown || id == Gosu::GpDown\n if @state == :menu\n @menu_selection += 1\n @menu_selection %= @menu_options.size\n end\n elsif id == Gosu::KbUp || id == Gosu::GpUp\n if @state == :menu\n @menu_selection += @menu_options.size - 1\n @menu_selection %= @menu_options.size\n elsif @state == :game\n @player.leave\n end\n elsif id == Gosu::KbReturn\n if @state == :menu\n if @menu_options[@menu_selection] == :Play || @menu_options[@menu_selection] == :Resume\n @menu_options[@menu_selection] = :Resume\n @state = :game\n @paused = true\n elsif @menu_options[@menu_selection] == :Instructions\n @state = :instructions\n elsif @menu_options[@menu_selection] == :Quit\n close\n end\n end\n end\n end",
"def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def activate_up(key)\n key_down.deactivate(key)\n key_held.deactivate(key)\n key_up.activate(key)\n end",
"def ls_down\n end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end",
"def invoke_drop(key); end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def onCmdReverse(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip\n @watcher.cmdReverse\n end",
"def key_press(*args)\n options = Hash === args.last ? args.pop : {}\n keys = args\n raise ArgumentError, 'Must have at least one key argument' if keys.empty?\n begin\n key_down keys.first\n if keys.length == 1\n yield if block_given?\n else\n key_press(*(keys[1..-1] + [options]))\n end\n ensure\n key_up keys.first\n end\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end"
] | [
"0.81894314",
"0.77000344",
"0.77000344",
"0.71842504",
"0.6992742",
"0.69250065",
"0.6849509",
"0.6667458",
"0.6621216",
"0.6574964",
"0.65252584",
"0.65185386",
"0.64259654",
"0.6388991",
"0.63725513",
"0.63124335",
"0.63088435",
"0.62571913",
"0.6159989",
"0.61031437",
"0.6053208",
"0.6053208",
"0.5969063",
"0.585852",
"0.57889557",
"0.5784489",
"0.57546544",
"0.57364434",
"0.5694239",
"0.56743616",
"0.56737065",
"0.56259406",
"0.55828094",
"0.5561234",
"0.5521374",
"0.5514878",
"0.55011183",
"0.5494451",
"0.54905933",
"0.5488425",
"0.54802895",
"0.5472995",
"0.5457435",
"0.5449894",
"0.5420479",
"0.5420479",
"0.5420316",
"0.5417453",
"0.54120773",
"0.5385921",
"0.538496",
"0.538258",
"0.5369516",
"0.5363247",
"0.5363022",
"0.5349318",
"0.5346963",
"0.5336649",
"0.53306454",
"0.5329425",
"0.5325612",
"0.53251094",
"0.53203756",
"0.5293999",
"0.52791613",
"0.52746165",
"0.5271126",
"0.52692527",
"0.526752",
"0.52450037",
"0.5242197",
"0.52328545",
"0.52300066",
"0.52261746",
"0.5224001",
"0.5224001",
"0.5223892",
"0.52236336",
"0.5221046",
"0.52167666",
"0.52157646",
"0.52139044",
"0.5205242",
"0.5195879",
"0.5193955",
"0.5191914",
"0.51679623",
"0.51648813",
"0.51647913",
"0.51647913",
"0.5160055",
"0.51523906",
"0.514801",
"0.5147191",
"0.5143739",
"0.51434654",
"0.51319957",
"0.5128447",
"0.5120269",
"0.5120269"
] | 0.77849996 | 1 |
Used to perform a key up on this view in the remote application You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.key_up 'a' key up for printable character 'a' view.key_up :delete key up for function key delete view.key_up :meta_key key up for the meta key | def key_up(key)
focus
@driver.sc_key_up action_target, key, *action_locator_args
stall :key_up
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def up(key)\n description = key_description_for_string key\n\n @modifiers &= ~(modifier_bit description[:key])\n @_pressed_keys.delete description[:code]\n\n client.command(\n Protocol::Input.dispatch_key_event(\n type: 'keyUp',\n modifiers: modifiers,\n key: description[:key],\n windows_virtual_key_code: description[:key_code],\n code: description[:code],\n location: description[:location]\n )\n ).wait!\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def control_key_up\r\n command 'controlKeyUp'\r\n end",
"def alt_key_up\r\n command 'altKeyUp'\r\n end",
"def meta_key_up\r\n command 'metaKeyUp'\r\n end",
"def shift_key_up\r\n command 'shiftKeyUp'\r\n end",
"def activate_up(key)\n key_down.deactivate(key)\n key_held.deactivate(key)\n key_up.activate(key)\n end",
"def key_up(*args, device: T.unsafe(nil)); end",
"def type(*keys)\n keys = normalize_keys(Array(keys))\n\n keys.each do |key|\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", type: type, **key)\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n end\n\n self\n end",
"def key_down key\n @keys.push key\n end",
"def on_key(ch)\n end",
"def input_key(key)\n @driver.action.send_keys(key).perform\n end",
"def send_key(*args); end",
"def while_key_up *args\n\t\t\tevent(:while_key_up, *args)\n\t\tend",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def keyUp(event)\n row = @autoCompleteTableView.selectedRow\n isShow = @autoCompletePopover.isShown\n\n #p \"wufield\"+ event.keyCode.to_s\n\n case event.keyCode\n when 125 #down\n if isShow\n @autoCompleteTableView.selectRowIndexes(NSIndexSet.indexSetWithIndex((row + 1)), byExtendingSelection: false)\n @autoCompleteTableView.scrollRowToVisible(@autoCompleteTableView.selectedRow)\n insert(self)\n return #skip default behavior\n end\n\n when 126 #up\n if isShow\n @autoCompleteTableView.selectRowIndexes(NSIndexSet.indexSetWithIndex((row - 1)), byExtendingSelection: false)\n @autoCompleteTableView.scrollRowToVisible(@autoCompleteTableView.selectedRow)\n insert(self)\n return #skip default behavior\n end\n when 36, 48, 51, 49 # return, tab, space\n if @myDelegate.respondsToSelector(\"didClickedCloseKey\")\n @myDelegate.didClickedCloseKey\n end\n\n self.autoCompletePopover.close()\n\n return #//skip default behavior\n else\n end\n\n super(event)\n complete(self)\n end",
"def down(key)\n key = normalize_keys(Array(key)).first\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: type, **key)\n self\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def button_down(key)\n end",
"def on_keyup(key, view)\n return unless key == CONSTRAIN_MODIFIER_KEY\n return if @axis_lock\n\n # Calling this method with no argument unlocks inference.\n view.lock_inference\n end",
"def key_down(key)\n focus\n @driver.sc_key_down action_target, key, *action_locator_args\n stall :key_down\n end",
"def press(key_sequence)\n end",
"def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\nend",
"def press_any_key\n # TODO: Print footer.\n get_wch\n end",
"def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end",
"def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end",
"def send_keycode(keycode)\n send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::DOWN))\n send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::UP))\n end",
"def keypress(key)\n puts \"Got key: #{key} (#{key.class})\"\n if key.is_a?(String)\n if key.length == 1\n # Assume letter\n @vnc.keyevent(key.chr, true)\n @vnc.keyevent(key.chr, false)\n else\n # Assume keysym\n puts \"I don't know how to type '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end\n else\n # type printables, key others.\n if 32.upto(127).include?(key)\n @vnc.keyevent(key, true)\n @vnc.keyevent(key, false)\n else\n case key\n when 8 \n @vnc.keyevent(0xff08, true)\n @vnc.keyevent(0xff08, false)\n when 13\n @vnc.keyevent(0xff0D, true)\n @vnc.keyevent(0xff0D, false)\n else\n puts \"I don't know how to type web keycode '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end # case key\n end # if 32.upto(127).include?(key)\n end # if key.is_a?String\n return nil\n end",
"def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end",
"def meta_key_down\r\n command 'metaKeyDown'\r\n end",
"def hkeys(key)\n send_command([:hkeys, key])\n end",
"def keypress_on(element, key)\r\n element.native.send_key(key)\r\n end",
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\n end",
"def onKeyUp(key, repeat, flags, view)\n if( key == CONSTRAIN_MODIFIER_KEY &&\n view.inference_locked? &&\n (Time.now - @shift_down_time) > 0.5 )\n view.lock_inference\n end\n end",
"def send_keys(*args); end",
"def keypress(key = nil, name = nil)\n Vedeu.trigger(:key, key)\n\n return false unless key\n\n new(key, name).keypress\n end",
"def onKeyDown(key, repeat, flags, view)\r\n if key == VK_END # toggle zig direction\r\n toggle_direc_flag()\r\n end\r\n if key == VK_HOME # toggle use of flood fill\r\n @flood = !@flood\r\n if (@flood)\r\n @statusmsg = @statusmsgBase2 + \"FLOOD #{@stepover_percent}%\"\r\n else\r\n @statusmsg = @statusmsgBase + \"StepOver #{@stepover_percent}%\"\r\n end\r\n Sketchup::set_status_text(@statusmsg, SB_PROMPT)\r\n end\r\n\r\n if (key == VK_SHIFT)\r\n @keyflag = 1\r\n else\r\n if (key == VK_CONTROL)\r\n @keyflag = 2\r\n else\r\n super #process other keys for depth selection\r\n end\r\n end\r\n end",
"def key_press *args\n\t\t\tevent(:key_press, *args)\n\t\tend",
"def process_key(key)\n case KeyHelper.key_symbol(key)\n when :up\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu - 1) % @items.size\n when :down\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu + 1) % @items.size\n when :enter\n # Erase body after call\n @past_menu = nil\n term.echo\n return :break, @items[@cur_menu].menu\n end\n\n return if key[0] != Ncurses::OK\n @items.each_with_index do |item, i|\n next unless key[2] =~ item.shortcut_regex\n @past_menu = @cur_menu\n @cur_menu = i\n end\n end",
"def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ RubyCurses::META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end",
"def alt_key_down\r\n command 'altKeyDown'\r\n end",
"def press key, options = {}\n key = 'Return' if key == 'ENTER'\n widget = options[:in] || Gtk::Window.toplevels.first\n event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)\n event.window = widget\n event.state |= Gdk::Window::CONTROL_MASK if key =~ /CTRL+/\n event.state |= Gdk::Window::MOD1_MASK if key =~ /ALT+/\n event.state |= Gdk::Window::SHIFT_MASK if key =~ /SHIFT+/\n event.keyval = Gdk::Keyval.from_name(key.split('+').last)\n widget.grab_focus\n event.send_event = true\n entry = Gdk::Keymap.default.get_entries_for_keyval(event.keyval).first\n event.hardware_keycode = entry[0]\n widget.signal_emit('key_press_event', event)\n process_events\nend",
"def scroll_up\n ESC + 'M'\n end",
"def hotkey=(key)\n @link.HotKey = key\n end",
"def handle_key(key); end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend",
"def keystroke(character, *special_keys)\n special_keys = [\"command\"] if special_keys.length == 0\n special_keys_as_applescript_array = special_keys.map { |k|\n \"#{k} down\"\n }.join(\", \")\n execute_applescript(%Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n keystroke \"#{character}\" using {#{special_keys_as_applescript_array}}\n end\n end tell\n ')\n end",
"def handle_key key\n key\n end",
"def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end",
"def key_converter(key)\n if Atoa::Keyboard_Type\n case key\n when A then return 'A'\n when B then return 'B'\n when C then return 'C'\n when X then return 'X'\n when Y then return 'Y'\n when Z then return 'Z'\n when L then return 'R'\n when R then return 'L'\n end\n else\n case key\n when A then return 'Z'\n when B then return 'X'\n when C then return 'C'\n when X then return 'D'\n when Y then return 'S'\n when Z then return 'A'\n when L then return 'Q'\n when R then return 'W'\n end\n end\n case key\n when UP then return '↑'\n when DOWN then return '↓'\n when LEFT then return '←'\n when RIGHT then return '→'\n end\n end",
"def handle_control_character(search, key)\n case key\n\n when KEY_CTRL_N then search.down\n when KEY_CTRL_P then search.up\n\n when KEY_CTRL_U then search.clear_query\n when KEY_CTRL_W then search.delete_word\n when KEY_CTRL_H, KEY_DELETE then search.backspace\n\n when ?\\r, KEY_CTRL_J, KEY_CTRL_M then search.done\n\n when KEY_CTRL_C then raise Abort\n\n else search\n end\n end",
"def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case @arrow_key_policy \n when :ignore\n if ch == KEY_DOWN or ch == KEY_UP\n return :UNHANDLED\n end\n when :popup\n if ch == KEY_DOWN or ch == KEY_UP\n popup\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end",
"def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end",
"def keyevent(key, metastate = nil)\n @bridge.keyevent(key, metastate)\n end",
"def handle(key)\n case key\n when :left, :right, :space, :one, :two, :three, :four, :five, :six, :seven, :eight, :nine\n @player_controller.events.trigger(:key, key)\n when :down, :up, :enter, :u, :f, :s, :j, :k, :m, :h, :o\n @track_controller.events.trigger(:key, key)\n end\n end",
"def show_single_key\n system(\"clear\")\n board.render\n\n c = read_char\n\n case c\n when \"\\e[A\"\n # puts \"UP ARROW\"\n board.selected_pos[0] -= 1 unless board.selected_pos[0] < 1\n when \"\\e[B\"\n board.selected_pos[0] += 1 unless board.selected_pos[0] > 7\n # puts \"DOWN ARROW\"\n when \"\\e[C\"\n board.selected_pos[1] += 1 unless board.selected_pos[1] > 7\n # puts \"RIGHT ARROW\"\n when \"\\e[D\"\n board.selected_pos[1] -= 1 unless board.selected_pos[1] < 1\n # puts \"LEFT ARROW\"\n when \"r\"\n make_move(board.selected_pos,\"r\")\n when \"f\"\n make_move(board.selected_pos,\"f\")\n when \"s\"\n save?\n end\n end",
"def send_modified_key(element_selector, key, *meta)\n wait_for_loading\n \n key_string = key\n key_string = \"alt+\" + key_string if meta.include? :alt\n key_string = \"ctrl+\" + key_string if meta.include? :control\n key_string = \"command+\" + key_string if meta.include? :command\n\n page.driver.execute_script(\"Mousetrap.trigger('#{key_string}');\")\n end",
"def key_pressed( event )\n @keys += [event.key]\n end",
"def getch\n map_key(key_press)\n end",
"def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end",
"def handle(key)\n case key\n when :left, :right, :space, :s\n @player_controller.events.trigger(:key, key)\n when :down, :up, :enter, :u\n @track_controller.events.trigger(:key, key)\n end\n end",
"def onKeyDown(key, repeat, flags, view)\n #puts \"onKeyDown: #{key}, #{flags}\"\n return if repeat > 1\n self.set_flags flags\n \n case( key )\n when VK_LEFT\n @keys |= LEFT_ARROW\n when VK_RIGHT\n @keys |= RIGHT_ARROW\n when VK_UP\n @keys |= UP_ARROW\n when VK_DOWN\n @keys |= DOWN_ARROW\n when '+'[0]\n @@speed += 1.0\n when '-'[0]\n @@speed -= 1.0\n @@speed = 1.0 if @@speed < 1.0\n else\n return\n end\n @speedx = @@speed\n @speedy = @@speed\n \n # get the distance from the camera to what we are looking at to control the speed\n @distance_to_target = self.guess_target_distance view\n \n view.animation = self\n view.dynamic = 3\nend",
"def keypress\n key = input\n\n @keypress ||= Vedeu::Input::Translator.translate(key)\n end",
"def handle_key ch\n super\n end",
"def onLButtonUp(flags, x, y, view)\n end",
"def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end",
"def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end",
"def hotkey\n @link.HotKey\n end",
"def send_key(keycode, ctrl=false, alt=false, shift=false)\n matchingshortcuts = @shortcuts.select { |shortcut|\n shortcut.keycode == keycode && shortcut.ctrl == ctrl &&\n shortcut.alt == alt && shortcut.shift == shift\n }\n counter = 0\n matchingshortcuts.each { |shortcut|\n action = shortcut.action\n @actions[action].each { |handler|\n handler.call(shortcut)\n counter+=1\n }\n }\n counter\n end",
"def ctrl_w() send_keys(:ctrl_w) end",
"def activate_down(key)\n key_down.activate(key)\n key_held.deactivate(key)\n key_up.deactivate(key)\n end",
"def keypress\n begin\n _call = direction\n if _call.present?\n _call.keypress(params) if defined?(_call.keypress)\n end\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n render :plain => '', content_type: \"text/html\", :status => 200\n end",
"def activateKey _args\n \"activateKey _args;\" \n end",
"def resolve_key key\n clear_message\n\n # hint mode, pick file based on shortcut\n return select_hint(@viewport, key) if key.match?(/^[a-pr-zZ]$/)\n\n if '0123456789'.include?(key)\n resolve_numeric_key(key)\n elsif key == 'BACKSPACE'\n @patt = @patt[0..-2] if @patt && !@patt.empty?\n @message = @patt = nil if @patt == ''\n @title = nil unless @patt\n else\n resolve_binding key\n end\n true\nend",
"def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend",
"def shift_key_down\r\n command 'shiftKeyDown'\r\n end",
"def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end",
"def draw_key(key)\n x = Combo_Command_Position[key][0]\n y = Combo_Command_Position[key][1]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(key)]\n self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, y, 24, 32, Input.key_converter(key))\n end\n end",
"def getch\n\n end",
"def type_key(key)\n focus\n @driver.sc_type_key action_target, key, *action_locator_args\n stall :type_key\n end",
"def key_down_event _value\n send_cmd(\"key_down_event #{_value}\")\n end",
"def keyboard_send_keyevent(keyevent)\r\n adb_exec(\"shell input keyevent #{keyevent}\")\r\nend",
"def getup\n send_command 0x23, 0x2\n end",
"def method_missing(sym, *args, &block)\n super if !args.empty? or block\n cmds = sym.to_s.split(\"_\")\n callsequence = \"\"\n cmds.each do |cmd|\n callsequence << case cmd.downcase\n when \"ctrl\" then \"^\"\n when \"shift\" then \"+\"\n when \"alt\" then \"!\"\n when \"win\" then \"#\"\n when \"enter\" then \"{ENTER}\"\n when \"return\" then \"{ENTER}\"\n when \"del\" then \"{DEL}\"\n else\n cmd\n end\n end\n send_keys(callsequence)\n end",
"def keypress\n Vedeu::Input::Translator.translate(input)\n end",
"def mouse_up *args; end",
"def update\n\t\tupdate_keypress\n\tend",
"def send_keys(*key)\n @bridge.send_keys_to_active_element(key)\n end",
"def keypress &block\n @keyblock = block\n end",
"def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end",
"def onRButtonUp(flags, x, y, view)\n end",
"def rl_bind_key(key, function)\r\n @_rl_keymap[rl_translate_keyseq(key)] = function\r\n @rl_binding_keymap = @_rl_keymap\r\n 0\r\n end"
] | [
"0.80277866",
"0.7596856",
"0.7575435",
"0.7575435",
"0.7025894",
"0.6904381",
"0.6534596",
"0.6478036",
"0.6455483",
"0.6391917",
"0.63572425",
"0.6198706",
"0.6142492",
"0.613259",
"0.61030865",
"0.60262626",
"0.6021781",
"0.6021781",
"0.60146433",
"0.60125947",
"0.59947884",
"0.5974658",
"0.5909083",
"0.5887513",
"0.5876804",
"0.58474326",
"0.58298326",
"0.58055794",
"0.580199",
"0.580199",
"0.57977575",
"0.57947475",
"0.5793783",
"0.5791633",
"0.5791633",
"0.5769519",
"0.5751877",
"0.57468843",
"0.57436234",
"0.57161003",
"0.5699505",
"0.56975174",
"0.56938714",
"0.56929374",
"0.56892693",
"0.5684547",
"0.5679244",
"0.5648988",
"0.56460077",
"0.56401104",
"0.56304204",
"0.56156677",
"0.5608868",
"0.55993766",
"0.55973756",
"0.5582469",
"0.55766565",
"0.5556139",
"0.55250806",
"0.5517401",
"0.55123657",
"0.5510598",
"0.5500534",
"0.54684883",
"0.54684395",
"0.54551405",
"0.54529315",
"0.5436153",
"0.54277486",
"0.5417766",
"0.5416737",
"0.5398134",
"0.53964996",
"0.53927267",
"0.53864235",
"0.5380231",
"0.53675276",
"0.535931",
"0.53519195",
"0.5349453",
"0.53491074",
"0.5347269",
"0.5337448",
"0.53278077",
"0.53276926",
"0.5320313",
"0.5314473",
"0.5306818",
"0.5306728",
"0.52973145",
"0.52963066",
"0.52947515",
"0.52919",
"0.52681017",
"0.5266875",
"0.5255784",
"0.5228394",
"0.5226226",
"0.522486",
"0.52146786"
] | 0.75465304 | 4 |
Used to type a key on this view in the remote application. This will cause a key down followed by a key up You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corresponding symbol. Example: view.type_key 'a' type printable character 'a' view.type_key :delete type function key delete | def type_key(key)
focus
@driver.sc_type_key action_target, key, *action_locator_args
stall :type_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(key)\n send_command([:type, key])\n end",
"def type(key)\n call_command(['type', key])\n end",
"def type(key)\n call_command(['type', key])\n end",
"def type(*keys)\n keys = normalize_keys(Array(keys))\n\n keys.each do |key|\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", type: type, **key)\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n end\n\n self\n end",
"def keypress(key)\n puts \"Got key: #{key} (#{key.class})\"\n if key.is_a?(String)\n if key.length == 1\n # Assume letter\n @vnc.keyevent(key.chr, true)\n @vnc.keyevent(key.chr, false)\n else\n # Assume keysym\n puts \"I don't know how to type '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end\n else\n # type printables, key others.\n if 32.upto(127).include?(key)\n @vnc.keyevent(key, true)\n @vnc.keyevent(key, false)\n else\n case key\n when 8 \n @vnc.keyevent(0xff08, true)\n @vnc.keyevent(0xff08, false)\n when 13\n @vnc.keyevent(0xff0D, true)\n @vnc.keyevent(0xff0D, false)\n else\n puts \"I don't know how to type web keycode '#{key}'\"\n return { :action => \"status\", :status => \"I don't know how to type '#{key}'\" }\n end # case key\n end # if 32.upto(127).include?(key)\n end # if key.is_a?String\n return nil\n end",
"def type(key, &blk)\n call_command(['type', key], &blk)\n end",
"def type_keys locator, value\r\n command 'typeKeys', locator, value\r\n end",
"def type(key)\n method_missing(:type, key)\n end",
"def type(key); end",
"def type(key); end",
"def type(key)\n call(key, [:type, key], read: true)\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end",
"def type(key)\n call_with_namespace(:type, key)\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def send_key(*args); end",
"def handle_key(key); end",
"def handle_key key\n key\n end",
"def input_key(key)\n @driver.action.send_keys(key).perform\n end",
"def dispatch_key_event(type:, modifiers: nil, timestamp: nil, text: nil, unmodified_text: nil, key_identifier: nil, code: nil, key: nil, windows_virtual_key_code: nil, native_virtual_key_code: nil, auto_repeat: nil, is_keypad: nil, is_system_key: nil, location: nil)\n {\n method: \"Input.dispatchKeyEvent\",\n params: { type: type, modifiers: modifiers, timestamp: timestamp, text: text, unmodifiedText: unmodified_text, keyIdentifier: key_identifier, code: code, key: key, windowsVirtualKeyCode: windows_virtual_key_code, nativeVirtualKeyCode: native_virtual_key_code, autoRepeat: auto_repeat, isKeypad: is_keypad, isSystemKey: is_system_key, location: location }.compact\n }\n end",
"def key_type\r\n\t\treturn \" \" if repeat?(:SPACE)\r\n\t\tfor key in LETTERS\r\n\t\t\tnext unless repeat?(key)\r\n\t\t\treturn upcase? ? key.to_s[3].upcase : key.to_s[3].downcase\r\n\t\tend\r\n\t\tfor key in NUMBERS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\tfor key in NUMPADS\r\n\t\t\treturn key.to_s[3] if repeat?(key)\r\n\t\tend\r\n\t\t\r\n\t\treturn \"\"\r\n\tend",
"def control_key_up\r\n command 'controlKeyUp'\r\n end",
"def draw_key_command(key, index)\n rect = item_rect_for_text(index)\n change_color(normal_color)\n draw_text(rect.x, rect.y, rect.width/2, line_height, Vocab.command_name(key))\n if $game_system.xinput_key_set[key]\n change_color(crisis_color)\n draw_text(rect.width/2, rect.y, rect.width/2, line_height, Vocab.gamepad_key($game_system.xinput_key_set[key]), 1)\n else\n change_color(knockout_color)\n draw_text(rect.width/2, rect.y, rect.width/2, line_height, ControllerSettings::NO_KEY_SET, 1)\n end\n end",
"def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end",
"def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def alt_key_up\r\n command 'altKeyUp'\r\n end",
"def draw_key(key)\n x = Combo_Command_Position[key][0]\n y = Combo_Command_Position[key][1]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(key)]\n self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, y, 24, 32, Input.key_converter(key))\n end\n end",
"def key_down key\n @keys.push key\n end",
"def on_key(ch)\n end",
"def key type\n make_key get_class(type)\n end",
"def type(w_id = nil)\n XDo::Keyboard.type(to_xdo, w_id)\n end",
"def keypress(key = nil, name = nil)\n Vedeu.trigger(:key, key)\n\n return false unless key\n\n new(key, name).keypress\n end",
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def key_converter(key)\n if Atoa::Keyboard_Type\n case key\n when A then return 'A'\n when B then return 'B'\n when C then return 'C'\n when X then return 'X'\n when Y then return 'Y'\n when Z then return 'Z'\n when L then return 'R'\n when R then return 'L'\n end\n else\n case key\n when A then return 'Z'\n when B then return 'X'\n when C then return 'C'\n when X then return 'D'\n when Y then return 'S'\n when Z then return 'A'\n when L then return 'Q'\n when R then return 'W'\n end\n end\n case key\n when UP then return '↑'\n when DOWN then return '↓'\n when LEFT then return '←'\n when RIGHT then return '→'\n end\n end",
"def up(key)\n description = key_description_for_string key\n\n @modifiers &= ~(modifier_bit description[:key])\n @_pressed_keys.delete description[:code]\n\n client.command(\n Protocol::Input.dispatch_key_event(\n type: 'keyUp',\n modifiers: modifiers,\n key: description[:key],\n windows_virtual_key_code: description[:key_code],\n code: description[:code],\n location: description[:location]\n )\n ).wait!\n end",
"def down(key)\n key = normalize_keys(Array(key)).first\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: type, **key)\n self\n end",
"def key\n \"#{@type}{#{@title}}]\"\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def hkeys(key)\n send_command([:hkeys, key])\n end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend",
"def on_key_typed(key)\n case key\n when GLFW_KEY_R\n puts 'Reset camera zoom and rotation'\n set_default_camera_zoom_and_rotation\n when GLFW_KEY_Q\n puts 'Quitting...'\n exit\n end\n end",
"def key=(new_key)\n @key = new_key\n end",
"def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend",
"def type?(key)\n timeout_retry(3, 3){\n write \"TYPE #{key}\\r\\n\"\n single_line_reply\n }\n end",
"def type(key)\n node_for(key).type(key)\n end",
"def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end",
"def draw_key(index, key)\n x = index * @actor.battler_combo[key][2]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(key)]\n self.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x + 8, 0, 24, 32, Input.key_converter(key))\n end\n end",
"def send_key(keycode, ctrl=false, alt=false, shift=false)\n matchingshortcuts = @shortcuts.select { |shortcut|\n shortcut.keycode == keycode && shortcut.ctrl == ctrl &&\n shortcut.alt == alt && shortcut.shift == shift\n }\n counter = 0\n matchingshortcuts.each { |shortcut|\n action = shortcut.action\n @actions[action].each { |handler|\n handler.call(shortcut)\n counter+=1\n }\n }\n counter\n end",
"def keypress\n begin\n _call = direction\n if _call.present?\n _call.keypress(params) if defined?(_call.keypress)\n end\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n render :plain => '', content_type: \"text/html\", :status => 200\n end",
"def keypress_on(element, key)\r\n element.native.send_key(key)\r\n end",
"def key_entry(key_string, key_type, comment, login)\n shell = @container.container_plugin.gear_shell || \"/bin/bash\"\n prefix = login ? \"OPENSHIFT_LOGIN=#{Shellwords.escape login} \" : \"\"\n command = \"command=\\\"#{prefix}#{shell}\\\",no-X11-forwarding\"\n [command, key_type, key_string, key_id(comment)].join(' ')\n end",
"def key_up(*args, device: T.unsafe(nil)); end",
"def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end",
"def draw_key(index, skill, key, input)\n x = (4 + index % 2 * (288 + 32)) + (width / (2 * @column_max)) - (Combo_Skill[skill][0].size * Base_Cost / 2) - 16 + key * @actor.battler_combo[input][2]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(input)]\n self.contents.blt(x, (index / 2 * 52) + 32, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, (index / 2 * 52) + 28, 24, 32, Input.key_converter(input))\n end\n end",
"def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end",
"def key_method method\n @key_method = method\n validates_presence_of method\n validates_length_of method, minimum: 1\n define_method(:key) { prepare_key(self.send method) }\n end",
"def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end",
"def key_up(key)\n focus\n @driver.sc_key_up action_target, key, *action_locator_args\n stall :key_up\n end",
"def long_press_keycode(key, metastate: [], flags: [])\n @bridge.long_press_keycode(key, metastate: metastate, flags: flags)\n end",
"def long_press_keycode(key, metastate: [], flags: [])\n @bridge.long_press_keycode(key, metastate: metastate, flags: flags)\n end",
"def keystroke(character, *special_keys)\n special_keys = [\"command\"] if special_keys.length == 0\n special_keys_as_applescript_array = special_keys.map { |k|\n \"#{k} down\"\n }.join(\", \")\n execute_applescript(%Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n keystroke \"#{character}\" using {#{special_keys_as_applescript_array}}\n end\n end tell\n ')\n end",
"def write_key(*key); end",
"def press key, options = {}\n key = 'Return' if key == 'ENTER'\n widget = options[:in] || Gtk::Window.toplevels.first\n event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)\n event.window = widget\n event.state |= Gdk::Window::CONTROL_MASK if key =~ /CTRL+/\n event.state |= Gdk::Window::MOD1_MASK if key =~ /ALT+/\n event.state |= Gdk::Window::SHIFT_MASK if key =~ /SHIFT+/\n event.keyval = Gdk::Keyval.from_name(key.split('+').last)\n widget.grab_focus\n event.send_event = true\n entry = Gdk::Keymap.default.get_entries_for_keyval(event.keyval).first\n event.hardware_keycode = entry[0]\n widget.signal_emit('key_press_event', event)\n process_events\nend",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts \"RETURN\"\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n when \"\\e[A\"\n puts \"UP ARROW\"\n when \"\\e[B\"\n puts \"DOWN ARROW\"\n when \"\\e[C\"\n puts \"RIGHT ARROW\"\n when \"\\e[D\"\n puts \"LEFT ARROW\"\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when /^.$/\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n end",
"def type_string text, options={}\n shift_key_down = nil\n\n text.each_char do |char|\n key_to_press = KEY_PRESS_CHARS[char]\n unless key_to_press.nil?\n key_press key_to_press\n else\n key_needs_shift = SHIFTED_CHARS.include? char\n\n if shift_key_down.nil? || shift_key_down != key_needs_shift\n if key_needs_shift\n key_down :shift\n else\n key_up :shift\n end\n end\n\n type char\n shift_key_down = key_needs_shift\n end\n end\n wait options\n end",
"def resolve_key key\n clear_message\n\n # hint mode, pick file based on shortcut\n return select_hint(@viewport, key) if key.match?(/^[a-pr-zZ]$/)\n\n if '0123456789'.include?(key)\n resolve_numeric_key(key)\n elsif key == 'BACKSPACE'\n @patt = @patt[0..-2] if @patt && !@patt.empty?\n @message = @patt = nil if @patt == ''\n @title = nil unless @patt\n else\n resolve_binding key\n end\n true\nend",
"def handle_control_character(search, key)\n case key\n\n when KEY_CTRL_N then search.down\n when KEY_CTRL_P then search.up\n\n when KEY_CTRL_U then search.clear_query\n when KEY_CTRL_W then search.delete_word\n when KEY_CTRL_H, KEY_DELETE then search.backspace\n\n when ?\\r, KEY_CTRL_J, KEY_CTRL_M then search.done\n\n when KEY_CTRL_C then raise Abort\n\n else search\n end\n end",
"def [](key)\n send key\n end",
"def [](key)\n send key\n end",
"def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend",
"def show_single_key\nc = read_char\ncase c\nwhen \" \"\nreturn \"SPACE\"\nwhen \"\\t\"\nreturn \"TAB\"\nwhen \"\\r\"\nreturn \"RETURN\"\nwhen \"\\n\"\nreturn \"LINE FEED\"\nwhen \"\\e\"\nreturn \"ESCAPE\"\nwhen \"\\e[A\"\nreturn \"UP ARROW\"\nwhen \"\\e[B\"\nreturn \"DOWN ARROW\"\nwhen \"\\e[C\"\nreturn \"RIGHT ARROW\"\nwhen \"\\e[D\"\nreturn \"LEFT ARROW\"\nwhen \"\\177\"\nreturn \"BACKSPACE\"\nwhen \"\\004\"\nreturn \"DELETE\"\nwhen \"\\e[3~\"\nreturn \"ALTERNATE DELETE\"\nwhen \"\\u0003\"\nreturn \"CONTROL-C\"\nexit 0\nwhen /^.$/\nreturn \"SINGLE CHAR HIT: #{c.inspect}\"\nelse\nreturn \"SOMETHING ELSE: #{c.inspect}\"\nend\nend",
"def set_key(key, text)\n return if key == self.key and text == self.text\n @key = key\n @text = text\n refresh\n end",
"def rl_bind_key(key, function)\r\n @_rl_keymap[rl_translate_keyseq(key)] = function\r\n @rl_binding_keymap = @_rl_keymap\r\n 0\r\n end",
"def send_keycode(keycode)\n send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::DOWN))\n send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::UP))\n end",
"def key_stroke(keycodeText)\n append_to_script \"key_stroke \\\"#{keycodeText}\\\"\"\n end",
"def keyevent(key, metastate = nil)\n @bridge.keyevent(key, metastate)\n end",
"def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end",
"def key_symbol\n @key\n end",
"def hotkey=(key)\n @link.HotKey = key\n end",
"def draw_key(index, skill, key, input)\n x = (width / 2) - (Combo_Skill[skill][0].size * Base_Cost / 2) - 16 + key * @actor.battler_combo[input][2]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(input)]\n self.contents.blt(x, ((index % @max_size) * 52) + 60, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, ((index % @max_size) * 52) + 56, 24, 32, Input.key_converter(input))\n end\n end",
"def press(key_sequence)\n end",
"def getKey; argSetTextual.to_sym end",
"def type_keysequence(keysequence, delay = 0.012)\n XDo::FFILib.xdo_keysequence @_xdo_pointer, @_window, keysequence,\n (delay * 1_000_000).to_i\n end",
"def rl_function_of_keyseq(keyseq, map, type)\r\n map ||= @_rl_keymap\r\n map[keyseq]\r\n end",
"def keypress &block\n @keyblock = block\n end",
"def keypress\n key = input\n\n @keypress ||= Vedeu::Input::Translator.translate(key)\n end",
"def press_any_key\n # TODO: Print footer.\n get_wch\n end",
"def key=(key)\n if (!key.kind_of?(String))\n raise ArgumentError, \"Expected String, but #{key.class} provided.\"\n end\n @key = key\n end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n RTermGame.println \"SPACE\"\n when \"\\t\"\n RTermGame.println \"TAB\"\n when \"\\r\"\n RTermGame.println \"RETURN\"\n when \"\\n\"\n RTermGame.println \"LINE FEED\"\n when \"\\e\"\n RTermGame.println \"ESCAPE\"\n when \"\\e[A\"\n RTermGame.println \"UP ARROW\"\n when \"\\e[B\"\n RTermGame.println \"DOWN ARROW\"\n when \"\\e[C\"\n RTermGame.println \"RIGHT ARROW\"\n when \"\\e[D\"\n RTermGame.println \"LEFT ARROW\"\n when \"\\177\"\n RTermGame.println \"BACKSPACE\"\n when \"\\004\"\n RTermGame.println \"DELETE\"\n when \"\\e[3~\"\n RTermGame.println \"ALTERNATE DELETE\"\n when \"\\u0003\"\n RTermGame.println \"CONTROL-C\"\n exit 0\n when /^.$/\n RTermGame.println \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n RTermGame.println \"SOMETHING ELSE: #{c.inspect}\"\n end\nend",
"def key_down(key)\n focus\n @driver.sc_key_down action_target, key, *action_locator_args\n stall :key_down\n end",
"def add_key(key_string, key_type=nil, comment=nil, login=nil )\n #@container.logger.info \"Adding new key #{key_string} #{key_type} #{comment} #{login}\"\n comment = \"\" unless comment\n\n modify do |keys|\n keys[key_id(comment)] = key_entry(key_string, key_type, comment, login)\n end\n\n end",
"def read_keypress(options = {})\n opts = { echo: false, raw: true }.merge(options)\n codes = unbufferred { get_codes(opts) }\n char = codes ? codes.pack('U*') : nil\n\n trigger_key_event(char) if char\n char\n end",
"def send_modified_key(element_selector, key, *meta)\n wait_for_loading\n \n key_string = key\n key_string = \"alt+\" + key_string if meta.include? :alt\n key_string = \"ctrl+\" + key_string if meta.include? :control\n key_string = \"command+\" + key_string if meta.include? :command\n\n page.driver.execute_script(\"Mousetrap.trigger('#{key_string}');\")\n end",
"def invoke_write_key(key)\n write_key(key)\n end",
"def ORIGbind_key keycode, *args, &blk # -- {{{\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) #if keycode.class==String ## 1.9 2009-10-05 19:40 \n #$log.debug \" #{name} Widg String called bind_key BIND #{keycode}, #{keycode_tos(keycode)} \"\n #$log.debug \" assigning #{keycode} \" if $log.debug? \n @_key_map[keycode] = blk\n when Array\n # double assignment\n # for starters lets try with 2 keys only\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n a0 = keycode[0]\n a0 = keycode[0].getbyte(0) if keycode[0].class == String\n a1 = keycode[1]\n a1 = keycode[1].getbyte(0) if keycode[1].class == String\n @_key_map[a0] ||= OrderedHash.new\n #$log.debug \" assigning #{keycode} , A0 #{a0} , A1 #{a1} \" if $log.debug? \n @_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n #$log.debug \" assigning #{keycode} to _key_map \" if $log.debug? \n @_key_map[keycode] = blk\n end\n @_key_args ||= {}\n @_key_args[keycode] = args\n\n end",
"def method_missing(sym, *args, &block)\n super if !args.empty? or block\n cmds = sym.to_s.split(\"_\")\n callsequence = \"\"\n cmds.each do |cmd|\n callsequence << case cmd.downcase\n when \"ctrl\" then \"^\"\n when \"shift\" then \"+\"\n when \"alt\" then \"!\"\n when \"win\" then \"#\"\n when \"enter\" then \"{ENTER}\"\n when \"return\" then \"{ENTER}\"\n when \"del\" then \"{DEL}\"\n else\n cmd\n end\n end\n send_keys(callsequence)\n end",
"def alt_key_down\r\n command 'altKeyDown'\r\n end"
] | [
"0.7480066",
"0.73115885",
"0.72530967",
"0.71177316",
"0.6900506",
"0.6753131",
"0.661871",
"0.64906937",
"0.6437501",
"0.6437501",
"0.63951325",
"0.62520427",
"0.62520427",
"0.61219114",
"0.6108311",
"0.6108311",
"0.61071455",
"0.60195",
"0.5999828",
"0.5995542",
"0.5982869",
"0.59612954",
"0.5901138",
"0.58901787",
"0.58535904",
"0.58535904",
"0.58426154",
"0.58426154",
"0.58382356",
"0.5836076",
"0.5834434",
"0.5819486",
"0.58149695",
"0.5811594",
"0.5791475",
"0.57899797",
"0.57885474",
"0.5766549",
"0.57465696",
"0.5741332",
"0.5729175",
"0.5672574",
"0.56693226",
"0.5655753",
"0.56546795",
"0.5653515",
"0.5624058",
"0.5616482",
"0.56164145",
"0.5594722",
"0.5588824",
"0.5565608",
"0.5562635",
"0.55264854",
"0.5520749",
"0.5515663",
"0.55126894",
"0.55124515",
"0.55113167",
"0.55103856",
"0.5508663",
"0.5507894",
"0.5507894",
"0.54934055",
"0.5478943",
"0.5477192",
"0.5473417",
"0.54727787",
"0.54686064",
"0.54605246",
"0.5459576",
"0.5459576",
"0.54577655",
"0.5455912",
"0.54481184",
"0.5446886",
"0.54435706",
"0.54349005",
"0.5433235",
"0.54237705",
"0.5415337",
"0.5413152",
"0.54063106",
"0.5399214",
"0.53965884",
"0.5387414",
"0.537812",
"0.5375363",
"0.5369586",
"0.5369028",
"0.53686357",
"0.5342047",
"0.5334189",
"0.5326146",
"0.53203857",
"0.5320002",
"0.53175795",
"0.52941203",
"0.52928597",
"0.5292544"
] | 0.7402131 | 1 |
Override this to supply the target, which can either be one of the following: :view :core_query_element | def action_target()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targetElement=(value)\n\t\t\t@targetElement = value\n\t\tend",
"def targetElement=(value)\n\t\t\t@targetElement = value\n\t\tend",
"def method_missing(method, *args, &block)\n @view.send(method, @selector, *args, &block)\n self\n end",
"def select_target\n @target or raise Vanagon::Error, '#select_target has not been implemented for your engine.'\n end",
"def target\n Element.new(`#@native.target`)\n end",
"def target\n self\n end",
"def target\n self\n end",
"def target=(target)\n self.each{|e| e.target=target}\n end",
"def target_view_path\n super\n end",
"def with_target\n self\n end",
"def semantic_target(element)\n if(element.respond_to?(:uri))\n uri = N::URI.new(element.uri)\n # TODO: Could check if we are actually dealing with local uris here\n link_to(uri.to_name_s, :controller => 'sources', :action => 'dispatch', :dispatch_uri => uri.local_name)\n else\n element\n end\n end",
"def target; end",
"def target; end",
"def locate_element(how, what)\n return super unless @nokogiri\n\n el = @query_scope.browser.doc.send(\"at_#{how}\", what)\n Watigiri::Element.new element: el, selector: {how => what}\n end",
"def target!\n @target.__class__ == JVM::XmlMarkup ? @target.toString : @target\n end",
"def target!\n @target\n end",
"def target\n return self\n end",
"def target\n @target\n end",
"def target\n self.class.target\n end",
"def select_xml(target=nil, options={})\n\n unless @noko.name == self.class::ROOT_ELEMENT ## and check for target too \n \n if target and TARGET_ATTR\n selector = \"xmlns:#{self.class::ROOT_ELEMENT}[@#{self.class::TARGET_ATTR}='#{target}'][1]\"\n @noko = @noko.xpath(selector)[0]\n else\n selector = \"xmlns:#{self.class::ROOT_ELEMENT}[1]\"\n @noko = @noko.xpath(selector)[0]\n end \n \n raise \"No suitable XML was selected: using #{selector}\" unless @noko and\n @noko.kind_of?(Nokogiri::XML::Element) and @noko.name\n \n end\n \n end",
"def target=(value)\n raise TypeError, 'target must be a TermUI::Application or TermUI::Widget' unless value.is_a?(TermUI::Application) || value.is_a?(TermUI::Widget)\n \n @target = value\n end",
"def target=(value)\n @target = value\n end",
"def target\n @target\n end",
"def method_missing method, *args, &block\n # respond_to?(symbol, include_all=false)\n if dom.respond_to? method, true\n dom.send method, *args, &block\n else\n super\n end\n end",
"def element(name, *args)\n self.view.send(name, *args)\n end",
"def target\n nil\n end",
"def target( **query )\n query[:visible_to] = self\n Game.instance.target(**query)\n end",
"def initialize options\r\n super\r\n @target = options[:target]\r\n end",
"def target(*args)\n if args.blank?\n const_defined?(:Target) ? const_get(:Target) : (@target || name[0..-5].classify.constantize)\n else\n self.target = args.first\n end\n end",
"def query_selector(selector)\n document.query_selector selector\n end",
"def assert_select(*args, &block)\n super(HTML::Document.new(last_invoke).root, *args, &block)\n end",
"def search_results_panel\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"/ctl00_content_ctl00_content/\"), __method__)\n end",
"def target=(_arg0); end",
"def target=(_arg0); end",
"def search(target)\n end",
"def call(target)\n @full_matcher.call(target)\n end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def get_target\n @target\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/ownerElement01\"\n end",
"def target=(target)\n @target = target\n end",
"def targetsQuery _obj, _args\n \"_obj targetsQuery _args;\" \n end",
"def widget(target, assigns = {}, options = {}, &block)\n assigns.merge!(:component => @component) {|_,old,_| old } if target.is_a? Class\n super target, assigns, options, &block\n end",
"def initialize( target )\n\t\t@target = target\n\tend",
"def target=(target)\n @target = target\n loaded!\n end",
"def target=(target)\n @target = target\n loaded!\n end",
"def target\n return @target\n end",
"def initialize(target)\n @target = target\n end",
"def initialize(target)\n @target = target\n end",
"def target\n @target ||= case scope\n when '#'\n klass\n when '.'\n klass && klass.class_eval{class << self; self; end}\n end\n end",
"def target\n @target ||= parse_response(request(build_request))\n end",
"def _active_target\n @target\n end",
"def initialize(query_scope, *args)\n @site = query_scope.class.ancestors.include?(Insite) ? query_scope : query_scope.site\n @browser = @site.browser\n @component_elements = self.class.component_elements\n\n if args[0].is_a?(Insite::Element) || args[0].is_a?(Watir::Element)\n @args = nil\n @target = args[0].target\n elsif args[0].is_a?(Insite::ElementCollection) || args[0].is_a?(Watir::ElementCollection)\n @args = nil\n @target = args[0]\n else\n unless self.class.selector.present? || parse_args(args).present?\n raise(\n Insite::Errors::ComponentSelectorError,\n \"Unable to initialize a #{self.class} Component for #{query_scope.class}. \" \\\n \"A Component selector wasn't defined in this Component's class \" \\\n \"definition and the method call did not include selector arguments.\",\n caller\n )\n end\n\n @selector = self.class.selector.merge(parse_args(args))\n @args = @selector\n\n # Figure out the correct query scope.\n @non_relative = @args.delete(:non_relative) || false\n if @non_relative\n @query_scope = query_scope.site\n else\n query_scope.respond_to?(:target) ? obj = query_scope : obj = query_scope.site\n @query_scope = obj\n end\n\n # See if there's a Watir DOM method for the class. If not, then\n # initialize using the default HTML element.\n watir_class = Insite::CLASS_MAP.key(self.class)\n if watir_class && watir_class != Watir::HTMLElement\n @target = watir_class.new(@query_scope.target, @args)\n else\n @target = Watir::HTMLElement.new(@query_scope.target, @args)\n end\n\n # New webdriver approach.\n # begin\n # @target.scroll.to\n # sleep 0.1\n # rescue => e\n # t = ::Time.now + 2\n # while ::Time.now <= t do\n # break if @target.present?\n # sleep 0.1\n # end\n # end\n end\n end",
"def method_missing selector, *arguments, &block\n _log { \"#{selector} #{arguments.inspect}\" }\n if @target_list.empty?\n super\n else\n target = @mutex.synchronize do\n @target_list[@target_index = \n (@target_index + 1) % @target_list.size]\n end\n raise Error, \"No target\" unless target\n target.method_missing(selector, *arguments, &block)\n end\n end",
"def target\n @target ||= request(build_request)\n end",
"def view\n @_view\n end",
"def translation_target\n super\n end",
"def initialize(target)\n @target = target\n end",
"def acts_as_selector\n define_method(\"is_selector?\") { true }\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/domimplementationfeaturecore\"\n end",
"def active_element; end",
"def widget(target, assigns = {}, options = {}, &block)\n if target.is_a? Class\n target.new(assigns, &block)._render_via(self, options)\n else\n unless assigns.empty?\n raise \"Unexpected second parameter. Did you mean to pass in assigns when you instantiated the #{target.class.to_s}?\"\n end\n target._render_via(self, options, &block)\n end\n end",
"def url\n super\n end",
"def target=(new_value)\n @target = new_value unless const_defined?(:Target)\n end",
"def at_xpath(*args); end",
"def at_xpath(*args); end",
"def scroll_to(element, device: T.unsafe(nil)); end",
"def for_target(target)\n @target_name = target[:target_name].to_s\n return self\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/hc_nodeclonenodetrue\"\n end",
"def target\n target, name, params, content = ast.children\n target\n end",
"def aimedAtTarget _obj, _args\n \"_obj aimedAtTarget _args;\" \n end",
"def view_select_statement(view, name=nil)\n raise NotImplementedError, \"view_select_statement is an abstract method\"\n end",
"def target\n return @target unless @target.blank?\n\n r = resources.by_version_desc.first\n tenant = r.tenant\n @target = tenant.full_url(Rails.application.routes.url_helpers.show_path(to_s))\n end",
"def selector\n @selector || (@caller && @caller.selector) || (@parent && @parent.selector)\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/level1/html/HTMLTableElement27\"\n end",
"def target\n if !block_given?\n return @j_del.java_method(:target, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling target()\"\n end",
"def target\n @target ||= Details.new(request(build_request))\n end",
"def target\n @target ||= Details.new(request(build_request))\n end",
"def targetURI\n \"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/nodeappendchilddocfragment\"\n end",
"def for(mytarget, myfinder, myfinder_args, myname=nil)\n NotImplementedError\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def _view; end",
"def initialize(target)\n @target = target\n end",
"def initialize(target)\n @target = target\n end",
"def root_target(obj=self)\n obj.respond_to?(:target) ? root_target(obj.target) : obj\n end",
"def initialize(view)\n @view = view\n end",
"def find(target)\n @root.find(target)\n end",
"def attach_to_browser_target\n {\n method: \"Target.attachToBrowserTarget\"\n }\n end",
"def query\n super\n end",
"def target=(target)\n @target = target\n @ori_target = target\n end",
"def execute\n view.add_control target, controller.current_view.instance\n end",
"def target\n return @target unless @target.blank?\n r = resources.by_version_desc.first\n tenant = r.tenant\n @target = tenant.full_url(StashEngine::Engine.routes.url_helpers.show_path(to_s))\n end",
"def selectors\n self.class.selectors\n end",
"def remote_query\n raise \"You must override `remote_query' in your class\"\n end",
"def action\n super\n end",
"def target\n __getobj__\n end",
"def loc_view\n \n end",
"def to( target )\n select { |e| e.respond_to?(:to?) && e.to?( target ) }\n end"
] | [
"0.5994996",
"0.5994996",
"0.5757981",
"0.5746993",
"0.57150686",
"0.5632601",
"0.5632601",
"0.5615904",
"0.5615043",
"0.5550563",
"0.5539968",
"0.552279",
"0.552279",
"0.5507207",
"0.55031276",
"0.54934937",
"0.54718274",
"0.54684377",
"0.5446981",
"0.54395056",
"0.53883445",
"0.5321193",
"0.5269239",
"0.52262366",
"0.5184199",
"0.5149632",
"0.5130638",
"0.51172215",
"0.50896716",
"0.5086619",
"0.50599325",
"0.505552",
"0.5052942",
"0.5052942",
"0.5042208",
"0.503892",
"0.5036536",
"0.5036536",
"0.5036536",
"0.5036536",
"0.50364494",
"0.50305915",
"0.50251704",
"0.50131226",
"0.5002637",
"0.49996653",
"0.4991426",
"0.4991426",
"0.49836105",
"0.4978479",
"0.4978479",
"0.49776268",
"0.49748856",
"0.49520782",
"0.49487075",
"0.49430227",
"0.49394032",
"0.49391013",
"0.49374798",
"0.49058357",
"0.48885772",
"0.48274162",
"0.48243943",
"0.48241827",
"0.4817709",
"0.48163006",
"0.4808572",
"0.4808572",
"0.48077556",
"0.48076206",
"0.48041233",
"0.4798908",
"0.47950426",
"0.47934136",
"0.47923142",
"0.47861683",
"0.47809187",
"0.47807527",
"0.4780556",
"0.4780556",
"0.47785538",
"0.4778243",
"0.47771323",
"0.47748402",
"0.47723153",
"0.47723153",
"0.47616532",
"0.47526315",
"0.47465795",
"0.47457218",
"0.47388104",
"0.47357303",
"0.47175074",
"0.4700908",
"0.46954432",
"0.46930346",
"0.46903527",
"0.46857098",
"0.4684594",
"0.4673713"
] | 0.5408089 | 20 |
Override this to supply the arguments to generate the locator | def action_locator_args()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_args__\n self\n end",
"def locator(options={})\n options.inject([]) do |locators, locator|\n key, value = locator\n locators << \"#{key}:#{value}\"\n end.join(',')\n end",
"def args()\n #This is a stub, used for indexing\n end",
"def region(*args)\n self.region_to_check = if args.first.is_a? Applitools::Selenium::Element\n proc do\n args.first\n end\n else\n proc do |driver|\n driver.find_element(*args)\n end\n end\n self.coordinate_type = Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]\n options[:timeout] = nil\n reset_ignore\n self\n end",
"def nearestLocations _args\n \"nearestLocations _args;\" \n end",
"def placeJourneyLocator(journeyDisplay, args, context)\n\n end",
"def at_xpath(*args); end",
"def at_xpath(*args); end",
"def spec( *args )\n\n if args[0].kind_of? Array\n\n # Coord pairs.\n args.each do |p|\n @path.push Pos.ini( p[0], p[1] )\n end\n\n else\n\n if args[0].kind_of? Pos\n # List of pos.\n @path = args\n else\n # Odd index in Array\n odd = false\n x = nil\n y = nil\n # Alternating x, y.\n args.each do |p|\n if odd\n @path.push Pos.ini( x, p )\n else\n x = p\n end\n odd = not( odd )\n end\n end\n end\n\n self\n end",
"def area(* args)\r\n raise \"not implemented for Selenium\"\r\n end",
"def nearestLocation _args\n \"nearestLocation _args;\" \n end",
"def locationPosition _args\n \"locationPosition _args;\" \n end",
"def arguments\n [position.to_s]\n end",
"def createLocation _args\n \"createLocation _args;\" \n end",
"def xpath(*args); end",
"def xpath(*args); end",
"def make_args(args_hash)\n # The routin should be provided in the inherited class\n end",
"def location=(_arg0); end",
"def set_arguments (args)\n end",
"def legislators_locate(*args)\n get('/legislators/locate', extract_location(args))\n end",
"def initialize(args = {})\n args[:selector] = ElementSelector.new(\n selection_xpath: RESOURCE_REFERENCE_XPATH\n )\n super(args)\n end",
"def placeJourneyLocator(journeyDisplay, args, context)\n PM.logger.info \"#{self.class.name}:#{__method__} #{journeyDisplay.route.name} #{args.inspect}\"\n self.delegate.placeJourneyLocator(journeyDisplay, args, context)\n end",
"def parse_args(args, anon_class_def)\n named_class = Class === args.first && Element > args.first\n if named_class && !anon_class_def\n element_class, *find_args = args\n elsif !named_class\n element_class = anon_class_def ? Class.new(Element, &anon_class_def) : Element\n find_args = args\n else\n raise ArgumentError 'Provide an Element subclass, an anonymous block definition, or neither, but not both'\n end\n\n locator = Hash === find_args.last ? find_args.pop : {}\n\n case find_args.size\n when 1 then locator[:css] = find_args.shift\n when 2 then locator[find_args.shift] = find_args.shift\n end\n\n return element_class, locator\n end",
"def nearestLocationWithDubbing _args\n \"nearestLocationWithDubbing _args;\" \n end",
"def initialize(keyword); super(keyword); @argSet = Set.new end",
"def at(*args); end",
"def at(*args); end",
"def at(*args); end",
"def at(*args); end",
"def markerPos _args\n \"markerPos _args;\" \n end",
"def initialize(driver, original_target_locator, on_will_switch)\n super(original_target_locator)\n @driver = driver\n @on_will_switch = on_will_switch\n @scroll_position_provider = Applitools::Selenium::ScrollPositionProvider.new(driver)\n end",
"def add_pin_args_str\n raise NotImplementedError, 'No argument string provided for this Sprout\\'s pins!'\n end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def general_locator_clicker(step, column)\n Rails.logger.info \"Clicking Locator for #{step}\"\n locators = GRDatabase.get_all_locators(step, @offer.campaign.Brand, @offer[column])\n begin\n click_all_locators(locators)\n rescue => e\n\n end\n end",
"def nearestBuilding _args\n \"nearestBuilding _args;\" \n end",
"def getPosATL _args\n \"getPosATL _args;\" \n end",
"def create_get_element_params(element_name, *find_args)\n method_name = \"#{element_name}_params\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do\n merge_args(find_args)\n end\n end\n end",
"def driver _args\n \"driver _args;\" \n end",
"def createMarker _args\n \"createMarker _args;\" \n end",
"def place_robot(args)\n x, y, direction = args.split(',')\n [x, y, direction].each do |arg|\n fail 'Missing argument' if arg.to_s.empty?\n end\n\n @toy_robot.place x.strip.to_i, y.strip.to_i,\n direction.strip.downcase.to_sym\n end",
"def position _args\n \"position _args;\" \n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def getMarkerPos _args\n \"getMarkerPos _args;\" \n end",
"def initialize(*args)\n @args = args\n end",
"def curatorPoints _args\n \"curatorPoints _args;\" \n end",
"def initialize(*args)\n super(args[0], args[1])\n end",
"def locate_by\n options_by_type(:locate_by) || :element\n end",
"def initialize(args = {})\n @driver = args.fetch(:driver)\n @instrumenter = args[:instrumenter] || Instrumenters::Noop\n @argument_generators = args.fetch(:argument_generators, DefaultArgumentGenerators)\n @result_transformers = args.fetch(:result_transformers, DefaultResultTransformers)\n @retry_strategy = args[:retry_strategy] || DefaultRetryStrategy\n @command_runners = args.fetch(:command_runners, DefaultCommandRunners)\n end",
"def legacy_search(args)\n warn \"WARNING: Calling Technorati#search this way is deprecated.\"\n warn \"WARNING: Please update your code.\"\n\n { 'start' => args } \n end",
"def location_parameter_names\n [:x, :y]\n end",
"def method_missing(method, *args)\n\t\t\t@path_elements << method.to_s\n\t\t\t@path_elements << args[0] if args[0]\n\t\t\treturn self\n\t\tend",
"def guarded_locator\n return unguarded_locator if unguarded_locator\n self.locator = case \n when template_id \n then %Q{//#{XMLManipulation::CDA_NAMESPACE}:section[./#{XMLManipulation::CDA_NAMESPACE}:templateId[@root = '#{template_id}']]}\n when locate_by == :attribute\n then \"@#{section_key.to_s.camelcase(:lower)}\"\n when section_key =~ /[^\\w]/\n # non word characters--asume an xpath locator is the section_key\n then section_key\n when section_key.to_s =~ /^\\w+/\n # all word characters--assume an element reference\n then \"#{XMLManipulation::CDA_NAMESPACE}:#{section_key.to_s.camelcase(:lower)}\"\n end \n end",
"def drawLocation _obj, _args\n \"_obj drawLocation _args;\" \n end",
"def waypointPosition _args\n \"waypointPosition _args;\" \n end",
"def search(args)\n raise NotImplementedError, \"Not implemented\"\n end",
"def locate_pins(params); end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize(args)\n end",
"def placeJourneyLocator(journeyDisplay, args, context)\n @locatorsStage << LocatorView.new(journeyDisplay, args)\n end",
"def initialize args\n hash_make args, InPort::ARG_SPECS\n @link = nil\n end",
"def initialize(args={})\n @id = args[\"id\"]\n @name = args[:name] || args[\"name\"]\n @point_base = args[:point_base] || args[\"point_base\"]\n @errors = []\n post_initialize\n end",
"def markerShape _args\n \"markerShape _args;\" \n end",
"def initialize(window, locators)\n @window = window\n extract(locators)\n end",
"def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/places\")\n end",
"def initialize(dbi, *args)\n @dbi = dbi\n @options = args.extract_options!\n @search_method = args[0]\n end",
"def locate(params)\n get params.is_a?(String) ? {:loc => params} : map_attributes(location_from_params(params))\n end",
"def hash_args\n [@offset_start] + super\n end",
"def markerText _args\n \"markerText _args;\" \n end",
"def initialize(**args)\n super(command: self.class.command.new(args), executed: [])\n end",
"def find(*args, **options, &optional_filter_block)\n LOG.info(\"Capybara find #{args.join(' ')}\")\n super\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def initialize(args)\n @args = args\n end",
"def initialize args={}\n assign(args)\n end",
"def args(*) end",
"def detail_args_for(options); end",
"def waypointHousePosition _args\n \"waypointHousePosition _args;\" \n end",
"def initialize(args)\n @latitude = args[:latitude]\n @longitude = args[:longitude]\n @endpoint_url = \"http://farmsense-prod.apigee.net/v1/frostdates/stations/?lat=#{@latitude}8&lon=#{@longitude}\"\n end",
"def getPos _args\n \"getPos _args;\" \n end"
] | [
"0.6004458",
"0.59963995",
"0.59331214",
"0.5824153",
"0.5785663",
"0.57632834",
"0.5745456",
"0.5745456",
"0.573316",
"0.5699353",
"0.5698791",
"0.5696598",
"0.5635229",
"0.5607605",
"0.5593467",
"0.5593467",
"0.5554346",
"0.55269915",
"0.54894",
"0.5470132",
"0.5441323",
"0.5439698",
"0.54174864",
"0.53679454",
"0.5354244",
"0.5347042",
"0.5347042",
"0.5347042",
"0.5347042",
"0.53447235",
"0.5338173",
"0.533403",
"0.53277105",
"0.53277105",
"0.53277105",
"0.53060174",
"0.53046083",
"0.5298531",
"0.529635",
"0.5252547",
"0.52392244",
"0.5238681",
"0.5232404",
"0.52273744",
"0.52273744",
"0.5218361",
"0.52147394",
"0.51835966",
"0.5165147",
"0.5163909",
"0.5162853",
"0.51592666",
"0.51516294",
"0.5144624",
"0.5128881",
"0.5117796",
"0.50904167",
"0.5089625",
"0.5089395",
"0.50865805",
"0.5080657",
"0.50760144",
"0.50720334",
"0.5070288",
"0.50597006",
"0.5055562",
"0.50521034",
"0.5050797",
"0.5046937",
"0.50440544",
"0.5035626",
"0.5025138",
"0.50213635",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5019345",
"0.5015037",
"0.5014507",
"0.5014142",
"0.49843043",
"0.49793175",
"0.49792922",
"0.49785987"
] | 0.6621261 | 0 |
Used as a Dashboard | def index
@items = Item.select { |item| item.user == current_user}
@bookings = Booking.select { |booking| booking.user == current_user }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard\r\n end",
"def dashboard; end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n end",
"def dashboard\n\n end",
"def dashboard\n\n end",
"def dashboard\n\tend",
"def set_dashboard\n end",
"def dashboard\n self.root\n self.follow('dtime:dashboard')\n self.get\n self\n end",
"def dashboard_1\n end",
"def show\n dashboard_4\n end",
"def dashboard\n # dashboard.html.erb\n end",
"def show\n dashboard_4\n end",
"def dashboard\n # shows data for just current user\n @user = current_user\n @writings = Writing.all\n @worksheets = Worksheet.all\n end",
"def dashboard\n @title = 'Admin'\n render 'admin/dashboard', :layout => 'layouts/main', :cachable => true\n end",
"def dashboard\n #sendEmailTest('ratinahirana@gmail.com', 'Blou Ratinahirana', 'M03200202', 'Arrivé au centre de dépot')\n load_dashboard(nil, nil)\n\n render 'dashboard'\n end",
"def dashboard\n 'dashboard'\n end",
"def dashboard\n template = OpenStudioMeasureTester::Dashboard.new(test_results_dir)\n template.render\n end",
"def dashboard\n @meta_data = {:page_title => \"Chicago Ideas Week | Dashboard\", :og_image => \"\", :og_title => \"Chicago Ideas Week\", :og_type => \"article\", :og_desc => \"\"}\n @user = current_user\n end",
"def user_dashboard\n @progress_count = Resource.in_progress.where(user_id: @user.id).count\n # some of these columns are calculated values for display that aren't stored (publication date)\n @resources = Resource.where(user_id: @user.id).latest_per_dataset\n @presenters = @resources.map { |res| StashDatacite::ResourcesController::DatasetPresenter.new(res) }\n setup_ds_status_facets\n sort_and_paginate_datasets\n end",
"def index\n super\n use_widgets do |root|\n root << jqg_top_widget('program')\n end\n render\n end",
"def admin\n self.sitemap\n self.follow('dtime:dashboard:admin')\n self.get\n self\n end",
"def index\n @datosgenerales = Datosgenerale.all\n dashboard_4\n end",
"def index\n statuses_dashboard\n end",
"def dashboard\n\t\t@popoverclass = SecureRandom.hex(16)\n\t\t@activities = PublicActivity::Activity.order(\"created_at desc\").where(owner_type: \"User\", :published => true,trackable_type: [\"Majorpost\"], :sub_category => nil, :test => false, :reviewed => nil).page(params[:page]).per_page(1)\n\tend",
"def overview\n\n end",
"def show() end",
"def show() end",
"def show() end",
"def show\n render :layout => 'hrmdashboard'\n add_breadcrumb \"Event\"\n end",
"def index\n @admin_dashboards = Admin::Dashboard.all\n end",
"def dashboard\n @total_count = TimePilot.features.map do |feature_name|\n counts = TimePilot.group_classes.map do |klass|\n [klass.to_s, klass.pilot_feature_cardinality(feature_name)]\n end.to_h\n [feature_name, counts]\n end.to_h\n erb :index\n end",
"def dashboard\n service_response = AdminManagement::AdminUser::Dashboard.new(params).perform\n render_api_response(service_response)\n end",
"def dashboard\n \t#can now use @user as variable to reference logged in user\n \t@user = User.find(current_user.id)\n \t@note = User.find(current_user.id).notes\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def dashboard\n \t\t@leagues = League.all\n @current_member = current_member\n \t\t@members = current_member.followers\n \tend",
"def index\n add_breadcrumb t(:'hyrax.controls.home'), root_path\n add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path\n add_breadcrumb t(:'hyrax.admin.sidebar.collections'), hyrax.my_collections_path if current_ability.admin?\n add_breadcrumb t(:'hyrax.admin.sidebar.collections'), hyrax.dashboard_collections_path unless current_ability.admin? \n collection_type_list_presenter\n managed_collections_count\n super\n end",
"def dashboard\n __log_activity\n __debug_route\n opt = url_parameters\n fast = opt.key?(:fast) ? true?(opt[:fast]) : Rails.env.test?\n @item, @preferences, @history = get_account_details(fast: fast)\n response.status =\n case flash.now[:alert]\n when '', nil then 200 # OK\n when /already signed in/ then 403 # Forbidden\n else 401 # Unauthorized\n end\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values(nil, as: :array) }\n end\n end",
"def dashboard\n # displays the admin dashboard if current user is admin\n if current_user.is_admin\n # retrieves a list of all users, ordered by username\n @users = User.order(\"username\")\n render :admin_dashboard\n # sold parameter can be toggled on the dashboard to display either sold or unsold listings\n elsif params[:sold]\n @sold = true\n # retrieves a paginated list of all of the users SOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is true\").order(\"created_at desc\").page params[:page]\n else\n @sold = false\n # retrieves a paginated list of all of the users UNSOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is false\").order(\"created_at desc\").page params[:page]\n end\n end",
"def show \r\n end",
"def show\n \n end",
"def show\n \n end",
"def dashboard_h\n render :layout => 'application-h'\n end",
"def begin_loading_dashboard(url)\n ::Gitlab::Metrics::Dashboard::Finder.find(\n project,\n embedded: true,\n grafana_url: url\n )\n end",
"def dashboard\n @players = User.all\n verify_session() #ApplicationHelper::UserInterface\n retreiveChallenges #UserHelper::ChallengeInterface\n end",
"def admin_logic\n end",
"def show\n\t\t end",
"def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end",
"def show\n\t end",
"def dashboard\n # render :partial =>'dashboard'\n end",
"def index\n @dashboards = Dashboard.all\n @dashboards = Dashboard.paginate(page: params[:page], per_page: 8) if current_user.admin.present?\n \n # From Website index to DashBoard\n # instance to index to valid? a new link \n # @website_new = params[:website]\n # this needs to be the last line as it is double instance to carry below to next method\n # @@website = params[:website]\n \n destroy_data # destroy data after 1 month...data_dashboards...\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def index\n @system_overviews = SystemOverview.all\n if @system_overviews.size > 0\n\n data_table = GoogleVisualr::DataTable.new\n data_table.new_column('string', 'Label')\n data_table.new_column('number', 'Value')\n data_table.add_rows(3)\n data_table.set_cell(0, 0, 'Current')\n data_table.set_cell(0, 1, SystemOverview\n .last.currently_running\n .tr('W', '')\n .tr('KW', '')\n .to_i\n )\n opts = { width: 400, height: 120, redFrom: 90, redTo: 100, yellowFrom: 75, yellowTo: 90, minorTicks: 5 }\n @chart = GoogleVisualr::Interactive::Gauge.new(data_table, opts)\n end\n end",
"def dashboard \n\t# List of all days\n\tlist_of_days = (1.month.ago.to_date...Date.today).to_a\n\n\t@clicks = Click.where(:created_at => 1.month.ago.to_date...Date.today, :user_id => current_user.id).count\n\t@leads = Lead.where(:created_at => 1.month.ago.to_date...Date.today, :user_id => current_user.id).count\n\n\n\t# # List of all days\n\t# @list_of_days = (2.month.ago.to_date...Date.today).to_a\n\t# # New Hash of days\n\t# @datelist = Hash.new\n\t# # Set all dates to zero\n\t# @list_of_days.each do |k|\n\t#\t# Convert to useable date\n\t#\tdate = k.to_date\n\t#\t# Count all clicks per day\n\t#\t@clicks = Click.complete_day(date).count\n\t#\t# Add to array per day with clicks\n\t#\t@datelist[date] = @clicks\n\t# end\n end",
"def dashboard\n # get my projects\n @eab_projects = current_user.eab_projects\n @favs = current_user.favorites\n @user = current_user\n @transactions = @user.recent_transactions\n end",
"def index \n \n @title=\"Administration page - \"\n \n end",
"def index\n render ('index') #render the admin_helpers view. The main page controller calls this action after the admin_helpers logs in\n end",
"def dashboard_params\n end",
"def dash\n @secrets = Secret.all\n @user = User.find_by_id(session[:user_id])\n @likes = Like.where(user: User.find_by_id(session[:user_id]))\n render layout: \"two_columns\"\n end",
"def output\n UI\n end",
"def widget\n end",
"def widget\n end",
"def index\n @dashers = Dasher.all\n end",
"def show_duser_chart\n Rails.logger.info \"in Helper show_duser_chart: #{params[:controller]} : #{params[:action]} for user: \" + current_duser.id.to_s\n #@chart_mgr = HSChartMgr.new(request.env[\"warden\"].user(:duser))\n end",
"def show\n\t\t\n\tend",
"def show\n\t\t\n\tend",
"def show\n\t\t\n\tend",
"def show\n content = User.all\n render response: { dashboard: content }\n end",
"def admin_index\n return if !user_is_allowed('laws', 'view')\n \n @gen = Caboose::PageBarGenerator.new(params, {\n 'category_id' => '',\n \t\t 'legal_id_like' => '',\t\t \n \t\t 'title_like' => '',\n \t\t 'content_like' => '' \t\t \n \t\t},{\n \t\t 'model' => 'Law',\n \t 'sort'\t\t\t => 'legal_id',\n \t\t 'desc'\t\t\t => false,\n \t\t 'base_url'\t\t=> '/admin/laws'\n \t})\n \t@laws = @gen.items\n \trender :layout => 'caboose/admin'\n end",
"def show\n project_activities = Activity.where(\"trackable_type = 'Project' and trackable_id in (?)\", @current_user.projects.map {|p| p.id})\n msg_activities = Activity.where(\"trackable_type = 'Message' and recipient_id = (?)\", @current_user.id)\n activities = project_activities + msg_activities\n content = Domain::Decorators::AddWrapping.new(activities.map(&:serializable_hash), @current_user).decorate\n render response: { dashboard: content }\n end",
"def show\n redirect_to bar_graphs_url\n end",
"def set_dashboard\n p 'Set contexst'\n p current_user\n context = view_context\n # if current_user.nil?\n # user = User.last\n # sign_in(:user, user)\n # end\n if current_user.present? && current_user.mmp_admin?\n @dashboards = Dashboards::MMPAdminDashboard.new(context, current_user)\n elsif current_user.vendor_admin?\n @dashboards = Dashboards::VendorDashboard.new(context, current_user)\n end\n @exhibitor = context.exhibit(@dashboards) if @dashboards.present?\n\n end",
"def show_statistics\n render partial: \"show_statistics_tab\"\n end",
"def show\n #not needed for our implementation\n end",
"def layout; end",
"def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end",
"def home\n Rails.logger.info \"in: #{params[:controller]} : #{params[:action]} for user: \" + current_duser.id.to_s\n #displayed_series is used to show an editable table of the data in the chart. \n #@displayed_series = DuserMetric.for_duser(current_duser.id).where(\"occur_dttm > ?\", @chart_mgr.the_date ).order(occur_dttm: :asc)\n @displayed_series = DuserMetric.for_duser(current_duser.id).order(occur_dttm: :asc)\n # respond_with (@displayed_series)\n # render :home if stale?(@displayed_series)\n respond_to do |format|\n format.html {render :home , locals:{displayed_series: @displayed_series}}\n end\n\n end",
"def dashboard\n if current_user.consented?\n variables = promis_disturbance_variables + promis_impairment_variables + meq_variables + wpai_variables + well_being_pcornet_variables + bmi_variables\n @data = current_user.subject.data(variables)\n end\n end",
"def user_dashboard\n if @current_user.superadmin_role\n path = auth_hub.index_superadmin_url\n elsif @current_user.admin_role\n path = auth_hub.index_admin_url\n elsif @current_user.admin_servizi\n path = auth_hub.index_admin_url\n end\n redirect_to path unless path.blank?\n end",
"def stats\n redirect_to admin_url\n end",
"def show\n \t\n end",
"def show\n \t\n end",
"def dashboard\n\n @response = CompanyApi::Request::Economy.new(\n CompanyApi::Response::Formatter::Economy,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_dashboard_details\n\n # Check if error present or not?\n unless @response.success?\n render_error_response(@response)\n return\n end\n\n @presenter_obj = ::WebPresenter::Economy::Dashboard.new(@response, params)\n unless @presenter_obj.client_token.step_three_done?\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect\n return\n end\n\n end",
"def dashboard_admin\n @user = current_user\n @users = User.all\n @grid = AdminsGrid.new(params[:admins_grid]) do |scope|\n scope.page(params[:page]).per(10)\n end\n @index_path = request.path\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end"
] | [
"0.81040573",
"0.80815953",
"0.78646934",
"0.78646934",
"0.78646934",
"0.78646934",
"0.78646934",
"0.7845085",
"0.7845085",
"0.7632984",
"0.7386546",
"0.73487204",
"0.7086469",
"0.7004972",
"0.68298876",
"0.6699293",
"0.66983193",
"0.66835874",
"0.6682708",
"0.66500187",
"0.657875",
"0.65392536",
"0.6507726",
"0.6492442",
"0.64625055",
"0.64532864",
"0.6451754",
"0.64084476",
"0.6364313",
"0.63632697",
"0.63632697",
"0.63632697",
"0.63447034",
"0.63380694",
"0.63336354",
"0.63240194",
"0.6320983",
"0.6318696",
"0.6318696",
"0.6318696",
"0.6318696",
"0.62978774",
"0.6293044",
"0.6244922",
"0.61742663",
"0.6142403",
"0.6105572",
"0.6105572",
"0.6092197",
"0.6045699",
"0.6030141",
"0.6027808",
"0.6019787",
"0.6018669",
"0.6017051",
"0.60036784",
"0.600112",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.59853786",
"0.5980912",
"0.5972066",
"0.5964803",
"0.5950063",
"0.5941349",
"0.59398764",
"0.5935475",
"0.5932682",
"0.592704",
"0.592704",
"0.5921884",
"0.59133714",
"0.5912777",
"0.5912777",
"0.5912777",
"0.59053",
"0.5899198",
"0.5898008",
"0.5896116",
"0.5879549",
"0.5872689",
"0.58670557",
"0.58641154",
"0.585711",
"0.5852707",
"0.58496565",
"0.58487314",
"0.58419067",
"0.58370525",
"0.58370525",
"0.5815902",
"0.5812121",
"0.5811563",
"0.5811563",
"0.5811563"
] | 0.0 | -1 |
Do we need? def show | def new
@item = Item.find(params[:item_id])
@booking = Booking.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show() end",
"def show() end",
"def show() end",
"def show ; end",
"def show\n\t\t end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n puts \"******* show *******\"\n end",
"def show\n\t\t#no need b/c we just show all at once\n\tend",
"def show \r\n end",
"def show?; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end",
"def show; end"
] | [
"0.835698",
"0.835698",
"0.835698",
"0.83345175",
"0.824427",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.81586903",
"0.8125699",
"0.81254435",
"0.805334",
"0.79969937",
"0.78854215",
"0.78854215",
"0.7885374",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957",
"0.7883957"
] | 0.0 | -1 |
Merges accepted corrections for specially formatted files into content AT. This is done in two steps: 1. Apply all corrections that can be done automatically (based on exact text matches) 2. Apply manual corrections where no or multiple extact matches are found. We have to do it in two steps so that when we open the file in the editor for manual changes, all auto corrections are already applied to the file and they don't overwrite any manual corrections prior to when the script stores auto corrections to disk. | def merge_accepted_corrections_into_content_at(options)
# First validate the spot sheets and cancel process if errors are found.
validate_spot_sheet(options.merge('validate_or_merge' => 'merge'))
accepted_corrections_base_dir = config.compute_base_dir(
options['base-dir'] ||
options['base-dir-1'] ||
:accepted_corrections_dir
)
accepted_corrections_glob_pattern = config.compute_glob_pattern(
accepted_corrections_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging accepted corrections into content_at'
start_time = Time.now
total_count = 0
auto_success_count = 0
manual_success_count = 0
errors_count = 0
Dir.glob(accepted_corrections_glob_pattern).each do |accepted_corrections_file_name|
if accepted_corrections_file_name !~ /\.accepted_corrections\.txt\z/
$stderr.puts " - skipping #{ accepted_corrections_file_name }"
next
end
total_count += 1
# prepare paths
content_at_file_name = accepted_corrections_file_name.gsub(
accepted_corrections_base_dir,
content_base_dir
).gsub(
/\.accepted_corrections\.txt\z/, '.at'
)
output_file_name = content_at_file_name
begin
# First apply all corrections that can be done automatically
outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_auto(
File.read(accepted_corrections_file_name),
File.read(content_at_file_name),
content_at_file_name,
)
if outcome.success
# write to file
at_with_accepted_corrections = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_accepted_corrections)
auto_success_count += 1
$stderr.puts " + Auto-merged accepted corrections from #{ accepted_corrections_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }"
end
# Second apply manual corrections.
outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_manually(
File.read(accepted_corrections_file_name),
File.read(content_at_file_name),
content_at_file_name,
)
if outcome.success
# Nothing needs to be written to file. This has already been done
# manually in the editor.
manual_success_count += 1
$stderr.puts " + Manually merged accepted corrections from #{ accepted_corrections_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ accepted_corrections_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ total_count } files in #{ Time.now - start_time } seconds:"
$stderr.puts " - Auto-merges: #{ auto_success_count } files."
$stderr.puts " - Manual merges: #{ manual_success_count } files."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def corrections; end",
"def sync_from_at(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n Repositext::Cli::Utils.convert_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n \"Synching AT files to PT\",\n options\n ) do |contents, filename|\n # Remove AT specific tokens\n pt = Suspension::TokenRemover.new(\n contents,\n Suspension::AT_SPECIFIC_TOKENS\n ).remove\n [Outcome.new(true, { contents: pt, extension: '.md' })]\n end\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def transfer_correction(coordinator, _all_corrected_ruby_lines, haml_lines)\n to_ruby_lines = coordinator.extract_from_corrected_lines(@start_marker_line_number, @ruby_lines.size)\n transfer_correction_logic(coordinator, to_ruby_lines, haml_lines)\n end",
"def corrections\n #For each word to be looked at\n $words.each do |word_array|\n #If the word is misspelled attempt corrections\n possible_matches = Array.new\n if word_array[1] == false\n #Sets word to the actual word, instead of array pair\n word = word_array[0]\n # Get lexicon searching vars\n first_char = word[0]\n len = word.length\n\n ##Find words with similar letters\n #Saves the length of the word for eaiser access\n size = word.length\n #Iterates over words with matching starting letter and length +- 1\n $lexicon[first_char][len].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n # only check shorter words if length is greater than 1\n if len > 1\n $lexicon[first_char][len-1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n end\n\n $lexicon[first_char][len+1].each do |word_compare|\n possible_matches << word_compare[0]\n end\n\n #Iterate over the possible matches, taking the match with the highest percentage\n #Hash to hold similarity\n similarity = Hash.new(0.0)\n possible_matches.each do |word_to_compare|\n similarity[word_to_compare] = match_percentage word, word_to_compare\n end\n\n best_match = ''\n similarity.each do |match|\n if match[1] > similarity[best_match]\n best_match = match[0]\n end\n end\n $correction[word] = best_match\n end\n end\nend",
"def check_merge\n\tres = ''\n\tfiles = Dir.glob(\"**/*.rb\") + Dir.glob(\"**/*.yml\") + Dir.glob(\"**/*.feature\")\n\tfiles.each do |file|\n\t\tnb = 0\n\t\tif !file.include? 'convention.rb'\n\t\t\terrors = %w(<<<<< >>>>> ===== binding\\.pry $\\tAnd)\n\t\t\terrors.each do |reg|\n\t\t\t\tnb += File.readlines(file).grep(reg).size\n\t\t\tend\n\t\tend\n\t\tif nb > 0\n\t\t\tres += \"#{file}, \"\n\t\t\t$errors = true\n\t\tend\n\tend\n\n\tif res != ''\n\t\tputs \"Some file seems to be incorrect, with error like <<<<, >>>>, ====, binding.pry...\"\n\t\tputs res\n\tend\nend",
"def check_spelling(files = nil)\n # Installs my fork of the spell checker if needed\n # my fork has line numbers + indexes\n system \"npm install -g orta/node-markdown-spellcheck\" unless mdspell_installed?\n\n # Check that this is in the user's PATH after installing\n raise \"mdspell is not in the user's PATH, or it failed to install\" unless mdspell_installed?\n\n markdown_files = get_files files\n\n arguments = [\"-r\"]\n skip_words = ignored_words || []\n\n arguments.push(\"-n\") if ignore_numbers\n arguments.push(\"-a\") if ignore_acronyms\n arguments.push(\"--#{language}\")\n\n File.write(\".spelling\", skip_words.join(\"\\n\"))\n result_texts = Hash[markdown_files.to_a.uniq.collect { |md| [md, `mdspell #{md} #{arguments.join(\" \")}`.strip] }]\n spell_issues = result_texts.select { |path, output| output.include? \"spelling errors found\" }\n File.unlink(\".spelling\")\n\n # Get some metadata about the local setup\n current_slug = env.ci_source.repo_slug\n\n if spell_issues.count > 0\n message = \"### Spell Checker found issues\\n\\n\"\n spell_issues.each do |path, output|\n if defined? @dangerfile.github\n git_loc = \"/#{current_slug}/tree/#{github.branch_for_head}/#{path}\"\n elsif defined? @dangerfile.gitlab\n git_loc = \"/#{current_slug}/tree/#{gitlab.branch_for_head}/#{path}\"\n else\n raise \"This plugin does not yet support bitbucket, would love PRs: https://github.com/dbgrandi/danger-prose/\"\n end\n\n message << \"#### [#{path}](#{git_loc})\\n\\n\"\n\n message << \"Line | Typo |\\n\"\n message << \"| --- | ------ |\\n\"\n\n output.lines[1..-3].each do |line|\n index_info = line.strip.split(\"|\").first\n index_line, index = index_info.split(\":\").map { |n| n.to_i }\n\n file = File.read(path)\n\n unknown_word = file[index..-1].split(\" \").first\n\n error_text = line.strip.split(\"|\")[1..-1].join(\"|\").strip\n error = error_text.gsub(unknown_word, \"**\" + unknown_word + \"**\")\n\n message << \"#{index_line} | #{error} | \\n\"\n end\n markdown message\n end\n end\n end",
"def necessary_spellings\n spellings = []\n if necessary_file\n File.readlines(necessary_file).each do |line|\n line.strip!\n spellings << line unless line == \"\"\n end\n end\n spellings\n end",
"def autocorrect_preceding_comments(corrector, comment); end",
"def support_autocorrect?; end",
"def corrections\n candidates = paths.flat_map(&:all_template_paths).uniq\n\n if partial\n candidates.select!(&:partial?)\n else\n candidates.reject!(&:partial?)\n end\n\n # Group by possible prefixes\n files_by_dir = candidates.group_by(&:prefix)\n files_by_dir.transform_values! do |files|\n files.map do |file|\n # Remove prefix\n File.basename(file.to_s)\n end\n end\n\n # No suggestions if there's an exact match, but wrong details\n if prefixes.any? { |prefix| files_by_dir[prefix]&.include?(path) }\n return []\n end\n\n cached_distance = Hash.new do |h, args|\n h[args] = -DidYouMean::Jaro.distance(*args)\n end\n\n results = Results.new(6)\n\n files_by_dir.keys.index_with do |dirname|\n prefixes.map do |prefix|\n cached_distance[[prefix, dirname]]\n end.min\n end.sort_by(&:last).each do |dirname, dirweight|\n # If our directory's score makes it impossible to find a better match\n # we can prune this search branch.\n next unless results.should_record?(dirweight - 1.0)\n\n files = files_by_dir[dirname]\n\n files.each do |file|\n fileweight = cached_distance[[path, file]]\n score = dirweight + fileweight\n\n results.add(File.join(dirname, file), score)\n end\n end\n\n if partial\n results.to_a.map { |res| res.sub(%r{_([^/]+)\\z}, \"\\\\1\") }\n else\n results.to_a\n end\n end",
"def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end",
"def correlate\n correlated = false\n r = nil\n\n # Correlate by address\n if self.address?\n matched_street = self.community.residents.where(\"residents.id != ? AND address ILIKE ? AND last_name ILIKE ?\", self.id, self.address, self.last_name)\n\n if matched_street.count > 0\n matched = matched_street.select { |resident| resident.first_name == self.first_name }\n\n if matched.count > 1\n # Well, what are the odds? =(\n end\n\n if matched.count == 1\n r = matched.first\n\n self.merge_into(r)\n correlated = true\n\n else\n # No match, but might match with a StreetAddress file\n matched_addr = self.community.street_addresses.where(\"address ILIKE ?\",\"%#{self.address}%\")\n\n if matched_addr.count == 1\n street = matched_addr.first\n\n self.street_address = street\n end\n end\n end\n end\n\n # Correlate by email\n if self.email?\n matched_email = self.community.residents.where(\"residents.id != ? AND email ILIKE ?\", self.id, self.email)\n\n # If this happens, then at least one of the files must have been\n # inputted/modified in the organizer app\n if matched_email.count > 1\n end\n\n # Add whatever was inputted to the existing Residents file\n if matched_email.count == 1\n r = matched_email.first\n\n self.merge_into(r)\n\n correlated = true\n end\n end\n\n # If there is neither an address nor an email, then there's a good chance of\n # correlating with the wrong file...so don't correlate\n if correlated\n self.destroy\n end\n\n r\n end",
"def merge(prt_pdb, lig_pdb, complex_pdb)\n prt_lines = File.readlines(prt_pdb)\n lig_lines = File.readlines(lig_pdb)\n\n prt_atm_lines = prt_lines.select { |line| /ATOM/ =~ line }\n lig_atm_lines = lig_lines.select { |line| /HETATM/ =~ line}\n\n f = File.open(complex_pdb, 'w')\n\n f.write(\"MODEL 1\\n\")\n prt_atm_lines.each do |line| f.write(line) end\n f.write(\"TER\\n\")\n lig_atm_lines.each do |line| f.write(line) end\n f.write(\"END\\n\")\n\n f.close()\n\nend",
"def fix_convert_abbreviations_to_lower_case(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.(at|pt|txt)\\z/i,\n \"Converting abbreviations to lower case\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::ConvertAbbreviationsToLowerCase.fix(contents, filename)\n [outcome]\n end\n end",
"def report_invalid_typographic_quotes(options)\n s_quote_open_and_d_quote_close = %(‘”)\n d_quote_open = %(“)\n apostrophe = %(’)\n straight_quotes = %(\"')\n newline = %(\\n)\n all_quotes = [s_quote_open_and_d_quote_close, d_quote_open, apostrophe, straight_quotes].join\n invalid_quotes_rx = /\n (?: # this non-capturing group handles s-quote-open and d-quote-close\n ([#{ s_quote_open_and_d_quote_close }]) # one of s-quote-open or d-quote-close\n [^#{ all_quotes }]* # zero or more non-quote chars inbetween\n \\1 # same quote type as capture group 1\n )\n |\n (?: # this non-capturing group handles d-quote-open\n #{ d_quote_open } # d-quote-open\n [^#{ all_quotes + newline }]* # zero or more non-quote or para chars inbetween\n #{ d_quote_open } # d-quote-open\n )\n /mx # NOTE: we don't handle s-quote-close as this is also used for apostrophes\n output_lines = []\n files_hash = {}\n context_size = 4 # num of chars to add before and after excerpt for context\n\n input_file_spec = options['input'] || 'content_dir/at_files'\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading folio at files\",\n options\n ) do |contents, filename|\n str_sc = Kramdown::Utils::StringScanner.new(contents)\n while !str_sc.eos? do\n if(match = str_sc.scan_until(invalid_quotes_rx))\n quote_type = match[-1]\n position_of_previous_quote = match.rindex(quote_type, -2) || 0\n start_position = [position_of_previous_quote - context_size, 0].max\n excerpt = match[start_position..-1]\n excerpt << str_sc.peek(context_size)\n excerpt = excerpt.inspect\n .gsub(/^\\\"/, '') # Remove leading double quotes (from inspect)\n .gsub(/\\\"$/, '') # Remove trailing double quotes (from inspect)\n files_hash[filename] ||= []\n files_hash[filename] << {\n :line => str_sc.current_line_number,\n :excerpt => excerpt,\n }\n else\n break\n end\n end\n end\n output_lines << \"Detecting invalid typographic quotes\"\n output_lines << '-' * 80\n total_count = 0\n files_hash.to_a.sort { |a,b| a.first <=> b.first }.each do |(filename, instances)|\n output_lines << \"File: #{ filename }\"\n instances.each do |instance|\n total_count += 1\n output_lines << [\n \" - #{ sprintf(\"line %5s\", instance[:line]) }\",\n \" - |#{ instance[:excerpt].truncate_in_the_middle(120) }|\",\n ].join\n end\n end\n output_lines << \"-\" * 80\n output_lines << \"Found #{ total_count } instances of invalid typographic quotes in #{ files_hash.size } files.\"\n output_lines.each { |e| $stderr.puts e }\n report_file_path = File.join(config.base_dir('reports_dir'), 'invalid_typographic_quotes.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Invalid Typographic Quotes in Content\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write output_lines.join(\"\\n\")\n f.write \"\\n\"\n f.write \"Command to generate this file: `repositext report invalid_typographic_quotes`\\n\"\n }\n end",
"def save_cleaned_cor_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n if w.ambigious? and w.clean_tag_ambiguity?\n w.remove_clean_tag_ambiguity\n elsif w.ambigious? and w.noun_gender_ambiguity?\n w.remove_noun_gender_ambiguity\n end\n f.puts '\"<' + w.string + '>\"'\n\n w.tags.each do |t|\n f.puts \"\\t\\\"#{t.lemma}\\\" #{t.string} \" + (t.correct ? \"\\t<Correct!>\" : \"\")\n end\n end\n end\n end\n\n nil\n end",
"def rewrite\n @corrections.each do |correction|\n begin\n @source_rewriter.transaction do\n correction.call(self)\n end\n rescue ErrorWithAnalyzedFileLocation => e\n raise e unless e.cause.is_a?(::Parser::ClobberingError)\n end\n end\n\n @source_rewriter.process\n end",
"def test_match_reference\n parser = CEdictParser.new(Rails.root.join(\"data/cedict/test_data/cedict_parser_match_reference.txt\").to_s)\n entries = parser.run\n assert_equal(6,entries.count)\n assert_equal(1,parser.reference_only_entries.count)\n \n merged_entries = parser.merge_references_into_base_entries(entries,parser.reference_only_entries)\n assert_equal(6,merged_entries.count)\n end",
"def clean2\n content = text.split(\"\\n\")\n \n # First, find and mark songs\n in_song = false\n new_content = []\n content.each do |line|\n if line=~/\\*{5}/ .. line=~END_OF_SONG\n new_content << \"SONG:\" unless in_song\n if line =~ END_OF_SONG\n new_content << line\n in_song = false\n else\n new_content << \" #{line}\"\n in_song = true\n end\n else\n if in_song\n new_content << \"END OF SONG\"\n end\n in_song = false\n new_content << line\n end\n end\n \n # Now, fix line endings and merge lines\n old_content = new_content\n new_content = []\n preserve_breaks = false\n last_line = \"\"\n old_content.each do |line|\n new_content << \"\" if preserve_breaks ||\n last_line =~ END_OF_SONG || \n new_content.size == 0 ||\n line =~ /^.[LS]-\\d+(?:\\]|$|.\\s*\\()/ ||\n line =~ /^\\([A-Z]/ ||\n line =~ /^[A-Z][A-Z, \\.-]+:\\s/ ||\n line =~ /^Scene\\s+\\?\\s+-\\s+\\?/ ||\n line =~ START_OF_SONG ||\n line =~ /^#/\n case line\n when START_OF_SONG\n preserve_breaks = true\n when END_OF_SONG\n preserve_breaks = false\n end\n new_content[-1] += ' ' unless new_content[-1] =~ /^$|\\s$/\n new_content[-1] += line\n last_line = line\n end\n \n # Now, insert extra empty lines\n old_content = new_content\n new_content = []\n extra_space = true\n in_cast = false\n in_song = false\n \n old_content.each do |line|\n if line =~ /^#/\n extra_space = false if in_cast\n else\n in_cast = false\n extra_space = true unless in_song\n end\n new_content << \"\" if extra_space && new_content.size > 0\n new_content << line\n case line\n when /^#CAST FOR SCENE/\n in_cast = true\n when START_OF_SONG\n extra_space = false\n in_song = true\n when END_OF_SONG\n extra_space = true\n in_song = false\n end\n end\n \n # Finally, fix songs\n old_content = new_content\n new_content = []\n i = 0\n while i<old_content.size\n line = old_content[i]\n case line\n when START_OF_SONG\n # Find lines with stars in them\n j = i+1\n while j<old_content.size && old_content[j] !~ END_OF_SONG\n j += 1\n end\n # At this point lines i...j are the song; back up and look for the last \"*****\"\n while j>i && old_content[j] !~ /\\*{5}/\n j -= 1\n end\n # Now lines (i+1)...j are the song information block\n song_information = old_content[(i+1)...j].join\n song_name = song_information[/^[\\s\\*]*([^\\*]+)/,1].strip\n tune = song_information[/([^\\*]+)[\\s\\*]*$/,1].strip\n new_content += [\" SONG: #{song_name}\", \" (To the tune of: #{tune})\"]\n i = j+1\n when END_OF_SONG\n i += 1 # Discard end of song markers; we don't need them anymore\n else\n new_content << line\n i += 1\n end\n end\n \n # Save the results\n text = new_content.join(\"\\n\")\n end",
"def apply_textdelta(file_baton, base_checksum)\n if file_baton[2].nil?\n nil\n else\n do_diff(file_baton[2], file_baton[2])\n end\n end",
"def merge_gap_mark_tagging_import_into_content_at(options)\n gap_mark_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir\n )\n gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(\n gap_mark_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :content_dir\n )\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|\n if gap_mark_tagging_import_file_name !~ /\\.gap_mark_tagging\\.txt\\z/\n next\n end\n\n total_count += 1\n # prepare paths\n content_at_file_name = gap_mark_tagging_import_file_name.gsub(\n gap_mark_tagging_import_base_dir, content_base_dir\n ).gsub(\n /\\.gap_mark_tagging\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(\n File.read(gap_mark_tagging_import_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_tokens = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def modify_line_logic\n f = open($BACK_UCF,\"r\")\n new = open($ORG_UCF,\"w\")\n mode = false\n match = false\n cont = false\n i = 0, j = 0\n target_word = \"\"\n\n while line = f.gets\n\n if/_rt/ =~ line\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n end\n\n if cont == true\n if /^#/ =~ line\n else\n line = \"#\" + line\n end\n if /}\\\";$/ =~ line\n cont = false\n end\n end \n \n $remove_list_bld.each do |net|\n error_net = net.gsub(\"\\/\",\"\\\\/\")\n error_net = error_net.gsub(\"\\[\",\"\\\\[\")\n net = error_net.gsub(\"\\]\",\"\\\\]\")\n if /#{net}/ =~ line\n if /^#/ =~ line\n elsif /\\AINST/ =~ line\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%4d]:%s\", i, line)\n i += 1\n end\n break\n elsif /\\ANET/ =~ line\n cont = true\n line = \"#\" + line\n if $VERBOSE == true\n printf(\"match [%04d]:%s\", i, line)\n i += 1\n end\n break\n else\n printf(\"[E] %s\", line)\n exit\n end\n end\n end\n if (j / 100) == 0\n printf(\".\")\n end\n j += 1\n new.write(line)\n end\n f.close\n printf(\"\\n\")\nend",
"def find_replacement_translations(locale, variant_words, translations)\n pp \"Processing #{locale} strings\"\n unchanged = []\n to_be_replaced = []\n variant_words.each do |dict|\n current = dict[:source]\n origin = dict[:origin]\n replacement = dict[:target]\n # keeping a tally of how many will not change due to both current\n # and replacement being the same\n if current == replacement\n unchanged << { current: current, replacement: replacement }\n next\n end\n if current == '--'\n t = translations.where('copy LIKE ?', \"%#{origin}%\")\n puts \"#{t.count} strings found in #{locale} for #{origin}\"\n else\n t = translations.where('copy LIKE ?', \"%#{current}%\")\n puts \"#{t.count} strings found in #{locale} for #{current}\"\n end\n # t = translations.where(source_copy: source)\n # count = t.count\n # t = t.concat(fuzzy_match)\n unless (t.nil? or t.empty?) && current[0] != replacement[0]\n # pp \"#{current[0]} matched #{replacement[0]}\"\n t.each do |row|\n # exact match with word boundaries around the word\n # this will prevent words being part of ids/classes\n # and it will also prevent words like \"Unenroll\"\n # it's looking for \"enroll\"\n unless row.copy.match(/#{current}\\b/)\n next\n end\n if current[0] == replacement[0]\n pp \"#{current} will be replaced with #{replacement}\"\n end\n rep = {\n locale: locale,\n source: row.source_copy,\n current: row.copy,\n replacement: row.copy && row.copy.gsub(current, replacement),\n id: row.id,\n word: replacement,\n }\n if rep[:current] != rep[:replacement]\n puts \"Current and replacmeent match: #{rep[:current]} == #{rep[:replacement]}\"\n begin\n if rep[:replacement].strip_html_tags == rep[:replacement]\n to_be_replaced << rep\n else\n pp \"Stripped #{rep[:replacement]} and didn't add to list\"\n end\n end\n end\n end\n end\n end\n puts \"Ignoring: #{unchanged.size} strings\"\n puts \"Changing: #{to_be_replaced.size} strings\"\n to_be_replaced\nend",
"def report_content_sources(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n folio_import_base_dir = config.base_dir('folio_import_dir')\n idml_import_base_dir = config.base_dir('idml_import_dir')\n total_count = 0\n folio_sourced = []\n idml_sourced = []\n other_sourced = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n idml_input_filename = filename.gsub(content_base_dir, idml_import_base_dir)\n .gsub(/\\.at/, '.idml.at')\n folio_input_filename = filename.gsub(content_base_dir, folio_import_base_dir)\n .gsub(/\\.at/, '.folio.at')\n if File.exists?(idml_input_filename)\n idml_sourced << filename\n elsif File.exists?(folio_input_filename)\n folio_sourced << filename\n else\n other_sourced << filename\n end\n end\n\n lines = [\n \"List sources of content_at files\",\n '-' * 40,\n ]\n if idml_sourced.any?\n lines << \" - The following #{ idml_sourced.length } content AT files are sourced from Idml:\"\n idml_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Idml.\"\n end\n if folio_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are sourced from Folio:\"\n folio_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Folio.\"\n end\n if other_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are from other sources:\"\n other_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files from other sources.\"\n end\n lines << '-' * 40\n lines << \"Sources summary:\"\n lines << \" - Idml: #{ idml_sourced.length }\"\n lines << \" - Folio: #{ folio_sourced.length }\"\n lines << \" - Other: #{ other_sourced.length }\"\n total_sourced = idml_sourced.length + folio_sourced.length + other_sourced.length\n lines << \"Determined sources for #{ total_sourced } of #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'content_sources.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report content_sources`\\n\"\n }\n end",
"def add_after_or_append(filename, matching_text, text_to_add, before_text, after_text)\n content = File.read(filename)\n if content.include?(matching_text)\n add_after(filename, matching_text, text_to_add)\n else\n append_file(filename, [before_text, text_to_add, after_text].join(\"\\n\"))\n end\n end",
"def corrections()\n return [] if !defined?(@corrections)\n return @corrections \n end",
"def fix_syntax_errors!\n # 1.34\n # patch_file! \"common/on_actions/00_on_actions.txt\" do |content|\n # content.gsub(/(effect = )\"(.*?)\"/m){ $1 + \"{\" + $2 + \"}\" }\n # end\n end",
"def report_long_editor_notes(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n total_file_count = 0\n total_editor_notes_count = 0\n long_editor_notes_count = 0\n long_editor_notes = []\n char_cutoff = 240\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_file_count += 1\n str_sc = Kramdown::Utils::StringScanner.new(contents)\n while !str_sc.eos? do\n if(str_sc.skip_until(/(?=\\[)/))\n start_line = str_sc.current_line_number\n if(editor_note = str_sc.scan(/\\[[^\\]]*\\]/))\n total_editor_notes_count += 1\n num_chars = editor_note.length\n next if num_chars < char_cutoff\n long_editor_notes_count += 1\n long_editor_notes << {\n :filename => filename,\n :line => start_line,\n :editor_note => editor_note.truncate_in_the_middle(120),\n :num_chars => num_chars,\n }\n else\n raise \"Unbalanced bracket\"\n end\n else\n str_sc.terminate\n end\n end\n end\n\n lines = [\n \"Editor notes with more than #{ char_cutoff } characters\",\n '-' * 40,\n ]\n long_editor_notes.each { |e|\n lines << \" - #{ e[:filename].split('/').last } - line #{ e[:line] } - #{ e[:num_chars] } chars - #{ e[:editor_note].inspect }\"\n }\n lines << '-' * 40\n lines << \"Found #{ long_editor_notes_count } of #{ total_editor_notes_count } editor notes with more than #{ char_cutoff } chars in #{ total_file_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'long_editor_notes.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report long_editor_notes`\\n\"\n }\n end",
"def updateAndCheckConflicts\n rError = nil\n\n lConflicts = []\n # Execute svn update\n change_dir(@LocalRepository) do\n `svn update --accept=postpone #{@StrFiles}`.split(\"\\n\").each do |iLine|\n # Check that this line does not tell about a conflict\n if (iLine.strip[0..0] == 'C')\n # There is a conflict\n lConflicts << iLine.strip[1..-1].strip\n end\n end\n end\n # Sum up conflicts\n if (!lConflicts.empty?)\n rError = UpdateConflictError.new(\"The following files are in conflict: #{lConflicts.join(', ')}. Please resolve the conflict by updating before committing.\")\n end\n\n return rError\n end",
"def translator(file)\n #Opens the file\n text = File.read(file)\n #Check the content for any non vocals -> adds an o and the non vocal instead\n replace = text.gsub!(/([bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ])/, '\\1o\\1')\n #Replace the original content with translated content\n File.open(file, \"w\") {|z| z.puts replace}\nend",
"def correct(word)\n if @dictionary.has_key?(word)\n return [word]\n end\n \n dist1_replacements = known(edits1(word))\n if dist1_replacements.length != 0\n \treturn dist1_replacements.sort_by{|value| @dictionary[value]}.reverse\n end\n \n dist2_replacements = known_edits2(word)\n if dist2_replacements.length != 0\n \treturn dist2_replacements.sort_by{|value| @dictionary[value]}.reverse\n end\n return nil\n end",
"def text_file_scan_and_rewrite(my_file_name)\n\n textfile = File.open(my_file_name, 'r+') #open file for read/write\n\n all_lines_from_file = textfile.read #read all the records in the file\n\n if word_position = all_lines_from_file =~ /word/ #check for \"word\" and if found note position in string\n all_lines_from_file.insert(word_position, 'inserted ') #put \"inserted \" in front of \"word\"\n textfile.rewind #reset to beginning of file\n textfile.puts all_lines_from_file #write new data to file\n end\n textfile.close\nend",
"def merge(*files)\n files.each do |f|\n f = check_for_file(f)\n @merged << f\n end\n end",
"def filename_completion\n#p @tmpl_doc.basename_orig\n#p @cfg[:append_doc]\n#p Dyndoc.docExt(@cfg[:format_doc])\n ext_mode=nil\n if @tmpl_doc.basename_orig =~ /\\_(html|tex|c|rb|txtl|md|txt|raw)$/\n @cfg[:cmd] += [:make_content,:save]\n ext_mode=$1.to_sym\n @cfg[:format_doc]=@cfg[:mode_doc]=@cfg[:format_output]=(ext_mode == :raw ? :txt : ext_mode )\n last=-(2 + $1.length)\n else\n last=-1\n end\n ##DEBUG:\n p [@tmpl_doc.basename_orig[0..last],@tmpl_doc.cfg[:append],@cfg[:append_doc],@cfg[:format_doc],Dyndoc.docExt(ext_mode || @cfg[:format_doc])]\n @cfg[:filename_doc]=@tmpl_doc.basename_orig[0..last]+@tmpl_doc.cfg[:append]+@cfg[:append_doc]+Dyndoc.docExt(ext_mode || @cfg[:format_doc]) if @cfg[:filename_doc].empty?\n ##p [:filename_completion,@filename,@cfg[:filename_doc] ]\n end",
"def to_check file_to_check\n #Opens the file to check\n file = File.open(file_to_check, 'r')\n #Reads until the end of the file\n until file.eof?\n #For each line check the spelling of each word\n file.each_line do |line|\n line.chomp!.downcase!\n #cleans punctuation\n line.gsub!($remove_punctuation, \"\")\n #Removes numbers since they can't be spelled wrong\n line.gsub!(/\\d/, \"\")\n line.split.each do |word|\n $words[word] = false\n end\n end\n end\nend",
"def beautify(file)\r\n\r\n @log.debug(\" Cleaning: \\\"#{file}\\\"\")\r\n\r\n docfile = File.new(file)\r\n olddoc = docfile.readlines.join\r\n docfile.close\r\n \r\n # process the file in pandoc\r\n cmd=\"pandoc -s #{file.esc} -f markdown -t markdown --atx-headers --reference-links \"\r\n newdoc = `#{cmd}`\r\n @log.debug(\" finished: \\\"#{file}\\\"\")\r\n \r\n # tweak the quoting\r\n if $?.success? then \r\n # do this twice since the replacement\r\n # does not work on e.g. 2\\_3\\_4\\_5.\r\n #\r\n newdoc.gsub!(/(\\w)\\\\_(\\w)/, '\\1_\\2')\r\n newdoc.gsub!(/(\\w)\\\\_(\\w)/, '\\1_\\2')\r\n \r\n # fix more quoting\r\n newdoc.gsub!('-\\\\>[', '->[')\r\n\r\n # (RS_Mdc)\r\n # TODO: fix Table width toggles sometimes\r\n if (not olddoc == newdoc) then ##only touch the file if it is really changed\r\n File.open(file, \"w\"){|f| f.puts(newdoc)}\r\n File.open(file+\".bak\", \"w\"){|f| f.puts(olddoc)} # (RS_Mdc_) # remove this if needed\r\n @log.debug(\" cleaned: \\\"#{file}\\\"\")\r\n else\r\n @log.debug(\"was clean: \\\"#{file}\\\"\")\r\n end\r\n #TODO: error handling here\r\n else\r\n @log.error(\"error calling pandoc - please watch the screen output\")\r\n end\r\n end",
"def save_ambigious_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n tag_strings = ['unkjent_ord'] if tag_strings.count == 0\n f.puts w.norm_string + \"\\t\" + tag_strings.sort.join(\"\\t\")\n end\n\n f.puts\n end\n end\n\n nil\n end",
"def report_long_editor_notes(options)\n total_file_count = 0\n total_editor_notes_count = 0\n long_editor_notes_count = 0\n long_editor_notes = []\n char_cutoff = 240\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n total_file_count += 1\n str_sc = Kramdown::Utils::StringScanner.new(content_at_file.contents)\n while !str_sc.eos? do\n if(str_sc.skip_until(/(?=\\[)/))\n start_line = str_sc.current_line_number\n if(editor_note = str_sc.scan(/\\[[^\\]]*\\]/))\n total_editor_notes_count += 1\n num_chars = editor_note.length\n next if num_chars < char_cutoff\n long_editor_notes_count += 1\n long_editor_notes << {\n :filename => content_at_file.filename,\n :line => start_line,\n :editor_note => editor_note.truncate_in_the_middle(120),\n :num_chars => num_chars,\n }\n else\n raise \"Unbalanced bracket\"\n end\n else\n str_sc.terminate\n end\n end\n end\n\n lines = [\n \"Editor notes with more than #{ char_cutoff } characters\",\n '-' * 40,\n ]\n long_editor_notes.each { |e|\n lines << \" - #{ e[:filename].split('/').last } - line #{ e[:line] } - #{ e[:num_chars] } chars - #{ e[:editor_note].inspect }\"\n }\n lines << '-' * 40\n lines << \"Found #{ long_editor_notes_count } of #{ total_editor_notes_count } editor notes with more than #{ char_cutoff } chars in #{ total_file_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir(:reports_dir), 'long_editor_notes.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report long_editor_notes`\\n\"\n }\n end",
"def correct(word)\n if (known([word]).count>0)\n return known([word])\n elsif (known(edits1(word)).count>0)\n return known(edits1(word))\n elsif (known_edits2(word).count>0)\n return known_edits2(word)\n else\n return nil\n end\n\n end",
"def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end",
"def fix_convert_folio_typographical_chars(options)\n input_file_spec = options['input'] || 'folio_import_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.(at|pt|txt)\\z/i,\n \"Changing typographical characters in files\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::ConvertFolioTypographicalChars.fix(contents, filename)\n [outcome]\n end\n end",
"def read_post_text_files\n open(MENTION_FILE, 'r:UTF-8') do |file|\n @reply_mention_text = file.readlines.collect{|line| line.strip}\n end\n\n open(NOTMEITAN_FILE, 'r:UTF-8') do |file|\n @notmeitan_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_CSHARP_FILE, 'r:UTF-8') do |file|\n @reply_csharp_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_MORNING_FILE, 'r:UTF-8') do |file|\n @reply_morning_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_SLEEPING_FILE, 'r:UTF-8') do |file|\n @reply_sleeping_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_DEPARTURE_FILE, 'r:UTF-8') do |file|\n @reply_departure_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_RETURN_FILE, 'r:UTF-8') do |file|\n @reply_return_text = file.readlines.collect{|line| line.strip}\n end\n\n log 'notmeitan text:'\n for s in @notmeitan_text do\n log ' ' + s\n end\n\n log 'reply text:'\n for s in @reply_mention_text do\n log ' ' + s\n end\n\n log 'reply csharp text:'\n for s in @reply_csharp_text do\n log ' ' + s\n end\n\n log 'reply departure text:'\n for s in @reply_departure_text do\n log ' ' + s\n end\n\n log 'reply returning text:'\n for s in @reply_return_text do\n log ' ' + s\n end\n end",
"def check_correct_spellings(review_text_array)\n speller = FFI::Aspell::Speller.new('en_US')\n # speller.suggestion_mode = Aspell::NORMAL\n\n review_text_array_temp = []\n\n # iterate through each response\n review_text_array.each do |review_text|\n review_tokens = review_text.split(\" \")\n review_text_temp = \"\"\n\n # iterate through tokens from each response\n review_tokens.each do |review_tok|\n # check the stem word's spelling for correctness\n unless speller.correct?(review_tok)\n review_tok = speller.suggestions(review_tok).first unless speller.suggestions(review_tok).first\n end\n\n review_text_temp += \" \"\n review_text_temp += review_tok.downcase\n end\n\n review_text_array_temp << review_text_temp\n end\n\n return review_text_array_temp\n end",
"def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\n end",
"def reformattedFile(theArgs, theFile)\n\n\t# Apply the formatters\n\t#\n\t# uncrustify is used to perform code transformations, such as\n\t# adjusting parentheses or braces.\n\t#\n\t# clang-format is then used to perform code reformatting.\n\t#\n\tpathConfigUC = \"#{theArgs[:config]}/#{FILE_CONFIG_UNCRUSTIFY}\";\n\t\n\ttheText =\t`cat \"#{theFile}\" | \\\n\t\t\t\t\"#{PATH_UNCRUSTIFY}\" -q -l CPP -c \"#{pathConfigUC}\" | \\\n\t\t\t\t\"#{PATH_CLANG_FORMAT}\" -style=file`;\n\n\n\n\t# Apply additional rules\n\tif (!theArgs[:clang])\n\t\ttheLines = splitLines(\t\t\ttheText);\n\t\ttheLines = formatComments(\t\ttheLines);\n\t\ttheLines = formatPreprocessor(\ttheLines);\n\t\ttheLines = formatScopes(\t\ttheLines);\n\t\ttheLines = formatIndents(\t\ttheLines);\n\n\t\ttheText = combineLines(\t\t\ttheLines);\n\t\ttheText = rewriteCopyright(\t\ttheText, theFile);\n\t\ttheText = rewriteHeaderGuard(\ttheText, theFile);\n\t\ttheText = rewriteGroups(\t\ttheText);\n\tend\n\n\treturn theText;\n\nend",
"def main (max_char, prefix, suffix)\r\n # Variable Definitions\r\n input_folder = 'Original/' # Folder of original files\r\n output_folder = 'Wrapped/' # Folder of processed files\r\n file_name = '' # The name of the file (test.rb)\r\n file_path = '' # The path of the file (folder/test.rb)\r\n output_path = '' # The path of the output file\r\n original_arr = [] # The lines of the original file\r\n wordwrapped_arr = [] # The formatxted file lines\r\n # Check if USER VARIABLES are valid.\r\n check_user_variables()\r\n # Get the name of the file that will be word wrapped.\r\n file_name = get_input_file_name()\r\n # Concatenate the folder name and file name to give a path so that the\r\n # file can be searched for later.\r\n file_path = input_folder + file_name\r\n # Check that the file_path is valid, if not the program will exit.\r\n check_input_file(file_path)\r\n # Now that the file path is vaild, read the file contents and save to\r\n # the array.\r\n original_arr = read_input_file(file_path)\r\n # Check the original_arr and make sure that no comment line is longer than\r\n # the max specified \r\n wordwrapped_arr = word_wrap(original_arr, max_char)\r\n # Create a path for the output file to go\r\n output_path = create_output_path(output_folder, file_name, prefix, suffix)\r\n # Write the formatted array to the output file\r\n write_formatted_file(wordwrapped_arr, output_path)\r\n puts(\"Formatting Succeded.\")\r\nend",
"def spellcheck\n lines = ::File.open(@file_path).readlines\n lines.each_with_index do |line, line_index|\n check_line(line, line_index + 1)\n end\n @incorrect_words\n end",
"def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end",
"def update_files\n PhrasingPhrase.transaction do\n # 1) Get file contents as keys and values\n keys_and_values = yml_to_keys_and_values\n old_version_keys_and_values = keys_and_values.clone\n\n # 2) Update all translated values in keys_and_values\n puts \"Updating..\"\n phrasing_phrases.each do |phrase|\n print \".\"\n next if phrase.key == phrase.value\n\n @word_counter.update(keys_and_values[\"#{phrase.locale}.#{phrase.key}\"], phrase.yml_value)\n\n keys_and_values[\"#{phrase.locale}.#{phrase.key}\"] = phrase.yml_value\n end\n\n # 3) Update keys_and_values to same yml file\n if @word_counter.has_change?\n # Create last version file entry in releases\n create_to_recent_version_entry_for(old_version_keys_and_values)\n # Update root file to new version\n update_as_next_root_version(keys_and_values)\n end\n\n # 4) Delete All Database Records for lang\n # phrasing_phrases.delete_all\n\n display_word_count\n\n # Return true for successfull execution\n return @word_counter.has_change?\n end\n end",
"def corrected?()\n return (defined?(@corrections) and @corrections.exists? and !@corrections.empty?)\n end",
"def fill_in_missing_transcriptions\n text=\" \\n\"\n empty_items=self.master_files.where(:transcription_text => nil)\n if empty_items.count > 0\n empty_items.each do |item|\n item.transcription_text=text unless item.transcription_text\n item.save! \n item.reload\n if item.exists_in_repo?\n Fedora.add_or_update_datastream(item.transcription_text, item.pid,\n 'transcription', 'Transcription', :contentType => 'text/plain',\n :mimeType => 'text/plain', :controlGroup => 'M')\n end\n end\n end\n end",
"def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n path = working_join file\n File.copy(path, path + \".resolve\" + File.extname(path))\n \n # try to merge the files!\n merge_state.resolve(file, working_changeset, merge_changeset)\n \n # restore the backup to .orig (overwriting the old one)\n File.move(path + \".resolve\" + File.extname(path), path + \".orig\" + File.extname(path))\n end",
"def update_codeword_matches(guess_type, guesses)\n\t\t@codeword_matches.each do |word|\n\t\t\tguesses.each do |letter|\n\t\t\t\t# conditionals narrow matches after each guess is made\n\t\t\t\tif (guess_type == 'correct' && word.include?(letter))\n\t\t\t\t\tcompare_letters(word, letter)\n\t\t\t\telsif (guess_type == 'correct' && !word.include?(letter))\n\t\t\t\t\t@codeword_matches.delete(word)\n\t\t\t\telsif (guess_type == 'incorrect' && word.include?(letter))\n\t\t\t\t\t@codeword_matches.delete(word)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def manipulate_file\n\t\tref = \"<w:attachedTemplate r:id=\\\"rId1\\\"/>\"\n\n\t\tif not File.stat(datastore['SOURCE']).readable?\n\t\t\tprint_error(\"Not enough rights to read the file. Aborting.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#lets extract our docx and store it in memory\n\t\tzip_data = unzip_docx\n\n\t\t#file to check for reference file we need\n\t\tfile_content = zip_data[\"word/settings.xml\"]\n\t\tif file_content.nil?\n\t\t\tprint_error(\"Bad \\\"word/settings.xml\\\" file, check if it is a valid .docx.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#if we can find the reference to our inject file, we don't need to add it and can just inject our unc path.\n\t\tif not file_content.index(\"w:attachedTemplate r:id=\\\"rId1\\\"\").nil?\n\t\t\tvprint_status(\"Reference to rels file already exists in settings file, we dont need to add it :)\")\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t# lets zip the end result\n\t\t\tzip_docx(zip_data)\n\t\telse\n\t\t\t#now insert the reference to the file that will enable our malicious entry\n\t\t\tinsert_one = file_content.index(\"<w:defaultTabStop\")\n\n\t\t\tif insert_one.nil?\n\t\t\t\tinsert_two = file_content.index(\"<w:hyphenationZone\") # 2nd choice\n\t\t\t\tif not insert_two.nil?\n\t\t\t\t\tvprint_status(\"HypenationZone found, we use this for insertion.\")\n\t\t\t\t\tfile_content.insert(insert_two, ref )\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tvprint_status(\"DefaultTabStop found, we use this for insertion.\")\n\t\t\t\tfile_content.insert(insert_one, ref )\n\t\t\tend\n\n\t\t\tif insert_one.nil? && insert_two.nil?\n\t\t\t\tprint_error(\"Cannot find insert point for reference into settings.xml\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\t#update the files that contain the injection and reference\n\t\t\tzip_data[\"word/settings.xml\"] = file_content\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t#lets zip the file\n\t\t\tzip_docx(zip_data)\n\t\tend\n\t\treturn 0\n\tend",
"def master_text_changed(master_text)\n master_text.localized_texts.where(needs_entry: false).update_all(needs_review: true)\n end",
"def test_file_must_contain_fuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"\\tnew line\", :position => Cfruby::FileEdit::APPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"\\tnew line\\n\", lines[-1])\n\t\t}\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => true, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(false, added, \"file_must_contain added the fuzzy match when it shouldn't have\")\n\n\t\tadded = Cfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :fuzzymatch => false, :position => Cfruby::FileEdit::APPEND)\n\t\tassert_equal(true, added, \"file_must_contain didn't add the strict match when it should have\")\n\t\t\n\t\t# test regexp escaping with fuzzymatch\n\t\tassert_nothing_raised() {\n\t\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, '0 0 * * 5 /usr/local/sbin/pkg_version -v -L =', :fuzzymatch=>true)\n\t\t}\n\t\t\n\t\t@resolvfile = Tempfile.new('test')\n\t\t@resolvefilecontents = <<FILEBLOCK\n# our servers\nnameserver 69.9.164.130\nnameserver 69.9.164.131\nFILEBLOCK\n\t\t@resolvfile.write(@multilinefilecontents)\n\t\t@resolvfile.close(false)\n\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'domain titanresearch.com', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.130', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.164.131', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 66.180.175.18', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.191.4', :fuzzymatch=>true)\n\t\tCfruby::FileEdit.file_must_contain(@resolvfile.path, 'nameserver 69.9.160.191', :fuzzymatch=>true)\n\t\t\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'domain titanresearch.com'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.130'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.164.131'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 66.180.175.18'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.191.4'))\n\t\tassert_equal(true, Cfruby::FileEdit.contains?(@resolvfile.path, 'nameserver 69.9.160.191'))\n\tend",
"def distribute_all_answers_if_none_pending\n # only execute if text changed\n if self.changes.keys.include?(\"text\") && self.changes[\"text\"].first.blank?\n answers = self.question.answers\n if answers.pending.count == 0\n AnswerMailer.all_answers(self.question, answers.pluck(:email)).deliver\n end\n end\n end",
"def compare_errs(file1, file2)\n pattern = /^(No warnings or errors were found\\.)|(\\d warnings?, \\d errors? were found!)/\n content1 = nil\n content2 = nil\n\n gnu_emacs = config_matches?('gnu-emacs', 'yes')\n emacs_pattern = /^.*(#{File.basename(self.source_file)}:.*)/i\n\n if File.exists?(file1)\n tmp = File.open(file1) { |f| f.readlines }\n content1 = tmp.take_while { |line| line !~ pattern }\n content1 << tmp[content1.count] unless tmp[content1.count].nil?\n if gnu_emacs\n content1.map! do |line|\n line.match(emacs_pattern) { |m| m[1] }\n end\n end\n end\n\n if File.exists?(file2)\n tmp = File.open(file2) { |f| f.readlines }\n content2 = tmp.take_while { |line| line !~ pattern }\n content2 << tmp[content2.count] unless tmp[content2.count].nil?\n if gnu_emacs\n content2.map! do |line|\n line.match(emacs_pattern) { |m| m[1] }\n end\n end\n end\n\n content1 == content2\n end",
"def merge_to_project(options = {})\n $merge = true \n @opt = {\n :proj_id => nil, \n :person_id => nil,\n :postfix_otu_names => false,\n :postfix_chr_names => false\n }.merge!(options.symbolize_keys)\n\n return false if !@opt[:proj_id] || !@opt[:person_id]\n return false if !@proj = Proj.find(@opt[:proj_id])\n return false if !@person = Person.find(@opt[:person_id])\n\n $proj_id = @proj.id \n $person_id = @person.id\n\n begin\n Proj.transaction do \n # try and do a little matching/transfer in a few cases (could also extend to Keywords)\n self.content_types.each do |o|\n if ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n # update the templates \n self.content_templates_content_types.each do |ctct|\n if ctct.content_type.name == ct.name\n ctct.content_type = ct\n ctct.save\n end\n end\n \n # update the content\n self.contents.each do |c|\n if c.content_type.name == ct.name\n c.content_type = ct\n c.save\n end\n end \n\n # update the mapped_chr_groups\n self.chr_groups.each do |cg|\n if !cg.content_type.blank? && cg.content_type.name == ct.name\n cg.content_type = ct\n cg.save\n end\n end \n # we have to only delete the merged object below\n end\n end\n\n self.genes.each do |g|\n if g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => g.name})\n self.primers.each do |p|\n p.gene = g\n p.save\n end\n self.seqs.each do |s|\n s.gene = g\n s.save\n end\n end\n end\n\n # loop the remaining types\n [:has_many, :has_one, :has_and_belongs_to_many].each do |rel|\n Proj.reflect_on_all_associations(rel).collect{|o| o.name}.each do |r| # r is the class name \n next if r == :text_content_types\n case r\n when :content_types \n self.send(r).each do |o|\n if @ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :genes\n self.send(r).each do |o|\n if @g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :people\n # do nothing, these remain in the project to be deleted later, otherwise they get touched an pwds get borked\n\n else \n t = self.send(r).each do |o|\n @o = o\n @r = r\n o.name = \"#{o.name} [from: #{o.proj_id}]\" if (@opt[:postfix_otu_names] && o.class == Otu) || (@opt[:postfix_chr_names] && o.class == Chr)\n o.proj_id = @opt[:proj_id]\n o.save\n end\n end\n end\n end # end rel types\n end # end transaction\n\n rescue Exception => e\n $merge = false\n raise \"#{e} o:(#{@o.to_yaml}) o_class: #{@o.class.to_s} r:(#{@r}) p:(#{@proj.id})\"\n end\n $merge = false\n true\n end",
"def correction \nend",
"def fix_offenses!\n run \"rubocop -a --format=simple\"\n end",
"def hot_fixes(text)\n text\n end",
"def ask_for_several_change_in_file line_to_change, file_path\n if @change_all\n puts \"\\n\\e[39m******************************************\"\n puts '* *'\n puts '* Automatically changes has been started *'\n puts '* *'\n puts \"\\nFile: #{file_path}\\n\\n\"\n return true\n end\n puts \"\\n\\e[39m******************************************\"\n puts '* *'\n puts '* Follow the instructions below to *'\n puts '* make changes in file *'\n puts \"\\nPhrase:\\n #{line_to_change}\\nfound in file:\\n#{file_path}\\n\"\n print \"\\e[31m\\e[1;4m\\nDo I have to change this phrase [y/n/all] (default \\e[32m\\e[1;4mYes\\e[31m) ?\\n\"\n choise = STDIN.gets.chomp.upcase\n res = false\n if choise == 'Y' || choise.length == 0\n res = true\n elsif choise == 'A'\n res = true\n @change_all = true\n end\n res\n end",
"def fixOriginalInput_CommunityFile()\n #check for traditional signs of an OTU table format and fix if necessary\n cRead = File.open(@communityFile, \"r\")\n line1 = cRead.gets\n line2 = cRead.gets\n cRead.close()\n\n stringCheck1 = \"\\# QIIME\\ v1.2.0\\ OTU\\ table\" \n #stringCheck1 =\"\\#Full \\OTU\\ Counts\"\n stringCheck2 = \"Consensus\\ Lineage\"\n\n headerCheckBool = 0\n otuLabelCheckBool = 0\n\n headerCheckBool = 1 if line1 =~ /#{stringCheck1}/\n otuLabelCheckBool = 1 if line1 =~ /#{stringCheck2}/ || line2 =~ /#{stringCheck2}/\n\n #if we have an OTU table that needs fixed\n #if headerCheckBool == 1 || otuLabelCheckBool == 1\n newCommFile = File.basename(@communityFile).gsub(/#{File.extname(@communityFile)}/, \"-communityFixed.dat\")\n newCommFile=\"#{outputDirectory}/#{newCommFile}\"\n w = File.open(newCommFile, \"w\") \n\n #loop through community file and output updated file\n cRead = File.open(@communityFile, \"r\")\n #ignore first line if we have a header line unique to OTU tables\n cRead.gets if headerCheckBool == 1\n \n #read through OTU table and fix the following issues:\n # -rename [0,0] to 'sites'\n # -add an 'X' to beginning of names to avoid data type issues\n # -replace -s with _s\n # -remove ' 's\n # -remove OTU tag if applicable\n \n header = cRead.gets\n headerSplit = header.split(\"\\t\")\n headerSize = headerSplit.length\n headerSize -= 1\n #add one position to header length if we do not need to subtract for\n # OTU label\n headerSize += 1 if otuLabelCheckBool == 0\n \n #print out each header value minus last value if we have OTU labels\n for pos in (0...headerSize)\n if pos == 0\n #substitute in name 'sites' at [0,0]\n w.print \"sites\"\n else\n #add 'X' in front of all header values\n sampleName = \"\\tX#{headerSplit[pos].strip}\"\n sampleName.gsub!(/\\-/, \"\")\n sampleName.gsub!(/\\ /, \"\")\n w.print sampleName\n end\n end \n w.puts\n \n #loop through remaining lines after header line\n cRead.each{ |line|\n headerSplit = line.split(\"\\t\")\n for pos in (0...headerSize)\n if pos == 0\n featureName = \"X#{headerSplit[pos]}\"\n featureName.gsub!(/\\-/, \"\")\n featureName.gsub!(/\\ /, \"\")\n w.print featureName\n else\n w.print \"\\t#{headerSplit[pos]}\" \n end \n end\n w.puts\n }\n\n cRead.close()\n w.close()\n\n #save the name of file before transposing so we can use for \n # environment file lookup\n @convertedCommunityFile = newCommFile\n\n #file to contain transposed community file\n transCommFile = newCommFile + \".tr\"\n\n #we then need to transpose this file so it will be compatable for R input\n #create matrix object from brlMatrix.rb\n matrixObject = MatrixWork.new(newCommFile, transCommFile)\n\n #store input as matrix\n commMatrix = matrixObject.file2matrix(nil)\n\n #transpose matrix\n transCommMatrix = commMatrix.t\n\n #export transposed matrix to file\n matrixObject.printMatrix(transCommMatrix, transCommFile)\n\n #update community file to updated file\n @communityFile = fep(transCommFile)\n end",
"def typos_in_file(destination_file)\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tlines = subtitles_object_list.map{ |subtitle| subtitle.get_lines }\n\n\t\twords = get_words(lines.flatten)\n\n\t\ttypos = word_not_in_dictionary(words)\n\n\t\ttypos_list = look_for_typos_in_file(typos, subtitles_object_list)\n\n\t\ttypos_file_content = {}\n\t\ttypos_list.each do |typos_object|\n\t\t\ttypos_file_content.merge!(typos_object) {|k,l,r| [l,r].flatten.join(\", \") }\n\t\tend\n\n\t\t#functionality to ignore words, per example names\n\t\tignored_words = IO.read(\"ignored_words.txt\").split(\"\\n\")\n\n\t\tcontent = \"\"\n\t\ttypos_file_content.each do |word|\n\t\t\tunless ignored_words.include? word[0]\n\t\t\t\tcontent << word[0] + \": \" + word[1] + \"\\n\"\n\t\t\tend\n\t\tend\n\t\tIO.write(destination_file, content)\n\tend",
"def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end",
"def perform_merge\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n result = false\n\n # Mergeable if there are no fields which are non-blank in\n # both descriptions.\n if @src.class.all_note_fields.none? \\\n { |f| src_notes[f].present? && dest_notes[f].present? }\n result = true\n\n # Copy over all non-blank descriptive fields.\n src_notes.each do |f, val|\n @dest.send(\"#{f}=\", val) if val.present?\n end\n\n # Save changes to destination.\n @dest.save\n\n # Copy over authors and editors.\n @src.authors.each { |user| @dest.add_author(user) }\n @src.editors.each { |user| @dest.add_editor(user) }\n\n # Delete old description if requested.\n delete_src_description_and_update_parent if @delete_after\n end\n\n result\n end",
"def propagate_edits\n\n active = @completed[-1]\n\n # If ends with \": ___\", just replace with what's before it\n\n update_this = @pending[@progress[0][0]]\n if active =~ /\\| (.+) : ___$/\n txt = $1\n update_this.sub! /.+? : /, \"#{txt} : \"\n else\n update_this.replace active[/\\| (.+)/, 1]\n end\n end",
"def merge_w2x\n if(/!inc! *([\\/\\w\\d._]+)([\\n])/ =~ @row;@rgx = $~)\n mac = @src_path+'/'+$1 \n src = $~.to_s #;p mac\n if File.exist?(mac)\n pop = $~.captures.pop\n #new = IO.read(mac).delete(\"\\r\").gsub(\"\\n\",\"\\n\"+@spc) \n new = read_w2tags(IO.read(mac))\n @doc_src= @row.gsub(src,new).split(\"\\n\")+@doc_src\n @row= @doc_src.shift+\"\\n\"\n parse_spc\n else\n @row.gsub!(src,\"<!--\"+mac+\", Not Found-->\\n\") \n nil\n end\n end\n end",
"def replace_all(source_text, replacement)\n case\n # For simple cases we just replace runs to try and keep formatting/layout of source\n when replacement.is_a?(String)\n @main_doc.replace_all_with_text(source_text, replacement)\n when (replacement.is_a?(Magick::Image) or replacement.is_a?(Magick::ImageList))\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_run_fragment(create_image_run_fragment(replacement)) }\n when replacement.is_a?(Hash)\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement, {:create_table => true})) }\n when replacement.is_a?(Nokogiri::XML::Element)\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n if replacement.name == \"w:tbl\"\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement)) }\n else\n runs.each { |r| r.replace_with_run_fragment(create_body_fragments(replacement)) }\n end\n else\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement)) }\n end\n end",
"def relevant_output(lint, files)\n all_files = {}\n files.each do |file|\n\n # sometimes data will be blank but this is good - it means no errors were raised in the lint\n next if lint.blank? || file.blank? || !file.is_a?(Hash) || !file.key?(:filename)\n lint_file = lint[file[:filename]]\n\n next if lint_file.blank?\n\n expanded = lines_added_to_range(file)\n revert_name = strip_working_dir(file[:filename])\n\n all_files[revert_name] = []\n\n lint_file.each do |l|\n if expanded.include?(l['line'].to_i)\n all_files[revert_name] << l\n end\n end\n\n # If there's nothing there, then it definitely isn't a relevant lint\n all_files.delete(revert_name) if all_files[revert_name].blank?\n end\n @output[:files_linted] = all_files.keys\n all_files\n end",
"def update_textuals\n\n # FIXME: this will remove all classes from Google Drive, which identify versions (I think) and styling.\n # Fuck it.\n\n markdown_to_html_and_text\n\n make_diffs if file_content_md_changed?\n\n if project.most_recent_work.id == id and file_content_md_changed?\n project.update_columns(\n file_content_md: file_content_md,\n file_content_text: file_content_text,\n file_content_html: file_content_html\n )\n end\n self.delay(:queue => 'preview_maker', priority: 20).create_preview_png\n end",
"def difftotextpst()\n merge(gadrdifftotextpst: 'true')\n end",
"def correction_existent_check\n # Check first if there is a correction\n page_content = PageContent.where(:page_id => self.id).where(:content_type => 'correction').order(id: :asc).last\n\n # If there isn't a correction,\n # Go to the ocr or text extraction\n if !page_content \n page_content = PageContent.where(:page_id => self.id).first\n end\n\n return page_content\n end",
"def difftotextpst()\n merge(rvdifftotextpst: 'true')\n end",
"def autocorrect(corrector, node); end",
"def autocorrect(corrector, node); end",
"def autocorrect(corrector, node); end",
"def test_update_name_merge_with_misspellings\n login(\"rolf\")\n name1 = names(:lactarius_alpinus)\n name2 = names(:lactarius_alpigenes)\n name3 = names(:lactarius_kuehneri)\n name4 = names(:lactarius_subalpinus)\n\n # First: merge Y into X, where Y is misspelling of X\n name2.correct_spelling = name1\n name2.change_deprecated(true)\n name2.save\n assert_not(name1.correct_spelling)\n assert_not(name1.deprecated)\n assert(name2.correct_spelling == name1)\n assert(name2.deprecated)\n params = {\n id: name2.id,\n name: {\n text_name: name1.text_name,\n author: name1.author,\n rank: \"Species\",\n deprecated: \"true\"\n }\n }\n put(:update, params: params)\n assert_flash_success\n assert_redirected_to(name_path(name1.id))\n assert_no_emails\n assert_not(Name.exists?(name2.id))\n assert(name1.reload)\n assert_not(name1.correct_spelling)\n assert_not(name1.deprecated)\n\n # Second: merge Y into X, where X is misspelling of Y\n name1.correct_spelling = name3\n name1.change_deprecated(true)\n name1.save\n name3.correct_spelling = nil\n name3.change_deprecated(false)\n name3.save\n assert(name1.correct_spelling == name3)\n assert(name1.deprecated)\n assert_not(name3.correct_spelling)\n assert_not(name3.deprecated)\n params = {\n id: name3.id,\n name: {\n text_name: name1.text_name,\n author: name1.author,\n rank: \"Species\",\n deprecated: \"false\"\n }\n }\n put(:update, params: params)\n assert_flash_success\n assert_redirected_to(name_path(name1.id))\n assert_no_emails\n assert_not(Name.exists?(name3.id))\n assert(name1.reload)\n assert_not(name1.correct_spelling)\n assert(name1.deprecated)\n\n # Third: merge Y into X, where X is misspelling of Z\n name1.correct_spelling = Name.first\n name1.change_deprecated(true)\n name1.save\n name4.correct_spelling = nil\n name4.change_deprecated(false)\n name4.save\n assert(name1.correct_spelling)\n assert(name1.correct_spelling != name4)\n assert(name1.deprecated)\n assert_not(name4.correct_spelling)\n assert_not(name4.deprecated)\n params = {\n id: name4.id,\n name: {\n text_name: name1.text_name,\n author: name1.author,\n rank: \"Species\",\n deprecated: \"false\"\n }\n }\n put(:update, params: params)\n assert_flash_success\n assert_redirected_to(name_path(name1.id))\n assert_no_emails\n assert_not(Name.exists?(name4.id))\n assert(name1.reload)\n assert(name1.correct_spelling == Name.first)\n assert(name1.deprecated)\n end",
"def insert_payment_partials(filename)\n lines = IO.readlines(filename)\n text = lines[2..-1].join\n\n text = replace_how_to_pay(text)\n text = replace_fee_table(text)\n\n File.write(filename, text)\n logger.info \"Created outcome '#{filename}'\"\n end",
"def run_all\n run_on_changes(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.tex')))\n end",
"def patches\n system \"cp src/Makefile.in src/Makefile.in.dos\"\n system \"tr -d '\\r' <src/Makefile.in.dos> src/Makefile.in\"\n DATA\n end",
"def fix_designated_point_remarks(designated_points)\n one = nil\n designated_points.map do |two|\n if one\n one_lines, two_lines = one.remarks&.lines, two.remarks&.lines\n if one_lines && two_lines\n if one_lines.count > 1 && (line = one_lines.last) !~ %r(\\s/\\s)\n # Move up\n if line.correlate(remainder = one_lines[0..-2].join, SYNONYMS) < line.correlate(two.remarks)\n two.remarks = [line, two.remarks].join(\"\\n\").compact\n one.remarks = remainder.compact\n end\n elsif two_lines.count > 1 && (line = two_lines.first) !~ %r(\\s/\\s)\n # Move down\n line = two_lines.first\n if line.correlate(remainder = two_lines[1..-1].join, SYNONYMS) < line.correlate(one.remarks)\n one.remarks = [one.remarks, line].join(\"\\n\").compact\n two.remarks = remainder.compact\n end\n end\n end\n end\n one = two\n end.map do |designated_point|\n designated_point.remarks = designated_point.remarks&.cleanup.blank_to_nil\n end\n end",
"def get_spelling_words(file)\n lines = IO.readlines(file).map(&:chomp)\n review_word = false\n challenge_word = false\n words = []\n lines.each do |line|\n if md=line.match(/\\A(\\d+)\\.\\s+(\\w+)\\Z/)\n (num, word) = md.captures\n words << SpellingWord.new(num, word, review_word, challenge_word)\n elsif line.match(/\\AReview Words/)\n review_word = true\n challenge_word = false\n elsif line.match(/\\AChallenge Words/)\n challenge_word = true\n review_word = false\n end\n end\n words\nend",
"def find_and_replace(dir, findstr, replacestr)\n Dir[dir].each do |name|\n text = File.read(name)\n replace = text.gsub(findstr,replacestr)\n if text != replace\n puts \"Fix: \" + name\n File.open(name, \"w\") { |file| file.puts replace }\n STDOUT.flush\n end\n end\n Dir[dir + '*/'].each(&method(:find_and_replace))\nend",
"def replace_lines(spec_file, replaces)\n require 'fileutils'\n output_file = \"#{spec_file}.tmp\"\n content = org_content = File.read(spec_file)\n replaces.each do |ar_repl|\n content.gsub!(ar_repl[0], ar_repl[1])\n end\n return false if org_content == content\n\n File.open(output_file, 'w') do |out_file|\n out_file.puts content\n end\n FileUtils.mv(output_file, spec_file)\n puts \"Done with #{spec_file}\"\n true\nend",
"def reload_rh_texts\n langs = Dir[\"Data/Text/Dialogs/#{CSV_BASE}.*.dat\"].collect { |i| i.match(/[0-9]+\\.([a-z]+)\\.dat$/).captures[0] }\n if langs.empty? ||\n File.mtime(\"Data/Text/Dialogs/#{CSV_BASE}.#{langs.first}.dat\") < File.mtime(\"Data/Text/#{langs.first}.dat\")\n langs << GamePlay::Load::DEFAULT_GAME_LANGUAGE if langs.empty?\n log_debug('Updating Text files')\n filename = 'plugins/text2csv' # Just to avoid the warning\n require filename\n Available_Langs.clear\n Available_Langs.concat(langs)\n log_debug('Compiling Text files')\n compile\n end\n end",
"def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = git.added_files.concat git.modified_files\n offending_files, patches = resolve_changes(validator, diff)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end",
"def refine_motif_format_guess(guessed_format, opts)\n opts.fetch(:motif_format, guessed_format)\nend",
"def refine_motif_format_guess(guessed_format, opts)\n opts.fetch(:motif_format, guessed_format)\nend",
"def normalize\n if defined?(@extra_rdoc_files) and @extra_rdoc_files\n @extra_rdoc_files.uniq!\n @files ||= []\n @files.concat(@extra_rdoc_files)\n end\n\n @files = @files.uniq if @files\n @extensions = @extensions.uniq if @extensions\n @test_files = @test_files.uniq if @test_files\n @executables = @executables.uniq if @executables\n @extra_rdoc_files = @extra_rdoc_files.uniq if @extra_rdoc_files\n end",
"def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end",
"def analyse!\n @words = formatted_mispelled_words\n @success = true\n rescue *rescued_exceptions_keys => e\n @success = false\n if rescued_exceptions_messages.include?(e.message)\n # aspell is not present. track analysis as failure\n else\n raise e\n end\n end",
"def update!(**args)\n @corrected = args[:corrected] if args.key?(:corrected)\n @corrected_text = args[:corrected_text] if args.key?(:corrected_text)\n end",
"def update!(**args)\n @corrected = args[:corrected] if args.key?(:corrected)\n @corrected_text = args[:corrected_text] if args.key?(:corrected_text)\n end",
"def sub_replacements text\n if REPLACEABLE_TEXT_RX.match? text\n # NOTE interpolation is faster than String#dup\n text = text.to_s\n REPLACEMENTS.each do |pattern, replacement, restore|\n # NOTE Using gsub! as optimization\n text.gsub!(pattern) { do_replacement $LAST_MATCH_INFO, replacement, restore }\n end\n end\n text\n end",
"def clean_text(force_clean=false)\n if self.name_changed? || force_clean\n self.name = self.name.strip\n \n if self.locale != 'ka'\n self.name = self.name.latinize.titlecase if self.name.is_georgian?\n end\n \n self.search_name = self.name.latinize.to_ascii.downcase\n end\n \n if self.address_changed? || force_clean\n self.address = self.address.strip\n \n if self.locale != 'ka'\n self.address = self.address.latinize.titlecase if self.address.is_georgian?\n end\n\n self.search_address = self.address.latinize.to_ascii.downcase\n end\n \n end",
"def altered_files\n parse!\n @altered_files\n end"
] | [
"0.54476726",
"0.5409826",
"0.5293991",
"0.52066636",
"0.5095803",
"0.5063352",
"0.50611675",
"0.49807286",
"0.4966632",
"0.4940869",
"0.4900983",
"0.48987687",
"0.48934543",
"0.4866788",
"0.48495376",
"0.4838936",
"0.48299643",
"0.48292568",
"0.48143947",
"0.4813448",
"0.48093876",
"0.47688174",
"0.4751059",
"0.4749107",
"0.4703136",
"0.4688934",
"0.4680685",
"0.46665195",
"0.46578392",
"0.46341294",
"0.46175015",
"0.46164346",
"0.45864624",
"0.45780224",
"0.45628694",
"0.4555502",
"0.45502505",
"0.454806",
"0.45323545",
"0.45317817",
"0.4516343",
"0.45153132",
"0.45032844",
"0.45014912",
"0.45010605",
"0.4498763",
"0.44878897",
"0.44870985",
"0.4485401",
"0.44852272",
"0.44783923",
"0.44730133",
"0.44707218",
"0.44678867",
"0.44664988",
"0.44595724",
"0.44580334",
"0.4457033",
"0.44533914",
"0.44492477",
"0.44338843",
"0.4430043",
"0.44255167",
"0.44222727",
"0.44200343",
"0.44120887",
"0.438776",
"0.43869576",
"0.4386077",
"0.43843397",
"0.43681544",
"0.4361966",
"0.4358376",
"0.4353584",
"0.43515152",
"0.43443167",
"0.43374872",
"0.4337237",
"0.4337237",
"0.4337237",
"0.43218842",
"0.43145284",
"0.431167",
"0.4303254",
"0.42982307",
"0.42941925",
"0.4291604",
"0.42888743",
"0.4281112",
"0.42783546",
"0.42685193",
"0.42685193",
"0.4267904",
"0.42669767",
"0.42609367",
"0.4259124",
"0.4259124",
"0.42483813",
"0.42416745",
"0.42415246"
] | 0.7996232 | 0 |
Merges gap_mark_tagging_import into content AT. Uses content AT as authority for text. | def merge_gap_mark_tagging_import_into_content_at(options)
gap_mark_tagging_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir
)
gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(
gap_mark_tagging_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(
options['base-dir-2'] || :content_dir
)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|
if gap_mark_tagging_import_file_name !~ /\.gap_mark_tagging\.txt\z/
next
end
total_count += 1
# prepare paths
content_at_file_name = gap_mark_tagging_import_file_name.gsub(
gap_mark_tagging_import_base_dir, content_base_dir
).gsub(
/\.gap_mark_tagging\.txt\z/, '.at'
)
output_file_name = content_at_file_name
begin
outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(
File.read(gap_mark_tagging_import_file_name),
File.read(content_at_file_name),
)
if outcome.success
# write to file
at_with_merged_tokens = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
$stderr.puts " + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_gap_mark_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('gap_mark_tagging_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to gap_mark tagging\",\n options.merge(\n :output_path_lambda => lambda { |input_filename, output_file_attrs|\n input_filename.gsub(config.base_dir(input_base_dir_name), output_base_dir)\n .gsub(/\\.at\\z/, '.gap_mark_tagging.txt')\n }\n )\n ) do |contents, filename|\n outcome = Repositext::Export::GapMarkTagging.export(contents)\n if outcome.success?\n [Outcome.new(true, { contents: outcome.result, extension: 'gap_mark_tagging.txt' })]\n else\n outcome\n end\n end\n end",
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def replace_taggings_from_atom(atom)\n Tagging.transaction do\n self.delete_classifier_taggings!\n taggings_from_atom(atom) \n end\n end",
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n idml_not_present_count = 0\n folio_not_present_count = 0\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)\n # Both files are present, merge tokens\n begin\n at_folio = File.read(at_folio_file_name)\n at_idml = File.read(at_idml_file_name)\n at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(\n at_folio, at_idml\n )\n # write to file\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge rids from #{ at_folio_file_name }\"\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, use Folio import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n idml_not_present_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n elsif File.exist?(at_idml_file_name)\n # Folio file is not present, use Idml import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n folio_not_present_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - Folio files not present: #{ folio_not_present_count }\"\n $stderr.puts \" - IDML files not present: #{ idml_not_present_count }\"\n $stderr.puts '-' * 80\n end",
"def annotate\n redirect_to :show unless rcparams = params[:recipe][:recipeContents]\n @content = rcparams[:content]\n ps = ParserServices.new entity: @recipe, content: @content\n # This is a two-, possibly three-phase process:\n # 1) a selection from the browser directs attention to a range of text, which generates a CSS path for an element to parse\n # 2) this so-called parse_path is attempted to be parsed. If it doesn't work because of a findable tag, a dialog is presented\n # for the user to decide how to handle the tag;\n # 3) the user says to enter the problematic tag directly into the dictionary, or specifies an existing tag for what\n # was meant by the problematic tag. The latter can be optionally entered as a synonym of the intended name.\n if rcparams[:anchor_path] # Initial annotation on browser selection\n logger.debug \"Annotating with anchor_path = '#{rcparams[:anchor_path]}'\"\n @annotation, @parse_path = ps.annotate_selection *rcparams.values_at(:token, :anchor_path, :anchor_offset, :focus_path, :focus_offset)\n elsif @parse_path = rcparams[:parse_path] # Specifying an element of the DOM\n if !(@tagname = rcparams[:tagname])\n logger.debug \"Looking for tag at '#{@parse_path}'\"\n # @annotation = ParsingServices.parse_on_path *rcparams.values_at(:content, :parse_path) do |tagtype, tagname|\n @annotation = ps.parse_on_path @parse_path do |tagtype, tagname|\n @tagtype, @tagname = tagtype, tagname\n end\n @parse_path = nil unless @tagname # We'll need the parse path for identifying the tag\n else # There IS a tagname: use that as a tag\n noko_elmt = ps.extract_via_path @parse_path\n @tagtype = rcparams[:tagtype]\n @annotation = rcparams[:content]\n # @tagname of type @tagtype is a mystery tag previously identified by a failed parse.\n logger.debug \"Use tag '#{@tagname}' of type '#{@tagtype}' at path '#{@parse_path}'\"\n # The logic here is as follows, for sorting out words.\n # -- '@tagname' is the questionable tag\n # -- 'rcparams[:replacement]' is the id of a tag selected by the user to serve in its place\n # -- 'rcparams[:assert]' is set if that tag will be added to the dictionary\n # If there's no replacement tag, the term is just accepted into the dictionary as a new instance of the tagtype.\n # If there IS a non-nil replacement, that's what we understand the term to mean. If, then, assert is set,\n # the questionable term will get added to the dictionary as a synonym for the replacement. If not, the alias\n # is accepted and added to the Seeker as such.\n # No tagname has been parsed out; proceed to parse the entity denoted by the parse path\n if (replacement = rcparams[:replacement]).present?\n old_tag = Tag.find_by id: replacement\n if rcparams[:assert]\n new_tag = Tag.assert @tagname, @tagtype\n new_tag.absorb old_tag, false\n end\n value = old_tag.name\n else\n # No replacement provided => simply assert the tag into the dictionary\n value = @tagname\n Tag.assert @tagname, @tagtype\n end\n @tagname = nil # Go back to the annotation dialog\n @parse_path = nil\n if noko_elmt\n noko_elmt[:value] = value\n @annotation = noko_elmt.ancestors.last.to_s\n end\n end\n end\n end",
"def insert_motivatedByTagging\n insert_motivatedBy OA.tagging\n end",
"def merge(to)\n if self == to \n raise ArgumentError, I18n.t(\"winnow.errors.tag.merge_name_error\")\n end\n \n self.manual_taggings.each do |tagging|\n unless to.manual_taggings.exists?(['feed_item_id = ?', tagging.feed_item_id])\n to.user.taggings.create!(:tag => to, :feed_item_id => tagging.feed_item_id, :strength => tagging.strength)\n end\n end\n # Used to be we would destroy the \"from\" tag (self). This is no longer done\n # because the from tag may have subscribers and would need to be archived.\n\n # TODO: Make merge its own separate command (like copy) rather than a side\n # effect of rename. (If it's going to be a side effect it would make more\n # sense as copy than as the present rename, anyhow, because currently you\n # cannot have the \"from\" tag of your merge be a subscribed tag, because you can't\n # \"rename\" someone else's tag.)\n end",
"def create_taggings_from_atom(atom)\n Tagging.transaction do \n taggings_from_atom(atom)\n end\n end",
"def taggings_from_atom(atom)\n atom.entries.each do |entry|\n begin\n strength = if category = entry.categories.detect {|c| c.term == self.name && c.scheme =~ %r{/#{Regexp.escape(self.user.login)}/tags/$}}\n category[CLASSIFIER_NAMESPACE, 'strength'].first.to_f\n else \n 0.0\n end\n\n if strength >= 0.9\n connection.execute \"INSERT IGNORE INTO taggings \" +\n \"(feed_item_id, tag_id, user_id, classifier_tagging, strength, created_on) \" +\n \"VALUES((select id from feed_items where uri = #{connection.quote(entry.id)}),\" + \n \"#{self.id}, #{self.user_id}, 1, #{strength}, UTC_TIMESTAMP()) \" +\n \"ON DUPLICATE KEY UPDATE strength = VALUES(strength);\"\n end\n rescue URI::InvalidURIError => urie\n logger.warn \"Invalid URI in Tag Assignment Document: #{entry.id}\"\n rescue ActiveRecord::StatementInvalid => arsi\n logger.warn \"Invalid taggings statement for #{entry.id}, probably the item doesn't exist.\"\n end\n end\n \n connection.execute(\"UPDATE tags SET last_classified_at = '#{Time.now.getutc.to_formatted_s(:db)}' where id = #{self.id}\")\n end",
"def import_markup_text( file_content )\n count = 0\n if file_content.scan(PTN_LINE)[0] =~ /tattertools/\n file_content = convert_tatter_xml( file_content )\n return file_content\n end\n count += create_pages( :content => file_content )\n count\n end",
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def restore_tags\n marc.by_tags(\"599\").each do |t|\n new_content = t.fetch_first_by_tag(\"a\").content\n if new_content =~ /=[0-9]{3}\\s{2}/\n tag, content = new_content.split(\" \")\n marc.parse_marc21(tag[1..4], content)\n t.destroy_yourself\n end\n end\n self.save\n end",
"def overwrite(to)\n to.taggings.clear\n self.copy(to)\n end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\n end",
"def merge\n notify \"Importing...\"\n @importer.merge\n end",
"def tagging_tag(tagging)\n if tagging.tag_list.present?\n content_tag :div, class: \"row\" do\n content_tag :div, class: \"article-tagging my-xs-20\" do\n (content_tag :span, \"標籤:\") +\n (tagging.tag_list.map {|t| link_to t, tag_path(t), class: \"btn btn-default ml-xs-10\"}.inject(&:+))\n # look up \"join\" method\n end\n end\n end\n end",
"def strip_annotations(content); end",
"def import_text_content\n self.text_content = self.to_text\n self.save\n\n # Reindex to elasticsearch\n self.reindex\n end",
"def absorb other\n # Take taggings from the other taggable\n other.taggings.map { |tagging| tag_with tagging.tag, tagging.user_id }\n super if defined? super\n end",
"def merge(content_data)\n content_data.contents.values.each { |content|\n add_content(content)\n }\n content_data.instances.values.each { |instance|\n add_instance(instance)\n }\n end",
"def export_subtitle_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('subtitle_tagging_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to subtitle tagging\",\n options.merge(\n :output_path_lambda => lambda { |input_filename, output_file_attrs|\n Repositext::Utils::SubtitleFilenameConverter.convert_from_repositext_to_subtitle_export(\n input_filename.gsub(config.base_dir(input_base_dir_name), output_base_dir),\n output_file_attrs\n )\n }\n )\n ) do |contents, filename|\n # Since the kramdown parser is specified as module in Rtfile,\n # I can't use the standard kramdown API:\n # `doc = Kramdown::Document.new(contents, :input => 'kramdown_repositext')`\n # We have to patch a base Kramdown::Document with the root to be able\n # to convert it.\n root, warnings = config.kramdown_parser(:kramdown).parse(contents)\n doc = Kramdown::Document.new('')\n doc.root = root\n subtitle_tagging = doc.send(config.kramdown_converter_method(:to_subtitle_tagging))\n empty_markers_file = %(RelativeMS\\tSamples\\n0\\t0\\n)\n [\n Outcome.new(true, { contents: subtitle_tagging, extension: 'rt.txt' }),\n Outcome.new(true, { contents: empty_markers_file, extension: 'markers.txt' }),\n ]\n end\n end",
"def backup_tag(tag)\n marc.by_tags(tag).each do |t|\n new_599 = MarcNode.new(Source, \"599\", \"\", \"4#\")\n ip = marc.get_insert_position(\"599\")\n new_599.add(MarcNode.new(Source, \"a\", \"#{t.to_s.strip}\", nil))\n new_599.sort_alphabetically\n marc.root.children.insert(ip, new_599)\n t.destroy_yourself\n end\n end",
"def merge(action)\n call_enforcer_for_merge(action)\n with(\n insert_before: \"#{action.insert_before}#{insert_before}\",\n replacement: action.replacement || @replacement,\n insert_after: \"#{insert_after}#{action.insert_after}\",\n ).combine_children(action.children)\n end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def insert_before(range, content); end",
"def merge_to_project(options = {})\n $merge = true \n @opt = {\n :proj_id => nil, \n :person_id => nil,\n :postfix_otu_names => false,\n :postfix_chr_names => false\n }.merge!(options.symbolize_keys)\n\n return false if !@opt[:proj_id] || !@opt[:person_id]\n return false if !@proj = Proj.find(@opt[:proj_id])\n return false if !@person = Person.find(@opt[:person_id])\n\n $proj_id = @proj.id \n $person_id = @person.id\n\n begin\n Proj.transaction do \n # try and do a little matching/transfer in a few cases (could also extend to Keywords)\n self.content_types.each do |o|\n if ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n # update the templates \n self.content_templates_content_types.each do |ctct|\n if ctct.content_type.name == ct.name\n ctct.content_type = ct\n ctct.save\n end\n end\n \n # update the content\n self.contents.each do |c|\n if c.content_type.name == ct.name\n c.content_type = ct\n c.save\n end\n end \n\n # update the mapped_chr_groups\n self.chr_groups.each do |cg|\n if !cg.content_type.blank? && cg.content_type.name == ct.name\n cg.content_type = ct\n cg.save\n end\n end \n # we have to only delete the merged object below\n end\n end\n\n self.genes.each do |g|\n if g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => g.name})\n self.primers.each do |p|\n p.gene = g\n p.save\n end\n self.seqs.each do |s|\n s.gene = g\n s.save\n end\n end\n end\n\n # loop the remaining types\n [:has_many, :has_one, :has_and_belongs_to_many].each do |rel|\n Proj.reflect_on_all_associations(rel).collect{|o| o.name}.each do |r| # r is the class name \n next if r == :text_content_types\n case r\n when :content_types \n self.send(r).each do |o|\n if @ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :genes\n self.send(r).each do |o|\n if @g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :people\n # do nothing, these remain in the project to be deleted later, otherwise they get touched an pwds get borked\n\n else \n t = self.send(r).each do |o|\n @o = o\n @r = r\n o.name = \"#{o.name} [from: #{o.proj_id}]\" if (@opt[:postfix_otu_names] && o.class == Otu) || (@opt[:postfix_chr_names] && o.class == Chr)\n o.proj_id = @opt[:proj_id]\n o.save\n end\n end\n end\n end # end rel types\n end # end transaction\n\n rescue Exception => e\n $merge = false\n raise \"#{e} o:(#{@o.to_yaml}) o_class: #{@o.class.to_s} r:(#{@r}) p:(#{@proj.id})\"\n end\n $merge = false\n true\n end",
"def tmp_gap_mark_complete\n tmp_gap_mark_number + tmp_gap_mark_text\n end",
"def report_gap_mark_count(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n file_count = 0\n files_with_gap_marks = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n gap_mark_count = contents.scan(/(?<!\\\\)%/).size\n date_code = Repositext::Utils::FilenamePartExtractor.extract_date_code(filename)\n if gap_mark_count > 0\n files_with_gap_marks << {\n gap_mark_count: gap_mark_count + 2, # add two for correct count in final document\n filename: filename,\n date_code: date_code,\n }\n end\n file_count += 1\n end\n lines = []\n files_with_gap_marks.sort { |a,b| a[:date_code] <=> b[:date_code] }.each do |attrs|\n l = \" - #{ attrs[:date_code].ljust(10) } - #{ attrs[:gap_mark_count].to_s.rjust(5) }\"\n $stderr.puts l\n lines << l\n end\n summary_line = \"Found #{ lines.length } of #{ file_count } files with gap_marks at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir('reports_dir'), 'gap_mark_count.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Gap_mark count\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write lines.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report gap_mark_count`\\n\"\n }\n end",
"def author_tag(text); end",
"def merge_requests_to_import\n project.merge_requests.id_not_in(already_imported_objects).with_state(:merged)\n end",
"def sync_from_at(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n Repositext::Cli::Utils.convert_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n \"Synching AT files to PT\",\n options\n ) do |contents, filename|\n # Remove AT specific tokens\n pt = Suspension::TokenRemover.new(\n contents,\n Suspension::AT_SPECIFIC_TOKENS\n ).remove\n [Outcome.new(true, { contents: pt, extension: '.md' })]\n end\n end",
"def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"def transfer_tags(appdata,companytagcheck)\n\n puts \"Importing Tags...\"\n\n #SOURCE APP\n #-----------------------------------------------------------------------------\n\n #INITIALIZE INFUSIONSOFT\n #_______________________\n #initializes source app\n puts \"=> Initializing\"\n initialize_infusionsoft(appdata[:src_appname], appdata[:src_apikey])\n\n #SOURCE APP DATA\n #_______________\n #Gets source app tags and tag categories\n puts \"=> Getting Source App Data\"\n source_tag_categories = get_table('ContactGroupCategory')\n source_tags = get_table('ContactGroup')\n\n #gets tag assignments\n source_tag_assignments = get_table('ContactGroupAssign')\n\n tags_on_contacts = []\n get_table('Contact').each { |c| tags_on_contacts |= c['Groups'].split(\",\") unless c['Groups'].nil? }\n source_tags.reject! { |t| tags_on_contacts.exclude? t['Id'].to_s}\n\n\n #DESTINATION APP\n #-----------------------------------------------------------------------------\n\n #INITIALIZE INFUSIONSOFT\n #_______________________\n #initializes destination app\n initialize_infusionsoft(appdata[:dest_appname], appdata[:dest_apikey])\n\n #DEST APP DATA\n #_____________\n #gets tags and tag categories that already exist in destination app\n puts \"=> Getting Dest App Data\"\n dest_tag_categories = {}\n get_table('ContactGroupCategory').each { |cat| dest_tag_categories[cat['Id']] = cat['CategoryName'] }\n\n dest_tags = {}\n get_table('ContactGroup').each { |tag| dest_tags[tag['Id']] = tag['GroupName'] }\n\n #creates ID relationships for contacts and companies\n dest_contacts = {}\n get_table('Contact',['Id',@@source_app_contact_id]).each { |contact| dest_contacts[contact[@@source_app_contact_id].to_i] = contact['Id'] }\n\n dest_companies = {}\n get_table('Company',['Id',@@source_app_account_id]).each { |company| dest_companies[company[@@source_app_account_id].to_i] = company['Id'] } unless params[:companies][:checkbox] == 'false'\n\n\n #CREATE TAGS AND CATEGORIES\n #__________________________\n #Create Categories and tags if they don't already exist\n puts \"=> Creating Categories\"\n category_relationship = {}\n source_tag_categories.each do |cat|\n category_relationship[cat['Id']] = dest_tag_categories.key(cat['CategoryName']) || Infusionsoft.data_add('ContactGroupCategory',cat)\n end\n\n puts \"=> Creating Tags\"\n tag_relationship = {}\n source_tags.each do |tag|\n tag['GroupCategoryId'] = category_relationship[tag['GroupCategoryId']] unless tag['GroupCategoryId'] == 0\n tag_relationship[tag['Id']] = dest_tags.key(tag['GroupName']) || Infusionsoft.data_add('ContactGroup',tag)\n end\n\n #ADD TAGS TO CONTACTS & COMPANIES\n #________________________________\n #adds tags to contacts using the ContactGroupAssign table from the source app\n puts \"=> Applying Tags\"\n source_tag_assignments.each do |contact|\n next if dest_contacts[contact['ContactId']].nil? && dest_companies[contact['Contact.CompanyID']].nil?\n contact['GroupId'] = tag_relationship[contact['GroupId']]\n dest_contacts[contact['ContactId']].nil? ? Infusionsoft.contact_add_to_group(dest_companies[contact['Contact.CompanyID']], contact['GroupId']) : Infusionsoft.contact_add_to_group(dest_contacts[contact['ContactId']], contact['GroupId'])\n end\n\n puts \"Tags Imported.\"\n end",
"def pubannos(data)\n \n result = JSON.parse(data)\n \n if result.has_key? 'Error'\n raise BioInterchange::Exceptions::InputFormatError, 'Error parsing the JSON input file: #{result[\"Error\"]}'\n end\n \n \n text = result['text']\n #doc_uri = \"http://pubannotation.dbcls.jp/pmdocs/\" + result['pmid'].to_s\n doc_uri = result['docurl']\n \n doc = Document.new(doc_uri)\n docContent = Content.new(0, text.length, Content::DOCUMENT, @process)\n docContent.setContext(doc)\n doc.add(docContent)\n \n #so our document requires content of type document or abstract\n #should it hold the content string?\n\n #hash to remember annotation in case they are needed for building upon based on ids later\n contents = {}\n\n if result['catanns']\n result['catanns'].each do |annot| \n start_offset = 0\n end_offset = 0\n if annot['span']\n start_offset = annot['span']['begin']\n end_offset = annot['span']['end']\n elsif annot['begin'] and annot['end']\n start_offset = annot['begin']\n end_offset = annot['end']\n end\n length = end_offset - start_offset\n\n category = annot['category']\n id = annot['id']\n \n entity = text.slice(start_offset..end_offset)\n \n #phrase = type for NE\n con = Content.new(start_offset, length, Content::PHRASE, @process)\n con.setContext(doc)\n doc.add(con)\n\n contents[id] = con \n \n #set process.date = updated_time?\n end\n end\n \n if result['insanns']\n result['insanns'].each do |annot|\n \n #unsure what to do about this (con1), 'E1' is the ID of something not created yet.\n #it is perhaps a case of making a new content, but with what params...?\n #need to conform what this is refering to with JDK\n con1 = nil \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'subClassOf'\n type = ContentConnection::SUBCLASS\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['relanns']\n result['relanns'].each do |annot|\n con1 = contents[annot['subject']] \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'equivalentTo'\n type = ContentConnection::EQUIVALENCE\n when 'themeOf'\n type = ContentConnection::THEME\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['modanns']\n result['modanns'].each do |annot|\n \n #in this case, it is a modification of an already existing content object (speculation/negation). \n con = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'Speculation'\n type = ContentConnection::SPECULATION\n when 'Negation'\n type = ContentConnection::NEGATION\n end\n connection = ContentConnection.new(con, nil, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n doc\n end",
"def merge_accepted_corrections_into_content_at(options)\n # First validate the spot sheets and cancel process if errors are found.\n validate_spot_sheet(options.merge('validate_or_merge' => 'merge'))\n\n accepted_corrections_base_dir = config.compute_base_dir(\n options['base-dir'] ||\n options['base-dir-1'] ||\n :accepted_corrections_dir\n )\n accepted_corrections_glob_pattern = config.compute_glob_pattern(\n accepted_corrections_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging accepted corrections into content_at'\n start_time = Time.now\n total_count = 0\n auto_success_count = 0\n manual_success_count = 0\n errors_count = 0\n\n Dir.glob(accepted_corrections_glob_pattern).each do |accepted_corrections_file_name|\n if accepted_corrections_file_name !~ /\\.accepted_corrections\\.txt\\z/\n $stderr.puts \" - skipping #{ accepted_corrections_file_name }\"\n next\n end\n total_count += 1\n # prepare paths\n content_at_file_name = accepted_corrections_file_name.gsub(\n accepted_corrections_base_dir,\n content_base_dir\n ).gsub(\n /\\.accepted_corrections\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n # First apply all corrections that can be done automatically\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_auto(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # write to file\n at_with_accepted_corrections = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_accepted_corrections)\n auto_success_count += 1\n $stderr.puts \" + Auto-merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n\n # Second apply manual corrections.\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_manually(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # Nothing needs to be written to file. This has already been done\n # manually in the editor.\n manual_success_count += 1\n $stderr.puts \" + Manually merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ total_count } files in #{ Time.now - start_time } seconds:\"\n $stderr.puts \" - Auto-merges: #{ auto_success_count } files.\"\n $stderr.puts \" - Manual merges: #{ manual_success_count } files.\"\n $stderr.puts '-' * 80\n end",
"def idml_import_consistent?(idml_import_at_file, content_at_file)\n idml_import_at_doc = Kramdown::Document.new(\n idml_import_at_file.contents,\n :input => 'KramdownRepositext'\n )\n content_at_doc = Kramdown::Document.new(\n content_at_file.contents,\n :input => 'KramdownRepositext'\n )\n\n idml_import_at_plain_text = idml_import_at_doc.to_plain_text\n content_at_plain_text = content_at_doc.to_plain_text\n\n # A.D., A.M., and B.C. are lower cased after record ids were merged\n # as part of the import command. We lower case them in both to\n # avoid getting validation errors from this.\n idml_import_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n idml_import_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n idml_import_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n content_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n content_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n content_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n\n diffs = Suspension::StringComparer.compare(idml_import_at_plain_text, content_at_plain_text)\n\n if diffs.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n diffs.map { |diff|\n Reportable.error(\n {\n filename: content_at_file.filename,\n corr_filename: idml_import_at_file.filename,\n },\n ['Plain text diference between idml_import_at and content_at', diff]\n )\n }\n )\n end\n end",
"def merge_ctags\n return unless @ctags_merge\n\n ctags_path = @ctags_path || find_ctags\n\n system(ctags_path, '--append=yes', '--format=2', '--languages=-Ruby',\n '--recurse=yes', *@options.files)\n end",
"def tag\n # NB: the PageRefsController handles a GET request to set up tagging, taking params[:extractions] into account\n if current_user\n update_options = { :skip_landing => true } # We're not going to wait for the entity to process\n # Collectibles include both PageRefs and other entities (Recipe, Site, etc.) that HAVE PageRefs\n # Furthermore, when initially collecting a URL, we may be tagging the entity BY REFERENCE to its PageRef, in\n # which case we need to tag the corresponding entity, either by picking one or making a new one.\n # #edittable_proxify() sorts all that out, returning an editable model and (for a POST call) parameters for modification\n model, modelparams = edittable_proxy # A page_ref may proxify into the associated Recipe or Site, or another PageRef\n if @page_ref\n @page_ref.adopt_extractions params[:extractions] if params[:extractions]\n @page_ref.save if (@page_ref != model) && (!@page_ref.persisted? || @page_ref.changed?) # Trigger launch as nec.\n update_options[:needs] = [ :picurl, :title ]\n end\n modelname = model.model_name.param_key\n params[modelname] = modelparams\n\n # The editable tag tokens need to be set through the decorator, since Taggable\n # doesn't know what tag types pertain.\n # So, first we pull the misc_tag_tokens from the params...\n misc_tag_tokens = params[modelname].delete :editable_misc_tag_tokens\n # Now the parameters should reflect the target type, and we can proceed as usual\n update_options.merge! (request.method == 'GET') ?\n { touch: :collect } : # Ensure that it's collected before editing\n # We have to provide update parameters, in case the model name doesn't match the controller\n { update_attributes: true, attribute_params: strong_parameters(modelname) }\n\n update_and_decorate model, update_options\n # ...now we apply the misc tag tokens (if any) according to the constraints of the decorator\n @decorator.send @decorator.misc_tags_name_expanded('editable_misc_tag_tokens='), misc_tag_tokens if misc_tag_tokens\n if resource_errors_to_flash @decorator, preface: 'Couldn\\'t save.'\n render :errors\n else\n unless request.method == 'GET'\n flash[:popup] = \"#{@decorator.human_name} saved\"\n render 'collectible/update.json'\n else\n response_service.title = @decorator.title.truncate(20) # Get title (or name, etc.) from the entity\n smartrender\n end\n end\n else\n respond_to do |format|\n format.html {# This is for capturing a new recipe and tagging it using a new page.\n # Defer request, redirecting it for JSON\n login_required :format => :json\n }\n format.json {\n # Not logged in => have to store recipe parameters (url, title, comment) in a safe place pending login\n # session[:pending_recipe] = params[:recipe].merge page_ref_id: page_ref.id\n # After login, we'll be returned to this request to complete tagging\n login_required\n }\n end\n end\n end",
"def insert_before_multi(range, content); end",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n save\n end\n true\n end",
"def process_sentance(blob)\n # strip out enclosures\n blob = blob.gsub(/\\\\/,'')\n # test for quotes\n # if quotes, these words are important (flag them)\n test = blob.match(/[\"'](.*)['\"]/)\n if test && test.size > 1\n @words = test[1..test.size].join(\" \")\n #test.each{|word|\n # @words << word\n #}\n #blob = blob.gsub(@words,'')\n blob = blob.gsub(/([\"'])/,'')\n end\n unless @words.nil?\n # break up and add to @local_important\n tmp = @words.split(\" \")\n tmp.each{|word|\n @local_important << word.downcase unless @local_important.include? word\n }\n end\n #puts blob\n the_pieces = blob.split(\" \")\n parse_words(the_pieces)\n \n # try to sort words\n words = grab_important_words\n puts words.inspect\n \n puts \"Derived Tags: #{words.join(' ')}\"\n \n end",
"def init_tags\n add_tag :BOLD, '+b', '-b'\n add_tag :EM, '+_', '-_'\n add_tag :TT, '' , '' # we need in_tt information maintained\n end",
"def before_commit(content)\n DCLPTextIdentifier.preprocess(content)\n end",
"def report_gap_mark_count(options)\n file_count = 0\n files_with_gap_marks = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n gap_mark_count = content_at_file.contents.scan(/(?<!\\\\)%/).size\n date_code = content_at_file.extract_date_code\n if gap_mark_count > 0\n files_with_gap_marks << {\n gap_mark_count: gap_mark_count + 2, # add two for correct count in final document\n filename: content_at_file.filename,\n date_code: date_code,\n }\n end\n file_count += 1\n end\n lines = []\n files_with_gap_marks.sort { |a,b| a[:date_code] <=> b[:date_code] }.each do |attrs|\n l = \" - #{ attrs[:date_code].ljust(10) } - #{ attrs[:gap_mark_count].to_s.rjust(5) }\"\n $stderr.puts l\n lines << l\n end\n summary_line = \"Found #{ lines.length } of #{ file_count } files with gap_marks at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir(:reports_dir), 'gap_mark_count.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Gap_mark count\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write lines.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report gap_mark_count`\\n\"\n }\n end",
"def insert_before(range, content)\n @source_rewriter.insert_before(range, content)\n end",
"def insert_before(range, content)\n @source_rewriter.insert_before(range, content)\n end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def insert_after(range, content); end",
"def transfer_to_otu(otu, delete_from_incoming = true)\n return false if otu.id == self.otu_id\n c = Content.find(:first, :conditions => {:otu_id => otu.id, :content_type_id => self.content_type_id})\n # does the incoming otu have this content_type already\n \n begin\n Content.transaction do\n if c # content already exists for the clone-to OTU \n c.text = c.text + \" [Transfered from OTU #{self.otu_id}: #{self.text}]\" # append content\n c.save! \n # deal with figures\n for f in self.figures\n if found = Figure.find(:first, :conditions => {:addressable_type => 'Content', :addressable_id => c.id , :image_id => f.image_id})\n # append the caption\n found.caption += \" [Transfered from OTU #{self.otu_id}: #{f.caption}]\"\n f.destroy if delete_from_incoming\n else\n if delete_from_incoming\n # transfer the figure\n f.addressable_id = c.id\n f.save!\n else\n # clone the figure\n n = f.clone\n n.addressable_id = c.id\n end\n end\n end\n\n # deal with tags\n for t in self.tags\n if found = Tag.find(:first, :conditions => {:addressable_type => 'Content' , :addressable_id => c.id , :keyword_id => t.keyword_id })\n # append the notes\n \n found.notes += \" [Transfered from OTU #{self.otu_id}: #{t.notes}]\"\n found.save!\n t.destroy if delete_from_incoming\n else\n if delete_from_incoming\n # transfer the tag\n t.addressable_id = c.id\n t.save!\n else\n #clone the tag\n n = t.clone\n n.addressable_id = c.id\n n.save!\n end\n end\n end\n\n self.destroy if delete_from_incoming\n \n else # content in transfer-to OTU doesn't exist\n if delete_from_incoming # just update the otu_id and everything gets transferred\n self.otu_id = otu.id\n self.save!\n else # need to clone everything\n # clone the content\n nc = self.clone\n nc.otu_id = otu.id\n nc.save!\n\n # clone figures\n for f in self.figures\n fn = f.clone\n fn.addressable_id = nc.id\n fn.save!\n end\n\n # clone tags\n for t in self.tags\n tn = t.clone\n tn.addressable_id = nc.id\n tn.save!\n end\n end\n end\n end\n\n rescue\n returns false\n end\n true\n end",
"def genit_tags_in_template\n HtmlDocument.genit_tags_from @template\n end",
"def merge(with); 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 merge(prt_pdb, lig_pdb, complex_pdb)\n prt_lines = File.readlines(prt_pdb)\n lig_lines = File.readlines(lig_pdb)\n\n prt_atm_lines = prt_lines.select { |line| /ATOM/ =~ line }\n lig_atm_lines = lig_lines.select { |line| /HETATM/ =~ line}\n\n f = File.open(complex_pdb, 'w')\n\n f.write(\"MODEL 1\\n\")\n prt_atm_lines.each do |line| f.write(line) end\n f.write(\"TER\\n\")\n lig_atm_lines.each do |line| f.write(line) end\n f.write(\"END\\n\")\n\n f.close()\n\nend",
"def process_tags(article_id)\n p = Article.find(article_id)\n p.tag_list.each do |tag|\n t = Tag.find_or_create_by_content(tag)\n t.articles << p\n t.save\n\n p.content = p.content.gsub(\"#\" + tag) {\"<a href='\" + Rails.application.routes.url_helpers.tag_path(tag) + \"'>#\"+tag+\"</a>\"}\n p.save\n end\n end",
"def autotag(string)\n return unless string\n return string unless Doing.auto_tag\n\n original = string.dup\n text = string.dup\n\n current_tags = text.scan(/@\\w+/).map { |t| t.sub(/^@/, '') }\n tagged = {\n whitelisted: [],\n synonyms: [],\n transformed: [],\n replaced: []\n }\n\n Doing.setting('autotag.whitelist').each do |tag|\n next if text =~ /@#{tag}\\b/i\n\n text.sub!(/(?<= |\\A)(#{tag.strip})(?= |\\Z)/i) do |m|\n m.downcase! unless tag =~ /[A-Z]/\n tagged[:whitelisted].push(m)\n \"@#{m}\"\n end\n end\n\n Doing.setting('autotag.synonyms').each do |tag, v|\n v.each do |word|\n word = word.wildcard_to_rx\n next unless text =~ /\\b#{word}\\b/i\n\n unless current_tags.include?(tag) || tagged[:whitelisted].include?(tag)\n tagged[:synonyms].push(tag)\n tagged[:synonyms] = tagged[:synonyms].uniq\n end\n end\n end\n\n if Doing.setting('autotag.transform')\n Doing.setting('autotag.transform').each do |tag|\n next unless tag =~ /\\S+:\\S+/\n\n if tag =~ /::/\n rx, r = tag.split(/::/)\n else\n rx, r = tag.split(/:/)\n end\n\n flag_rx = %r{/([r]+)$}\n if r =~ flag_rx\n flags = r.match(flag_rx)[1].split(//)\n r.sub!(flag_rx, '')\n end\n r.gsub!(/\\$/, '\\\\')\n rx.sub!(/^@?/, '@')\n regex = Regexp.new(\"(?<= |\\\\A)#{rx}(?= |\\\\Z)\")\n\n text.sub!(regex) do\n m = Regexp.last_match\n new_tag = r\n\n m.to_a.slice(1, m.length - 1).each_with_index do |v, idx|\n next if v.nil?\n\n new_tag.gsub!(\"\\\\#{idx + 1}\", v)\n end\n # Replace original tag if /r\n if flags&.include?('r')\n tagged[:replaced].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })\n new_tag.split(/ /).map { |t| t.sub(/^@?/, '@') }.join(' ')\n else\n tagged[:transformed].concat(new_tag.split(/ /).map { |t| t.sub(/^@/, '') })\n tagged[:transformed] = tagged[:transformed].uniq\n m[0]\n end\n end\n end\n end\n\n logger.debug('Autotag:', \"whitelisted tags: #{tagged[:whitelisted].log_tags}\") unless tagged[:whitelisted].empty?\n logger.debug('Autotag:', \"synonyms: #{tagged[:synonyms].log_tags}\") unless tagged[:synonyms].empty?\n logger.debug('Autotag:', \"transforms: #{tagged[:transformed].log_tags}\") unless tagged[:transformed].empty?\n logger.debug('Autotag:', \"transform replaced: #{tagged[:replaced].log_tags}\") unless tagged[:replaced].empty?\n\n tail_tags = tagged[:synonyms].concat(tagged[:transformed])\n tail_tags.sort!\n tail_tags.uniq!\n\n text.add_tags!(tail_tags) unless tail_tags.empty?\n\n if text == original\n logger.debug('Autotag:', \"no change to \\\"#{text.strip}\\\"\")\n else\n new_tags = tagged[:whitelisted].concat(tail_tags).concat(tagged[:replaced])\n logger.debug('Autotag:', \"added #{new_tags.log_tags} to \\\"#{text.strip}\\\"\")\n logger.count(:autotag, level: :info, count: 1, message: 'autotag updated %count %items')\n end\n\n text.dedup_tags\n end",
"def flush\n\t\t@pending_tagging.each do |tag,pending_items|\n\t\t\tif pending_items.size >= @max_pending\n\t\t\t\tlog(\"Applying tag '#{tag}' to #{pending_items.size} items\")\n\t\t\t\t$utilities.getBulkAnnotater.addTag(tag,pending_items)\n\t\t\t\t@pending_tagging[tag] = []\n\t\t\tend\n\t\tend\n\n\t\t@pending_custom_metadata.each do |field_name,value_grouped|\n\t\t\tvalue_grouped.each do |value,pending_items|\n\t\t\t\tif pending_items.size >= @max_pending\n\t\t\t\t\tlog(\"Applying field '#{field_name}' to #{pending_items.size} items\")\n\t\t\t\t\t$utilities.getBulkAnnotater.putCustomMetadata(field_name,value,pending_items,nil)\n\t\t\t\t\t@pending_custom_metadata[field_name][value] = []\n\t\t\t\tend\t\n\t\t\tend\n\t\tend\n\tend",
"def flush\n if ARG_TAG_ITEMS != nil\n if ARG_TAG_ITEMS\n $utilities.bulk_annotater.add_tag(@tag, @item_array)\n else\n $utilities.bulk_annotater.remove_tag(@tag, @item_array)\n end\n end\n @item_array = Array.new\n end",
"def replace(content)\n \n # pre-structuring\n content.gsub!( /^(\\w.*)\\n(\\w.*)/ ) { \"#{$1} #{$2}\" } # remove single line breaks between text in order to avoid false paragraph markup\n content.gsub!( /<!--/ ) { \"--\" } # replace opening html commentaries\n content.gsub!( /-->/ ) { \"--\" } # replace closing html commentaries\n \n # templates\n content.gsub!( /\\{\\{Zitat\\|(.*)\\|.*\\}\\}\\s*$\\n/ ) { \"\\{p\\}\\\"#{$1}\\\"\\{/p\\}\\n\" } # citation\n content.gsub!( /\\{\\{.*(Finale Version).*\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1}</font>{/status}<br>\" } # final version\n content.gsub!( /\\{\\{Vorlage:(Dokument.*)\\n*(.*)\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1} #{$2}</font>{/status}<br>\" } # document status\n content.gsub!( /\\{\\{.*\\}\\} *$/ ) { '' } # remove single line templates\n content.gsub!( /\\{\\{.*\\n?.*\\}\\} *$/ ) { '' } # remove all remaining templates\n \n # tags\n content.gsub!( /<nowiki>(.*?)<\\/nowiki>/ ) { \"<pre>#{$1}</pre>\" }\n content.gsub!( /^ +(.*)/ ) { \"<pre>#{$1}</pre>\" }\n\n # special markup of qualidative data analysis\n content = content + \"\\n\\n{!end}\"\n \n # categories\n content.gsub!( /\\[\\[Kategorie:(.*?)\\]\\]/i ) { \"{category}<font color=\\\"#FF0000\\\">Kategorie:#{$1}</font>{/category}<br>\" }\n \n # images\n content.gsub!( /\\[\\[Bild:(.*?)\\]\\]/i ) { \"{image}Bild:#{$1.gsub!(/.*\\|/,'')}{/image}<br>\"} # Bild:lpscreen.jpg|thumb|Bereichseite des Landesportals\n\n # bold\n content.gsub!(/'''(.*?)'''/) {\"<strong>#{$1}</strong>\"}\n content.gsub!(/'''(.*?)$/) {\"<strong>#{$1}</strong>\"}\n\n # italics\n content.gsub!(/''(.*?)''/) {\"<em>#{$1}</em>\"}\n content.gsub!(/''(.*?)$/) {\"<em>#{$1}</em>\"}\n\n # headings\n 6.downto(1) { |i| content.gsub!( /^={#{i}}(.*?)={#{i}} *$/ ) { \"<h#{i}>\\{h>#{i}\\}#{$1}\\{/h>#{i}\\}</h#{i}>\" } }\n \n # links, internal\n content.gsub!( /\\[\\[([^\\[\\n]*?)\\| *(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[\\[(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n\n # links, external\n content.gsub!( /\\[([^\\[\\n]*?)\\| *(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n \n # lists\n content.gsub!(/^:+/,'') # remove forced indenting\n content.gsub!( /^((?:\\*.*\\n+)+)/ ) { \"\\{l>ul\\}<ul>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^\\*/,'')}</li>\\n\" }.join}</ul>\\{/l>ul\\}<br>\\n\" } # first level ul\n content.gsub!( /^((?:#.*\\n+)+)/ ) { \"\\{l>ol\\}<ol>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^#/,'')}</li>\\n\" }.join}</ol>\\{/l>ol\\}<br>\\n\" } # first level ol\n content.gsub!( /<li>\\s*<\\/li>\\n/ ) { '' } # remove empty list entries (this may occur if first-level wiki-lists are entered with \\n\\n; they look like a single list when, in fact, they are but multiple single lists)\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # second level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # second level ol\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # third level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # third level ol\n\n # tables\n # the table conversion barely works, cf. http://johbuc6.coconia.net/doku.php/mediawiki2html_machine/code?DokuWiki=7c542b97df2bc0f82fec0f4875265a20 for an implementation in PHP\n content.gsub!( /^\\{\\|(.*)/ ) { \"\\{table\\}\\n<table #{$1}>\" }\n content.gsub!( /\\|\\}/ ) { \"</table>\\n\\{/table\\}\" }\n content.gsub!( /^\\|-(.*)/ ) { \"<tr>#{$1}\" }\n content.gsub!( /^!(.*?)\\|(.*)/ ) { \"<th #{$1}>#{$2}</th>\" } # table header with piped markup\n content.gsub!( /^!(.*)/ ) { \"<th>#{$1}</th>\" } # table header without piped markup\n content.gsub!( /^\\|(.*?)\\|(.*)/ ) { \"<td #{$1}>#{$2}\" } # table data with piped markup\n content.gsub!( /^\\|(.*)/ ) { \"<td>#{$1}\" } # table data without piped markup\n \n # line breaks\n content.gsub!( /(^(?:\\w|<strong|<em|<a|\\\").*)\\n\\s*\\n/ ) {\"<p>\\{p\\}#{$1}\\{/p\\}</p>\\n\"}\n \n # special markup of qualidative data analysis\n content.gsub!( /(\\{id\\}.*\\{\\/title\\})/ ) { \"<p><strong><em>#{$1.gsub(/_/,' ')}</em></strong></p>\" }\n \n# //$html = nl2br($html);\n# \t// line breaks\n# \t$html = preg_replace('/[\\n\\r]{4}/',\"<br/><br/>\",$html);\n# \t$html = preg_replace('/[\\n\\r]{2}/',\"<br/>\",$html);\n\n# \t$html = preg_replace('/[>]<br\\/>[<]/',\"><\",$html);\n \n# // allowed tags\n# \t$html = preg_replace('/<(\\/?)(small|sup|sub|u)>/','<${1}${2}>',$html);\n#\n# \t$html = preg_replace('/\\n*<br *\\/?>\\n*/',\"\\n\",$html);\n# \t$html = preg_replace('/<(\\/?)(math|pre|code|nowiki)>/','<${1}pre>',$html);\n# \t$html = preg_replace('/<!--/','<!--',$html);\n# \t$html = preg_replace('/-->/',' -->',$html);\n# \n return content\n\nend",
"def merge_use_idml_or_folio(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :idml_import_dir\n )\n input_file_selector = config.compute_file_selector(\n options['file-selector'] || :all_files\n )\n input_file_extension = config.compute_file_extension(\n options['file-extension'] || :at_extension\n )\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Using either idml_at or folio_at for content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n idml_used_count = 0\n folio_used_count = 0\n\n # TODO: refactor this method to use Cli::Utils so that the changed-only flag works\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_idml_file_name)\n # Idml is present, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n idml_at = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, idml_at)\n success_count += 1\n idml_used_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, bt folio is, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n folio_at = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, folio_at)\n success_count += 1\n folio_used_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - IDML files used: #{ idml_used_count }\"\n $stderr.puts \" - Folio files used: #{ folio_used_count }\"\n $stderr.puts '-' * 80\n end",
"def merge!\n other_tag = Tag.find_by_name(self.name)\n if other_tag.nil? or other_tag.id == self.id\n return self\n else\n taggings.map(&:clone).each { |t| (t.tag = other_tag) && t.save! }\n self.destroy\n return other_tag\n end\n end",
"def tag_this_and_merchant_untagged_with(tag_list)\n self.tag_with(tag_list)\n # don't tag other transactions if this merchant has had autotags disabled\n return if MerchantUser.autotags_disabled?(User.current, merchant, amount.sign)\n\n non_split_tags = Tag.parse_to_tags(tag_list).reject(&:split)\n to_tag = self.merchant.txactions.with_account_key(self.account.account_key).with_sign(amount.sign).untagged\n to_tag.each{|tx| tx.tag_with(non_split_tags) } # don't propagate splits\n\n to_tag |= [self]\n end",
"def generate_merging(template, binding, path, tag_prefix)\n new_content = TemplateManager.new.generate(template, binding)\n @project.merge_new_content(new_content, path, \"Spec generated\", tag_prefix)\n end",
"def sync(save=true)\n counts = {}\n ArticleText.find_by_sql(\"SELECT article_id, text FROM article_texts WHERE text LIKE '%#{name}%'\").each { |at|\n counts[at.article_id.to_i] = at.text.scan(/#{name}/).size\n }\n # replace existing Tags\n self.tags = []\n counts.each { |t, count|\n self.tags.build({:count => count, :article_id => t, :term_id=>id})\n }\n self.save if save\n self\n end",
"def extract_tags\n extract_hashtags(content) do |tag|\n extracted_tag = Tag.find_or_create_by(name: tag.downcase)\n self.tags << extracted_tag unless tags.include? extracted_tag\n end\n end",
"def before_commit(content)\n HGVMetaIdentifier.preprocess(content)\n end",
"def copy_docx_import_to_content(options)\n input_base_dir = config.compute_base_dir(options['base-dir'] || :docx_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = options['output'] || config.base_dir(:content_dir)\n\n Repositext::Cli::Utils.copy_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'],\n \"Copying DOCX imported AT files to content\",\n options.merge(\n :output_path_lambda => lambda { |input_filename|\n input_filename.gsub(input_base_dir, output_base_dir)\n .gsub(/\\.docx\\.at\\z/, '.at')\n }\n )\n )\n end",
"def initialize(text, also_tagged_with=[], start_with=nil)\n chars = text.chars.to_a # Convert text into char\n\n if also_tagged_with.nil? || also_tagged_with.empty?\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).all_tags\n }\n else\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).with_all_tags(also_tagged_with).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).with_all_tags(also_tagged_with).all_tags\n }\n\n # Finally, filter any tags returned that are already in also_tagged_with\n tag_set.delete_if {|tag| also_tagged_with.include?(tag)}\n end\n\n # # Filter by start_with, if required\n if !start_with.nil? && !start_with.empty?\n tag_set.keep_if {|tag| tag.start_with?(start_with) }\n end\n\n @tags = tag_set\n end",
"def import\n gitpath_import = params['gitpath'] ;\n params['gitpath'] = params['gitpath'].sub(/^.*:[0-9]+/, '') ;\n end",
"def mass_tikify(text, destination)\n sentences = text.lines\n i = 0\n sentences.each do |s|\n log (\"Importing: sentence #{i}\") if (i % 1000) == 0\n begin\n# @env.transaction do |trans|\n tokens = NLP.tokenize(s).reject do |t|\n # Don't include usernames/urls as tokens\n (t[0]==('@')) \\\n || (t.include?('://')) \\\n || t.length > 30\n end\n tokstr = tokens.map { |t| tikify(t) }\n destination.add(tokstr)\n# end\n rescue LMDB::Error::MAP_FULL\n destination.expand()\n retry\n end\n i += 1\n end\n destination\n end",
"def merge\n document.update_attributes :access => access\n email_on_complete\n super\n end",
"def import\n # Get request token\n request_token = request.original_url.split('code=')[1]\n logger.debug request_token # TODO: remove this and the other logger.debug statements\n\n # Get access token\n access_token_url = 'https://avosapi.delicious.com/api/v1/oauth/token?client_id=' + @client_id.to_s + '&client_secret=' + @client_secret.to_s + '&grant_type=code&code=' + request_token\n response = RestClient.post access_token_url, nil\n access_token = JSON.parse(response)['access_token']\n logger.debug access_token\n\n # Get all bookmarks stored in delicious\n response = RestClient.get 'https://delicious.com/v1/posts/all?&tag_separator=comma', :Authorization => 'Bearer ' + access_token\n logger.debug response\n\n # Parse response and push bookmarks to 'links'\n xml_doc = Nokogiri::XML(response)\n xml_doc.xpath('//post').each do |post|\n url_str = Url.new({:url => post.xpath('@href').to_s, :icon => nil})\n title = post.xpath('@description').to_s\n description = post.xpath('@extended').to_s\n tags = post.xpath('@tag').to_s.split(',')\n logger.debug tags\n \n url = Url.find_by_url(post.xpath('@href').to_s)\n if url.nil?\n url = Url.new({:url => post.xpath('@href').to_s, :icon => nil})\n if !url.save\n render :status => 404\n end \n end \n\n bookmark = Bookmark.new({:url => url, :title => title, :description => description, :user => current_user})\n tags.each do |t|\n if Tag.where(:tagname => t.strip.gsub(' ', '-').downcase).size == 0\n tag = Tag.new\n tag.tagname = t.strip.gsub(' ','-').downcase\n bookmark.tags << tag\n else\n bookmark.tags << Tag.where(:tagname => t.strip.gsub(' ', '-').downcase).first\n end\n end unless tags.nil?\n\n if bookmark.save\n logger.debug \"Saved #{post}\"\n else\n logger.debug \"Failed to save #{post}\"\n end\n end\n redirect_to timeline_path, alert: 'Import from \\'Delicious\\' completed'\n end",
"def insert_after_multi(range, content); end",
"def find_subtitle_misalignments_between_qotd_and_content_at(date_code, posting_date_time, qotd_txt, content_at_txt, collector)\n end",
"def add_existing_annotation\n @text = AnnotationText.find(params[:annotation_text_id])\n @submission_file_id = params[:submission_file_id]\n @submission_file = SubmissionFile.find(@submission_file_id)\n @annotation = Annotation.new\n @annotation.update_attributes({\n line_start: params[:line_start],\n line_end: params[:line_end],\n submission_file_id: params[:submission_file_id]\n })\n @annotation.annotation_text = @text\n @annotation.save\n @submission = @submission_file.submission\n @annotations = @submission.annotations\n end",
"def import(params)\r\n if lines = params[:contact][:import_text]\r\n lines = params[:contact][:import_text].gsub(\"\\n\", '').split(\"\\r\")\r\n if lines.count >= 2\r\n header_labels = lines[0].split(',')\r\n lines.delete_at(0) # remove the header\r\n\r\n lines.each do |line|\r\n fields = line.split(',') # get fields\r\n\r\n if fields.count >= 5 # skip blank lines and short data\r\n name = fields[0].split(' ') # split name into first name and last name\r\n first_name = name[0] # address books can be a mess, so we're just assuming first name is first.\r\n last_name = '' # Assume no last name is provided.\r\n\r\n # If the name is something like \"John Van Burk\" then the first name will be \"John\" and the last name \"Van Burk\"\r\n if name.count >= 2\r\n last_name = name[1..-1].join(' ') # concat rest of name data.\r\n end\r\n\r\n # The google contacts export will have phone numbers like this:\r\n # Home,<home phone #>,\r\n # Work,<work phone #>,\r\n # Mobile,<cell phone #>,\r\n # If there's multiple phone #'s for a category, they will appear as <phone #> ::: <phone #> (yes, literally \" ::: \" with the spaces.)\r\n # Example:\r\n # Emma,,,Emma,,,,,,,,,,,,,,,,,,,,,,,* My Contacts,,,Home,5183290085,Mobile,5188211924 ::: 8577531441,,,,\r\n\r\n work_phone = get_phone('Work', header_labels, fields)\r\n home_phone = get_phone('Home', header_labels, fields)\r\n cell_phone = get_phone('Mobile', header_labels, fields)\r\n email = fields[header_labels.index('E-mail 1 - Value')]\r\n website = fields[header_labels.index('Website 1 - Value')]\r\n\r\n contact = Contact.new({user_id: session[:user_id], first_name: first_name, last_name: last_name, home_phone: home_phone, work_phone: work_phone, cell_phone: cell_phone, email: email, website: website})\r\n contact.save()\r\n end\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data besides the header to import.'\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data to import.'\r\n end\r\n\r\n nil\r\n end",
"def merge; end",
"def copy(to)\n if self == to\n raise ArgumentError, I18n.t(\"winnow.errors.tag.copy_name_error\")\n end\n \n if to.taggings.size > 0\n raise ArgumentError, I18n.t(\"winnow.errors.tag.copy_exists_error\", :to => to.name)\n end\n \n Tagging.connection.execute(%Q|\n INSERT INTO taggings(feed_item_id, strength, classifier_tagging, created_on, tag_id, user_id)\n (SELECT feed_item_id, strength, classifier_tagging, created_on, #{to.id}, #{to.user_id} FROM taggings WHERE tag_id = #{self.id})\n |)\n \n to.bias = self.bias \n to.description = self.description\n to.last_classified_at = self.last_classified_at\n to.save!\n end",
"def assign_tags_to_user\n current_user.tag(@quote, :with => params[:quote][:tag_list], :on => :tags)\n end",
"def tag_on(model, text)\n return if (text.length == 0)\n words = text.split(' ')\n taggings = []\n\n words.each do |word|\n tag = Tag.find_or_create_by(name: word)\n\n if Tagging.where(tagger: self, taggable: model, tag: tag).first \n return\n end\n\n tagging = self.taggings.create(tag: tag, taggable: model)\n if tagging\n tag.inc(:taggings_count, 1)\n else\n return\n end\n\n # taggings << tagging\n\n model_tag = model.model_tags.find_or_create_by(name: word)\n model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n model_tag.inc(:taggings_count, 1)\n model_tag.save \n model.reload\n end\n\n # taggings\n\n # return if (text.length == 0)\n\n # tag = Tag.find_or_create_by(name: text)\n\n # if Tagging.where(tagger: self, taggable: model, tag: tag).first \n # return\n # end\n\n # if tagging = self.taggings.create(tag: tag, taggable: model)\n # tag.inc(:taggings_count, 1)\n # end\n\n # model_tag = model.model_tags.find_or_create_by(name: text)\n # model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n # model_tag.inc(:taggings_count, 1)\n # model_tag.save \n # model.reload\n # tagging\n end",
"def tag_with(tags, attr = 'tag', owner = User.current_user, owned_tags_only = false)\n tags = Array(tags)\n # FIXME: yuck! - this is required so that self has an id and can be assigned to an Annotation.annotatable\n return if new_record? && !save\n\n current = annotations_with_attribute(attr)\n original = current\n current = current.select { |c| c.source == owner } if owned_tags_only\n for_removal = []\n current.each do |cur|\n for_removal << cur unless tags.include?(cur.value.text)\n end\n\n tags.each do |tag|\n exists = TextValue.where('lower(text) = ?', tag.downcase)\n # text_value exists for this attr\n if !exists.empty?\n\n # isn't already used as an annotation for this entity\n if owned_tags_only\n matching = Annotation.for_annotatable(self.class.name, id).with_attribute_name(attr).by_source(owner.class.name, owner.id).select { |a| a.value.text.casecmp(tag.downcase).zero? }\n else\n matching = Annotation.for_annotatable(self.class.name, id).with_attribute_name(attr).select { |a| a.value.text.casecmp(tag.downcase).zero? }\n end\n\n if matching.empty?\n annotation = Annotation.new(source: owner,\n annotatable: self,\n attribute_name: attr,\n value: exists.first)\n annotation.save!\n end\n else\n annotation = Annotation.new(source: owner,\n annotatable: self,\n attribute_name: attr,\n value: tag)\n annotation.save!\n end\n end\n for_removal.each(&:destroy)\n # return if the annotations have changed. just use the text to avoid issues with ID's changing\n original = original.collect { |a| a.value.text }.sort\n new = annotations_with_attribute(attr).collect { |a| a.value.text }.sort\n original != new\n end",
"def merge_texts!(hash, element)\n unless element.has_text?\n hash\n else\n # must use value to prevent double-escaping\n texts = +\"\"\n element.texts.each { |t| texts << t.value }\n merge!(hash, CONTENT_KEY, texts)\n end\n end",
"def report_count_files_with_gap_marks_and_subtitle_marks(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n total_count = 0\n with_gap_marks = 0\n with_subtitle_marks = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n with_gap_marks += 1 if contents.index('%')\n with_subtitle_marks += 1 if contents.index('@')\n # Uncomment next line to print line 7 of each file\n # puts contents.split(\"\\n\")[6][0,80] + ' ' + filename.split('/').last\n end\n\n lines = [\n \"Count of files with gap_marks and subtitle_marks\",\n '-' * 40,\n ]\n lines << \" - With gap_marks: #{ with_gap_marks }\"\n lines << \" - With subtitle_marks: #{ with_subtitle_marks }\"\n lines << '-' * 40\n lines << \"Checked #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'count_files_with_gap_marks_and_subtitle_marks.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report count_files_with_gap_marks_and_subtitle_marks`\\n\"\n }\n end",
"def merge_w2x\n if(/!inc! *([\\/\\w\\d._]+)([\\n])/ =~ @row;@rgx = $~)\n mac = @src_path+'/'+$1 \n src = $~.to_s #;p mac\n if File.exist?(mac)\n pop = $~.captures.pop\n #new = IO.read(mac).delete(\"\\r\").gsub(\"\\n\",\"\\n\"+@spc) \n new = read_w2tags(IO.read(mac))\n @doc_src= @row.gsub(src,new).split(\"\\n\")+@doc_src\n @row= @doc_src.shift+\"\\n\"\n parse_spc\n else\n @row.gsub!(src,\"<!--\"+mac+\", Not Found-->\\n\") \n nil\n end\n end\n end",
"def merge\n frm.link(:text=>\"Merge\").click\n AnnouncementsMerge.new(@browser)\n end",
"def merge\n @mergeit.merge_data(@input_files)\n end",
"def insert_after(range, content)\n @source_rewriter.insert_after(range, content)\n end",
"def insert_after(range, content)\n @source_rewriter.insert_after(range, content)\n end"
] | [
"0.6669897",
"0.6423653",
"0.5679911",
"0.5664879",
"0.5527974",
"0.5379095",
"0.5342197",
"0.52206373",
"0.5152867",
"0.5109662",
"0.50669765",
"0.50081336",
"0.49331763",
"0.478046",
"0.47328126",
"0.47231713",
"0.47207317",
"0.4708869",
"0.4655644",
"0.46509063",
"0.46256196",
"0.4618361",
"0.4615474",
"0.46153557",
"0.46071494",
"0.46071494",
"0.46071494",
"0.46071494",
"0.46071494",
"0.46071494",
"0.46071494",
"0.46071494",
"0.4588513",
"0.45884195",
"0.45722443",
"0.45665976",
"0.45612174",
"0.45541993",
"0.45444188",
"0.45423308",
"0.4542193",
"0.45362562",
"0.45320067",
"0.4516816",
"0.45108843",
"0.44946283",
"0.44942176",
"0.44858423",
"0.44805002",
"0.44575852",
"0.4455987",
"0.44461796",
"0.44461796",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44406444",
"0.44340378",
"0.44228768",
"0.4412707",
"0.44115692",
"0.44077253",
"0.43959558",
"0.43877426",
"0.43858778",
"0.43734193",
"0.43717292",
"0.43577588",
"0.4353974",
"0.43508878",
"0.4350351",
"0.43494633",
"0.4346038",
"0.4345902",
"0.43399295",
"0.43368527",
"0.4329368",
"0.43204984",
"0.43137148",
"0.43082204",
"0.43047696",
"0.42992863",
"0.42983994",
"0.42823568",
"0.4280018",
"0.4274779",
"0.427105",
"0.42709687",
"0.42637014",
"0.4256747",
"0.4255861",
"0.42556933",
"0.42549747",
"0.42482054",
"0.42475334",
"0.42475334"
] | 0.7781892 | 0 |
Merges record_marks from FOLIO XML import into IDML import Uses IDML as authority for text and all tokens except record_marks. If no IDML file is present, uses FOLIO XML as authority for everything. | def merge_record_marks_from_folio_xml_at_into_idml_at(options)
input_folio_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :folio_import_dir
)
input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)
input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)
input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)
output_base_dir = config.base_dir(:staging_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
idml_not_present_count = 0
folio_not_present_count = 0
# First get union of all Folio and Idml files
folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)
idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)
all_output_files = (folio_files + idml_files).map { |e|
# process folio files
e = e.gsub(input_folio_base_dir, output_base_dir)
.gsub(/\.folio\.at\z/, '.at')
# process idml files
e = e.gsub(input_idml_base_dir, output_base_dir)
.gsub(/\.idml\.at\z/, '.at')
}.uniq.sort
all_output_files.each do |output_file_name|
if output_file_name !~ /\.at\z/
$stderr.puts " - Skip #{ output_file_name }"
next
end
total_count += 1
# prepare paths
at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\.at\z/, '.folio.at')
at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\.at\z/, '.idml.at')
if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)
# Both files are present, merge tokens
begin
at_folio = File.read(at_folio_file_name)
at_idml = File.read(at_idml_file_name)
at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(
at_folio, at_idml
)
# write to file
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
$stderr.puts " + Merge rids from #{ at_folio_file_name }"
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
elsif File.exist?(at_folio_file_name)
# IDML file is not present, use Folio import as authority
FileUtils.mkdir_p(File.dirname(output_file_name))
at_with_merged_tokens = File.read(at_folio_file_name)
# write to file
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
idml_not_present_count += 1
$stderr.puts " Use #{ at_folio_file_name }"
elsif File.exist?(at_idml_file_name)
# Folio file is not present, use Idml import as authority
FileUtils.mkdir_p(File.dirname(output_file_name))
at_with_merged_tokens = File.read(at_idml_file_name)
# write to file
File.write(output_file_name, at_with_merged_tokens)
success_count += 1
folio_not_present_count += 1
$stderr.puts " Use #{ at_idml_file_name }"
else
raise "Could find neither Folio nor IDML file! (#{ output_file_name })"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts " - Folio files not present: #{ folio_not_present_count }"
$stderr.puts " - IDML files not present: #{ idml_not_present_count }"
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_author_identities_set(import_settings)\n import_settings.map do |import_setting|\n # ensure that we have a *new* identity worth saving\n next unless author_identity_different?(import_setting_to_attribs(import_setting))\n\n normalize_author_identity(import_setting['firstName'], import_setting.fetch('middleName', 'None'),\n import_setting['lastName'], import_setting.fetch('institution', 'None'))\n end.compact.to_s # we need to compact to reject the nils we get from skipping identities that are identical to the primary\n end",
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def prepare_identities_from_files; end",
"def alignmentMarkerLoad(inhash)\n \n log_info 'inhash', inhash # 1, 0\n if inhash[:sampleTypes] == 'DNA'\n alignment_markers = find(:item, sample: { name: MARKERS[inhash[:type_ind]][inhash[:cutoff_ind]] })\n elsif inhash[:sampleTypes] == 'RNA'\n alignment_markers = find(:item, { sample: { name: MARKERS[inhash[:type_ind]] } } )\n end\n log_info 'alignment marker ', alignment_markers\n alignment_marker=-1\n if(!(alignment_markers.nil?))\n alignment_marker=alignment_markers[0] \n end\n log_info 'alignment_marker', alignment_marker\n # marker currently in machine (location)\n # marker_in_analyzer = find(:item, object_type: { name: \"Stripwell\" })\n # .find { |s| s.datum[:matrix][0][0] == alignment_marker.sample.id && s.location == \"Fragment analyzer\"} # old version\n \n # TODO: use check_alignment_marker function\n marker_in_analyzer = find(:item, object_type: {name: \"Stripwell\"}).find {|s| s.location == 'Fragment analyzer'}\n \n # is requested marker different from marker in machine?\n different_marker =! (alignment_markers.include?(marker_in_analyzer))\n \n # old marker?\n old_marker=( (marker_in_analyzer.get(:begin_date) ? (Date.today - (Date.parse marker_in_analyzer.get(:begin_date)) >= 7) : true) )\n \n # need to replace? \n marker_needs_replacing = (old_marker) || (different_marker)\n \n # new alignment marker\n alignment_marker_stripwell = find(:item, object_type: { name: \"Stripwell\" })\n .find { |s| collection_from(s).matrix[0][0] == alignment_marker.sample.id &&\n s != marker_in_analyzer }\n \n if(debug) \n show do\n title \"DEBUG\"\n note \"marker_in_analyzer=#{marker_in_analyzer}\"\n note \"different marker = #{different_marker}\"\n note \"marker_needs_replacing = #{marker_needs_replacing}\"\n note \"looking for #{MARKERS[inhash[:type_ind]][inhash[:cutoff_ind]]}\"\n note \"alignment_marker_stripwell = #{alignment_marker_stripwell}\"\n end\n end\n\n # replace alignment marker\n if(marker_needs_replacing && alignment_marker_stripwell) \n show do\n title \"Place stripwell #{alignment_marker_stripwell} in buffer array\"\n note \"Move to the fragment analyzer.\"\n note \"Open ScreenGel software.\"\n check \"Click on the <b>Load Position</b> icon.\"\n check \"Open the sample door and retrieve the buffer tray.\"\n warning \"Be VERY careful while handling the buffer tray! Buffers can spill.\"\n if old_marker\n check \"Discard the current alignment marker stripwell (labeled #{marker_in_analyzer}).\"\n end\n check \"Place the alignment marker stripwell labeled #{alignment_marker_stripwell} in the MARKER 1 position of the buffer array.\"\n image \"make_marker_placement\"\n check \"Place the buffer tray in the buffer tray holder\"\n image \"make_marker_tray_holder\"\n check \"Close the sample door.\"\n end\n alignment_marker_stripwell.location = \"Fragment analyzer\"\n alignment_marker_stripwell.save\n if(old_marker) # replaced because old one was outdated\n alignment_marker_stripwell.associate :begin_date, Date.today.strftime \n alignment_marker_stripwell.save\n release [alignment_marker_stripwell] \n marker_in_analyzer.mark_as_deleted # trash outdated marker\n else # move current marker to SF2 (small fridge 2)\n marker_in_analyzer.location = \"SF2\"\n marker_in_analyzer.save\n end\n end\n end",
"def parse_annotation_file filename\n lines = File.open(filename,'r').read.split(\"\\n\")\n puts lines.size\n bad_header = lines.shift.split(\"\\t\")\n header = %w'seq_id reciprocal_id reciprocal_rank sp_symbol sp_evalue sp_description pfam_ids go_ids'\n data = []\n lines.each do |line|\n fields = line.split(\"\\t\")\n fields = fields.collect {|f| (f == \"#N/A\") ? nil : f}\n d = Hash[header.zip(fields)]\n d['pfam_ids'] = (d['pfam_ids']) ? d['pfam_ids'].split(\";\") : []\n\n d['go_ids'] = (d['go_ids']) ? d['go_ids'].split(\";\") : []\n data << d\n end\n data\nend",
"def validate_idml_import(options)\n options['report_file'] ||= config.compute_glob_pattern(\n 'idml_import_dir/validation_report_file'\n )\n reset_validation_report(options, 'validate_idml_import')\n file_specs = config.compute_validation_file_specs(\n primary: 'idml_import_dir/all_files', # for reporting only\n idml_sources: options['input'] || 'idml_import_dir/idml_files',\n imported_at_files: 'idml_import_dir/at_files',\n imported_repositext_files: 'idml_import_dir/repositext_files',\n )\n validation_options = {\n 'idml_parser_class' => config.kramdown_parser(:idml),\n 'idml_validation_parser_class' => config.kramdown_parser(:idml_validation),\n 'kramdown_converter_method_name' => config.kramdown_converter_method(:to_at),\n 'kramdown_parser_class' => config.kramdown_parser(:kramdown),\n 'kramdown_validation_parser_class' => config.kramdown_parser(:kramdown_validation),\n }.merge(options)\n if options['run_options'].include?('pre_import')\n Repositext::Validation::IdmlPreImport.new(file_specs, validation_options).run\n end\n if options['run_options'].include?('post_import')\n Repositext::Validation::IdmlPostImport.new(file_specs, validation_options).run\n end\n end",
"def inline_mark(text)\n # process simple inlines\n for inline in INLINES_MARK\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\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}#{index}[#{body}]#{after}\"\n end\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}[#{link}](#{url})#{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 merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def validate_idml_import(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :idml_import_dir, :validation_report_file, ''\n )\n reset_validation_report(options, 'validate_idml_import')\n input_base_dir = config.compute_base_dir(options['base-dir'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n idml_sources_file_extension = config.compute_file_extension(\n options['file-extension'] || :idml_extension\n )\n file_specs = config.compute_validation_file_specs(\n primary: [input_base_dir, input_file_selector, idml_sources_file_extension], # for reporting only\n idml_sources: [input_base_dir, input_file_selector, idml_sources_file_extension],\n imported_at_files: [input_base_dir, input_file_selector, :at_extension],\n imported_repositext_files: [input_base_dir, input_file_selector, :repositext_extensions],\n )\n validation_options = {\n 'config' => config,\n 'idml_parser_class' => config.kramdown_parser(:idml),\n 'idml_validation_parser_class' => config.kramdown_parser(:idml_validation),\n 'kramdown_converter_method_name' => config.kramdown_converter_method(:to_at),\n 'kramdown_parser_class' => config.kramdown_parser(:kramdown),\n 'kramdown_validation_parser_class' => config.kramdown_parser(:kramdown_validation),\n }.merge(options)\n if options['run_options'].include?('pre_import')\n Repositext::Validation::IdmlPreImport.new(file_specs, validation_options).run\n end\n if options['run_options'].include?('post_import')\n Repositext::Validation::IdmlPostImport.new(file_specs, validation_options).run\n end\n end",
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def idml_import_consistent?(idml_import_at_file, content_at_file)\n idml_import_at_doc = Kramdown::Document.new(\n idml_import_at_file.contents,\n :input => 'KramdownRepositext'\n )\n content_at_doc = Kramdown::Document.new(\n content_at_file.contents,\n :input => 'KramdownRepositext'\n )\n\n idml_import_at_plain_text = idml_import_at_doc.to_plain_text\n content_at_plain_text = content_at_doc.to_plain_text\n\n # A.D., A.M., and B.C. are lower cased after record ids were merged\n # as part of the import command. We lower case them in both to\n # avoid getting validation errors from this.\n idml_import_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n idml_import_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n idml_import_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n content_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n content_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n content_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n\n diffs = Suspension::StringComparer.compare(idml_import_at_plain_text, content_at_plain_text)\n\n if diffs.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n diffs.map { |diff|\n Reportable.error(\n {\n filename: content_at_file.filename,\n corr_filename: idml_import_at_file.filename,\n },\n ['Plain text diference between idml_import_at and content_at', diff]\n )\n }\n )\n end\n end",
"def process_alignment\n # init vars\n @names = []\n @seqs = []\n \n @alignment = \"-B #{@basename}.aln\"\n\n # import alignment file\n @content = IO.readlines(@infile).map {|line| line.chomp}\n \n #check alignment for gap-only columns\n remove_inserts\n \n #write query-file\n File.open(@infile, \"w\") do |file|\n file.write(\">#{@names[0]}\\n\")\n file.write(\"#{@seqs[0]}\\n\")\n end\n \n #write aln-file\n File.open(@basename + \".aln\", \"w\") do |file|\n @names.each_index do |num|\n file.write(\"Sequence#{num} \")\n file.write(\" \") if (num < 10)\n file.write(\" \") if (num < 100)\n file.write(\"#{@seqs[num]}\\n\")\n end\n end\n end",
"def handle_people(data, import)\n path = @args[:data_directory] + 'TXT/people.txt'\n raise 'file not found' if not File.exists?(path)\n f = CSV.open(path, col_sep: \"\\t\", :headers => true)\n\n print 'Handling people '\n if import.metadata['people']\n print \"from database. Indexing People by PeopleID...\"\n f.each do |row|\n data.people_id.merge!(row['PeopleID'] => row)\n end\n\n DataAttribute.where(import_predicate: 'PeopleID', attribute_subject_type: 'User').each do |u|\n $user_index.merge!(u.value => u.attribute_subject_id)\n end\n\n DataAttribute.where(import_predicate: 'PeopleID', attribute_subject_type: 'People').each do |p|\n PEOPLE.merge!(p.value => p.attribute_subject_id)\n end\n\n print \"done.\\n\"\n else\n print \"as newly parsed.\\n\"\n f.each do |row|\n puts \"\\tNo last name: #{row}\" if row['LastName'].blank?\n p = Person::Vetted.new(\n last_name: row['LastName'] || 'Not Provided',\n first_name: row['FirstName'],\n data_attributes_attributes: [ {value: row['PeopleID'], import_predicate: 'PeopleID', type: 'ImportAttribute'} ]\n )\n p.notes.build(text: row['Comments']) if !row['Comments'].blank?\n p.save!\n #data.people.merge!(row => p)\n data.people_id.merge!(row['PeopleID'] => row)\n PEOPLE.merge!(row['PeopleID'] => p)\n end\n import.metadata['people'] = true\n end\n end",
"def create_affi_obj(lines_list, auth_id)\n tkn_idx = 0\n auth_affi = Author_Affiliation.new()\n auth_affi.article_author_id = auth_id\n inst_found = \"\"\n #while tkn_idx < lines_list.count\n while tkn_idx < lines_list.count\n a_line = lines_list[tkn_idx].strip\n # lines_hash.keys.each do |line_key|\n # a_line = lines_hash[line_key].strip\n # first element is designated as the affilition\n if tkn_idx == 0\n auth_affi.name = a_line\n elsif $affi_countries.include?(a_line)\n auth_affi.country = a_line\n elsif $affi_institutions.include?(a_line)\n if auth_affi.name != nil\n # if the affiliation name is not an institution\n # add institution to name and make short name the institution\n # otherwise shot name is the same as name\n if $affi_institutions.include?(auth_affi.name) or \\\n $institution_synonyms.keys.include?(auth_affi.name.to_sym) then\n auth_affi.short_name = auth_affi.name\n auth_affi.add_01 = a_line\n else\n auth_affi.name = auth_affi.name + \", \" + a_line\n auth_affi.short_name = a_line\n end\n end\n elsif $institution_synonyms.keys.include?(a_line.to_sym) then\n if auth_affi.name != nil\n # if the affiliation name is not an institution\n # add institution to name and make short name the institution\n # otherwise shot name is the same as name\n if !$affi_institutions.include?(auth_affi.name) and \\\n !$institution_synonyms.keys.include?(auth_affi.name.to_sym) then\n auth_affi.name = auth_affi.name + \", \" + $institution_synonyms[a_line.to_sym]\n auth_affi.short_name = $institution_synonyms[a_line.to_sym]\n else\n auth_affi.short_name = $institution_synonyms[a_line.to_sym]\n end\n end\n elsif auth_affi.add_01 == nil\n auth_affi.add_01 = a_line\n elsif auth_affi.add_02 == nil\n auth_affi.add_02 = a_line\n elsif auth_affi.add_03 == nil\n auth_affi.add_03 = a_line\n elsif auth_affi.add_04 == nil\n auth_affi.add_04 = a_line\n elsif auth_affi.add_05 == nil\n auth_affi.add_05 = a_line\n elsif auth_affi.add_05 != nil # case more than 5 tokes in address\n auth_affi.add_05 += \", \" + a_line\n end\n tkn_idx += 1\n end\n\n # make sure there is a short name, if blank make it the same as name\n if auth_affi.short_name == nil\n auth_affi.short_name = auth_affi.name\n end\n\n # if country is missing get check all addres lines in object\n if auth_affi.country == nil\n got_it = false\n auth_affi.instance_variables.each do |instance_variable|\n # look for country name in address strings\n if instance_variable.to_s.include?(\"add_0\") then\n #print instance_variable\n value = auth_affi.instance_variable_get(instance_variable)\n ctry = get_country_any(value.to_s)\n if ctry != nil then\n auth_affi.country = ctry\n value = drop_country(value)\n auth_affi.instance_variable_set(instance_variable, value)\n break\n end\n end\n end\n # look for country in affiliation name\n if auth_affi.country.to_s == \"\" then\n ctry = get_country_any(auth_affi.name)\n auth_affi.country = ctry\n end\n # look for country in institution table\n if auth_affi.country.to_s == \"\" then\n inst_found = auth_affi.name\n # separate lookup for sysnonyms as they are not registered as institution\n if $affi_institutions.include?(auth_affi.name)\n inst_found = auth_affi.name\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $affi_institutions.include?(auth_affi.short_name)\n inst_found = auth_affi.short_name\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $institution_synonyms.keys.include?(auth_affi.name.to_sym)\n inst_found = $institution_synonyms[auth_affi.name.to_sym]\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $institution_synonyms.keys.include?(auth_affi.short_name.to_sym)\n inst_found = $institution_synonyms[auth_affi.short_name.to_sym]\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n end\n end\n end\n return auth_affi\nend",
"def reid_annotations!(annotations, doc)\n existing_ids = doc.get_annotation_hids(id)\n unless existing_ids.empty?\n id_change = {}\n if annotations.has_key?(:denotations)\n annotations[:denotations].each do |a|\n id = a[:id]\n id = Denotation.new_id while existing_ids.include?(id)\n if id != a[:id]\n id_change[a[:id]] = id\n a[:id] = id\n existing_ids << id\n end\n end\n\n if annotations.has_key?(:relations)\n annotations[:relations].each do |a|\n id = a[:id]\n id = Relation.new_id while existing_ids.include?(id)\n if id != a[:id]\n id_change[a[:id]] = id\n a[:id] = id\n existing_ids << id\n end\n a[:subj] = id_change[a[:subj]] if id_change.has_key?(a[:subj])\n a[:obj] = id_change[a[:obj]] if id_change.has_key?(a[:obj])\n end\n end\n\n if annotations.has_key?(:attributes)\n Attrivute.new_id_init\n annotations[:attributes].each do |a|\n id = a[:id]\n id = Attrivute.new_id while existing_ids.include?(id)\n if id != a[:id]\n a[:id] = id\n existing_ids << id\n end\n a[:subj] = id_change[a[:subj]] if id_change.has_key?(a[:subj])\n end\n end\n\n if annotations.has_key?(:modifications)\n annotations[:modifications].each do |a|\n id = a[:id]\n id = Modification.new_id while existing_ids.include?(id)\n if id != a[:id]\n a[:id] = id\n existing_ids << id\n end\n end\n end\n end\n end\n\n annotations\n end",
"def import_idml(options)\n import_idml_specific_steps(options)\n import_shared_steps(options)\n end",
"def parse_taxon_ids_list full_document\n full_document.gsub(/%tl\\[(.*?)\\]/) do\n ids_string = $1\n ids = ids_string.gsub(\" \", \"\").split(\",\")\n\n ids.map do |id|\n try_linking_taxon_id id\n end.join(\", \")\n end\n end",
"def mirror_author_identities(import_settings)\n return if import_settings.blank?\n # Return if no changes in author identifies.\n return false if author_identities_set == import_author_identities_set(import_settings)\n\n transaction do\n author_identities.clear # drop all existing identities\n import_settings.each do |i|\n attribs = import_setting_to_attribs(i)\n # ensure that we have a *new* identity worth saving\n next unless author_identity_different?(attribs)\n\n # can't call create! on an unsaved record\n new_record? ? author_identities.build(attribs) : author_identities.create!(attribs)\n end\n end\n make_harvestable\n true\n end",
"def process_record(record)\n # filter out unwanted namespaces\n return nil unless record[\"id\"].start_with?(PID_NAMESPACE)\n\n # remove Etd and GenericFiles and other unwanted objects\n return nil if %w(Etd FindingAid GenericFile Person Profile ProfileSection LinkedResource Hydramata::Group).include?(record[\"active_fedora_model_ssi\"])\n\n # remove non-public items\n read_groups = record[\"read_access_group_ssim\"]\n return nil unless !read_groups.nil? && read_groups.include?(\"public\")\n\n # convert each id into a URL\n record[\"id\"] = record[\"id\"].sub(/^[^:]*:/, \"https://curate.nd.edu/show/\")\n record\n end",
"def do_rec_note_prep(l, r)\n if r =~ /JapaneseAuthorsMap:\\s*(.*)\\},/\n mapstr = $1\n maplist = mapstr.split(/,\\s*/)\n maplist.each do |a|\n e, j = a.split(/:\\s*/)\n add_author_map(e, j)\n f, l = e.split(/\\s+/)\n add_author_map(\"#{l}, #{f}\", j)\n end\n end\n [l, r]\n end",
"def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end",
"def create_or_update_aleph_identity\n identity = identities.find_or_initialize_by(uid: omniauth_hash_map.nyuidn, provider: \"aleph\")\n aleph_patron = begin\n Login::Aleph::PatronLoader.new(omniauth_hash_map.nyuidn).patron\n rescue Exception => e\n Raven.capture_exception(e)\n nil\n end\n # Start with the omniauth hash to create the identity if user logged in with Aleph\n identity.properties.merge!(omniauth_hash_map.properties) if omniauth_hash_map.provider == 'aleph'\n # If the patron was also found from the loader, update the properties to those\n # since they may be more up to date from the flat file\n identity.properties.merge!(aleph_patron.attributes) if aleph_patron.present?\n identity.updated_at = Time.now\n identity.save\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def merge_identities(user, auth)\n if auth.info[:first_name] && !user.first_name.present?\n user.first_name = auth.info[:first_name]\n end\n\n if auth.info[:last_name] && !user.last_name.present?\n user.last_name = auth.info[:last_name]\n end\n\n if auth.info[:email] && !user.email.present?\n user.email = auth.info[:email]\n end\n\n create_new_identity(user,auth)\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def record\n @record ||= if params[:annotation_category_id]\n AnnotationText.find_by(id: params[:id])\n elsif params[:annotation_text_id]\n AnnotationText.find_by(id: params[:annotation_text_id])\n else\n AnnotationCategory.find_by(id: params[:id])\n end\n end",
"def set_markinfo\n @markinfo = Markinfo.find(params[:id])\n end",
"def delete_from_body(start_mark, end_mark, delete_marks=false)\n if delete_marks\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"\")\n else\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"#{start_mark}#{end_mark}\")\n end\n update_issue({ body: @issue_body })\n end",
"def transform_enrollment_file\n #puts \"Transforming enrollment file for #{@district.name}\"\n att_array = []\n enr_array = []\n tmp_array = []\n #Load up the attendance and enrollment files into arrays\n for file_path in @files\n if !File.directory?(file_path)\n IO.foreach(file_path, sep_string = get_sep_string(file_path)) do |line|\n unless line.blank?\n line.gsub!(/[\"][^\"]*[\"]/) { |m| m.gsub(',','|') }\n att_array.push(line) if file_path.downcase.index('att')\n enr_array.push(line) if file_path.downcase.index('enroll')\n end \n end\n end\n end\n #Process enrollment file for rewrite\n @file_to_write = File.open(File.join(@dir, \"tmp_e.tmp\"),\"w\")\n #Run through each attendance record, when tea_id matches, use enrollment value to re-build enrollment file\n #with report dates\n att_array.each do |rec|\n date,@tmp_tea_id,absent = rec.split(\",\") if @allowed_attendance_headers.length == 3\n date,@tmp_tea_id,school_name,absent = rec.split(\",\") if @allowed_attendance_headers.length == 4\n if date.downcase.index(\"date\").blank?\n enr_array.each do |line|\n @enrolled = 0\n tmp_line = line.split(@delimiter)\n if tmp_line.length == 3\n if is_date?(tmp_line.first.gsub('\"',''))\n enroll_date,tea_id,enrolled = tmp_line\n else\n tea_id,name,enrolled = tmp_line\n end \n elsif tmp_line.length == 4\n enroll_date,tea_id,name,enrolled = tmp_line \n end\n unless @six_digit_campus_id\n tea_id = \"0#{value}\" if tea_id.length == 2\n tea_id = \"00#{value}\" if tea_id.length == 1\n tea_id = \"#{@district.district_id}#{tea_id}\"\n end\n @tmp_tea_id.gsub!('\"',\"\")\n tea_id.gsub!('\"',\"\")\n @tmp_tea_id.gsub!(\"'\",\"\")\n tea_id.gsub!(\"'\",\"\")\n tea_id.strip!\n @tmp_tea_id.strip!\n enrolled.strip!\n enrolled.gsub!('\"',\"\")\n enrolled.gsub!(\"'\",\"\")\n enrolled.gsub!(\"|\",\"\")\n if tea_id.to_i != @tmp_tea_id.to_i\n next\n else\n @enrolled = enrolled.to_i\n break\n end\n end\n tmp_array.push('\"'+date.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+@tmp_tea_id.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+school_name.gsub('\"',\"\").gsub('|',',')+'\"') unless school_name.blank?\n tmp_array.push('\"'+\"#{@enrolled}\"+'\"')\n @file_to_write.puts tmp_array.join(\",\")\n tmp_array = [] \n end\n end\n @file_to_write.close\n for file_path in @files\n if file_path.downcase.index('enroll')\n #Delete file just read\n File.delete(file_path)\n #Rename temp file to previously read file\n File.rename(File.join(@dir, \"tmp_e.tmp\"), file_path)\n end\n end\n end",
"def strip_annotations(content); end",
"def clear_marks\n @entries.each { |e| e[MARKED] = 0 }\n write_index\n end",
"def get_author_list(record)\n author_list = []\n authors_primary = record.find { |f| f.tag == '100' }\n begin\n author_primary = authors_primary.find { |s| s.code == 'a' }.value unless authors_primary.nil?\n rescue StandardError\n ''\n end\n author_list.push(clean_end_punctuation(author_primary)) unless author_primary.nil?\n authors_secondary = record.find_all { |f| f.tag == '700' }\n authors_secondary&.each do |l|\n unless l.find { |s| s.code == 'a' }.nil?\n author_list.push(clean_end_punctuation(l.find { |s| s.code == 'a' }.value)) unless l.find { |s| s.code == 'a' }.value.nil?\n end\n end\n author_list.uniq!\n author_list\n end",
"def adapt_record(endnote_hash)\n # This will only work with endnote 8\n rec = endnote_hash[:endnote_record]\n\n @id = rec.id\n @title = rec.title\n @alt_title = rec.alt_title\n @pubyear = rec.pubyear\n @abstract = rec.abstract\n @language = rec.language\n @keywords = rec.keywords\n @publisher = rec.publisher\n @place = rec.place\n @patent_applicant = rec.patent_applicant\n @patent_date = rec.patent_date\n @patent_number = rec.patent_number\n @isbn = rec.isbn\n @issn = rec.issn\n @extent = rec.extent\n @sourcetitle = rec.sourcetitle\n @sourcevolume = rec.sourcevolume\n @sourceissue = rec.sourceissue\n @sourcepages = rec.sourcepages\n @article_number = rec.article_number\n @doi = rec.doi\n @doi_url = rec.doi_url\n add_identifier(@doi, 'doi')\n add_identifier(rec.pubmed_id, 'pubmed')\n add_identifier(rec.scopus_id, 'scopus-id')\n add_identifier(rec.extid.split(':').last, 'isi-id')\n add_publication_link(@doi_url, 1)\n @xml = rec.xml\n end",
"def export_as_refworks_marc_txt\n fields = to_marc.find_all {|f| ('000'..'999') === f.tag}\n text = \"LEADER #{to_marc.leader}\"\n fields.each do |field|\n unless [\"940\", \"999\"].include?(field.tag)\n if field.is_a?(MARC::ControlField)\n text << \"#{field.tag} #{field.value}\\n\"\n else\n text << \"#{field.tag} \"\n text << (field.indicator1 ? field.indicator1 : \" \")\n text << (field.indicator2 ? field.indicator2 : \" \")\n text << \" \"\n field.each {|s| s.code == 'a' ? text << \"#{s.value}\" : text << \" |#{s.code}#{s.value}\"}\n text << \"\\n\"\n end\n end\n end\n\n # As of 11 May 2010, Refworks has a problem with UTF-8 if it's decomposed,\n # it seems to want C form normalization, although RefWorks support\n # couldn't tell me that. -jrochkind\n text = text.unicode_normalize(:nfc)\n\n return text\n end",
"def combine_token_nfas(token_records)\n\n # Create a new distinguished start state\n\n start_state = State.new(0)\n baseId = 1\n\n token_records.each do |tk|\n regParse = tk.reg_ex\n\n oldToNewMap, baseId = regParse.start_state.duplicateNFA(baseId)\n\n dupStart = oldToNewMap[regParse.start_state]\n\n # Transition from the expression's end state (not a final state)\n # to a new final state, with the transitioning edge\n # labelled with the token id (actually, a transformed token id to distinguish\n # it from character codes)\n dupEnd = oldToNewMap[regParse.endState]\n\n dupfinal_state = State.new(baseId)\n baseId += 1\n dupfinal_state.final_state = true\n\n # Why do I need to add 'ToknInternal.' here? Very confusing.\n dupEnd.addEdge(CodeSet.new(ToknInternal.token_id_to_edge_label(tk.id)), dupfinal_state)\n\n # Add an e-transition from the start state to this expression's start\n start_state.addEdge(CodeSet.new(EPSILON),dupStart)\n end\n start_state\n end",
"def merge(prt_pdb, lig_pdb, complex_pdb)\n prt_lines = File.readlines(prt_pdb)\n lig_lines = File.readlines(lig_pdb)\n\n prt_atm_lines = prt_lines.select { |line| /ATOM/ =~ line }\n lig_atm_lines = lig_lines.select { |line| /HETATM/ =~ line}\n\n f = File.open(complex_pdb, 'w')\n\n f.write(\"MODEL 1\\n\")\n prt_atm_lines.each do |line| f.write(line) end\n f.write(\"TER\\n\")\n lig_atm_lines.each do |line| f.write(line) end\n f.write(\"END\\n\")\n\n f.close()\n\nend",
"def consume_lines(lines)\n log \"Removing commented lines and sorting mentions\"\n\n statements = []\n mentions = []\n lines.each do |l|\n next if l.start_with?('#') # Remove commented lines\n next if l.include?('RT') || l.include?('MT') # Remove soft retweets\n\n if l[0]==('@') || l.match(/\\s@/)\n mentions << NLP.normalize(l)\n else\n statements << NLP.normalize(l)\n end\n end\n\n text = statements.join(\"\\n\").encode('UTF-8', :invalid => :replace)\n mention_text = mentions.join(\"\\n\").encode('UTF-8', :invalid => :replace)\n\n lines = nil; statements = nil; mentions = nil # Allow garbage collection\n\n log \"Tokenizing #{text.count('\\n')} statements and #{mention_text.count('\\n')} mentions\"\n\n mass_tikify(text, @smodel)\n mass_tikify(mention_text, @mmodel)\n\n @keywords.import(NLP.keywords(text).top(2000).map(&:to_s))\n log \"Top keywords: #{@keywords[0]} #{@keywords[1]} #{@keywords[2]}\"\n\n self\n end",
"def add_mark(assessment, student_number, mark)\n assessment.marks[student_number] = mark\n end",
"def load_identities(identities, ask_passphrase, ignore_decryption_errors); end",
"def before_commit(content)\n DCLPTextIdentifier.preprocess(content)\n end",
"def attach_identifiers(provenance:, affiliation:, result: {}, json: {})\n return affiliation unless affiliation.new_record?\n\n ror_prov = Provenance.where(name: 'ror').first\n\n # First use any identifiers returned by ROR\n if ror_prov.present? && result.present? && (result[:ror].present? || result[:fundref].present?)\n if result[:ror].present?\n affiliation.identifiers << ::Identifier.find_or_initialize_by(\n provenance: ror_prov, category: 'ror', descriptor: 'is_identified_by',\n value: \"https://ror.org/#{result[:ror]}\", identifiable_type: 'Affiliation'\n )\n end\n if result[:fundref].present?\n affiliation.identifiers << ::Identifier.find_or_initialize_by(\n provenance: ror_prov, category: 'fundref', descriptor: 'is_identified_by',\n value: \"https://api.crossref.org/funders/#{result[:fundref]}\",\n identifiable_type: 'Affiliation'\n )\n end\n end\n\n # Otherwise take any identifiers passed in the JSON\n id = json.fetch(:affiliation_id, json.fetch(:funder_id, {}))\n if id.present? && id[:identifier].present?\n identifier = Api::V0::Deserialization::Identifier.deserialize(\n provenance: provenance, identifiable: affiliation, json: id\n )\n affiliation.identifiers << identifier if identifier.present? && identifier.new_record?\n end\n affiliation\n end",
"def parse_kanjidic lines\n line_number=1\n # get id values from the tables for the various attributes such as kunyomi, onyomi etc\n # to be used in the join tables \n readings_to_import= {}\n @lookup_attributes.each do |column|\n #stores readings in a hash of arrays with the key being\n #the attribute name e.g. :nanori, :kunyomi, etc\n readings_to_import[column]=[]\n end \n\n\n #create empty arrays to store index values\n indexes_to_import= [] #2D array of [[dictionary_id, kanji_id, index_value],...]\n\n lines.each do |line|\n unless line_number == 1\n kanji = get_element(:kanji,line)\n kanji_id = @kanji_lookup[kanji]\n #for each of nanori, onyomi, meanings, pinyin etc\n @lookup_attributes.each do |column| \n #get each of the multiple value attributes and append them to an array \n #to import at the end\n klass = eval(column.to_s.capitalize)\n relation_klass = eval(column.to_s.capitalize.pluralize+\"Kanji\")\n lookup = \"@#{column}_lookup\"\n #puts lookup\n lookup = eval(lookup)\n\n values = get_element(column, line)\n values.each do |value|\n #e.g. equivalent to o=Onyomi.find_by_onyomi onyomi\n relation_id = lookup[value]\n # e.g. equivalent to array << OnyomisKanji.new(:kanji_id=>id,:onyomi_id =>o.id)\n readings_to_import[column] << [kanji_id ,relation_id]\n end\n end \n\n #for the indexes we have a KanjiIndex table an Dictionaries table\n #and a KanjiIndex has a dictionary_id column\n @index_names.each do |index_name|\n indexes_to_import += get_dictionary_index(index_name, line)\n end\n\n end\n line_number +=1\n end\n return readings_to_import, indexes_to_import\n end",
"def create_or_update_aleph_identity\n identity = identities.find_or_initialize_by(uid: omniauth_hash_map.nyuidn, provider: \"aleph\")\n if identity.expired?\n aleph_patron = Login::Aleph::PatronLoader.new(omniauth_hash_map.nyuidn).patron\n # Start with the omniauth hash to create the identity if user logged in with Aleph\n identity.properties.merge!(omniauth_hash_map.properties) if omniauth_hash_map.provider == 'aleph'\n # If the patron was also found from the loader, update the properties to those\n # since they may be more up to date from the flat file\n identity.properties.merge!(aleph_patron.attributes) if aleph_patron.present?\n identity.save\n end\n end",
"def merge_use_idml_or_folio(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :idml_import_dir\n )\n input_file_selector = config.compute_file_selector(\n options['file-selector'] || :all_files\n )\n input_file_extension = config.compute_file_extension(\n options['file-extension'] || :at_extension\n )\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Using either idml_at or folio_at for content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n idml_used_count = 0\n folio_used_count = 0\n\n # TODO: refactor this method to use Cli::Utils so that the changed-only flag works\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_idml_file_name)\n # Idml is present, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n idml_at = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, idml_at)\n success_count += 1\n idml_used_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, bt folio is, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n folio_at = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, folio_at)\n success_count += 1\n folio_used_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - IDML files used: #{ idml_used_count }\"\n $stderr.puts \" - Folio files used: #{ folio_used_count }\"\n $stderr.puts '-' * 80\n end",
"def pubannos(data)\n \n result = JSON.parse(data)\n \n if result.has_key? 'Error'\n raise BioInterchange::Exceptions::InputFormatError, 'Error parsing the JSON input file: #{result[\"Error\"]}'\n end\n \n \n text = result['text']\n #doc_uri = \"http://pubannotation.dbcls.jp/pmdocs/\" + result['pmid'].to_s\n doc_uri = result['docurl']\n \n doc = Document.new(doc_uri)\n docContent = Content.new(0, text.length, Content::DOCUMENT, @process)\n docContent.setContext(doc)\n doc.add(docContent)\n \n #so our document requires content of type document or abstract\n #should it hold the content string?\n\n #hash to remember annotation in case they are needed for building upon based on ids later\n contents = {}\n\n if result['catanns']\n result['catanns'].each do |annot| \n start_offset = 0\n end_offset = 0\n if annot['span']\n start_offset = annot['span']['begin']\n end_offset = annot['span']['end']\n elsif annot['begin'] and annot['end']\n start_offset = annot['begin']\n end_offset = annot['end']\n end\n length = end_offset - start_offset\n\n category = annot['category']\n id = annot['id']\n \n entity = text.slice(start_offset..end_offset)\n \n #phrase = type for NE\n con = Content.new(start_offset, length, Content::PHRASE, @process)\n con.setContext(doc)\n doc.add(con)\n\n contents[id] = con \n \n #set process.date = updated_time?\n end\n end\n \n if result['insanns']\n result['insanns'].each do |annot|\n \n #unsure what to do about this (con1), 'E1' is the ID of something not created yet.\n #it is perhaps a case of making a new content, but with what params...?\n #need to conform what this is refering to with JDK\n con1 = nil \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'subClassOf'\n type = ContentConnection::SUBCLASS\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['relanns']\n result['relanns'].each do |annot|\n con1 = contents[annot['subject']] \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'equivalentTo'\n type = ContentConnection::EQUIVALENCE\n when 'themeOf'\n type = ContentConnection::THEME\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['modanns']\n result['modanns'].each do |annot|\n \n #in this case, it is a modification of an already existing content object (speculation/negation). \n con = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'Speculation'\n type = ContentConnection::SPECULATION\n when 'Negation'\n type = ContentConnection::NEGATION\n end\n connection = ContentConnection.new(con, nil, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n doc\n end",
"def output_idmap(refseq_data, up)\n taxid = refseq_data[:taxid]\n gene_label_url = URI.escape(refseq_data[:gene_label])\n up = up.split(\"-\").first if up.index(\"-\") # with \"-\" means isoform's ID. expect to protein's ID\n\n unless $gene_up_list[\"#{refseq_data[:gene_rsrc]}:#{up}\"]\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"rdfs:seeAlso\", \"upid:#{up}\")\n $output_ttl.puts triple(\"upid:#{up}\", \"rdf:type\", \"<http://identifiers.org/uniprot>\")\n $output_ttl.puts triple(\"upid:#{up}\", \"rdfs:seeAlso\", \"up:#{up}\")\n $output_ttl.puts triple(\"up:#{up}\", \"dct:publisher\", \"<http://identifirs.org/miriam.resource/MIR:00100134>\") # UniProt (www.uniprot.org)\n $output_ttl.puts triple(\"upid:#{up}\", \"rdfs:seeAlso\", \"tax:#{taxid}\")\n $gene_up_list[\"#{refseq_data[:gene_rsrc]}:#{up}\"] = true # to prevent duplicate output\n $taxid_list[taxid] = true\n end\nend",
"def generate_zotero_defaults\n xml = Nokogiri::XML(@datastreams[\"zotero\"]) \n id_hash = {}\n # no public or private tag -> private per tcramer, 11/28\n id_hash[\"access_display\"] ||= [\"Private\"]\n id_hash[\"access_facet\"] ||= [\"Private\"]\n id_hash[\"public_b\"] ||= ['false'] \n id_hash[\"identifiers_s\"] ||= [@pid]\n id_hash[\"identifiers_t\"] ||= [@pid]\n \n xml.search(\"//dcterms:LCC\").each do |id| \n id_hash[\"identifiers_s\"] << id.content.strip\n id_hash[\"identifiers_t\"] << id.content.strip\n end\n \n series = \"Accession 2005-101\"\n id_hash[\"identifiers_s\"].each do |id|\n if id.include?(\"SC340_1986\") \n series = \"Accession 1986-052\"\n end\n end\n \n [\"facet\", \"display\", \"s\", \"t\", \"sort\"].each {|v| id_hash[\"series_#{v}\"] ||= []; id_hash[\"series_#{v}\"] << series }\n return id_hash\n end",
"def get_all_authors(record)\n translator_code = \"trl\"; editor_code = \"edt\"; compiler_code = \"com\"\n primary_authors = []; translators = []; editors = []; compilers = []\n record.find_all {|f| f.tag === \"100\"}.each do |field|\n primary_authors << field[\"a\"] if field[\"a\"]\n end\n record.find_all {|f| f.tag === \"700\"}.each do |field|\n if field[\"a\"]\n relators = []\n relators << clean_end_punctuation(field[\"e\"]) if field[\"e\"]\n relators << clean_end_punctuation(field[\"4\"]) if field[\"4\"]\n if relators.include?(translator_code)\n translators << field[\"a\"]\n elsif relators.include?(editor_code)\n editors << field[\"a\"]\n elsif relators.include?(compiler_code)\n compilers << field[\"a\"]\n else\n primary_authors << field[\"a\"] unless primary_authors.include?(field[\"a\"])\n end\n end\n end\n {:primary_authors => primary_authors, :translators => translators, :editors => editors, :compilers => compilers}\n end",
"def set_key_indicate_map_indicator_file\n @key_indicate_map_indicator_file = KeyIndicateMap::IndicatorFile.find(params[:id])\n end",
"def annotate_with(annotations, attr = 'tag', owner = User.current_user, user_owned_only = false)\n if annotations.is_a?(String)\n annotations = annotations.split(',').map(&:strip).uniq\n elsif annotations.is_a?(Array)\n annotations = annotations.map(&:strip).uniq\n else\n annotations = []\n end\n potential_values = Array(annotations).uniq(&:downcase).compact\n\n existing = send(\"#{attr}_annotations\")\n\n params = {}\n param_index = 0\n\n any_deletes = false\n duplicates = []\n existing.each do |ann|\n if user_owned_only && ann.source != owner\n params[(param_index += 1).to_s] = { id: ann.id }\n elsif ann.persisted?\n index = potential_values.index { |v| v.casecmp(ann.value_content) == 0 }\n if index\n duplicates << index\n params[(param_index += 1).to_s] = { id: ann.id }\n else\n any_deletes = true\n params[(param_index += 1).to_s] = { id: ann.id, _destroy: true }\n end\n end\n end\n\n potential_values.delete_if.with_index { |_, i| duplicates.include?(i) }\n\n potential_values.each do |value|\n # Annotation model can take either a String or an AR object as the value\n text_value = TextValue.where('lower(text) = ?', value.downcase).first || value\n params[(param_index += 1).to_s] = { source_type: owner.class.name, source_id: owner.id,\n attribute_name: attr, value: text_value }\n end\n\n send(\"#{attr}_annotations\").reset # Clear any previously assigned, but unsaved annotations\n send(\"#{attr}_annotations_attributes=\", params)\n\n potential_values.any? || any_deletes\n end",
"def parse_reference_ids full_document\n full_document.gsub(/%r(\\d+)/) do\n if Reference.exists? $1\n reference = Reference.find($1)\n reference.decorate.to_link\n else\n broken_markdown_link \"reference\", $1\n end\n end\n end",
"def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend",
"def ref_attrs\n docidentifier.detect(&:primary)&.tap do |di|\n return { anchor: di.id.gsub(\" \", \".\").squeeze(\".\") }\n end\n end",
"def annotate_samples\n # hash to connect metadata\n exp_hash = create_metadata_hash(@exp_metadata, 0) # { expid => [metadata] }\n bs_hash = create_metadata_hash(@bs_metadata, 0) # { biosampleid => [metadata] }\n srs_hash = create_metadata_hash(@bs_metadata, 1) # { sampleid => [metadata] }\n date_hash = received_date_by_experiment # { expid => date_received }\n\n annotated = Parallel.map(open(@samples_fpath).readlines.drop(1), :in_threads => @@nop) do |line|\n data = line.chomp.split(\"\\t\")\n sample_md = bs_hash[data[0]] || srs_hash[data[0]]\n sample_info = if sample_md\n coverage = if sample_md[3] != \"NA\"\n data[7].to_f / sample_md[3].to_f * 1_000_000\n else\n \"NA\"\n end\n [\n sample_md,\n coverage,\n ]\n else\n \"NA\\tNA\\tNA\\tNA\" # secondary sample id, taxon id, taxonomic name, coverage\n end\n [\n data,\n sample_info,\n exp_hash[data[1]],\n date_hash[data[1]],\n ].flatten.join(\"\\t\")\n end\n open(output_fpath(\"quanto.annotated.tsv\"), 'w'){|f| f.puts([annotated_header.join(\"\\t\"), annotated]) }\n end",
"def parse\n self.data = BdlFile.strip_comments self.data\n save!\n tokenize\n Instruction.create_references!\n end",
"def import_indicators(indicators)\n log \"Importing indicators.\"\n indicators.map do |indicator|\n FundamentalAttribute.create(\n label: indicator.label,\n name: indicator.title,\n description: indicator.description\n ) unless lookup_fundamental_attribute(indicator.label)\n end\n end",
"def parse_taxon_ids full_document\n full_document.gsub(/%t(\\d+)/) do\n try_linking_taxon_id $1\n end\n end",
"def add_existing_annotation\n @text = AnnotationText.find(params[:annotation_text_id])\n @submission_file_id = params[:submission_file_id]\n @submission_file = SubmissionFile.find(@submission_file_id)\n @annotation = Annotation.new\n @annotation.update_attributes({\n line_start: params[:line_start],\n line_end: params[:line_end],\n submission_file_id: params[:submission_file_id]\n })\n @annotation.annotation_text = @text\n @annotation.save\n @submission = @submission_file.submission\n @annotations = @submission.annotations\n end",
"def after_save\n df = DataFile.find_by_id(self.orig_data_file_id)\n unless df.blank?\n df.annotations.each do |a|\n a.annotatable = self\n #need to call update without callbacks, otherwise a new version is created\n a.send(:update_without_callbacks)\n\n #versions for annotations are no longer enabled in SEEK - but this code is left here incase they are re-enabled in the future.\n a.versions.each do |av|\n av.annotatable =self\n av.save\n end\n end\n end\n super\n end",
"def parse_endnotes(endnotes_xml)\n @endnotes = {}\n xml = Nokogiri::XML(endnotes_xml)\n xml.xpath(\"//w:endnote[@w:id > 0]\").each do |endnote|\n id = endnote['w:id'].to_i\n f = Swordfish::Node::Footnote.new\n endnote.xpath(\".//w:p\").each do |p|\n f.append _node_parse_runs(p, :endnotes)\n end\n @endnotes[id] = f\n end\n end",
"def do_inproceedings\n @lines.each {|l| l.sub!(/journal =/, \"booktitle =\") }\n end",
"def add_docidentifier\n @bib.docidentifier.each do |i|\n case i.type\n when \"isbn\" then @item.isbn = i.id\n when \"lccn\" then @item.lccn = i.id\n when \"issn\" then @item.issn = i.id\n end\n end\n end",
"def parse_entry(io)\n # Read INSDC or RefSeq entry\n Bio::FlatFile.auto(io).each do |entry|\n @entry = entry\n @features = entry.features\n @source = @features.shift\n parse_sequence\n parse_source\n #parse_genes\n parse_features\n end\n end",
"def add_index_maps(layer, druid, rootdir)\n doc = Nokogiri::XML(File.read(File.join(rootdir, 'metadata', 'contentMetadata.xml')))\n return unless doc.search('//file[@id=\\'index_map.json\\']').length > 0\n\n refs = JSON.parse(layer.metadata['dct_references_s'])\n refs['https://openindexmaps.org'] = \"#{Settings.stacks.url}/file/druid:#{druid}/index_map.json\"\n layer.metadata['dct_references_s'] = refs.to_json\n end",
"def decode_pseudo_marc(pseudo_marc)\n raise ParserError, \"Cannot decode empty string.\" if pseudo_marc == \"\"\n \n pseudo_marc = pseudo_marc.split(\"\\n\") \n raw_fields = []\n \n if pseudo_marc[0][0..5] == \"LEADER\"\n record = create_record_for_type(pseudo_marc[0][7..-1])\n else\n raise ParserError, \"Cannot decode record without a leader.\"\n end\n \n pseudo_marc[1..pseudo_marc.length].each do |field|\n data = @entities.decode(field[7..-1])\n if field[0..2] != ' '\n data = MARC::ControlField.control_tag?(field[0..2]) ? data : \"a#{data}\"\n raw_fields << { \n :tag => field[0..2], \n :indicator1 => field[4,1], \n :indicator2 => field[5,1], \n :value => data.strip, \n :raw => field.strip\n }\n else \n raw_fields.last[:value] += \" #{data}\"\n raw_fields.last[:raw] += field.strip\n end\n end\n \n raw_fields.each do |field|\n tag = field[:tag]\n field_data = field[:value]\n if MARC::ControlField.control_tag?(tag)\n record.append(MARC::ControlField.new(tag, field_data)) \n else\n datafield = MARC::DataField.new(tag)\n datafield.indicator1 = field[:indicator1]\n datafield.indicator2 = field[:indicator2]\n \n field_data.split('|').each{|sub| \n subfield = MARC::Subfield.new(sub[0,1], sub[1..-1])\n datafield.append(subfield)\n }\n record.append(datafield)\n end\n end\n \n return record\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 marks\n marks = []\n if input =~ / *mark:(\\d\\S*)/i\n marks = $1.gsub /(\\d+)-(\\d+)/ do\n ($1.to_i..$2.to_i).to_a.join(',')\n end\n marks = marks.split(',').collect {|s| s.to_i}.sort\n end\n marks\n end",
"def set_odmowa_mark\n #@odmowa_mark = OdmowaMark.find(params[:id])\n @odmowa_mark = OdmowaMark.joins(:odmowa_typ).find(params[:id])\n end",
"def get_record_identifiers(doc, options)\n doc_name = build_doc_name(doc)\n aug_rec = options['task'].augmented_patients.detect { |r| doc_name == to_doc_name(r[:first][1], r[:last][1]) }\n mrn = @names[doc_name] || aug_rec&.original_patient_id\n [mrn || nil, doc_name, aug_rec, parse_telecoms(doc)]\n end",
"def import_dict_from_file_hnd(dict_name, dict_folder)\n puts \"start importing dictionary\"\n\n base_path = @file_dir+\"/\"+dict_folder\n dict_idx_path = base_path + \"/\" + \"#{dict_folder}.index\"\n dict_data_path = base_path + \"/\" +\"#{dict_folder}.dict\"\n\n dict_table = @DB[@dict_table_name];\n dict_id = -1\n begin\n dict_id = dict_table.insert(:name=>dict_name.force_encoding(\"UTF-8\"),\n :string_id=>dict_folder.force_encoding(\"UTF-8\"))\n rescue\n #dict_id = @DB['SELECT * FROM ? WHERE string_id = ?',@dict_table_name, dict_folder].first\n dict_id = dict_table[:string_id=>dict_folder][:id]\n #puts \"count not insert dict #{dict_id}\"\n end\n\n if (dict_id<0)\n puts \"unknown error, could not find dict_id\"\n return\n end\n\n word_table = @DB[@word_table_name];\n meaning_table = @DB[@meaning_table_name];\n\n\n count = 0\n File.open(dict_data_path, \"r\") do |data_file|\n File.open(dict_idx_path, \"r\") do |idx_file|\n while (line = idx_file.gets)\n count+=1\n pos1 = line.index(\"\\t\")\n pos2=line.index(\"\\t\",pos1+1)\n\n keyword = line[0..pos1-1]\n str_entry_offset = line[pos1+1..pos2-1]\n str_entry_len = line[pos2+1..line.length-2]\n\n entry_offset = dec_val(str_entry_offset)\n entry_len = dec_val(str_entry_len)\n data_file.seek(entry_offset, IO::SEEK_SET)\n meaning = data_file.read(entry_len)\n\n word_id = -1\n existed_meaning = nil\n begin\n ch = keyword[0].upcase\n kind = 0\n if (ch<='Z' and ch >= 'A')\n kind = ch.getbyte(0) - 64\n end\n word_id = word_table.insert(:word=>keyword.force_encoding(\"UTF-8\"), :kind=>kind)\n rescue Exception => e\n word_id = word_table[:word=>keyword][:id]\n existed_meaning = meaning_table[:word=>word_id, :dict=>dict_id]\n if !existed_meaning.nil?\n existed_meaning = existed_meaning[:meaning]\n end\n end\n\n if (word_id<0)\n puts \"unknown error, could not get word id\"\n return\n end\n\n begin\n if (!existed_meaning.nil?)\n meaning = existed_meaning + \"\\n\\n\" + meaning.force_encoding(\"UTF-8\");\n meaning_table[:dict=>dict_id, :word=>word_id] = {:meaning=>meaning}\n else\n meaning_table.insert(:dict=>dict_id,:word=>word_id, :meaning=>meaning)\n end\n rescue Exception => e\n puts \"could not insert meaning #{keyword} e: #{e}\"\n end\n\n if count%1000==0\n puts \"count: #{count}\"\n #return\n end\n\n end\n end\n end\n\n puts \"importing done\"\n\nend",
"def normalize_author_identity(first_name, middle_name, last_name, institution)\n \"First: #{first_name} Middle: #{middle_name} Last: #{last_name} Institution: #{institution}\"\n end",
"def mark(oid)\n end",
"def export_as_refworks_marc_txt\n return '' unless to_marc\n super\n end",
"def get_mentor_signoffs()\n ASF::Person.preload('cn')\n ASF::ICLA.preload()\n people = Hash[ASF::Person.list.map {|person| [person.public_name, person.id]}]\n\n agendas = Dir[File.join(BOARD, 'board_agenda_*.txt'),\n File.join(BOARD, 'archived_agendas', 'board_agenda_*.txt')]\n agendas = agendas.sort_by {|file| File.basename(file)}[-13..-1]\n if File.read(agendas.last).include? 'The Apache Incubator is the entry path'\n agendas.shift\n else\n agendas.pop\n end\n\n # projects = URI.parse('http://incubator.apache.org/projects/')\n # table = Nokogiri::HTML(Net::HTTP.get(projects)).at('table')\n # # extract a list of [podling names, table row]\n # podlings = table.search('tr').map do |tr|\n # tds = tr.search('td')\n # next if tds.empty?\n # [tds.last.text, tr]\n # end\n\n mentors = {}\n podlings = {}\n agendas.each do |file|\n date = file[/\\d+_\\d+_\\d+/].gsub('_', '-')\n agenda = File.read(file)\n signoffs = agenda.scan(/^#* ?Signed-off-by:\\s+.*?\\n\\n/m).join\n signoffs.scan(/\\[(.+?)\\]\\((.*?)\\) (.*)/).each do |check, podling, name|\n name.strip!\n podling.strip!\n # allow for reports where comments have been joined to the previous line\n name.sub! %r{ Comments:.*}, ''\n name.sub! /\\s+\\(.*?\\)/, ''\n\n mentors[name] = [] unless mentors[name]\n mentors[name] << {\n date: date,\n checked: !check.strip.empty?,\n podling: podling\n }\n\n podlings[podling] = Hash.new{|h,k| h[k] = [] } unless podlings[podling]\n podlings[podling][date] << [name, !check.strip.empty?]\n end\n end\n return mentors, podlings, people\nend",
"def reconcile_identifiers!(marc_hyacinth_record, existing_hyacinth_record)\n marc_hyacinth_record.digital_object_data['identifiers'].push(*(existing_hyacinth_record['identifiers']))\n marc_hyacinth_record.digital_object_data['identifiers'].uniq!\n end",
"def calculate_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n xcategory = xuser.personal.category\n xacademic = xuser.academic\n tenth_mark = xacademic.tenth_marks\n user_subs = xacademic.subject_entries.all\n total_special_sub = sub_maps.count\n total = 0\n user_subs.each do |us|\n total += us.marks\n sub_maps.each do |sm|\n if us.subject_id == sm.subject_id\n total += us.marks\n end\n end\n end\n self.calculated_marks = total*10000 + tenth_mark\n end",
"def add_records(records)\n records.each do |r|\n condensed_record = condense_record(r)\n load_atoms(condensed_record)\n add_occurences(condensed_record,r.id)\n @records_size += 1\n end\n end",
"def clear_marks\n each_blob { |blob| blob.clear_marks }\n end",
"def get_all_authors(record)\n translator_code = \"trl\"; editor_code = \"edt\"; compiler_code = \"com\"\n primary_authors = []; translators = []; editors = []; compilers = []\n corporate_authors = []; meeting_authors = []; secondary_authors = []\n record.find_all{|f| f.tag === \"100\" }.each do |field|\n primary_authors << field[\"a\"] if field[\"a\"]\n end\n record.find_all{|f| f.tag === '110' || f.tag === '710'}.each do |field|\n corporate_authors << (field['a'] ? field['a'] : '') +\n (field['b'] ? ' ' + field['b'] : '')\n end\n record.find_all{|f| f.tag === '111' || f.tag === '711' }.each do |field|\n meeting_authors << (field['a'] ? field['a'] : '') +\n (field['q'] ? ' ' + field['q'] : '')\n end\n record.find_all{|f| f.tag === \"700\" }.each do |field|\n if field[\"a\"]\n relators = []\n relators << clean_end_punctuation(field[\"e\"]) if field[\"e\"]\n relators << clean_end_punctuation(field[\"4\"]) if field[\"4\"]\n if relators.include?(translator_code)\n translators << field[\"a\"]\n elsif relators.include?(editor_code)\n editors << field[\"a\"]\n elsif relators.include?(compiler_code)\n compilers << field[\"a\"]\n else\n secondary_authors << field[\"a\"]\n end\n end\n end\n\n primary_authors.each_with_index do |a,i|\n primary_authors[i] = a.gsub(/[\\.,]$/,'')\n end\n secondary_authors.each_with_index do |a,i|\n secondary_authors[i] = a.gsub(/[\\.,]$/,'')\n end\n\n {:primary_authors => primary_authors, :corporate_authors => corporate_authors, :translators => translators, :editors => editors, :compilers => compilers,\n :secondary_authors => secondary_authors, :meeting_authors => meeting_authors }\n end",
"def import_shared_steps(options)\n merge_record_marks_from_folio_xml_at_into_idml_at(options)\n fix_adjust_merged_record_mark_positions(options)\n fix_convert_abbreviations_to_lower_case(options) # run after merge_record_marks...\n move_staging_to_content(options)\n sync_from_at(options)\n options['report_file'] = config.compute_glob_pattern(\n 'content_dir/validation_report_file'\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_shared_steps')\n validate_content(options)\n end",
"def get_indi(personmodel)\n id = personmodel[\"Ord-Nr\"]\n npfx = personmodel[\"Titel\"]\n name = personmodel[\"Name\"]\n name = personmodel[\"Geb-Name\"]\n rufname = personmodel[\"Rufname\"]&.strip\n vorname = personmodel[\"Vorname\"]\n vornamerufname = vorname #.gsub(rufname, %Q{*#{rufname.strip}*}) unless rufname.nil?\n\n sex = personmodel[\"Geschl\"] == \"M\" ? \"M\" : \"F\"\n ausehe = personmodel[\"AusEhe\"]\n art = personmodel[\"AusEhe\"]\n\n beruf = wrap(personmodel[\"Beruf\"] || \"\", 80).strip\n\n family_roles = (personmodel[:family_roles] || []).map { |v| %Q{1 #{v[1].to_s.upcase} @#{ $idmapper.fam(v[0]) }@} }.join(\"\\n\")\n maiden = (personmodel[:family_roles] || []).map { |v| %Q{1 #{v[1].to_s.upcase} @#{ $idmapper.fam(v[0]) }@} }.join(\"\\n\")\n\n %Q{\n0 @#{$idmapper.indi(id)}@ INDI\n1 NAME #{vornamerufname} (#{id}) /#{name}/\n2 GiVN #{vornamerufname}\n2 SURN #{name}\n2 NPFX #{npfx}\n2 _RUFNAME #{rufname}\n1 NOTE #{beruf.gsub(\"\\n\", \"\\n2 CONT \")}\n1 SEX #{sex}\n1 REFN #{id}\n1 BIRT\n2 DATE #{personmodel[\"Geb-am\"]}\n2 PLAC #{personmodel[\"Geb-in\"]}\n1 DEAT\n2 DATE #{personmodel[\"Gest-am\"]}\n2 PLAC #{personmodel[\"Gest-in\"]}\n #{family_roles}\n }.strip\n\nend",
"def process_records(source, format, marc, test) \n STDOUT.puts \"Processing...\"\n source = resolve_source(source) || source\n # Set encoding based on format or file extension.\n if format == \"oclc\"\n external_encoding = \"cp866\"\n else\n external_encoding = \"UTF-8\"\n end\n extension = \".#{format}\"\n marc_out = OUT + \"kumc_ebooks_\" + source + extension\n mode = test ? \"Test\" : \"Normal\"\n unless @quiet\n STDOUT.puts \"Processing #{format.upcase} from \" + source + \" with Mode: \" + mode\n end\n reader = MARC::Reader.new(marc, :external_encoding => external_encoding, :internal_encoding => \"UTF-8\", :invalid => :replace, :replace => \"\")\n writer = MARC::Writer.new(marc_out)\n logfile = File.open(LOGFILE, 'ab')\n counter = 0\n for record in reader\n # Do record enhancements\n newrecord = add_control_number(record)\n newrecord = add_holding_location(newrecord)\n if source == \"Clinical_Key\"\n newrecord = fix_clinicalkey_links(newrecord)\n end\n newrecord = add_link_prefix(newrecord)\n newrecord = set_link_text(newrecord)\n\n\n # Re-sort the tags in the record after appending fields.\n newrecord.fields.sort_by!{|f| f.tag}\n \n begin\n writer.write(newrecord)\n rescue MARC::Exception => e\n STDERR.puts e.message\n STDERR.puts e.backtrace.inspect\n end \n \n # Log 001 source control number\n logfile.puts record['001'].value\n counter += 1\n unless @quiet\n STDOUT.puts counter if (counter.modulo(100)).zero?\n end\n end\n writer.close\n logfile.close\n unless @quiet\n\t\tSTDOUT.puts counter.to_s + \" MARC records written to\"\n\t\tSTDOUT.puts marc_out\n\t\tSTDOUT.puts \"Source Control Numbers (001) logged to #{LOGFILE}\"\n end\nend",
"def split_upids(idmap_file)\n puts \"split idmapping.dat to each prefix files\"\n up_refp_output = prepare_prefix_files(idmap_file, \"protein_id\")\n up_refg_output = prepare_prefix_files(idmap_file, \"gene_id\")\n\n cnt = 0\n # it is assumed that the tax_id is followed by a protein_id or gene_id\n current_tax = {upid: nil, tax_id: nil}\n taxid_missing_list = [] \n File.open(idmap_file, \"r\") do |f|\n f.each_line do |line|\n up, xref, id = line.strip.split(\"\\t\")\n case xref\n when \"NCBI_TaxID\"\n current_tax = {upid: up.split(\"-\").first, tax_id: id}\n when \"RefSeq\", \"GeneID\"\n # Push only the tax_id with refseq protein_id or gene_id\n if current_tax[:upid] == up.split(\"-\").first\n if xref == \"RefSeq\"\n prefix = id.chomp.strip[0..4]\n up_refp_output[prefix].puts line.chomp.strip + \"\\t\" + current_tax[:tax_id]\n elsif xref == \"GeneID\"\n prefix = id.chomp.strip[0]\n up_refg_output[prefix].puts line.chomp.strip + \"\\t\" + current_tax[:tax_id]\n end\n else\n taxid_missing_list.push(up)\n end\n end\n cnt += 1\n if (cnt % 100000 == 0)\n puts cnt\n end\n end\n # list of upid that can't get taxid. Depends on the order of idmapping.dat\n out = File.open(\"taxid_missing_list.json\", \"w\") unless taxid_missing_list.size == 0\n taxid_missing_list.each do |upid|\n out.puts JSON.pretty_generate(taxid_missing_list)\n end\n end\n\n # close files\n up_refp_output.each do |k, v|\n v.flush\n v.close\n end\n up_refg_output.each do |k, v|\n v.flush\n v.close\n end\nend",
"def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n # Set this property so derivatives will run, acts like a FileAppender.\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members. If they're not preserved, it was\n # probably a bug - e.g. page 3 didn't make it into preservation.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set, external_resource: true)\n output\n end",
"def validate_idml_import_consistency(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :idml_import_dir, :validation_report_file, ''\n )\n reset_validation_report(options, 'validate_idml_import')\n input_base_dir = config.compute_base_dir(options['base-dir'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(\n options['file-extension'] || :at_extension\n )\n file_specs = config.compute_validation_file_specs(\n primary: [input_base_dir, input_file_selector, input_file_extension], # for reporting only\n idml_import_at_files: [input_base_dir, input_file_selector, input_file_extension],\n )\n Repositext::Validation::IdmlImportConsistency.new(file_specs, options).run\n end",
"def markinfo_params\n params.require(:markinfo).permit(:title, :description, :user_id)\n end",
"def merge(fulltext_reader)\n fulltext_reader.dump_data do |data|\n @io.write data \n end\n end",
"def mark_params\n params.require(:mark).permit(:name, :url, :tag, :domain_id)\n end",
"def set_mark\n @mark = Mark.find(params[:id])\n end",
"def set_mark\n @mark = Mark.find(params[:id])\n end",
"def set_mark\n @mark = Mark.find(params[:id])\n end",
"def parse_entities(io)\n\t parser = nil\n\t parse_pairs io do |code, value|\n\t\tif 0 == code.to_i\n\t\t if parser\n\t\t\tentities.push parser.to_entity\n\t\t\tparser = nil\n\t\t end\n\n\t\t # Nothing to do\n\t\t next if 'ENDSEC' == value\n\n\t\t if 'LWPOLYLINE' == value\n\t\t\tparser = EntityParser.new(value)\n\t\t elsif 'SPLINE' == value\n\t\t\tparser = SplineParser.new\n\t\t else\n\t\t\tentities.push Entity.new(value)\n\t\t end\n\t\telsif parser\n\t\t parser.parse_pair(code.to_i, value)\n\t\telse\n\t\t entities.last.parse_pair(code, value)\n\t\tend\n\t end\n\tend",
"def annotate\n genes={}\n File.open(ANNOTATION,'r').each do |line|\n temp=line.split\n genes[temp[9]]={}\n genes[temp[9]][\"start\"]=temp[3].to_i\n genes[temp[9]][\"end\"]=temp[4].to_i\n genes[temp[9]][\"strand\"]=temp[6]\n genes[temp[9]][\"length\"]=temp[4].to_i - 1 - temp[3].to_i\n end\n return genes\nend",
"def serialize_landmark(set_uri, landmark)\n return if @landmarks.has_key?(landmark.seqid)\n landmark_uri = landmark_uri(set_uri, landmark.seqid)\n region_uri = RDF::URI.new(\"#{landmark_uri.to_s}/region\")\n @landmarks[landmark.seqid] = landmark_uri\n create_triple(landmark_uri, RDF.type, @base.Landmark)\n create_triple(landmark_uri, @base.has_identifier, RDF::URI.new(\"#{landmark_uri}/id\"))\n create_triple(\"#{landmark_uri}/id\", @base.has_value, landmark.seqid)\n create_triple(landmark_uri, @base.has_attribute, region_uri)\n if landmark.start_coordinate then\n start_position_uri = RDF::URI.new(\"#{landmark_uri.to_s}/region/start\")\n create_triple(region_uri, BioInterchange::FALDO.begin, start_position_uri)\n create_triple(start_position_uri, BioInterchange::FALDO.position, landmark.start_coordinate)\n end\n if landmark.start_coordinate then\n end_position_uri = RDF::URI.new(\"#{landmark_uri.to_s}/region/end\")\n create_triple(region_uri, BioInterchange::FALDO.end, end_position_uri)\n create_triple(end_position_uri, BioInterchange::FALDO.position, landmark.end_coordinate)\n end\n end",
"def idl(idlfiles = nil)\n if idlfiles\n BRIX11.log_fatal(\"SE interface recipe #{self.recipe_file.full_path} only allows a single topic IDL to be defined!\") if idlfiles.size > 1\n end\n super\n end",
"def update_ID3(attributes)\n begin\n musicFile = TagLib::File.new(self.filePath())\n musicFile.title = attributes[:id3Title]\n musicFile.artist = attributes[:id3Artist]\n musicFile.save()\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end \n end",
"def annotate\n redirect_to :show unless rcparams = params[:recipe][:recipeContents]\n @content = rcparams[:content]\n ps = ParserServices.new entity: @recipe, content: @content\n # This is a two-, possibly three-phase process:\n # 1) a selection from the browser directs attention to a range of text, which generates a CSS path for an element to parse\n # 2) this so-called parse_path is attempted to be parsed. If it doesn't work because of a findable tag, a dialog is presented\n # for the user to decide how to handle the tag;\n # 3) the user says to enter the problematic tag directly into the dictionary, or specifies an existing tag for what\n # was meant by the problematic tag. The latter can be optionally entered as a synonym of the intended name.\n if rcparams[:anchor_path] # Initial annotation on browser selection\n logger.debug \"Annotating with anchor_path = '#{rcparams[:anchor_path]}'\"\n @annotation, @parse_path = ps.annotate_selection *rcparams.values_at(:token, :anchor_path, :anchor_offset, :focus_path, :focus_offset)\n elsif @parse_path = rcparams[:parse_path] # Specifying an element of the DOM\n if !(@tagname = rcparams[:tagname])\n logger.debug \"Looking for tag at '#{@parse_path}'\"\n # @annotation = ParsingServices.parse_on_path *rcparams.values_at(:content, :parse_path) do |tagtype, tagname|\n @annotation = ps.parse_on_path @parse_path do |tagtype, tagname|\n @tagtype, @tagname = tagtype, tagname\n end\n @parse_path = nil unless @tagname # We'll need the parse path for identifying the tag\n else # There IS a tagname: use that as a tag\n noko_elmt = ps.extract_via_path @parse_path\n @tagtype = rcparams[:tagtype]\n @annotation = rcparams[:content]\n # @tagname of type @tagtype is a mystery tag previously identified by a failed parse.\n logger.debug \"Use tag '#{@tagname}' of type '#{@tagtype}' at path '#{@parse_path}'\"\n # The logic here is as follows, for sorting out words.\n # -- '@tagname' is the questionable tag\n # -- 'rcparams[:replacement]' is the id of a tag selected by the user to serve in its place\n # -- 'rcparams[:assert]' is set if that tag will be added to the dictionary\n # If there's no replacement tag, the term is just accepted into the dictionary as a new instance of the tagtype.\n # If there IS a non-nil replacement, that's what we understand the term to mean. If, then, assert is set,\n # the questionable term will get added to the dictionary as a synonym for the replacement. If not, the alias\n # is accepted and added to the Seeker as such.\n # No tagname has been parsed out; proceed to parse the entity denoted by the parse path\n if (replacement = rcparams[:replacement]).present?\n old_tag = Tag.find_by id: replacement\n if rcparams[:assert]\n new_tag = Tag.assert @tagname, @tagtype\n new_tag.absorb old_tag, false\n end\n value = old_tag.name\n else\n # No replacement provided => simply assert the tag into the dictionary\n value = @tagname\n Tag.assert @tagname, @tagtype\n end\n @tagname = nil # Go back to the annotation dialog\n @parse_path = nil\n if noko_elmt\n noko_elmt[:value] = value\n @annotation = noko_elmt.ancestors.last.to_s\n end\n end\n end\n end",
"def add_associate(hash)\n\n type = hash.delete(:type)\n\n doc = NSDocument.new(hash)\n doc.identifier = Noteshare::Identifier.new().string\n doc.root_ref = { 'id'=> 0, 'title' => ''}\n doc.author_id = self.author_id\n doc.author = self.author\n doc.author_credentials2 = self.author_credentials2\n\n doc2 = DocumentRepository.create doc\n\n doc2.associate_to(self, type)\n\n doc2\n\n end",
"def idl(*idlfiles)\n @recipe.idl(idlfiles.flatten.compact)\n end",
"def mark(mark)\n @marks << mark\n end"
] | [
"0.51859033",
"0.51580006",
"0.47088492",
"0.46572605",
"0.45058817",
"0.44985515",
"0.44369283",
"0.44071212",
"0.44071007",
"0.43925086",
"0.43878338",
"0.43812704",
"0.4317431",
"0.42685977",
"0.42623025",
"0.42609125",
"0.42325857",
"0.4231966",
"0.41948512",
"0.4176468",
"0.41385463",
"0.4127961",
"0.4125321",
"0.4116732",
"0.41110831",
"0.41099772",
"0.41030726",
"0.409555",
"0.40948623",
"0.4093283",
"0.40767977",
"0.40687454",
"0.40674335",
"0.40672606",
"0.40605363",
"0.40585542",
"0.40572155",
"0.4054167",
"0.40299025",
"0.40263072",
"0.40257788",
"0.39927846",
"0.399258",
"0.3990236",
"0.3988989",
"0.39716867",
"0.3971266",
"0.3970163",
"0.39697817",
"0.39687213",
"0.39455837",
"0.3938663",
"0.39380747",
"0.39380705",
"0.3925049",
"0.3923463",
"0.39227223",
"0.3917726",
"0.391018",
"0.39081818",
"0.39009053",
"0.38984057",
"0.38973796",
"0.38803855",
"0.38772023",
"0.3875736",
"0.3865307",
"0.3864792",
"0.38625368",
"0.38599864",
"0.38595194",
"0.38554507",
"0.38552094",
"0.3855138",
"0.38538706",
"0.3845743",
"0.38444194",
"0.3839953",
"0.38389918",
"0.38350943",
"0.38348916",
"0.38342118",
"0.38284123",
"0.38257694",
"0.38229635",
"0.38195238",
"0.38193676",
"0.3818378",
"0.38136175",
"0.38136175",
"0.38136175",
"0.38127366",
"0.3811493",
"0.3810418",
"0.380488",
"0.38018224",
"0.37972185",
"0.37972048",
"0.37917307",
"0.3788338"
] | 0.63851887 | 0 |
Merges subtitle_marks from subtitle_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks. | def merge_subtitle_marks_from_subtitle_import_into_content_at(options)
subtitle_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir
)
subtitle_import_glob_pattern = config.compute_glob_pattern(
subtitle_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'
merge_subtitle_marks_from_subtitle_shared_into_content_at(
subtitle_import_glob_pattern,
subtitle_import_base_dir,
content_base_dir,
options
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def subtitle_mark_at_beginning_of_every_paragraph?(content_at_file)\n content = content_at_file.contents\n # Early return if content doesn't contain any subtitle_marks\n return Outcome.new(true, nil) if !content.index('@')\n case @options[:content_type]\n when :import\n # In this mode we raise an exception if we find any paragraphs\n content_without_headers = empty_header_lines(content)\n paragraphs_without_subtitle_mark = check_import_file(content_without_headers)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n # We want to terminate an import if there isn't a subtitle_mark\n # at the beginning of every paragraph.\n # Normally we'd return a negative outcome (see :content), but in this\n # case we raise an exception.\n raise NoSubtitleMarkAtBeginningOfParagraphError.new(\n [\n \"The following paragraphs don't start with a subtitle_mark:\",\n paragraphs_without_subtitle_mark.map { |e| e.inspect }.join(\"\\n\")\n ].join(\"\\n\")\n )\n end\n when :content\n # In this mode we only report errors if we find any paragraphs\n # We only look at text after the second record_id. Replace all lines\n # before the second record_id with empty lines (to keep line location\n # in error reports accurate)\n content_from_second_record_id = remove_all_text_content_before_second_record_id(content)\n paragraphs_without_subtitle_mark = check_content_file(content_from_second_record_id)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n paragraphs_without_subtitle_mark.map { |(line, para)|\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: line,\n context: para.inspect,\n },\n [\"Paragraph doesn't start with a subtitle_mark\"]\n )\n }\n )\n end\n else\n raise ArgumentError.new(\"Invalid @options[:content_type]: #{ @options[:content_type].inspect }\")\n end\n end",
"def export_subtitle_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('subtitle_tagging_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to subtitle tagging\",\n options.merge(\n :output_path_lambda => lambda { |input_filename, output_file_attrs|\n Repositext::Utils::SubtitleFilenameConverter.convert_from_repositext_to_subtitle_export(\n input_filename.gsub(config.base_dir(input_base_dir_name), output_base_dir),\n output_file_attrs\n )\n }\n )\n ) do |contents, filename|\n # Since the kramdown parser is specified as module in Rtfile,\n # I can't use the standard kramdown API:\n # `doc = Kramdown::Document.new(contents, :input => 'kramdown_repositext')`\n # We have to patch a base Kramdown::Document with the root to be able\n # to convert it.\n root, warnings = config.kramdown_parser(:kramdown).parse(contents)\n doc = Kramdown::Document.new('')\n doc.root = root\n subtitle_tagging = doc.send(config.kramdown_converter_method(:to_subtitle_tagging))\n empty_markers_file = %(RelativeMS\\tSamples\\n0\\t0\\n)\n [\n Outcome.new(true, { contents: subtitle_tagging, extension: 'rt.txt' }),\n Outcome.new(true, { contents: empty_markers_file, extension: 'markers.txt' }),\n ]\n end\n end",
"def report_count_subtitle_marks(options)\n file_count = 0\n subtitle_marks_count = 0\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n subtitle_marks_count += content_at_file.contents.count('@')\n file_count += 1\n end\n $stderr.puts \"Found #{ subtitle_marks_count } subtitle_marks in #{ file_count } files at #{ Time.now.to_s }.\"\n end",
"def merge_gap_mark_tagging_import_into_content_at(options)\n gap_mark_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir\n )\n gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(\n gap_mark_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :content_dir\n )\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|\n if gap_mark_tagging_import_file_name !~ /\\.gap_mark_tagging\\.txt\\z/\n next\n end\n\n total_count += 1\n # prepare paths\n content_at_file_name = gap_mark_tagging_import_file_name.gsub(\n gap_mark_tagging_import_base_dir, content_base_dir\n ).gsub(\n /\\.gap_mark_tagging\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(\n File.read(gap_mark_tagging_import_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_tokens = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def copy_subtitle_marker_csv_files_to_content(options)\n input_base_dir = config.compute_base_dir(options['base-dir'])\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :txt_extension)\n output_base_dir = options['output'] || config.base_dir(:content_dir)\n\n Repositext::Cli::Utils.copy_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'] || /\\.markers\\.txt\\z/,\n \"Copying subtitle marker CSV files from subtitle_tagging_import_dir to content_dir\",\n options.merge(\n :output_path_lambda => lambda { |input_filename|\n input_filename.gsub(input_base_dir, output_base_dir)\n .gsub(\n /\\/([^\\/\\.]+)\\.markers\\.txt/,\n '/' + config.setting(:language_code_3_chars) + '\\1.subtitle_markers.csv'\n )\n }\n )\n )\n end",
"def significant_changes?(content_at, subtitle_marker_csv)\n raise(ArgumentError.new(\"content_at is empty.\")) if content_at.to_s.strip.empty?\n raise(ArgumentError.new(\"subtitle_marker_csv is empty.\")) if subtitle_marker_csv.to_s.strip.empty?\n if !content_at.index('@')\n # Document doesn't contain subtitle marks, skip it\n return Outcome.new(true, nil)\n end\n csv = CSV.new(subtitle_marker_csv, col_sep: \"\\t\", headers: :first_row)\n previous_stm_positions_and_lengths = csv.to_a.map { |row|\n r = row.to_hash\n { char_pos: r['charPos'].to_i, char_length: r['charLength'].to_i }\n }\n new_captions = Repositext::Utils::SubtitleMarkTools.extract_captions(content_at)\n # make sure that both counts are identical\n if new_captions.length != previous_stm_positions_and_lengths.length\n # TODO: maybe we have to make them the same length, if stm was added or removed\n raise \"Different counts: #{ previous_stm_positions_and_lengths.length } -> #{ new_captions.length }\"\n end\n\n significantly_changed_captions = []\n previous_stm_positions_and_lengths.each_with_index { |old_caption, idx|\n new_caption = new_captions[idx]\n old_pos = old_caption[:char_pos]\n old_len = old_caption[:char_length]\n new_pos = new_caption[:char_pos]\n new_len = new_caption[:char_length]\n if subtitle_mark_changed_significantly?(old_len, new_len)\n line_num = content_at[0..new_pos].count(\"\\n\") + 1\n significantly_changed_captions << { excerpt: new_caption[:excerpt], line_num: line_num }\n end\n }\n if significantly_changed_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n [\n Reportable.error(\n [@file_to_validate.first.path], # content_at file\n [\n 'Subtitle caption length has changed significantly',\n 'Review changes and update subtitle_markers_file with `repositext sync subtitle_mark_character_positions`',\n significantly_changed_captions.map { |e|\n \"On line #{ e[:line_num] }: #{ e[:excerpt] }\"\n }.join(\"\\n\")\n ]\n )\n ]\n )\n end\n end",
"def significant_changes?(content_at_file, subtitle_marker_csv_file)\n if content_at_file.contents.to_s.strip.empty?\n raise(ArgumentError.new(\"content_at is empty.\"))\n end\n if subtitle_marker_csv_file.contents.to_s.strip.empty?\n raise(ArgumentError.new(\"subtitle_marker_csv is empty.\"))\n end\n if !content_at_file.contents.index('@')\n # Document doesn't contain subtitle marks, skip it\n return Outcome.new(true, nil)\n end\n csv = subtitle_marker_csv_file.csv\n previous_stm_lengths = csv.to_a.map { |row|\n r = row.to_hash\n { char_length: r['charLength'].to_i }\n }\n new_captions = Repositext::Utils::SubtitleMarkTools.extract_captions(content_at_file.contents)\n # make sure that both counts are identical\n if new_captions.length != previous_stm_lengths.length\n # There is a mismatch in subtitle_mark counts between CSV file and\n # content_at. It makes no sense to run this validator unless the\n # counts match. We just skip it silently.\n return Outcome.new(true, nil)\n end\n\n changed_captions = []\n previous_stm_lengths.each_with_index { |old_caption, idx|\n new_caption = new_captions[idx]\n old_len = old_caption[:char_length]\n new_len = new_caption[:char_length]\n change_severity = compute_subtitle_mark_change(old_len, new_len)\n if change_severity\n changed_captions << {\n severity: change_severity,\n excerpt: new_caption[:excerpt],\n line_num: new_caption[:line],\n subtitle_index: idx + 1 # subtitle_index is '1'-based in the other workflow tools\n }\n end\n }\n if changed_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n changed_captions.map { |e|\n case e[:severity]\n when :insignificant\n Reportable.warning(\n {\n filename: content_at_file.filename,\n line: e[:line_num],\n context: \"Subtitle ##{ e[:subtitle_index] }: #{ e[:excerpt] }\",\n corr_filename: subtitle_marker_csv_file.filename,\n },\n ['Subtitle caption length has changed insignificantly']\n )\n when :significant\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: e[:line_num],\n context: \"Subtitle ##{ e[:subtitle_index] }: #{ e[:excerpt] }\",\n corr_filename: subtitle_marker_csv_file.filename,\n },\n [\n 'Subtitle caption length has changed significantly',\n 'Review changes and update subtitle_markers_file with `repositext sync subtitle_mark_character_positions`',\n ]\n )\n else\n raise \"Invalid severity: #{ e.inspect }\"\n end\n }\n )\n end\n end",
"def copy_subtitle_marker_csv_files_to_subtitle_export(options)\n input_base_dir = config.compute_base_dir(options['base-dir'] || :content_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :csv_extension)\n # grab source marker_csv file from primary repo\n primary_repo_input_base_dir = input_base_dir.sub(\n config.base_dir(:content_type_dir), config.primary_content_type_base_dir\n )\n output_base_dir = options['output'] || config.base_dir(:subtitle_export_dir)\n Repositext::Cli::Utils.copy_files(\n primary_repo_input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'] || /\\.subtitle_markers\\.csv\\z/,\n \"Copying subtitle marker CSV files from content_dir to subtitle_export_dir\",\n options.merge(\n output_path_lambda: lambda { |input_filename|\n Service::Filename::ConvertStmCsvToStExport.call(\n source_filename: input_filename.sub(\n primary_repo_input_base_dir,\n output_base_dir\n )\n )[:result]\n }\n )\n )\n end",
"def insert_new_subtitles!(subtitles_container)\n insert_and_split_ops.each do |op|\n insert_at_index = compute_insert_at_index(op, subtitles_container)\n # Get all the inserted subtitle ids\n inserted_stids = op.affected_stids.find_all { |e|\n '' == e.tmp_attrs[:before].to_s and '' != e.tmp_attrs[:after].to_s\n }.map(&:persistent_id)\n # Insert subtitle ids into subtitles_container, starting with last\n # so that we can insert them all at the same index.\n inserted_stids.reverse.each { |stid|\n subtitles_container.insert(insert_at_index, { persistent_id: stid })\n }\n end\n true\n end",
"def delete_subtitles!(subtitles_container)\n delete_and_merge_ops.each do |op|\n # Remove subtitle\n op.affected_stids.each { |aff_st|\n next unless '' == aff_st.tmp_attrs[:after]\n subtitles_container.delete_if { |new_st|\n new_st[:persistent_id] == aff_st.persistent_id\n }\n }\n end\n true\n end",
"def subtitle_marks_spaced_correctly?(content_at_file)\n # Early return if content doesn't contain any subtitle_marks\n return Outcome.new(true, nil) if !content_at_file.contents.index('@')\n\n too_long_captions = find_too_long_captions(content_at_file.contents)\n if too_long_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n too_long_captions.map { |(line, length, idx, excerpt)|\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: line,\n context: excerpt,\n },\n [\n 'Subtitle caption is too long',\n %(#{ length } characters in caption ##{ idx }),\n ]\n )\n }\n )\n end\n end",
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n idml_not_present_count = 0\n folio_not_present_count = 0\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)\n # Both files are present, merge tokens\n begin\n at_folio = File.read(at_folio_file_name)\n at_idml = File.read(at_idml_file_name)\n at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(\n at_folio, at_idml\n )\n # write to file\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge rids from #{ at_folio_file_name }\"\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, use Folio import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n idml_not_present_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n elsif File.exist?(at_idml_file_name)\n # Folio file is not present, use Idml import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n folio_not_present_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - Folio files not present: #{ folio_not_present_count }\"\n $stderr.puts \" - IDML files not present: #{ idml_not_present_count }\"\n $stderr.puts '-' * 80\n end",
"def find_subtitle_misalignments_between_qotd_and_content_at(date_code, posting_date_time, qotd_txt, content_at_txt, collector)\n end",
"def subtitle_mark_counts_match?(content_at, subtitle_marker_csv)\n content_at_count = content_at.count('@')\n subtitle_marker_csv_count = subtitle_marker_csv.strip.count(\"\\n\")\n\n # compare the two counts\n if 0 == content_at_count || content_at_count == subtitle_marker_csv_count\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n [\n Reportable.error(\n [@file_to_validate.last.path],\n [\n 'Subtitle_mark count mismatch',\n \"content_at contains #{ content_at_count }, but subtitle_marker_csv contains #{ subtitle_marker_csv_count } subtitle_marks.\"\n ]\n )\n ]\n )\n end\n end",
"def strip_annotations(content); end",
"def compute_insert_at_index(op, updated_subtitles)\n insert_at_index = case op.operation_type\n when 'insert'\n # No matter if op has one or more affected_stids, we only need the\n # first index. All affected_stids will be inserted here in the\n # correct order.\n compute_insert_at_index_given_after_stid(\n op.after_stid,\n updated_subtitles\n )\n when 'split'\n first_st = op.affected_stids.first\n rest_sts = op.affected_stids[1..-1]\n signature_computer = ->(st) {\n '' == st.tmp_attrs[:before] ? :blank : :present\n }\n # Compute before signature of first and unique rest elements\n aff_stid_before_signatures = (\n [signature_computer.call(first_st)] +\n rest_sts.map { |e| signature_computer.call(e) }.uniq\n )\n case aff_stid_before_signatures\n when [:present, :blank]\n # This is a regular split where the original subtitle comes first.\n # Insert new subtitle after original subtitle\n compute_insert_at_index_given_after_stid(\n op.affected_stids.first.persistent_id,\n updated_subtitles\n )\n else\n # This is an unexpected case.\n puts @content_at_file.filename\n p op\n p aff_stid_before_signatures\n raise \"Handle unexpected split!\"\n end\n else\n raise \"Handle this: #{ op.inspect }\"\n end\n insert_at_index\n end",
"def insert_into_transcript\n @transcript_lines << {\n transcript_id: @transcript_id,\n start_time: @line_temp[:from],\n end_time: @line_temp[:to],\n original_text: @line_temp[:lines].join(' '),\n sequence: (@line_number - 1)\n }\n @line_number += 1\n end",
"def transfer_subtitles(p_s, f_s)\n if debug\n puts \" Transfer subtitles:\"\n puts \" * p_s: #{ p_s.inspect }\"\n puts \" * f_s: #{ f_s.inspect }\"\n end\n # Determine if we can use punctuation signature for snapping.\n # Conditions: Each primary st is preceded by punctuation and primary\n # and foreign punctuation signatures are identical.\n sts_w_preceding_punct = p_s.scan(/(?:\\S|^)\\s?@/)\n all_sts_are_preceded_by_punct = sts_w_preceding_punct.all? { |e|\n e =~ /\\A@/ || e =~ /\\A[#{ regex_punctuation_chars }]/\n }\n\n # Determine and apply snapping strategy\n if(\n all_sts_are_preceded_by_punct &&\n (\n p_punct_sig = p_s.scan(/([#{ regex_punctuation_chars }])|([^#{ regex_punctuation_chars }]+)/).map { |m1, m2|\n m1 ? m1 : 'T'\n }.join\n f_punct_sig = f_s.scan(/([#{ regex_punctuation_chars }])|([^#{ regex_punctuation_chars }]+)/).map { |m1, m2|\n m1 ? m1 : 'T'\n }.join\n punc_sig_sim = p_punct_sig.longest_subsequence_similar(f_punct_sig)\n if debug\n puts \" * punctuation signatures:\"\n puts \" * p: #{ p_punct_sig.inspect }\"\n puts \" * f: #{ f_punct_sig.inspect }\"\n puts \" * sim: #{ punc_sig_sim.inspect }\"\n end\n 1.0 == punc_sig_sim\n )\n )\n # All primary subtitles are preceded by punctuation, and primary\n # and foreign punctuation signatures are identical.\n snap_subtitles_to_punctuation_signature(p_s, f_s)\n else\n # Do a simple character based interpolation for initial\n # subtitle_mark placement.\n new_f_s_raw = interpolate_subtitle_positions(p_s, f_s)\n # Snap subtitle_marks to nearby punctuation\n snap_subtitles_to_nearby_punctuation(p_s, new_f_s_raw)\n end\n end",
"def add_srt_data(text)\n language = Language.detect(text)\n text.gsub(/\\r\\n/, \"\\n\").split(/\\n\\n/).each do |block|\n index, times, text = block.split(/\\n/, 3)\n start_time, end_time = parse_srt_times(times)\n # TODO: Is this the best way to add records to an unsaved has_many?\n self.subtitles <<\n Subtitle.new(playable_media: self, language: language,\n start_time: start_time, end_time: end_time,\n text: text.chomp)\n end\n end",
"def subtitle(page_subtitle, show_subtitle = true, ignore_in_breadcrumbs = false)\n @show_subtitle = show_subtitle\n @ignore_subtitle_in_breadcrumbs = ignore_in_breadcrumbs\n @subtitle_for_content = page_subtitle.to_s\n end",
"def merge_annotation_topics(course_ids)\n logger.log \"Merging annotation topics for course #{course_ids.join(', ')}\"\n\n course_ids.each do |course_id|\n ids = Course::Assessment::Answer::ProgrammingFileAnnotation.joins(:discussion_topic).\n where(\"course_discussion_topics.course_id = #{course_id}\").pluck(:id)\n duplicate_ids = Course::Assessment::Answer::ProgrammingFileAnnotation.where(id: ids).\n select([:line, :file_id]).group(:line, :file_id).having('count(*) > 1').to_a\n duplicate_ids.each do |attr|\n do_merge(attr.file_id, attr.line)\n end\n end\n end",
"def subtitle(subtitle)\n @subtitle = subtitle\n end",
"def retrieve_subtitle\n\t\t\tFile.unlink(\"/tmp/Sub.srt\") if File.exists?(\"/tmp/Sub.srt\")\n\t\t\tget_from_source\n\t\t\treturn true if valid_subtitle?\n\t\t\tFile.unlink(\"/tmp/Sub.srt\") if File.exists?(\"/tmp/Sub.srt\")\n\t\t\treturn false\n\t\tend",
"def sub_load _subtitle_file\n send_cmd(\"sub_load #{_subtitle_file}\")\n end",
"def set_subtitle!\n if patterns = @name.match(/\\A([^\\b:]+): (.+)\\Z/)\n @name = patterns[1]\n @subtitle = patterns[2]\n end\n end",
"def do_inproceedings\n @lines.each {|l| l.sub!(/journal =/, \"booktitle =\") }\n end",
"def pubannos(data)\n \n result = JSON.parse(data)\n \n if result.has_key? 'Error'\n raise BioInterchange::Exceptions::InputFormatError, 'Error parsing the JSON input file: #{result[\"Error\"]}'\n end\n \n \n text = result['text']\n #doc_uri = \"http://pubannotation.dbcls.jp/pmdocs/\" + result['pmid'].to_s\n doc_uri = result['docurl']\n \n doc = Document.new(doc_uri)\n docContent = Content.new(0, text.length, Content::DOCUMENT, @process)\n docContent.setContext(doc)\n doc.add(docContent)\n \n #so our document requires content of type document or abstract\n #should it hold the content string?\n\n #hash to remember annotation in case they are needed for building upon based on ids later\n contents = {}\n\n if result['catanns']\n result['catanns'].each do |annot| \n start_offset = 0\n end_offset = 0\n if annot['span']\n start_offset = annot['span']['begin']\n end_offset = annot['span']['end']\n elsif annot['begin'] and annot['end']\n start_offset = annot['begin']\n end_offset = annot['end']\n end\n length = end_offset - start_offset\n\n category = annot['category']\n id = annot['id']\n \n entity = text.slice(start_offset..end_offset)\n \n #phrase = type for NE\n con = Content.new(start_offset, length, Content::PHRASE, @process)\n con.setContext(doc)\n doc.add(con)\n\n contents[id] = con \n \n #set process.date = updated_time?\n end\n end\n \n if result['insanns']\n result['insanns'].each do |annot|\n \n #unsure what to do about this (con1), 'E1' is the ID of something not created yet.\n #it is perhaps a case of making a new content, but with what params...?\n #need to conform what this is refering to with JDK\n con1 = nil \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'subClassOf'\n type = ContentConnection::SUBCLASS\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['relanns']\n result['relanns'].each do |annot|\n con1 = contents[annot['subject']] \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'equivalentTo'\n type = ContentConnection::EQUIVALENCE\n when 'themeOf'\n type = ContentConnection::THEME\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['modanns']\n result['modanns'].each do |annot|\n \n #in this case, it is a modification of an already existing content object (speculation/negation). \n con = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'Speculation'\n type = ContentConnection::SPECULATION\n when 'Negation'\n type = ContentConnection::NEGATION\n end\n connection = ContentConnection.new(con, nil, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n doc\n end",
"def report_count_files_with_gap_marks_and_subtitle_marks(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n total_count = 0\n with_gap_marks = 0\n with_subtitle_marks = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n with_gap_marks += 1 if contents.index('%')\n with_subtitle_marks += 1 if contents.index('@')\n # Uncomment next line to print line 7 of each file\n # puts contents.split(\"\\n\")[6][0,80] + ' ' + filename.split('/').last\n end\n\n lines = [\n \"Count of files with gap_marks and subtitle_marks\",\n '-' * 40,\n ]\n lines << \" - With gap_marks: #{ with_gap_marks }\"\n lines << \" - With subtitle_marks: #{ with_subtitle_marks }\"\n lines << '-' * 40\n lines << \"Checked #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'count_files_with_gap_marks_and_subtitle_marks.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report count_files_with_gap_marks_and_subtitle_marks`\\n\"\n }\n end",
"def create_subtitles\n self.outline[:subtitles].each do |subtitle, points_array|\n new_subtitle = self.subtitles.build(name: subtitle)\n points_array.each do |point_hash|\n point_hash.each do |point, note|\n new_point = new_subtitle.points.build(name: point)\n new_note = new_point.note.build(details: note)\n end\n end\n end\n end",
"def texts=(texts); end",
"def texts=(texts); end",
"def clean2\n content = text.split(\"\\n\")\n \n # First, find and mark songs\n in_song = false\n new_content = []\n content.each do |line|\n if line=~/\\*{5}/ .. line=~END_OF_SONG\n new_content << \"SONG:\" unless in_song\n if line =~ END_OF_SONG\n new_content << line\n in_song = false\n else\n new_content << \" #{line}\"\n in_song = true\n end\n else\n if in_song\n new_content << \"END OF SONG\"\n end\n in_song = false\n new_content << line\n end\n end\n \n # Now, fix line endings and merge lines\n old_content = new_content\n new_content = []\n preserve_breaks = false\n last_line = \"\"\n old_content.each do |line|\n new_content << \"\" if preserve_breaks ||\n last_line =~ END_OF_SONG || \n new_content.size == 0 ||\n line =~ /^.[LS]-\\d+(?:\\]|$|.\\s*\\()/ ||\n line =~ /^\\([A-Z]/ ||\n line =~ /^[A-Z][A-Z, \\.-]+:\\s/ ||\n line =~ /^Scene\\s+\\?\\s+-\\s+\\?/ ||\n line =~ START_OF_SONG ||\n line =~ /^#/\n case line\n when START_OF_SONG\n preserve_breaks = true\n when END_OF_SONG\n preserve_breaks = false\n end\n new_content[-1] += ' ' unless new_content[-1] =~ /^$|\\s$/\n new_content[-1] += line\n last_line = line\n end\n \n # Now, insert extra empty lines\n old_content = new_content\n new_content = []\n extra_space = true\n in_cast = false\n in_song = false\n \n old_content.each do |line|\n if line =~ /^#/\n extra_space = false if in_cast\n else\n in_cast = false\n extra_space = true unless in_song\n end\n new_content << \"\" if extra_space && new_content.size > 0\n new_content << line\n case line\n when /^#CAST FOR SCENE/\n in_cast = true\n when START_OF_SONG\n extra_space = false\n in_song = true\n when END_OF_SONG\n extra_space = true\n in_song = false\n end\n end\n \n # Finally, fix songs\n old_content = new_content\n new_content = []\n i = 0\n while i<old_content.size\n line = old_content[i]\n case line\n when START_OF_SONG\n # Find lines with stars in them\n j = i+1\n while j<old_content.size && old_content[j] !~ END_OF_SONG\n j += 1\n end\n # At this point lines i...j are the song; back up and look for the last \"*****\"\n while j>i && old_content[j] !~ /\\*{5}/\n j -= 1\n end\n # Now lines (i+1)...j are the song information block\n song_information = old_content[(i+1)...j].join\n song_name = song_information[/^[\\s\\*]*([^\\*]+)/,1].strip\n tune = song_information[/([^\\*]+)[\\s\\*]*$/,1].strip\n new_content += [\" SONG: #{song_name}\", \" (To the tune of: #{tune})\"]\n i = j+1\n when END_OF_SONG\n i += 1 # Discard end of song markers; we don't need them anymore\n else\n new_content << line\n i += 1\n end\n end\n \n # Save the results\n text = new_content.join(\"\\n\")\n end",
"def update_record_ids!(subtitles_container)\n # We iterate over all operations, find the affected_stids' corresponding\n # subtitle and update the record id.\n operations.each do |op|\n op.affected_stids.each { |aff_st|\n # Find matching st in subtitles_container\n matching_st = subtitles_container.detect { |st| st[:persistent_id] == aff_st.persistent_id }\n if matching_st\n # Update record id\n matching_st[:record_id] = aff_st.record_id\n else\n raise \"Could not find matching_st with persistent_id #{ aff_st.persistent_id }\"\n end\n }\n end\n end",
"def add_subtitles(movie)\n video_file_res = movie.project.final + \"/video.avi\"\n video_file = movie.project.final + \"/videotrack.avi\"\n cmd = @settings['subtitles'].dup\n cmd.sub!('<source>', video_file)\n cmd.sub!('<target>', video_file_res)\n cmd.sub!('<subtitles>', movie.subtitles)\n puts \"Adding subtitles\"\n puts cmd\n system(cmd)\n return video_file_res\n end",
"def update!(**args)\n @video_transcript_annotations = args[:video_transcript_annotations] if args.key?(:video_transcript_annotations)\n end",
"def insert_subject(topic=[], geographic=[], temporal=[])\n\t\tindex = self.mods(0).subject.count\n\t\tx = topic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif topic[x].strip == ''\n\t\t\t\ttopic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = geographic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif geographic[x].strip == ''\n\t\t\t\tgeographic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = temporal.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif temporal[x].strip == ''\n\t\t\t\ttemporal.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tself.mods(0).subject(index).topic = topic unless topic.blank?\n\t\tself.mods(0).subject(index).geographic = geographic unless geographic.blank?\n\t\tself.mods(0).subject(index).temporal = temporal unless temporal.blank?\n\tend",
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def setSubTitleHighlight(highlight)\n @subtitle_attr = highlight\n end",
"def before_commit(content)\n DCLPTextIdentifier.preprocess(content)\n end",
"def delete_from_body(start_mark, end_mark, delete_marks=false)\n if delete_marks\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"\")\n else\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"#{start_mark}#{end_mark}\")\n end\n update_issue({ body: @issue_body })\n end",
"def set_subtitle\n @subtitle = Subtitle.find(params[:id])\n end",
"def update!(**args)\n @transcript_segments = args[:transcript_segments] if args.key?(:transcript_segments)\n end",
"def update!(**args)\n @transcript_segments = args[:transcript_segments] if args.key?(:transcript_segments)\n end",
"def report_files_with_subtitles(options)\n total_csv_file_count = 0\n files_with_subtitles = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :csv_extension\n ),\n options['file_filter'] || /\\.subtitle_markers\\.csv\\z/,\n nil,\n \"Reading subtitle marker CSV files\",\n options\n ) do |csv_file|\n total_csv_file_count += 1\n uniq_first_col_vals = csv_file.contents.scan(/^\\d+/).uniq\n if ['0'] != uniq_first_col_vals\n # File has non-zero timestamps\n file_base_name = csv_file.basename\n files_with_subtitles << file_base_name.gsub(/\\.subtitle_markers\\.csv\\z/, '.at')\n $stderr.puts \" - #{ file_base_name }\"\n end\n end\n\n summary_line = \"Found #{ files_with_subtitles.length } of #{ total_csv_file_count } CSV files with subtitles at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir(:reports_dir), 'files_with_subtitles.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Files with subtitles\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write files_with_subtitles.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report files_with_subtitles`\\n\"\n }\n end",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def transfer_subtitles_to_foreign_sentence(p_s, f_s)\n subtitle_count = p_s.count('@')\n if 0 == subtitle_count\n # Return as is\n puts \" * No subtitle found\" if debug\n Outcome.new(true, [f_s, 1.0])\n elsif((1 == subtitle_count) && (p_s =~ /\\A@/))\n # Prepend one subtitle\n puts \" * Single subtitle, prepend to foreign sentence\" if debug\n Outcome.new(true, ['@' << f_s, 1.0])\n else\n transfer_subtitles(p_s, f_s)\n end\n end",
"def import_text_content\n self.text_content = self.to_text\n self.save\n\n # Reindex to elasticsearch\n self.reindex\n end",
"def transfer_st_ops_to_foreign_file!(foreign_content_at_file, st_ops_for_file)\n from_gc = st_ops_for_file.from_git_commit\n to_gc = st_ops_for_file.to_git_commit\n\n # Get from_subtitles as of from_gc\n from_subtitles = cached_primary_subtitle_data(\n foreign_content_at_file,\n from_gc,\n :at_child_or_ref\n )\n # Get to_subtitles as of the next git commit after to_gc. We have\n # to do this since STM CSV files are updated during st sync,\n # however the changes aren't committed until the next commit\n # after the sync_commit.\n to_subtitles = cached_primary_subtitle_data(\n foreign_content_at_file,\n to_gc,\n :at_child_or_current\n )\n\n # Get new content AT file contents\n fcatf_contents = st_ops_for_file.apply_to_foreign_content_at_file(\n foreign_content_at_file,\n from_subtitles,\n to_subtitles\n )\n\n # Update content AT file with new contents\n foreign_content_at_file.update_contents!(fcatf_contents)\n\n # Update file level st_sync data\n update_foreign_file_level_data(\n foreign_content_at_file,\n st_ops_for_file.to_git_commit,\n st_ops_for_file.subtitles_that_require_review,\n )\n true\n end",
"def save_subtitle contents, fs, source_id\n srt_filename = @filename.gsub /.mp4$/, ''\n srt_filename += \".#{source_id}#{next_distinguisher}.srt\"\n @stdout.puts \"Downloaded as #{srt_filename}\"\n fs.save_file srt_filename, contents\n end",
"def text_annotation(rect, contents, options = {})\n options = options.merge(Subtype: :Text, Rect: rect, Contents: contents)\n annotate(options)\n end",
"def import_markup_text( file_content )\n count = 0\n if file_content.scan(PTN_LINE)[0] =~ /tattertools/\n file_content = convert_tatter_xml( file_content )\n return file_content\n end\n count += create_pages( :content => file_content )\n count\n end",
"def typos_in_file(destination_file)\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tlines = subtitles_object_list.map{ |subtitle| subtitle.get_lines }\n\n\t\twords = get_words(lines.flatten)\n\n\t\ttypos = word_not_in_dictionary(words)\n\n\t\ttypos_list = look_for_typos_in_file(typos, subtitles_object_list)\n\n\t\ttypos_file_content = {}\n\t\ttypos_list.each do |typos_object|\n\t\t\ttypos_file_content.merge!(typos_object) {|k,l,r| [l,r].flatten.join(\", \") }\n\t\tend\n\n\t\t#functionality to ignore words, per example names\n\t\tignored_words = IO.read(\"ignored_words.txt\").split(\"\\n\")\n\n\t\tcontent = \"\"\n\t\ttypos_file_content.each do |word|\n\t\t\tunless ignored_words.include? word[0]\n\t\t\t\tcontent << word[0] + \": \" + word[1] + \"\\n\"\n\t\t\tend\n\t\tend\n\t\tIO.write(destination_file, content)\n\tend",
"def preprocess_avc(contents)\n new_contents = contents # no manipulation done here\n new_contents\n end",
"def add_existing_annotation\n @text = AnnotationText.find(params[:annotation_text_id])\n @submission_file_id = params[:submission_file_id]\n @submission_file = SubmissionFile.find(@submission_file_id)\n @annotation = Annotation.new\n @annotation.update_attributes({\n line_start: params[:line_start],\n line_end: params[:line_end],\n submission_file_id: params[:submission_file_id]\n })\n @annotation.annotation_text = @text\n @annotation.save\n @submission = @submission_file.submission\n @annotations = @submission.annotations\n end",
"def subtitle=(new_subtitle)\n @subtitle = new_subtitle\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 # 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 do_article\n # if it's a specification, force to @manual\n # if it's a site description, force to @misc\n # I couldn't determin condition whether output will be @manual or @article.\n if @article_type == :specification\n @lines.each {|l| l.sub!(/@article{/, \"@manual{\") }\n do_manual\n elsif @article_type == :site\n @lines.each {|l| l.sub!(/@article{/, \"@misc{\") }\n do_misc\n end\n end",
"def inline_mark(text)\n # process simple inlines\n for inline in INLINES_MARK\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\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}#{index}[#{body}]#{after}\"\n end\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}[#{link}](#{url})#{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 update!(**args)\n @content = args[:content] if args.key?(:content)\n @text_segments = args[:text_segments] if args.key?(:text_segments)\n end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\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 annotate_samples\n # hash to connect metadata\n exp_hash = create_metadata_hash(@exp_metadata, 0) # { expid => [metadata] }\n bs_hash = create_metadata_hash(@bs_metadata, 0) # { biosampleid => [metadata] }\n srs_hash = create_metadata_hash(@bs_metadata, 1) # { sampleid => [metadata] }\n date_hash = received_date_by_experiment # { expid => date_received }\n\n annotated = Parallel.map(open(@samples_fpath).readlines.drop(1), :in_threads => @@nop) do |line|\n data = line.chomp.split(\"\\t\")\n sample_md = bs_hash[data[0]] || srs_hash[data[0]]\n sample_info = if sample_md\n coverage = if sample_md[3] != \"NA\"\n data[7].to_f / sample_md[3].to_f * 1_000_000\n else\n \"NA\"\n end\n [\n sample_md,\n coverage,\n ]\n else\n \"NA\\tNA\\tNA\\tNA\" # secondary sample id, taxon id, taxonomic name, coverage\n end\n [\n data,\n sample_info,\n exp_hash[data[1]],\n date_hash[data[1]],\n ].flatten.join(\"\\t\")\n end\n open(output_fpath(\"quanto.annotated.tsv\"), 'w'){|f| f.puts([annotated_header.join(\"\\t\"), annotated]) }\n end",
"def multistamp(primary_file, stamp_file, output); end",
"def report_count_files_with_gap_marks_and_subtitle_marks(options)\n total_count = 0\n with_gap_marks = 0\n with_subtitle_marks = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n total_count += 1\n with_gap_marks += 1 if content_at_file.contents.index('%')\n with_subtitle_marks += 1 if content_at_file.contents.index('@')\n # Uncomment next line to print line 7 of each file\n # puts contents.split(\"\\n\")[6][0,80] + ' ' + filename.split('/').last\n end\n\n lines = [\n \"Count of files with gap_marks and subtitle_marks\",\n '-' * 40,\n ]\n lines << \" - With gap_marks: #{ with_gap_marks }\"\n lines << \" - With subtitle_marks: #{ with_subtitle_marks }\"\n lines << '-' * 40\n lines << \"Checked #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir(:reports_dir), 'count_files_with_gap_marks_and_subtitle_marks.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report count_files_with_gap_marks_and_subtitle_marks`\\n\"\n }\n end",
"def subtitle_values\n []\n end",
"def text_annotation(rect, contents, options={})\n options = options.merge(:Subtype => :Text, :Rect => rect, :Contents => contents)\n write_note(options)\n end",
"def subtitle\n {}\n end",
"def sub(text, regexp, with)\n linestart = text.index('insert linestart')\n lineend = linestart.lineend\n line = text.get(linestart, lineend)\n\n text.replace(linestart, lineend, line) if line.sub!(regexp, with)\n end",
"def sync_from_at(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n Repositext::Cli::Utils.convert_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n \"Synching AT files to PT\",\n options\n ) do |contents, filename|\n # Remove AT specific tokens\n pt = Suspension::TokenRemover.new(\n contents,\n Suspension::AT_SPECIFIC_TOKENS\n ).remove\n [Outcome.new(true, { contents: pt, extension: '.md' })]\n end\n end",
"def stamp(primary_file, stamp_file, output); end",
"def get_texts(params)\n #first, get the relevant canto and its stanzas\n canto = Canto.find_by_name(params['canto'])\n @stanzas = Stanza.where(canto_id: canto.id).includes(:stanza_translations).order(:number)\n case params[\"view\"]\n #if user wants to view a text without annotations, select the relevant translations\n when \"no_annotations\" # get text of the original poem or of one of its translations\n translation = Translation.find_by_name(params[:text])\n stanza_translations = extract_translations(translation)\n when \"asimov_annotations\"\n stanza_translations = extract_translations(Translation.first)\n when \"parallel_texts\"\n stanza_translations = parallel_texts_collection(params)\n end\n stanza_translations\n end",
"def get_podcast_references(content, target_page_url)\n # The logic here assumes that:\n # - paragraphs have headers\n # - each block of text (paragraph) is seperated by an empty line \n \n # Split the content into paragraphs\n paragraphs = content.split(/\\n\\n+/)\n # Find all the headers in the content\n headers = content.scan(/^#+\\s+(.*)$/).flatten\n\n # Create an array of hashes containing:\n # - the paragraph's title\n # - the paragraph's title slug\n # - the associated header\n # - the timestamp of the podcast in which this paragraph is discussed\n podcast_references = []\n current_header = 0\n current_title = {}\n in_review_club_section = false\n\n # Iterate over all paragraphs to find those with a podcast reference mark\n paragraphs.each do |p|\n # a title might have multiple paragraphs associated with it\n # the podcast reference mark might be at the end of an isolated\n # paragraph snippet that cannot access the title, therefore\n # we keep this information to be used in the link to the podcast recap\n title = find_title(p, !in_review_club_section)\n if !title.empty?\n # paragraph has title\n current_title = title\n end\n\n # If the current paragraph contains the podcast reference mark,\n # capture the timestamp, add paragraph to references and replace \n # the mark with link to the related podcast item\n p.gsub!($podcast_reference_mark) do |match|\n if in_review_club_section\n # the newsletter's review club section is the only section that does\n # not have a list item to use as anchor so we use the header\n current_title[\"podcast_slug\"] = \"#pr-review-club\" # to avoid duplicate anchor\n current_title[\"slug\"] = \"#bitcoin-core-pr-review-club\"\n end\n podcast_reference = {\"header\"=> headers[current_header], \"timestamp\"=> $1}\n podcast_reference.merge!(current_title)\n podcast_references << podcast_reference\n\n if current_title.empty?\n # this is needed for the podcast reference mark to link to the header\n # of the special section\n current_title[\"slug\"] = generate_slug(headers[current_header])\n end\n # Replace the whole match with the link\n headphones_link = \"[<i class='fa fa-headphones' title='Listen to our discussion of this on the podcast'></i>]\"\n replacement_link_to_podcast_item = \"#{headphones_link}(#{target_page_url}#{current_title[\"podcast_slug\"] || current_title[\"slug\"]})\"\n end\n\n # update to the next header when parse through it\n if p.sub(/^#+\\s*/, \"\") == headers[(current_header + 1) % headers.length()]\n current_header += 1\n in_review_club_section = headers[current_header] == \"Bitcoin Core PR Review Club\"\n # reset header-specific variables\n current_title = {}\n end\n\n end\n\n # Join the paragraphs back together to return the modified content\n updated_content = paragraphs.join(\"\\n\\n\")\n\n [updated_content, podcast_references]\n end",
"def split_to_token_contents(content)\n raise NotImplementedError(\"split_to_token_contents must be implemented for validation and parsing\")\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 set_increments\n if @tti.length == 0\n @sgn = 0 # subtitle group number\n @sn = 0 # subtitle number\n else\n @sgn = @tti.last.sgn\n @sn = @tti.last.sn\n increment_subtitle\n end\n end",
"def subtitle_values\n get_values(*subtitle_fields)\n end",
"def merge_texts!(hash, element)\n unless element.has_text?\n hash\n else\n # must use value to prevent double-escaping\n texts = +\"\"\n element.texts.each { |t| texts << t.value }\n merge!(hash, CONTENT_KEY, texts)\n end\n end",
"def calculate_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n xcategory = xuser.personal.category\n xacademic = xuser.academic\n tenth_mark = xacademic.tenth_marks\n user_subs = xacademic.subject_entries.all\n total_special_sub = sub_maps.count\n total = 0\n user_subs.each do |us|\n total += us.marks\n sub_maps.each do |sm|\n if us.subject_id == sm.subject_id\n total += us.marks\n end\n end\n end\n self.calculated_marks = total*10000 + tenth_mark\n end",
"def extract_annotations_from(file, pattern); end",
"def subtitle(value = nil, options = nil)\n end",
"def clear_marks\n @entries.each { |e| e[MARKED] = 0 }\n write_index\n end",
"def run\n # @file_to_validate is an array with the content_at and\n # subtitle/subtitle_tagging_import files\n content_at_file, subtitle_import_file = @file_to_validate\n errors, warnings = [], []\n\n catch(:abandon) do\n outcome = contents_match?(\n content_at_file.read,\n subtitle_import_file.read\n )\n\n if outcome.fail?\n errors += outcome.errors\n warnings += outcome.warnings\n #throw :abandon\n end\n end\n\n log_and_report_validation_step(errors, warnings)\n end",
"def merge_accepted_corrections_into_content_at(options)\n # First validate the spot sheets and cancel process if errors are found.\n validate_spot_sheet(options.merge('validate_or_merge' => 'merge'))\n\n accepted_corrections_base_dir = config.compute_base_dir(\n options['base-dir'] ||\n options['base-dir-1'] ||\n :accepted_corrections_dir\n )\n accepted_corrections_glob_pattern = config.compute_glob_pattern(\n accepted_corrections_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging accepted corrections into content_at'\n start_time = Time.now\n total_count = 0\n auto_success_count = 0\n manual_success_count = 0\n errors_count = 0\n\n Dir.glob(accepted_corrections_glob_pattern).each do |accepted_corrections_file_name|\n if accepted_corrections_file_name !~ /\\.accepted_corrections\\.txt\\z/\n $stderr.puts \" - skipping #{ accepted_corrections_file_name }\"\n next\n end\n total_count += 1\n # prepare paths\n content_at_file_name = accepted_corrections_file_name.gsub(\n accepted_corrections_base_dir,\n content_base_dir\n ).gsub(\n /\\.accepted_corrections\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n # First apply all corrections that can be done automatically\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_auto(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # write to file\n at_with_accepted_corrections = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_accepted_corrections)\n auto_success_count += 1\n $stderr.puts \" + Auto-merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n\n # Second apply manual corrections.\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_manually(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # Nothing needs to be written to file. This has already been done\n # manually in the editor.\n manual_success_count += 1\n $stderr.puts \" + Manually merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ total_count } files in #{ Time.now - start_time } seconds:\"\n $stderr.puts \" - Auto-merges: #{ auto_success_count } files.\"\n $stderr.puts \" - Manual merges: #{ manual_success_count } files.\"\n $stderr.puts '-' * 80\n end",
"def subtitle\n if @subtitle.nil?\n subtitle_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:subtitle\",\n \"subtitle\",\n \"atom03:tagline\",\n \"tagline\",\n \"description\",\n \"summary\",\n \"abstract\",\n \"ABSTRACT\",\n \"content:encoded\",\n \"encoded\",\n \"content\",\n \"xhtml:body\",\n \"body\",\n \"xhtml:div\",\n \"div\",\n \"p:payload\",\n \"payload\",\n \"channelDescription\",\n \"blurb\",\n \"info\"\n ])\n @subtitle = FeedTools::HtmlHelper.process_text_construct(\n subtitle_node, self.feed_type, self.feed_version, [self.base_uri])\n if self.feed_type == \"atom\" ||\n self.configurations[:always_strip_wrapper_elements]\n @subtitle = FeedTools::HtmlHelper.strip_wrapper_element(@subtitle)\n end\n if @subtitle.blank?\n @subtitle = self.itunes_summary\n end\n if @subtitle.blank?\n @subtitle = self.itunes_subtitle\n end\n end\n return @subtitle\n end",
"def process_article(art)\n this_pub = {}\n \n # if not table of figure or equation remove reference\n # a.zip(b) zipped lists\n both = art.xpath('//xref/@ref-type').zip(art.xpath('//xref'))\n both.each do |tag,elem| \n if tag.text != 'table' || tag.text != 'fig' || tag.text != 'fn' || tag.text != 'sec' || tag.text != 'disp-formula'\n elem.remove\n end\n end\n\n jrn_meta = art / \"article/front/journal-meta\"\n this_pub[:jrn_id] = (jrn_meta / \"journal-id[journal-id-type='nlm-ta']\").text\n art_meta = art / \"/article/front/article-meta\"\n\n this_pub[:pmid] = (art_meta / \"article-id[pub-id-type='pmid']\").text\n\n this_pub[:pmcid] = (art_meta / \"article-id[pub-id-type='pmc']\").text\n# this_pub[:doi] = (art_meta / \"article-id[pub-id-type='doi']\").text\n\n # title\n title_node = (art_meta / \"title-group/article-title\")\n \n # SDB Note 8/2016\n # Turns out that some of the article titles include footnotes or super/subscripts which occurred at the end of a title, \n # which are represented by embedded tags (e.g. <fn> or something like that),and calling .text on the title node was \n # including those (and messing stuff up in the process).\n # We thought that we only needed to worry about tags at the end of titles, and so for trec CDS 2016 we just used the first child node and called it good.\n # This turned out to be insufficient- in the latest PMC release, there are titles with italic text (cf. PMC1079931),\n # and the approach below fails in these cases. \n # TODO: a more robust title-parsing algorithm\n \n if title_node.children.size > 1\n this_pub[:title] = title_node.children.first.text.strip\n else\n this_pub[:title] = title_node.text.strip\n end\n\n # pub_year\n # if ppub, use that; else use collection\n ppub = (art_meta / \"pub-date[pub-type='ppub']/year\").text\n epub = (art_meta / \"pub-date[pub-type='epub']/year\").text\n year = nil\n if ppub.strip.length > 0\n year = ppub.strip\n else\n year = epub.strip\n end\n this_pub[:year] = year \n\n # abstract (if present)\n abst_node = art_meta / \"abstract\"\n \n this_pub[:abstract] = {}\n if abst_node.length == 0\n this_pub[:abstract][:full] = \"\"\n elsif (abst_node / \"sec\").size > 0 # structured abstract (inc. section headings)\n abstract_full = \"\" \n # go through each section, and get the parts out in some kind of order\n (abst_node / \"sec\").each do |s|\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end \n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n # clean leftovers of xref\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n abstract_full << ti << \"\\n\"\n abstract_full << body << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full.strip\n end\n if (abst_node / \"p\").size > 0 # unstructured abstract\n abstract_full = this_pub[:abstract][:full].to_s\n (abst_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n abs = s.text.strip\n abs = abs.gsub(/\\[-*\\]/, \"\")\n abs = abs.gsub(/\\(,*\\)/, \"\")\n abs = abs.gsub(/\\(-*\\)/, \"\")\n abs = abs.gsub(/\\[,*\\]/, \"\")\n abstract_full << abs << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full\n else\n STDERR.puts \"Other format found: \" + (art_meta / \"article-id[pub-id-type='pmc']\").text\n this_pub[:abstract][:full] = \"\"\n end\n \n # now do body- similar deal\n this_pub[:body] = {}\n body_node = art / \"/article/body\"\n \n if (body_node / \"sec\").size > 0\n body_full = \"\"\n (body_node / \"sec\").each do |s|\n # rm xref\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end\n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/inline-formula').each do |node|\n node.remove\n end\n\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n fig_cap = (s / \"fig/caption/p\").text.strip\n tbl_cap = (s / \"table-wrap/table-wrap-foot/p\").text.strip\n tbl_fn = (s / \"table-wrap/table-wrap-foot/fn\").text.strip\n\n # clean leftovers of xref\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\[-*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\(,*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\(-*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\[,*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[-*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(,*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(-*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[,*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[-*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(,*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(-*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[,*\\]/, \"\")\n body_full << ti << \"\\n\"\n body_full << body << \"\\n\"\n body_full << fig_cap << \"\\n\"\n body_full << tbl_cap << \"\\n\"\n body_full << tbl_fn << \"\\n\"\n end\n this_pub[:body][:full] = body_full.strip\n end\n\n if (body_node / \"p\").size > 0 # found the sec and p can coexist 2660466.nxml\n body_full = this_pub[:body][:full].to_s\n (body_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n body = s.text.strip\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body_full << body << \"\\n\"\n end\n this_pub[:body][:full] = body_full \n else\n STDERR.puts \"Serious weirdness in body: \"+ (art_meta / \"article-id[pub-id-type='pmc']\").text\n end\n \n \n return this_pub\nend",
"def subtitle_fields\n []\n end",
"def import\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_import_file_given')) and return unless params[:importfile].present?\n filename = params[:importfile].original_filename\n extension = filename.sub(/.*\\./, '')\n if extension == 'yml'\n hash = YAML.load_file(params[:importfile].tempfile.path) rescue nil\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.cannot_parse_yaml')) and return unless hash\n CouchbaseI18n.traverse_flatten_keys(hash).each do |key, value|\n existing = CouchbaseI18n::Translation.find_by_translation_key(key)\n if existing\n if existing.translation_value != value\n existing.translation_value = value\n existing.translated = true\n existing.save\n end\n else\n CouchbaseI18n::Translation.create :translation_key => key, :translation_value => value\n end\n end \n else\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_proper_import_extension', :extension => extension)) and return \n end\n redirect_to({:action => :index, :offset => params[:offset]}, :notice => I18n.t('couchbase_i18n.translation.file_imported', :filename => filename))\n end",
"def paste(at: caret)\n editable? and @native.paste_text(at.to_i)\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 strip_annotations(content)\n real_content = []\n mode = :content\n header_position = 0\n\n content.split(/\\n/, -1).each_with_index do |line, line_number|\n if mode == :header && line !~ /\\s*#/\n mode = :content\n real_content << line unless line.blank?\n elsif mode == :content\n if line =~ /^\\s*#\\s*== Route.*$/\n header_position = line_number + 1 # index start's at 0\n mode = :header\n else\n real_content << line\n end\n end\n end\n\n real_content_and_header_position(real_content, header_position)\n end",
"def create_parts_and_annotations_mcd(part)\n \n puts\n puts \"== Creating/finding SD part for #{part.biofab_id} ==\"\n\n sd_sequence = part.sequence[$msd1]\n sd_part = Part.find_by_sequence(sd_sequence)\n if !sd_part\n sd_part = Part.new\n sd_part.sequence = sd_sequence\n sd_part.description = \"The Shine-Dalgarno / RBS sequence in a mono-cistronic design.\"\n sd_part.part_type = $sd_type\n sd_part.save!\n puts \"--created sd part\"\n else\n puts \"--found sd part\"\n end\n puts \"---- #{sd_part.sequence}\"\n\n puts\n puts \"== Creating start part for #{part.biofab_id} ==\"\n\n start_sequence = part.sequence[$mstart]\n start_part = Part.find_by_sequence(start_sequence)\n if !start_part\n start_part = Part.new\n start_part.sequence = start_sequence\n start_part.description = \"Start codon.\"\n start_part.part_type = $start_type\n start_part.save!\n puts \"--created start part\"\n else\n puts \"--found start part\"\n end\n \n puts\n puts \"== Annotating #{part.biofab_id} ==\"\n\n annot_type_name = \"Mono-cistronic 5' UTRs\"\n annot_type = AnnotationType.find_by_name(annot_type_name)\n if !annot_type\n annot_type = AnnotationType.new\n annot_type.name = annot_type_name\n annot_type.save!\n puts \"-- created annotation type for mono-cistronic 5' UTRs\"\n else\n puts \"-- found annotation type for mono-cistronic 5' UTRs\"\n end\n \n sd_label = \"Mutated SD\"\n start_label = \"Start\"\n\n create_annotation(part, sd_part, annot_type, $msd1.begin, $msd1.end, sd_label)\n create_annotation(part, start_part, annot_type, $mstart.begin, $mstart.end, start_label)\n\nend",
"def export_as_apa_citation_txt\n return '' unless to_marc\n super\n end",
"def parse_span_extensions; end",
"def raw_bibtex_entry_params\n params.require(:content).permit(:converted, :subject_list => [], :keyword_list => [])\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n ind1 = ' '\n code, *ind2 = case term['term_type']\n when 'uniform_title'\n value = term['term'].split(\" \")[0]\n first_indicator = '0'\n if value\n hsh = {}\n hsh['A'] = '2'\n hsh['An'] = '3'\n hsh['The'] = '4'\n articles = []\n articles = hsh.keys\n first_indicator = hsh[value] if articles.include?(value)\n end\n ['630', first_indicator, source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # code borrowed from Yale to export subject authority id\n unless subject['authority_id'].nil?\n sfs << ['0', subject['authority_id']]\n end\n\n \n # N.B. ind2 is an array at this point.\n if ind2[0] == '7'\n sfs << ['2', subject['source']]\n end\n\n # adding this code snippet because I'm making ind2 an array\n # for code 630 if the title begins with an article\n if (ind2.is_a?(Array) && code == '630')\n ind1, ind2 = ind2\n else\n ind2 = ind2[0]\n end\n\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def restore_tags\n marc.by_tags(\"599\").each do |t|\n new_content = t.fetch_first_by_tag(\"a\").content\n if new_content =~ /=[0-9]{3}\\s{2}/\n tag, content = new_content.split(\" \")\n marc.parse_marc21(tag[1..4], content)\n t.destroy_yourself\n end\n end\n self.save\n end",
"def tex_cleanup\n puts ' cleanup obsolete stuff in LaTeX'\n document.content.gsub! /\\\\textbackslash\\{}printbibliography/, '\\printbibliography'\n document.content.gsub! /\\\\textbackslash\\{}cite\\\\\\{(.*?)\\\\}/, '\\cite{\\1}'\n\n puts ' increase heading levels'\n # for the annual report the level of headings of the project reports need to be increased\n # a) headings within a project need to be named paragraphs\n document.content.gsub! /\\\\subsection{(.*)}\\\\label/, '\\subsubsection{\\1}~\\\\\\label'\n # b) project titles need to be two levels down\n document.content.gsub! /\\\\section{(.*)}\\\\label/, '\\subsection{\\1}\\label' # TODO: do we need that here?\n\n # to fix multiple occurrences of labels in the aggregated report, we prepend each label with\n # the project's slug\n document.content.gsub! /\\\\label{([\\w-]*)}/, \"\\\\label{#{document.data['slug']}-\\\\1}\"\n\n # wrap the project's report in it's own _biblatex_ reference section\n document.content.prepend(\"\\\\begin{refsection}[projects/#{document.data['slug']}]\\n\\n\")\n document.content += \"\\n\\\\end{refsection}\\n\"\n\n # add the project's title\n document.content.prepend(\"\\\\subsection{#{document.data['title']}}\\\\label{#{document.data['title'].downcase.gsub(/\\s/, '-')}}\\n\\n\")\n end",
"def insert_inline_table_of_contents(content)\n content.gsub(/^inline\\-toc\\.\\s*$(.*?)^\\s*$/m) do |match|\n yaml_raw = $~.captures[0]\n yaml = YAML::load(yaml_raw)\n NavHelper.inline_toc_items(yaml)\n end\n end",
"def annotate\n redirect_to :show unless rcparams = params[:recipe][:recipeContents]\n @content = rcparams[:content]\n ps = ParserServices.new entity: @recipe, content: @content\n # This is a two-, possibly three-phase process:\n # 1) a selection from the browser directs attention to a range of text, which generates a CSS path for an element to parse\n # 2) this so-called parse_path is attempted to be parsed. If it doesn't work because of a findable tag, a dialog is presented\n # for the user to decide how to handle the tag;\n # 3) the user says to enter the problematic tag directly into the dictionary, or specifies an existing tag for what\n # was meant by the problematic tag. The latter can be optionally entered as a synonym of the intended name.\n if rcparams[:anchor_path] # Initial annotation on browser selection\n logger.debug \"Annotating with anchor_path = '#{rcparams[:anchor_path]}'\"\n @annotation, @parse_path = ps.annotate_selection *rcparams.values_at(:token, :anchor_path, :anchor_offset, :focus_path, :focus_offset)\n elsif @parse_path = rcparams[:parse_path] # Specifying an element of the DOM\n if !(@tagname = rcparams[:tagname])\n logger.debug \"Looking for tag at '#{@parse_path}'\"\n # @annotation = ParsingServices.parse_on_path *rcparams.values_at(:content, :parse_path) do |tagtype, tagname|\n @annotation = ps.parse_on_path @parse_path do |tagtype, tagname|\n @tagtype, @tagname = tagtype, tagname\n end\n @parse_path = nil unless @tagname # We'll need the parse path for identifying the tag\n else # There IS a tagname: use that as a tag\n noko_elmt = ps.extract_via_path @parse_path\n @tagtype = rcparams[:tagtype]\n @annotation = rcparams[:content]\n # @tagname of type @tagtype is a mystery tag previously identified by a failed parse.\n logger.debug \"Use tag '#{@tagname}' of type '#{@tagtype}' at path '#{@parse_path}'\"\n # The logic here is as follows, for sorting out words.\n # -- '@tagname' is the questionable tag\n # -- 'rcparams[:replacement]' is the id of a tag selected by the user to serve in its place\n # -- 'rcparams[:assert]' is set if that tag will be added to the dictionary\n # If there's no replacement tag, the term is just accepted into the dictionary as a new instance of the tagtype.\n # If there IS a non-nil replacement, that's what we understand the term to mean. If, then, assert is set,\n # the questionable term will get added to the dictionary as a synonym for the replacement. If not, the alias\n # is accepted and added to the Seeker as such.\n # No tagname has been parsed out; proceed to parse the entity denoted by the parse path\n if (replacement = rcparams[:replacement]).present?\n old_tag = Tag.find_by id: replacement\n if rcparams[:assert]\n new_tag = Tag.assert @tagname, @tagtype\n new_tag.absorb old_tag, false\n end\n value = old_tag.name\n else\n # No replacement provided => simply assert the tag into the dictionary\n value = @tagname\n Tag.assert @tagname, @tagtype\n end\n @tagname = nil # Go back to the annotation dialog\n @parse_path = nil\n if noko_elmt\n noko_elmt[:value] = value\n @annotation = noko_elmt.ancestors.last.to_s\n end\n end\n end\n end"
] | [
"0.80893487",
"0.60355467",
"0.56063306",
"0.5563302",
"0.55631053",
"0.5482907",
"0.54163516",
"0.5389429",
"0.53316957",
"0.5297075",
"0.52208096",
"0.5157434",
"0.5102568",
"0.5079679",
"0.50069255",
"0.4964183",
"0.4943861",
"0.4942114",
"0.48841727",
"0.48463398",
"0.47611725",
"0.46907404",
"0.46806273",
"0.46479428",
"0.457296",
"0.45719942",
"0.45679462",
"0.4555634",
"0.45274022",
"0.45158905",
"0.45028102",
"0.45028102",
"0.45026362",
"0.44766393",
"0.44743827",
"0.44685608",
"0.44536936",
"0.4430977",
"0.44130012",
"0.4408314",
"0.4395625",
"0.4389439",
"0.43801412",
"0.43801412",
"0.43730512",
"0.4369013",
"0.43431973",
"0.4340354",
"0.43325996",
"0.43304425",
"0.43194708",
"0.43091497",
"0.42959252",
"0.42952353",
"0.427298",
"0.4258343",
"0.42567828",
"0.42381272",
"0.42284366",
"0.42217782",
"0.42180765",
"0.42169055",
"0.41978037",
"0.41916952",
"0.41850978",
"0.4182271",
"0.41816318",
"0.41731802",
"0.41730663",
"0.41585857",
"0.41477618",
"0.4121495",
"0.4111953",
"0.41063005",
"0.40952888",
"0.4094994",
"0.40942627",
"0.4091202",
"0.40864408",
"0.40774614",
"0.4074418",
"0.4068251",
"0.4061157",
"0.4061118",
"0.4060122",
"0.40571696",
"0.40548947",
"0.40193826",
"0.4016435",
"0.4013593",
"0.40073922",
"0.3999773",
"0.39906493",
"0.39886323",
"0.39868513",
"0.39794886",
"0.3971468",
"0.3968925",
"0.39520073",
"0.3949357"
] | 0.8202545 | 0 |
Merges subtitle_marks from subtitle_tagging_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks. | def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)
subtitle_tagging_import_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir
)
subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(
subtitle_tagging_import_base_dir,
options['file-selector'] || :all_files,
options['file-extension'] || :txt_extension
)
content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'
merge_subtitle_marks_from_subtitle_shared_into_content_at(
subtitle_tagging_import_glob_pattern,
subtitle_tagging_import_base_dir,
content_base_dir,
options
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def export_subtitle_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('subtitle_tagging_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to subtitle tagging\",\n options.merge(\n :output_path_lambda => lambda { |input_filename, output_file_attrs|\n Repositext::Utils::SubtitleFilenameConverter.convert_from_repositext_to_subtitle_export(\n input_filename.gsub(config.base_dir(input_base_dir_name), output_base_dir),\n output_file_attrs\n )\n }\n )\n ) do |contents, filename|\n # Since the kramdown parser is specified as module in Rtfile,\n # I can't use the standard kramdown API:\n # `doc = Kramdown::Document.new(contents, :input => 'kramdown_repositext')`\n # We have to patch a base Kramdown::Document with the root to be able\n # to convert it.\n root, warnings = config.kramdown_parser(:kramdown).parse(contents)\n doc = Kramdown::Document.new('')\n doc.root = root\n subtitle_tagging = doc.send(config.kramdown_converter_method(:to_subtitle_tagging))\n empty_markers_file = %(RelativeMS\\tSamples\\n0\\t0\\n)\n [\n Outcome.new(true, { contents: subtitle_tagging, extension: 'rt.txt' }),\n Outcome.new(true, { contents: empty_markers_file, extension: 'markers.txt' }),\n ]\n end\n end",
"def merge_gap_mark_tagging_import_into_content_at(options)\n gap_mark_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir\n )\n gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(\n gap_mark_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :content_dir\n )\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|\n if gap_mark_tagging_import_file_name !~ /\\.gap_mark_tagging\\.txt\\z/\n next\n end\n\n total_count += 1\n # prepare paths\n content_at_file_name = gap_mark_tagging_import_file_name.gsub(\n gap_mark_tagging_import_base_dir, content_base_dir\n ).gsub(\n /\\.gap_mark_tagging\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(\n File.read(gap_mark_tagging_import_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_tokens = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def subtitle_mark_at_beginning_of_every_paragraph?(content_at_file)\n content = content_at_file.contents\n # Early return if content doesn't contain any subtitle_marks\n return Outcome.new(true, nil) if !content.index('@')\n case @options[:content_type]\n when :import\n # In this mode we raise an exception if we find any paragraphs\n content_without_headers = empty_header_lines(content)\n paragraphs_without_subtitle_mark = check_import_file(content_without_headers)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n # We want to terminate an import if there isn't a subtitle_mark\n # at the beginning of every paragraph.\n # Normally we'd return a negative outcome (see :content), but in this\n # case we raise an exception.\n raise NoSubtitleMarkAtBeginningOfParagraphError.new(\n [\n \"The following paragraphs don't start with a subtitle_mark:\",\n paragraphs_without_subtitle_mark.map { |e| e.inspect }.join(\"\\n\")\n ].join(\"\\n\")\n )\n end\n when :content\n # In this mode we only report errors if we find any paragraphs\n # We only look at text after the second record_id. Replace all lines\n # before the second record_id with empty lines (to keep line location\n # in error reports accurate)\n content_from_second_record_id = remove_all_text_content_before_second_record_id(content)\n paragraphs_without_subtitle_mark = check_content_file(content_from_second_record_id)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n paragraphs_without_subtitle_mark.map { |(line, para)|\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: line,\n context: para.inspect,\n },\n [\"Paragraph doesn't start with a subtitle_mark\"]\n )\n }\n )\n end\n else\n raise ArgumentError.new(\"Invalid @options[:content_type]: #{ @options[:content_type].inspect }\")\n end\n end",
"def report_count_subtitle_marks(options)\n file_count = 0\n subtitle_marks_count = 0\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n subtitle_marks_count += content_at_file.contents.count('@')\n file_count += 1\n end\n $stderr.puts \"Found #{ subtitle_marks_count } subtitle_marks in #{ file_count } files at #{ Time.now.to_s }.\"\n end",
"def copy_subtitle_marker_csv_files_to_content(options)\n input_base_dir = config.compute_base_dir(options['base-dir'])\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :txt_extension)\n output_base_dir = options['output'] || config.base_dir(:content_dir)\n\n Repositext::Cli::Utils.copy_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'] || /\\.markers\\.txt\\z/,\n \"Copying subtitle marker CSV files from subtitle_tagging_import_dir to content_dir\",\n options.merge(\n :output_path_lambda => lambda { |input_filename|\n input_filename.gsub(input_base_dir, output_base_dir)\n .gsub(\n /\\/([^\\/\\.]+)\\.markers\\.txt/,\n '/' + config.setting(:language_code_3_chars) + '\\1.subtitle_markers.csv'\n )\n }\n )\n )\n end",
"def significant_changes?(content_at, subtitle_marker_csv)\n raise(ArgumentError.new(\"content_at is empty.\")) if content_at.to_s.strip.empty?\n raise(ArgumentError.new(\"subtitle_marker_csv is empty.\")) if subtitle_marker_csv.to_s.strip.empty?\n if !content_at.index('@')\n # Document doesn't contain subtitle marks, skip it\n return Outcome.new(true, nil)\n end\n csv = CSV.new(subtitle_marker_csv, col_sep: \"\\t\", headers: :first_row)\n previous_stm_positions_and_lengths = csv.to_a.map { |row|\n r = row.to_hash\n { char_pos: r['charPos'].to_i, char_length: r['charLength'].to_i }\n }\n new_captions = Repositext::Utils::SubtitleMarkTools.extract_captions(content_at)\n # make sure that both counts are identical\n if new_captions.length != previous_stm_positions_and_lengths.length\n # TODO: maybe we have to make them the same length, if stm was added or removed\n raise \"Different counts: #{ previous_stm_positions_and_lengths.length } -> #{ new_captions.length }\"\n end\n\n significantly_changed_captions = []\n previous_stm_positions_and_lengths.each_with_index { |old_caption, idx|\n new_caption = new_captions[idx]\n old_pos = old_caption[:char_pos]\n old_len = old_caption[:char_length]\n new_pos = new_caption[:char_pos]\n new_len = new_caption[:char_length]\n if subtitle_mark_changed_significantly?(old_len, new_len)\n line_num = content_at[0..new_pos].count(\"\\n\") + 1\n significantly_changed_captions << { excerpt: new_caption[:excerpt], line_num: line_num }\n end\n }\n if significantly_changed_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n [\n Reportable.error(\n [@file_to_validate.first.path], # content_at file\n [\n 'Subtitle caption length has changed significantly',\n 'Review changes and update subtitle_markers_file with `repositext sync subtitle_mark_character_positions`',\n significantly_changed_captions.map { |e|\n \"On line #{ e[:line_num] }: #{ e[:excerpt] }\"\n }.join(\"\\n\")\n ]\n )\n ]\n )\n end\n end",
"def significant_changes?(content_at_file, subtitle_marker_csv_file)\n if content_at_file.contents.to_s.strip.empty?\n raise(ArgumentError.new(\"content_at is empty.\"))\n end\n if subtitle_marker_csv_file.contents.to_s.strip.empty?\n raise(ArgumentError.new(\"subtitle_marker_csv is empty.\"))\n end\n if !content_at_file.contents.index('@')\n # Document doesn't contain subtitle marks, skip it\n return Outcome.new(true, nil)\n end\n csv = subtitle_marker_csv_file.csv\n previous_stm_lengths = csv.to_a.map { |row|\n r = row.to_hash\n { char_length: r['charLength'].to_i }\n }\n new_captions = Repositext::Utils::SubtitleMarkTools.extract_captions(content_at_file.contents)\n # make sure that both counts are identical\n if new_captions.length != previous_stm_lengths.length\n # There is a mismatch in subtitle_mark counts between CSV file and\n # content_at. It makes no sense to run this validator unless the\n # counts match. We just skip it silently.\n return Outcome.new(true, nil)\n end\n\n changed_captions = []\n previous_stm_lengths.each_with_index { |old_caption, idx|\n new_caption = new_captions[idx]\n old_len = old_caption[:char_length]\n new_len = new_caption[:char_length]\n change_severity = compute_subtitle_mark_change(old_len, new_len)\n if change_severity\n changed_captions << {\n severity: change_severity,\n excerpt: new_caption[:excerpt],\n line_num: new_caption[:line],\n subtitle_index: idx + 1 # subtitle_index is '1'-based in the other workflow tools\n }\n end\n }\n if changed_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n changed_captions.map { |e|\n case e[:severity]\n when :insignificant\n Reportable.warning(\n {\n filename: content_at_file.filename,\n line: e[:line_num],\n context: \"Subtitle ##{ e[:subtitle_index] }: #{ e[:excerpt] }\",\n corr_filename: subtitle_marker_csv_file.filename,\n },\n ['Subtitle caption length has changed insignificantly']\n )\n when :significant\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: e[:line_num],\n context: \"Subtitle ##{ e[:subtitle_index] }: #{ e[:excerpt] }\",\n corr_filename: subtitle_marker_csv_file.filename,\n },\n [\n 'Subtitle caption length has changed significantly',\n 'Review changes and update subtitle_markers_file with `repositext sync subtitle_mark_character_positions`',\n ]\n )\n else\n raise \"Invalid severity: #{ e.inspect }\"\n end\n }\n )\n end\n end",
"def find_subtitle_misalignments_between_qotd_and_content_at(date_code, posting_date_time, qotd_txt, content_at_txt, collector)\n end",
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n idml_not_present_count = 0\n folio_not_present_count = 0\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)\n # Both files are present, merge tokens\n begin\n at_folio = File.read(at_folio_file_name)\n at_idml = File.read(at_idml_file_name)\n at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(\n at_folio, at_idml\n )\n # write to file\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge rids from #{ at_folio_file_name }\"\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, use Folio import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n idml_not_present_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n elsif File.exist?(at_idml_file_name)\n # Folio file is not present, use Idml import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n folio_not_present_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - Folio files not present: #{ folio_not_present_count }\"\n $stderr.puts \" - IDML files not present: #{ idml_not_present_count }\"\n $stderr.puts '-' * 80\n end",
"def delete_subtitles!(subtitles_container)\n delete_and_merge_ops.each do |op|\n # Remove subtitle\n op.affected_stids.each { |aff_st|\n next unless '' == aff_st.tmp_attrs[:after]\n subtitles_container.delete_if { |new_st|\n new_st[:persistent_id] == aff_st.persistent_id\n }\n }\n end\n true\n end",
"def insert_new_subtitles!(subtitles_container)\n insert_and_split_ops.each do |op|\n insert_at_index = compute_insert_at_index(op, subtitles_container)\n # Get all the inserted subtitle ids\n inserted_stids = op.affected_stids.find_all { |e|\n '' == e.tmp_attrs[:before].to_s and '' != e.tmp_attrs[:after].to_s\n }.map(&:persistent_id)\n # Insert subtitle ids into subtitles_container, starting with last\n # so that we can insert them all at the same index.\n inserted_stids.reverse.each { |stid|\n subtitles_container.insert(insert_at_index, { persistent_id: stid })\n }\n end\n true\n end",
"def copy_subtitle_marker_csv_files_to_subtitle_export(options)\n input_base_dir = config.compute_base_dir(options['base-dir'] || :content_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :csv_extension)\n # grab source marker_csv file from primary repo\n primary_repo_input_base_dir = input_base_dir.sub(\n config.base_dir(:content_type_dir), config.primary_content_type_base_dir\n )\n output_base_dir = options['output'] || config.base_dir(:subtitle_export_dir)\n Repositext::Cli::Utils.copy_files(\n primary_repo_input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'] || /\\.subtitle_markers\\.csv\\z/,\n \"Copying subtitle marker CSV files from content_dir to subtitle_export_dir\",\n options.merge(\n output_path_lambda: lambda { |input_filename|\n Service::Filename::ConvertStmCsvToStExport.call(\n source_filename: input_filename.sub(\n primary_repo_input_base_dir,\n output_base_dir\n )\n )[:result]\n }\n )\n )\n end",
"def subtitle_marks_spaced_correctly?(content_at_file)\n # Early return if content doesn't contain any subtitle_marks\n return Outcome.new(true, nil) if !content_at_file.contents.index('@')\n\n too_long_captions = find_too_long_captions(content_at_file.contents)\n if too_long_captions.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n too_long_captions.map { |(line, length, idx, excerpt)|\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: line,\n context: excerpt,\n },\n [\n 'Subtitle caption is too long',\n %(#{ length } characters in caption ##{ idx }),\n ]\n )\n }\n )\n end\n end",
"def strip_annotations(content); end",
"def subtitle_mark_counts_match?(content_at, subtitle_marker_csv)\n content_at_count = content_at.count('@')\n subtitle_marker_csv_count = subtitle_marker_csv.strip.count(\"\\n\")\n\n # compare the two counts\n if 0 == content_at_count || content_at_count == subtitle_marker_csv_count\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n [\n Reportable.error(\n [@file_to_validate.last.path],\n [\n 'Subtitle_mark count mismatch',\n \"content_at contains #{ content_at_count }, but subtitle_marker_csv contains #{ subtitle_marker_csv_count } subtitle_marks.\"\n ]\n )\n ]\n )\n end\n end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\n end",
"def compute_insert_at_index(op, updated_subtitles)\n insert_at_index = case op.operation_type\n when 'insert'\n # No matter if op has one or more affected_stids, we only need the\n # first index. All affected_stids will be inserted here in the\n # correct order.\n compute_insert_at_index_given_after_stid(\n op.after_stid,\n updated_subtitles\n )\n when 'split'\n first_st = op.affected_stids.first\n rest_sts = op.affected_stids[1..-1]\n signature_computer = ->(st) {\n '' == st.tmp_attrs[:before] ? :blank : :present\n }\n # Compute before signature of first and unique rest elements\n aff_stid_before_signatures = (\n [signature_computer.call(first_st)] +\n rest_sts.map { |e| signature_computer.call(e) }.uniq\n )\n case aff_stid_before_signatures\n when [:present, :blank]\n # This is a regular split where the original subtitle comes first.\n # Insert new subtitle after original subtitle\n compute_insert_at_index_given_after_stid(\n op.affected_stids.first.persistent_id,\n updated_subtitles\n )\n else\n # This is an unexpected case.\n puts @content_at_file.filename\n p op\n p aff_stid_before_signatures\n raise \"Handle unexpected split!\"\n end\n else\n raise \"Handle this: #{ op.inspect }\"\n end\n insert_at_index\n end",
"def insert_into_transcript\n @transcript_lines << {\n transcript_id: @transcript_id,\n start_time: @line_temp[:from],\n end_time: @line_temp[:to],\n original_text: @line_temp[:lines].join(' '),\n sequence: (@line_number - 1)\n }\n @line_number += 1\n end",
"def export_gap_mark_tagging(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('gap_mark_tagging_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to gap_mark tagging\",\n options.merge(\n :output_path_lambda => lambda { |input_filename, output_file_attrs|\n input_filename.gsub(config.base_dir(input_base_dir_name), output_base_dir)\n .gsub(/\\.at\\z/, '.gap_mark_tagging.txt')\n }\n )\n ) do |contents, filename|\n outcome = Repositext::Export::GapMarkTagging.export(contents)\n if outcome.success?\n [Outcome.new(true, { contents: outcome.result, extension: 'gap_mark_tagging.txt' })]\n else\n outcome\n end\n end\n end",
"def subtitle(page_subtitle, show_subtitle = true, ignore_in_breadcrumbs = false)\n @show_subtitle = show_subtitle\n @ignore_subtitle_in_breadcrumbs = ignore_in_breadcrumbs\n @subtitle_for_content = page_subtitle.to_s\n end",
"def transfer_subtitles(p_s, f_s)\n if debug\n puts \" Transfer subtitles:\"\n puts \" * p_s: #{ p_s.inspect }\"\n puts \" * f_s: #{ f_s.inspect }\"\n end\n # Determine if we can use punctuation signature for snapping.\n # Conditions: Each primary st is preceded by punctuation and primary\n # and foreign punctuation signatures are identical.\n sts_w_preceding_punct = p_s.scan(/(?:\\S|^)\\s?@/)\n all_sts_are_preceded_by_punct = sts_w_preceding_punct.all? { |e|\n e =~ /\\A@/ || e =~ /\\A[#{ regex_punctuation_chars }]/\n }\n\n # Determine and apply snapping strategy\n if(\n all_sts_are_preceded_by_punct &&\n (\n p_punct_sig = p_s.scan(/([#{ regex_punctuation_chars }])|([^#{ regex_punctuation_chars }]+)/).map { |m1, m2|\n m1 ? m1 : 'T'\n }.join\n f_punct_sig = f_s.scan(/([#{ regex_punctuation_chars }])|([^#{ regex_punctuation_chars }]+)/).map { |m1, m2|\n m1 ? m1 : 'T'\n }.join\n punc_sig_sim = p_punct_sig.longest_subsequence_similar(f_punct_sig)\n if debug\n puts \" * punctuation signatures:\"\n puts \" * p: #{ p_punct_sig.inspect }\"\n puts \" * f: #{ f_punct_sig.inspect }\"\n puts \" * sim: #{ punc_sig_sim.inspect }\"\n end\n 1.0 == punc_sig_sim\n )\n )\n # All primary subtitles are preceded by punctuation, and primary\n # and foreign punctuation signatures are identical.\n snap_subtitles_to_punctuation_signature(p_s, f_s)\n else\n # Do a simple character based interpolation for initial\n # subtitle_mark placement.\n new_f_s_raw = interpolate_subtitle_positions(p_s, f_s)\n # Snap subtitle_marks to nearby punctuation\n snap_subtitles_to_nearby_punctuation(p_s, new_f_s_raw)\n end\n end",
"def add_srt_data(text)\n language = Language.detect(text)\n text.gsub(/\\r\\n/, \"\\n\").split(/\\n\\n/).each do |block|\n index, times, text = block.split(/\\n/, 3)\n start_time, end_time = parse_srt_times(times)\n # TODO: Is this the best way to add records to an unsaved has_many?\n self.subtitles <<\n Subtitle.new(playable_media: self, language: language,\n start_time: start_time, end_time: end_time,\n text: text.chomp)\n end\n end",
"def subtitle(subtitle)\n @subtitle = subtitle\n end",
"def merge_annotation_topics(course_ids)\n logger.log \"Merging annotation topics for course #{course_ids.join(', ')}\"\n\n course_ids.each do |course_id|\n ids = Course::Assessment::Answer::ProgrammingFileAnnotation.joins(:discussion_topic).\n where(\"course_discussion_topics.course_id = #{course_id}\").pluck(:id)\n duplicate_ids = Course::Assessment::Answer::ProgrammingFileAnnotation.where(id: ids).\n select([:line, :file_id]).group(:line, :file_id).having('count(*) > 1').to_a\n duplicate_ids.each do |attr|\n do_merge(attr.file_id, attr.line)\n end\n end\n end",
"def annotate\n redirect_to :show unless rcparams = params[:recipe][:recipeContents]\n @content = rcparams[:content]\n ps = ParserServices.new entity: @recipe, content: @content\n # This is a two-, possibly three-phase process:\n # 1) a selection from the browser directs attention to a range of text, which generates a CSS path for an element to parse\n # 2) this so-called parse_path is attempted to be parsed. If it doesn't work because of a findable tag, a dialog is presented\n # for the user to decide how to handle the tag;\n # 3) the user says to enter the problematic tag directly into the dictionary, or specifies an existing tag for what\n # was meant by the problematic tag. The latter can be optionally entered as a synonym of the intended name.\n if rcparams[:anchor_path] # Initial annotation on browser selection\n logger.debug \"Annotating with anchor_path = '#{rcparams[:anchor_path]}'\"\n @annotation, @parse_path = ps.annotate_selection *rcparams.values_at(:token, :anchor_path, :anchor_offset, :focus_path, :focus_offset)\n elsif @parse_path = rcparams[:parse_path] # Specifying an element of the DOM\n if !(@tagname = rcparams[:tagname])\n logger.debug \"Looking for tag at '#{@parse_path}'\"\n # @annotation = ParsingServices.parse_on_path *rcparams.values_at(:content, :parse_path) do |tagtype, tagname|\n @annotation = ps.parse_on_path @parse_path do |tagtype, tagname|\n @tagtype, @tagname = tagtype, tagname\n end\n @parse_path = nil unless @tagname # We'll need the parse path for identifying the tag\n else # There IS a tagname: use that as a tag\n noko_elmt = ps.extract_via_path @parse_path\n @tagtype = rcparams[:tagtype]\n @annotation = rcparams[:content]\n # @tagname of type @tagtype is a mystery tag previously identified by a failed parse.\n logger.debug \"Use tag '#{@tagname}' of type '#{@tagtype}' at path '#{@parse_path}'\"\n # The logic here is as follows, for sorting out words.\n # -- '@tagname' is the questionable tag\n # -- 'rcparams[:replacement]' is the id of a tag selected by the user to serve in its place\n # -- 'rcparams[:assert]' is set if that tag will be added to the dictionary\n # If there's no replacement tag, the term is just accepted into the dictionary as a new instance of the tagtype.\n # If there IS a non-nil replacement, that's what we understand the term to mean. If, then, assert is set,\n # the questionable term will get added to the dictionary as a synonym for the replacement. If not, the alias\n # is accepted and added to the Seeker as such.\n # No tagname has been parsed out; proceed to parse the entity denoted by the parse path\n if (replacement = rcparams[:replacement]).present?\n old_tag = Tag.find_by id: replacement\n if rcparams[:assert]\n new_tag = Tag.assert @tagname, @tagtype\n new_tag.absorb old_tag, false\n end\n value = old_tag.name\n else\n # No replacement provided => simply assert the tag into the dictionary\n value = @tagname\n Tag.assert @tagname, @tagtype\n end\n @tagname = nil # Go back to the annotation dialog\n @parse_path = nil\n if noko_elmt\n noko_elmt[:value] = value\n @annotation = noko_elmt.ancestors.last.to_s\n end\n end\n end\n end",
"def pubannos(data)\n \n result = JSON.parse(data)\n \n if result.has_key? 'Error'\n raise BioInterchange::Exceptions::InputFormatError, 'Error parsing the JSON input file: #{result[\"Error\"]}'\n end\n \n \n text = result['text']\n #doc_uri = \"http://pubannotation.dbcls.jp/pmdocs/\" + result['pmid'].to_s\n doc_uri = result['docurl']\n \n doc = Document.new(doc_uri)\n docContent = Content.new(0, text.length, Content::DOCUMENT, @process)\n docContent.setContext(doc)\n doc.add(docContent)\n \n #so our document requires content of type document or abstract\n #should it hold the content string?\n\n #hash to remember annotation in case they are needed for building upon based on ids later\n contents = {}\n\n if result['catanns']\n result['catanns'].each do |annot| \n start_offset = 0\n end_offset = 0\n if annot['span']\n start_offset = annot['span']['begin']\n end_offset = annot['span']['end']\n elsif annot['begin'] and annot['end']\n start_offset = annot['begin']\n end_offset = annot['end']\n end\n length = end_offset - start_offset\n\n category = annot['category']\n id = annot['id']\n \n entity = text.slice(start_offset..end_offset)\n \n #phrase = type for NE\n con = Content.new(start_offset, length, Content::PHRASE, @process)\n con.setContext(doc)\n doc.add(con)\n\n contents[id] = con \n \n #set process.date = updated_time?\n end\n end\n \n if result['insanns']\n result['insanns'].each do |annot|\n \n #unsure what to do about this (con1), 'E1' is the ID of something not created yet.\n #it is perhaps a case of making a new content, but with what params...?\n #need to conform what this is refering to with JDK\n con1 = nil \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'subClassOf'\n type = ContentConnection::SUBCLASS\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['relanns']\n result['relanns'].each do |annot|\n con1 = contents[annot['subject']] \n con2 = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'equivalentTo'\n type = ContentConnection::EQUIVALENCE\n when 'themeOf'\n type = ContentConnection::THEME\n end\n connection = ContentConnection.new(con1, con2, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n if result['modanns']\n result['modanns'].each do |annot|\n \n #in this case, it is a modification of an already existing content object (speculation/negation). \n con = contents[annot['object']]\n \n #get annotation type\n type = ContentConnection::UNSPECIFIED\n case annot['type']\n when 'Speculation'\n type = ContentConnection::SPECULATION\n when 'Negation'\n type = ContentConnection::NEGATION\n end\n connection = ContentConnection.new(con, nil, type, @process)\n connection.setContext(doc)\n doc.add(connection)\n\n contents[annot['id']] = connection\n\n end\n end\n \n doc\n end",
"def retrieve_subtitle\n\t\t\tFile.unlink(\"/tmp/Sub.srt\") if File.exists?(\"/tmp/Sub.srt\")\n\t\t\tget_from_source\n\t\t\treturn true if valid_subtitle?\n\t\t\tFile.unlink(\"/tmp/Sub.srt\") if File.exists?(\"/tmp/Sub.srt\")\n\t\t\treturn false\n\t\tend",
"def set_subtitle!\n if patterns = @name.match(/\\A([^\\b:]+): (.+)\\Z/)\n @name = patterns[1]\n @subtitle = patterns[2]\n end\n end",
"def report_count_files_with_gap_marks_and_subtitle_marks(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n total_count = 0\n with_gap_marks = 0\n with_subtitle_marks = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n with_gap_marks += 1 if contents.index('%')\n with_subtitle_marks += 1 if contents.index('@')\n # Uncomment next line to print line 7 of each file\n # puts contents.split(\"\\n\")[6][0,80] + ' ' + filename.split('/').last\n end\n\n lines = [\n \"Count of files with gap_marks and subtitle_marks\",\n '-' * 40,\n ]\n lines << \" - With gap_marks: #{ with_gap_marks }\"\n lines << \" - With subtitle_marks: #{ with_subtitle_marks }\"\n lines << '-' * 40\n lines << \"Checked #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'count_files_with_gap_marks_and_subtitle_marks.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report count_files_with_gap_marks_and_subtitle_marks`\\n\"\n }\n end",
"def init_tags\n add_tag :BOLD, '+b', '-b'\n add_tag :EM, '+_', '-_'\n add_tag :TT, '' , '' # we need in_tt information maintained\n end",
"def clean2\n content = text.split(\"\\n\")\n \n # First, find and mark songs\n in_song = false\n new_content = []\n content.each do |line|\n if line=~/\\*{5}/ .. line=~END_OF_SONG\n new_content << \"SONG:\" unless in_song\n if line =~ END_OF_SONG\n new_content << line\n in_song = false\n else\n new_content << \" #{line}\"\n in_song = true\n end\n else\n if in_song\n new_content << \"END OF SONG\"\n end\n in_song = false\n new_content << line\n end\n end\n \n # Now, fix line endings and merge lines\n old_content = new_content\n new_content = []\n preserve_breaks = false\n last_line = \"\"\n old_content.each do |line|\n new_content << \"\" if preserve_breaks ||\n last_line =~ END_OF_SONG || \n new_content.size == 0 ||\n line =~ /^.[LS]-\\d+(?:\\]|$|.\\s*\\()/ ||\n line =~ /^\\([A-Z]/ ||\n line =~ /^[A-Z][A-Z, \\.-]+:\\s/ ||\n line =~ /^Scene\\s+\\?\\s+-\\s+\\?/ ||\n line =~ START_OF_SONG ||\n line =~ /^#/\n case line\n when START_OF_SONG\n preserve_breaks = true\n when END_OF_SONG\n preserve_breaks = false\n end\n new_content[-1] += ' ' unless new_content[-1] =~ /^$|\\s$/\n new_content[-1] += line\n last_line = line\n end\n \n # Now, insert extra empty lines\n old_content = new_content\n new_content = []\n extra_space = true\n in_cast = false\n in_song = false\n \n old_content.each do |line|\n if line =~ /^#/\n extra_space = false if in_cast\n else\n in_cast = false\n extra_space = true unless in_song\n end\n new_content << \"\" if extra_space && new_content.size > 0\n new_content << line\n case line\n when /^#CAST FOR SCENE/\n in_cast = true\n when START_OF_SONG\n extra_space = false\n in_song = true\n when END_OF_SONG\n extra_space = true\n in_song = false\n end\n end\n \n # Finally, fix songs\n old_content = new_content\n new_content = []\n i = 0\n while i<old_content.size\n line = old_content[i]\n case line\n when START_OF_SONG\n # Find lines with stars in them\n j = i+1\n while j<old_content.size && old_content[j] !~ END_OF_SONG\n j += 1\n end\n # At this point lines i...j are the song; back up and look for the last \"*****\"\n while j>i && old_content[j] !~ /\\*{5}/\n j -= 1\n end\n # Now lines (i+1)...j are the song information block\n song_information = old_content[(i+1)...j].join\n song_name = song_information[/^[\\s\\*]*([^\\*]+)/,1].strip\n tune = song_information[/([^\\*]+)[\\s\\*]*$/,1].strip\n new_content += [\" SONG: #{song_name}\", \" (To the tune of: #{tune})\"]\n i = j+1\n when END_OF_SONG\n i += 1 # Discard end of song markers; we don't need them anymore\n else\n new_content << line\n i += 1\n end\n end\n \n # Save the results\n text = new_content.join(\"\\n\")\n end",
"def text_annotation(rect, contents, options = {})\n options = options.merge(Subtype: :Text, Rect: rect, Contents: contents)\n annotate(options)\n end",
"def update!(**args)\n @video_transcript_annotations = args[:video_transcript_annotations] if args.key?(:video_transcript_annotations)\n end",
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def before_commit(content)\n DCLPTextIdentifier.preprocess(content)\n end",
"def restore_tags\n marc.by_tags(\"599\").each do |t|\n new_content = t.fetch_first_by_tag(\"a\").content\n if new_content =~ /=[0-9]{3}\\s{2}/\n tag, content = new_content.split(\" \")\n marc.parse_marc21(tag[1..4], content)\n t.destroy_yourself\n end\n end\n self.save\n end",
"def subtitle_values\n []\n end",
"def texts=(texts); end",
"def texts=(texts); end",
"def setSubTitleHighlight(highlight)\n @subtitle_attr = highlight\n end",
"def create_subtitles\n self.outline[:subtitles].each do |subtitle, points_array|\n new_subtitle = self.subtitles.build(name: subtitle)\n points_array.each do |point_hash|\n point_hash.each do |point, note|\n new_point = new_subtitle.points.build(name: point)\n new_note = new_point.note.build(details: note)\n end\n end\n end\n end",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n save\n end\n true\n end",
"def sub_load _subtitle_file\n send_cmd(\"sub_load #{_subtitle_file}\")\n end",
"def annotate_samples\n # hash to connect metadata\n exp_hash = create_metadata_hash(@exp_metadata, 0) # { expid => [metadata] }\n bs_hash = create_metadata_hash(@bs_metadata, 0) # { biosampleid => [metadata] }\n srs_hash = create_metadata_hash(@bs_metadata, 1) # { sampleid => [metadata] }\n date_hash = received_date_by_experiment # { expid => date_received }\n\n annotated = Parallel.map(open(@samples_fpath).readlines.drop(1), :in_threads => @@nop) do |line|\n data = line.chomp.split(\"\\t\")\n sample_md = bs_hash[data[0]] || srs_hash[data[0]]\n sample_info = if sample_md\n coverage = if sample_md[3] != \"NA\"\n data[7].to_f / sample_md[3].to_f * 1_000_000\n else\n \"NA\"\n end\n [\n sample_md,\n coverage,\n ]\n else\n \"NA\\tNA\\tNA\\tNA\" # secondary sample id, taxon id, taxonomic name, coverage\n end\n [\n data,\n sample_info,\n exp_hash[data[1]],\n date_hash[data[1]],\n ].flatten.join(\"\\t\")\n end\n open(output_fpath(\"quanto.annotated.tsv\"), 'w'){|f| f.puts([annotated_header.join(\"\\t\"), annotated]) }\n end",
"def parse_span_extensions; end",
"def add_existing_annotation\n @text = AnnotationText.find(params[:annotation_text_id])\n @submission_file_id = params[:submission_file_id]\n @submission_file = SubmissionFile.find(@submission_file_id)\n @annotation = Annotation.new\n @annotation.update_attributes({\n line_start: params[:line_start],\n line_end: params[:line_end],\n submission_file_id: params[:submission_file_id]\n })\n @annotation.annotation_text = @text\n @annotation.save\n @submission = @submission_file.submission\n @annotations = @submission.annotations\n end",
"def import_markup_text( file_content )\n count = 0\n if file_content.scan(PTN_LINE)[0] =~ /tattertools/\n file_content = convert_tatter_xml( file_content )\n return file_content\n end\n count += create_pages( :content => file_content )\n count\n end",
"def insert_subject(topic=[], geographic=[], temporal=[])\n\t\tindex = self.mods(0).subject.count\n\t\tx = topic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif topic[x].strip == ''\n\t\t\t\ttopic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = geographic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif geographic[x].strip == ''\n\t\t\t\tgeographic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = temporal.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif temporal[x].strip == ''\n\t\t\t\ttemporal.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tself.mods(0).subject(index).topic = topic unless topic.blank?\n\t\tself.mods(0).subject(index).geographic = geographic unless geographic.blank?\n\t\tself.mods(0).subject(index).temporal = temporal unless temporal.blank?\n\tend",
"def delete_from_body(start_mark, end_mark, delete_marks=false)\n if delete_marks\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"\")\n else\n @issue_body = issue_body.gsub(/#{start_mark}.*#{end_mark}/im, \"#{start_mark}#{end_mark}\")\n end\n update_issue({ body: @issue_body })\n end",
"def update!(**args)\n @transcript_segments = args[:transcript_segments] if args.key?(:transcript_segments)\n end",
"def update!(**args)\n @transcript_segments = args[:transcript_segments] if args.key?(:transcript_segments)\n end",
"def subtitle_values\n get_values(*subtitle_fields)\n end",
"def subtitle=(new_subtitle)\n @subtitle = new_subtitle\n end",
"def import_text_content\n self.text_content = self.to_text\n self.save\n\n # Reindex to elasticsearch\n self.reindex\n end",
"def subtitle\n {}\n end",
"def merge_texts!(hash, element)\n unless element.has_text?\n hash\n else\n # must use value to prevent double-escaping\n texts = +\"\"\n element.texts.each { |t| texts << t.value }\n merge!(hash, CONTENT_KEY, texts)\n end\n end",
"def extractTags()\n line = @lines[@currentLine]\n re = /\\[([^\\[]+)\\]/m\n while line =~ re\n @currentBlock.addTag($~[1])\n line = line.sub(re, '')\n end\n end",
"def do_inproceedings\n @lines.each {|l| l.sub!(/journal =/, \"booktitle =\") }\n end",
"def report_files_with_subtitles(options)\n total_csv_file_count = 0\n files_with_subtitles = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :csv_extension\n ),\n options['file_filter'] || /\\.subtitle_markers\\.csv\\z/,\n nil,\n \"Reading subtitle marker CSV files\",\n options\n ) do |csv_file|\n total_csv_file_count += 1\n uniq_first_col_vals = csv_file.contents.scan(/^\\d+/).uniq\n if ['0'] != uniq_first_col_vals\n # File has non-zero timestamps\n file_base_name = csv_file.basename\n files_with_subtitles << file_base_name.gsub(/\\.subtitle_markers\\.csv\\z/, '.at')\n $stderr.puts \" - #{ file_base_name }\"\n end\n end\n\n summary_line = \"Found #{ files_with_subtitles.length } of #{ total_csv_file_count } CSV files with subtitles at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir(:reports_dir), 'files_with_subtitles.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Files with subtitles\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write files_with_subtitles.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report files_with_subtitles`\\n\"\n }\n end",
"def inline_mark(text)\n # process simple inlines\n for inline in INLINES_MARK\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\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}#{index}[#{body}]#{after}\"\n end\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}[#{link}](#{url})#{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 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 subtitle_fields\n []\n end",
"def parse_tag(tag, subtags, feed)\n extracted_subtags = {}\n feed = ExtractData.extract_tag_text(feed, tag)\n\n subtags.each do |sub|\n # Should be exctract_subtag_text here, after the correction\n sub_text = ExtractData.extract_tag_text(feed, sub)\n extracted_subtags[sub] = TransformData.tag_to_plaintext(sub_text) unless sub_text.empty?\n end\n\n transform_dates_in extracted_subtags\n end",
"def add_subtitles(movie)\n video_file_res = movie.project.final + \"/video.avi\"\n video_file = movie.project.final + \"/videotrack.avi\"\n cmd = @settings['subtitles'].dup\n cmd.sub!('<source>', video_file)\n cmd.sub!('<target>', video_file_res)\n cmd.sub!('<subtitles>', movie.subtitles)\n puts \"Adding subtitles\"\n puts cmd\n system(cmd)\n return video_file_res\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 update_record_ids!(subtitles_container)\n # We iterate over all operations, find the affected_stids' corresponding\n # subtitle and update the record id.\n operations.each do |op|\n op.affected_stids.each { |aff_st|\n # Find matching st in subtitles_container\n matching_st = subtitles_container.detect { |st| st[:persistent_id] == aff_st.persistent_id }\n if matching_st\n # Update record id\n matching_st[:record_id] = aff_st.record_id\n else\n raise \"Could not find matching_st with persistent_id #{ aff_st.persistent_id }\"\n end\n }\n end\n end",
"def text_annotation(rect, contents, options={})\n options = options.merge(:Subtype => :Text, :Rect => rect, :Contents => contents)\n write_note(options)\n end",
"def report_count_files_with_gap_marks_and_subtitle_marks(options)\n total_count = 0\n with_gap_marks = 0\n with_subtitle_marks = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n total_count += 1\n with_gap_marks += 1 if content_at_file.contents.index('%')\n with_subtitle_marks += 1 if content_at_file.contents.index('@')\n # Uncomment next line to print line 7 of each file\n # puts contents.split(\"\\n\")[6][0,80] + ' ' + filename.split('/').last\n end\n\n lines = [\n \"Count of files with gap_marks and subtitle_marks\",\n '-' * 40,\n ]\n lines << \" - With gap_marks: #{ with_gap_marks }\"\n lines << \" - With subtitle_marks: #{ with_subtitle_marks }\"\n lines << '-' * 40\n lines << \"Checked #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir(:reports_dir), 'count_files_with_gap_marks_and_subtitle_marks.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report count_files_with_gap_marks_and_subtitle_marks`\\n\"\n }\n end",
"def subtitle\n if @subtitle.nil?\n subtitle_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:subtitle\",\n \"subtitle\",\n \"atom03:tagline\",\n \"tagline\",\n \"description\",\n \"summary\",\n \"abstract\",\n \"ABSTRACT\",\n \"content:encoded\",\n \"encoded\",\n \"content\",\n \"xhtml:body\",\n \"body\",\n \"xhtml:div\",\n \"div\",\n \"p:payload\",\n \"payload\",\n \"channelDescription\",\n \"blurb\",\n \"info\"\n ])\n @subtitle = FeedTools::HtmlHelper.process_text_construct(\n subtitle_node, self.feed_type, self.feed_version, [self.base_uri])\n if self.feed_type == \"atom\" ||\n self.configurations[:always_strip_wrapper_elements]\n @subtitle = FeedTools::HtmlHelper.strip_wrapper_element(@subtitle)\n end\n if @subtitle.blank?\n @subtitle = self.itunes_summary\n end\n if @subtitle.blank?\n @subtitle = self.itunes_subtitle\n end\n end\n return @subtitle\n end",
"def set_subtitle\n @subtitle = Subtitle.find(params[:id])\n end",
"def typos_in_file(destination_file)\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tlines = subtitles_object_list.map{ |subtitle| subtitle.get_lines }\n\n\t\twords = get_words(lines.flatten)\n\n\t\ttypos = word_not_in_dictionary(words)\n\n\t\ttypos_list = look_for_typos_in_file(typos, subtitles_object_list)\n\n\t\ttypos_file_content = {}\n\t\ttypos_list.each do |typos_object|\n\t\t\ttypos_file_content.merge!(typos_object) {|k,l,r| [l,r].flatten.join(\", \") }\n\t\tend\n\n\t\t#functionality to ignore words, per example names\n\t\tignored_words = IO.read(\"ignored_words.txt\").split(\"\\n\")\n\n\t\tcontent = \"\"\n\t\ttypos_file_content.each do |word|\n\t\t\tunless ignored_words.include? word[0]\n\t\t\t\tcontent << word[0] + \": \" + word[1] + \"\\n\"\n\t\t\tend\n\t\tend\n\t\tIO.write(destination_file, content)\n\tend",
"def assign_tags\n if self.text\n self.tag_s = self.text.scan(/\\s+\\#\\S+/).join(' ')\n end\n true\n end",
"def replace_taggings_from_atom(atom)\n Tagging.transaction do\n self.delete_classifier_taggings!\n taggings_from_atom(atom) \n end\n end",
"def author_tag(text); end",
"def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"def run\n # @file_to_validate is an array with the content_at and\n # subtitle/subtitle_tagging_import files\n content_at_file, subtitle_import_file = @file_to_validate\n errors, warnings = [], []\n\n catch(:abandon) do\n outcome = contents_match?(\n content_at_file.read,\n subtitle_import_file.read\n )\n\n if outcome.fail?\n errors += outcome.errors\n warnings += outcome.warnings\n #throw :abandon\n end\n end\n\n log_and_report_validation_step(errors, warnings)\n end",
"def extract_annotations_from(file, pattern); end",
"def transfer_subtitles_to_foreign_sentence(p_s, f_s)\n subtitle_count = p_s.count('@')\n if 0 == subtitle_count\n # Return as is\n puts \" * No subtitle found\" if debug\n Outcome.new(true, [f_s, 1.0])\n elsif((1 == subtitle_count) && (p_s =~ /\\A@/))\n # Prepend one subtitle\n puts \" * Single subtitle, prepend to foreign sentence\" if debug\n Outcome.new(true, ['@' << f_s, 1.0])\n else\n transfer_subtitles(p_s, f_s)\n end\n end",
"def preprocess_avc(contents)\n new_contents = contents # no manipulation done here\n new_contents\n end",
"def subtitle(value = nil, options = nil)\n end",
"def transfer_st_ops_to_foreign_file!(foreign_content_at_file, st_ops_for_file)\n from_gc = st_ops_for_file.from_git_commit\n to_gc = st_ops_for_file.to_git_commit\n\n # Get from_subtitles as of from_gc\n from_subtitles = cached_primary_subtitle_data(\n foreign_content_at_file,\n from_gc,\n :at_child_or_ref\n )\n # Get to_subtitles as of the next git commit after to_gc. We have\n # to do this since STM CSV files are updated during st sync,\n # however the changes aren't committed until the next commit\n # after the sync_commit.\n to_subtitles = cached_primary_subtitle_data(\n foreign_content_at_file,\n to_gc,\n :at_child_or_current\n )\n\n # Get new content AT file contents\n fcatf_contents = st_ops_for_file.apply_to_foreign_content_at_file(\n foreign_content_at_file,\n from_subtitles,\n to_subtitles\n )\n\n # Update content AT file with new contents\n foreign_content_at_file.update_contents!(fcatf_contents)\n\n # Update file level st_sync data\n update_foreign_file_level_data(\n foreign_content_at_file,\n st_ops_for_file.to_git_commit,\n st_ops_for_file.subtitles_that_require_review,\n )\n true\n end",
"def parse_tag_with_types_and_title(tag_name, text); end",
"def parse_init\n @tg_end = [] #momorize tag end from regex function\n @doc_src = []\n @doc_out = []\n @tg_hot = {} \n merge_tags @mrg ? @mrg : @ext\n next_tag_init\n end",
"def todo_tag(text); end",
"def get_podcast_references(content, target_page_url)\n # The logic here assumes that:\n # - paragraphs have headers\n # - each block of text (paragraph) is seperated by an empty line \n \n # Split the content into paragraphs\n paragraphs = content.split(/\\n\\n+/)\n # Find all the headers in the content\n headers = content.scan(/^#+\\s+(.*)$/).flatten\n\n # Create an array of hashes containing:\n # - the paragraph's title\n # - the paragraph's title slug\n # - the associated header\n # - the timestamp of the podcast in which this paragraph is discussed\n podcast_references = []\n current_header = 0\n current_title = {}\n in_review_club_section = false\n\n # Iterate over all paragraphs to find those with a podcast reference mark\n paragraphs.each do |p|\n # a title might have multiple paragraphs associated with it\n # the podcast reference mark might be at the end of an isolated\n # paragraph snippet that cannot access the title, therefore\n # we keep this information to be used in the link to the podcast recap\n title = find_title(p, !in_review_club_section)\n if !title.empty?\n # paragraph has title\n current_title = title\n end\n\n # If the current paragraph contains the podcast reference mark,\n # capture the timestamp, add paragraph to references and replace \n # the mark with link to the related podcast item\n p.gsub!($podcast_reference_mark) do |match|\n if in_review_club_section\n # the newsletter's review club section is the only section that does\n # not have a list item to use as anchor so we use the header\n current_title[\"podcast_slug\"] = \"#pr-review-club\" # to avoid duplicate anchor\n current_title[\"slug\"] = \"#bitcoin-core-pr-review-club\"\n end\n podcast_reference = {\"header\"=> headers[current_header], \"timestamp\"=> $1}\n podcast_reference.merge!(current_title)\n podcast_references << podcast_reference\n\n if current_title.empty?\n # this is needed for the podcast reference mark to link to the header\n # of the special section\n current_title[\"slug\"] = generate_slug(headers[current_header])\n end\n # Replace the whole match with the link\n headphones_link = \"[<i class='fa fa-headphones' title='Listen to our discussion of this on the podcast'></i>]\"\n replacement_link_to_podcast_item = \"#{headphones_link}(#{target_page_url}#{current_title[\"podcast_slug\"] || current_title[\"slug\"]})\"\n end\n\n # update to the next header when parse through it\n if p.sub(/^#+\\s*/, \"\") == headers[(current_header + 1) % headers.length()]\n current_header += 1\n in_review_club_section = headers[current_header] == \"Bitcoin Core PR Review Club\"\n # reset header-specific variables\n current_title = {}\n end\n\n end\n\n # Join the paragraphs back together to return the modified content\n updated_content = paragraphs.join(\"\\n\\n\")\n\n [updated_content, podcast_references]\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @text_segments = args[:text_segments] if args.key?(:text_segments)\n end",
"def load_notetags\n super\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<itype_id:\\s*(\\d+)\\s*>/i\n @itype_id = $1.to_i\n when /<synthesis_level:\\s*(\\d*)\\s*>/i\n @synthesis_level = $1.to_i\n when /<synthesis_material:\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*>/i\n @synthesis_materials.push(RPG::Material.new($1.to_i, $2.to_i, $3.to_i))\n end\n }\n end",
"def process_sentance(blob)\n # strip out enclosures\n blob = blob.gsub(/\\\\/,'')\n # test for quotes\n # if quotes, these words are important (flag them)\n test = blob.match(/[\"'](.*)['\"]/)\n if test && test.size > 1\n @words = test[1..test.size].join(\" \")\n #test.each{|word|\n # @words << word\n #}\n #blob = blob.gsub(@words,'')\n blob = blob.gsub(/([\"'])/,'')\n end\n unless @words.nil?\n # break up and add to @local_important\n tmp = @words.split(\" \")\n tmp.each{|word|\n @local_important << word.downcase unless @local_important.include? word\n }\n end\n #puts blob\n the_pieces = blob.split(\" \")\n parse_words(the_pieces)\n \n # try to sort words\n words = grab_important_words\n puts words.inspect\n \n puts \"Derived Tags: #{words.join(' ')}\"\n \n end",
"def merge(to)\n if self == to \n raise ArgumentError, I18n.t(\"winnow.errors.tag.merge_name_error\")\n end\n \n self.manual_taggings.each do |tagging|\n unless to.manual_taggings.exists?(['feed_item_id = ?', tagging.feed_item_id])\n to.user.taggings.create!(:tag => to, :feed_item_id => tagging.feed_item_id, :strength => tagging.strength)\n end\n end\n # Used to be we would destroy the \"from\" tag (self). This is no longer done\n # because the from tag may have subscribers and would need to be archived.\n\n # TODO: Make merge its own separate command (like copy) rather than a side\n # effect of rename. (If it's going to be a side effect it would make more\n # sense as copy than as the present rename, anyhow, because currently you\n # cannot have the \"from\" tag of your merge be a subscribed tag, because you can't\n # \"rename\" someone else's tag.)\n end",
"def process_article(art)\n this_pub = {}\n \n # if not table of figure or equation remove reference\n # a.zip(b) zipped lists\n both = art.xpath('//xref/@ref-type').zip(art.xpath('//xref'))\n both.each do |tag,elem| \n if tag.text != 'table' || tag.text != 'fig' || tag.text != 'fn' || tag.text != 'sec' || tag.text != 'disp-formula'\n elem.remove\n end\n end\n\n jrn_meta = art / \"article/front/journal-meta\"\n this_pub[:jrn_id] = (jrn_meta / \"journal-id[journal-id-type='nlm-ta']\").text\n art_meta = art / \"/article/front/article-meta\"\n\n this_pub[:pmid] = (art_meta / \"article-id[pub-id-type='pmid']\").text\n\n this_pub[:pmcid] = (art_meta / \"article-id[pub-id-type='pmc']\").text\n# this_pub[:doi] = (art_meta / \"article-id[pub-id-type='doi']\").text\n\n # title\n title_node = (art_meta / \"title-group/article-title\")\n \n # SDB Note 8/2016\n # Turns out that some of the article titles include footnotes or super/subscripts which occurred at the end of a title, \n # which are represented by embedded tags (e.g. <fn> or something like that),and calling .text on the title node was \n # including those (and messing stuff up in the process).\n # We thought that we only needed to worry about tags at the end of titles, and so for trec CDS 2016 we just used the first child node and called it good.\n # This turned out to be insufficient- in the latest PMC release, there are titles with italic text (cf. PMC1079931),\n # and the approach below fails in these cases. \n # TODO: a more robust title-parsing algorithm\n \n if title_node.children.size > 1\n this_pub[:title] = title_node.children.first.text.strip\n else\n this_pub[:title] = title_node.text.strip\n end\n\n # pub_year\n # if ppub, use that; else use collection\n ppub = (art_meta / \"pub-date[pub-type='ppub']/year\").text\n epub = (art_meta / \"pub-date[pub-type='epub']/year\").text\n year = nil\n if ppub.strip.length > 0\n year = ppub.strip\n else\n year = epub.strip\n end\n this_pub[:year] = year \n\n # abstract (if present)\n abst_node = art_meta / \"abstract\"\n \n this_pub[:abstract] = {}\n if abst_node.length == 0\n this_pub[:abstract][:full] = \"\"\n elsif (abst_node / \"sec\").size > 0 # structured abstract (inc. section headings)\n abstract_full = \"\" \n # go through each section, and get the parts out in some kind of order\n (abst_node / \"sec\").each do |s|\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end \n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n # clean leftovers of xref\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n abstract_full << ti << \"\\n\"\n abstract_full << body << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full.strip\n end\n if (abst_node / \"p\").size > 0 # unstructured abstract\n abstract_full = this_pub[:abstract][:full].to_s\n (abst_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n abs = s.text.strip\n abs = abs.gsub(/\\[-*\\]/, \"\")\n abs = abs.gsub(/\\(,*\\)/, \"\")\n abs = abs.gsub(/\\(-*\\)/, \"\")\n abs = abs.gsub(/\\[,*\\]/, \"\")\n abstract_full << abs << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full\n else\n STDERR.puts \"Other format found: \" + (art_meta / \"article-id[pub-id-type='pmc']\").text\n this_pub[:abstract][:full] = \"\"\n end\n \n # now do body- similar deal\n this_pub[:body] = {}\n body_node = art / \"/article/body\"\n \n if (body_node / \"sec\").size > 0\n body_full = \"\"\n (body_node / \"sec\").each do |s|\n # rm xref\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end\n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/inline-formula').each do |node|\n node.remove\n end\n\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n fig_cap = (s / \"fig/caption/p\").text.strip\n tbl_cap = (s / \"table-wrap/table-wrap-foot/p\").text.strip\n tbl_fn = (s / \"table-wrap/table-wrap-foot/fn\").text.strip\n\n # clean leftovers of xref\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\[-*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\(,*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\(-*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\[,*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[-*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(,*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(-*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[,*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[-*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(,*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(-*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[,*\\]/, \"\")\n body_full << ti << \"\\n\"\n body_full << body << \"\\n\"\n body_full << fig_cap << \"\\n\"\n body_full << tbl_cap << \"\\n\"\n body_full << tbl_fn << \"\\n\"\n end\n this_pub[:body][:full] = body_full.strip\n end\n\n if (body_node / \"p\").size > 0 # found the sec and p can coexist 2660466.nxml\n body_full = this_pub[:body][:full].to_s\n (body_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n body = s.text.strip\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body_full << body << \"\\n\"\n end\n this_pub[:body][:full] = body_full \n else\n STDERR.puts \"Serious weirdness in body: \"+ (art_meta / \"article-id[pub-id-type='pmc']\").text\n end\n \n \n return this_pub\nend",
"def not_test_add_marks_to_a_file\r\n TextFormatter.add_para_marks_to_a_file(DIR_OF_NEW+File::SEPARATOR+\r\n \tFILE_7) \r\n end",
"def add_tags_to_verses(document, text)\n html = text.to_str\n html.gsub!(/data-srcid\\s?=\\s?['\"](.*?)['\"]/) do |match|\n tagid = DmKnowledge::Document.tagcontext_from_srcid($1)\n tag_list = document.tag_list_on(tagid)\n unless tag_list.empty?\n \"#{match} data-tags='#{tag_list.to_json}' data-tagid='#{tagid}'\"\n else\n match\n end\n end\n html.html_safe\n end",
"def taglines\n movie_taglines.css(\"#taglines_content > .soda\").map { |node| node.text.clean_tagline }\n end",
"def split_to_token_contents(content)\n raise NotImplementedError(\"split_to_token_contents must be implemented for validation and parsing\")\n end",
"def insert_motivatedByTagging\n insert_motivatedBy OA.tagging\n end",
"def set_increments\n if @tti.length == 0\n @sgn = 0 # subtitle group number\n @sn = 0 # subtitle number\n else\n @sgn = @tti.last.sgn\n @sn = @tti.last.sn\n increment_subtitle\n end\n end",
"def segment_text(review)\n # ******* Pre-processing the review/submission text **********\n # replace commas in large numbers, makes parsing sentences with commas confusing!\n # replace quotation marks\n review = remove_urls(review)\n review.delete!(\"\\\"()\")\n\n # break the text into multiple sentences\n segmented_review = review.split(/[.?!,;]/).map(&:strip)\n segmented_review\n end",
"def initialize(text, also_tagged_with=[], start_with=nil)\n chars = text.chars.to_a # Convert text into char\n\n if also_tagged_with.nil? || also_tagged_with.empty?\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).all_tags\n }\n else\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).with_all_tags(also_tagged_with).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).with_all_tags(also_tagged_with).all_tags\n }\n\n # Finally, filter any tags returned that are already in also_tagged_with\n tag_set.delete_if {|tag| also_tagged_with.include?(tag)}\n end\n\n # # Filter by start_with, if required\n if !start_with.nil? && !start_with.empty?\n tag_set.keep_if {|tag| tag.start_with?(start_with) }\n end\n\n @tags = tag_set\n end",
"def load_notetags\n super\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<default title:\\s*(\\d*)\\s*>/i\n @default_title_id = $1.to_i\n when /<titles:[ ](\\d+(?:\\s*,\\s*\\d+)*)>/i\n $1.scan(/\\d+/).each { |num| \n @titles.push(num.to_i) if num.to_i > 0 \n }\n when /<icon_index:\\s*(\\d*)\\s*>/i\n @icon_index = $1.to_i\n when /<max_level:\\s*(\\d*)\\s*>/i\n @max_level = $1.to_i\n end\n }\n end"
] | [
"0.8073107",
"0.6250079",
"0.60288954",
"0.5826444",
"0.5427378",
"0.5423028",
"0.53833884",
"0.5312697",
"0.5263177",
"0.52549976",
"0.5229811",
"0.51592773",
"0.51465636",
"0.5127518",
"0.5099899",
"0.4941452",
"0.48906457",
"0.47415972",
"0.47116363",
"0.46969014",
"0.46779314",
"0.46676964",
"0.4654692",
"0.4613935",
"0.46011922",
"0.45572925",
"0.45251638",
"0.4501344",
"0.4495929",
"0.44883883",
"0.44850576",
"0.44845578",
"0.4442379",
"0.44362354",
"0.44313294",
"0.44275868",
"0.44048885",
"0.43900657",
"0.4385847",
"0.4385847",
"0.4372126",
"0.436253",
"0.4356179",
"0.43509308",
"0.43280694",
"0.43150744",
"0.42911565",
"0.42855066",
"0.4284927",
"0.4281545",
"0.4275161",
"0.4275161",
"0.42611742",
"0.42538851",
"0.42442116",
"0.42399874",
"0.42383713",
"0.4235903",
"0.4229957",
"0.4225795",
"0.4225437",
"0.42153385",
"0.42072046",
"0.42040327",
"0.42016685",
"0.41949493",
"0.41880614",
"0.4181881",
"0.41729584",
"0.41682363",
"0.41644192",
"0.41623586",
"0.41589028",
"0.41573915",
"0.41556293",
"0.4154299",
"0.41363937",
"0.4133793",
"0.4132238",
"0.41318658",
"0.4118491",
"0.41096044",
"0.40977877",
"0.4079461",
"0.40766883",
"0.40750715",
"0.4060534",
"0.40580428",
"0.40518424",
"0.40511188",
"0.4048389",
"0.40437225",
"0.4042609",
"0.40355185",
"0.40252838",
"0.40252748",
"0.40238726",
"0.4017735",
"0.40100452",
"0.4009015"
] | 0.83738387 | 0 |
Merges titles from folio roundtrip compare txt files into content AT to get correct spelling. | def merge_titles_from_folio_roundtrip_compare_into_folio_import(options)
folio_roundtrip_compare_base_dir = File.join(
config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :compare_dir
),
'folio_source/with_folio_import'
)
folio_import_base_dir = config.compute_base_dir(options['base-dir-2'] || :folio_import_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Merging titles from folio roundtrip compare into content_at'
start_time = Time.now
total_count = 0
success_count = 0
errors_count = 0
Dir.glob(
[
folio_roundtrip_compare_base_dir,
config.compute_file_selector(options['file-selector'] || :all_files),
config.compute_file_extension(options['file-extension'] || :txt_extension)
].join
).each do |folio_roundtrip_compare_file_name|
total_count += 1
# prepare paths
content_at_file_name = folio_roundtrip_compare_file_name.gsub(
folio_roundtrip_compare_base_dir, # update path
folio_import_base_dir
).gsub(
/\/+/, '/' # normalize runs of slashes resulting from different directory depths
).gsub(
/\.txt\z/, '.folio.at' # replace file extension
)
output_file_name = content_at_file_name
begin
outcome = Repositext::Process::Merge::TitlesFromFolioRoundtripCompareIntoContentAt.merge(
File.read(folio_roundtrip_compare_file_name),
File.read(content_at_file_name),
)
if outcome.success
# write to file
at_with_merged_title = outcome.result
FileUtils.mkdir_p(File.dirname(output_file_name))
File.write(output_file_name, at_with_merged_title)
success_count += 1
$stderr.puts " + Merge title from #{ folio_roundtrip_compare_file_name }"
else
errors_count += 1
$stderr.puts " x Error: #{ folio_roundtrip_compare_file_name }: #{ outcome.messages.join }"
end
rescue StandardError => e
errors_count += 1
$stderr.puts " x Error: #{ folio_roundtrip_compare_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join("\n") }"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_compare_titles_with_those_of_erp(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n titles_from_erp = load_titles_from_erp\n file_count = 0\n titles_with_differences = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n title_from_content_at = contents.match(/(?<=^#)[^\\n]+/)\n .to_s\n .gsub('*', '')\n .strip\n date_code = Repositext::Utils::FilenamePartExtractor.extract_date_code(filename)\n title_attrs_from_erp = titles_from_erp[date_code]\n if title_attrs_from_erp.nil?\n titles_with_differences << {\n erp: \"[Could not find title from ERP with date code #{ date_code.inspect }\",\n content_at: title_from_content_at,\n filename: filename,\n date_code: date_code\n }\n else\n title_from_erp = title_attrs_from_erp[:title].to_s\n .gsub(\"'\", '’') # convert straight quote to typographic one\n .gsub('Questions And Answers', 'Questions and Answers') # ignore difference in capitalization for 'And'\n .gsub('#', '') # ignore presence of hash\n if title_from_erp != title_from_content_at\n titles_with_differences << {\n erp: title_from_erp,\n content_at: title_from_content_at,\n filename: filename,\n date_code: date_code\n }\n end\n end\n file_count += 1\n end\n lines = []\n titles_with_differences.sort { |a,b| a[:date_code] <=> b[:date_code] }.each do |attrs|\n l = \" - #{ attrs[:date_code].ljust(8) } ERP: #{ attrs[:erp].inspect.ljust(40) } Content AT: #{ attrs[:content_at].inspect }\"\n $stderr.puts l\n lines << l\n end\n summary_line = \"Found #{ lines.length } titles with differences in #{ file_count } files at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir('reports_dir'), 'compare_titles_with_those_of_erp.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Compare content AT titles with those of ERP\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write lines.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report compare_titles_with_those_of_erp`\\n\"\n }\n end",
"def process_all_primary_files\n # NOTE: I investigated concurrent processing of files\n # to speed up this process, however I didn't pursue it\n # further: This process is highly CPU intensive, so the\n # only way to get a significant speedup is to use\n # multiple CPUs/Cores. In MRI this is only possible\n # with multiple processes. I didn't want to go through\n # the trouble of IPC to collect all files' operations.\n # It would be easier if we could use threads, however\n # that would require jruby or rbx. So I'm sticking with\n # sequential processing for now.\n Dir.glob(\n File.join(@repository.base_dir, '**/content/**/*.at')\n ).map { |absolute_file_path|\n next nil if !@file_list.any? { |e| absolute_file_path.index(e) }\n # Skip non content_at files\n unless absolute_file_path =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here\"\n end\n\n # Note: @any_content_type may be the wrong one, however finding\n # corresponding STM CSV file will still work as it doesn't rely\n # on config but das regex replacements on file path only.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n File.read(absolute_file_path),\n @language,\n absolute_file_path,\n @any_content_type\n )\n\n @logger.info(\" - process #{ content_at_file_to.repo_relative_path(true) }\")\n\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n ).compute\n\n if soff.operations.any?\n @prev_last_operation_id = soff.last_operation_id\n soff\n else\n # Return nil if no subtitle operations exist for this file\n nil\n end\n }.compact\n end",
"def convert(tableread)\n\ttableread[0].each do |filename|\n\t\t#puts filename\n\t\ttext = File.open(filename).read\n\t\ttext = text.gsub(\"<\", \"<\").gsub(\">\", \">\")\n\t\t#convert code to html\n\t\ttextlines = text.split(/\\r*\\n/)\n\t\tcounter = 1\n\t\ttext = \"<html><head><meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\"/></head>\\n<body><pre>\"\n\t\ttextlines.each do |line|\n\t\t\tline = \"<a name=\\\"\"+counter.to_s+\"\\\">\"+line+\"</a>\\n\"\n\t\t\ttext += line\n\t\t\tcounter = counter + 1\n\t\tend\n\t\ttext = text + \"</pre></body></html>\"\n\t\t#modify text based on dump (may need to reorder it)\n\t\ttableread[1].each do |var|\n\t\t\t#puts var[0]+\" \"+var[1]+\" \"+var[2].to_s+\" \"+var[3].to_s\n\t\t\tif var.last == -2 or var.last == 1\n\t\t\t\t#Need to change this to allow multi-files\n\t\t\t\tappearances = text.split(/(?<=\\n)/)\n\t\t\t\ttext = \"\"\n\t\t\t\tappearances.each do |temp|\n\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\" or filename != var[1]\n\t\t\t\t\t\t\tif temp =~ (temp.scan '\\W'+var[0]+'\\W')\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t#text = text.gsub(var[0],\"<a href=\\\"\"+var[1]+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\telsif var.last == -1\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tprocessed = false\n\t\t\t\t\tbalance = 0\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tsplitter = text.split(Regexp.new \"(?=<a name=\\\"\"+var[2].to_s+\"\\\">)\")\n\t\t\t\t\ttext = splitter.first\n\t\t\t\t\ttemptext = splitter.last\n\t\t\t\t\tskipping = false\n\t\t\t\t\twhile processed == false or balance != 0\n\t\t\t\t\t\tcounter = counter + 1\n\t\t\t\t\t\tif temptext[counter] == '\"'\n\t\t\t\t\t\t\tif skipping == true\n\t\t\t\t\t\t\t\tskipping = false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tskipping = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif temptext[counter] == '{' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance + 1\n\t\t\t\t\t\telsif temptext[counter] == '}' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance - 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tusefultext = temptext[0..counter]\n\t\t\t\t\t\n\t\t\t\t\tappearances = usefultext.split(/(?<=\\n)/)\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttext = text + temptext[counter+1..-1]\n\t\t\t\tend\n\t\t\telsif var.last == -5\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tappearances = text.split(Regexp.new \"(?<=\"+var[0]+\")\")\n\t\t\t\t\ttext = \"\"\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t#puts \"Local: \"+ appearances\n\t\t\telse\n\t\t\t\tif var[1] == filename.split(/\\//).last\n\t\t\t\t\tprocessed = false\n\t\t\t\t\tbalance = 0\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tsplitter = text.split(Regexp.new \"(?=<a name=\\\"\"+var[2].to_s+\"\\\">)\")\n\t\t\t\t\ttext = splitter.first\n\t\t\t\t\ttemptext = splitter.last\n\t\t\t\t\tskipping = false\n\t\t\t\t\twhile processed == false or balance != -1\n\t\t\t\t\t\tcounter = counter + 1\n\t\t\t\t\t\tif temptext[counter] == '\"'\n\t\t\t\t\t\t\tif skipping == true\n\t\t\t\t\t\t\t\tskipping = false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tskipping = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif temptext[counter] == '{' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance + 1\n\t\t\t\t\t\telsif temptext[counter] == '}' and skipping == false\n\t\t\t\t\t\t\tprocessed = true\n\t\t\t\t\t\t\tbalance = balance - 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tusefultext = temptext[0..counter]\n\t\t\t\t\t\n\t\t\t\t\t#appearances = usefultext.split(Regexp.new \"(?<=\"+var[0]+\")\")\n\t\t\t\t\tappearances = usefultext.split(/(?<=\\n)/)\n\t\t\t\t\tappearances.each do |temp|\n\t\t\t\t\t\tif not temp.include? (\">\"+var[0])\n\t\t\t\t\t\t\tif not temp.include? \"<a name=\\\"\"+var[2].to_s+\"\\\">\"\n\t\t\t\t\t\t\t\tif temp =~ (Regexp.new '\\W'+var[0]+'\\W',true)\n\t\t\t\t\t\t\t\t\ttemp = temp.gsub((Regexp.new '(?<=\\W'+var[0]+'\\W)'),\"<a href=\\\"\"+var[1].gsub(/\\./,\"_\")+\".html\"+\"#\"+var[2].to_s+\"\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\ttemp = temp.gsub(var[0],\"<a name=\\\"searched\\\">\"+var[0]+\"</a>\")\n\t\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttext = text + temp\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttext = text + temptext[counter+1..-1]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#htmlParse(text)\n\n\t\t#print text\n\t\t#text = text.gsub(/\\r*\\n/, \"<br>\\n\")\n\t\t#puts text\n\t\tFile.open(filename.gsub(/\\./,\"_\")+\".html\", \"w\") do |out|\n\t\t\tout.write(text)\n\t\t\t#out.write(replaceGT)\n\t\tend\n\tend\nend",
"def report_files_with_subtitles_that_require_review(options)\n if config.setting(:is_primary_repo)\n raise \"This command can only be used in foreign repos.\"\n end\n\n fwstrr = {\n subtitles_not_exported: {\n st_ops_and_content_changes: [],\n content_changes_only: [],\n autosplit: []\n },\n subtitles_exported: []\n }\n files_found_count = 0\n total_file_count = 0\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :json_extension\n ),\n /\\.data\\.json\\z/,\n nil,\n \"Reading data.json files\",\n options\n ) do |data_json_file|\n total_file_count += 1\n fd = data_json_file.read_data\n filename = data_json_file.filename\n subtitles_have_been_exported = '' != fd['exported_subtitles_at_st_sync_commit'].to_s.strip\n st_tr = (fd['st_sync_subtitles_to_review'] || {})\n next if st_tr.none?\n st_tr_keys = st_tr.keys\n st_tr_cnt = st_tr_keys.count\n desc = nil\n if subtitles_have_been_exported\n # No further distinction required\n files_found_count += 1\n if st_tr.any? { |e| ['all', ['autosplit']] == e }\n # all sts need to be reviewed, don't print details\n fwstrr[:subtitles_exported] << [filename, 'all', []]\n else\n # only some sts need to be reviewed, print details\n # Add subtitle index + type of change to this file group\n # st_tr: { \"6938579\" => [\"content_change\"], \"2756941\" => [\"content_change\"] }\n subtitles = data_json_file.corresponding_content_at_file.subtitles\n st_tr_attrs = st_tr.map { |stid, ops|\n st = subtitles.detect { |e| stid == e.persistent_id }\n # st may not exist if it was deleted via merge or delete operation.\n idx = ((st && st.tmp_index) || '[N/A]').to_s.rjust(5, ' ')\n { index: idx, operations: ops.join(', ') }\n }\n fwstrr[:subtitles_exported] << [filename, st_tr_cnt, st_tr_attrs]\n end\n desc = \" - subtitles have been exported, has #{ st_tr_cnt } subtitles to review\".color(:blue)\n else\n # subtitles have not been exported, further distinguish kinds of changes\n if data_json_file.is_autosplit?\n # This file is autosplit\n files_found_count += 1\n fwstrr[:subtitles_not_exported][:autosplit] << [filename, 'all']\n desc = \" - subtitles have not been exported, was autosplit\".color(:blue)\n elsif st_tr.all? { |stid,ops| ops.all? { |op| 'content_change' == op } }\n # content_changes only\n files_found_count += 1\n fwstrr[:subtitles_not_exported][:content_changes_only] << [filename, st_tr_cnt]\n desc = \" - subtitles have not been exported, #{ st_tr_cnt } content_changes to review\".color(:blue)\n else\n # st ops and content_changes\n files_found_count += 1\n # Add subtitle index + type of change to this file group\n # st_tr: { \"6938579\" => [\"content_change\"], \"2756941\" => [\"content_change\"] }\n subtitles = data_json_file.corresponding_content_at_file.subtitles\n st_tr_attrs = st_tr.map { |stid, ops|\n st = subtitles.detect { |e| stid == e.persistent_id }\n # st may not exist if it was deleted via merge or delete operation.\n idx = ((st && st.tmp_index) || '[N/A]').to_s.rjust(5, ' ')\n { index: idx, operations: ops.join(', ') }\n }\n fwstrr[:subtitles_not_exported][:st_ops_and_content_changes] << [filename, st_tr_cnt, st_tr_attrs]\n desc = \" - subtitles have not been exported, #{ st_tr_cnt } st_ops and content_changes to review\".color(:blue)\n end\n end\n $stderr.puts desc\n end\n if files_found_count > 0\n $stderr.puts \"\\nThe following #{ files_found_count } files have subtitles requiring review\".color(:blue)\n $stderr.puts '-' * 80\n if(fs = fwstrr[:subtitles_not_exported][:st_ops_and_content_changes]).any?\n $stderr.puts \" With st ops (subtitles not exported yet):\".color(:blue)\n fs.each { |(fn, cnt, sts_tr)|\n $stderr.puts \" * #{ fn } (#{ cnt })\"\n sts_tr.each { |st_tr|\n $stderr.puts \" - index #{ st_tr[:index] }: #{ st_tr[:operations] }\"\n }\n }\n end\n if(fs = fwstrr[:subtitles_not_exported][:content_changes_only]).any?\n $stderr.puts \" With content_changes (subtitles not exported yet):\".color(:blue)\n fs.each { |(fn, cnt)| $stderr.puts \" * #{ fn } (#{ cnt })\" }\n end\n if(fs = fwstrr[:subtitles_not_exported][:autosplit]).any?\n $stderr.puts \" Autosplit (subtitles not exported yet):\".color(:blue)\n fs.each { |(fn, cnt)| $stderr.puts \" * #{ fn } (#{ cnt })\" }\n end\n if(fs = fwstrr[:subtitles_exported]).any?\n $stderr.puts \" Subtitles already exported:\".color(:blue)\n # fs.each { |(fn, cnt)| $stderr.puts \" * #{ fn } (#{ cnt })\" }\n fs.each { |(fn, cnt, sts_tr)|\n $stderr.puts \" * #{ fn } (#{ cnt })\"\n sts_tr.each { |st_tr|\n $stderr.puts \" - index #{ st_tr[:index] }: #{ st_tr[:operations] }\"\n }\n }\n end\n $stderr.puts\n end\n end",
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end",
"def read_post_text_files\n open(MENTION_FILE, 'r:UTF-8') do |file|\n @reply_mention_text = file.readlines.collect{|line| line.strip}\n end\n\n open(NOTMEITAN_FILE, 'r:UTF-8') do |file|\n @notmeitan_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_CSHARP_FILE, 'r:UTF-8') do |file|\n @reply_csharp_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_MORNING_FILE, 'r:UTF-8') do |file|\n @reply_morning_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_SLEEPING_FILE, 'r:UTF-8') do |file|\n @reply_sleeping_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_DEPARTURE_FILE, 'r:UTF-8') do |file|\n @reply_departure_text = file.readlines.collect{|line| line.strip}\n end\n\n open(REPLY_RETURN_FILE, 'r:UTF-8') do |file|\n @reply_return_text = file.readlines.collect{|line| line.strip}\n end\n\n log 'notmeitan text:'\n for s in @notmeitan_text do\n log ' ' + s\n end\n\n log 'reply text:'\n for s in @reply_mention_text do\n log ' ' + s\n end\n\n log 'reply csharp text:'\n for s in @reply_csharp_text do\n log ' ' + s\n end\n\n log 'reply departure text:'\n for s in @reply_departure_text do\n log ' ' + s\n end\n\n log 'reply returning text:'\n for s in @reply_return_text do\n log ' ' + s\n end\n end",
"def typos_in_file(destination_file)\n\n\t\tsubtitles_object_list = get_subtitle_objects_in_file\n\n\t\tlines = subtitles_object_list.map{ |subtitle| subtitle.get_lines }\n\n\t\twords = get_words(lines.flatten)\n\n\t\ttypos = word_not_in_dictionary(words)\n\n\t\ttypos_list = look_for_typos_in_file(typos, subtitles_object_list)\n\n\t\ttypos_file_content = {}\n\t\ttypos_list.each do |typos_object|\n\t\t\ttypos_file_content.merge!(typos_object) {|k,l,r| [l,r].flatten.join(\", \") }\n\t\tend\n\n\t\t#functionality to ignore words, per example names\n\t\tignored_words = IO.read(\"ignored_words.txt\").split(\"\\n\")\n\n\t\tcontent = \"\"\n\t\ttypos_file_content.each do |word|\n\t\t\tunless ignored_words.include? word[0]\n\t\t\t\tcontent << word[0] + \": \" + word[1] + \"\\n\"\n\t\t\tend\n\t\tend\n\t\tIO.write(destination_file, content)\n\tend",
"def create_filename(newpost)\n File.readlines(newpost).each do |line|\n tidytitle = ''\n # Extract title from the h2 line, and create tidytitle and filename\n if line =~ />\\w.*h2/\n # $& returns exact match, not entire line. Strip the tags surroundging the title.\n @title = $&.sub('>','').sub('</a></h2','') \n # Remove illegaal characters from title\n tidytitle = @title.downcase.gsub(/(#|%|&|\\*|<|>|\\{|\\}|\\\\|:|;|,|<|>|\\?|\\/|\\+|'|!|\\.)/,'').gsub(/ /,'-').gsub(/-+/,'-') + '.html'\n # Create filename preceded with datestamp\n @filename = @filedate + '-' + tidytitle\n break\n end\n end\nend",
"def textualed\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n while a = full_list.shift\n puts a unless nil? \n end\n end",
"def merge(prt_pdb, lig_pdb, complex_pdb)\n prt_lines = File.readlines(prt_pdb)\n lig_lines = File.readlines(lig_pdb)\n\n prt_atm_lines = prt_lines.select { |line| /ATOM/ =~ line }\n lig_atm_lines = lig_lines.select { |line| /HETATM/ =~ line}\n\n f = File.open(complex_pdb, 'w')\n\n f.write(\"MODEL 1\\n\")\n prt_atm_lines.each do |line| f.write(line) end\n f.write(\"TER\\n\")\n lig_atm_lines.each do |line| f.write(line) end\n f.write(\"END\\n\")\n\n f.close()\n\nend",
"def formatted_file_list(title, source_files); end",
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def report_content_sources(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n folio_import_base_dir = config.base_dir('folio_import_dir')\n idml_import_base_dir = config.base_dir('idml_import_dir')\n total_count = 0\n folio_sourced = []\n idml_sourced = []\n other_sourced = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n idml_input_filename = filename.gsub(content_base_dir, idml_import_base_dir)\n .gsub(/\\.at/, '.idml.at')\n folio_input_filename = filename.gsub(content_base_dir, folio_import_base_dir)\n .gsub(/\\.at/, '.folio.at')\n if File.exists?(idml_input_filename)\n idml_sourced << filename\n elsif File.exists?(folio_input_filename)\n folio_sourced << filename\n else\n other_sourced << filename\n end\n end\n\n lines = [\n \"List sources of content_at files\",\n '-' * 40,\n ]\n if idml_sourced.any?\n lines << \" - The following #{ idml_sourced.length } content AT files are sourced from Idml:\"\n idml_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Idml.\"\n end\n if folio_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are sourced from Folio:\"\n folio_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Folio.\"\n end\n if other_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are from other sources:\"\n other_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files from other sources.\"\n end\n lines << '-' * 40\n lines << \"Sources summary:\"\n lines << \" - Idml: #{ idml_sourced.length }\"\n lines << \" - Folio: #{ folio_sourced.length }\"\n lines << \" - Other: #{ other_sourced.length }\"\n total_sourced = idml_sourced.length + folio_sourced.length + other_sourced.length\n lines << \"Determined sources for #{ total_sourced } of #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'content_sources.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report content_sources`\\n\"\n }\n end",
"def converttitles()\n merge(converttitles: 'true')\n end",
"def cleanup_page_titles\n\n fids = {} # an array of entries, NOTE BENE: these entries are shared structures into @sequence\n @sequence.each do |entry| # anything with the same FID gets the same title (the entries will have the same values)\n next unless is_page? entry\n fids[entry.fid] ||= []\n fids[entry.fid].push entry\n end\n\n fid_seq = pages.map { |entry| entry.fid } # we need to process in @sequence order to re-number pages\n\n titles = {}\n seen = {}\n\n fid_seq.each do |fid|\n next if seen[fid]\n seen[fid] = true\n title = fids[fid][0].title\n titles[title] ||= 0\n titles[title] += 1\n end\n\n\n we_have_issues = []\n\n fid_seq.reverse.each do |fid|\n title = fids[fid][0].title\n n = titles[title]\n\n if n and n > 1\n fids[fid].each do |entry|\n entry.title = entry.title + \" (#{n})\"\n we_have_issues.push entry.title\n end\n titles[title] -= 1\n end\n end\n\n if not we_have_issues.empty?\n warning \"Not all page labels in the METS file were unique; a parenthesized number was appended for these labels: '\" + we_have_issues.join(\"', '\") + \"'.\"\n end\n end",
"def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend",
"def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end",
"def load_all_from_files\n\t\tload_hash_from_file($searched, $progDir+'searched.txt')\n\t\tload_hash_from_file($downloaded, $progDir+'downloaded.txt')\n\t\tload_array_from_file($toSearch, $progDir+'toSearch.txt')\n\t\tload_array_from_file($toDownload, $progDir+'toDownload.txt')\n\trescue => e\n\t\t$error.save_error_to_file(__method__, e, $specialErrorTxt)\n\tend",
"def single_ucf_file_lists\n File.open(single_bad_ucf_file, 'a') do |mergedfile|\n Dir.glob(\"#{output_directory_path}*name.txt\").each do |file|\n File.foreach(file) do |line|\n mergedfile.write(line)\n end\n end\n end\n end",
"def merge_use_idml_or_folio(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :idml_import_dir\n )\n input_file_selector = config.compute_file_selector(\n options['file-selector'] || :all_files\n )\n input_file_extension = config.compute_file_extension(\n options['file-extension'] || :at_extension\n )\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Using either idml_at or folio_at for content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n idml_used_count = 0\n folio_used_count = 0\n\n # TODO: refactor this method to use Cli::Utils so that the changed-only flag works\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_idml_file_name)\n # Idml is present, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n idml_at = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, idml_at)\n success_count += 1\n idml_used_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, bt folio is, use it\n FileUtils.mkdir_p(File.dirname(output_file_name))\n folio_at = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, folio_at)\n success_count += 1\n folio_used_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - IDML files used: #{ idml_used_count }\"\n $stderr.puts \" - Folio files used: #{ folio_used_count }\"\n $stderr.puts '-' * 80\n end",
"def clean2\n content = text.split(\"\\n\")\n \n # First, find and mark songs\n in_song = false\n new_content = []\n content.each do |line|\n if line=~/\\*{5}/ .. line=~END_OF_SONG\n new_content << \"SONG:\" unless in_song\n if line =~ END_OF_SONG\n new_content << line\n in_song = false\n else\n new_content << \" #{line}\"\n in_song = true\n end\n else\n if in_song\n new_content << \"END OF SONG\"\n end\n in_song = false\n new_content << line\n end\n end\n \n # Now, fix line endings and merge lines\n old_content = new_content\n new_content = []\n preserve_breaks = false\n last_line = \"\"\n old_content.each do |line|\n new_content << \"\" if preserve_breaks ||\n last_line =~ END_OF_SONG || \n new_content.size == 0 ||\n line =~ /^.[LS]-\\d+(?:\\]|$|.\\s*\\()/ ||\n line =~ /^\\([A-Z]/ ||\n line =~ /^[A-Z][A-Z, \\.-]+:\\s/ ||\n line =~ /^Scene\\s+\\?\\s+-\\s+\\?/ ||\n line =~ START_OF_SONG ||\n line =~ /^#/\n case line\n when START_OF_SONG\n preserve_breaks = true\n when END_OF_SONG\n preserve_breaks = false\n end\n new_content[-1] += ' ' unless new_content[-1] =~ /^$|\\s$/\n new_content[-1] += line\n last_line = line\n end\n \n # Now, insert extra empty lines\n old_content = new_content\n new_content = []\n extra_space = true\n in_cast = false\n in_song = false\n \n old_content.each do |line|\n if line =~ /^#/\n extra_space = false if in_cast\n else\n in_cast = false\n extra_space = true unless in_song\n end\n new_content << \"\" if extra_space && new_content.size > 0\n new_content << line\n case line\n when /^#CAST FOR SCENE/\n in_cast = true\n when START_OF_SONG\n extra_space = false\n in_song = true\n when END_OF_SONG\n extra_space = true\n in_song = false\n end\n end\n \n # Finally, fix songs\n old_content = new_content\n new_content = []\n i = 0\n while i<old_content.size\n line = old_content[i]\n case line\n when START_OF_SONG\n # Find lines with stars in them\n j = i+1\n while j<old_content.size && old_content[j] !~ END_OF_SONG\n j += 1\n end\n # At this point lines i...j are the song; back up and look for the last \"*****\"\n while j>i && old_content[j] !~ /\\*{5}/\n j -= 1\n end\n # Now lines (i+1)...j are the song information block\n song_information = old_content[(i+1)...j].join\n song_name = song_information[/^[\\s\\*]*([^\\*]+)/,1].strip\n tune = song_information[/([^\\*]+)[\\s\\*]*$/,1].strip\n new_content += [\" SONG: #{song_name}\", \" (To the tune of: #{tune})\"]\n i = j+1\n when END_OF_SONG\n i += 1 # Discard end of song markers; we don't need them anymore\n else\n new_content << line\n i += 1\n end\n end\n \n # Save the results\n text = new_content.join(\"\\n\")\n end",
"def merge_description_notes\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n src_notes.each_key do |f|\n if dest_notes[f].blank?\n dest_notes[f] = src_notes[f]\n elsif src_notes[f].present?\n dest_notes[f] += \"\\n\\n--------------------------------------\\n\\n\"\n dest_notes[f] += src_notes[f].to_s\n end\n end\n @dest.all_notes = dest_notes\n end",
"def cleanup_title(line)\n\n\t# title variable\n\ttitle = nil\n\n\t# splitting the line by \">\"\n\t# as the result should have 4 different strings\n\t# the tmp_4 war should contain title string\n\ttmp_1, tmp_2, tmp_3, tmp_4 = line.chomp.split(/>/)\n\n\t# ===============================================================\n\t# make the first letter of the string uppercase\n\tstr_up = tmp_4\n\tstr_up[0] = str_up[0].upcase\n\ttitle_tmp = str_up\n\t# ===============================================================\n\n\tif title_tmp.match(/^[\\A]/)\n\n\t\t# splitting up the title_tmp further\n\t\t# after splitting the first part of the title_tmp string should give back title\n\t\t# and the rest what left is the garbage string\n\t\ttitle_tmp_2, garbage = title_tmp.chomp.split(/[\\/\\()\\[\\]\\:\\_\\-\\+\\=\\*\\@\\![0-9]]/)\n\n\t\t# ===============================================================\n\t\t# Replace spaces within an empty char\n\t\tstr_no_sp = title_tmp_2.gsub(/\\s/,'')\n\t\tstr_no_sp = str_no_sp.gsub(/\\?/,'')\n\t\tstr_no_sp = str_no_sp.gsub(/\\!/,'')\n\t\tstr_no_sp = str_no_sp.gsub(/\\./,'')\n\t\tstr_no_sp = str_no_sp.gsub(/\\'/,'')\n\t\t\n\t\t# check if title matches the regular expression\n\t\treg_str = str_no_sp[/[a-zA-Z]+$/]\n\t\tis_equal = str_no_sp == reg_str # true or false\n\t\t# ================================================================\n\t\t\n\t\tif is_equal == true\n\t\t\tif title_tmp_2 != \"\"\n\t\t\t\t$counter_1 += 1\n\t\t\t\ttitle = title_tmp_2.downcase!.gsub(/\\s+$/,'')\n\t\t\t\ttitle = title.gsub(/\\.$/,'')\n\t\t\t\t#puts \"*********************\\n\"\n\t\t\t\t#puts \"[ENG][+]: #{title} ==> #{$counter_1}\"\n\t\t\t\t#puts \"*********************\\n\"\n\t\t\tend\t\n\t\telse\n\t\t\t$counter_2 += 1\n\t\t\t#puts \"*********************\\n\"\n\t\t\t#puts \"[NON-ENG][-]: #{title_tmp_2} ==> #{$counter_1}\"\n\t\t\t#puts \"*********************\\n\"\n\t\tend\n\tend\n\n\t# return cleaned up title string\n\treturn title;\n\nend",
"def titleize\n @collection.dictionary.each do |id, data|\n next unless File.basename(data['id']) =~ /^untitled/\n new_name = Ruhoh::StringFormat.clean_slug(data['title'])\n new_file = \"#{new_name}#{File.extname(data['id'])}\"\n old_file = File.basename(data['id'])\n next if old_file == new_file\n\n FileUtils.cd(File.dirname(data['pointer']['realpath'])) {\n FileUtils.mv(old_file, new_file)\n }\n Ruhoh::Friend.say { green \"Renamed #{old_file} to: #{new_file}\" }\n end\n end",
"def do_inproceedings\n @lines.each {|l| l.sub!(/journal =/, \"booktitle =\") }\n end",
"def cleanup_page_titles\n pages.each do |p|\n new_title = p.title.sub(/^page\\s*/i, '').strip\n p.title = new_title\n end\n\n pages.each do |p|\n if p.title.empty?\n if p.image_filename # we need to be able to make the assumption this exists\n p.title = file_name(p.image_filename)\n end\n end\n end\n\n seen = {}\n sequence = 1\n problems = []\n pages.each do |p|\n if p.title.empty?\n p.title = sequence.to_s\n end\n if seen[p.title]\n p.title += \" (#{sequence})\"\n problems.push p.title\n end\n seen[p.title] = true\n sequence += 1\n end\n\n if not problems.empty?\n warning \"Some page labels were not unique; the sequence number was appended: '\" + problems.join(\"', '\") + \"'.\"\n end\n end",
"def merge_reads\n @reads_fpath = output_fpath(\"quanto.reads.tsv\")\n if !output_exist?(@reads_fpath)\n File.open(@reads_fpath, 'w') do |file|\n file.puts(reads_header.join(\"\\t\"))\n @objects.each do |obj|\n file.puts(open(obj[:summary_path]).read.chomp)\n end\n end\n end\n end",
"def save_ambigious_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n tag_strings = ['unkjent_ord'] if tag_strings.count == 0\n f.puts w.norm_string + \"\\t\" + tag_strings.sort.join(\"\\t\")\n end\n\n f.puts\n end\n end\n\n nil\n end",
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n idml_not_present_count = 0\n folio_not_present_count = 0\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)\n # Both files are present, merge tokens\n begin\n at_folio = File.read(at_folio_file_name)\n at_idml = File.read(at_idml_file_name)\n at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(\n at_folio, at_idml\n )\n # write to file\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge rids from #{ at_folio_file_name }\"\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, use Folio import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n idml_not_present_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n elsif File.exist?(at_idml_file_name)\n # Folio file is not present, use Idml import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n folio_not_present_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - Folio files not present: #{ folio_not_present_count }\"\n $stderr.puts \" - IDML files not present: #{ idml_not_present_count }\"\n $stderr.puts '-' * 80\n end",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def merge_accepted_corrections_into_content_at(options)\n # First validate the spot sheets and cancel process if errors are found.\n validate_spot_sheet(options.merge('validate_or_merge' => 'merge'))\n\n accepted_corrections_base_dir = config.compute_base_dir(\n options['base-dir'] ||\n options['base-dir-1'] ||\n :accepted_corrections_dir\n )\n accepted_corrections_glob_pattern = config.compute_glob_pattern(\n accepted_corrections_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging accepted corrections into content_at'\n start_time = Time.now\n total_count = 0\n auto_success_count = 0\n manual_success_count = 0\n errors_count = 0\n\n Dir.glob(accepted_corrections_glob_pattern).each do |accepted_corrections_file_name|\n if accepted_corrections_file_name !~ /\\.accepted_corrections\\.txt\\z/\n $stderr.puts \" - skipping #{ accepted_corrections_file_name }\"\n next\n end\n total_count += 1\n # prepare paths\n content_at_file_name = accepted_corrections_file_name.gsub(\n accepted_corrections_base_dir,\n content_base_dir\n ).gsub(\n /\\.accepted_corrections\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n # First apply all corrections that can be done automatically\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_auto(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # write to file\n at_with_accepted_corrections = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_accepted_corrections)\n auto_success_count += 1\n $stderr.puts \" + Auto-merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n\n # Second apply manual corrections.\n outcome = Repositext::Process::Merge::AcceptedCorrectionsIntoContentAt.merge_manually(\n File.read(accepted_corrections_file_name),\n File.read(content_at_file_name),\n content_at_file_name,\n )\n\n if outcome.success\n # Nothing needs to be written to file. This has already been done\n # manually in the editor.\n manual_success_count += 1\n $stderr.puts \" + Manually merged accepted corrections from #{ accepted_corrections_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ accepted_corrections_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ total_count } files in #{ Time.now - start_time } seconds:\"\n $stderr.puts \" - Auto-merges: #{ auto_success_count } files.\"\n $stderr.puts \" - Manual merges: #{ manual_success_count } files.\"\n $stderr.puts '-' * 80\n end",
"def file_process(file)\n\n stop_words = File.read('stop_words.txt').split(\"\\n\")\n\n lines = File.readlines(file)\n title = lines[0]\n speech = lines[1..-1]\n line_count = speech.size\n text = speech.join\n char_count = text.length\n char_count_nospaces = text.force_encoding('UTF-8').gsub(/\\s+/, '').length\n word_count = text.scan(/\\w+/).length\n sentence_count = text.split(/\\.|\\?|!/).length\n average_words_sentence = word_count / sentence_count\n paragraph_count = text.split(/\\n\\n/).length\n word_frequency_hash = {}\n word_frequency_top = []\n\n text.split().each do |word|\n unless stop_words.include?(word.downcase)\n if word_frequency_hash.has_key?(word.downcase)\n word_frequency_hash[word.downcase] += 1\n else\n word_frequency_hash[word.downcase] = 1\n end\n end\n end\n\n non_fluff_words = (word_frequency_hash.size.to_f / word_count.to_f * 100).to_i\n\n array_of_sentences = text.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).sort_by { |sentence| sentence.length }\n ideal_sentences = array_of_sentences[array_of_sentences.length/3..array_of_sentences.length - array_of_sentences.length/3]\n\n word_frequency = word_frequency_hash.sort_by { |key, value| value}.reverse\n word_frequency.flatten.each_with_index { |word, index| word_frequency_top << word if index.even? }\n\n puts \"#{title}\"\n puts \"#{line_count} lines\"\n puts \"#{char_count} characters\"\n puts \"#{char_count_nospaces} characters excluding spaces\"\n puts \"#{word_count} words\"\n puts \"#{sentence_count} sentences\"\n puts \"#{paragraph_count} paragraphs\"\n puts \"#{average_words_sentence} words per sentence (average)\"\n puts \"#{word_frequency_hash.size} non-fluff words\"\n puts \"roughly #{non_fluff_words} percent non-fluff words.\"\n puts \"Top 10 non-fluff words: #{word_frequency_top.take(10)} top 10 non-fluff words.\"\n puts \"Ideal sentences array: #{ideal_sentences.take(7) }\"\n puts\n puts\n\nend",
"def merge\n @filenames.each do |f_name|\n reader = Fileread_with_row_index.new(f_name)\n last_row = reader.count_row - 1\n for i in 0..last_row \n line = reader.read_row(i)\n @writer.puts(line)\n end\n end\n end",
"def doing_phrases_file_sort_and_unique\n a = File.readlines(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\")\n @megadeta = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"\"\n puts queue\n\t @megadata_unique = @megadata.uniq\n queue << \"#{@megadata_unique}\"\n break unless @megadata_uniq\n consumer.transfer queue\n queue.clear\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def merge_names(*args)\n\tnames = {}\n\targs.each do |arg|\n\t\tFile.open(arg,'r') do |f|\n\t\t\twhile line = f.gets do\n\t\t\t\tnames[line.delane_sequence_name] = true\n\t\t\tend\n\t\tend\n\tend\n\tnames\nend",
"def report_compare_file_inventory_with_erp(options)\n date_codes_from_erp = load_titles_from_erp.keys\n date_codes_from_repo = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :at_extension\n ),\n options['file_filter'],\n nil,\n \"Reading AT files\",\n options\n ) do |content_at_file|\n date_codes_from_repo << content_at_file.extract_date_code.downcase\n end\n # compute differences\n common_date_codes = date_codes_from_erp & date_codes_from_repo\n missing_date_codes = date_codes_from_erp - common_date_codes\n added_date_codes = date_codes_from_repo - common_date_codes\n missing_count = missing_date_codes.length\n added_count = added_date_codes.length\n common_count = common_date_codes.length\n total_count = missing_count + added_count + common_count\n lines = [\n \"Compare content AT file inventory with ERP\",\n '-' * 40,\n ]\n lines << \" - There are #{ common_count } files in both content AT and ERP.\"\n if missing_date_codes.empty?\n lines << \" - There are no files in ERP that aren't also in content AT.\"\n else\n lines << \" - The following #{ missing_count } files in ERP are NOT in content AT:\"\n missing_date_codes.each do |dc|\n lines << \" - - #{ dc }\"\n end\n end\n if added_date_codes.empty?\n lines << \" - There are no files in content AT that aren't also in ERP.\"\n else\n lines << \" - The following #{ added_count } files in content AT are NOT in ERP:\"\n added_date_codes.each do |dc|\n lines << \" - - #{ dc }\"\n end\n end\n lines << '-' * 40\n lines << \"Found #{ missing_count + added_count } differences in #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir(:reports_dir), 'compare_file_inventory_with_erp.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report compare_file_inventory_with_erp`\\n\"\n }\n end",
"def comparative(file_name)\n @scrap_lines = File.readlines(file_name)\n\n @upload_docs.each do |upload_doc_line|\n if @scrap_lines.include?(upload_doc_line)\n if File.file?(\"report.txt\") \n File.open(\"report.txt\" ,\"w\"){ |file| file.write(upload_doc_line)}\n else\n @reportfile = File.new(\"report.txt\",\"w+\")\n File.open(\"report.txt\",\"w\"){ |file| file.write(upload_doc_line)}\n @reportfile.close\n end\n else\n puts \"No instances of plagiarism detected in the application;\"\n end\n end \n end",
"def generatetitles()\n merge(gadrgeneratetitles: 'true')\n end",
"def titre_in_file\n if File.exist? fullpath\n titre_in_code File.read(fullpath).force_encoding('utf-8')\n else\n debug \"= Fichier ID #{id} introuvable (#{fullpath}). Impossible de récupérer son titre\"\n \"\"\n end\n end",
"def report_compare_file_inventory_with_erp(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n date_codes_from_erp = load_titles_from_erp.keys\n date_codes_from_repo = []\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n date_codes_from_repo << Repositext::Utils::FilenamePartExtractor.extract_date_code(filename)\n .downcase\n end\n # compute differences\n common_date_codes = date_codes_from_erp & date_codes_from_repo\n missing_date_codes = date_codes_from_erp - common_date_codes\n added_date_codes = date_codes_from_repo - common_date_codes\n missing_count = missing_date_codes.length\n added_count = added_date_codes.length\n common_count = common_date_codes.length\n total_count = missing_count + added_count + common_count\n lines = [\n \"Compare content AT file inventory with ERP\",\n '-' * 40,\n ]\n lines << \" - There are #{ common_count } files in both content AT and ERP.\"\n if missing_date_codes.empty?\n lines << \" - There are no files in ERP that aren't also in content AT.\"\n else\n lines << \" - The following #{ missing_count } files in ERP are NOT in content AT:\"\n missing_date_codes.each do |dc|\n lines << \" - - #{ dc }\"\n end\n end\n if added_date_codes.empty?\n lines << \" - There are no files in content AT that aren't also in ERP.\"\n else\n lines << \" - The following #{ added_count } files in content AT are NOT in ERP:\"\n added_date_codes.each do |dc|\n lines << \" - - #{ dc }\"\n end\n end\n lines << '-' * 40\n lines << \"Found #{ missing_count + added_count } differences in #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'compare_file_inventory_with_erp.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report compare_file_inventory_with_erp`\\n\"\n }\n end",
"def count_danger_dave_faults\n danger_dave_es = '/Users/michael/Desktop/language_files/danger_dave_inflection_freqs/content/2016/es/es_full.txt'\n bw_count = File.new('./bw_count.txt', 'w+')\n not_found_count = File.new('./not_found_count.txt', 'w+')\n File.readlines(danger_dave_es).each do |word_n_freq|\n if $. == 100\n break\n end\n word_n_freq_arr = word_n_freq.split(' ')\n word = word_n_freq_arr[0]\n hit_count = word_n_freq_arr[1]\n bw_exists = BaseWord.find_by(base_word: word)\n # headers for bw_count file: base_word, hit_count, (inflection), base_word_id\n # headers for not_found_count file: inflection, hit_count\n if bw_exists\n bw_count.puts word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_exists.id\n else\n inflection_exists = Inflection.find_by(word: word)\n if inflection_exists\n bw_id = inflection_exists.base_word_id\n bw = BaseWord.find(bw_id).base_word\n bw_count.puts base_word + ' ' + hit_count + ' ' + '(' + word + ')' + ' ' + bw_id\n else\n not_found_count.puts word + ' ' + hit_count\n end\n end\n end\nend",
"def normalize_titles\n normalized_rt_title\n normalized_tz_title\n self\n end",
"def printWords(file, lines, htmlOutput=false) \ntranslated = []\nFile.open(\"german_vocabulary.c\") { |german| \n translated = german.readlines.collect { |l|\n if l =~ /\\{\"[^\"]*\", (\"[A-Z0-9_]+\")/ then\n $1\n end\n }.uniq\n}\n\ncount = 0\nlines.each { |line|\n if line =~ /\\#define.*NAM_.*(\".*\")/ then\n if not translated.include? $1 then\n puts $1+' nicht uebersetzt!' unless htmlOutput\n count += 1\n end\n end\n}\n\nif htmlOutput then\n puts '<tr>'\n puts ' <td>'+file+'</td>'\n puts ' <td align=\"right\">'+lines.size.to_s+'</td>'\n puts ' <td align=\"right\">'+count.to_s+'</td>'\n puts ' <td align=\"right\">'+sprintf(\"%4d\", lines.size-count)+'</td>'\n puts ' <td align=\"right\">'+sprintf(\"%2g\", (lines.size-count)*100.0/lines.size)+'</td>'\n puts '</tr>'\nelse\n puts\n puts \"Gesamtzahl: \"+sprintf(\"%4d\", lines.size.to_s)\n puts \"Nicht uebersetzte Wort: \"+sprintf(\"%4d\", count.to_s)\n puts \"Uebersetzte Worte: \"+sprintf(\"%4d\", lines.size-count)\n puts \"Prozentual uebersetzt: \"+sprintf(\"%2g\", (lines.size-count)*100.0/lines.size)\nend\n\nend",
"def main\n filelist = split_ts_export_main\n sort_lines_main(filelist)\n #reverse_lines_main\nend",
"def parse_nfo\n @nfo.split(/\\n/).each do |line|\n case line\n when /subtitle|sub/i\n @srt << 'fr' if line =~ /fr|fre|french/i\n @srt << 'en' if line =~ /en|eng|english/i\n # TODO add more language parsing here\n @srt << 'none' if line =~ /none/i\n when /imdb\\.com\\/title\\//\n @imdb_link = (matched = line.match(/imdb.com\\/title\\/(tt[0-9]+)/)) && \"http://imdb.com/title/#{matched[1]}\"\n end\n end\n @srt << 'unknown' if @srt.empty?\n end",
"def get_tweet_text(files)\n\t\t#tweets_file = \"#{ARGV.last}_merged.csv\"\n\t\ttweets_file = ARGV.last\n\t\tCSV.open(tweets_file, 'ab') do |csv|\n\t\t\tbegin\n\t\t\t\tnew_file = CSV.read(tweets_file,:encoding => \"iso-8859-1\",:col_sep => \",\")\n\t\t\t \tif new_file.none?\n\t\t\t \tcsv << [\"id\", \"created_at\", \"tweet\", \"user_id\", \"username\", \"screen_name\", \"hashtags\", \"retweets\", \"urls\", \"media\", \"quoted_text\"]\n\t\t\t \tend\n\t\t\t\tfiles.each do |file|\n\t\t\t\t\tCSV.foreach(file, headers:true) do |tweet|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tlangauge = tweet['tweet'].gsub(/http(:|s:)(\\/\\/|\\/)[A-Za-z\\S]+/, \"\").gsub(/http(s:|:)\\u2026/, \"\").gsub(/(@|#)[a-zA-Z]*/, \"\").gsub(/^RT/, \"\").gsub(/[^0-9a-zA-Z ]/, \"\").strip\n\t\t\t\t\t\t\tif !langauge.empty?\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t#if @wl.detect(langauge) == :en\n\t\t\t\t\t\t\t\tif @wl.process_text(langauge)[:english] >= 2\n\t\t\t\t\t\t\t\t\tputs tweet\n\t\t\t\t\t\t\t\t\tputs '-----------------------'\n\t\t\t\t\t\t\t\t\tcsv << [tweet['id'], tweet['created_at'], tweet['tweet'], tweet['user_id'], tweet['username'], tweet['screen_name'], tweet['hashtags'], tweet['retweeted_tweet_retweet_count'], tweet['urls'], tweet['media'], tweet['quoted_text']]\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\t\t\n\t\t\t\t\t\trescue Exception => e\n\t \t\t\t\t\t\tputs \"Error #{e}\"\n\t \t\t\t\t\t\tnext\t\n\t\t\t\t\t\tend\t\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t \t\t\tputs \"Error #{e}\"\n\t \t\t\tnext\n\t \t\tend\t\n \t\tend\n\tend",
"def merge_hot\n if(/!hot! *([\\w;.\\/]+)([\\n])/ =~ @row;@rgx = $~)\n hots= @rgx[1].split(';').collect {|x|x+'.'+@hot}\n rpl = ['']\n hots.each do |hot|\n fls = File.exist?(hot) ? hot :\n File.exist?(@src_path+'/'+hot) ? @src_path+'/'+hot :\n File.exist?(W2Tags::Dir+'/../hot/'+hot) ? W2Tags::Dir+'/../hot/'+hot : ''\n if fls==''\n rpl << \"<!--\"+hot+\", Not Found-->\\n\"\n else\n puts '=>'+File.expand_path(fls) if !@silent\n @tg_hot.merge!(W2Tags.read_filehot(fls))\n end \n end\n @row.gsub!(@rgx.to_s,rpl.join)\n end\n end",
"def populate_title\n if self.title.blank?\n self.title = self.file_file_name.blank? ? \"\" : self.file_file_name.gsub(/_/, \" \").capitalize\n end\n\tend",
"def transPt2Heroes\n pageNum = 1\n translatedFile = File.join('..', 'translatedData', \"ToTranslate_Heroes_#{pageNum}.txt\")\n heroes = @rawData[@cf::HEROES]\n while (File.exist?(translatedFile))\n dataFromFile = readPartitionedFile(translatedFile, File.read(translatedFile))\n dataFromFile.each do |heroTranslation|\n hero = heroes[heroTranslation[@cf::HERO_ID]]\n hero[@cf::NAME_JP] = hero[@cf::NAME]\n hero[@cf::NAME] = heroTranslation[@cf::NAME]\n \n heroUlt = hero[@cf::ULT]\n translatedUlt = heroTranslation[@cf::ULT]\n heroUlt[@cf::NAME_JP] = heroUlt[@cf::NAME]\n heroUlt[@cf::NAME] = translatedUlt[@cf::NAME]\n heroUlt[@cf::DESC] = translatedUlt[@cf::DESC]\n end\n pageNum += 1\n translatedFile = File.join('..', 'translatedData', \"ToTranslate_Heroes_#{pageNum}.txt\")\n end\n end",
"def merge_gap_mark_tagging_import_into_content_at(options)\n gap_mark_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir\n )\n gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(\n gap_mark_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :content_dir\n )\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|\n if gap_mark_tagging_import_file_name !~ /\\.gap_mark_tagging\\.txt\\z/\n next\n end\n\n total_count += 1\n # prepare paths\n content_at_file_name = gap_mark_tagging_import_file_name.gsub(\n gap_mark_tagging_import_base_dir, content_base_dir\n ).gsub(\n /\\.gap_mark_tagging\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(\n File.read(gap_mark_tagging_import_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_tokens = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end",
"def createAllScripts()\n\n # List of lists that pairs all play names with their Folger's acronyms\n plays = [[\"MND\", \"a_midsummer_nights_dream\"], [\"AWW\", 'alls_well_that_ends_well'], [\"Ant\", 'antony_and_cleopatra'], [\"AYL\", 'as_you_like_it'], [\"Cor\", 'coriolanus'], [\"Cym\", 'cymbeline'], \n [\"Ham\", 'hamlet'], [\"1H4\", 'henry_iv_part_1'], [\"2H4\", 'henry_iv_part_2'], [\"H5\", 'henry_v'], [\"1H6\",'henry_vi_part_1'], [\"2H6\", 'henry_vi_part_2'],\n [\"3H6\", 'henry_vi_part_3'], [\"H8\", 'henry_viii'], [\"JC\", 'julius_caesar'], [\"Jn\", 'king_john'], [\"Lr\", 'king_lear'], [\"LLL\", 'loves_labors_lost'],\n [\"Mac\", 'macbeth'], [\"MM\", 'measure_for_measure'], [\"Ado\", 'much_ado_about_nothing'], [\"Oth\", 'othello'], [\"Per\", 'pericles'], [\"R2\", 'richard_ii'], [\"R3\", 'richard_iii'], \n [\"Rom\", 'romeo_and_juliet'], [\"Shr\", 'taming_of_the_shrew'], [\"Err\", 'the_comedy_of_errors'], [\"MV\", 'the_merchant_of_venice'], [\"Wiv\", 'the_merry_wives_of_windsor'],\n [\"Tmp\", 'the_tempest'], [\"TGV\", 'the_two_gentlemen_of_verona'], [\"TNK\", 'the_two_noble_kinsmen'], [\"WT\", 'the_winters_tale'],\n [\"Tim\", 'timon_of_athens'], [\"Tit\", 'titus_andronicus'], [\"Tro\", 'troilus_and_cressida'], [\"TN\", 'twelfth_night'], [\"Ven\", 'venus_and_adonis']]\n\n index = 1\n plays.each do |play|\n text = createScript(play[0], true)\n filename = '../../edited_' + play[1] + '.html'\n File.open(filename, \"w\") {|f| f.write(text)}\n puts((index * 100 / plays.length).to_s + '% completed')\n index = index + 1\n end \nend",
"def report_files_with_subtitles(options)\n total_csv_file_count = 0\n files_with_subtitles = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n options['base-dir'] || :content_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :csv_extension\n ),\n options['file_filter'] || /\\.subtitle_markers\\.csv\\z/,\n nil,\n \"Reading subtitle marker CSV files\",\n options\n ) do |csv_file|\n total_csv_file_count += 1\n uniq_first_col_vals = csv_file.contents.scan(/^\\d+/).uniq\n if ['0'] != uniq_first_col_vals\n # File has non-zero timestamps\n file_base_name = csv_file.basename\n files_with_subtitles << file_base_name.gsub(/\\.subtitle_markers\\.csv\\z/, '.at')\n $stderr.puts \" - #{ file_base_name }\"\n end\n end\n\n summary_line = \"Found #{ files_with_subtitles.length } of #{ total_csv_file_count } CSV files with subtitles at #{ Time.now.to_s }.\"\n $stderr.puts summary_line\n report_file_path = File.join(config.base_dir(:reports_dir), 'files_with_subtitles.txt')\n File.open(report_file_path, 'w') { |f|\n f.write \"Files with subtitles\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write files_with_subtitles.join(\"\\n\")\n f.write \"\\n\"\n f.write '-' * 40\n f.write \"\\n\"\n f.write summary_line\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report files_with_subtitles`\\n\"\n }\n end",
"def process_file(file_name)\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n puts \"Processing File.... \"\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n \n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# Clean Title\n clean_title = cleanup_title(line)\n\t\t\t\t# Split title into words\n\t\t\t\tif clean_title != nil\n\t\t\t\t\t# Array of words in the title\n\t\t\t\t\twords = clean_title.split(' ', 30)\n\t\t\t\t\twords.delete(\"\")\n\t\t\t\t\t\t# For every word in the title\n\t\t\t\t\t\tfor i in 0..words.length - 1\n\t\t\t\t\t\t# \tIf word is not already in first hash as a key\n\t\t\t\t\t\t\tif !$bigrams.key?(words[i])\n\t\t\t\t\t\t\t\t# If it is not the last word in the title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# Insert first word into hash as key, with a new hash containing next word as key and 1 as value\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = {words[i+1] => 1}\n\t\t\t\t\t\t\t\t# Else it is the last word in the title\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t$bigrams[words[i]] = Hash.new\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# Else word is already in first hash \n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# If word is not the last word in title\n\t\t\t\t\t\t\t\tif words[i] != words.last\n\t\t\t\t\t\t\t\t\t# If nested hash contains second word as a key\n\t\t\t\t\t\t\t\t\tif $bigrams[words[i]].key?(words[i+1])\n\t\t\t\t\t\t\t\t\t\t# Increase value that corresponds with second word\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] += 1\n\t\t\t\t\t\t\t\t\t# Else word that follows is not in second hash\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t# Insert second word as key in second hash and set value to 1\n\t\t\t\t\t\t\t\t\t\t$bigrams[words[i]][words[i+1]] = 1\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t# Else word is last word in title, no words follow\n\t\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue => exception\n\t\tp exception.backtrace\n\t\traise\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend",
"def concat(dir_dest)\n\tDir.chdir(dir_dest)\n\tdvs_all = File.open(\"DVS_ALL.txt\", \"a\")\n\tDir.glob(\"*.{pre,PRE}*\").each do |f|\n\t\tdvs_files = File.open(f,'r')\n\t\tdvs_files.each_line{|line| dvs_all.puts line}\n\tend\n\tDir.glob(\"*.{tab,TAB}*\").each do |f|\n\t\tdvs_files = File.open(f,'r')\n\t\tdvs_files.each_line{|line| dvs_all.puts line}\n\tend\n\tdvs_all.close\nend",
"def formatted_file_list(title, source_files)\n title_id = title.gsub(/^[^a-zA-Z]+/, \"\").gsub(/[^a-zA-Z0-9\\-\\_]/, \"\")\n # Silence a warning by using the following variable to assign to itself:\n # \"warning: possibly useless use of a variable in void context\"\n # The variable is used by ERB via binding.\n title_id = title_id\n template(\"file_list\").result(binding)\n end",
"def content_fulltext(page_xml, paper_title, page_title)\n page_path = Pathname.new(@source)\n basename = page_path.basename.to_s.gsub('.xml', '')\n full_text_path =\n File.join(page_path.parent, basename, paper_title, page_title)\n full_text_file = \"#{full_text_path}/fulltext.txt\"\n FileUtils.mkdir_p full_text_path\n page_text = page_xml.xpath('pagetext').map(&:content).first.to_s\n File.open(full_text_file, \"w\") { |f| f.write(page_text) }\n full_text_file.gsub Pathname.pwd.to_s + \"/\", \"\"\n end",
"def title_processor\n\n column_titles = create_column_titles('../data/census_column_metadata.csv')\n\n processed_titles = column_titles.map { |o|\n\t\to.flatten.compact.reverse.join\n\t}\nend",
"def do_update! results\r\n\trequire 'sunflower'\r\n\ts = Sunflower.new.login\r\n\t\r\n\tbasepage = \"Wikiprojekt:Nauki medyczne/Ilustrowanie/Histologia\"\r\n\ts.summary = 'automatyczny update listy'\r\n\t\r\n\tfiles = bysize results\r\n\t\r\n\tfiles.each do |fn|\r\n\t\ttitlebit = fn.sub(/\\.txt\\Z/, '')\r\n\t\r\n\t\ttext = File.read fn\r\n\t\tp = Page.new \"#{basepage}/#{titlebit}\"\r\n\t\t\r\n\t\tif !p.pageid # page doesn't exist yet\r\n\t\t\tp.text = \"Zobacz: [[#{basepage}]].\" + \"\\n\\n\" + text\r\n\t\t\tp.save\r\n\t\t\r\n\t\t\tputs \"#{titlebit} - saved.\"\r\n\t\telse\r\n\t\t\tputs \"#{titlebit} - already there.\"\r\n\t\tend\r\n\tend\r\n\t\r\n\tp = Page.new \"#{basepage}/ignored\"\r\n\tp.text = File.read \"ignored.txt\"\r\n\tp.save\r\n\t\r\n\tputs 'ignored'\r\nend",
"def fixOriginalInput_CommunityFile()\n #check for traditional signs of an OTU table format and fix if necessary\n cRead = File.open(@communityFile, \"r\")\n line1 = cRead.gets\n line2 = cRead.gets\n cRead.close()\n\n stringCheck1 = \"\\# QIIME\\ v1.2.0\\ OTU\\ table\" \n #stringCheck1 =\"\\#Full \\OTU\\ Counts\"\n stringCheck2 = \"Consensus\\ Lineage\"\n\n headerCheckBool = 0\n otuLabelCheckBool = 0\n\n headerCheckBool = 1 if line1 =~ /#{stringCheck1}/\n otuLabelCheckBool = 1 if line1 =~ /#{stringCheck2}/ || line2 =~ /#{stringCheck2}/\n\n #if we have an OTU table that needs fixed\n #if headerCheckBool == 1 || otuLabelCheckBool == 1\n newCommFile = File.basename(@communityFile).gsub(/#{File.extname(@communityFile)}/, \"-communityFixed.dat\")\n newCommFile=\"#{outputDirectory}/#{newCommFile}\"\n w = File.open(newCommFile, \"w\") \n\n #loop through community file and output updated file\n cRead = File.open(@communityFile, \"r\")\n #ignore first line if we have a header line unique to OTU tables\n cRead.gets if headerCheckBool == 1\n \n #read through OTU table and fix the following issues:\n # -rename [0,0] to 'sites'\n # -add an 'X' to beginning of names to avoid data type issues\n # -replace -s with _s\n # -remove ' 's\n # -remove OTU tag if applicable\n \n header = cRead.gets\n headerSplit = header.split(\"\\t\")\n headerSize = headerSplit.length\n headerSize -= 1\n #add one position to header length if we do not need to subtract for\n # OTU label\n headerSize += 1 if otuLabelCheckBool == 0\n \n #print out each header value minus last value if we have OTU labels\n for pos in (0...headerSize)\n if pos == 0\n #substitute in name 'sites' at [0,0]\n w.print \"sites\"\n else\n #add 'X' in front of all header values\n sampleName = \"\\tX#{headerSplit[pos].strip}\"\n sampleName.gsub!(/\\-/, \"\")\n sampleName.gsub!(/\\ /, \"\")\n w.print sampleName\n end\n end \n w.puts\n \n #loop through remaining lines after header line\n cRead.each{ |line|\n headerSplit = line.split(\"\\t\")\n for pos in (0...headerSize)\n if pos == 0\n featureName = \"X#{headerSplit[pos]}\"\n featureName.gsub!(/\\-/, \"\")\n featureName.gsub!(/\\ /, \"\")\n w.print featureName\n else\n w.print \"\\t#{headerSplit[pos]}\" \n end \n end\n w.puts\n }\n\n cRead.close()\n w.close()\n\n #save the name of file before transposing so we can use for \n # environment file lookup\n @convertedCommunityFile = newCommFile\n\n #file to contain transposed community file\n transCommFile = newCommFile + \".tr\"\n\n #we then need to transpose this file so it will be compatable for R input\n #create matrix object from brlMatrix.rb\n matrixObject = MatrixWork.new(newCommFile, transCommFile)\n\n #store input as matrix\n commMatrix = matrixObject.file2matrix(nil)\n\n #transpose matrix\n transCommMatrix = commMatrix.t\n\n #export transposed matrix to file\n matrixObject.printMatrix(transCommMatrix, transCommFile)\n\n #update community file to updated file\n @communityFile = fep(transCommFile)\n end",
"def old_combine_notes\n notes = self.notes\n full_text = \"\"\n\n for note in notes\n full_text << \" //- \"\n full_text << note.body.strip\n # if @note != @notes[-1]\n # @full_text << \" //- \"\n # end\n end\n\n self.combined_notes = full_text\n puts self.combined_notes\n self.save \n end",
"def test_match_reference\n parser = CEdictParser.new(Rails.root.join(\"data/cedict/test_data/cedict_parser_match_reference.txt\").to_s)\n entries = parser.run\n assert_equal(6,entries.count)\n assert_equal(1,parser.reference_only_entries.count)\n \n merged_entries = parser.merge_references_into_base_entries(entries,parser.reference_only_entries)\n assert_equal(6,merged_entries.count)\n end",
"def convert_to_po( source_file_h = nil, base_file = nil, fuzzy_list = nil )\n return false unless english_header?\n\n # What we actually do depends on what was setup for us.\n # If source_file_h is nil and po_locale is nil, we are xgettext.\n # If source_file_h is nil and we have po_locale, we are msginit.\n # If we have a source_file_h, then we are msgunfmt.\n action = :msgunfmt\n action = :msginit if source_file_h.nil? && po_locale\n action = :xgettext if source_file_h.nil? && po_locale.nil?\n\n # lang_en serves as the master reference for all output, especially\n # comments and metadata.\n lang_en = PoHeaderFile.new(@@default_en)\n return false unless lang_en.source_file\n\n # untranslated_items serves as the source for *untranslated* strings.\n # This differs from lang_en in that we may overwrite some of the\n # lang_en strings from the base_file, later. This can help when\n # translating, e.g., regional formats.\n untranslated_items = lang_en.items.clone\n if base_file\n lang_base = PoHeaderFile.new(base_file)\n return false unless lang_base.source_file\n untranslated_items.merge!(lang_base.items)\n end\n\n # We will use lang_source if we have a source_file_h, i.e., msgunfmt,\n # as the source for *translated* strings.\n if source_file_h\n lang_source = PoHeaderFile.new(source_file_h)\n return false unless lang_source.source_file\n else\n lang_source = nil\n end\n\n\n # If we were given a fuzzy_list and we have a source_file, then\n # we have to mark appropriate items as fuzzy.\n if fuzzy_list && fuzzy_list.count > 0 && lang_source\n untranslated_items.each do |key, value|\n if fuzzy_list.include?(key)\n value.each_value do |v|\n v[:fuzzy] = true\n end\n end\n\n end\n end\n\n # The information in the PO header can come from a few different sources\n # depending on what we're doing.\n header_plural_forms = nil\n header_pot_line = nil\n header_translate_to = nil\n\n if action == :xgettext\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_en.plural_count}; plural=#{lang_en.plural_form}\"\n header_pot_line = \"POT-Creation-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_en.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n\n end\n if action == :msginit\n header_plural_forms = \"Plural-Forms: #{known_locales[po_locale.to_sym][:plural_form]}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = po_locale\n end\n if action == :msgunfmt\n header_plural_forms = \"Plural-Forms: nplurals=#{lang_source.plural_count}; plural=#{lang_source.plural_form}\"\n header_pot_line = \"PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n header_translate_to = lang_source.items[:TIDY_LANGUAGE]['0'][:string].tr('\"', '')\n end\n\n header_plural_count = header_plural_forms.match(/nplurals=(.*?);/i)[1].to_i - 1\n\n # We'll use this closure to perform a repetitive task in the report.\n item_output = lambda do | label, string |\n result = ''\n if string.lines.count > 1\n result << \"#{label} \\\"\\\"\\n\"\n result << \"#{string}\\n\"\n else\n result << \"#{label} #{string}\\n\"\n end\n result\n end\n\n\n report = <<-HEREDOC\nmsgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Language: #{header_translate_to}\\\\n\"\n\"#{header_plural_forms}\\\\n\"\n\"X-Generator: HTML Tidy #{File.basename($0)}\\\\n\"\n\"Project-Id-Version: \\\\n\"\n\"#{header_pot_line}\\\\n\"\n\"Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\\\n\"\n\"Language-Team: \\\\n\"\n\n HEREDOC\n\n untranslated_items.delete(:TIDY_LANGUAGE)\n untranslated_items.delete(:TIDY_MESSAGE_TYPE_LAST)\n untranslated_items.each do |key, value|\n\n if value['0'][:comment]\n value['0'][:comment].each_line { |line| report << \"#. #{line.strip}\\n\"}\n end\n\n attribs = []\n attribs << 'fuzzy' if value['0'][:fuzzy] && action == :msgunfmt\n attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) }\n if attribs.count > 0\n report << \"#, #{attribs.join(', ')}\\n\"\n end\n\n report << \"msgctxt \\\"#{key.to_s}\\\"\\n\"\n\n # Handle the untranslated strings, with the possibility that there\n # are two forms. PO/POT is English-based and supports only a singular\n # and plural form.\n value.each_value do | subitem |\n label = subitem[:case] == '0' ? 'msgid' : 'msgid_plural'\n report << item_output.(label, subitem[:string])\n end\n\n # Handle translated strings, with the possibility that there\n # are multiple plural forms for them.\n en_is_singular = value.count == 1\n\n if lang_source && lang_source.items[key]\n # Print translated strings.\n if en_is_singular\n report << item_output.( 'msgstr', lang_source.items[key]['0'][:string])\n else\n # Print available plural forms and write blanks for the rest.\n (0..header_plural_count).each do |i|\n if lang_source.items[key].has_key?(i.to_s)\n report << item_output.( \"msgstr[#{i}]\", lang_source.items[key][i.to_s][:string])\n else\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n else\n # Print empty translated strings.\n if en_is_singular\n report << \"msgstr \\\"\\\"\\n\"\n else\n (0..header_plural_count).each do |i|\n report << \"msgstr[#{i}] \\\"\\\"\\n\"\n end\n end\n end\n\n report << \"\\n\"\n end # do\n\n if emacs_footer\n report << <<-HEREDOC\n# Local Variables:\n# mode: po\n# eval: (add-hook 'po-subedit-mode-hook '(lambda () (setq fill-column 78)))\n# End:\n HEREDOC\n end\n\n output_file = action == :xgettext ? 'tidy.pot' : \"language_#{header_translate_to}.po\"\n if File.exists?(output_file)\n File.rename(output_file, safe_backup_name(output_file))\n end\n File.open(output_file, 'w') { |f| f.write(report) }\n @@log.info \"#{__method__}: Results written to #{output_file}\"\n puts \"Wrote a new file to #{File.expand_path(output_file)}\"\n true\n end",
"def test_participant_names\n\t\tnames = []\n\t\tfile.each_with_pagename do |name, sheet|\n\t\t\tnext if name =~/Totaal/\n\n\t\t\t\tpart = sheet.cell(3,3) || \"\"\n\t\t\t\tif part.blank?\n\t\t\t\t\tbyebug\n\t\t\t\telse\n\t\t\t\t\tpart = part.strip.downcase\n\t\t\t\t\tnames.push part\n\n\t\t\t\tend\n\n\t\tend\t\n\n\t\tnames.map{|x| x.strip.downcase}.uniq.sort\t\n\tend",
"def humongous_sort\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n end",
"def reload_rh_texts\n langs = Dir[\"Data/Text/Dialogs/#{CSV_BASE}.*.dat\"].collect { |i| i.match(/[0-9]+\\.([a-z]+)\\.dat$/).captures[0] }\n if langs.empty? ||\n File.mtime(\"Data/Text/Dialogs/#{CSV_BASE}.#{langs.first}.dat\") < File.mtime(\"Data/Text/#{langs.first}.dat\")\n langs << GamePlay::Load::DEFAULT_GAME_LANGUAGE if langs.empty?\n log_debug('Updating Text files')\n filename = 'plugins/text2csv' # Just to avoid the warning\n require filename\n Available_Langs.clear\n Available_Langs.concat(langs)\n log_debug('Compiling Text files')\n compile\n end\n end",
"def titles\n urls.each do |url|\n @titles << Nokogiri::HTML(open(url)).css('title')[0].text\n end\n @titles\n end",
"def file_title(title)\n title.downcase.gsub(/\\s+/, '-').gsub(/-{2,}/, '-').gsub(':', '')\nend",
"def name_merge hsh\n str = \"\"\n @log.debug \"name merge for #{hsh}\"\n str += hsh[:name].strip.force_encoding(\"UTF-8\") if hsh[:name]\n str += \"\\n#{hsh[:description].strip.force_encoding(\"UTF-8\")}\" if hsh[:description]\n str\n end",
"def contentReport(psdFiles)\n textData = Array.new\n\n psdFiles.each do |psdFile|\n name = File.basename(psdFile)\n PSD.open(psdFile) do |psd|\n puts \"\\n[ #{name} ] Text Content =================================== \\n\\n\"\n psd.layers.each do |layer|\n textRaw = layer.adjustments[:type]\n textString = textRaw.to_s()\n if textString == \"\"\n else\n textData.push(\"\\n#{textString}\\n\")\n end\n end\n end\n textDataClean = textData.uniq\n textDataClean.each do |d|\n puts d\n end\n end\nend",
"def analyze_text\n reset_analyzed\n @renames = {}\n @names = {}\n\n Dir.chdir(@dir) do\n if Dir.glob('*').length == 0\n @errors.add(:structure, \"No files found in directory: '#{@dir}'.\")\n return\n end\n end\n\n Dir.foreach(@dir) do |f|\n next if (f == '.' || f == '..')\n\n @errors.add(:structure, \"error: found a subdirectory. cannot process.\") if File.directory?(f)\n\n i = Nyudl::Text::Filename.new(f, @prefix, @options)\n\n @errors.add(:unrecognized, \"#{File.join(@dir,i.fname)}\") unless i.recognized?\n\n # only add to hash if rename is required\n @renames[i.newname] = i if i.rename?\n @names[i.newname] = i\n end\n set_analyzed\n end",
"def load_translations_and_collect_file_errors(files); end",
"def sort_file\n File.open(file_name) do |line|\n line.each do |x|\n puts \"#{x.to_textual}\"\n end\n end\n end",
"def fix_title t\n # remove .html\n t1 = t.sub(/\\.html$/,'')\n # add /wiki/ unless it exists\n if t1.index(\"/wiki/\")\n return t1\n end\n return \"/wiki/\" + t.sub(/\\.html$/,'')\nend",
"def fix_title t\n # remove .html\n t1 = t.sub(/\\.html$/,'')\n # add /wiki/ unless it exists\n if t1.index(\"/wiki/\")\n return t1\n end\n return \"/wiki/\" + t.sub(/\\.html$/,'')\nend",
"def titleize line\n \n separate_words = line.split\n \n # if there is only one word in the title\n # return title cased word \n if separate_words.count == 1\n return separate_words[0][0].upcase + separate_words[0].chars.drop(1).join\n end\n \n # for more than one word\n # convert first word into title case\n # irrespective of what the word is e.g., the, and over \n first_word = separate_words[0]\n separate_words[0].replace(first_word[0].upcase + first_word.chars.drop(1).join) \n\n separate_words.each do |word|\n if word != \"and\" and word != \"the\" and word != \"over\" # do not title case these words \n word.replace(word[0].upcase + word[1..word.size])\n end \n end\n separate_words.join(\" \")\nend",
"def run\n load_the_file\n word_frequency\n match_the_word\n end",
"def create_text\n $game_text = {}\n text = {}\n key = \"\"\n SES::ExternalText::Languages.each do |l|\n $game_text.clear\n SES::ExternalText.each_file(\"Data/Text/#{l}\") do |f|\n File.open(f, \"r:BOM|UTF-8\") do |file|\n file.readlines.each_with_index do |v,i|\n next if v =~ /(^\\s*(#|\\/\\/).*|^\\s*$)/\n SES::ExternalText::Tags.each_pair do |k,p|\n if v =~ k\n p.call(*$~[1..-1])\n v.clear\n end\n end\n if SES::ExternalText.key && !v.empty?\n v = \"\\n#{v}\" unless $game_text[SES::ExternalText.key][1].empty?\n $game_text[SES::ExternalText.key][1] << v\n end\n end\n end\n end\n File.open(\"Data/#{l}.rvdata2\", \"w\") do |file|\n Marshal.dump($game_text, file)\n end\n end\n end",
"def to_text\n ocr_files.map do |resource|\n url = full_text_url(resource['id'])\n content = full_text_content(url)\n if xml_ocr_types.include?(resource['mimetype'])\n alto_xml_string_content(content)\n elsif html_ocr_types.include?(resource['mimetype'])\n hocr_string_content(content)\n else # plain text\n content.scrub.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?').gsub(/\\s+/, ' ')\n end\n end\n end",
"def find_apf( path_and_file = self.file_name_and_contents.path_and_file)\n match_apf = []\n regexp = /^t([^ \\#]+)( *$| )/\n File_name_and_contents.new( path_and_file ).contents.each do |line|\n if line.match(regexp) != nil\n if line.match(regexp)[1] != nil \n match_apf << ( self.file_name_and_contents.path_and_file.sub(/\\/.+/, '') + '/' + line.match(regexp)[1].chomp + '.apf' ) \n end\n end\n end\n match_apf\n end",
"def transform_links_in_files files\n files.each do |filename|\n text = File.read filename\n content = transform_links_in_text text\n File.open(filename, \"w\") { |file| file << content }\n end\n end",
"def get_orgs(type)\r\n dir = File.dirname(__FILE__)\r\n files = Dir.glob(\"#{dir}/#{type}/*.org\").sort\r\n file_info = files.map do |file|\r\n File.open(file) do |f|\r\n fname = file.split(\"/\")[-1]\r\n org = Orgmode::Parser.new(f.read)\r\n title = org.lines.map do |slide|\r\n if slide.match(/\\#\\+title\\:*/)\r\n slide.gsub(/\\#\\+title\\: /, \"\")\r\n else\r\n fname\r\n end\r\n end\r\n {fname: fname, title: title.compact[0]}\r\n end\r\n end\r\nend",
"def substituteTitles(post, toc_title)\n items = Array.new\n\n post.content.gsub!(/h(\\d)\\. (\\S+[ \\S]*)/) do |r|\n level = $1\n title = $2\n link_text = title.gsub(/[_*]/, \"\") # title: bla *bla* => bla_bla\n id = link_text.gsub(/\\W+/, \"_\").gsub(/[\\W_]+$/, '') # title Bla?_bla*blbla => Bla_bla_blbla\n items << { :link_text => link_text, :level => level.to_i, :id => id }\n \"h#{level}(##{id}). #{title}\"\n end\n self.process_toc(post, items, toc_title)\n end",
"def import\n podcast_list = [\n [ \"Radiolab\", \"The incredible, little-known story of the Nazi prisoners of war kept on American soil during World War II.\", \"Nazi Summer Camp\", \"https://media2.wnyc.org/i/819/1125/l/80/1/potter.png\", \"http://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/radiolab_podcast/radiolab_podcast15nazicamp.mp3\", \"http://www.radiolab.org/story/nazi-summer-camp/\" ],\n [ \"Radiolab\", \"Highlights from a live Radiolab performance about hearts, driving forces, and the people we love - including a final conversation with Dr. Oliver Sacks.\", \"Radiolab Live: Tell-Tale Hearts featuring Oliver Sacks\", \"https://media2.wnyc.org/i/620/372/c/80/1/BAM.jpg\", \"http://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/radiolab/radiolab051315.mp3\", \"http://www.radiolab.org/story/radiolab-live-telltale-hearts-featuring-oliver-sacks/\" ],\n [ \"Radiolab\", \"Photojournalist Lynsey Addario captured something that happens all the time but few of us get to see, a soldier fatally wounded on the battlefield.\", \"Sight Unseen\", \"https://media2.wnyc.org/i/620/372/c/80/1/Addario.jpg\", \"http://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/radiolab_podcast/radiolab_podcast15sightunseen.mp3\", \"http://www.radiolab.org/story/sight-unseen/\" ],\n [ \"Radiolab\", \"Producer Briana Breen and the podcast Love + Radio bring us a story about a very eventful year in the life of an accidental voyeur.\", \"The Living Room\", \"https://media2.wnyc.org/i/620/372/l/80/1/351123047_b91fe7e6ff_o.jpg\", \"http://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/radiolab_podcast/radiolab_podcast15thelivingroom.mp3\", \"http://www.radiolab.org/story/living-room/\" ],\n ]\n\n podcast_list.each do |title, description, episode, image_file_location, audio_file_location, url|\n podcast = Podcast.create(title: title, description: description, episode: episode, image_file_location: image_file_location, audio_file_location: audio_file_location, url: url)\n\n associate_to_user(ASSOCIATED_USER,podcast)\n end\n end",
"def titleize_proper_names\n self.author = self.author.titleize\n self.editor = self.editor.titleize if self.editor\n self.buyed_from = self.buyed_from.titleize if self.buyed_from\n end",
"def read_files\r\n @prefixes = IO.read('prefixes.txt').split(' ')\r\n @syllables = IO.read('syllables.txt').split(' ')\r\n @postfixes = IO.read('postfixes.txt').split(' ')\r\n end",
"def full_title\n ti = title_values&.first\n st = subtitle_values&.first\n if ti && st\n # Remove the automatically-appended subtitle (in the case of search\n # results entries).\n ti = ti.delete_suffix(st).rstrip.delete_suffix(':')\n # Append the subtitle only if it doesn't appear to already be included in\n # the base title itself.\n ti = \"#{ti}: #{st}\" unless significant(ti).include?(significant(st))\n end\n ti || st || '???'\n end",
"def sort_sections\n titles = @sections.map { |title, _| title }\n\n if titles.length > 1 and\n TOMDOC_TITLES_SORT ==\n (titles | TOMDOC_TITLES).sort_by { |title| title.to_s } then\n @sections.values_at(*TOMDOC_TITLES).compact\n else\n @sections.sort_by { |title, _|\n title.to_s\n }.map { |_, section|\n section\n }\n end\n end",
"def init_textuals\n set_content_type\n return if image?\n\n if source_from != 'google_drive'\n\n yomu = Yomu.new (Rails.env.production? ? document.url : document.path)\n\n if !yomu.nil?\n text = yomu.text\n text_utf8 = text.force_encoding(\"UTF-8\")\n self.update_columns(file_content_text: text_utf8)\n yomu = nil\n end\n end\n\n # Prioritize markdown.\n if self.file_content_md\n markdown_to_html_and_text\n elsif self.file_content_html\n clean_html if self.source_from == 'google_drive'\n html_to_markdown\n html_to_plain\n elsif self.file_content_text\n text_to_md\n text_to_html\n elsif self.image?\n # do nothing\n else\n errors.add(\"There is no textual content for work id: #{self.id}\")\n end\n make_diffs\n self.delay(:queue => 'preview_maker', priority: 20).create_preview_png\n end",
"def fill_in_missing_transcriptions\n text=\" \\n\"\n empty_items=self.master_files.where(:transcription_text => nil)\n if empty_items.count > 0\n empty_items.each do |item|\n item.transcription_text=text unless item.transcription_text\n item.save! \n item.reload\n if item.exists_in_repo?\n Fedora.add_or_update_datastream(item.transcription_text, item.pid,\n 'transcription', 'Transcription', :contentType => 'text/plain',\n :mimeType => 'text/plain', :controlGroup => 'M')\n end\n end\n end\n end",
"def headline_for_solr\n \treturn FinderHelper.strip(headline) if archived == true\n end",
"def parse_html_files\n Find.find(Dir.getwd) do |file|\n if !File.directory? file and File.extname(file) == '.html'\n # exclude and skip if in a bad directory\n # we may be on an html file, but some we just do not want\n current = File.new(file).path\n\n # skip these folders entirely\n if current.match(/(blog|old|draft|archive|font)/i)\n next\n end\n\n # open file, pluck content out by its element(s)\n page = Nokogiri::HTML(open(file));\n\n # grab title\n title = page.css('title').text.to_s;\n title = strip_bad_chars(title)\n\n # for page title, destroy any pipes and MS pipes and return the first match\n title.sub!('Velir | ', '')\n\n # Grab hero title and tagline\n hero = page.css('article.type-centered h2').text\n hero_tagline = page.css('article.type-centered .type-hero').text\n\n # grab the body content\n body = page.css('.outer-wrapper .row .columns').to_html\n body = clean_body(body)\n\n # clean the file path\n path = File.new(file).path\n path.gsub! $base_path, \"/\"\n\n # if we have content, add this as a page to our page array\n if (body.length > 0)\n $count += 1\n puts \"Processing \" + title\n\n # insert into array\n data = {\n 'title' => title,\n 'path' => path,\n 'hero' => hero,\n 'hero_tagline' => hero_tagline,\n 'body' => body,\n }\n\n $pages.push data\n end\n end\n end\n\n write_csv($pages)\n report($count)\nend",
"def load_vocab_translations\n pp_nl_serialized = File.read(\"#{$filepath_nl}alle danyvertalingen qff export.json\")\n pp_nl = JSON.parse(pp_nl_serialized)\n\n #orgins of words: passaporte (and chapter) or other\n construct_book_origins(pp_nl[\"folders\"])\n \n #saving the words to the database with reference to passaporte_words\n pp_nl[\"words\"].each do |ppnl_line|\n word_pt_raw = ppnl_line[\"word\"]\n word_pt_split = Translation.split_article_front(word_pt_raw)\n word_pt = word_pt_split[:word]\n genre_pt = word_pt_split[:article]\n # puts \"for word_pt_split: #{word_pt_split}\"\n passaporte_found = passaporte_unit?(word_pt_split)\n # puts \"found?:\"\n # puts passaporte_found\n pt_translation = nil\n if !passaporte_found.nil?\n pt_transl = Translation.find_by word_pt:word_pt_split[:word], genre_pt:word_pt_split[:article]\n # puts pt_transl\n end\n # puts \"pt_transl:\"\n # puts pt_transl\n translation_array = ppnl_line[\"translations\"]\n save_nl_translation(word_pt, pt_transl, genre_pt,translation_array, ppnl_line[\"comments\"])\n end\nend",
"def extract_work_title_display\n \ttitle_display_array = {}\n self.find_by_terms(:vra_work,:titleSet,:titleSet_display).each do |title_display|\n ::Solrizer::Extractor.insert_solr_field_value(title_display_array, \"title_display_tesim\", title_display.text) \n end\n return title_display_array\n end",
"def merge(fulltext_reader)\n fulltext_reader.dump_data do |data|\n @io.write data \n end\n end",
"def fix_convert_abbreviations_to_lower_case(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.(at|pt|txt)\\z/i,\n \"Converting abbreviations to lower case\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::ConvertAbbreviationsToLowerCase.fix(contents, filename)\n [outcome]\n end\n end",
"def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end",
"def add_file_characterization_to_all_basic_files\n logger = Logger.new(STDOUT)\n logger.level = Logger::INFO\n logger.datetime_format = \"%H:%M:%S\"\n bfs = BasicFile.all\n bfs.each do |bf|\n if bf.datastreams['fitsMetadata1'].nil?\n logger.info \"No FITS datastream found for #{bf.pid}, going to add one...\"\n #need to create a new temp file using the content from the datastream\n temp_file = File.new('temp_content_file', 'w+')\n begin\n temp_file.puts bf.content.content\n rescue StandardError => re\n logger.error 'Got error writing BasicFile contents to file'\n logger.error re.to_s\n if re.to_s.match 'from ASCII-8BIT to UTF-8'\n logger.info 'ASCII file detected'\n temp_file.puts bf.content.content.force_encoding('UTF-8')\n end\n end\n #temp_file.puts bf.content.content.force_encoding('UTF-8')\n\n f = ActionDispatch::Http::UploadedFile.new(filename: bf.content.label, type: bf.content.profile['dsMIME'], tempfile: temp_file)\n\n begin\n logger.info 'Generating FITS metadata XML'\n fitsMetadata = Hydra::FileCharacterization.characterize(f, f.original_filename, :fits)\n rescue Hydra::FileCharacterization::ToolNotFoundError => tnfe\n logger.error tnfe.to_s\n abort 'FITS tool not found, terminating, check FITS_HOME environment variable is set and FITS is installed'\n rescue RuntimeError => re\n logger.error 'Something went wrong with extraction of file metadata using FITS'\n logger.error re.to_s\n abort 'FITS tool not found, terminating, check FITS_HOME environment variable is set and FITS is installed'\n end\n fitsDatastream = ActiveFedora::OmDatastream.from_xml(fitsMetadata)\n fitsDatastream.digital_object = bf.inner_object\n\n bf.add_datastream(fitsDatastream, {:prefix => 'fitsMetadata'})\n bf.save\n logger.info 'FITS metadata datastream added, tidying up resources used'\n temp_file.close\n FileUtils.remove_file 'temp_content_file'\n logger.info \"Finished adding FITS metadata for #{bf.pid}\"\n logger.info '********************************************'\n end\n end\n end",
"def multi_source_text_check(texts)\n texts.each do |text|\n page_text = $driver.page_source\n page_text.gsub!(/<[^>]*>/, '')\n page_text.gsub!(/\\s+/, ' ')\n page_text.should include( text )\n print \".\"\n end\n end"
] | [
"0.68886334",
"0.5963178",
"0.58270115",
"0.57796055",
"0.56616473",
"0.5658089",
"0.5650263",
"0.56049395",
"0.55702674",
"0.5556202",
"0.5552666",
"0.55489075",
"0.55408376",
"0.5492955",
"0.54602766",
"0.54545224",
"0.5394314",
"0.5377122",
"0.5366659",
"0.53440577",
"0.5342507",
"0.534206",
"0.5336537",
"0.533303",
"0.5329376",
"0.5324449",
"0.53183055",
"0.53054595",
"0.53005135",
"0.52925056",
"0.5279441",
"0.52586997",
"0.5200845",
"0.5187658",
"0.518748",
"0.5177252",
"0.51735926",
"0.51707983",
"0.5169213",
"0.5168501",
"0.5152159",
"0.5135589",
"0.5131639",
"0.5131585",
"0.51160806",
"0.5111687",
"0.51065356",
"0.5094112",
"0.50856763",
"0.5082844",
"0.50661385",
"0.50411314",
"0.5040141",
"0.50331557",
"0.50305194",
"0.5028059",
"0.5026599",
"0.5018694",
"0.50093156",
"0.5002976",
"0.5002805",
"0.5002489",
"0.49991676",
"0.49868742",
"0.49827772",
"0.4967278",
"0.49562708",
"0.4954178",
"0.4952677",
"0.49432665",
"0.49419615",
"0.49384898",
"0.49380141",
"0.49331924",
"0.49327525",
"0.49327525",
"0.49234548",
"0.4918528",
"0.49146166",
"0.49129435",
"0.4912388",
"0.4908919",
"0.4907096",
"0.49066567",
"0.49031943",
"0.4902022",
"0.4900548",
"0.48999694",
"0.48970267",
"0.48927462",
"0.4885295",
"0.48668876",
"0.486497",
"0.48568705",
"0.48465082",
"0.4844934",
"0.4839245",
"0.48287308",
"0.48273447",
"0.48264793"
] | 0.74505836 | 0 |
Uses either idml_imported (preference) or folio_imported (fallback) at for content. NOTE: this duplicates a lot of code from merge_record_marks_from_folio_xml_at_into_idml_at | def merge_use_idml_or_folio(options)
input_folio_base_dir = config.compute_base_dir(
options['base-dir'] || options['base-dir-1'] || :folio_import_dir
)
input_idml_base_dir = config.compute_base_dir(
options['base-dir-2'] || :idml_import_dir
)
input_file_selector = config.compute_file_selector(
options['file-selector'] || :all_files
)
input_file_extension = config.compute_file_extension(
options['file-extension'] || :at_extension
)
output_base_dir = config.base_dir(:staging_dir)
$stderr.puts ''
$stderr.puts '-' * 80
$stderr.puts 'Using either idml_at or folio_at for content_at'
start_time = Time.now
total_count = 0
success_count = 0
idml_used_count = 0
folio_used_count = 0
# TODO: refactor this method to use Cli::Utils so that the changed-only flag works
# First get union of all Folio and Idml files
folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)
idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)
all_output_files = (folio_files + idml_files).map { |e|
# process folio files
e = e.gsub(input_folio_base_dir, output_base_dir)
.gsub(/\.folio\.at\z/, '.at')
# process idml files
e = e.gsub(input_idml_base_dir, output_base_dir)
.gsub(/\.idml\.at\z/, '.at')
}.uniq.sort
all_output_files.each do |output_file_name|
if output_file_name !~ /\.at\z/
$stderr.puts " - Skip #{ output_file_name }"
next
end
total_count += 1
# prepare paths
at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\.at\z/, '.folio.at')
at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\.at\z/, '.idml.at')
if File.exist?(at_idml_file_name)
# Idml is present, use it
FileUtils.mkdir_p(File.dirname(output_file_name))
idml_at = File.read(at_idml_file_name)
# write to file
File.write(output_file_name, idml_at)
success_count += 1
idml_used_count += 1
$stderr.puts " Use #{ at_idml_file_name }"
elsif File.exist?(at_folio_file_name)
# IDML file is not present, bt folio is, use it
FileUtils.mkdir_p(File.dirname(output_file_name))
folio_at = File.read(at_folio_file_name)
# write to file
File.write(output_file_name, folio_at)
success_count += 1
folio_used_count += 1
$stderr.puts " Use #{ at_folio_file_name }"
else
raise "Could find neither Folio nor IDML file! (#{ output_file_name })"
end
end
$stderr.puts "Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds."
$stderr.puts " - IDML files used: #{ idml_used_count }"
$stderr.puts " - Folio files used: #{ folio_used_count }"
$stderr.puts '-' * 80
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_folio_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :folio_import_dir\n )\n input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = config.base_dir(:staging_dir)\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :record_mark tokens from folio_at into idml_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n idml_not_present_count = 0\n folio_not_present_count = 0\n\n # First get union of all Folio and Idml files\n folio_files = Dir.glob([input_folio_base_dir, input_file_selector, input_file_extension].join)\n idml_files = Dir.glob([input_idml_base_dir, input_file_selector, input_file_extension].join)\n all_output_files = (folio_files + idml_files).map { |e|\n # process folio files\n e = e.gsub(input_folio_base_dir, output_base_dir)\n .gsub(/\\.folio\\.at\\z/, '.at')\n # process idml files\n e = e.gsub(input_idml_base_dir, output_base_dir)\n .gsub(/\\.idml\\.at\\z/, '.at')\n }.uniq.sort\n all_output_files.each do |output_file_name|\n if output_file_name !~ /\\.at\\z/\n $stderr.puts \" - Skip #{ output_file_name }\"\n next\n end\n\n total_count += 1\n\n # prepare paths\n at_folio_file_name = output_file_name.gsub(output_base_dir, input_folio_base_dir).gsub(/\\.at\\z/, '.folio.at')\n at_idml_file_name = output_file_name.gsub(output_base_dir, input_idml_base_dir).gsub(/\\.at\\z/, '.idml.at')\n\n if File.exist?(at_folio_file_name) && File.exist?(at_idml_file_name)\n # Both files are present, merge tokens\n begin\n at_folio = File.read(at_folio_file_name)\n at_idml = File.read(at_idml_file_name)\n at_with_merged_tokens = Repositext::Process::Merge::RecordMarksFromFolioXmlAtIntoIdmlAt.merge(\n at_folio, at_idml\n )\n # write to file\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge rids from #{ at_folio_file_name }\"\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ at_folio_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n elsif File.exist?(at_folio_file_name)\n # IDML file is not present, use Folio import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_folio_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n idml_not_present_count += 1\n $stderr.puts \" Use #{ at_folio_file_name }\"\n elsif File.exist?(at_idml_file_name)\n # Folio file is not present, use Idml import as authority\n FileUtils.mkdir_p(File.dirname(output_file_name))\n at_with_merged_tokens = File.read(at_idml_file_name)\n # write to file\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n folio_not_present_count += 1\n $stderr.puts \" Use #{ at_idml_file_name }\"\n else\n raise \"Could find neither Folio nor IDML file! (#{ output_file_name })\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts \" - Folio files not present: #{ folio_not_present_count }\"\n $stderr.puts \" - IDML files not present: #{ idml_not_present_count }\"\n $stderr.puts '-' * 80\n end",
"def idml_import_consistent?(idml_import_at_file, content_at_file)\n idml_import_at_doc = Kramdown::Document.new(\n idml_import_at_file.contents,\n :input => 'KramdownRepositext'\n )\n content_at_doc = Kramdown::Document.new(\n content_at_file.contents,\n :input => 'KramdownRepositext'\n )\n\n idml_import_at_plain_text = idml_import_at_doc.to_plain_text\n content_at_plain_text = content_at_doc.to_plain_text\n\n # A.D., A.M., and B.C. are lower cased after record ids were merged\n # as part of the import command. We lower case them in both to\n # avoid getting validation errors from this.\n idml_import_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n idml_import_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n idml_import_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n content_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n content_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n content_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n\n diffs = Suspension::StringComparer.compare(idml_import_at_plain_text, content_at_plain_text)\n\n if diffs.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n diffs.map { |diff|\n Reportable.error(\n {\n filename: content_at_file.filename,\n corr_filename: idml_import_at_file.filename,\n },\n ['Plain text diference between idml_import_at and content_at', diff]\n )\n }\n )\n end\n end",
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def import_xml_common(ent, node)\n REXML::XPath.each(node, \"./ctx:identifier\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"}) do |id|\n ent.add_identifier(id.get_text.value) if id and id.has_text?\n end\n\n priv = REXML::XPath.first(node, \"./ctx:private-data\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n ent.set_private_data(priv.get_text.value) if priv and priv.has_text?\n\n ref = REXML::XPath.first(node, \"./ctx:metadata-by-ref\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n if ref\n reference = {}\n ref.to_a.each do |r|\n if r.name == \"format\"\n reference[:format] = r.get_text.value if r.get_text\n else\n reference[:location] = r.get_text.value\n end\n end\n ent.set_reference(reference[:location], reference[:format])\n end\n end",
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def imports\n return @imports if @imports\n if import&.attached? &&\n (self.import_contents = import.download rescue nil)\n line_hash = { }\n import_contents.split(\"\\n\").each { |line|\n fields = line.split \"\\t\"\n next if (title = fields.first.strip.gsub /\\s+/, ' ').blank?\n line_hash[title] = fields[1..-1]\n }\n titles = line_hash.keys\n titles -=\n ListItem.where(list_type_id: import_type_id,\n user_id: id,\n title: titles).pluck :title\n @imports = titles.collect { |title|\n ListItem.new(\n list_type_id: import_type_id,\n user_id: id,\n title: title\n ).import line_hash[title]\n }\n end\n end",
"def import_opml\n respond_to do |wants|\n wants.xml do\n @feeds = []\n if params[:opml]\n @feeds = params[:opml].feeds.map do |f|\n feed = Feed.find_or_create_by_url(f.xmlUrl)\n feed.created_by = params[:created_by] if !params[:created_by].nil?\n feed.title = f.title if f.title and feed.title.nil?\n feed.save\n feed\n end\n else\n logger.debug(\"import_opml called without opml file\")\n end\n render :xml => @feeds.to_xml\n end\n end\n end",
"def override_content_type_and_save_info\n case File.extname(file.file).delete('.').to_sym\n when :xlsx\n file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n when :docx\n file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n when :pptx\n file.content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n end\n\n # if File.extname(file.file).delete('.').to_sym == :xlsx\n # file.content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n # end\n # if File.extname(file.file).delete('.').to_sym == :docx\n # file.content_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n # end\n # if File.extname(file.file).delete('.').to_sym == :pptx\n # file.content_type='application/vnd.openxmlformats-officedocument.presentationml.presentation'\n # end\n\n model.file_content_type = file.content_type if file.content_type\n model.file_size = number_to_human_size(file.size) if file.size\n\n tmp_file = file.path\n photo = MiniExiftool.new \"#{tmp_file}\"\n\n model.latitude = dms_to_float(photo.gpslatitude) if photo && photo.gpslatitude\n model.longitude = dms_to_float(photo.gpslongitude) if photo && photo.gpslongitude\n model.photo_created_at = photo.createdate if photo && photo.createdate\n end",
"def merge_gap_mark_tagging_import_into_content_at(options)\n gap_mark_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir\n )\n gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern(\n gap_mark_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(\n options['base-dir-2'] || :content_dir\n )\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :gap_mark tokens from gap_mark_tagging_import into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(gap_mark_tagging_import_glob_pattern).each do |gap_mark_tagging_import_file_name|\n if gap_mark_tagging_import_file_name !~ /\\.gap_mark_tagging\\.txt\\z/\n next\n end\n\n total_count += 1\n # prepare paths\n content_at_file_name = gap_mark_tagging_import_file_name.gsub(\n gap_mark_tagging_import_base_dir, content_base_dir\n ).gsub(\n /\\.gap_mark_tagging\\.txt\\z/, '.at'\n )\n output_file_name = content_at_file_name\n\n begin\n outcome = Repositext::Process::Merge::GapMarkTaggingImportIntoContentAt.merge(\n File.read(gap_mark_tagging_import_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_tokens = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_tokens)\n success_count += 1\n $stderr.puts \" + Merge :gap_marks from #{ gap_mark_tagging_import_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ gap_mark_tagging_import_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def import_shared_steps(options)\n merge_record_marks_from_folio_xml_at_into_idml_at(options)\n fix_adjust_merged_record_mark_positions(options)\n fix_convert_abbreviations_to_lower_case(options) # run after merge_record_marks...\n move_staging_to_content(options)\n sync_from_at(options)\n options['report_file'] = config.compute_glob_pattern(\n 'content_dir/validation_report_file'\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_shared_steps')\n validate_content(options)\n end",
"def alignmentMarkerLoad(inhash)\n \n log_info 'inhash', inhash # 1, 0\n if inhash[:sampleTypes] == 'DNA'\n alignment_markers = find(:item, sample: { name: MARKERS[inhash[:type_ind]][inhash[:cutoff_ind]] })\n elsif inhash[:sampleTypes] == 'RNA'\n alignment_markers = find(:item, { sample: { name: MARKERS[inhash[:type_ind]] } } )\n end\n log_info 'alignment marker ', alignment_markers\n alignment_marker=-1\n if(!(alignment_markers.nil?))\n alignment_marker=alignment_markers[0] \n end\n log_info 'alignment_marker', alignment_marker\n # marker currently in machine (location)\n # marker_in_analyzer = find(:item, object_type: { name: \"Stripwell\" })\n # .find { |s| s.datum[:matrix][0][0] == alignment_marker.sample.id && s.location == \"Fragment analyzer\"} # old version\n \n # TODO: use check_alignment_marker function\n marker_in_analyzer = find(:item, object_type: {name: \"Stripwell\"}).find {|s| s.location == 'Fragment analyzer'}\n \n # is requested marker different from marker in machine?\n different_marker =! (alignment_markers.include?(marker_in_analyzer))\n \n # old marker?\n old_marker=( (marker_in_analyzer.get(:begin_date) ? (Date.today - (Date.parse marker_in_analyzer.get(:begin_date)) >= 7) : true) )\n \n # need to replace? \n marker_needs_replacing = (old_marker) || (different_marker)\n \n # new alignment marker\n alignment_marker_stripwell = find(:item, object_type: { name: \"Stripwell\" })\n .find { |s| collection_from(s).matrix[0][0] == alignment_marker.sample.id &&\n s != marker_in_analyzer }\n \n if(debug) \n show do\n title \"DEBUG\"\n note \"marker_in_analyzer=#{marker_in_analyzer}\"\n note \"different marker = #{different_marker}\"\n note \"marker_needs_replacing = #{marker_needs_replacing}\"\n note \"looking for #{MARKERS[inhash[:type_ind]][inhash[:cutoff_ind]]}\"\n note \"alignment_marker_stripwell = #{alignment_marker_stripwell}\"\n end\n end\n\n # replace alignment marker\n if(marker_needs_replacing && alignment_marker_stripwell) \n show do\n title \"Place stripwell #{alignment_marker_stripwell} in buffer array\"\n note \"Move to the fragment analyzer.\"\n note \"Open ScreenGel software.\"\n check \"Click on the <b>Load Position</b> icon.\"\n check \"Open the sample door and retrieve the buffer tray.\"\n warning \"Be VERY careful while handling the buffer tray! Buffers can spill.\"\n if old_marker\n check \"Discard the current alignment marker stripwell (labeled #{marker_in_analyzer}).\"\n end\n check \"Place the alignment marker stripwell labeled #{alignment_marker_stripwell} in the MARKER 1 position of the buffer array.\"\n image \"make_marker_placement\"\n check \"Place the buffer tray in the buffer tray holder\"\n image \"make_marker_tray_holder\"\n check \"Close the sample door.\"\n end\n alignment_marker_stripwell.location = \"Fragment analyzer\"\n alignment_marker_stripwell.save\n if(old_marker) # replaced because old one was outdated\n alignment_marker_stripwell.associate :begin_date, Date.today.strftime \n alignment_marker_stripwell.save\n release [alignment_marker_stripwell] \n marker_in_analyzer.mark_as_deleted # trash outdated marker\n else # move current marker to SF2 (small fridge 2)\n marker_in_analyzer.location = \"SF2\"\n marker_in_analyzer.save\n end\n end\n end",
"def import_initial_lines(type)\n @initial_lines.each do |initial_line|\n import_lines(type, initial_line[:file_name]) unless (initial_line[:type] != type ||\n initial_line[:file_name].nil?)\n end\n @initial_lines.delete_if do |il|\n il.has_key?(:file_name) && il[:type] == type\n end # Remove all imported lines\n end",
"def no_classification_conflict(uploaded_file, obj, to_save)\n if obj.respond_to?(:stix_id)\n original_id = obj.stix_id.include?(Setting.READ_ONLY_EXT) ? obj.stix_id.slice(0, obj.stix_id.length - Setting.READ_ONLY_EXT.length) : obj.stix_id\n end\n\n if obj.respond_to?(:cybox_object_id)\n original_id = obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n original_guid = obj.guid.include?(Setting.READ_ONLY_EXT) ? obj.guid.slice(0, obj.guid.length - Setting.READ_ONLY_EXT.length) : obj.guid\n end\n\n to_save.each do |normal|\n if obj.respond_to?(:stix_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.stix_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:stix_package_id) && normal.stix_package_id == obj.stix_id\n normal.stix_package_id = original_id\n elsif normal.respond_to?(:stix_indicator_id) && normal.stix_indicator_id == obj.stix_id\n normal.stix_indicator_id = original_id\n elsif normal.respond_to?(:course_of_action_id) && normal.course_of_action_id == obj.stix_id\n normal.course_of_action_id = original_id\n elsif normal.respond_to?(:stix_package_stix_id) && normal.stix_package_stix_id == obj.stix_id\n normal.stix_package_stix_id = original_id\n elsif normal.respond_to?(:stix_course_of_action_id) && normal.stix_course_of_action_id == obj.stix_id\n normal.stix_course_of_action_id = original_id\n elsif normal.respond_to?(:stix_exploit_target_id) && normal.stix_exploit_target_id == obj.stix_id\n normal.stix_exploit_target_id = original_id\n elsif normal.respond_to?(:stix_ttp_id) && normal.stix_ttp_id == obj.stix_id\n normal.stix_ttp_id = original_id\n elsif normal.respond_to?(:stix_attack_pattern_id) && normal.stix_attack_pattern_id == obj.stix_id\n normal.stix_attack_pattern_id = original_id\n end\n end\n \n if obj.respond_to?(:guid)\n if normal.respond_to?(:vulnerability_guid) && normal.vulnerability_guid == obj.guid\n normal.vulnerability_guid = original_guid\n elsif normal.respond_to?(:remote_src_object) && normal.remote_src_object_guid == obj.guid\n normal.remote_src_object_guid = original_guid\n elsif normal.respond_to?(:remote_dest_object) && normal.remote_dest_object_guid == obj.guid\n normal.remote_dest_object_guid = original_guid\n elsif normal.respond_to?(:target_guid) && normal.target_guid == obj.guid\n normal.target_guid = original_guid\n end\n end\n\n if obj.respond_to?(:cybox_object_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.cybox_object_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:cybox_object_id) && normal.cybox_object_id == obj.cybox_object_id\n normal.cybox_object_id = original_id\n elsif normal.respond_to?(:cybox_file_id) && normal.cybox_file_id == obj.cybox_object_id\n normal.cybox_file_id = original_id\n elsif normal.respond_to?(:uri_object_id) && normal.uri_object_id == obj.cybox_object_id\n normal.uri_object_id = original_id\n elsif normal.respond_to?(:cybox_win_reg_key_id) && normal.cybox_win_reg_key_id == obj.cybox_object_id\n normal.cybox_win_reg_key_id = original_id\n end\n end\n\n if normal.class == StixMarking && normal.remote_object_id == obj.guid\n normal.remote_object_id = original_guid\n # set stix_markings stix_id back to normal as well\n normal.stix_id = normal.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.stix_id.slice(0, normal.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.stix_id\n normal.guid = normal.guid.include?(Setting.READ_ONLY_EXT) ? normal.guid.slice(0, normal.guid.length - Setting.READ_ONLY_EXT.length) : normal.guid\n\n # relink isa markings/assertions/tlp/simple\n if normal.isa_assertion_structure\n normal.isa_assertion_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_assertion_structure.stix_id = normal.isa_assertion_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.stix_id.slice(0, normal.isa_assertion_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.stix_id\n normal.isa_assertion_structure.guid = normal.isa_assertion_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.guid.slice(0, normal.isa_assertion_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.guid\n\n # relink further sharing/isa privs\n if normal.isa_assertion_structure.isa_privs\n normal.isa_assertion_structure.isa_privs.each do |ip|\n ip.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n\n if normal.isa_assertion_structure.further_sharings\n normal.isa_assertion_structure.further_sharings.each do |fs|\n fs.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n end\n if normal.isa_marking_structure\n normal.isa_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_marking_structure.stix_id = normal.isa_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.stix_id.slice(0, normal.isa_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.stix_id\n normal.isa_marking_structure.guid = normal.isa_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.guid.slice(0, normal.isa_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.guid\n end\n if normal.tlp_marking_structure\n normal.tlp_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.stix_id\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.guid\n end\n if normal.ais_consent_marking_structure\n normal.ais_consent_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.stix_id\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.guid\n end\n end\n end\n\n if obj.respond_to?(:stix_id)\n obj.stix_id = original_id\n end\n \n if obj.respond_to?(:cybox_object_id)\n # set all the observables/parameter observables back to normal\n obj_observables = to_save.select {|d| d.respond_to?(:remote_object_id) && (d.remote_object_id == obj.cybox_object_id || d.remote_object_id == obj.cybox_object_id + Setting.READ_ONLY_EXT)}\n # you must get observables before resetting id\n # reset the id\n obj.cybox_object_id = obj.cybox_object_id && obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n if obj_observables.present?\n obj_observables.each do |o|\n o.cybox_object_id = o.cybox_object_id && o.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? o.cybox_object_id.slice(0, o.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : o.cybox_object_id\n o.remote_object_id = original_id\n end\n end\n\n old_cybox = to_save.select {|o| o.respond_to?(:cybox_object_id) && o.cybox_object_id == obj.cybox_object_id }\n\n # spoof the swap if needed function so we can use it than set the read only back to true\n old_cybox[0] = IngestUtilities.spoof_swap(uploaded_file, old_cybox[0], old_cybox[0].read_only, uploaded_file.read_only, uploaded_file.overwrite, to_save)\n \n # We need both in them because we have a method that removes the one without an id later.\n if old_cybox[0].id != nil\n unless to_save.include?(old_cybox[0])\n to_save << old_cybox[0]\n end\n end\n\n to_save = self.destroy_old_objs(old_cybox[0], to_save)\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n obj.guid = original_guid\n end\n\n to_save = self.destroy_old_objs(obj, to_save)\n\n to_save\n end",
"def strip_annotations(content); end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\n end",
"def iiif_manifest_attributes\n super.merge imported_attributes\n end",
"def iiif_manifest_attributes\n super.merge imported_attributes\n end",
"def imported\n @imported_page = true\n end",
"def apply_additional_metadata(depositor_id)\n #Here's where we call specific additional metadata changes...\n\t\tif self.respond_to?(:apply_content_specific_additional_metadata)\n self.apply_content_specific_additional_metadata\n end\t\n\n\t\t#We are setting the ownerId within apply_addtional_metadata due to a Fedora bug (FCREPO-963 - which means we can't set it on ingest).\n\t\t#It only sets the ownerId with the depositor id if its in the proto queue\n \t\tif self.queue_membership.include? :proto\n\t\t\tself.owner_id = depositor_id\n\t\tend\n\t\t\t\n\t\tdc_ds = self.dc\n\t\tdescMetadata_ds = self.descMetadata\n\n unless dc_ds.nil?\n dc_ds.update_indexed_attributes([:dc_title]=> self.get_values_from_datastream(\"descMetadata\", [:title], {}).to_s)\n begin\n date_issued = self.get_values_from_datastream(\"descMetadata\", [:origin_info,:date_issued], {})\n\t\t\t\tdate_valid = self.get_values_from_datastream(\"descMetadata\", [:origin_info,:date_valid], {})\n \n if date_issued.to_s != \"\"\n \tdc_ds.update_indexed_attributes([:dc_date]=> date_issued.to_s) if date_issued.present?\n\t\t\t\telse\n\t\t\t\t\tdc_ds.update_indexed_attributes([:dc_date]=> date_valid.to_s) if date_valid.present?\n\t\t\t\tend\n rescue OM::XML::Terminology::BadPointerError => e\n logger.error \"ERROR when trying to copy date on #{self.class} #{self.pid}:\\n\\t#{e.message}\"\n end\n end\n\t\n\t\tunless descMetadata_ds.nil?\n\t\t\tdescMetadata_ds.update_indexed_attributes ([:record_info,:record_change_date] => Time.now.strftime(\"%Y-%m-%d\"))\n\t\tend\n\n\t\tself.label = generate_object_label\n\t\t\n\t return true\n end",
"def import!\n return selected_importer.import!\n end",
"def import_metadata_attributes\n if PerDistrict.new.does_students_export_include_rows_for_inactive_students?\n {}\n else\n { missing_from_last_export: false }\n end\n end",
"def content_from_default=(content)\n # needs to be overridden for each kind of elements\n end",
"def load_notetags\n super\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<default title:\\s*(\\d*)\\s*>/i\n @default_title_id = $1.to_i\n when /<titles:[ ](\\d+(?:\\s*,\\s*\\d+)*)>/i\n $1.scan(/\\d+/).each { |num| \n @titles.push(num.to_i) if num.to_i > 0 \n }\n when /<icon_index:\\s*(\\d*)\\s*>/i\n @icon_index = $1.to_i\n when /<max_level:\\s*(\\d*)\\s*>/i\n @max_level = $1.to_i\n end\n }\n end",
"def import_xml xml_data\n ###\n [table, id]\n end",
"def import_folio_xml(options)\n import_folio_xml_specific_steps(options)\n import_shared_steps(options)\n end",
"def import_markup_text( file_content )\n count = 0\n if file_content.scan(PTN_LINE)[0] =~ /tattertools/\n file_content = convert_tatter_xml( file_content )\n return file_content\n end\n count += create_pages( :content => file_content )\n count\n end",
"def extract_related_content\n end",
"def parse_kanjidic lines\n line_number=1\n # get id values from the tables for the various attributes such as kunyomi, onyomi etc\n # to be used in the join tables \n readings_to_import= {}\n @lookup_attributes.each do |column|\n #stores readings in a hash of arrays with the key being\n #the attribute name e.g. :nanori, :kunyomi, etc\n readings_to_import[column]=[]\n end \n\n\n #create empty arrays to store index values\n indexes_to_import= [] #2D array of [[dictionary_id, kanji_id, index_value],...]\n\n lines.each do |line|\n unless line_number == 1\n kanji = get_element(:kanji,line)\n kanji_id = @kanji_lookup[kanji]\n #for each of nanori, onyomi, meanings, pinyin etc\n @lookup_attributes.each do |column| \n #get each of the multiple value attributes and append them to an array \n #to import at the end\n klass = eval(column.to_s.capitalize)\n relation_klass = eval(column.to_s.capitalize.pluralize+\"Kanji\")\n lookup = \"@#{column}_lookup\"\n #puts lookup\n lookup = eval(lookup)\n\n values = get_element(column, line)\n values.each do |value|\n #e.g. equivalent to o=Onyomi.find_by_onyomi onyomi\n relation_id = lookup[value]\n # e.g. equivalent to array << OnyomisKanji.new(:kanji_id=>id,:onyomi_id =>o.id)\n readings_to_import[column] << [kanji_id ,relation_id]\n end\n end \n\n #for the indexes we have a KanjiIndex table an Dictionaries table\n #and a KanjiIndex has a dictionary_id column\n @index_names.each do |index_name|\n indexes_to_import += get_dictionary_index(index_name, line)\n end\n\n end\n line_number +=1\n end\n return readings_to_import, indexes_to_import\n end",
"def fix_adjust_merged_record_mark_positions(options)\n input_file_spec = options['input'] || 'staging_dir/at_files'\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\z/i,\n \"Adjusting merged :record_mark positions\",\n options\n ) do |contents, filename|\n outcome = Repositext::Fix::AdjustMergedRecordMarkPositions.fix(contents, filename)\n [outcome]\n end\n end",
"def content_opf_template(escaped_title, copyright, author, uuid, cover_id,\n toc_chapters, manifest_chapters, images)\n if cover_id\n cover_meta = %(<meta name=\"cover\" content=\"#{cover_id}\"/>)\n cover_html = %(<item id=\"cover\" href=\"#{cover_filename}\" media-type=\"application/xhtml+xml\"/>)\n cover_ref = '<itemref idref=\"cover\" linear=\"no\" />'\n else\n cover_meta = cover_html = cover_ref = ''\n end\n%(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<package unique-identifier=\"BookID\" version=\"3.0\" xmlns=\"http://www.idpf.org/2007/opf\">\n <metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\"\n xmlns:opf=\"http://www.idpf.org/2007/opf\">\n <dc:title>#{escaped_title}</dc:title>\n <dc:language>en</dc:language>\n <dc:rights>Copyright (c) #{copyright} #{escape(author)}</dc:rights>\n <dc:creator>#{escape(author)}</dc:creator>\n <dc:publisher>Softcover</dc:publisher>\n <dc:identifier id=\"BookID\">urn:uuid:#{uuid}</dc:identifier>\n <meta property=\"dcterms:modified\">#{Time.now.strftime('%Y-%m-%dT%H:%M:%S')}Z</meta>\n #{cover_meta}\n </metadata>\n <manifest>\n <item href=\"#{nav_filename}\" id=\"nav\" media-type=\"application/xhtml+xml\" properties=\"nav\"/>\n <item id=\"ncx\" href=\"toc.ncx\" media-type=\"application/x-dtbncx+xml\"/>\n <item id=\"page-template.xpgt\" href=\"styles/page-template.xpgt\" media-type=\"application/vnd.adobe-page-template+xml\"/>\n <item id=\"pygments.css\" href=\"styles/pygments.css\" media-type=\"text/css\"/>\n <item id=\"softcover.css\" href=\"styles/softcover.css\" media-type=\"text/css\"/>\n <item id=\"epub.css\" href=\"styles/epub.css\" media-type=\"text/css\"/>\n <item id=\"custom.css\" href=\"styles/custom.css\" media-type=\"text/css\"/>\n <item id=\"custom_epub.css\" href=\"styles/custom_epub.css\" media-type=\"text/css\"/>\n #{cover_html}\n #{manifest_chapters.join(\"\\n\")}\n #{images.join(\"\\n\")}\n </manifest>\n <spine toc=\"ncx\">\n #{cover_ref}\n #{toc_chapters.join(\"\\n\")}\n </spine>\n</package>\n)\n end",
"def update_metadata_from_attachment(filename,fullpath, mime_type, nokodoc,locale)\n thisfile = File.new(\"#{fullpath}\")\n app_area = nokodoc.xpath(\"//meta[@name = 'app_area']/@content\")\n product = nokodoc.xpath(\"//meta[@name = 'product']/@content\")\n role = nokodoc.xpath(\"//meta[@name = 'role']/@content\")\n edition = nokodoc.xpath(\"//meta[@name = 'edition']/@content\")\n topic_type = nokodoc.xpath(\"//meta[@name = 'product']/@content\")\n identifier = nokodoc.xpath(\"//meta[@name = 'DC.Identifier']/@content\")\n maintitle = nokodoc.xpath(\"//meta[@name = 'SFDC.Title']/@content\")\n technology = nokodoc.xpath(\"//meta[@name = 'SFDC.Technology']/@content\")\n doctype = nokodoc.xpath(\"//meta[@name = 'SFDC.Type']/@content\")\n homelink = nokodoc.xpath(\"//meta[@name = 'SFDC.MainTopic']/@content\")\n upload_attachment(filename,locale,fullpath, mime_type,filename)\n perm_and_edition_tables=nokodoc.xpath('//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').inner_text()\n body_content=nokodoc.xpath('//body')\n # Remove items we don't want returned in the search snippet\n body_content.xpath('//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').remove\n body_content.xpath('//h1[1]').remove\n body_content.xpath('//*[contains(@class, \"breadcrumb\")]').remove\n# content=EscapeUtils.escape_html(body_content.children().inner_text())\n content=body_content.children().inner_text()\n title=nokodoc.xpath('//title[1]').inner_text()\n\n @thistopic = Topic.by_topicname_and_locale.key([\"#{filename}\",\"#{locale}\"]).first\n begin\n # If @thistopic doesn't exist, it will be a NilClass, which\n # doesn't have the update_attributes method. We need to catch\n # that.\n @thistopic.update_attributes(\n :version_removed => CURRENT_PATCH,\n :api_version_removed => CURRENT_API_VERSION,\n :locale => locale,\n :topicname => filename,\n :app_area => app_area,\n :product => product,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :identifier => identifier,\n :content => content,\n :perm_and_edition_tables => perm_and_edition_tables,\n :title => title,\n :maintitle => maintitle,\n :technology => technology,\n :doctype => doctype,\n :homelink => homelink\n )\n rescue NoMethodError\n STDERR.puts \"Error: Could not update the attributes on #{filename}. Check the couchdb connection.\"\n STDERR.puts \"#{$!}\"\n rescue RestClient::RequestFailed => e\n STDERR.puts \"Error: Could not update the attributes on #{filename}.\"\n if (e.http_code == 409 or e.http_code == 412)\n then\n STDERR.puts \"The problem was caused by a conflict or a precondition issue. Trying again.\"\n @thistopic.reload\n begin\n @thistopic.update_attributes(\n :version_removed => CURRENT_PATCH,\n :api_version_removed => CURRENT_API_VERSION,\n :locale => locale,\n :topicname => filename,\n :app_area => app_area,\n :product => product,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :identifier => identifier,\n :content => content,\n :perm_and_edition_tables => perm_and_edition_tables,\n :title => title,\n :maintitle => maintitle,\n :technology => technology,\n :doctype => doctype,\n :homelink => homelink\n )\n STDERR.puts \"Success!\"\n rescue\n STDERR.puts \"Nope. Updating the attributes on #{filename} still failed.\"\n # Now add it to the SOLR search index.\n else\n begin\n index_topic_with_solr(@thistopic)\n rescue\n STDERR.puts \"Couldn't add #{filename} to the SOLR index\"\n end\n end\n else\n STDERR.puts \"There was an error (#{e.http_code}) updating #{filename}.\"\n end\n rescue\n STDERR.puts \"Error: Could not update the attributes on #{filename}.\"\n STDERR.puts \"#{$!}\"\n raise\n else\n # Now add it to the SOLR search index.\n begin\n index_topic_with_solr(@thistopic)\n rescue\n STDERR.puts \"Couldn't add #{filename} to the SOLR index\"\n end\n end\n thisfile.close\nend",
"def process_article(art)\n this_pub = {}\n \n # if not table of figure or equation remove reference\n # a.zip(b) zipped lists\n both = art.xpath('//xref/@ref-type').zip(art.xpath('//xref'))\n both.each do |tag,elem| \n if tag.text != 'table' || tag.text != 'fig' || tag.text != 'fn' || tag.text != 'sec' || tag.text != 'disp-formula'\n elem.remove\n end\n end\n\n jrn_meta = art / \"article/front/journal-meta\"\n this_pub[:jrn_id] = (jrn_meta / \"journal-id[journal-id-type='nlm-ta']\").text\n art_meta = art / \"/article/front/article-meta\"\n\n this_pub[:pmid] = (art_meta / \"article-id[pub-id-type='pmid']\").text\n\n this_pub[:pmcid] = (art_meta / \"article-id[pub-id-type='pmc']\").text\n# this_pub[:doi] = (art_meta / \"article-id[pub-id-type='doi']\").text\n\n # title\n title_node = (art_meta / \"title-group/article-title\")\n \n # SDB Note 8/2016\n # Turns out that some of the article titles include footnotes or super/subscripts which occurred at the end of a title, \n # which are represented by embedded tags (e.g. <fn> or something like that),and calling .text on the title node was \n # including those (and messing stuff up in the process).\n # We thought that we only needed to worry about tags at the end of titles, and so for trec CDS 2016 we just used the first child node and called it good.\n # This turned out to be insufficient- in the latest PMC release, there are titles with italic text (cf. PMC1079931),\n # and the approach below fails in these cases. \n # TODO: a more robust title-parsing algorithm\n \n if title_node.children.size > 1\n this_pub[:title] = title_node.children.first.text.strip\n else\n this_pub[:title] = title_node.text.strip\n end\n\n # pub_year\n # if ppub, use that; else use collection\n ppub = (art_meta / \"pub-date[pub-type='ppub']/year\").text\n epub = (art_meta / \"pub-date[pub-type='epub']/year\").text\n year = nil\n if ppub.strip.length > 0\n year = ppub.strip\n else\n year = epub.strip\n end\n this_pub[:year] = year \n\n # abstract (if present)\n abst_node = art_meta / \"abstract\"\n \n this_pub[:abstract] = {}\n if abst_node.length == 0\n this_pub[:abstract][:full] = \"\"\n elsif (abst_node / \"sec\").size > 0 # structured abstract (inc. section headings)\n abstract_full = \"\" \n # go through each section, and get the parts out in some kind of order\n (abst_node / \"sec\").each do |s|\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end \n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n # clean leftovers of xref\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n abstract_full << ti << \"\\n\"\n abstract_full << body << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full.strip\n end\n if (abst_node / \"p\").size > 0 # unstructured abstract\n abstract_full = this_pub[:abstract][:full].to_s\n (abst_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n abs = s.text.strip\n abs = abs.gsub(/\\[-*\\]/, \"\")\n abs = abs.gsub(/\\(,*\\)/, \"\")\n abs = abs.gsub(/\\(-*\\)/, \"\")\n abs = abs.gsub(/\\[,*\\]/, \"\")\n abstract_full << abs << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full\n else\n STDERR.puts \"Other format found: \" + (art_meta / \"article-id[pub-id-type='pmc']\").text\n this_pub[:abstract][:full] = \"\"\n end\n \n # now do body- similar deal\n this_pub[:body] = {}\n body_node = art / \"/article/body\"\n \n if (body_node / \"sec\").size > 0\n body_full = \"\"\n (body_node / \"sec\").each do |s|\n # rm xref\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end\n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/inline-formula').each do |node|\n node.remove\n end\n\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n fig_cap = (s / \"fig/caption/p\").text.strip\n tbl_cap = (s / \"table-wrap/table-wrap-foot/p\").text.strip\n tbl_fn = (s / \"table-wrap/table-wrap-foot/fn\").text.strip\n\n # clean leftovers of xref\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\[-*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\(,*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\(-*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\[,*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[-*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(,*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(-*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[,*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[-*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(,*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(-*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[,*\\]/, \"\")\n body_full << ti << \"\\n\"\n body_full << body << \"\\n\"\n body_full << fig_cap << \"\\n\"\n body_full << tbl_cap << \"\\n\"\n body_full << tbl_fn << \"\\n\"\n end\n this_pub[:body][:full] = body_full.strip\n end\n\n if (body_node / \"p\").size > 0 # found the sec and p can coexist 2660466.nxml\n body_full = this_pub[:body][:full].to_s\n (body_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n body = s.text.strip\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body_full << body << \"\\n\"\n end\n this_pub[:body][:full] = body_full \n else\n STDERR.puts \"Serious weirdness in body: \"+ (art_meta / \"article-id[pub-id-type='pmc']\").text\n end\n \n \n return this_pub\nend",
"def parse_onotology(el)\n el.children.each do |el|\n case el.node_name\n when 'imports'\n res = el.attribute_with_ns('resource', RDF_NS)\n self.class.import(res.value)\n else\n #warn \"Unknown eleement '#{el.node_name}' in 'owl:Ontology'\"\n end\n end\n \n end",
"def do_article\n # if it's a specification, force to @manual\n # if it's a site description, force to @misc\n # I couldn't determin condition whether output will be @manual or @article.\n if @article_type == :specification\n @lines.each {|l| l.sub!(/@article{/, \"@manual{\") }\n do_manual\n elsif @article_type == :site\n @lines.each {|l| l.sub!(/@article{/, \"@misc{\") }\n do_misc\n end\n end",
"def content_manipulation\n self.summary = markup_manipulation self.summary if self.summary.present?\n self.content = markup_manipulation self.content if self.content.present?\n end",
"def enhance_referent(body, request) \n doc = Nokogiri::XML(body)\n return unless cite = doc.at(\"PubmedArticleSet/PubmedArticle/MedlineCitation\") # Nothing of interest here\n \n return unless article = cite.at(\"Article\") # No more useful metadata \n if abstract = article.at(\"Abstract/AbstractText\")\n request.add_service_response( \n :service=>self,\n :display_text => \"Abstract from #{@display_name}\",\n :content => abstract.inner_text,\n :service_type_value => 'abstract') unless abstract.inner_text.blank? \n end\n \n if journal = article.at(\"Journal\")\n if issn = journal.at('ISSN')\n if issn.attributes['issntype']==\"Print\" \n request.referent.enhance_referent('issn', issn.inner_html)\n else \n request.referent.enhance_referent('eissn', issn.inner_html) \n end\n end\n if jrnlissue = journal.at('JournalIssue')\n if volume = jrnlissue.at('Volume')\n request.referent.enhance_referent('volume', volume.inner_text)\n end\n if issue = jrnlissue.at('Issue')\n request.referent.enhance_referent('issue', issue.inner_text)\n end \n if date = jrnlissue.at('PubDate') \n \n request.referent.enhance_referent('date', openurl_date(date))\n \n end \n end\n \n if jtitle = journal.at('Title')\n request.referent.enhance_referent('jtitle', jtitle.inner_text) \n end\n if stitle = journal.at('ISOAbbreviation')\n request.referent.enhance_referent('stitle', stitle.inner_text)\n end \n \n if atitle = article.at('ArticleTitle')\n request.referent.enhance_referent('atitle', atitle.inner_text)\n end \n \n if pages = article.at('Pagination/MedlinePgn')\n page_str = pages.inner_text\n request.referent.enhance_referent('pages', page_str)\n if spage = page_str.split(\"-\")[0]\n request.referent.enhance_referent('spage', spage.strip)\n end\n end \n \n if author = article.at('AuthorList/Author')\n if last_name = author.at('LastName')\n request.referent.enhance_referent('aulast', last_name.inner_text)\n end\n if first_name = author.at('ForeName')\n request.referent.enhance_referent('aufirst', first_name.inner_text)\n end \n if initials = author.at('Initials')\n request.referent.enhance_referent('auinit', initials.inner_text)\n end \n end \n end \n \n end",
"def boilerplate ingestor\n\n @mods.add_islandora_identifier ingestor.pid\n @mods.add_extension_elements @manifest\n\n # somewhat order dependent\n\n ingestor.label = @label\n ingestor.owner = @owner\n ingestor.content_model = @content_model\n ingestor.collections = @collections\n ingestor.dc = @mods.to_dc\n ingestor.mods = @mods.to_s\n\n if @marc\n ingestor.datastream('MARCXML') do |ds|\n ds.dsLabel = \"Archived Digitool MarcXML\"\n ds.content = @marc\n ds.mimeType = 'text/xml'\n end\n end\n end",
"def import_idml(options)\n import_idml_specific_steps(options)\n import_shared_steps(options)\n end",
"def perform(filename)\n\n # checking if already imported\n if dataset_marked? filename, 'imported'\n puts \"#{filename} is already imported, skipping.\"\n return\n end\n\n articles_to_import = []\n\n with_locked_file filename do\n puts \"Opening file at #{filename}\"\n file = File.open filename\n puts \"creating a nokogiri document...\"\n doc = Nokogiri.XML(file)\n\n # checking for errors in file\n if doc.errors.length > 0\n puts \"error reading file #{filename}, marking 'errors'\"\n mark_dataset(filename, 'errors')\n # mark the file as incomplete\n raise 'bad file'\n end\n\n # inserting into array\n doc.css('PubmedArticle').each do |article|\n pmid = article.css('MedlineCitation PMID').first.text.to_i\n raw_xml = article.to_s\n title = article.css('MedlineCitation Article ArticleTitle').first.try(:text)\n abstract = article.css('MedlineCitation Article Abstract AbstractText').first.try(:text)\n\n articles_to_import << [pmid, raw_xml, title, abstract] if pmid\n end\n\n # we are pretty confident about validity of data\n cols = [:pubmed_id, :raw_pubmed_xml, :title, :abstract]\n Rails.logger.silence do\n Article.import cols, articles_to_import, validate: false\n end\n\n # mark the file as imported\n unmark_dataset(filename, 'errors')\n mark_dataset(filename, 'imported')\n end\n end",
"def post_import\n end",
"def find_subtitle_misalignments_between_qotd_and_content_at(date_code, posting_date_time, qotd_txt, content_at_txt, collector)\n end",
"def after_save\n df = DataFile.find_by_id(self.orig_data_file_id)\n unless df.blank?\n df.annotations.each do |a|\n a.annotatable = self\n #need to call update without callbacks, otherwise a new version is created\n a.send(:update_without_callbacks)\n\n #versions for annotations are no longer enabled in SEEK - but this code is left here incase they are re-enabled in the future.\n a.versions.each do |av|\n av.annotatable =self\n av.save\n end\n end\n end\n super\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def import\n if @default_photo_identity ||= @photo_identities.first\n provider_name = if @default_photo_identity.is_a?(ProviderAuthorization)\n @default_photo_identity.photo_source_name\n else\n @default_photo_identity.class.to_s.underscore.split('_').first\n end\n @default_photo_identity_url = \"/#{provider_name.downcase}/photo_fields?context=user\"\n end\n @project = Project.find(params[:project_id].to_i) if params[:project_id]\n if logged_in?\n @projects = current_user.project_users.joins(:project).includes(:project).\n order( Arel.sql( \"lower(projects.title)\" ) ).collect(&:project)\n @project_templates = {}\n @projects.each do |p|\n @project_templates[p.title] = p.observation_fields.order(:position) if @project && p.id == @project.id\n end\n end\n end",
"def set_content_attributes!(report)\n if report.content_type.blank? && report.content_type_id.to_i == 0\n if (item_id = params[:item_id] || params[:report].try(:[], :item_id) ).to_i > 0\n report.content_type = 'ITEM'\n report.content_type_id = item_id\n elsif (item_comment_id = params[:item_comment_id] || params[:report].try(:[], :item_comment_id) ).to_i > 0\n report.content_type = 'ITEM_COMMENT'\n report.content_type_id = item_comment_id\n elsif (trade_comment_id = params[:trade_comment_id] || params[:report].try(:[], :trade_comment_id) ).to_i > 0\n report.content_type = 'TRADE_COMMENT'\n report.content_type_id = trade_comment_id\n end\n end\n if ::Report.valid_content_type?(report.content_type)\n if (record = report.content_record)\n report.offender_user_id ||= record.user_id # this assumes all types have user_id as the offender.\n else\n flash[:error] = \"The reported record cannot be found\"\n end\n end\n end",
"def read_header!(list_type_to_default_data_processing_id)\n @io.rewind\n\n string = get_header_string(@io)\n doc = Nokogiri::XML.parse(string, nil, @encoding, Mspire::Mzml::Parser::NOBLANKS)\n\n doc.remove_namespaces!\n mzml_n = doc.root\n if mzml_n.name == 'indexedmzML'\n mzml_n = mzml_n.child\n end\n\n @id = mzml_n[:id]\n\n cv_list_n = mzml_n.child\n self.cvs = cv_list_n.children.map do |cv_n|\n Mspire::Mzml::CV.from_xml(cv_n)\n end\n\n # get the file description node but deal with it after getting ref_hash\n file_description_n = cv_list_n.next\n\n xml_n = file_description_n.next\n\n # a hash of referenceable_param_groups indexed by id\n @link = {}\n\n if xml_n.name == 'referenceableParamGroupList'\n self.referenceable_param_groups = xml_n.children.map do |rpg_n|\n Mspire::Mzml::ReferenceableParamGroup.from_xml(rpg_n) # <- no ref_hash (not made yet)\n end\n @link[:ref_hash] = self.referenceable_param_groups.index_by(&:id)\n xml_n = xml_n.next\n end\n\n # now we can set the file description because we have the ref_hash\n self.file_description = Mspire::Mzml::FileDescription.from_xml(file_description_n, @link)\n @link[:source_file_hash] = self.file_description.source_files.index_by(&:id)\n\n\n loop do\n case xml_n.name\n when 'sampleList'\n self.samples = xml_n.children.map do |sample_n|\n Mspire::Mzml::Sample.from_xml(sample_n, @link)\n end\n @link[:sample_hash] = self.samples.index_by(&:id)\n when 'softwareList' # required\n self.software_list = xml_n.children.map do |software_n|\n Mspire::Mzml::Software.from_xml(software_n, @link)\n end\n @link[:software_hash] = self.software_list.index_by(&:id)\n when 'instrumentConfigurationList'\n self.instrument_configurations = xml_n.children.map do |inst_config_n|\n Mspire::Mzml::InstrumentConfiguration.from_xml(inst_config_n, @link)\n end\n @link[:instrument_configuration_hash] = self.instrument_configurations.index_by(&:id)\n when 'dataProcessingList'\n self.data_processing_list = xml_n.children.map do |data_processing_n|\n Mspire::Mzml::DataProcessing.from_xml(data_processing_n, @link)\n end\n @link[:data_processing_hash] = self.data_processing_list.index_by(&:id)\n when 'run'\n @link[:index_list] = @index_list\n list_type_to_default_data_processing_id.each do |type, process_id|\n @link[\"#{type}_default_data_processing\".to_sym] = @link[:data_processing_hash][process_id]\n end\n self.run = Mspire::Mzml::Run.from_xml(@io, xml_n, @link)\n break\n end\n xml_n = xml_n.next\n end\n end",
"def mcx_import(content, append=false)\n settings = Settings.new content\n mcx_flags = { 'has_mcx_settings' => true }\n mcx_flags = mcx_flags.to_plist({:plist_format => CFPropertyList::List::FORMAT_XML, :formatted => true})\n self['mcx_flags'] = [CFPropertyList::Blob.new(mcx_flags)]\n self['mcx_settings'] = settings.domains\n end",
"def unresolved_mark?(content)\n content.include? \"< .mine\" or content.include? \"> .r\"\n end",
"def export_icml(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n input_base_dir_name, input_file_pattern_name = input_file_spec.split(\n Repositext::Cli::FILE_SPEC_DELIMITER\n )\n output_base_dir = options['output'] || config.base_dir('icml_export_dir')\n Repositext::Cli::Utils.export_files(\n config.base_dir(input_base_dir_name),\n config.file_pattern(input_file_pattern_name),\n output_base_dir,\n /\\.at\\Z/i,\n \"Exporting AT files to ICML\",\n options\n ) do |contents, filename|\n # We first convert AT to plain markdown to remove record_marks,\n # subtitle_marks, and gap_marks which aren't supported by ICML.\n md = convert_at_string_to_plain_markdown(contents)\n # Since the kramdown parser is specified as module in Rtfile,\n # I can't use the standard kramdown API:\n # `doc = Kramdown::Document.new(contents, :input => 'kramdown_repositext')`\n # We have to patch a base Kramdown::Document with the root to be able\n # to convert it.\n root, warnings = config.kramdown_parser(:kramdown).parse(md)\n doc = Kramdown::Document.new('')\n doc.root = root\n icml = doc.send(config.kramdown_converter_method(:to_icml))\n [Outcome.new(true, { contents: icml, extension: 'icml' })]\n end\n end",
"def import_xml(xml)\n if xml.is_a?(String)\n xml.force_encoding(\"UTF-8\") if xml.respond_to? :force_encoding\n xml.scrub!\n doc = REXML::Document.new xml.gsub(/>[\\s\\t]*\\n*[\\s\\t]*</, \"><\").strip\n elsif xml.is_a?(REXML::Document)\n doc = xml\n else\n raise ArgumentError, \"Argument must be an REXML::Document or well-formed XML string\"\n end\n\n # Cut to the context object\n ctx = REXML::XPath.first(doc, \".//ctx:context-object\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n\n ctx.attributes.each do |attr, val|\n @admin.each do |adm, vals|\n set_administration_key(adm, val) if vals[\"label\"] == attr\n end\n end\n ctx.to_a.each do |ent|\n if @@defined_entities.value?(ent.name)\n import_entity(ent)\n else\n import_custom_node(ent)\n end\n end\n end",
"def import_category(category)\n article_ids = article_ids_for_category(category, @depth)\n import_articles_with_scores_and_views article_ids\n end",
"def merge_titles_from_folio_roundtrip_compare_into_folio_import(options)\n folio_roundtrip_compare_base_dir = File.join(\n config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :compare_dir\n ),\n 'folio_source/with_folio_import'\n )\n folio_import_base_dir = config.compute_base_dir(options['base-dir-2'] || :folio_import_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging titles from folio roundtrip compare into content_at'\n start_time = Time.now\n total_count = 0\n success_count = 0\n errors_count = 0\n\n Dir.glob(\n [\n folio_roundtrip_compare_base_dir,\n config.compute_file_selector(options['file-selector'] || :all_files),\n config.compute_file_extension(options['file-extension'] || :txt_extension)\n ].join\n ).each do |folio_roundtrip_compare_file_name|\n total_count += 1\n # prepare paths\n content_at_file_name = folio_roundtrip_compare_file_name.gsub(\n folio_roundtrip_compare_base_dir, # update path\n folio_import_base_dir\n ).gsub(\n /\\/+/, '/' # normalize runs of slashes resulting from different directory depths\n ).gsub(\n /\\.txt\\z/, '.folio.at' # replace file extension\n )\n output_file_name = content_at_file_name\n begin\n outcome = Repositext::Process::Merge::TitlesFromFolioRoundtripCompareIntoContentAt.merge(\n File.read(folio_roundtrip_compare_file_name),\n File.read(content_at_file_name),\n )\n\n if outcome.success\n # write to file\n at_with_merged_title = outcome.result\n FileUtils.mkdir_p(File.dirname(output_file_name))\n File.write(output_file_name, at_with_merged_title)\n success_count += 1\n $stderr.puts \" + Merge title from #{ folio_roundtrip_compare_file_name }\"\n else\n errors_count += 1\n $stderr.puts \" x Error: #{ folio_roundtrip_compare_file_name }: #{ outcome.messages.join }\"\n end\n rescue StandardError => e\n errors_count += 1\n $stderr.puts \" x Error: #{ folio_roundtrip_compare_file_name }: #{ e.class.name } - #{ e.message } - #{ e.backtrace.join(\"\\n\") }\"\n end\n end\n\n $stderr.puts \"Finished merging #{ success_count } of #{ total_count } files in #{ Time.now - start_time } seconds.\"\n $stderr.puts '-' * 80\n end",
"def imported?\n self.ar_record.present? and self.ar_record.wp_id.present?\n end",
"def merge! other_feed\n [:id, :title, :subtitle, :updated, :rights, :logo, :icon].each do |p|\n if (v = other_feed.get(p))\n set p, v\n end\n end\n\n [:links, :categories, :authors, :contributors].each do |p|\n other_feed.get(p).each do |e|\n get(p) << e\n end\n end\n\n @extensions = other_feed.extensions\n\n merge_entries! other_feed\n end",
"def load_notetags\n super\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<itype_id:\\s*(\\d+)\\s*>/i\n @itype_id = $1.to_i\n when /<synthesis_level:\\s*(\\d*)\\s*>/i\n @synthesis_level = $1.to_i\n when /<synthesis_material:\\s*(\\d*)\\s*,\\s*(\\d*)\\s*,\\s*(\\d*)\\s*>/i\n @synthesis_materials.push(RPG::Material.new($1.to_i, $2.to_i, $3.to_i))\n end\n }\n end",
"def create_defaults\n import_layout(self.layout_dir(:absolute => true))\n import_content(self.content_dir(:absolute => true))\n end",
"def parse_feed(options={})\n document = read_from_file(filename)\n document.extend Hashie::Extensions::DeepFetch\n recommendations = document.deep_fetch('ObjectList', 'Article') { nil }\n\n Array(recommendations).each do |item|\n doi = item['Doi']\n # sometimes doi metadata are missing\n break unless doi\n\n # turn classifications into array with lowercase letters\n classifications = item['Classifications'] ? item['Classifications'].downcase.split(\", \") : []\n\n year = Time.zone.now.year\n month = Time.zone.now.month\n\n recommendation = { 'year' => year,\n 'month' => month,\n 'doi' => doi,\n 'f1000_id' => item['Id'],\n 'url' => item['Url'],\n 'score' => item['TotalScore'].to_i,\n 'classifications' => classifications,\n 'updated_at' => Time.now.utc.iso8601 }\n\n # try to get the existing information about the given work\n data = get_result(db_url + CGI.escape(doi))\n\n if data['recommendations'].nil?\n data = { 'recommendations' => [recommendation] }\n else\n # update existing entry\n data['recommendations'].delete_if { |recommendation| recommendation['month'] == month && recommendation['year'] == year }\n data['recommendations'] << recommendation\n end\n\n # store updated information in CouchDB\n put_lagotto_data(db_url + CGI.escape(doi), data: data)\n end\n end",
"def annotate\n redirect_to :show unless rcparams = params[:recipe][:recipeContents]\n @content = rcparams[:content]\n ps = ParserServices.new entity: @recipe, content: @content\n # This is a two-, possibly three-phase process:\n # 1) a selection from the browser directs attention to a range of text, which generates a CSS path for an element to parse\n # 2) this so-called parse_path is attempted to be parsed. If it doesn't work because of a findable tag, a dialog is presented\n # for the user to decide how to handle the tag;\n # 3) the user says to enter the problematic tag directly into the dictionary, or specifies an existing tag for what\n # was meant by the problematic tag. The latter can be optionally entered as a synonym of the intended name.\n if rcparams[:anchor_path] # Initial annotation on browser selection\n logger.debug \"Annotating with anchor_path = '#{rcparams[:anchor_path]}'\"\n @annotation, @parse_path = ps.annotate_selection *rcparams.values_at(:token, :anchor_path, :anchor_offset, :focus_path, :focus_offset)\n elsif @parse_path = rcparams[:parse_path] # Specifying an element of the DOM\n if !(@tagname = rcparams[:tagname])\n logger.debug \"Looking for tag at '#{@parse_path}'\"\n # @annotation = ParsingServices.parse_on_path *rcparams.values_at(:content, :parse_path) do |tagtype, tagname|\n @annotation = ps.parse_on_path @parse_path do |tagtype, tagname|\n @tagtype, @tagname = tagtype, tagname\n end\n @parse_path = nil unless @tagname # We'll need the parse path for identifying the tag\n else # There IS a tagname: use that as a tag\n noko_elmt = ps.extract_via_path @parse_path\n @tagtype = rcparams[:tagtype]\n @annotation = rcparams[:content]\n # @tagname of type @tagtype is a mystery tag previously identified by a failed parse.\n logger.debug \"Use tag '#{@tagname}' of type '#{@tagtype}' at path '#{@parse_path}'\"\n # The logic here is as follows, for sorting out words.\n # -- '@tagname' is the questionable tag\n # -- 'rcparams[:replacement]' is the id of a tag selected by the user to serve in its place\n # -- 'rcparams[:assert]' is set if that tag will be added to the dictionary\n # If there's no replacement tag, the term is just accepted into the dictionary as a new instance of the tagtype.\n # If there IS a non-nil replacement, that's what we understand the term to mean. If, then, assert is set,\n # the questionable term will get added to the dictionary as a synonym for the replacement. If not, the alias\n # is accepted and added to the Seeker as such.\n # No tagname has been parsed out; proceed to parse the entity denoted by the parse path\n if (replacement = rcparams[:replacement]).present?\n old_tag = Tag.find_by id: replacement\n if rcparams[:assert]\n new_tag = Tag.assert @tagname, @tagtype\n new_tag.absorb old_tag, false\n end\n value = old_tag.name\n else\n # No replacement provided => simply assert the tag into the dictionary\n value = @tagname\n Tag.assert @tagname, @tagtype\n end\n @tagname = nil # Go back to the annotation dialog\n @parse_path = nil\n if noko_elmt\n noko_elmt[:value] = value\n @annotation = noko_elmt.ancestors.last.to_s\n end\n end\n end\n end",
"def replace(content)\n \n # pre-structuring\n content.gsub!( /^(\\w.*)\\n(\\w.*)/ ) { \"#{$1} #{$2}\" } # remove single line breaks between text in order to avoid false paragraph markup\n content.gsub!( /<!--/ ) { \"--\" } # replace opening html commentaries\n content.gsub!( /-->/ ) { \"--\" } # replace closing html commentaries\n \n # templates\n content.gsub!( /\\{\\{Zitat\\|(.*)\\|.*\\}\\}\\s*$\\n/ ) { \"\\{p\\}\\\"#{$1}\\\"\\{/p\\}\\n\" } # citation\n content.gsub!( /\\{\\{.*(Finale Version).*\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1}</font>{/status}<br>\" } # final version\n content.gsub!( /\\{\\{Vorlage:(Dokument.*)\\n*(.*)\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1} #{$2}</font>{/status}<br>\" } # document status\n content.gsub!( /\\{\\{.*\\}\\} *$/ ) { '' } # remove single line templates\n content.gsub!( /\\{\\{.*\\n?.*\\}\\} *$/ ) { '' } # remove all remaining templates\n \n # tags\n content.gsub!( /<nowiki>(.*?)<\\/nowiki>/ ) { \"<pre>#{$1}</pre>\" }\n content.gsub!( /^ +(.*)/ ) { \"<pre>#{$1}</pre>\" }\n\n # special markup of qualidative data analysis\n content = content + \"\\n\\n{!end}\"\n \n # categories\n content.gsub!( /\\[\\[Kategorie:(.*?)\\]\\]/i ) { \"{category}<font color=\\\"#FF0000\\\">Kategorie:#{$1}</font>{/category}<br>\" }\n \n # images\n content.gsub!( /\\[\\[Bild:(.*?)\\]\\]/i ) { \"{image}Bild:#{$1.gsub!(/.*\\|/,'')}{/image}<br>\"} # Bild:lpscreen.jpg|thumb|Bereichseite des Landesportals\n\n # bold\n content.gsub!(/'''(.*?)'''/) {\"<strong>#{$1}</strong>\"}\n content.gsub!(/'''(.*?)$/) {\"<strong>#{$1}</strong>\"}\n\n # italics\n content.gsub!(/''(.*?)''/) {\"<em>#{$1}</em>\"}\n content.gsub!(/''(.*?)$/) {\"<em>#{$1}</em>\"}\n\n # headings\n 6.downto(1) { |i| content.gsub!( /^={#{i}}(.*?)={#{i}} *$/ ) { \"<h#{i}>\\{h>#{i}\\}#{$1}\\{/h>#{i}\\}</h#{i}>\" } }\n \n # links, internal\n content.gsub!( /\\[\\[([^\\[\\n]*?)\\| *(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[\\[(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n\n # links, external\n content.gsub!( /\\[([^\\[\\n]*?)\\| *(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n \n # lists\n content.gsub!(/^:+/,'') # remove forced indenting\n content.gsub!( /^((?:\\*.*\\n+)+)/ ) { \"\\{l>ul\\}<ul>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^\\*/,'')}</li>\\n\" }.join}</ul>\\{/l>ul\\}<br>\\n\" } # first level ul\n content.gsub!( /^((?:#.*\\n+)+)/ ) { \"\\{l>ol\\}<ol>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^#/,'')}</li>\\n\" }.join}</ol>\\{/l>ol\\}<br>\\n\" } # first level ol\n content.gsub!( /<li>\\s*<\\/li>\\n/ ) { '' } # remove empty list entries (this may occur if first-level wiki-lists are entered with \\n\\n; they look like a single list when, in fact, they are but multiple single lists)\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # second level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # second level ol\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # third level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # third level ol\n\n # tables\n # the table conversion barely works, cf. http://johbuc6.coconia.net/doku.php/mediawiki2html_machine/code?DokuWiki=7c542b97df2bc0f82fec0f4875265a20 for an implementation in PHP\n content.gsub!( /^\\{\\|(.*)/ ) { \"\\{table\\}\\n<table #{$1}>\" }\n content.gsub!( /\\|\\}/ ) { \"</table>\\n\\{/table\\}\" }\n content.gsub!( /^\\|-(.*)/ ) { \"<tr>#{$1}\" }\n content.gsub!( /^!(.*?)\\|(.*)/ ) { \"<th #{$1}>#{$2}</th>\" } # table header with piped markup\n content.gsub!( /^!(.*)/ ) { \"<th>#{$1}</th>\" } # table header without piped markup\n content.gsub!( /^\\|(.*?)\\|(.*)/ ) { \"<td #{$1}>#{$2}\" } # table data with piped markup\n content.gsub!( /^\\|(.*)/ ) { \"<td>#{$1}\" } # table data without piped markup\n \n # line breaks\n content.gsub!( /(^(?:\\w|<strong|<em|<a|\\\").*)\\n\\s*\\n/ ) {\"<p>\\{p\\}#{$1}\\{/p\\}</p>\\n\"}\n \n # special markup of qualidative data analysis\n content.gsub!( /(\\{id\\}.*\\{\\/title\\})/ ) { \"<p><strong><em>#{$1.gsub(/_/,' ')}</em></strong></p>\" }\n \n# //$html = nl2br($html);\n# \t// line breaks\n# \t$html = preg_replace('/[\\n\\r]{4}/',\"<br/><br/>\",$html);\n# \t$html = preg_replace('/[\\n\\r]{2}/',\"<br/>\",$html);\n\n# \t$html = preg_replace('/[>]<br\\/>[<]/',\"><\",$html);\n \n# // allowed tags\n# \t$html = preg_replace('/<(\\/?)(small|sup|sub|u)>/','<${1}${2}>',$html);\n#\n# \t$html = preg_replace('/\\n*<br *\\/?>\\n*/',\"\\n\",$html);\n# \t$html = preg_replace('/<(\\/?)(math|pre|code|nowiki)>/','<${1}pre>',$html);\n# \t$html = preg_replace('/<!--/','<!--',$html);\n# \t$html = preg_replace('/-->/',' -->',$html);\n# \n return content\n\nend",
"def manipulate_file\n\t\tref = \"<w:attachedTemplate r:id=\\\"rId1\\\"/>\"\n\n\t\tif not File.stat(datastore['SOURCE']).readable?\n\t\t\tprint_error(\"Not enough rights to read the file. Aborting.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#lets extract our docx and store it in memory\n\t\tzip_data = unzip_docx\n\n\t\t#file to check for reference file we need\n\t\tfile_content = zip_data[\"word/settings.xml\"]\n\t\tif file_content.nil?\n\t\t\tprint_error(\"Bad \\\"word/settings.xml\\\" file, check if it is a valid .docx.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#if we can find the reference to our inject file, we don't need to add it and can just inject our unc path.\n\t\tif not file_content.index(\"w:attachedTemplate r:id=\\\"rId1\\\"\").nil?\n\t\t\tvprint_status(\"Reference to rels file already exists in settings file, we dont need to add it :)\")\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t# lets zip the end result\n\t\t\tzip_docx(zip_data)\n\t\telse\n\t\t\t#now insert the reference to the file that will enable our malicious entry\n\t\t\tinsert_one = file_content.index(\"<w:defaultTabStop\")\n\n\t\t\tif insert_one.nil?\n\t\t\t\tinsert_two = file_content.index(\"<w:hyphenationZone\") # 2nd choice\n\t\t\t\tif not insert_two.nil?\n\t\t\t\t\tvprint_status(\"HypenationZone found, we use this for insertion.\")\n\t\t\t\t\tfile_content.insert(insert_two, ref )\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tvprint_status(\"DefaultTabStop found, we use this for insertion.\")\n\t\t\t\tfile_content.insert(insert_one, ref )\n\t\t\tend\n\n\t\t\tif insert_one.nil? && insert_two.nil?\n\t\t\t\tprint_error(\"Cannot find insert point for reference into settings.xml\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\t#update the files that contain the injection and reference\n\t\t\tzip_data[\"word/settings.xml\"] = file_content\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t#lets zip the file\n\t\t\tzip_docx(zip_data)\n\t\tend\n\t\treturn 0\n\tend",
"def import(manifest) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n return false if @reimport_mono.blank?\n monograph = @reimport_mono\n rows = CSV.parse(manifest, headers: true, skip_blanks: true).delete_if { |row| row.to_hash.values.all?(&:blank?) }\n # The template CSV file contains an extra row after the\n # headers that has explanatory text about how to fill in\n # the table. We want to throw away that text.\n rows.delete(0)\n rows.each do |row|\n noid = row.field('NOID')\n row.each do |key, value|\n field = metadata_field(key)\n next if field.blank? || value.blank?\n if noid == monograph.id\n if metadata_monograph_field?(key)\n monograph.send(\"#{field[:metadata_name]}=\", metadata_field_value(field, value))\n monograph.save\n end\n elsif metadata_file_set_field?(key)\n file_set = FileSet.find(noid)\n if key == 'Representative Kind'\n set_representative_or_cover(monograph, file_set, value.strip.downcase)\n else\n file_set.send(\"#{field[:metadata_name]}=\", metadata_field_value(field, value))\n file_set.save\n end\n end\n end\n end\n true\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 treatments\n begin\n if content_blob.is_extractable_spreadsheet?\n xml = spreadsheet_xml\n Seek::Data::Treatments.new xml\n else\n Seek::Data::Treatments.new\n end\n rescue Exception => e\n Rails.logger.error(\"Error reading spreadsheet #{e.message}\")\n raise(e) if Rails.env==\"test\"\n Seek::Data::Treatments.new\n end\n end",
"def set_import_ma_news\n @import_ma_news = ImportMaNew.find(params[:id])\n end",
"def boilerplate ingestor\n\n @pid = ingestor.pid\n\n @mods.add_iid_identifier @iid if @mods.iids.empty? # we do sanity checking and setup the @iid elsewhere\n @mods.add_islandora_identifier ingestor.pid\n @mods.add_flvc_extension_elements @manifest\n\n if @mods.type_of_resource.empty?\n @mods.add_type_of_resource @mods_type_of_resource\n end\n\n @mods.post_process_cleanup # creates purl if necessary, must be done after iid inserted into MODS\n raise PackageError, \"Invalid MODS file\" unless @mods.valid?\n\n ingestor.label = @label\n ingestor.owner = @owner\n ingestor.content_model = @content_model\n ingestor.collections = @collections\n ingestor.dc = @mods.to_dc\n ingestor.mods = @mods.to_s\n\n if @marc\n ingestor.datastream('MARCXML') do |ds|\n ds.dsLabel = \"Archived MarcXML\"\n ds.content = @marc\n ds.mimeType = 'text/xml'\n end\n end\n\n if @manifest.embargo\n @drupal_db.add_embargo @pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n\n # set POLICY if there is only one collection with same namespace and POLICY datastream\n # if none or more than one collection, do not set POLICY\n\n if @inherited_policy_collection_id\n ingestor.datastream('POLICY') do |ds|\n ds.dsLabel = \"XACML Policy Stream\"\n ds.content = Utils.get_datastream_contents(@config, @inherited_policy_collection_id, 'POLICY')\n ds.mimeType = 'text/xml'\n ds.controlGroup = 'X'\n end\n end\n\n ingestor.datastream('RELS-EXT') do |ds|\n ds.dsLabel = 'Relationships'\n ds.content = rels_ext(ingestor.pid)\n ds.mimeType = 'application/rdf+xml'\n end\n end",
"def import\n update_attribute(:published_at, Time.now)\n @tyra = Tyra.new(0)\n @tyra.import({ \"meta\" => metadata, \"data\" => data })\n end",
"def subtitle_mark_at_beginning_of_every_paragraph?(content_at_file)\n content = content_at_file.contents\n # Early return if content doesn't contain any subtitle_marks\n return Outcome.new(true, nil) if !content.index('@')\n case @options[:content_type]\n when :import\n # In this mode we raise an exception if we find any paragraphs\n content_without_headers = empty_header_lines(content)\n paragraphs_without_subtitle_mark = check_import_file(content_without_headers)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n # We want to terminate an import if there isn't a subtitle_mark\n # at the beginning of every paragraph.\n # Normally we'd return a negative outcome (see :content), but in this\n # case we raise an exception.\n raise NoSubtitleMarkAtBeginningOfParagraphError.new(\n [\n \"The following paragraphs don't start with a subtitle_mark:\",\n paragraphs_without_subtitle_mark.map { |e| e.inspect }.join(\"\\n\")\n ].join(\"\\n\")\n )\n end\n when :content\n # In this mode we only report errors if we find any paragraphs\n # We only look at text after the second record_id. Replace all lines\n # before the second record_id with empty lines (to keep line location\n # in error reports accurate)\n content_from_second_record_id = remove_all_text_content_before_second_record_id(content)\n paragraphs_without_subtitle_mark = check_content_file(content_from_second_record_id)\n if paragraphs_without_subtitle_mark.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n paragraphs_without_subtitle_mark.map { |(line, para)|\n Reportable.error(\n {\n filename: content_at_file.filename,\n line: line,\n context: para.inspect,\n },\n [\"Paragraph doesn't start with a subtitle_mark\"]\n )\n }\n )\n end\n else\n raise ArgumentError.new(\"Invalid @options[:content_type]: #{ @options[:content_type].inspect }\")\n end\n end",
"def import_to\n begin\n study = Study.find(params[:study_id])\n \n unless study.user_id != session[:user_id] || study.active == true\n sparql = SPARQL::Client.new(\"http://dbpedia.org/sparql\")\n \n category = params[:category_name].gsub ' ', '_'\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n ?name <http://xmlns.com/foaf/0.1/depiction> ?image .\n FILTER (LANG(?description) = 'en')\n }\")\n \n unless items.size < 1\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n image = item[:image].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.image = image\n i.save\n end\n end\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n FILTER (LANG(?description) = 'en')\n }\")\n \n if items.size > 0\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n unless Item.where(name: name).size > 0\n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.save\n end\n end\n else\n flash[:error] = \"Please enter a valid Wikipedia category.\"\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end",
"def fetch_local_bibitem(xmldoc)\n xmldoc.xpath(\"//bibitem[formattedref][uri[@type = 'citation']]\")\n .each do |b|\n uri = b&.at(\"./uri[@type = 'citation']\")&.text\n bibitem = read_local_bibitem(uri) or next\n bibitem[\"id\"] = b[\"id\"]\n b.replace(bibitem)\n end\n end",
"def load_legacy_ingest_content(dirname )\n json_doc = TaskHelpers.load_json_doc( File.join( dirname, TaskHelpers::DOCUMENT_JSON_FILE ) )\n xml_doc = TaskHelpers.load_xml_doc( File.join( dirname, TaskHelpers::DOCUMENT_XML_FILE ) )\n return json_doc, xml_doc\n end",
"def extract_extends_data\n @extends_data.tap { @extends_data = nil }\n end",
"def load_notetags\n init_custom_fields\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when /<image:\\s*\"(.*)\"\\s*>/i\n @image = $1\n when /<subtype_id:\\s*(\\d*)\\s*>/i\n @subtype_id = $1.to_i\n end\n }\n end",
"def update_local_storage\n xml = HTTParty.get(self.url).body\n content = Feedjira.parse(xml)\n\n self.title = Feed.parse_for_title(content)\n self.image = Feed.parse_for_image_source(content)\n self.articles += Feed.convert_articles(content.entries).select do |article|\n is_new = true\n self.articles.each do |existing_article|\n if (existing_article.title == article.title && existing_article.published_date == article.published_date)\n is_new = false\n break\n end\n end\n is_new\n end\n\n self.save\n end",
"def importing\n @dataset = Dataset.where(id: params.fetch(:id)).first\n render plain: @dataset.import_status\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 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 merge_requests_to_import\n project.merge_requests.id_not_in(already_imported_objects).with_state(:merged)\n end",
"def transform_and_load_parse_data(data_type, user_id, update_scores)\n if data_type == \"Mood\"\n @parse_moods.each do |parse_mood|\n\n find_timestamp(\"Mood\", parse_mood[\"objectId\"])\n if @timestamp != nil\n mood_timestamp = @timestamp\n else\n mood_timestamp = parse_mood[\"createdAt\"]\n end\n\n if !duplicate_entry_exists?(data_type, parse_mood[\"objectId\"], user_id)\n mood = Mood.new(\n :mood_rating => (parse_mood[\"moodRating\"] + 1),\n :anxiety_rating => (parse_mood[\"anxietyRating\"] + 1),\n :irritability_rating => (parse_mood[\"irritabilityRating\"] + 1),\n :user_id => user_id,\n :timestamp => mood_timestamp\n )\n mood.created_at = parse_mood[\"createdAt\"]\n mood.updated_at = parse_mood[\"updatedAt\"]\n mood.parse_object_id = parse_mood[\"objectId\"]\n if !mood.save!\n @unsaved_mood_ids << parse_mood[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, mood_timestamp)\n end\n else\n if update_scores\n update_user_scorecard(data_type, user_id, mood_timestamp)\n end\n if duplicate_entry_updated?(data_type, parse_mood[\"objectId\"], parse_mood, user_id)\n mood = Mood.where(parse_object_id: parse_mood[\"objectId\"]).where(user_id: user_id).first\n mood.mood_rating = (parse_mood[\"moodRating\"] + 1)\n mood.anxiety_rating = (parse_mood[\"anxietyRating\"] + 1)\n mood.irritability_rating = (parse_mood[\"irritabilityRating\"] + 1)\n mood.timestamp = mood_timestamp\n mood.created_at = parse_mood[\"createdAt\"]\n mood.updated_at = parse_mood[\"updatedAt\"]\n mood.parse_object_id = parse_mood[\"objectId\"]\n if !mood.save!\n @unsaved_mood_ids << parse_mood[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, mood_timestamp)\n end\n end\n end\n end\n\n elsif data_type == \"Sleep\"\n @parse_sleeps.each do |parse_sleep|\n if !duplicate_entry_exists?(data_type, parse_sleep[\"objectId\"], user_id)\n sleep = Sleep.new(\n :start_time => parse_sleep[\"startTime\"],\n :finish_time => parse_sleep[\"finishTime\"],\n :time => (parse_sleep[\"finishTime\"].to_i - parse_sleep[\"startTime\"].to_i) / 3600,\n :quality => (parse_sleep[\"quality\"] + 1),\n :user_id => user_id\n )\n sleep.created_at = parse_sleep[\"createdAt\"]\n sleep.updated_at = parse_sleep[\"updatedAt\"]\n sleep.parse_object_id = parse_sleep[\"objectId\"]\n if !sleep.save!\n @unsaved_sleep_ids << parse_sleep[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, parse_sleep[\"finishTime\"])\n end\n else\n if update_scores\n update_user_scorecard(data_type, user_id, parse_sleep[\"finishTime\"])\n end\n if duplicate_entry_updated?(data_type, parse_sleep[\"objectId\"], parse_sleep, user_id)\n sleep = Sleep.where(parse_object_id: parse_sleep[\"objectId\"]).where(user_id: user_id).first\n sleep.start_time = parse_sleep[\"startTime\"]\n sleep.finish_time = parse_sleep[\"finishTime\"]\n sleep.time = (parse_sleep[\"finishTime\"].to_i - parse_sleep[\"startTime\"].to_i) / 3600\n sleep.quality = (parse_sleep[\"quality\"] + 1)\n sleep.created_at = parse_sleep[\"createdAt\"]\n sleep.updated_at = parse_sleep[\"updatedAt\"]\n sleep.parse_object_id = parse_sleep[\"objectId\"]\n if !sleep.save!\n @unsaved_sleep_ids << parse_sleep[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, parse_sleep[\"finishTime\"])\n end\n end\n end\n end\n\n elsif data_type == \"SelfCare\"\n @parse_self_cares.each do |parse_self_care|\n\n find_timestamp(\"SelfCare\", parse_self_care[\"objectId\"])\n if @timestamp != nil\n self_care_timestamp = @timestamp\n else\n self_care_timestamp = parse_self_care[\"createdAt\"]\n end\n\n if !duplicate_entry_exists?(data_type, parse_self_care[\"objectId\"], user_id)\n self_care = SelfCare.new(\n :counseling => parse_self_care[\"counseling\"],\n :medication => parse_self_care[\"medication\"],\n :meditation => parse_self_care[\"meditation\"],\n :exercise => parse_self_care[\"exercise\"],\n :user_id => user_id,\n :timestamp => self_care_timestamp\n )\n self_care.created_at = parse_self_care[\"createdAt\"]\n self_care.updated_at = parse_self_care[\"updatedAt\"]\n self_care.parse_object_id = parse_self_care[\"objectId\"]\n if !self_care.save!\n @unsaved_self_care_ids << parse_self_care[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, self_care_timestamp)\n end\n else\n if update_scores\n update_user_scorecard(data_type, user_id, self_care_timestamp)\n end\n if duplicate_entry_updated?(data_type, parse_self_care[\"objectId\"], parse_self_care, user_id)\n self_care = SelfCare.where(parse_object_id: parse_self_care[\"objectId\"]).where(user_id: user_id).first\n self_care.counseling = parse_self_care[\"counseling\"]\n self_care.medication = parse_self_care[\"medication\"]\n self_care.meditation = parse_self_care[\"meditation\"]\n self_care.exercise = parse_self_care[\"exercise\"]\n self_care.timestamp = self_care_timestamp\n self_care.created_at = parse_self_care[\"createdAt\"]\n self_care.updated_at = parse_self_care[\"updatedAt\"]\n self_care.parse_object_id = parse_self_care[\"objectId\"]\n if !self_care.save!\n @unsaved_self_care_ids << parse_self_care[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, self_care_timestamp)\n end\n end\n end\n end\n\n elsif data_type == \"Journal\"\n @parse_journals.each do |parse_journal|\n\n find_timestamp(\"Journal\", parse_journal[\"objectId\"])\n if @timestamp != nil\n journal_timestamp = @timestamp\n else\n journal_timestamp = parse_self_care[\"createdAt\"]\n end\n\n if !duplicate_entry_exists?(data_type, parse_journal[\"objectId\"], user_id)\n journal = Journal.new(\n :journal_entry => parse_journal[\"journalEntry\"],\n :user_id => user_id,\n :timestamp => journal_timestamp\n )\n journal.created_at = parse_journal[\"createdAt\"]\n journal.updated_at = parse_journal[\"updatedAt\"]\n journal.parse_object_id = parse_journal[\"objectId\"]\n if !journal.save!\n @unsaved_journal_ids << parse_journal[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, journal_timestamp)\n end\n else\n if update_scores\n update_user_scorecard(data_type, user_id, journal_timestamp)\n end\n if duplicate_entry_updated?(data_type, parse_journal[\"objectId\"], parse_journal, user_id)\n journal = Journal.where(parse_object_id: parse_journal[\"objectId\"]).where(user_id: user_id).first\n journal.journal_entry = parse_journal[\"journalEntry\"]\n journal.timestamp = journal_timestamp\n journal.created_at = parse_journal[\"createdAt\"]\n journal.updated_at = parse_journal[\"updatedAt\"]\n journal.parse_object_id = parse_journal[\"objectId\"]\n if !journal.save!\n @unsaved_journal_ids << parse_journal[\"objectId\"]\n else\n update_user_scorecard(data_type, user_id, journal_timestamp)\n end\n end\n end\n end\n end\n end",
"def importation\n Dir.mkdir(importation_route) unless File.exists?(importation_route)\n spreadsheet = Dir.glob(\"#{importation_route}/*\")[0]\n xlsx = Roo::Spreadsheet.open(spreadsheet)\n\n xlsx.each_with_pagename do |name, sheet|\n unless name.include?('Nota')\n state = State.find_by_name(name)\n unless state\n state = State.create(name: name)\n end\n sheet.each_with_index(D_mnpio: 'mnpio', d_asenta: 'asenta',\n d_codigo: 'codigo') do |attributes, index|\n unless index == 0\n city = City.find_by(name: attributes[:D_mnpio], state_id: state&.id)\n unless city\n city = City.create(name: attributes[:D_mnpio], state_id: state&.id)\n end\n colony = Colony.find_by(name: attributes[:d_asenta], postcode: attributes[:d_codigo], city_id: city&.id)\n unless colony\n Colony.create(name: attributes[:d_asenta], postcode: attributes[:d_codigo], city_id: city&.id)\n end\n end\n end\n end\n end\n end",
"def import(contents)\n\t\tdoc = Nokogiri.XML(contents)\n\n\t\tdoc.xpath(\"//body//outline\").inject(Array.new) do |feeds, outline|\n\t\t\tnext if outline.attributes.empty?\n\t\t\tfeeds << Outline.new(xml_node_to_hash(outline.attributes))\n\t\tend\n\tend",
"def report_content_sources(options)\n input_file_spec = options['input'] || 'content_dir/at_files'\n content_base_dir = config.base_dir('content_dir')\n folio_import_base_dir = config.base_dir('folio_import_dir')\n idml_import_base_dir = config.base_dir('idml_import_dir')\n total_count = 0\n folio_sourced = []\n idml_sourced = []\n other_sourced = []\n\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(input_file_spec),\n /\\.at\\Z/i,\n nil,\n \"Reading AT files\",\n options\n ) do |contents, filename|\n total_count += 1\n idml_input_filename = filename.gsub(content_base_dir, idml_import_base_dir)\n .gsub(/\\.at/, '.idml.at')\n folio_input_filename = filename.gsub(content_base_dir, folio_import_base_dir)\n .gsub(/\\.at/, '.folio.at')\n if File.exists?(idml_input_filename)\n idml_sourced << filename\n elsif File.exists?(folio_input_filename)\n folio_sourced << filename\n else\n other_sourced << filename\n end\n end\n\n lines = [\n \"List sources of content_at files\",\n '-' * 40,\n ]\n if idml_sourced.any?\n lines << \" - The following #{ idml_sourced.length } content AT files are sourced from Idml:\"\n idml_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Idml.\"\n end\n if folio_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are sourced from Folio:\"\n folio_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Folio.\"\n end\n if other_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are from other sources:\"\n other_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files from other sources.\"\n end\n lines << '-' * 40\n lines << \"Sources summary:\"\n lines << \" - Idml: #{ idml_sourced.length }\"\n lines << \" - Folio: #{ folio_sourced.length }\"\n lines << \" - Other: #{ other_sourced.length }\"\n total_sourced = idml_sourced.length + folio_sourced.length + other_sourced.length\n lines << \"Determined sources for #{ total_sourced } of #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir('reports_dir'), 'content_sources.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report content_sources`\\n\"\n }\n end",
"def import_lines(type, file_name)\n on AccountingLine do |line|\n line.send(\"import_lines_#{type}\")\n line.send(\"account_line_#{type}_file_name\").set($file_folder+file_name)\n line.send(\"add_#{type}_import\")\n update_from_page!(type)\n end\n end",
"def load_from_xml(f)\n case f\n when Array\n f.each { |filename| load_from_xml(filename) }\n when String\n load_from_xml(File.open(f))\n when IO\n tf = PROIELXML::Reader.parse_io(f)\n\n tf.proiel.sources.each do |s|\n @sources << Source.new(self, s.id, tf.proiel.export_time, s.language, s.dialect,\n bundle_metadata(s), s.alignment_id) do |source|\n build_divs(s, source)\n end\n\n index_source_objects!(@sources.last)\n end\n\n tf.proiel.dictionaries.each do |s|\n @dictionaries << Dictionary.new(self, tf.proiel.export_time, s.language, s.dialect, s)\n\n index_dictionary_objects!(@dictionaries.last)\n end\n\n annotation_schema = AnnotationSchema.new(tf.proiel.annotation)\n schema_version = tf.proiel.schema_version\n\n @annotation_schema ||= annotation_schema\n @schema_version ||= schema_version\n\n if @annotation_schema == annotation_schema and @schema_version == schema_version\n # FIXME: consolidate export times? This is a design flaw in PROIEL XML\n # 2.0: export time ought to be per source not per PROIEL XML file, so\n # not clear what to do here. Pass it down to the source object?\n # @export_time = tf.proiel.export_time\n else\n raise SchemaMismatch\n end\n else\n raise ArgumentError, 'expected filename, IO or array of these'\n end\n\n self\n end",
"def load_tomls(default, secondary)\n load_toml(default).deep_merge(load_toml(secondary))\n end",
"def parse_feed(options={})\n document = read_from_file(filename)\n document.extend Hashie::Extensions::DeepFetch\n recommendations = document.deep_fetch('ObjectList', 'Article') { nil }\n\n Array(recommendations).each do |item|\n doi = item['Doi']\n # sometimes doi metadata are missing\n break unless doi\n\n # turn classifications into array with lowercase letters\n classifications = item['Classifications'] ? item['Classifications'].downcase.split(\", \") : []\n\n year = Time.zone.now.year\n month = Time.zone.now.month\n\n recommendation = { 'year' => year,\n 'month' => month,\n 'doi' => doi,\n 'f1000_id' => item['Id'],\n 'url' => item['Url'],\n 'score' => item['TotalScore'].to_i,\n 'classifications' => classifications,\n 'updated_at' => Time.now.utc.iso8601 }\n\n # try to get the existing information about the given article\n data = get_result(db_url + CGI.escape(doi))\n\n if data['recommendations'].nil?\n data = { 'recommendations' => [recommendation] }\n else\n # update existing entry\n data['recommendations'].delete_if { |recommendation| recommendation['month'] == month && recommendation['year'] == year }\n data['recommendations'] << recommendation\n end\n\n # store updated information in CouchDB\n put_alm_data(db_url + CGI.escape(doi), data: data)\n end\n end",
"def import( file, project, input, options = {})\n # TODO - is there a default .. XML .. ?? - can't think of suitable one !\n # - if no suitable default exists raise error cos no abstract in Ruby\n end",
"def import\n att_file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n enr_file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n ili_file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n EnrollmentImporter.new(@enroll_file).import_csv unless @enroll_file.blank?\n AttendanceImporter.new(@attendance_file).import_csv unless @attendance_file.blank?\n IliImporter.new(@ili_file).import_csv unless @ili_file.blank?\n File.rename(@enroll_file, enr_file_name) unless @enroll_file.blank?\n File.rename(@attendance_file, att_file_name) unless @attendance_file.blank?\n File.rename(@ili_file, ili_file_name) unless @ili_file.blank?\n FileUtils.mv(enr_file_name, File.join(@dir, \"archive\")) unless @enroll_file.blank?\n FileUtils.mv(att_file_name, File.join(@dir, \"archive\")) unless @attendance_file.blank?\n FileUtils.mv(ili_file_name, File.join(@dir, \"archive\")) unless @ili_file.blank?\n end",
"def migrate_undergraduate_paper(path, content_server_url, collection_mapping_doc_path, user) \r\nresult = 1 # default is fail\r\nmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . (app one is not namespaced)\r\ncommon = CommonMigrationMethods.new\r\nputs \"migrating a ug_paper with content url\"\t\r\n\tfoxmlpath = path\t\r\n\t# enforce UTF-8 compliance when opening foxml file\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\t\t\t\r\n\t\r\n\t# establish parent collection - map old to new from mappings file\r\n\tcollection_mappings = {}\r\n\tmapping_text = File.read(collection_mapping_doc_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |line| \r\n\t\told_id = line[0]\r\n\t\tnew_id = line[2]\t\t\r\n\t\tcollection_mappings[old_id] = new_id\r\n\tend\r\n\t\r\n\t# make sure we have current rels-ext version\r\n\trels_nums = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion/@ID\",ns)\t\r\n\trels_all = all = rels_nums.to_s\r\n\tcurrent_rels = rels_all.rpartition('.').last \r\n\trels_current_version = 'RELS-EXT.' + current_rels\r\n\tuntrimmed_former_parent_pid = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[@ID='#{rels_current_version}']/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf/@rdf:resource\",ns).to_s\t\r\n\t# remove unwanted bits \r\n\tformer_parent_pid = untrimmed_former_parent_pid.sub 'info:fedora/york', 'york'\r\n\tparentcol = collection_mappings[former_parent_pid]\r\n\t# find max dc version\r\n\tnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tall = nums.to_s\r\n\tcurrent = all.rpartition('.').last \r\n\tcurrentVersion = 'DC.' + current\r\n\t\r\n\t# find the max THESIS_MAIN or EXAM_PAPER version\r\n\tmainDocFound=\"\"\r\n\t#check for one or the other with an active state A\r\n\tmainDocFound = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN'][@STATE='A']/@VERSIONABLE\",ns).to_s\r\n\tif mainDocFound.length > 0\r\n\t main_resource_id = \"THESIS_MAIN\"\r\n\telse\r\n\t\tmainDocFound = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER'][@STATE='A']/@VERSIONABLE\",ns).to_s\r\n\t\tif mainDocFound.length > 0 \r\n\t\t\tmain_resource_id = \"EXAM_PAPER\"\r\n\t\tend\r\n\tend\t\r\n\tif mainDocFound.length > 0 && main_resource_id == \"THESIS_MAIN\"\r\n\t\tpaper_nums = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion/@ID\",ns)\t\r\n\telsif mainDocFound.length > 0 && main_resource_id == \"EXAM_PAPER\"\r\n\t\tpaper_nums = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/foxml:datastreamVersion/@ID\",ns)\r\n\telse\r\n\t#do nothing. apparently there are some in the live system without any main file\r\n\t\t#result = 2 # this will trigger putting a specific message into the tracking file\r\n\t\t#return \r\n\tend\t\r\n\tif mainDocFound.length > 0\r\n\t\tpaper_all = paper_nums.to_s\r\n\t\tpaper_current = paper_all.rpartition('.').last\r\n\t\tcurrentPaperVersion = main_resource_id + '.' + paper_current\r\n\t\t# GET CONTENT - get the location of the pdf as a string\r\n\t\t#pdf_loc = \tdoc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/foxml:contentLocation/@REF\",ns).to_s\t\r\n\t\tpdf_loc = doc.xpath(\"//foxml:datastream[@ID='\" + main_resource_id + \"']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t# CONTENT FILES\t\r\n\t\texternalpdfurl = pdf_loc.sub 'http://local.fedora.server', content_server_url \r\n\t\texternalpdflabel = main_resource_id #default\r\n\t\t# actual label for gui display may be different\r\n\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='\" + main_resource_id + \"']/foxml:datastreamVersion[@ID='#{currentPaperVersion}']/@LABEL\",ns).to_s \r\n\t\tif label.length > 0\r\n\t\t\texternalpdflabel = label \r\n\t\tend\r\n\tend\r\n# hash for any THESIS_ADDITIONAL URLs. needs to be done here rather than later to ensure we obtain overridden version og FileSet class rather than CC as local version not namespaced\r\n#not needed for any yet. uncomment if live ingest contains any with additional resources and edit accordingly\r\n=begin\r\n additional_filesets = {}\t\r\n\telems = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\telems.each { |id| \r\n\t\tidname = id.attr('ID')\t\t\r\n\t\tif idname.start_with?('THESIS_ADDITIONAL')\r\n\t\tidstate = id.attr('STATE')\r\n\t\tif idstate == \"A\"\r\n\t\t\tversion_nums = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion/@ID\",ns)\r\n\t\t\tcurrent_version_num = version_nums.to_s.rpartition('.').last\r\n\t\t\tcurrent_version_name = idname + '.' + current_version_num\r\n\t\t\taddit_file_loc = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t\taddit_file_loc = addit_file_loc.sub 'http://local.fedora.server', content_server_url\r\n\t\t\tfileset = Object::FileSet.new\r\n\t\t\tfileset.filetype = 'externalurl'\r\n\t\t\tfileset.external_file_url = addit_file_loc\r\n\t\t\tfileset.title = [idname]\r\n\t\t\t# may have a label - needed for display- that is different to the datastream title\r\n\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/@LABEL\",ns).to_s \r\n\t\t\tif label.length > 0\r\n\t\t\tfileset.label = label\r\n\t\t\tend\r\n\t\t\tfileset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tfileset.depositor = \"ps552@york.ac.uk\"\r\n\t\t\tadditional_filesets[idname] = fileset\r\n\t\t\tend\r\n\t\tend\r\n\t}\r\n=end #coz there dont seem to be any in this collection\r\n\t\t\r\n\t# create a new thesis implementing the dlibhydra models\r\n\tug_paper = Object::Thesis.new #we have decided to use this model\r\n\t# once depositor and permissions defined, object can be saved at any time\r\n\tug_paper.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tug_paper.depositor = user\r\n\t\r\n\t# start reading and populating data\r\n\ttitle = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:title/text()\",ns).to_s\r\n\ttitle = title.to_s\r\n\ttitle.gsub!(\"&\",\"&\")\r\n\t\r\n\tug_paper.title = [title]\t# 1 only\r\n\tformer_id = doc.xpath(\"//foxml:digitalObject/@PID\",ns).to_s\r\n\tif former_id.length > 0\r\n\t\tug_paper.former_id = [former_id]\r\n\tend\r\n\t\r\n\t# file to list what its starting work on as a cleanup tool. doesnt matter if it doesnt get this far as there wont be anything to clean up\r\n\ttname = \"ug_tracking.txt\"\r\n\ttrackingfile = File.open(tname, \"a\")\r\n\ttrackingfile.puts( \"am now working on \" + former_id + \" title:\" + title )\r\n\ttrackingfile.close\t\r\n\tcreators = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).each do |c|\r\n\t\tcreator = c.to_s\r\n\t\tcreators.push(creator)\r\n\tend\r\n\t#may not always be present \r\n\tcreators.each do |creator|\r\n\t\tcreator.gsub!(\"&\",\"&\") #unlikely but no harm done - could be group projects\r\n\t\tug_paper.creator_string += [creator] # now multivalued\r\n\tend\r\n\t# essays and projects have a description rather than an abstract optional field so test presence\r\n\tpaper_descriptions = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).each do |d|\r\n\t d = d.to_s\r\n\t\td.gsub!(\"&\",\"&\")\r\n\t\tpaper_descriptions.push(d)\t\t\r\n\tend\r\n\tpaper_descriptions.each do |d|\r\n\t\td.gsub!(\"&\",\"&\") \r\n\t\tug_paper.description += [d] # now multivalued\r\n\tend\r\n\t\r\n\t\r\n\t# use date_of_award for UG papers - metadata team have confirmed\r\n\tpaper_date = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:date/text()\",ns).to_s\t\r\n\tif paper_date.length > 0\r\n\t\t#ug_paper.date = [paper_date] \r\n\t\tug_paper.date_of_award = paper_date\r\n\tend\r\n\t# advisor 0... 1 so check if present\r\n\tpaper_advisor = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:contributor/text()\",ns).each do |i|\r\n\t\tpaper_advisor.push(i.to_s)\r\n\tend\r\n\tpaper_advisor.each do |c|\r\n\t\tug_paper.advisor_string.push(c)\r\n\tend\t\r\n\t\r\n\t # departments and institutions \r\n\t#in this collection the loc may also be defined in the creator!\r\n locations = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:publisher/text()\",ns).each do |i|\r\n\t\tlocations.push(i.to_s)\r\n\t end\r\n\t \r\n\t #if publisher element is not present (which may be the case for essays and projects) see if creator is present, and if so, if it contains the right sort of content - ie a university department rather than a personal name\r\n\t if locations.size == 0\r\n\t\tif creators.size > 0\r\n\t\t\tcreators.each {|c|\r\n\t\t\tputs \"c was\" + c.to_s\r\n\t\t\t\tif c.downcase.include? \"department\" or c.downcase.include? \"dept\" or c.downcase.include? \"university\" or c.downcase.include? \"school\" or c.downcase.include? \"centre\"\r\n\t\t\t\t\tlocations.push(c.to_s)\r\n\t\t\t\tend\r\n\t\t\t}\t\t\r\n\t\tend\r\n\t end\r\n\t \r\n\t \r\n\t \r\n\t inst_preflabels = []\r\n\t locations.each do |loc|\r\n\t\t# awarding institution id (just check preflabel here as few options)\r\n\t\tif loc.include? \"University of York\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York.\" \r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York:\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"Oxford Brookes University\"\r\n\t\t\tinst_preflabels.push(\"Oxford Brookes University\") #I'v just added this as a minority of our theses come from here!\r\n\t\tend\r\n\t\tinst_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('institution', preflabel)\r\n\t\t\tug_paper.awarding_institution_resource_ids+=[id]\r\n\t\tend\r\n\t\t\t\t\r\n\t\t# department\r\n\t\tdept_preflabels = common.get_department_preflabel(loc)\t\t \r\n\t\tif dept_preflabels.empty?\r\n\t\t\tputs \"no department found\"\r\n\t\tend\r\n\t\tdept_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('department', preflabel)\r\n\t\t\tug_paper.department_resource_ids +=[id]\r\n\t\tend\r\n\tend\r\n\t\r\n\t# qualification level, name, resource type\r\n\ttypesToParse = [] #\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:type/text()\",ns).each do |t|\t\r\n\ttypesToParse.push(t)\r\n\tend\r\n\t# qualification names (object)\r\n\t#will we need this?\r\n\tqualification_name_preflabels = common.get_qualification_name_preflabel(typesToParse)\r\n\tif qualification_name_preflabels.length == 0 \r\n\t\tputs \"no qualification name preflabel found\"\r\n\tend\r\n\tqualification_name_preflabels.each do |q|\t\r\n\t\tqname_id = common.get_resource_id('qualification_name',q)\r\n\t\tif qname_id.to_s != \"unfound\"\t\t\r\n\t\t\tug_paper.qualification_name_resource_ids+=[qname_id]\r\n\t\telse\r\n\t\t\tputs \"no qualification nameid found\"\r\n\t\tend\r\n\tend\t\r\n\t# qualification levels (yml file). this wont really work as mapped for the other files, but can modify here by searching for anything in types including the term indicating a batchelors\r\n\t#degree then forcing it. may also need to try for other things\r\n\ttypesToParse.each do |t|\t\r\n\t\ttype_to_test = t.to_s\r\n\t\tqual_levels = []\r\n\t\tlevels = common.get_qualification_level_term(type_to_test)\r\n\t\tlevels.each do |level|\r\n\t\t\tif !qual_levels.include? level\r\n\t\t\t\tqual_levels.push(level)\r\n\t\t\tend\t\r\n\t\tend\r\n\t\tqual_levels.each do |dl|\r\n\t\t\tug_paper.qualification_level += [dl]\r\n\t\tend\r\n\t\t\r\n\t\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\t\t#should this still be here for UG essays and projects?\r\n\t\t#im assuming that in the case of undergraduate dc:type labelled project rather than thesis, this should still be given the theis subject type \r\n\t\ttheses = [ 'theses','Theses','Dissertations','dissertations','project','Project' ] #KALE should this still be here for UG essays and projects?\r\n\t\tif theses.include? type_to_test\t\r\n\t\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\t\tsubject_id = common.get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\t\tug_paper.subject_resource_ids +=[subject_id]\t\t \r\n\t\tend\r\n\tend\r\n\t\r\n\tpaper_language = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:language/text()\",ns).each do |lan|\r\n\tpaper_language.push(lan.to_s)\r\n\tend\t\r\n\tpaper_language.each do |lan| #0 ..n\r\n\tstandard_language = \"unfound\"\r\n\t standard_language = common.get_standard_language(lan.titleize)#capitalise first letter\r\n\t\tif standard_language!= \"unfound\"\r\n\t\t\tug_paper.language+=[standard_language]\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text not lookup\r\n\tpaper_subject = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\tpaper_subject.push(s.to_s)\r\n\tend\r\n\tpaper_subject.each do |s|\r\n\t\ts.gsub!(\"&\",\"&\")\r\n\t\tug_paper.keyword+=[s] #TODO:: ADDED TO FEDORA AS DC.RELATION NOT DC(OR DC11).SUBJECT!!!\r\n\tend\t\r\n\t\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders \r\n paper_rightsholder = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[not(contains(.,'http')) and not (contains(.,'licenses')) ]\",ns).to_s\r\n if paper_rightsholder.length > 0\r\n\tug_paper.rights_holder=[paper_rightsholder] \r\n end\r\n \r\n # license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\tpaper_rights = defaultLicence\r\n\tpaper_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\n\t\r\n\tnewrights = common.get_standard_rights(paper_rights)# all theses currently York restricted \t\r\n\tif newrights.length > 0\r\n\t\tpaper_rights = newrights\r\n\t\tug_paper.rights=[paper_rights]\t\t\t\r\n\tend\t\r\n\t\r\n\t#check the collection exists before saving and putting in collection\r\n\t# save\t\r\n\tif Object::Collection.exists?(parentcol.to_s)\r\n\t\tug_paper.save!\r\n\t\tid = ug_paper.id\r\n\t\tputs \"paper id was \" +id \r\n\t\tputs \"parent col was \" + parentcol.to_s\r\n\t\tcol = Object::Collection.find(parentcol.to_s)\r\n\t\tputs \"id of col was:\" +col.id\r\n\t\tputs \" collection title was \" + col.title[0].to_s\r\n\t\tcol.members << ug_paper \r\n\t\tcol.save!\r\n\telse\r\n\t\tputs \"couldnt find collection \" + parentcol.to_s\r\n\t\treturn\r\n\tend\r\n\t\r\n\tif mainDocFound.length > 0\r\n\t\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\t\tuser_object = users[0]\r\n\t\tputs \"got the user\"\r\n\t\tbegin\r\n\t\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\t\t#mfset.filetype = 'externalurl'\r\n\t\t\tmfset.filetype = 'managed'\r\n\t\t\t# make this the same as the label\r\n\t\t\tmfset.title = [externalpdflabel]\t#needs to be same label as content file label in foxml \r\n\t\t\tmfset.label = externalpdflabel\r\n\t\t\t# add the external content URL\r\n\t\t\tmfset.external_file_url = externalpdfurl\r\n\t\t\tputs \"added external file url\" + externalpdfurl\r\n\t\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user_object)\r\n\t\t\tactor.create_metadata(ug_paper)\r\n\t\t\t#Declare file as external resource\r\n\t\t\tHydra::Works::AddExternalFileToFileSet.call(mfset, externalpdfurl, 'external_url')\r\n\t\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tmfset.depositor = user\r\n\t\t\tmfset.save!\r\n\t\t\tputs \"fileset \" + mfset.id + \" saved\"\r\n \r\n\t\t\t#this is here because the system tended to lock up during multiple uploads - suspect competition for resources or threading issue somewhere\r\n\t\t\tsleep 20 \t\t\r\n\t\t\tug_paper.mainfile << mfset\r\n\t\t\tsleep 20 \r\n\t\t\tug_paper.save!\r\n\t\trescue\r\n\t\t\tputs \"QUACK QUACK OOPS! addition of external file unsuccesful\"\r\n\t\t\tresult = 4\r\n\t\t\treturn result\t\t\r\n\t\tend \r\n\t\tputs \"all done for external content mainfile \" + id \r\n\t\tresult = 0 \t\t\r\n\t else\r\n\t\tresult = 2\r\n\t end\r\n\r\n#uncomment and edit this if any additional resource files found in records\r\n=begin\r\n\tfor key in additional_filesets.keys() do\t\t\r\n\t\tadditional_thesis_file_fs = additional_filesets[key]\r\n actor = CurationConcerns::Actors::FileSetActor.new(additional_thesis_file_fs, user_object)\r\n actor.create_metadata(ug_paper)\r\n\t\turl = additional_thesis_file_fs.external_file_url\r\n Hydra::Works::AddExternalFileToFileSet.call(additional_thesis_file_fs, url, 'external_url')\r\n additional_thesis_file_fs.save!\r\n\t\tug_paper.members << additional_thesis_file_fs\r\n ug_paper.save!\r\n\t\tputs \"all done for additional file \" + key\r\n\tend\r\n=end\r\n\t \r\n\t#when done, explicity reset big things to empty to ensure resources not hung on to\r\n\t#additional_filesets = {} uncomment if additional content files\r\n doc = nil\r\n\tmapping_text = nil\r\n\tcollection_mappings = {}\t\r\n\t\r\n\treturn result # give it a return value\r\nend",
"def set_content_defaults\r\n @content.user_id = @user.id\r\n @content.user = @user\r\n @content.is_in_startpage = !@content.albums.detect{|a| !a.featured_album?}\r\n @content.is_in_gallery = true\r\n @content_kind_displayname = \"New #{@content.entity_name_for_human.titleize}\".t\r\n @title = @user.login + ' :: ' + @content_kind_displayname\r\n #'New Music Album'.t\r\n #'New Music Contest'.t\r\n end",
"def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n #when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'a']\n # Remove processinfo from 500\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'separatedmaterial'\n ['500','a']\n # we would prefer that information from both the note and subnote appear in subfields of a 506 element, like this:\n # <datafield ind1=\"1\" ind2=\" \" tag=\"506\">\n # <subfield code=\"a\">Restricted until 2020</subfield> <!-- from the subnote/text/content field -->\n # <subfield code=\"f\">Available</subfield> <!-- from the category list -->\n # </datafield>\n when 'accessrestrict'\n ind1 = note['publish'] ? '1' : '0'\n if note['publish'] || @include_unpublished\n if note['rights_restriction']\n result = note['rights_restriction']['local_access_restriction_type']\n if result != []\n result.each do |lart|\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']], ['f', lart])\n end\n else\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']])\n end\n else\n ['506', ind1 ,'', 'a']\n end\n end\n when 'scopecontent'\n ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', ' ', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','d']\n when 'bioghist'\n ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n # Add processinfo to 583\n when 'appraisal', 'processinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished) and if there are not multiple local access restriction types (if there are, that's already handled above)\n unless note['type'] == 'accessrestrict' && note['rights_restriction']\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n\n end\n end",
"def load_imports(imports)\n return unless imports\n\n imports = [imports] unless imports.respond_to?(:to_ary)\n imports.each_with_object({}) do |import, imp|\n imp[String(import[:name])] = case import[:ids]\n when Hash\n [String(import[:ids][:name])]\n else\n import[:ids].map { |id| String(id[:name]) }\n end\n end\n end",
"def use_from_metadata(file_identifier)\n file_metadata = file_set.file_metadata.find { |fm| file_identifier.id.include? fm.id.id }\n if file_metadata\n file_metadata.use\n else\n Valkyrie::Vocab::PCDMUse.OriginalFile\n end\n end",
"def update\n mod_key(\"permalink\") if data.has_key?(\"permalink\") && @fm_mods[\"permalink\"]\n merge_data\n @content.sub!(FRONTMATTER_REGEXP, to_frontmatter) || @content\n end",
"def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end",
"def perform(name)\n filename = find_free_xml(name)\n articles_to_import = []\n unless filename\n puts 'no files left'\n return\n end\n with_locked_xml filename do\n puts \"Opening file at #{filename}\"\n file = File.open filename\n puts \"creating a nokogiri document...\"\n doc = Nokogiri.XML(file)\n if doc.errors.length > 0\n puts \"error reading file #{filename}, marking 'errors'\"\n mark_dataset(filename, 'errors')\n # mark the file as incomplete\n raise 'bad file'\n end\n doc.css('PubmedArticle').each do |article|\n pmid = article.css('MedlineCitation PMID').first.text.to_i\n if pmid\n a = Article.find_or_initialize_by_pubmed_id(pmid)\n a.raw_pubmed_xml = article.to_s\n a.extract_pubmed_data_from_node(article)\n if a.persisted?\n a.save! if a.changed?\n else\n articles_to_import << a\n end\n else\n puts 'Ignoring article without ID... What the hell?'\n end\n end\n\n # we are pretty confident about validity of data\n Article.import articles_to_import, :validate => false if articles_to_import.size > 0\n\n # mark the file as imported\n unmark_dataset(filename, 'errors')\n mark_dataset(filename, 'imported')\n end\n end",
"def import_process_framework\r\n uploaded_file = params[:xml_file]\r\n unless uploaded_file.nil?\r\n orig_name = uploaded_file.original_filename\r\n if File.extname(orig_name).downcase == \".xml\" \r\n data = uploaded_file.read if uploaded_file.respond_to? :read\r\n doc = REXML::Document.new( data )\r\n position_model = ProcessModel.find(:first, :order=> \"position DESC\")\r\n model_position = position_model.nil?? 1: (position_model.position+1) \r\n doc.elements.each(\"process_model\") do |e| \r\n if ProcessModel.find_by_name(e.attributes[\"name\"]).nil? \r\n new_process_model = ProcessModel.new\r\n new_process_model.name = e.attributes[\"name\"]\r\n new_process_model.author_id = User.current.id\r\n new_process_model.date = Time.now\r\n new_process_model.description = e.text\r\n new_process_model.position = model_position\r\n new_process_model.save\r\n ++ model_position\r\n activies = e.get_elements(\"activity\")\r\n activity_position =1\r\n activies.each do |acty|\r\n new_activity = Activity.new\r\n new_activity.name = acty.attributes[\"name\"]\r\n new_activity.description = acty.text\r\n new_activity.model_id = new_process_model.id\r\n new_activity.position= activity_position\r\n ++activity_position\r\n new_activity.save\r\n action_position = 1\r\n actions = acty.get_elements(\"action\")\r\n actions.each do |acns|\r\n new_action = Action.new\r\n new_action.name = acns.attributes[\"name\"]\r\n new_action.description = acns.text\r\n new_action.activity_id = new_activity.id\r\n new_action.position = action_position\r\n new_action.save\r\n ++action_position \r\n task_position = 1\r\n tasks = acns.get_elements(\"task\")\r\n tasks.each do |task|\r\n new_task = PfTask.new\r\n new_task.name = task.attributes[\"name\"]\r\n new_task.description = task.text\r\n new_task.action_id = new_action.id\r\n new_task.position = task_position\r\n ++task_position\r\n new_task.save\r\n end\r\n end\r\n end\r\n \r\n else \r\n flash[:error] = l(:lable_model_already_exist)\r\n redirect_to :controller=>'init_select',:action=>'select_models',:project_id => @project\r\n return\r\n end\r\n end \r\n flash[:notice] = l(:lable_import_successfully)\r\n redirect_to :controller=>'init_select',:action=>'select_models',:project_id => @project\r\n return\r\n else\r\n flash[:error] = l(:lable_import_unsuccessfully)\r\n redirect_to :controller=>'init_select',:action=>'select_models',:project_id => @project\r\n return\r\n end\r\n else\r\n flash[:error] = l(:lable_please_select_file_first)\r\n redirect_to :controller=>'init_select',:action=>'select_models',:project_id => @project\r\n return\r\n end\r\n end",
"def nightly_import!\n import_ieps!(PerDistrict.new.filenames_for_iep_pdf_zips_ordered_oldest_to_newest)\n end",
"def initialize(definition)\n @definition = definition\n \n @encounter_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.127']/cda:entry/cda:encounter\")\n @procedure_importer = SectionImporter.new(\"//cda:procedure[cda:templateId/@root='2.16.840.1.113883.10.20.1.29']\")\n @result_importer = SectionImporter.new(\"//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15']\")\n @vital_sign_importer = SectionImporter.new(\"//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.14']\")\n @medication_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.112']/cda:entry/cda:substanceAdministration\",\n \"./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code\")\n\n @condition_importer = SectionImporter.new(\"//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.103']/cda:entry/cda:act/cda:entryRelationship/cda:observation\",\n \"./cda:value\")\n @null_importer = NullSectionImporter.new\n end",
"def imported?\n # theme should has page_layout, param_values\n themes = TemplateTheme.native.includes(:current_template_release)\n #theme.current_template_release may be nil\n themes.select{|theme| theme.current_template_release.try(:theme_id) == self.id}.present? \n end",
"def inferred_notes\n if scrubbed_notes?\n Rails.logger.debug \"not replacing scrubbed notes\"\n head_notes\n notes\n elsif head_notes.present?\n head_notes\n elsif notes.present? && ff?\n Rails.logger.debug \"not deleting old ff notes\"\n head_notes\n notes\n else\n head_notes\n end\n end"
] | [
"0.61001337",
"0.59466064",
"0.5316787",
"0.5243763",
"0.5201312",
"0.51964575",
"0.50662744",
"0.49114943",
"0.4884987",
"0.48686188",
"0.4845496",
"0.48205814",
"0.4813428",
"0.47976515",
"0.47955358",
"0.47776836",
"0.47776836",
"0.4754573",
"0.47400784",
"0.47339615",
"0.47250673",
"0.47234064",
"0.4719857",
"0.4709448",
"0.4687241",
"0.4675781",
"0.46734098",
"0.4671915",
"0.4662556",
"0.46524924",
"0.4652417",
"0.46504447",
"0.4645394",
"0.46444756",
"0.46441388",
"0.46428588",
"0.46404117",
"0.46213424",
"0.46066698",
"0.46060216",
"0.4605343",
"0.46042874",
"0.4603808",
"0.45985547",
"0.45723614",
"0.45704675",
"0.4566356",
"0.4560965",
"0.4542907",
"0.45403793",
"0.45372912",
"0.45363078",
"0.45114106",
"0.4508028",
"0.44966882",
"0.44942483",
"0.44924664",
"0.44888866",
"0.44843978",
"0.44810507",
"0.44794235",
"0.44777748",
"0.4475114",
"0.44632632",
"0.445898",
"0.44391647",
"0.44370264",
"0.441809",
"0.44179937",
"0.4417642",
"0.4414445",
"0.4413966",
"0.44046003",
"0.44004673",
"0.43904334",
"0.43904334",
"0.43875852",
"0.43736666",
"0.43696272",
"0.4365205",
"0.4361819",
"0.43547085",
"0.4353597",
"0.4353042",
"0.43429574",
"0.43384513",
"0.43347815",
"0.43328977",
"0.43325153",
"0.43250322",
"0.4320534",
"0.43196303",
"0.431854",
"0.4316438",
"0.43143663",
"0.4308879",
"0.4307361",
"0.4299102",
"0.42970902",
"0.4291645"
] | 0.57625264 | 2 |
NOTE: This is very much tailored to handling Stellar requests. | def post_response(url, opts = {})
options = {
parse_json: true,
data: {}
}.merge(opts)
uri = URI.parse(url)
http = HTTPClient.new
begin
response = http.post(uri, options[:data].to_json)
rescue EOFError => e
end
if response
if options[:parse_json]
JSON(response.body).with_indifferent_access
else
response.body
end
else
{
result: {
status: 'error'
}
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onRequest(req)\n\t\tif req.request == 'WHEREAMI?'\n\t\t\tloc = location.space\n\t\t\tresp = {:x => loc.x, :y => loc.y, :sectorx => loc.sector.offsetX, :sectory => loc.sector.offsetY}.to_json\n\t\t\treq.reply('YOURPOS', resp)\n\t\telsif req.request == 'NEARBY?'\n\t\t\tdistOfSight = req.message.to_i\n\t\t\tdistOfSight = SolarSystem::SolarSystemRadius if distOfSight > SolarSystem::SolarSystemRadius\n\t\t\tdistOfSight = 1000 if distOfSight < 1000\n\t\t\t\n\t\t\tresp = []\n\t\t\tloc = location.space\n\t\t\tloc.sector.solarsystemsWithin(loc.x, loc.y, distOfSight).each do |system|\n\t\t\t\tsystem.celestialBodiesWithin(loc.x, loc.y, distOfSight).each do |cb|\n\t\t\t\t\tbodyinfo = {:x => cb.x, :y => cb.y, :type => cb.type}\n\t\t\t\t\tresp.push bodyinfo\n\t\t\t\tend\n\t\t\tend\n\t\t\treq.reply('NEARBY', {:cbs => resp}.to_json)\n\t\telsif req.request == 'DISTANT?'\n\t\t\tloc = location.space\n\t\t\tresp = []\n\t\t\tloc.sector.solarsystems().each do |system|\n\t\t\t\tsystem.distantCelestialBodies.each do |cb|\n\t\t\t\t\tbodyinfo = {:x => cb.x, :y => cb.y, :type => 'star'}\n\t\t\t\t\tresp.push bodyinfo\n\t\t\t\tend\n\t\t\tend\n\t\t\treq.reply('DISTANT', {:cbs => resp}.to_json)\n\t\telsif req.request == 'RESOURCES'\n\t\t\tresourceinfo = {}\n\t\t\tcelestialbody = getCelestialBody(@db, req.getmessage())\n\t\t\tif (celestialbody.solarsystem.sector == location.space.sector)\n\t\t\t\tdist = Math.sqrt((location.space.x - celestialbody.x)**2 + (location.space.y - celestialbody.y)**2)\n\t\t\t\tif (dist <= D)\n\t\t\t\t\tresourceinfo = celestialbody.inventory.resources.to_json\n\t\t\t\tend\n\t\t\tend\n\t\t\treq.reply('RESOURCES', resourceinfo)\n\t\telsif req.request == 'INVENTORY'\n\t\t\tinvinfo = inventory.resources.to_json\t\n\t\t\treq.reply('INVENTORY', invinfo)\n\t\telsif req.request == 'IMOVED'\n\t\t\treqjson = req.json\n\t\t\tif reqjson.include?('sx') && reqjson.include?('sy') && reqjson.include?('x') && reqjson.include?('y')\n\t\t\t\t# TODO: Handle other sectors\n\t\t\t\t# TODO: Check validity of move\n\t\t\t\tlocation.setSpace(astroLocationFromCoords(location.space.sector, reqjson['x'].to_i, reqjson['y'].to_i))\n\t\t\tend\n\t\telsif req.request == 'NEARBYENT?'\n\t\t\tdistOfSight = req.message.to_i\n\t\t\tdistOfSight = SolarSystem::SolarSystemRadius if distOfSight > 10 * SolarSystem::SolarSystemRadius\n\t\t\tdistOfSight = 1000 if distOfSight < 1000\n\t\t\t\n\t\t\tresp = nearbyObservable(distOfSight)\n\t\t\treq.reply('NEARBYENT', {:ent => resp}.to_json)\n\t\tend\n\tend",
"def http_get_early(request, response)\n params = request.query_parameters\n return http_get(request, response) if params['sabreAction'] == 'info'\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def parse_response!; end",
"def perform(request, response); end",
"def request(*args); end",
"def service_request(service); end",
"def request_data; end",
"def sellsy_request(sellsy_request, sellsy_params)\n # Set the API URL\n url = URI(\"https://apifeed.sellsy.com/0/\")\n\n # Define the timestamp & a random nonce\n timestamp = Time.now.to_i\n nonce = SecureRandom.hex(6)\n\n # Setup the URL host and port, and force to use SSL (Sellsy don't authorize request without TLS)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n\n # Store the POST request in a new var\n request = Net::HTTP::Post.new(url)\n # HTTP request headers\n request[\"cache-control\"] = 'no-cache'\n request[\"accept\"] = '*/*'\n request[\"content-type\"] = 'application/x-www-form-urlencoded'\n # HTTP request body\n request.set_form_data(\n \"do_in\" => {\n \"method\" => sellsy_request,\n \"params\" => sellsy_params\n }.to_json,\n \"io_mode\" => \"json\",\n \"request\" => 1,\n \"oauth_consumer_key\" => \"YOUR CONSUMER KEY\",\n \"oauth_token\" => \"YOUR TOKEN KEY\",\n \"oauth_signature_method\" => \"PLAINTEXT\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => 1.0,\n \"oauth_signature\" => \"YOUR CONSUMER SECRET & YOUR TOKEN SECRET\"\n ).to_json\n\n # Launch the HTTP request\n response = http.request(request)\n # Return the response\n return response.read_body\nend",
"def global_request(packet); end",
"def conditional_requests; end",
"def conditional_requests; end",
"def content_get\n\t\t\t# compress GET requests to try and stay under that 8KB request limit\n\t\t\tdeflated_request = Zlib::Deflate.deflate(@request, 9)[2..-5]\n\t\t\t# strict_encode64() isn't available? sub out the newlines\n\t\t\t@request_params[\"SAMLRequest\"] = Base64.encode64(deflated_request).gsub(/\\n/, \"\")\n\t\t\t\n\t\t\tLogging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n\t\t\turi = Addressable::URI.parse(@URL)\n\t\t\turi.query_values = @request_params\n\t\t\turl = uri.to_s\n\t\t\t#url = @URL + \"?SAMLRequest=\" + @request_params[\"SAMLRequest\"]\n\t\t\tLogging.debug \"Sending to URL #{url}\"\n\t\t\treturn url\n\t\tend",
"def apply_request(request_env); end",
"def send_request; end",
"def query(action, hash = {})\n # uri = URI.parse(\"https://130.59.10.31\")\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n #\n # request = Net::HTTP::Get.new(uri.request_uri)\n #\n # response = http.request(request)\n # response.body\n # response.status\n # response[\"header-here\"] # All headers are lowercase\n uri = URI.parse(@url + \"/api/xml?action=#{action}\")\n hash.each_pair do |key, val|\n if val\n if key == \"filter\" or key == \"sort\"\n uri.query += val.query\n else\n uri.query += \"&\" + key + \"=\" + CGI::escape(\"#{val}\")\n end\n end\n end\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n # logger = Logger.new('log/development.log')\n # logger.info(url.path + \"?\" + url.query)\n if @sessionid\n request.add_field(\"Cookie\", \"BREEZESESSION=\"+@sessionid)\n end\n puts \"ACS query - request: \" + request.path\n response = http.request(request)\n puts \"ACS query - response: \" + response.body.inspect\n return response\n end",
"def partial_request(uri, range)\nbegin\nresponse = open(uri, 'Range' => range)\nrescue OpenURI::HTTPError => e\nresponse = e.io\nend\n\nputs \"Status code: #{response.status.inspect}\"\nputs \"Representation size: #{Response.size}\"\nputs \" Content Range: #{response.meta['content-range']}\"\nputs \" Etag: #{response.meta['etag']}\"\nend",
"def xml_http_request?; end",
"def perform_api_request(query) \n request = Net::HTTP::Post.new( \n $url.path + ($url.query != nil ? (\"?\" + $url.query) : \"\"), \n initheader = {\"Content-Type\" => \"application/json\", \n \"X-Replicon-Security-Context\" => \"User\"}) \n request.basic_auth($companyKey + \"\\\\\" + $loginname, $password) \n request.body = JSON.generate(query) \n \n server = Net::HTTP.new($url.host, $url.port) \n server.use_ssl = $url.scheme == \"https\" \n response = server.start {|http| http.request(request)} \n \n http_code = response.code.to_i \n if http_code != 200 \n puts response.body \n raise \"Expected success code 200, but was #{http_code}\" \n end \n \n return JSON.parse(response.body) \nend",
"def net_http_res; end",
"def do_request(params)\n # Convert the uri to a URI if it's a string.\n if params[:uri].is_a?(String)\n params[:uri] = URI.parse(params[:uri])\n end\n host_url = \"#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? \":#{params[:uri].port}\" : ''}\"\n\n # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to\n # different hosts.\n @connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options)\n\n # Set headers to an empty hash if none are set.\n headers = params[:headers] || {}\n headers['Accept'] = 'application/*+xml;version=1.5' if version == '1.5'\n\n # Add our auth cookie to the headers\n if @cookie\n headers.merge!('Cookie' => @cookie)\n end\n\n # Make the request\n response = @connections[host_url].request({\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers,\n :method => params[:method] || 'GET',\n :path => params[:uri].path\n })\n\n # Parse the response body into a hash\n unless response.body.empty?\n if params[:parse]\n document = Fog::ToHashDocument.new\n parser = Nokogiri::XML::SAX::PushParser.new(document)\n parser << response.body\n parser.finish\n response.body = document.body\n end\n end\n\n response\n end",
"def parse(response)\n\nend",
"def call(request); end",
"def request(*args, &block); end",
"def do_request(params)\n # Convert the uri to a URI if it's a string.\n if params[:uri].is_a?(String)\n params[:uri] = URI.parse(params[:uri])\n end\n host_url = \"#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? \":#{params[:uri].port}\" : ''}\"\n\n # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to\n # different hosts.\n @connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options)\n\n # Set headers to an empty hash if none are set.\n headers = params[:headers] || {}\n\n # Add our auth cookie to the headers\n if @cookie\n headers.merge!('Cookie' => @cookie)\n end\n\n # Make the request\n response = @connections[host_url].request({\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers,\n :method => params[:method] || 'GET',\n :path => params[:uri].path\n })\n\n # Parse the response body into a hash\n #puts response.body\n unless response.body.empty?\n if params[:parse]\n document = Fog::ToHashDocument.new\n parser = Nokogiri::XML::SAX::PushParser.new(document)\n parser << response.body\n parser.finish\n\n response.body = document.body\n end\n end\n\n response\n end",
"def http_call(payload); end",
"def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def run\n super\n\n #\n # This module currently uses the Free API (rate limited / response limited)\n # https://freeapi.robtex.com/ipquery/#{search_ip}\n #\n # Note that a paid version (free up to 10k queries / month) of the API is available at:\n # https://market.mashape.com/robtex/robtex\n #\n\n # Check Robtex API & create entities from returned JSON\n search_ip = _get_entity_name\n search_uri = \"https://freeapi.robtex.com/ipquery/#{search_ip}\"\n\n begin\n details = JSON.parse(http_get_body(search_uri))\n _log \"Got details: #{details}\"\n\n #status\n # Should be \"ok\"\n unless details[\"status\"] == \"ok\"\n _log_error \"Unable to continue\"\n return\n end\n\n #act\n # Active (forward) DNS\n if details[\"act\"]\n details[\"act\"].each do |forward_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => forward_lookup[\"o\"],\n \"time\" => \"#{Time.at(forward_lookup[\"t\"])}\"\n }\n end\n end\n\n #pas\n # Passive (reverse) DNS\n if details[\"pas\"]\n details[\"pas\"].each do |reverse_lookup|\n _create_entity \"DnsRecord\",{\n \"name\" => reverse_lookup[\"o\"],\n \"time\" => \"#{Time.at(reverse_lookup[\"t\"])}\"\n }\n end\n end\n\n #pash\n # Passive DNS history\n # TODO\n\n #acth\n # Active DNS history\n # TODO\n\n #as\n # Autonomous System Number\n if details[\"as\"]\n _create_entity \"AsNumber\",{\n \"name\" => \"AS#{details[\"as\"]}\",\n \"as_name\" => details[\"asname\"],\n \"as_desc\" => details[\"asdesc\"]\n }\n end\n\n # Netblock\n #\n if details[\"bgproute\"]\n _create_entity \"NetBlock\",{\"name\" => \"#{details[\"bgproute\"]}\"}\n end\n\n rescue JSON::ParserError => e\n _log_error \"Unable to get parsable response from #{search_uri}: #{e}\"\n rescue StandardError => e\n _log_error \"Error grabbing robtex details: #{e}\"\n end\n\n\n end",
"def process(request); end",
"def make_api_request(query)\n response = timeout(configuration.timeout) do\n uri = URI.parse(query_url(query))\n http_client.start(uri.host, uri.port, :use_ssl => true) do |client|\n req = Net::HTTP::Post.new(uri.request_uri, configuration.http_headers)\n req.basic_auth(uri.user, uri.password) if uri.user and uri.password\n req.body = sensis_query_json(query)\n req.content_type = 'application/json'\n req['X-Auth-Token'] = configuration.api_key[0]\n req['X-Auth-Password'] = configuration.api_key[1]\n client.request(req)\n end\n end\n case response.code.to_i\n when 200\n return response\n when 400\n raise_error ::Geocoder::InvalidRequest, \"Bad Request: #{response.body}\"\n else\n raise_error ::Geocoder::Error, \"Unable to access Sensis API: #{response.code}. Body:\\n#{response.body}\"\n end\n response\n end",
"def format_request(payload); end",
"def format_request(payload); end",
"def raw_response; end",
"def call(env)\n request = Request.new(env) \n snip, part, format = request_uri_parts(request)\n if snip\n params = request.params.merge(:snip => snip, :part => part, \n :format => format, :method => request.request_method.downcase)\n [200, {\"Content-Type\" => \"text/html\"}, [Vanilla.present(params)]]\n else\n four_oh_four = Vanilla.present(:snip => 'system', :part => 'four_oh_four', :format => 'html')\n [404, {\"Content-Type\" => \"text/html\"}, [four_oh_four]]\n end\n end",
"def conditional_requests=(_arg0); end",
"def parse(request)\n raise NotImplementedError\n end",
"def send_request\n uri = URI('https://www.mhealthappointments.com/rest/searchCompany/searchLocation?zipcode=98144&distance=50&_=1617576760078')\n\n # Create client\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n # Create Request\n req = Net::HTTP::Get.new(uri)\n # Add headers\n req.add_field \"User-Agent\", \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0\"\n # Add headers\n req.add_field \"Accept\", \"application/json, text/javascript, */*; q=0.01\"\n # Add headers\n req.add_field \"Accept-Language\", \"en-US,en;q=0.5\"\n # Add headers\n req.add_field \"Accept-Encoding\", \"gzip\"\n # Add headers\n req.add_field \"X-Requested-With\", \"XMLHttpRequest\"\n # Add headers\n req.add_field \"Connection\", \"keep-alive\"\n # Add headers\n req.add_field \"Referer\", \"https://www.mhealthappointments.com/covidappt\"\n # Add headers\n req.add_field \"Cookie\", \"JSESSIONID=4C6525B591B6A7DC16A0725C10D2B1A0; _ga=GA1.2.1291055990.1617576700; _gid=GA1.2.902042659.1617576700; _gat=1\"\n # Add headers\n req.add_field \"Pragma\", \"no-cache\"\n # Add headers\n req.add_field \"Cache-Control\", \"no-cache\"\n # Add headers\n req.add_field \"Te\", \"Trailers\"\n\n # Fetch Request\n res = http.request(req)\n puts \"Albertsons: #{res.body}\"\n (res.body == \"false\") ? 0 : 1\nrescue StandardError => e\n puts \"HTTP Request failed (#{e.message})\"\nend",
"def request_success(packet); end",
"def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end",
"def request_result\n \n end",
"def send_request(req); end",
"def parse_Request(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\treturn initial,headers,body\n\nend",
"def content_get\n # compress GET requests to try and stay under that 8KB request limit\n deflated_request = Zlib::Deflate.deflate(@request, 9)[2..-5]\n # strict_encode64() isn't available? sub out the newlines\n @request_params[\"SAMLRequest\"] = Base64.encode64(deflated_request).gsub(/\\n/, \"\")\n \n Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n uri = Addressable::URI.parse(@URL)\n if uri.query_values == nil\n uri.query_values = @request_params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = @request_params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end",
"def prapor_quest; end",
"def request(endpoint, request, &block); end",
"def api_request(data)\n params = {'id' => next_sequence_number!}\n params['sid'] = sid if sid\n json_data = [data].to_json\n\n response_body = get_api_response(params,json_data)\n parse_json_response(response_body)\n end",
"def request(*args)\n end",
"def search\n send_request\n parse_response\n end",
"def set_request; end",
"def parse_request request\n\n request_uuid = request.shift\n request_method = request.shift\n\n begin\n request_response = @notifier_engine.process_input request_method.to_sym, request\n rescue => exc\n request_response = \"#{exc.class}: #{exc.message}\"\n end\n\n send_response request_uuid, request_response\n\n end",
"def search_from_four_square_api(search_params,venue_params)\n require \"net/http\"\n conditions=\"\"\n conditions+=\"search?query=\"+search_params[:query]+\"&near=\"+search_params[:near] if search_params[:query]!=nil and search_params[:near]!=nil and venue_params==\"near\"\n conditions+=\"search?ll=\"+search_params[:latitude]+\",\"+search_params[:longitude] if search_params[:latitude]!=nil and search_params[:longitude] and venue_params==\"ll\"\n conditions+=search_params[:venue_id]+\"?\" if search_params[:venue_id]!=nil and venue_params==\"access_id\"\n url=FOURSQUARE_API+conditions+'&client_id='+FOURSQUARE_CLIENT_ID+'&client_secret='+FOURSQUARE_SECRET+'&v='+Time.now.strftime(\"%Y%m%d\")\n uri = URI.parse(URI.escape(url))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request) \n parsed_json = ActiveSupport::JSON.decode(response.body)\n \n return parsed_json\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def request_params; end",
"def build_response(connection, request); end",
"def do_request(request_string)\n\n RestClient.log = logger if (logger.debug? and TRACE != FalseClass)\n\n # make the request specific to the separately configured API.\n url=format_url(request_string)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: url: #{url}\"\n r = Stopwatch.new(Thread.current.to_s+\": \"+url)\n r.start\n begin\n response = RestClient.get url, {:Authorization => \"Bearer #{@token}\",\n 'x-ibm-client-id' => @key,\n :accept => :json,\n :verify_ssl => true}\n\n # If the request has more data pull out the external url to get it.\n more_url = process_link_header(response)\n # fix it up to go through our proxy.\n more_url = reduce_url(more_url, request_string)\n\n ## try to parse as json. If can't do that generate an error.\n json_response = JSON.parse(response)\n\n ## json_response is a JSON object. Only print part of it.\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: esb response as json\"+JSON.generate(json_response)[0..30]\n\n # fix up the json a bit.\n json_response = standardize_json(json_response, response)\n\n ####### Now we have a parsed json object\n # figure out the overall response code for the request. That may come from the esb call or data returned\n # from the request url\n rc = compute_response_code_to_return(json_response, response)\n\n ## We have parsed JSON, now make it a json string so it can be returned\n json_response = JSON.generate(json_response)\n\n wrapped_response = WAPIResultWrapper.new(rc, \"COMPLETED\", json_response, more_url)\n\n ### handle some error conditions explicitly.\n rescue URI::InvalidURIError => exp\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: invalid URI: \"+exp.to_s\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::BAD_REQUEST, \"INVALID URL\", exp.to_s)\n\n rescue StandardError => exp\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: exception: \"+exp.inspect\n if exp.response.code == WAPIStatus::HTTP_NOT_FOUND\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::HTTP_NOT_FOUND, \"NOT FOUND\", exp)\n else\n wrapped_response = WAPIResultWrapper.new(WAPIStatus::UNKNOWN_ERROR, \"EXCEPTION\", exp)\n end\n end\n\n r.stop\n logger.info \"#{self.class.to_s}:#{__method__}:#{__LINE__}:do_request: stopwatch: \"+ r.pretty_summary\n wrapped_response\n end",
"def response\n parse_request\n do_something\n put_response\n end",
"def receive(request); end",
"def parse(uri, response, body); end",
"def http; end",
"def parse_request\n p request.body.string\n case request.content_type\n when JSON_TYPE then parse_json_request\n else parse_http_request\n end\n end",
"def typhoeus_response\n @request.run\n end",
"def request(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end",
"def get_json_from_openstreetmaps(key,val,constrain_to_usa = true)\n timeout = 20000\n bounds = \"#{CONTINENTAL_US[:s]},#{CONTINENTAL_US[:w]},#{CONTINENTAL_US[:n]},#{CONTINENTAL_US[:e]}\"\n bounds_string = constrain_to_usa ? \"(#{bounds})\" : \"\"\n\n #This string fetches all geometry of a way including center points, but does not restrict how many ways to download\n #str = \"data=[out:json][timeout:#{timeout}];way[\\\"#{key}\\\"=\\\"#{val}\\\"](#{bounds_string});foreach((._;>;);out center #{NUMBER_TO_DOWNLOAD};);\"\n\n #This string fetches almost all geometry of a way except for center points. Does restrict number to download. \n str = \"data=[out:json][timeout:#{timeout}][maxsize:1073741824];way[\\\"#{key}\\\"=\\\"#{val}\\\"]#{bounds_string};out count;out meta geom #{NUMBER_TO_DOWNLOAD};\"\n\n print str\n base_url = \"http://overpass-api.de/api/interpreter?\"\n url = \"#{base_url}#{URI.escape(str)}\"\n puts url\n response = Typhoeus.get(url, {followlocation: true, timeout: timeout})\n response.body\nend",
"def process_request(public_request_id) \n\n # parse the URL into verb, resources, options, and body\n @active_requests[public_request_id][:public_request].match /(GET|POST) \\/(\\S*)(.*)^(.*)\\Z/m\n parsed_requests, new_requests, request_resources = [$1, $2, $3, $4], {}, $2\n\n ## handle / (GENERIC) resource requests ##\n if request_resources.empty?\n new_requests = process_generic_request(parsed_requests, public_request_id)\n\n ## handle /TEST_POST/ resource request ##\n elsif request_resources.match /test_post/\n new_requests = process_form_request(parsed_requests, public_request_id)\n \n ## handle ALL OTHER requests ##\n else\n parsed_resources = parsed_requests[1].split(\"/\")\n device_match = ::ArduinoGateway::Model::ModelTemplates::ResourceDevice.find_by_name(parsed_resources[0])\n\n # handle requests for DEVICE-BASED SERVICES\n unless device_match.empty?\n new_requests = process_device_request(parsed_requests, parsed_resources, device_match, public_request_id) \n # handle requests for SERVICES ACCROSS DEVICES\n else \n new_requests = process_service_request(parsed_requests, parsed_resources, device_match, public_request_id)\n end\n\n end # else related to ALL OTHER requests\n\n new_requests.each { | name, request | make_request request }\n @active_requests[public_request_id][:arduino_requests] = new_requests\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def get_response\n parse_response(parse_JSON(get_request))\n end",
"def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end",
"def call_satellite(action, url, user, password, ref, content_type, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :user => user,\n :password => password,\n :verify_ssl => false,\n :headers => { :content_type => content_type, :accept => content_type }\n }\n\n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"Satellite6 Request: #{url} action: #{action} payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_satellite: #{err}. Returning nil.\")\n return nil\n end\nend",
"def _api\n res = TinyURL.pack(request[:turl]) if request[:turl]\n res = TinyURL.unpack(request[:url].split('/').last) if request[:url]\n res = TinyURL.count(request[:hits].split('/').last).to_s if request[:hits]\n res ||= ''\n respond res\n end",
"def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end",
"def response_parser; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def process_kong_request (url, method, payload)\n begin\n url = kong_url + url\n header = {\n 'Accept' => 'application/json, text/plain, */*',\n 'Content-Type' => 'application/json'\n }\n uri = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(uri.host,uri.port)\n\n case method\n when :GET\n req = Net::HTTP::Get.new(uri, header) # GET Method\n when :POST\n req = Net::HTTP::Post.new(uri.path, header) # POST Method\n when :PUT\n req = Net::HTTP::Put.new(uri.path, header) # PUT Method\n when :PATCH\n req = Net::HTTP::Patch.new(uri.path, header) # PATCH Method\n when :DELETE\n req = Net::HTTP::Delete.new(uri.path, header) # DELETE Method\n else\n # Default Case\n end\n\n puts \"HTTP #{ method } to #{ uri.host}:#{ uri.port }. Body: #{ payload.to_json }\"\n body = \"#{ payload.to_json }\"\n res = http.request(req, body)\n if res.body\n JSON.parse(res.body) # Returned Data\n else\n {}\n end\n rescue Exception => e\n puts \"Exception: \" + e.message.to_s + \"\\n\" + e.backtrace_locations.join(\"\\n\") + \"}\"\n { message: e.to_s }.to_json\n end\n end"
] | [
"0.62451726",
"0.588067",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.58186525",
"0.5700883",
"0.56267005",
"0.56157666",
"0.55748546",
"0.55524296",
"0.5511729",
"0.54547125",
"0.5448983",
"0.5448983",
"0.5412694",
"0.5406218",
"0.5392967",
"0.53690994",
"0.5364751",
"0.5364418",
"0.5364365",
"0.5358274",
"0.53487897",
"0.53074855",
"0.5300085",
"0.52963406",
"0.5292914",
"0.52922904",
"0.52899086",
"0.52826333",
"0.52826333",
"0.52826333",
"0.52787733",
"0.5276873",
"0.5270666",
"0.5265113",
"0.5265113",
"0.52365065",
"0.5227833",
"0.5226435",
"0.52261305",
"0.52025855",
"0.5186941",
"0.5182738",
"0.5177963",
"0.5175942",
"0.51573807",
"0.5144187",
"0.5142799",
"0.51410776",
"0.5131483",
"0.5124107",
"0.5116614",
"0.5110692",
"0.5101494",
"0.5097156",
"0.50969034",
"0.5085349",
"0.5081771",
"0.50811607",
"0.50762755",
"0.50756603",
"0.50694126",
"0.50574934",
"0.5056226",
"0.5055822",
"0.50529945",
"0.5051746",
"0.5051063",
"0.5047802",
"0.50263",
"0.50195795",
"0.50185144",
"0.50185144",
"0.5014527",
"0.50013036",
"0.49991897",
"0.4995409",
"0.49921775",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.49755993",
"0.4973572"
] | 0.0 | -1 |
Conversions Currencies need to implement conversion methods for currencies that are not themselves. | def to_btc(value)
value.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_currency_conversion!; end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def currencies\n raise NotImplementedError\n end",
"def convert_to(new_currency)\n\n # if the instance is already in the requested currency\n if @currency == new_currency\n\n #returns itself without conversions\n return self\n\n # if the current currency is different from the base currency used for conversions\n # and also the new currency is different from the base one\n elsif @currency != @@base_currency && new_currency != @@base_currency\n\n # amount is divided by the rate of the current currency in order to convert it to the base currency\n # then is multiplied by the rate of the new currency\n amount = (@amount_bigdecimal/(BigDecimal(@@rates[@currency],0))) * (BigDecimal(@@rates[new_currency],0))\n\n # current currency is different from the base currency but new currency equals the base currency\n elsif @currency != @@base_currency && new_currency == @@base_currency\n\n # amount is divided by the rate of the current currency in order to convert it to the base currency\n amount = (@amount_bigdecimal / @@rates[@currency])\n\n # current currency must be equal to the base currency and be different from the new currency\n else\n\n # amount is multiplied for the rate of the new currency\n amount = @amount_bigdecimal * (BigDecimal.new(@@rates[new_currency],0))\n\n end\n\n # A new istance is returned with the new currency and the calculated amount\n Xchange.new(amount,new_currency)\n\n end",
"def disallow_currency_conversion!\n self.default_bank = Bank::SingleCurrency.instance\n end",
"def convert_to(exchange_currency)\n begin\n exchange_currency = Money::InputSanitizer.sanitize_currency(exchange_currency,Money::CrossRate.get_all_available_currencies)\n Money::LiveConverter.new(@amount.to_f*Money::CrossRate.get_cross_value_for_currency(@currency,exchange_currency),exchange_currency)\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def convert_curr\n curr = {\"USD\" => 1.0, \"CAN\" => 1.9, \"CHF\" => 0.91, \"EUR\" => 0.74, \"HKD\" => 7.75}\n curr.each do |key, value|\n if key == @currency\n @con = @price * value\n end\n end\n end",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def currencies(force = false)\n exchange_rates.currencies(force)\n end",
"def currency_conversions(price = 0.0)\n convert_dollars = price * EXCHANGE_DOLLARS\n convert_euros = price * EXCHANGE_EUROS\n return convert_dollars, convert_euros\nend",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end",
"def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end",
"def exchange(cents, from_currency, to_currency)\n from_currency.upcase!\n to_currency.upcase!\n if !@rates[from_currency] or !@rates[to_currency] \n raise Money::UnknownRate, \"No conversion rate known for '#{from_currency}' -> '#{to_currency}'\"\n end\n ((cents / @rates[from_currency]) * @rates[to_currency]).round\n end",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend",
"def convertCurrency(fromCurrencyCode, toCurrencyCode, price)\n fromRate = get_exchange_rate(fromCurrencyCode)\n toRate = get_exchange_rate(toCurrencyCode)\n (price * toRate) / fromRate\n end",
"def convert_to_currency(target_currency, date = Date.today)\n return self if target_currency == currency\n\n converted_amount = CurrencyExchangeRate.convert(amount, currency, target_currency, date)\n return self.class.new(converted_amount, target_currency)\n end",
"def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end",
"def conversion_rates(currency=\"EUR\",cross_rate={'USD' => 1.11, 'Bitcoin' => 0.0047})\n @currency = Money::InputSanitizer.sanitize_currency(currency)\n @cross_rate = Money::InputSanitizer.sanitize_cross_rate(cross_rate)\n end",
"def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end",
"def base_currency_to_currency(date, to_currency)\n currency_rate(date, to_currency)\n end",
"def with_currency(new_currency); end",
"def convert_to(to_currency)\n\t\tfrom_currency = self.currency\n\t\trate = Money.getRate(from_currency, to_currency)\n\n\t\tconverted_amount = self.amount * rate\n\n\t\tMoney.new(converted_amount, to_currency)\n\tend",
"def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end",
"def convert(euros, exchange_rate)\n euros * (exchange_rate / 100)\nend",
"def known_currencies\n @known_currencies = money_currencies & exchange_rates.currencies.keys\n end",
"def to_base_currency(money)\n bank.exchange_with(money, price_currency)\n end",
"def test_converter_returns_error_for_unknown_currency\n assert_raises(UnknownCurrencyCodeError){Currency_Converter.new({'USD' => 1.00, 'JPY' => 120.0}).convert( Currency.new('JPY', 120.0), 'ALL' )}\n end",
"def conv_exchange_rate\n currency_exchange.exchange_rate\n end",
"def currency\n number_to_currency(self)\n end",
"def rates\n base_currency_rates.map(&:conversion_rate)\n end",
"def *(currency_object)\n if @currency_symb == currency_object.currency_symb\n Currency.new(@amount *currency_object.amount)\n elsif\n @currency_symb == currency_object.currency_symb\n Currency.new(@amount *currency_object.amount)\n else\n raise UnknownCurrencyCodeError\n end\n end",
"def convert_at_rates(converter, currency)\n rates_conversion = []\n converter.rates.each_key do |key|\n rates_conversion << converter.convert(currency, key)\n end\n return rates_conversion\n end",
"def money_currencies\n Money::Currency.table.keys.map { |c| c.to_s.upcase }\n end",
"def exchange(cents, from_currency, to_currency)\n rate = get_rate(from_currency, to_currency)\n if !rate\n raise Money::UnknownRate, \"No conversion rate known for '#{from_currency}' -> '#{to_currency}'\"\n end\n (cents * rate).floor\n end",
"def get_rate(currency_iso_from, currency_iso_to); end",
"def calculate_conversion\n converted_amount = nil\n\n # checking parameters before calculating the conversion rate\n if currency_converter_params[:rate_date] != \"\" or currency_converter_params[:from_cur] != \"\" or currency_converter_params[:to_cur] != \"\"\n rate = ExchangeRate.at( currency_converter_params[:rate_date].to_date, currency_converter_params[:from_cur], currency_converter_params[:to_cur])\n converted = false\n # rate is not nil go on and do the conversion\n if rate\n converted_amount = currency_converter_params[:amount].to_f * rate\n # rounding the amount to 5 decimal places\n converted_amount = converted_amount.round(5)\n converted = true\n\n # write the success message\n message = I18n.t('success_message', amount: converted_amount.to_s).html_safe\n else\n # failure message\n message = I18n.t('failure').html_safe\n end\n else\n # missing data message\n converted = false\n message = I18n.t('missed_data').html_safe\n end\n respond_to do |format|\n if converted\n format.json {render json: {success: true, message: message, amount: converted_amount} }\n else\n format.json {render json: {success: false, message: message, amount: \"\"}, status: 422 }\n end\n end\n end",
"def allow_currency_symbols(*args)\n # Obviously US-centric, I need to make it international or customizable.\n # Some international symbols '¢£¥€ƒ$,'\n add_equal_method CURRENCY_CHARS, args \n end",
"def convert_to_currency(target_currency, date = Date.today)\n return moneys.inject(Money.zero(target_currency)) do |sum, (_, money)|\n sum + money.convert_to_currency(target_currency, date)\n end\n end",
"def conversion_rate(target_currency)\n if DaMoney::Money.conversion_rates.key? self.currency\n if DaMoney::Money.conversion_rates[self.currency].key? target_currency\n DaMoney::Money.conversion_rates[self.currency][target_currency].to_f\n else\n raise Exception.new(\"Conversion rate from '#{self.currency}' to '#{target_currency}'\" +\n \" if not configured!\")\n end\n else\n raise Exception.new(\"Curreny '#{self.currency}' is not configured!\")\n end\n end",
"def convert(amount, currency_from, currency_to)\n return Money.new(amount, currency_from).exchange_to(currency_to).fractional\n end",
"def currencies\n @currencies || []\n end",
"def currency_as_string; end",
"def currencies\n reload_currencies_cache if !self.currencies_cache?\n c = YAML.load(self.currencies_cache)\n c ||= {}\n end",
"def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend",
"def initialize(currency_conversions, source_currency)\n @currency_conversions = currency_conversions #currency_conversions.sort_by { |currency_conversion, date| date }\n @source_currency = source_currency\n @best_path_currencies = []\n end",
"def number_to_currency(amount)\n super(amount, unit: \"₹\")\n end",
"def iv_exchange_currency(currency1, currency2, amount1, amount2)\r\r\n lose_currency(currency1, amount1)\r\r\n gain_currency(currency2, amount2)\r\r\n end",
"def load_currencies\n @iso_definitions = symbolize_keys(\n YAML.load_file(File.join(ROOT_PATH, 'iso4217.yml'))\n )\n\n @historical_definitions = symbolize_keys(\n YAML.load_file(File.join(ROOT_PATH, 'iso4217-historical.yml'))\n )\n\n @unofficial_definitions = symbolize_keys(\n YAML.load_file(File.join(ROOT_PATH, 'unofficial.yml'))\n )\n\n historical_keys = @historical_definitions.keys\n\n historical_keys.each do |key|\n replacement_currency = @historical_definitions[key][:replaced_by]\n if replacement_currency\n unless currencies.include?(replacement_currency)\n raise Exchange::NoCurrencyError,\n \"#{replacement_currency} is not matchable to a currency\"\n end\n end\n end\n end",
"def exchange_rates\n Currency::Exchange.exchange_rates\n end",
"def from_and_to_non_base_currency(date, from_currency, to_currency)\n currency_rate(date, to_currency) / currency_rate(date, from_currency)\n end",
"def as_ca_euro\n exchange_to(\"EUR\")\n end",
"def method_missing(method_id)\n \n singular_currency = method_id.to_s.gsub( /s$/, '') # Take off s at the end of string if there\n\n if @@currencies.has_key?(singular_currency) #\n return self * @@currencies[singular_currency] # Turn into dollars\n end\n \n end",
"def currency; end",
"def currency; end",
"def same_currency?(currency1, currency2); end",
"def -(another_currency)\n\n #converts the given instance in the actual currency and substracts the amounts\n amount= @amount_bigdecimal - another_currency.convert_to(@currency).amount\n\n #returns the result as a new instance\n Xchange.new(amount,@currency)\n\n end",
"def set_ConvertToCurrency(value)\n set_input(\"ConvertToCurrency\", value)\n end",
"def refresh_exchange_rates\n CurrencyConverter.cache_current_exchange_rates!\n end",
"def best_currency(earlier_conversion, later_conversion)\n best_conversion_amount = 0.0\n best_conversion_currency = nil\n\n earlier_conversion.rates.each do |currency, rate|\n #puts \"Checking #{earlier_conversion.source_currency.to_s} through #{currency}\"\n early_amount_currency = earlier_conversion.convert(earlier_conversion.source_currency, currency.to_sym)\n later_amount_currency = later_conversion.convert(early_amount_currency, earlier_conversion.source_currency.currency)\n #puts \"#{earlier_conversion.source_currency.to_s} > #{later_amount_currency.to_s} ?\"\n if later_amount_currency.amount > best_conversion_amount\n best_conversion_amount = later_amount_currency.amount\n best_conversion_currency = currency\n end\n end\n best_conversion_currency\n end",
"def +(another_currency)\n\n #converts the given instance in the actual currency and sums the amounts\n amount = @amount_bigdecimal + another_currency.convert_to(@currency).amount\n\n #returns the result as a new instance\n Xchange.new(amount,@currency)\n\n end",
"def to_celsius(**options) = convert_to('celsius', **options)",
"def ==(other_currency); end",
"def convert_to_cents(to_currency)\n if to_currency == currency\n cents\n else\n @currency.exchange(to_currency, cents)\n end\n end",
"def currency_should_be_in_supported\n self.errors.add(:currency, 'exchange rate can not be found and is not supported') if self.currency.present? && !Currency.exists?(:iso_code => self.currency)\n end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def currency_symbol\n Currency.new(currency).symbol\n end",
"def load_currencies\n currencies = parse_currency_file(\"currency.json\")\n currencies.merge! parse_currency_file(\"currency_bc.json\")\n end",
"def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end",
"def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end",
"def convert_to_user_currency(statements)\n exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency])\n\n statements.each { |statement|\n statement.price = statement.price.to_d * exchange_rate\n statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate\n }\n\n statements\n end",
"def in (currency)\n self * (1/@@currencies[nomalizeCurrency currency])\n end",
"def ot_currency_code\n end",
"def _from(currency)\n @original = currency\n self\n end",
"def to_currency(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n o = \"00.#{o}\" if ( (o.length) == 1 )\n o = \"0.#{o}\" if ( (o.length) == 2 )\n\n result_string = o\n result_string = \"#{ko}...#{result_string}\" if ( ko != 0 )\n result_string = \"#{mo}...#{result_string}\" if ( mo != 0 )\n result_string = \"#{go}...#{result_string}\" if ( go != 0 )\n\n result_string = @currency.result_strin\n return(result_string)\n end",
"def converters; end",
"def converters; end",
"def converters; end",
"def available_currencies\n set_default_rate\n currency_rates.keys\n end",
"def exchange_with(from, to_currency, &block); end",
"def exchange(cents, from, to)\n rate = get_rate(from, to)\n raise(Money::UnknownRate, \"No conversion rate for #{from} -> #{to}\") unless rate\n (cents * rate).floor # or round here?\n end",
"def rates_for(currency_code)\n # Retrieve the actual rates from the external source\n rates = all_rates\n\n adjusted_currency = currency_code.to_s.upcase.to_sym \n unless rates.include?(adjusted_currency)\n raise Errors::CurrencyNotAvailable, \"#{adjusted_currency.to_s} was not available in this Source (#{self.to_s}), please use a different Source\"\n end\n\n adjusted_rates = {}\n\n # Add the currency we are converting to...\n adjusted_rates[adjusted_currency] = 1.0\n\n # Work out the exchange from our desired currency to our base currency. So if our base was EUR and we wanted USD this would \n # be how many Euros are in one US dollar.\n adjustment_factor = 1.0 / rates[adjusted_currency]\n adjusted_rates[base_currency] = adjustment_factor\n\n # Now remove it, since we've already done it.\n rates.delete(base_currency)\n\n # Now convert the rest\n rates.each do |currency, rate|\n adjusted_rates[currency] = rate * adjustment_factor\n end\n\n adjusted_rates\n end",
"def initialize(currencies, &block)\n super(@currencies = currencies, &block)\n end",
"def converted_amount(other)\n (currency == other.currency ? other : other.convert_to(currency)).amount.to_f\n end",
"def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend",
"def conversion\n fetch(:conversion) do\n others = inelastic_siblings.sum(&:conversion)\n\n # Don't break the laws of thermodynamics; conversion may not be\n # negative.\n others > 1.0 ? 0.0 : 1.0 - others\n end\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def to_system_currency(value)\n value.to_d / currency.exchange_rate.to_d\n end",
"def do_conversion!(*args)\n raise NotImplementedError\n end",
"def formated_in_provided_currency(amount_cents, currency_code, no_cents_if_whole = false)\n Money.new(amount_cents, currency_code).format(:no_cents_if_whole => no_cents_if_whole)\n end",
"def to_century(**options) = convert_to('century', **options)",
"def get_currency_symbol\n self.le_currency.nil? ? \"\" : self.le_currency.display_symbol\n end"
] | [
"0.750382",
"0.7207858",
"0.6895679",
"0.68831897",
"0.67953604",
"0.6747275",
"0.66808015",
"0.6665789",
"0.6650125",
"0.6630351",
"0.661515",
"0.6573833",
"0.6539112",
"0.65294176",
"0.6407027",
"0.63641405",
"0.63641405",
"0.63641405",
"0.63625187",
"0.6344454",
"0.63080424",
"0.6306071",
"0.63009006",
"0.62928766",
"0.6292174",
"0.62792397",
"0.6262593",
"0.6256043",
"0.6229914",
"0.62267345",
"0.62221766",
"0.61840963",
"0.61750317",
"0.6129722",
"0.61259013",
"0.6125217",
"0.61226964",
"0.61196506",
"0.61189824",
"0.60855985",
"0.6050542",
"0.6041704",
"0.6039219",
"0.60353714",
"0.6034751",
"0.6034373",
"0.6026567",
"0.6026441",
"0.60218793",
"0.6003241",
"0.5997347",
"0.5991267",
"0.59738237",
"0.5969306",
"0.59661084",
"0.59633493",
"0.59628093",
"0.59628093",
"0.59549624",
"0.5954631",
"0.5941914",
"0.5940769",
"0.5936726",
"0.59246176",
"0.59013754",
"0.5894033",
"0.5890636",
"0.5886317",
"0.588528",
"0.5877154",
"0.5860946",
"0.58495885",
"0.5844555",
"0.5844555",
"0.5844114",
"0.5842024",
"0.582895",
"0.58280003",
"0.5817946",
"0.58169365",
"0.58169365",
"0.58169365",
"0.58142173",
"0.58045125",
"0.5799895",
"0.57812184",
"0.57737803",
"0.5768882",
"0.57599175",
"0.5750819",
"0.5729315",
"0.5729315",
"0.5729315",
"0.5729315",
"0.5726852",
"0.572054",
"0.5719938",
"0.5717645",
"0.57051367",
"0.5703038",
"0.56973225"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_pet
@pet = Pet.find_by!(id: params[:pet_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_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def 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 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 action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n 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 startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def 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 action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); 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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup_signals; 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 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 after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; 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 save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 setup(&blk)\n @setup_block = blk\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 callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\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 duas1(action)\n action.call\n action.call\nend"
] | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_bid
@bid = @pet.bids.find_by!(number: params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def bid_params
params.require(:bid).permit(:bid_price, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n 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",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
def make_path(input) case input.to_i when (1..50) creates the specific city's link for Scraper.get_activities | def list_activities(name)
puts ""
puts "--------------------------------------------------"
puts "Here is a list of activities popular in #{name}:".colorize(:green)
puts "--------------------------------------------------"
puts ""
# prints activities available in city chosen by user
Twyd::Activity.all.each.with_index(1) do |a, i|
puts "#{i}. #{a.name}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_visit\n par = case $url.upcase\n when \"LMX\" then \"https://www.linio.com.mx\"\n when \"LCO\" then \"https://www.linio.com.co\"\n when \"LCL\" then \"https://www.linio.cl\"\n when \"LVE\" then \"https://www.linio.com.ve\"\n when \"LAR\" then \"https://www.linio.com.ar\"\n when \"LEC\" then \"https://www.linio.com.ec\"\n when \"LPA\" then \"https://www.linio.com.pa\" \n when \"LPE\" then \"https://www.linio.com.pe\" \n when \"HPMX\" then \"https://www.hponline.com.mx\"\n when \"HPCL\" then \"https://www.hponline.cl\"\n when \"WLCP\" then \"https://tienda.clubpremier.com\"\n when \"AVCO\" then \"http://co.catalog.lifemiles.com/\"\n when \"AVPE\" then \"http://pe.catalog.lifemiles.com/\"\n#batman\n when \"A01_MX\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-mx.linio-staging.com\"\n when \"A01_CO\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-co.linio-staging.com\"\n when \"A01_CL\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-cl.linio-staging.com\"\n when \"A01_VE\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ve.linio-staging.com\"\n when \"A01_AR\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ar.linio-staging.com\"\n when \"A01_EC\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ec.linio-staging.com\"\n when \"A01_PA\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-pa.linio-staging.com\" \n when \"A01_PE\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-pe.linio-staging.com\" \n #cobra\n when \"A02_MX\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-mx.linio-staging.com\"\n when \"A02_CO\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-co.linio-staging.com\"\n when \"A02_CL\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-cl.linio-staging.com\"\n when \"A02_VE\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ve.linio-staging.com\"\n when \"A02_AR\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ar.linio-staging.com\"\n when \"A02_EC\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ec.linio-staging.com\"\n when \"A02_PA\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-pa.linio-staging.com\" \n when \"A02_PE\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-pe.linio-staging.com\" \n #mobile\n when \"A03_MX\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-mx.linio-staging.com\"\n when \"A03_CO\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-co.linio-staging.com\"\n when \"A03_CL\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-cl.linio-staging.com\"\n when \"A03_VE\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ve.linio-staging.com\"\n when \"A03_AR\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ar.linio-staging.com\"\n when \"A03_EC\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ec.linio-staging.com\"\n when \"A03_PA\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-pa.linio-staging.com\" \n when \"A03_PE\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-pe.linio-staging.com\" \n #shop-launch\n when \"A04_MX\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-mx.linio-staging.com\"\n when \"A04_CO\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-co.linio-staging.com\"\n when \"A04_CL\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-cl.linio-staging.com\"\n when \"A04_VE\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ve.linio-staging.com\"\n when \"A04_AR\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ar.linio-staging.com\"\n when \"A04_EC\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ec.linio-staging.com\"\n when \"A04_PA\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-pa.linio-staging.com\" \n when \"A04_PE\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-pe.linio-staging.com\" \n\n when \"A06_MX\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-mx.linio-staging.com\"\n when \"A06_EC\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-ec.linio-staging.com\"\n when \"A06_CL\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-cl.linio-staging.com\"\n when \"A06_CO\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-co.linio-staging.com\"\n when \"A06_PA\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-pa.linio-staging.com\"\n when \"A06_PE\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-pe.linio-staging.com\"\n when \"A06_AR\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-ar.linio-staging.com\"\n \n else \"Error country\"\n end\n return par\nrescue\n puts \"Error\"\nend",
"def url_create(state_code, city_name)\n 'http://en.m.wikipedia.org/wiki/' + self.url_suffix_create(state_code, city_name)\n end",
"def create_url (type,permalink,page)\n\t\tbase_url = \"http://api.crunchbase.com/v/2/\"\n\t\tuser_key = \"2f9f86ebf459116f9b1a6e86f24ba34b\" # This's Isabel's key\n\t\tuser_key2 = \"411490520ad9db1b432e77f1a25735a8\" # This's David's Key\n\t\tif permalink == \"\" then\n\t\t\tif @random_key == 1\n\t\t\t\turl = \"#{base_url}#{type}?page=#{page}&user_key=#{user_key}\"\n\t\t\t\t@random_key = 2\n\t\t\telsif @random_key == 2\n\t\t\t\turl = \"#{base_url}#{type}?page=#{page}&user_key=#{user_key2}\"\n\t\t\t\t@random_key = 1\n\t\t\tend\n\t\telse\n\t\t\tif @random_key == 1\n\t\t\t\turl = \"#{base_url}#{type}/#{permalink}?page=#{page}&user_key=#{user_key}\"\n\t\t\t\t@random_key = 2\n\t\t\telsif @random_key == 2\n\t\t\t\turl = \"#{base_url}#{type}/#{permalink}?page=#{page}&user_key=#{user_key2}\"\n\t\t\t\t@random_key = 1\n\t\t\tend\n\t\tend \n\t\treturn url \n\tend",
"def create_url\n #we trim away all periods and break apart the name by spaces to use to acquire the url of the poet in the Poetry Foundation website\n name_no_periods = @name.tr(\".\", \"\")\n name_no_periods = name_no_periods.split(\" \")\n\n #we use name_no_periods to generate the url for the poet (example url: \"https://www.poetryfoundation.org/poets/ben-jonson\")\n url = \"https://www.poetryfoundation.org/poets/\"\n name_no_periods.each { |part| url = \"#{url}#{part}-\"}\n\n #this leaves an extra hyphen at the end, but we can just cut that off in the return.\n url = url.chop\n end",
"def url_generator\n\t\t@page_name = PAGE_NAME_PART_1 + @movie_type + PAGE_NAME_PART_2 + @page_num.to_s + PAGE_NAME_PART_3\n\tend",
"def get_schedule( city, category, url_postfix )\n case category\n when 'cinema'\n get_schedule_type_1( city, category, url_postfix )\n when 'concert', 'club'\n get_schedule_type_2( city, category, url_postfix )\n when 'theatre'\n get_schedule_type_3( city, category, url_postfix )\n end\nend",
"def generate_url\n\t\tself.url ||= name.parameterize\n\tend",
"def person_url(id)\n 'https://swapi.co/api/people/' + id.to_s\nend",
"def city number\n case number\n when 1\n 'Cochabamba'\n when 2\n 'La paz'\n when 3\n 'Oruro'\n when 4\n 'Chuquisaca'\n when 5\n 'Santa Cruz'\n when 6\n 'Pando'\n when 7\n 'Beni'\n when 8\n 'Potosi'\n else\n 'tarija'\n end\nend",
"def build_call_url(word)\r\n\t\t\tURI.parse(URI.escape(base_url + word))\r\n\t\tend",
"def ruby_hard_way_urls\n urls = ['http://ruby.learncodethehardway.org/book/intro.html']\n (1..52).each do |val|\n urls << 'http://ruby.learncodethehardway.org/book/ex' + val.to_s.rjust(2,'0') + '.html'\n end\n urls << 'http://ruby.learncodethehardway.org/book/next.html'\n urls << 'http://ruby.learncodethehardway.org/book/advice.html'\n urls\nend",
"def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end",
"def append_link_type(key_url)\n if key_url.start_with?('y/')\n 'https://www.indeed.com/compan' + key_url\n elsif key_url.start_with?('?jk=')\n 'https://www.indeed.com/viewjob' + key_url\n elsif key_url.start_with?('/clk?mo')\n 'https://www.indeed.com/pagead' + key_url\n # elsif key_url.start_with?('????')\n # 'https://www.indeed.com/pagead' + key_url\n else\n 'unknown parameter, adjust in `append_link_type` method in indeed_scraper class...'\n end\n end",
"def construct_url\n @@API_URL + city + @@API_KEY\n end",
"def generate_url(template); end",
"def course_to_url(term_cd, term_year, department, ccn)\n term = case term_cd\n when 'B' then 'spring'\n when 'C' then 'summer'\n when 'D' then \"fall\"\n else\n Rails.logger.warn(\"Unknown term code #{term_cd} for #{department} #{ccn}\")\n return ''\n end\n \"/academics/semester/#{term}-#{term_year}/class/#{ccn}\"\n end",
"def to_partial_path() \n \"activities/#{target_type.downcase}\" \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 make_url(apipath)\n @base_url + \"/api/open-v1.0/\" + apipath\n end",
"def run(lat_lng,counter)\n\t\t\n\t\tcounter = counter.to_i\n\t\tcase counter\n\t\twhen 1\n\t\t\treturn [2,self.url_1]\n\t\twhen 2\n\t\t\treturn [3,self.url_2]\n\t\twhen 3\n\t\t\treturn [1,self.url_3]\n\t\tend\n\n\tend",
"def make_path(base, href)\n return href if href[0] == '/'\n base + href\n end",
"def make_url(string)\n puts \"not implemented\"\nend",
"def url_suffix_create(state_code, city_name)\n # fetch state.\n state_name_full = StateUtil.abbv_to_state state_code\n \n # transform the state name.\n # there might be an issue with caps of non proper nouns.\n # names are in this format\n # _District_Of_Columbia\n # first letter is in caps and underscore in front of every word.\n state_name_full = state_name_full.split.map(&:capitalize).join(' ')\n state_name_full = state_name_full.gsub(/ /, '_')\n state_name_full = \"_\" + state_name_full\n \n # transform the city name.\n # Los_Angeles\n # caps for each word and underscore instead of space\n city_name_full = city_name.split.map(&:capitalize).join(' ')\n city_name_full = city_name_full.gsub(/ /, '_')\n \n # final url suffix\n city_name_full + \",\" + state_name_full\n end",
"def location_path(location)\n url_for(:controller => 'locations', :action => 'show', :city => location.city.gsub(' ','_'), :state => location.state)\n end",
"def url_for(string); end",
"def generate_search_url\n begin\n if self.search_url.blank? && job.county.search_template_url.present?\n params = generate_search_params.to_s\n if job.county.search_method == \"GET\"\n self.search_url = job.county.search_template_url.gsub(/\\{\\{params\\}\\}/, \"?#{params}\")\n end\n end\n rescue\n # don't worry if something went wrong generating the url\n end\n end",
"def generate_url_for_course(course_code, year)\n date = '201516'\n weeks = '4-16'\n\n url = 'https://www.dit.ie/timetables/PortalServ?reqtype=timetable&ttType=CLASS&sKey=' + date + '|' + course_code + '|' + course_code + '/' + year + '|' + weeks\n\n url\n end",
"def api_url(id)\n name = get_tourney_name(id)\n return \"https://api.challonge.com/v1/tournaments/uxie#{id}#{name}\"\nend",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.url = self.title.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\tend\t\n\tend",
"def url_for(isbn)\n \"http://www.amazon.com/gp/product/\" + isbn\nend",
"def choose_city\n puts \" \"\n puts \"Please enter the number of the city you would like to learn more about 1-17 and hit enter.\"\n puts \" \"\n \n input = gets.strip.to_i \n \n if input.between?(1,17)\n category = input-1\n display_city_desc (category)\n submenu\n else\n puts \"Invalid number.\"\n list_cities\n choose_city\n end \n end",
"def generate_path_slug\n slug = \"/#{archive.slug}/news/#{ymd}/#{sluggerize(news.title)}\"\n end",
"def get_type_of_stories_link\n # Used to convert user selection to the string link\n mapped_choices = [\"sports\", \"campus\", \"science-and-medicine\", \"arts-and-humanities\", \"the-conversation\", \"covid-19-updates\"]\n \n # Prompt the user for what type of stories they want\n input = prompt \"What type of stories would you like? Please input the number beside it.\\n1. Sports\\n2. Campus\\n3. Science & Medicine\\n4. Arts & Humanities\\n5. The Conversation\\n6. Covid Updates\\nSelection: \"\n \n while !input.to_i().between?(1,6) #keep asking for input until input is valid\n puts \"\\nInvalid input. Please try again.\"\n input = prompt \"What type of stories would you like? Please input the number beside it.\\n1. Sports\\n2. Campus\\n3. Science & Medicine\\n4. Arts & Humanities\\n5. The Conversation\\n6. Covid Updates\\nSelection: \"\n end\n\n \"https://news.osu.edu/#{mapped_choices[input.to_i() - 1]}/\"\nend",
"def maproutes(graph_instance)\n url ='http://www.gcmap.com/mapui?P='\n route_strings=''\n graph_instance.node_hash.each_key{ |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n route_strings = route_strings + \"#{key}-#{tuple.city},+\"\n }\n }\n Launchy.open(url+route_strings)\nend",
"def generate_short_url\n random_chars = ['0'..'9','A'..'Z','a'..'z'].map{|range| range.to_a}.flatten\n self.assign_attributes(short_url: 6.times.map{ random_chars.sample }.join.prepend(\"http://\")) until self.short_url.present? && Link.find_by_short_url(short_url).nil?\n end",
"def make_path(*args)\n end",
"def fetch_trips(origin_city)\r\n return if origin_city.nil?\r\n\r\n airport_type = AIRPORT_TYPE_MEDIUM_KEY\r\n\r\n case\r\n when origin_city.downcase == 'helsinki'\r\n # Helsinki-Vantaa on ainoa poikkeus!\r\n airport_type = AIRPORT_TYPE_LARGE_KEY\r\n end\r\n\r\n # Suomesta tapahtuvien lähtöjen lentokentät ovat pääsääntöisesti medium-luokkaa.\r\n journey_airports = AIRPORTS.find({MUNICIPALITY_KEY => origin_city.capitalize, AIRPORT_TYPE_KEY => airport_type})\r\n unless journey_airports.nil?\r\n journey_airports.each do |airport|\r\n\r\n fetch_origin_country(airport)\r\n\r\n @trips = TRIPS.find({AIRPORT_ORIGIN_CITY => airport[MUNICIPALITY_KEY]})\r\n end\r\n end\r\n\r\n #@wikipedia_link = COUNTRIES.find(\r\n\r\nend",
"def website_path(website)\n url_for([website.websiteable, website])\n end",
"def genration_diary_path diary_id\n CACHE.fetch(\"/genration_decoration_diary_path/#{diary_id}\", 1.day) do\n diary = DecorationDiary.find diary_id\n city_area = generate_firm_city_area diary.deco_firm_id\n city = TAGURLS[city_area[0]]\n \"http://z.#{city}.51hejia.com/gs-#{diary.deco_firm_id}/zhuangxiugushi/#{diary.id}\"\n end\n end",
"def url_for_mnhn(barcode)\r\n #\"https://science.mnhn.fr/institution/mnhn/collection/p/item/\" + barcode #herbarium sheets\r\n \"https://science.mnhn.fr/institution/mnhn/collection/f/item/\" + barcode #fossil slides\r\nend",
"def paginate_path(site, num_page); end",
"def catalog_generator(bib)\n QuickSearch::Engine::WORLD_CAT_DISCOVERY_API_ARTICLE_CONFIG['url_link'] +\n bib.oclc_number.to_s\n end",
"def to_param\n #'foo'\n #{id}-#{permalink}\"\n permalink\n end",
"def page_url(page, obj = nil)\n url = case page\n when 'home' then '/'\n when 'featured events' then '#/featured'\n when 'browse all events' then '#/browse/events'\n when 'browse all places' then '#/browse/places'\n when 'browse publishers' then '#/fun'\n when 'my redrover' then '/my'\n when 'settings' then '#/settings'\n else raise \"Unknown page_url: #{page}\"\n end\nend",
"def knight_path(start, finish)\n\nend",
"def travel\n @prev_city = @current_city\n case @current_city\n when 'Enumerable Canyon'\n @random_num = @prng.rand(2)\n @current_city = ec_travel\n when 'Duck Type Beach'\n @random_num = @prng.rand(2)\n @current_city = dtb_travel\n when 'Monkey Patch City'\n @random_num = @prng.rand(3)\n @current_city = mpc_travel\n when 'Nil Town'\n @random_num = @prng.rand(3)\n @current_city = nt_travel\n when 'Matzburg'\n @random_num = @prng.rand(4)\n @current_city = m_travel\n when 'Hash Crossing'\n @random_num = @prng.rand(3)\n @current_city = hc_travel\n when 'Dynamic Palisades'\n @random_num = @prng.rand(2)\n @current_city = dp_travel\n end\n end",
"def find_path(goal) \n \n end",
"def url_for(arg)\n arg\n end",
"def do_url (name)\n name.to_s.downcase.gsub(' ', '_')\n end",
"def genURI(c_type)\n if c_type == 'BTC'\n c_uri = '/v1/ticker/bitcoin'\n elsif c_type == 'LTC'\n c_uri = '/v1/ticker/litecoin'\n elsif c_type == 'ETH'\n c_uri = '/v1/ticker/ethereum'\n elsif c_type == 'XRP'\n c_uri = '/v1/ticker/ripple'\n else\n c_uri = '/v1/ticker/notsupported'\n end\n return c_uri\nend",
"def plan_url(request)\n build_url(request[:from], request[:to], request[:trip_time], request[:arrive_by], request[:options] || {})\n end",
"def create_short_url\n rand_url = ('a'..'z').to_a.shuffle[0..5].join\n self.short_url = \"#{rand_url}\"\n end",
"def get_new_url\n self.update_attributes(url: \"#{(0...50).map{ ('a'..'z').to_a[rand(26)] }.join}\")\n end",
"def generate_path_slug\n slug = \"/#{archive.slug}/\"\n slug += sluggerize(study.ddi_id)\n end",
"def build_uri(action, options)\n case action\n when 'sale'\n \"/ens/service/page/#{options[:page_id]}/process\"\n when 'auth'\n '/ens/service/authenticate'\n end\n end",
"def getUrl(items)\n \n #puts @i.class\n if not @i.nil?\n puts 'You have passed the following argument: \"' + @i.to_s + '\"'\n else\n puts 'Please enter a number from the list'\n i = gets.chomp\n end\n \n i = i.to_i\n \n #STDOUT.flush\n if items[i]\n url = items[i].at_css(\"@href\").value\n puts \"You have chosen #{items[i].xpath('a').text}\"\n return url\n else\n puts \"There is no list number #{i}\"\n getUrl(@css)\n end\nend",
"def create_address(city, state, zip)\n call_address = Addressable::URI.new(\n :scheme => \"http\",\n :host => \"www.whitepages.com\",\n :path => \"search/FindNearby\",\n :query_values => {\n :utf8 => \"✓\",\n :street => \"#{city}, #{state}\",\n :where => \"#{zip}\"\n }\n ).to_s\n end",
"def get_url(stadium)\n 'http://www.hittrackeronline.com/index.php?h=&p=&b=' + stadium +\n '&perpage=10000'\nend",
"def get_townhall_urls\n city = []\n town.xpath('//p/a').each do |node|\n city << node.text.downcase #l'array city, est l'ensemble des villes du 95\n end\n array_url = city\n final = []\n array_url.each do |town|\n return array_url2 = Nokogiri::HTML(URI.open(\"http://annuaire-des-mairies.com/95/#{town.gsub(\" \", \"-\" )}.html\"))\n end\nend",
"def get_my_link()\n strip = self;\n return \"#{strip.id}\";\n# return \"comic/#{strip.id}\"; # this utilizes our route magic \n # to forward us to home/index/:id \n end",
"def shorten\n\t\trange = [*'0'..'9',*'A'..'Z',*'a'..'z']\n self.short_url = Array.new(7){range.sample}.join\n self.save\n\tend",
"def generate_short_url\n new_short = \"/\" + Faker::Lorem.characters(7)\n until short_url_unique?(new_short)\n new_short = \"/\" + Faker::Lorem.characters(7)\n end\n self.short_url = new_short\n end",
"def link() url; end",
"def link() url; end",
"def build_url(input)\n url = \"#{GOOGLE_BOOKS_API_BASE_URL}#{input}\"\n url\nend",
"def build_url(vars = {})\n \"/\" + path_spec.map do |p|\n case p\n when String\n p\n when Symbol\n vars.fetch(p)\n end\n end.join(\"/\")\n end",
"def city_specific_run\n\n puts 'You want city specific details'\n puts 'Type the name of the city that you want'\n city = gets.chomp\n\n # wait till you receive a correct input\n while not @ui_lib.query.city_to_code.has_key?(city)\n puts 'Please try again'\n city = gets.chomp\n end\n\n puts \"You selected #{city}\"\n puts \"What information do you want about #{city}\"\n\n city = @ui_lib.query.city_to_code[city] #changed the string to its code form\n\n @num_to_info_key.each {|num,infoKey| puts \"Type #{num} for #{infoKey}\"}\n command = gets.chomp.to_i\n\n while not @num_to_info_key.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n\n if command == 9\n puts \"#{@ui_lib.get_outgoing_routes(city)}\"\n else\n puts \"#{@ui_lib.get_city_info(city, @num_to_info_key[command])}\"\n end\n\n end",
"def link_to_locations\n\n # Remove any existing links\n # (this method is used in both create and update)\n Visit.where(tour_id: @tour.id).each(&:destroy)\n\n # Create new links\n got_start_location = false\n (1..10).each do |i|\n\n # Grab a location id from the parameters\n # Be forgiving\n # No such key? Okay, set to -1 (flag for no location in this itinerary slot)\n selected_location_id =\n tour_params[\"location\" + i.to_s] ?\n tour_params[\"location\" + i.to_s].to_i :\n -1\n\n # Create visits relationship (or skip to next iteration)\n next unless selected_location_id.positive?\n new_visits_rel = Visit.new(\n tour_id: @tour.id,\n location_id: selected_location_id\n )\n new_visits_rel.save\n\n # Create starts at relationship (or skip to next iteration)\n next if got_start_location\n new_start_at_rel = StartAt.new(\n tour_id: @tour.id,\n location_id: selected_location_id\n )\n new_start_at_rel.save\n got_start_location = true\n\n end\n\n # Gotta have at least one location in the itinerary\n # https://stackoverflow.com/questions/5320934/how-to-add-custom-errors-to-the-user-errors-collection\n unless got_start_location\n @tour.errors[:base] << \"A tour must have at least one location\"\n end\n\n end",
"def open_url_generator(bib)\n open_url_link = open_url_resolve_link(bib)\n links = UmdOpenUrl::Resolver.resolve(open_url_link)\n links\n end",
"def location_string(type, id, version=nil)\n link = Conf.base_uri\n case type.downcase\n when \"workflow\"; link += \"/workflows/\"\n when \"blob\"; link += \"/files/\"\n when \"pack\"; link += \"/packs/\"\n else; return( link += \"/home\" )\n end\n \n link += id.to_s\n link += \"?version=#{version}\" if version\n \n return link\n end",
"def trail_builder(urls)\n urls.each do |trail|\n page = Nokogiri::HTML(open(TARGET_DOMAIN + trail))\n script = page.css('script')[3]\n trail_id = script.children.to_s.match(/TRAIL_ID\\s=\\s\\\"(\\d+)\\\"/)[1]\n gpx_name = script.children.to_s.match(/GPX_URL\\s=\\s\\\"(.+)\\\"/)[1]\n gpx_url = TARGET_DOMAIN + \"/content/gpsData/gps\" + trail_id + \"-\" + gpx_name + \".gpx\"\n end\nend",
"def get_us_city_url(city)\n self_storage_path :state => States.name_of(city.state).parameterize, :city => city.name.parameterize\n end",
"def call(visit_info)\n cases = []\n visit_info.each do |(url, views)|\n begin\n this_case = Case.friendly.find(url.split('/').last)\n cases << [this_case, views]\n rescue ActiveRecord::RecordNotFound\n end\n end\n cases\n end",
"def link_to_landing_page \n \"/about/#{url_uuid}\"\n end",
"def url(url_or_int = 1)\n case url_or_int\n when String\n parsed_url = Wgit::Url.parse(url_or_int)\n append_url(parsed_url)\n when Array\n url_or_int.each { |url| append_url(url) }\n when Integer\n url_or_int.times { @@urls << DatabaseTestData.url }\n else\n raise \"Invalid data type: #{url_or_int.class}\"\n end\n end",
"def normalise_path(url)\n url == :home_page && \"/\" || \"/\" << url.to_s\n end",
"def geturl (reg)\n\n case reg.clase\n when 0\n return concepto_path(reg.elemento)\n when 1\n return conceptospersonales_path\n when 2\n return departamentos_path\n when 3\n return dependencias_path\n when 4\n return persona_path(reg.elemento)\n when 5\n return tipos_path\n when 6\n return cargo_path(reg.elemento)\n end\n end",
"def url_to\n h.url_for [model.category, model]\n end",
"def gather_uri(key = nil, cat = nil, val = nil)\n uri = \"http://jservice.io/api/\"\n if !key.nil? && !cat.nil?\n category = return_categories(key)\n category = category.select {|c| c[\"title\"] == cat}[0] if category.kind_of? Array\n uri += \"clues?category=#{category['id']}\"\n if !val.nil?\n uri += \"&value=#{val}\"\n end\n else\n uri += \"random?count=1\"\n end\n uri\nend",
"def look_up_link(result)\n case name\n when \"IGN\" then return result.attributes[\"href\"].value\n when \"GameSpot\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n when \"GiantBomb\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n end\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def expand_url(input, url=nil)\n url ||= root\n if input =~ /^#{url}/\n input\n else\n File.join(url, input)\n end\n end",
"def test_generate_url\n @test1 = CinePassion.new()\n assert_equal(@test1.GenerateURLMovieSearch(\"toto\"), \"http://scraper-cine-passion-demo.ledez.net/scraper/API/1/Movie.Search/Title/en/XML/fake-7945cb-fake/toto\")\n assert_equal(@test1.GenerateURLMovieGetInfo(\"toto\"), \"http://scraper-cine-passion-demo.ledez.net/scraper/API/1/Movie.GetInfo/ID/en/XML/fake-7945cb-fake/toto\")\n end",
"def go_to_date_link(user)\n\t\tdynamic_range\n\t\t@base_path = root_path+\"users/#{user.id}/scrapbook/#{@destination}\"\n\tend",
"def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end",
"def generate_url_codes\r\n\r\n self.spec_url_code = create_code\r\n while (AirframeMessage.where(:spec_url_code => self.spec_url_code).count > 0)\r\n self.spec_url_code = create_code\r\n end\r\n\r\n self.photos_url_code = create_code\r\n while (AirframeMessage.where(:photos_url_code => self.photos_url_code).count > 0)\r\n self.photos_url_code = create_code\r\n end\r\n\r\n end",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def tranform_full_url(array_cities)\n array_cities.each do |city|\n city.delete_prefix!(\".\")\n city.insert(0,'http://annuaire-des-mairies.com')\n end\n print array_cities\n return array_cities\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def create_openurl(request, wh)\n metadata = request.referent.metadata\n \n co = OpenURL::ContextObject.new\n cor = co.referent\n cor.set_format(wh['record_type'])\n cor.add_identifier(\"info:oclcnum/#{wh['oclcnum']}\")\n cor.set_metadata('aulast', metadata['aulast'] ) if metadata['aulast']\n cor.set_metadata('aufirst', metadata['aufirst']) if metadata['aufirst']\n cor.set_metadata('aucorp', metadata['aucorp']) if metadata['aucorp']\n cor.set_metadata('title', wh['title'])\n link = @openurl_base + '?' + co.kev\n return link\n end"
] | [
"0.6597116",
"0.64332086",
"0.6273109",
"0.59461427",
"0.59392375",
"0.5852955",
"0.58299935",
"0.5791049",
"0.57619834",
"0.56556153",
"0.56498593",
"0.56402016",
"0.5618965",
"0.5555122",
"0.55499893",
"0.55436796",
"0.5530475",
"0.5527893",
"0.55217767",
"0.55056745",
"0.54899716",
"0.5471454",
"0.54654545",
"0.5465297",
"0.5440472",
"0.5431864",
"0.5409998",
"0.54049814",
"0.54027563",
"0.5397705",
"0.5394723",
"0.53935504",
"0.5387116",
"0.5384321",
"0.5382036",
"0.53803694",
"0.5375645",
"0.53719765",
"0.53718215",
"0.536913",
"0.5365508",
"0.53547573",
"0.5352748",
"0.5343415",
"0.5336966",
"0.53307503",
"0.53289336",
"0.5327161",
"0.53220373",
"0.53187543",
"0.52998257",
"0.529544",
"0.5282081",
"0.5281904",
"0.5281278",
"0.52786785",
"0.52709436",
"0.52665216",
"0.5262485",
"0.5261916",
"0.525934",
"0.525619",
"0.52386564",
"0.52386564",
"0.52324575",
"0.52295023",
"0.5229171",
"0.522439",
"0.52227515",
"0.52207243",
"0.5217307",
"0.520472",
"0.5199541",
"0.51898557",
"0.5174029",
"0.51722455",
"0.516192",
"0.5159771",
"0.51564276",
"0.5155974",
"0.5150689",
"0.5150689",
"0.5150689",
"0.51467425",
"0.5141964",
"0.5139134",
"0.5137069",
"0.5132686",
"0.5131177",
"0.5131177",
"0.5124182",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.512352",
"0.51168656"
] | 0.0 | -1 |
GET /exam_managements GET /exam_managements.json | def index
@exam_managements = ExamManagement.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @managements = Management.all\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def exam_management_params\n params[:exam_management]\n end",
"def index\n @product_managements = ProductManagement.all\n\n render json: @product_managements\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def index\n @users_managements = Users::Management.all\n end",
"def index\n @exam_sets = ExamSet.all\n end",
"def index\n @incidentmanagements = Incidentmanagement.all\n end",
"def index\n @amandments = Amandment.all\n end",
"def index\n @emmisions = Emmision.all\n @emmisions = @emmisions.joins(:vestments).where(:vestments => {:vestment_id => params[:vestment_id]}) if params[:vestment_id]\n @emmisions = @emmisions.order(:number).page(params[:page] || 1)\n end",
"def index\n @product_managements = ProductManagement.all\n end",
"def get_immunizations\n response = perform(:get, 'Immunization', params, headers)\n response.body\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def index\n @medical_equipments = MedicalEquipment.all\n end",
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def index\n @meditations = Meditation.all\n end",
"def new\n @my_exam = MyExam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def index\n @examquestions = Examquestion.all\n end",
"def index\n @exam_settings = ExamSetting.all\n end",
"def create\n @exam_management = ExamManagement.new(exam_management_params)\n\n respond_to do |format|\n if @exam_management.save\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' }\n format.json { render :show, status: :created, location: @exam_management }\n else\n format.html { render :new }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @loan_managements = LoanManagement.all\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def index\n @misiones = Misione.all\n end",
"def destroy\n @exam_management.destroy\n respond_to do |format|\n format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examinations }\n end\n end",
"def index\n render json: Assignment.all\n end",
"def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end",
"def index\n @introexams = Introexam.all\n end",
"def index\n @expertises = Expertise.all\n\n render json: @expertises\n end",
"def index\n @exam_marks = ExamMark.all\n end",
"def show\n Exam.find(params[:exam_id])\n\n user_exam = current_user.user_exams.find_or_initialize_by(exam_id: params[:exam_id])\n user_exam.save! unless user_exam.persisted?\n render json: UserExamRepresenter.new(user_exam).to_h\n end",
"def index\n @immunizations = Immunization.all\n end",
"def index\n @m_answers = MAnswer.all\n end",
"def index\n @employments = @cinema.employments\n end",
"def manage\n @memorials = Memorial.find_all_by_user_id(@session[:user].id)\n end",
"def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end",
"def index\n @admintreatmentmechanicals = Admintreatmentmechanical.all\n end",
"def index\n @admintreatmentfumigations = Admintreatmentfumigation.all\n end",
"def index\n begin\n @account_managements = get_all\n @account_managements = sort(@account_managements)\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @account_managements }\n end\n end",
"def index\n @exams = Exam.all\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend",
"def index\n @exam_students = ExamStudent.all\n end",
"def show\n @examination = Examination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @examination }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @examination }\n end\n end",
"def new\n @exam_category = ExamCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def index\n @mpayments = Mpayment.all\n end",
"def index\n @misions = Mision.all\n\n end",
"def set_exam\n @exam = @student.exams.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def new\n @exam_option = ExamOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_option }\n end\n end",
"def index\n @admittings = Admitting.all\n render json: @admittings\n end",
"def index\n if params[:admin]==\"1\"\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end\n end",
"def show\n @amendment = Amendment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amendment }\n end\n end",
"def index\n @mantencioncorrectivas = Mantencioncorrectiva.all\n end",
"def index\n @assigments = Assigment.all\n end",
"def get_symptoms\n begin\n @desease = Desease.find(params[:id])\n\n @symptoms = @desease.symptoms\n render json: @symptoms\n rescue ActiveRecord::RecordNotFound => e\n render json: e, status: :unprocessable_entity\n end\n \n \n end",
"def new\n @exam_user = ExamUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_user }\n end\n end",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end",
"def index\n @advances = user_capabilities(Advance).current_advances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advances }\n end\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n end",
"def _manage_list\n\t\t# Author\n\t\tauthorize! :manage, Project\n\n\t\tper = Rails.application.config.item_per_page\n\n\t\tif params[:keyword].blank?\n\t\t\tinvestors = Investor.order(updated_at: 'asc')\n\t\telse\n\t\t\tinvestors = Investor.search(params[:keyword])\n\t\tend\n\n\t\tcount = investors.count\n\n\t\treturn render json: { status: 1 } if count === 0\n\n\t\trender json: {\n\t\t\tstatus: 0,\n\t\t\tresult: {\n\t\t\t\tlist: render_to_string(partial: 'investors/manage_list', locals: { investors: investors.page(params[:page].to_i, per) }),\n\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t}\n\t\t}\n\tend",
"def index\n @encouragements = Encouragement.all\n end",
"def index\n @housing_detail_managements = HousingDetailManagement.all.order(\"id DESC\")\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @maritalinfos = @member.maritalinfo\n end",
"def index\n @materiales_auditoria = MaterialesAuditorium.all\n end",
"def index\n @measurments = Measurment.all\n end",
"def index\n render json: { assignments: [ @assignment.as_json ] }\n end",
"def index\n @departments = Department.all\n respond_to do |format|\n format.json{ render json: @departments}\n end\n end",
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def index\n @education_accomplishments = EducationAccomplishment.all\n end",
"def index\n @achievments = Achievment.all\n end",
"def show\n @exam_option = ExamOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_option }\n end\n end",
"def new\n @amendment = Amendment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amendment }\n end\n end",
"def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end",
"def set_exam\n professional_list = Exam.where(user: @list).pluck(:id)\n user_list = Exam.where(user: current_user).pluck(:id)\n exams = Exam.where(id: [professional_list, user_list].flatten)\n if exams.blank?\n @exam = nil\n redirect_to root_url, notice: \"Registro não encontrado\"\n else\n @exam = Exam.find(params[:id])\n end\n end",
"def show_medical_items\n record = MedicalInsuranceParticipator.find_by_user_id(params[:id])\n if record.participate=='participated'\n response_json MedicalTemplate.find(record.medical_template_id).medical_items.as_json(include: :medical_item_template)\n else\n response_json []\n end\n end",
"def show\n @exam_user = ExamUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_user }\n end\n end",
"def index\n @medalhas = Medalha.all\n end",
"def new\n @examination = Examination.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @examination }\n end\n end",
"def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end",
"def index\n @manuals = Manual.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manuals }\n end\n end",
"def index\n @emissions = Emission.all\n end"
] | [
"0.6691709",
"0.6376951",
"0.615914",
"0.61048347",
"0.6024783",
"0.59841484",
"0.5923909",
"0.5871902",
"0.5850734",
"0.5838046",
"0.58378536",
"0.5837433",
"0.5683783",
"0.5663371",
"0.5661857",
"0.56558764",
"0.5653756",
"0.564942",
"0.5639136",
"0.56313556",
"0.5618737",
"0.5607102",
"0.5601886",
"0.5601493",
"0.55943453",
"0.5579285",
"0.5569014",
"0.5561494",
"0.5538357",
"0.5514153",
"0.5511036",
"0.5495594",
"0.5487156",
"0.54846275",
"0.54835945",
"0.54796165",
"0.54710656",
"0.5469337",
"0.546175",
"0.54588807",
"0.5446425",
"0.5445751",
"0.54444265",
"0.5440607",
"0.5422292",
"0.5420737",
"0.5407567",
"0.5405433",
"0.54039586",
"0.5403145",
"0.54006207",
"0.5392403",
"0.5390169",
"0.53888977",
"0.538839",
"0.5386615",
"0.5385489",
"0.53845185",
"0.5370631",
"0.53608704",
"0.5359839",
"0.5359668",
"0.53547746",
"0.5351519",
"0.5347097",
"0.53429496",
"0.5340958",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.5340178",
"0.53387284",
"0.5334632",
"0.5334187",
"0.53312916",
"0.53291696",
"0.53247136",
"0.53212655",
"0.5318062",
"0.5316584",
"0.53158385",
"0.53154016",
"0.53110456",
"0.5310825",
"0.53104985",
"0.53025484",
"0.5292582",
"0.52856207",
"0.5280373",
"0.5276272",
"0.52747184",
"0.52740026",
"0.52731824",
"0.5271152",
"0.52703667"
] | 0.75781417 | 0 |
GET /exam_managements/1 GET /exam_managements/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exam_managements = ExamManagement.all\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def index\n @managements = Management.all\n end",
"def show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def new\n @my_exam = MyExam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def exam_management_params\n params[:exam_management]\n end",
"def show\n Exam.find(params[:exam_id])\n\n user_exam = current_user.user_exams.find_or_initialize_by(exam_id: params[:exam_id])\n user_exam.save! unless user_exam.persisted?\n render json: UserExamRepresenter.new(user_exam).to_h\n end",
"def new\n @exam_option = ExamOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_option }\n end\n end",
"def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def new\n @exam_user = ExamUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_user }\n end\n end",
"def show\n @examination = Examination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @examination }\n end\n end",
"def index\n @exam_sets = ExamSet.all\n end",
"def show\n @exam_option = ExamOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_option }\n end\n end",
"def new\n @exam_category = ExamCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def create\n @exam_management = ExamManagement.new(exam_management_params)\n\n respond_to do |format|\n if @exam_management.save\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' }\n format.json { render :show, status: :created, location: @exam_management }\n else\n format.html { render :new }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @exam_user = ExamUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_user }\n end\n end",
"def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend",
"def new\n @examination = Examination.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @examination }\n end\n end",
"def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend",
"def index\n @product_managements = ProductManagement.all\n\n render json: @product_managements\n end",
"def new\n @exam_code = ExamCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_code }\n end\n end",
"def set_exam\n @exam = @student.exams.find(params[:id])\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @examination }\n end\n end",
"def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end",
"def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end",
"def index\n @exam_settings = ExamSetting.all\n end",
"def index\n @examquestions = Examquestion.all\n end",
"def show\n @exam_code = ExamCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_code }\n end\n end",
"def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end",
"def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end",
"def destroy\n @exam_management.destroy\n respond_to do |format|\n format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examinations }\n end\n end",
"def new\n @experiencedetail = Experiencedetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiencedetail }\n end\n end",
"def index\n @incidentmanagements = Incidentmanagement.all\n end",
"def index\n @expertises = Expertise.all\n\n render json: @expertises\n end",
"def index\n @emmisions = Emmision.all\n @emmisions = @emmisions.joins(:vestments).where(:vestments => {:vestment_id => params[:vestment_id]}) if params[:vestment_id]\n @emmisions = @emmisions.order(:number).page(params[:page] || 1)\n end",
"def show\n @amendment = Amendment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amendment }\n end\n end",
"def new\n @explaination = Explaination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @explaination }\n end\n end",
"def show\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @explaination }\n end\n end",
"def new\n @admin_interview = Interview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_interview }\n end\n end",
"def show\n @experiencedetail = Experiencedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiencedetail }\n end\n end",
"def index\n render json: Assignment.all\n end",
"def new\n @advancement = Advancement.new(params[:advancement])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advancement }\n end\n end",
"def new\n @amendment = Amendment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amendment }\n end\n end",
"def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end",
"def set_introexam\n @introexam = Introexam.find(params[:id])\n end",
"def get_symptoms\n begin\n @desease = Desease.find(params[:id])\n\n @symptoms = @desease.symptoms\n render json: @symptoms\n rescue ActiveRecord::RecordNotFound => e\n render json: e, status: :unprocessable_entity\n end\n \n \n end",
"def index\n @exam_marks = ExamMark.all\n end",
"def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_instructor }\n end\n end",
"def set_exam_setting\n @exam_setting = ExamSetting.find(params[:id])\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def get_immunizations\n response = perform(:get, 'Immunization', params, headers)\n response.body\n end",
"def show\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_instructor }\n end\n end",
"def new\n @mencion = Mencion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mencion }\n end\n end",
"def new\n @experience = Experience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience }\n end\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end",
"def create\n @exam_set = ExamSet.new(exam_set_params)\n\n respond_to do |format|\n if @exam_set.save\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully created.' }\n format.json { render :show, status: :created, location: @exam_set }\n else\n format.html { render :new }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @users_managements = Users::Management.all\n end",
"def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end",
"def show\n @assessment = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def index\n @exam_students = ExamStudent.all\n end",
"def show\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @msalary }\n end\n end",
"def index\n @introexams = Introexam.all\n end",
"def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end",
"def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end",
"def show\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def update\n respond_to do |format|\n if @exam_management.update(exam_management_params)\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_management }\n else\n format.html { render :edit }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam.exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n authorize! :update, @exam\n end",
"def index\n @meditations = Meditation.all\n end",
"def index\n @amandments = Amandment.all\n end",
"def index\n @product_managements = ProductManagement.all\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @exp_detail = ExpDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exp_detail }\n end\n end",
"def new\n @judgement = Judgement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @judgement }\n end\n end",
"def show\n @project = Project.find(params[:project_id])\n @material_usage = @project.material_usages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_usage }\n end\n end",
"def show\n @curriculum_assessment = current_user.curriculumAssessments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end",
"def index\n @m_answers = MAnswer.all\n end",
"def set_exam_question\n @exam_question = ExamQuestion.find(params[:id])\n end",
"def new\n @medium_mission = MediumMission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_mission }\n end\n end",
"def show\n @medium_research_allotment = MediumResearchAllotment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_research_allotment }\n end\n end",
"def index\n @educations = Education.all\n render json: @educations\n end"
] | [
"0.7520445",
"0.68434495",
"0.64389783",
"0.64270663",
"0.6416772",
"0.6402397",
"0.6362644",
"0.6251403",
"0.62056255",
"0.61888474",
"0.6154322",
"0.6121455",
"0.6120247",
"0.61154735",
"0.6103058",
"0.6096471",
"0.6079488",
"0.60758805",
"0.60682464",
"0.60455257",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60447896",
"0.60418814",
"0.6033305",
"0.6019794",
"0.59966344",
"0.5975924",
"0.59668523",
"0.5957477",
"0.5936355",
"0.5908704",
"0.5894226",
"0.58873945",
"0.58596265",
"0.58562535",
"0.58535683",
"0.5788496",
"0.57846224",
"0.5775631",
"0.57635623",
"0.57589465",
"0.57589287",
"0.574512",
"0.5744231",
"0.57439697",
"0.5729946",
"0.5720587",
"0.56990415",
"0.56978333",
"0.56946385",
"0.56926423",
"0.56921655",
"0.5687735",
"0.56865317",
"0.56824905",
"0.56806195",
"0.56784904",
"0.56741077",
"0.5642498",
"0.56393975",
"0.5635972",
"0.5630416",
"0.56234545",
"0.5611688",
"0.5603901",
"0.5594479",
"0.5594461",
"0.5593319",
"0.55912703",
"0.5588908",
"0.55777806",
"0.55728847",
"0.5569398",
"0.5569398",
"0.5566358",
"0.55651385",
"0.5562759",
"0.55588764",
"0.55578494",
"0.5557598",
"0.55564475",
"0.5551365",
"0.5545461",
"0.5544402",
"0.5543796",
"0.55277544",
"0.55275214",
"0.5521807",
"0.5520288",
"0.55187005",
"0.551771",
"0.5514675",
"0.5512314",
"0.55068034"
] | 0.0 | -1 |
POST /exam_managements POST /exam_managements.json | def create
@exam_management = ExamManagement.new(exam_management_params)
respond_to do |format|
if @exam_management.save
format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' }
format.json { render :show, status: :created, location: @exam_management }
else
format.html { render :new }
format.json { render json: @exam_management.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exam_managements = ExamManagement.all\n end",
"def create\n @exam_set = ExamSet.new(exam_set_params)\n\n respond_to do |format|\n if @exam_set.save\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully created.' }\n format.json { render :show, status: :created, location: @exam_set }\n else\n format.html { render :new }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:name, :level, :description, :experience,\n questions_attributes: [:id, :exam_id, :content, '_destroy',\n answers_attributes: [:id, :question_id, :content, :correct, '_destroy' ] ])\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.user = current_user\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exam }\n else\n format.html { render action: 'new' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_exam = MyExam.new(params[:my_exam])\n\n respond_to do |format|\n if @my_exam.save\n format.html { redirect_to @my_exam, notice: 'My exam was successfully created.' }\n format.json { render json: @my_exam, status: :created, location: @my_exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_management_params\n params[:exam_management]\n end",
"def create\n @assessment = @department.assessments.build(assessment_params)\n authorize! :create, @assessment\n respond_to do |format|\n if @assessment.save\n flash[:notice] = \"Aspek Penilaian berhasil ditambahkan, #{undo_link(@assessments)}\"\n format.js\n else\n format.js { render action: 'new' }\n end\n end\n end",
"def create\n @introexam = Introexam.new(introexam_params)\n\n respond_to do |format|\n if @introexam.save\n format.html { redirect_to @introexam, notice: 'Introexam was successfully created.' }\n format.json { render :show, status: :created, location: @introexam }\n else\n format.html { render :new }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_set_params\n params.require(:exam_set).permit(:name, :sequence_number, :exam_date, :code, :exam_id)\n end",
"def create\n @exam = current_user.exams.new(exam_params)\n respond_to do |format|\n if @exam.save\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exam }\n else\n format.html { render action: 'new' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mockexam_params\n params.require(:mockexam).permit(:name, :level_id, :subject_id, {:mock_questions => [{:mock_answers => [:mock_question_id, :content], :mock_correct_answers => [:content,:mock_answer_id] } ]})\n end",
"def exam_params\n params.require(:exam).permit(:name, :exam_type, :difficulty_level, :course_id, :full_mark, :no_of_questions)\n end",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @exam_group = ExamGroup.shod(params[:exam_group_id])\n @batch = @exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n @exam = @exam_group.exams.new(params_exam)\n exam_create\n end",
"def create\r\n @exam = Exam.new(exam_params)\r\n\r\n if @exam.save\r\n redirect_to @exam, notice: \"Exam was successfully created.\"\r\n else\r\n render :new, status: :unprocessable_entity\r\n end\r\n end",
"def exam_params\n params.require(:exam).permit(:note, :student_id, :evaluation_id)\n end",
"def create\n @exam_setting = ExamSetting.new(exam_setting_params)\n\n respond_to do |format|\n if @exam_setting.save\n format.html { redirect_to exam_settings_path, notice: 'Exam setting was successfully created.' }\n format.json { render :show, status: :created, location: @exam_setting }\n else\n format.html { render :new }\n format.json { render json: @exam_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @examination = Examination.new(params[:examination])\n respond_to do |format|\n if @examination.save\n format.html { redirect_to @examination, notice: 'Examination was successfully created.' }\n format.json { render json: @examination, status: :created, location: @examination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params[:exam][:employee_id] = current_employee.id\n params.require(:exam).permit(:title, :marks, :time, :state, :employee_id, :subject_id, :team_id)\n end",
"def exam_params\n\t\t\tparams.require(:exam).permit(:title, :date, :unit_id, \n\t\t\t\tquestions_attributes:[ :id, :question, :exam_id,\t:_destroy,\n\t\t\t\tresponse_attributes:[:id, :answer, :question_id, :video,:_destroy]]\n\t\t\t\t)\n\t\tend",
"def exam_create\n if @exam.save\n flash[:notice] = t('create_exam')\n redirect_to exams_exam_group_path(@exam.exam_group)\n else\n render 'new'\n end\n end",
"def new\n @employer_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employer_study }\n end\n end",
"def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to exams_path, notice: 'Exam was successfully created.' }\n format.json { render json: exams_path, status: :created, location: @exam }\n else\n format.html { \n flash[:error] = 'Exam name can not be left blank.'\n render action: \"new\"\n }\n format.json { render json: exams_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def create\n @random_exam = RandomExam.new(random_exam_params)\n\n respond_to do |format|\n if @random_exam.save\n format.html { redirect_to @random_exam, notice: 'Random exam was successfully created.' }\n format.json { render :show, status: :created, location: @random_exam }\n else\n format.html { render :new }\n format.json { render json: @random_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:name)\n end",
"def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def create\n @m_answer = @m_question.m_answers.build(m_answer_params)\n respond_to do |format|\n if @m_answer.save\n format.html { redirect_to m_question_path(@m_question) }\n format.json { render action: 'show', status: :created, location: @m_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @m_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:exam_type, :name,:brief)\n end",
"def create_demonstrator_params\n params.require(:practical_ids).permit(:sam_student_id, practical_ids: [])\n end",
"def exam_params\n params[:exam].permit(:name, :grade)\n end",
"def new\n @my_exam = MyExam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def destroy\n @exam_management.destroy\n respond_to do |format|\n format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def exam_params\n params.require(:exam).permit(:exam_type, :number, :is_solution, :file, :semester, :year)\n end",
"def create\n params[:exam][:state] ||= nil\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @advancement = Advancement.new(params[:advancement])\n\n respond_to do |format|\n if @advancement.save\n format.html { redirect_to @advancement, notice: 'Advancement was successfully created.' }\n format.json { render json: @advancement, status: :created, location: @advancement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advancement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @examquestion = Examquestion.new(examquestion_params)\n\n respond_to do |format|\n if @examquestion.save\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @examquestion }\n else\n format.html { render action: 'new' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam_option = ExamOption.new(params[:exam_option])\n\n respond_to do |format|\n if @exam_option.save\n format.html { redirect_to @exam_option, notice: 'Exam option was successfully created.' }\n format.json { render json: @exam_option, status: :created, location: @exam_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:title)\n end",
"def exam_params\n params.require(:exam).permit(:exam_category_id, :name, :start_date)\n end",
"def written_exam_params\n params[:written_exam].permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end",
"def create\n puts management_params\n @management = Management.new(management_params)\n if @management.save\n render json: @management, status: :created\n else \n render json: @management.errors, status: :unprocessable_entity\n end\n end",
"def create\n @engagement = current_user.engagements.new(engagement_params_with_school)\n if @engagement.save\n render :show, status: :created, location: api_v2_engagement_url(@engagement)\n else\n puts @engagement.errors.full_messages\n render json: @engagement.errors, status: :unprocessable_entity\n end\n end",
"def create_exam\n @exam = PlacementExam.new\n @company = Company.all\n @placement_exam = PlacementExam.new\n end",
"def create\n @exam_student = ExamStudent.new\n if params[:user_id]\n @exam_student.user_id = params[:user_id]\n end\n if params[:exam_id]\n @exam_student.exam_id = params[:exam_id]\n end\n if params[:status]\n @exam_student.status = params[:status]\n end\n\n respond_to do |format|\n if @exam_student.save\n format.html { redirect_to exams_url, notice: 'Prijavili ste ispit.' }\n format.json { render :show, status: :created, location: @exam_student }\n else\n format.html { render :new }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mx_assessment = MxAssessment.new(mx_assessment_params)\n # byebug\n\n respond_to do |format|\n if @mx_assessment.save\n # format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @mx_assessment }\n format.json {head :no_content}\n else\n # format.html { render action: 'new' }\n format.json { render json: @mx_assessment.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n authorize @exam\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exam }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @exmedico = @paciente.exams.exmedico.new(params[:exmedico])\n # @exmedico.exam_id = @exam.id\n \n\n \n if @exmedico.save\n redirect_to [@paciente, @exam, @exmedico]\n else\n render action: \"new\"\n end\n \n end",
"def create\n @exam_user = ExamUser.new(params[:exam_user])\n\n respond_to do |format|\n if @exam_user.save\n format.html { redirect_to @exam_user, notice: 'Exam user was successfully created.' }\n format.json { render json: @exam_user, status: :created, location: @exam_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n params.require(:exam).permit(:user_id, :title, :description, :exam_date, :place, files: [], :tag_ids=>[])\n end",
"def index\n @managements = Management.all\n end",
"def create\n @encouragement = Encouragement.new(encouragement_params)\n\n respond_to do |format|\n if @encouragement.save\n format.html { redirect_to admin_encouragements_path, notice: 'Encouragement was successfully created.' }\n format.json { render :show, status: :created, location: @encouragement }\n else\n format.html { render :new }\n format.json { render json: @encouragement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @education = Education.new(education_params)\n\n if @education.save\n render json: @education, status: :created, location: @education\n else\n render json: @education.errors, status: :unprocessable_entity\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.patient = @patient\n\n if @exam.save\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle, status: :created\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n if @examination.save\n format.html { redirect_to @examination.project, notice: 'Examination was successfully created.' }\n format.json { render json: @examination, status: :created, location: @examination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @exam_category = ExamCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def questionnaire_params\n params.permit(member_ids: [], questionnaire: [:subject, :content])\n end",
"def create\n @immunization = Immunization.new(immunization_params)\n\n respond_to do |format|\n if @immunization.save\n format.html { redirect_to @immunization, notice: 'Immunization was successfully created.' }\n format.json { render :show, status: :created, location: @immunization }\n else\n format.html { render :new }\n format.json { render json: @immunization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\n prm=params.require(:exam).permit(:name, :description, :valid_from, :valid_to, :timespan, :teacher_id)\n questions=params.permit(question_list: [])\n prm[:teacher_id]=@logged_teacher.id\n @validated_question=[]\n unless questions[\"question_list\"].nil?\n sum=0\n questions[\"question_list\"].each do |question_id|\n question=Question.find_by_id(question_id)\n unless question.nil?\n @validated_question << question\n sum+=question.difficulty\n end\n end\n prm[:average_difficulty]=sum.to_f/@validated_question.size.to_f\n\n end\n prm\n end",
"def exam_params\n\t\t\tparams.require(:exam).permit(:title, :expired)\n\t\tend",
"def create\n @exam_category = ExamCategory.new(params[:exam_category])\n\n respond_to do |format|\n if @exam_category.save\n format.html { redirect_to @exam_category, notice: 'Exam category was successfully created.' }\n format.json { render json: @exam_category, status: :created, location: @exam_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_managements_params\n params.require(:document_managements).permit(:name, :file, :mg_employee_id, :is_deleted, :mg_school_id)\n end",
"def create\n @exam = Exam.new(params[:exam])\n @exam.user_id = current_user.id\n\n respond_to do |format|\n if @exam.save\n flash[:notice] = 'Exam was successfully created.'\n format.html { redirect_to(@exam) }\n format.xml { render :xml => @exam, :status => :created, :location => @exam }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @submission = Submission.new(:student_id => current_student.id, :assignment_id => params[:assignment_id])\n\n respond_to do |format|\n if @submission.save\n @assignment = @submission.assignment\n @assignment.questions.each do |question| \n answer = SubmittedAnswer.new(:submission_id => @submission.id, :question_id => question.id)\n answer.save\n end\n format.html { redirect_to edit_submission_path(@submission), notice: 'Submission was successfully created.' }\n format.json { render json: @submission, status: :created, location: @submission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_student_params\n params.require(:exam_student).permit(:exam_id, :user_id, :status)\n end",
"def create\n @admin = Admin.new(admin_params)\n\n respond_to do |format|\n if @admin.save\n format.html { redirect_to managements_path, notice: 'Management was successfully created.' }\n format.json { render :show, status: :created, location: @admin }\n else\n format.html { render :new}\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @exam_option = ExamOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_option }\n end\n end",
"def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end",
"def create\n @answer_set = AnswerSet.new(params[:answer_set])\n @answer_set.user = current_user\n @answer_set.cohort = current_user.cohort\n \n respond_to do |format|\n if @answer_set.save\n format.html { redirect_to root_path, notice: 'Your current mood has been recorded. Thank you.' }\n format.json { render json: @answer_set, status: :created, location: @answer_set }\n else\n format.html { render \"pages/home\" }\n format.json { render json: @answer_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end",
"def new\n @exam_user = ExamUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_user }\n end\n end",
"def create\n @enrollment = @parent.enrollments.build enrollment_params\n if @enrollment.save\n render :show, status: :created, location: api_v1_mutant_enrollment_url(@enrollment.mutant_id, @enrollment)\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @emmision = Emmision.new(emmision_params)\n\n respond_to do |format|\n if @emmision.save\n format.html { redirect_to @emmision, notice: \"Emmision was successfully created.\" }\n format.json { render :show, status: :created, location: @emmision }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @emmision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @placement_exam = PlacementExam.new(placement_exam_params)\n @placement_exam.save\n end",
"def create\n @exam_mark = ExamMark.new(exam_mark_params)\n\n respond_to do |format|\n if @exam_mark.save\n format.html { redirect_to @exam_mark, notice: 'Exam mark was successfully created.' }\n format.json { render :show, status: :created, location: @exam_mark }\n else\n format.html { render :new }\n format.json { render json: @exam_mark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def random_exam_params\n params.require(:random_exam).permit(\n :name,\n random_exam_sections_attributes: [\n :id,\n :selected,\n :section_id,\n :questions_number\n ]\n )\n end",
"def create\n @departmentlesson = Departmentlesson.new(departmentlesson_params)\n\n respond_to do |format|\n if @departmentlesson.save\n format.html { redirect_to @departmentlesson, notice: 'Department lesson was successfully created.' }\n format.json { render :show, status: :created, location: @departmentlesson }\n else\n format.html { render :new }\n format.json { render json: @departmentlesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end",
"def exam_params\n params[:exam]\n params.permit(:file, :posttype, :year, :user_id, :course_id, :examtype, :accepted, :acceptedby)\n end",
"def exam_answer_params\n params.require(:exam_answer).permit(:id, :exam_id, :user_id, :q1, :q2, :q3, :q4, :q5, :q6, :q7, :q8, :q9, :q10, :rec_points, :exam_level)\n end",
"def create\n @explaination = Explaination.new(params[:explaination])\n\n respond_to do |format|\n if @explaination.save\n format.html { redirect_to @explaination, notice: 'Explaination was successfully created.' }\n format.json { render json: @explaination, status: :created, location: @explaination }\n else\n format.html { render action: \"new\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @examination = Examination.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @examination }\n end\n end",
"def create\n @amendment = Amendment.new(params[:amendment])\n\n respond_to do |format|\n if @amendment.save\n format.html { redirect_to @amendment, notice: 'Amendment was successfully created.' }\n format.json { render json: @amendment, status: :created, location: @amendment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @amendment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exam_params\r\n params.require(:exam).permit(\r\n :title, :time, :category_id,\r\n questions_attributes: [\r\n :id, :title, :score, :_destroy,\r\n options_attributes: [:id, :content, :is_correct, :_destroy]\r\n ])\r\n #params.require(:exam).permit(:title, :time, :category_id)\r\n end",
"def create_employees_assessments\n assessmens = Assessment.active.map{|e| {assessment_id: e.id, employee_id: id}}\n # Creates an array like [{employee_id: 1}, {employee_id: 3}]\n EmployeeAssessment.create(assessmens)\n end",
"def create\n @amandment = Amandment.new(amandmant_params)\n @amandment.user = current_user\n\n respond_to do |format|\n if @amandment.save\n format.html { redirect_to @amandment, notice: 'Amandman was successfully created.' }\n format.json { render :show, status: :created, location: @amandment }\n else\n format.html { render :new }\n format.json { render json: @amandment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @first_exam = FirstExam.new(first_exam_params)\n\n respond_to do |format|\n if @first_exam.save\n format.html { redirect_to @first_exam, notice: 'First exam was successfully created.' }\n format.json { render :show, status: :created, location: @first_exam }\n else\n format.html { render :new }\n format.json { render json: @first_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return\n teacher = Teacher.find_by_name(params[:teacher])\n user = User.new(:username => params[:username])\n\n teacher.users << user\n \n user.record_exam(params)\n\n respond_to do |format|\n format.html { render :status => 200, :text => 'done' }\n end\n end",
"def create\n @exemption = Exemption.new(exemption_params)\n\n respond_to do |format|\n if @exemption.save\n format.html { redirect_to @exemption, notice: 'Exemption was successfully created.' }\n format.json { render :show, status: :created, location: @exemption }\n else\n format.html { render :new }\n format.json { render json: @exemption.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if ExamSubject.create(exam_subject_params[:exam_subject])\n format.html { redirect_to exams_path, notice: 'Exam marks saved.' }\n else\n format.html { render :new }\n end\n end\n end",
"def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end",
"def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def exam_params\n params.require(:exam).permit(:title, :date, :minimum)\n end"
] | [
"0.6509114",
"0.6235746",
"0.60923886",
"0.60821307",
"0.6022878",
"0.6022878",
"0.5989685",
"0.5982695",
"0.5969359",
"0.59178036",
"0.59096515",
"0.5891241",
"0.5866648",
"0.5845734",
"0.5825597",
"0.5807066",
"0.57910025",
"0.5787659",
"0.5783099",
"0.5780498",
"0.57164174",
"0.5712518",
"0.5699984",
"0.5677891",
"0.5672628",
"0.56695116",
"0.5662034",
"0.5651435",
"0.56479293",
"0.5645522",
"0.56417304",
"0.56403226",
"0.5614961",
"0.5614457",
"0.56123495",
"0.56045383",
"0.56027746",
"0.559312",
"0.55883723",
"0.55721414",
"0.55490315",
"0.5535529",
"0.5519342",
"0.5516323",
"0.5514117",
"0.551026",
"0.5502365",
"0.5498935",
"0.5489907",
"0.54831386",
"0.5479846",
"0.5477373",
"0.5471619",
"0.5460909",
"0.5453131",
"0.54451084",
"0.5438189",
"0.5421686",
"0.5417832",
"0.5417504",
"0.54169226",
"0.54166603",
"0.54124916",
"0.54114455",
"0.54051083",
"0.5401868",
"0.5384172",
"0.5383984",
"0.53808457",
"0.5379855",
"0.5372838",
"0.53722525",
"0.5364184",
"0.53560555",
"0.5354257",
"0.5353518",
"0.5343266",
"0.53431135",
"0.5338838",
"0.53294855",
"0.5326487",
"0.53248477",
"0.53191596",
"0.5314101",
"0.5308819",
"0.53058237",
"0.5289007",
"0.5287502",
"0.5279018",
"0.5271567",
"0.52645355",
"0.5263957",
"0.52628344",
"0.52605647",
"0.52600765",
"0.52599746",
"0.52580845",
"0.52576333",
"0.52557844",
"0.52430254"
] | 0.6725472 | 0 |
PATCH/PUT /exam_managements/1 PATCH/PUT /exam_managements/1.json | def update
respond_to do |format|
if @exam_management.update(exam_management_params)
format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' }
format.json { render :show, status: :ok, location: @exam_management }
else
format.html { render :edit }
format.json { render json: @exam_management.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_set.update(exam_set_params)\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_set }\n else\n format.html { render :edit }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n if @my_exam.update_attributes(params[:my_exam])\n format.html { redirect_to @my_exam, notice: 'My exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @exam\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:examination][:usesOfDrug_ids] ||= []\n params[:examination][:resistancesToDrug_ids] ||= []\n params[:examination][:mutation_ids] ||= []\n @examination = Examination.find(params[:id])\n\n respond_to do |format|\n if @examination.update_attributes(params[:examination])\n format.html { redirect_to @examination, notice: 'Examination was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rand_exam.update(rand_exam_params)\n @rand_exam.cache_paper_reset\n format.html { redirect_to xmt_test_exams_path, notice: '编辑成功.' }\n format.json { render :show, status: :ok, location: @rand_exam }\n else\n format.html { render :edit }\n format.json { render json: @rand_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam_option = ExamOption.find(params[:id])\n\n respond_to do |format|\n if @exam_option.update_attributes(params[:exam_option])\n format.html { redirect_to @exam_option, notice: 'Exam option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权修改别人编写的考试\"\n end\n parsed_param=exam_params\n @exam.questions.delete_all\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if @exam.update(parsed_param)\n format.html { redirect_to @exam, notice: \"已成功更新考试“#{@exam.name}.”\" }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_setting.update(exam_setting_params)\n format.html { redirect_to exam_settings_path, notice: 'Exam setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_setting }\n else\n format.html { render :edit }\n format.json { render json: @exam_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_exam.update(first_exam_params)\n format.html { redirect_to @first_exam, notice: 'First exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_exam }\n else\n format.html { render :edit }\n format.json { render json: @first_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @random_exam.update(random_exam_params)\n format.html { redirect_to @random_exam, notice: 'Random exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @random_exam }\n else\n format.html { render :edit }\n format.json { render json: @random_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mx_assessment.update(mx_assessment_params)\n format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam_user = ExamUser.find(params[:id])\n\n respond_to do |format|\n if @exam_user.update_attributes(params[:exam_user])\n format.html { redirect_to @exam_user, notice: 'Exam user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @introexam.update(introexam_params)\n format.html { redirect_to @introexam, notice: 'Introexam was successfully updated.' }\n format.json { render :show, status: :ok, location: @introexam }\n else\n format.html { render :edit }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto_minero_exam.update(proyecto_minero_exam_params)\n format.html { redirect_to @proyecto_minero_exam, notice: 'Proyecto minero exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto_minero_exam }\n else\n format.html { render :edit }\n format.json { render json: @proyecto_minero_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam.exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n authorize! :update, @exam\n end",
"def update\n @exam = Exam.shod(params[:id])\n if @exam.update(params_exam)\n flash[:notice] = t('update_exam')\n redirect_to exams_exam_group_path(@exam.exam_group)\n else\n render 'edit'\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = 'Exam was successfully updated.'\n format.html { redirect_to(@exam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_init(@written_exam)\n respond_to do |format|\n if @written_exam.update(written_exam_params)\n format.html { redirect_to @written_exam, notice: 'Written exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @written_exam }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @examination.update_attributes(params[:examination])\n format.html { redirect_to @examination, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n if @exam.update(exam_params)\r\n redirect_to @exam, notice: \"Exam was successfully updated.\"\r\n else\r\n render :edit, status: :unprocessable_entity\r\n end\r\n end",
"def update\n respond_to do |format|\n if @exam_subject.update(exam_subject_params)\n format.html { redirect_to @exam_subject, notice: 'Exam subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_subject }\n else\n format.html { render :edit }\n format.json { render json: @exam_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_student.update(exam_student_params)\n format.html { redirect_to @exam_student, notice: 'Exam student was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_student }\n else\n format.html { render :edit }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @advancement = Advancement.find(params[:id])\n\n respond_to do |format|\n if @advancement.update_attributes(params[:advancement])\n format.html { redirect_to @advancement, notice: 'Advancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advancement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_mark.update(exam_mark_params)\n format.html { redirect_to @exam_mark, notice: 'Exam mark was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_mark }\n else\n format.html { render :edit }\n format.json { render json: @exam_mark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam_code = ExamCode.find(params[:id])\n\n respond_to do |format|\n if @exam_code.update_attributes(params[:exam_code])\n format.html { redirect_to @exam_code, notice: 'Exam code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n if @exam_category.update_attributes(params[:exam_category])\n format.html { redirect_to @exam_category, notice: 'Exam category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end",
"def update\n @exam_group = ExamGroup.shod(params[:id])\n @exam_group.update(params_exam_group)\n @batch = @exam_group.batch\n @subjects = @batch.subjects.exam\n @exam_group.exams.build\n end",
"def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee_remunerative_concept = @employee.employee_emunerative_concept.find(params[:id])\n\n respond_to do |format|\n if @employee_remunerative_concept.update_attributes(params[:employee_remunerative_concept])\n format.html { redirect_to([@employee,@employee_remunerative_concept], :notice => 'Employee remunerative concept was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_remunerative_concept.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @experiencedetail = Experiencedetail.find(params[:id])\n\n respond_to do |format|\n if @experiencedetail.update_attributes(params[:experiencedetail])\n format.html { redirect_to @experiencedetail, notice: 'Experiencedetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiencedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n need_edit!\n @manual = Manual.find(params[:id])\n\n respond_to do |format|\n if @manual.update_attributes(params[:manual])\n format.html { redirect_to @manual, :notice => 'Manual was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @manual.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\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\n end\n end",
"def update\n @amendment = Amendment.find(params[:id])\n\n respond_to do |format|\n if @amendment.update_attributes(params[:amendment])\n format.html { redirect_to @amendment, notice: 'Amendment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @amendment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n if @explaination.update_attributes(params[:explaination])\n format.html { redirect_to @explaination, notice: 'Explaination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thesis_examination.update(thesis_examination_params)\n format.html { redirect_to @thesis_examination, notice: 'Thesis examination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thesis_examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment = @department.assessments.find(params[:id])\n respond_to do |format|\n if @assessment.update(assessment_params)\n flash[:notice] = \"Aspek Penilaian berhasil diubah, #{undo_link(@assessments)}\"\n format.js\n else\n format.js { render action: 'edit' }\n end\n end\n end",
"def update\n @assessment = Content.find(params[:id])\n if current_user.role.id == 7\n params[:assessment][:status] = 6\n end\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n if @assessment.status == 6\n Content.send_message_to_est(current_user.center.est,current_user,@assessment)\n end\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient = Patient.find(params[:patient_id]) \n @managed_care = ManagedCare.find(params[:id])\n @managed_care.updated_user = current_user.login_name\n @subscriber = @patient.subscribers.all\n @providers = @patient.providers\n @groups = @patient.groups \n \n respond_to do |format|\n if @managed_care.update_attributes(params[:managed_care])\n format.html { redirect_back_or_default patient_managed_cares_path(:patient_id =>params[:patient_id]), notice: 'Managed care was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @managed_care.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exapmle.update(exapmle_params)\n format.html { redirect_to @exapmle, notice: 'Exapmle was successfully updated.' }\n format.json { render :show, status: :ok, location: @exapmle }\n else\n format.html { render :edit }\n format.json { render json: @exapmle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exmedico.update(exmedico_params)\n format.html { redirect_to paciente_exam_exmedico_path(@paciente,@exam,@exmedico), notice: 'Exmedico was successfully updated.' }\n format.json { render :show, status: :ok, location: paciente_exam_exmedico_path(@paciente,@exam,@exmedico) }\n else\n format.html { render :edit }\n format.json { render json: @exmedico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @examination = Examination.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @examination.update(examination_params)\r\n\t #4 if @examination.update_attributes(params[:examination])\r\n flash[:notice] = 'Examination was successfully updated.'\r\n format.html { redirect_to(list_examinations_url) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @examination.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n if @exam.update(exam_params)\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @exam_id = args[:exam_id] if args.key?(:exam_id)\n @exam_type = args[:exam_type] if args.key?(:exam_type)\n @token = args[:token] if args.key?(:token)\n end",
"def update\n @admission.update_attributes(admission_params)\n end",
"def update\n @admission_form = AdmissionForm.find(params[:id])\n\n respond_to do |format|\n if @admission_form.update_attributes(params[:admission_form])\n format.html { redirect_to @admission_form, notice: 'Admission form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admission_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @m_answer = MAnswer.find(params[:id])\n respond_to do |format|\n if @m_answer.update(m_answer_params)\n format.html { redirect_to m_question_path(@m_question), notice: 'M answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admission.update(admission_params)\n format.html { redirect_to @admission, notice: 'Admission was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission }\n else\n format.html { render :edit }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @manage_instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n if @manage_instructor.update_attributes(params[:manage_instructor])\n format.html { redirect_to @manage_instructor, notice: 'Instructor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manage_instructor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admission.update(admission_params)\n format.html { redirect_to @admission, notice: 'Admission information was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission }\n else\n format.html { render :edit }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n examenes = params[:examenes]\n \n respond_to do |format|\n if @perfil.update(perfil_params) \n @perfil_examenes = PerfilExamene.where(:perfil_id => @perfil.id)\n examenes.each do |examen|\n @perfil_examenes.update(@perfil.id, tipo_examen_id: examen ) \n end\n \n\n format.html { redirect_to perfils_path, notice: 'El perfil fue actualizado correctamente' }\n format.json { render :show, status: :ok, location: @perfil }\n else\n format.html { render :edit }\n format.json { render json: @perfil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n if @msalary.update_attributes(params[:msalary])\n format.html { redirect_to @msalary, notice: 'Msalary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @msalary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @remission_guide.update(remission_guide_params)\n format.html { \n flash[:notice] = 'La Guía de Remisión se actualizó satisfactoriamente.'\n redirect_to remission_guides_path\n }\n format.json { render :show, status: :ok, location: @remission_guide }\n else\n format.html { render :edit }\n format.json { render json: @remission_guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_result.update(exam_result_params)\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_result }\n else\n format.html { render :edit }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @skill_assessment.update(skill_assessment_params)\n format.html { redirect_to @skill_assessment, notice: 'Skill assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @skill_assessment }\n else\n format.html { render :edit }\n format.json { render json: @skill_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consultant_master = ConsultantMaster.find(params[:id])\n\n respond_to do |format|\n if @consultant_master.update_attributes(params[:consultant_master])\n format.html { redirect_to @consultant_master, notice: 'Consultant master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consultant_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def update\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_practice_test][:status] = 6\n end\n respond_to do |format|\n if@assessment_practice_test.update_attributes(params[:assessment_practice_test])\n format.html { redirect_to@assessment_practice_test, notice: 'AssessmentPracticeTest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_practice_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @education_service_provided_typology.update(education_service_provided_typology_params)\n format.html { redirect_to @education_service_provided_typology, notice: 'Education service provided typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_service_provided_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n action_message_for(@guide.content_item.status)\n if update_guide\n format.html { redirect_to redirect_target(@guide), flash: @feedback_flash }\n format.json { render :show, status: :ok, location: @guide }\n else\n 1.times { @guide.sections.new } if @guide.subtype == 'detailed_guide'\n @guide.content_item.status = session[:content_item_status]\n format.html { render :edit }\n format.json { render json: @guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n check_forged_path\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if params[:question].has_key?(:purpose)\n @question.purpose = params[:question][:purpose]\n end\n format.html { redirect_to question_url(@question) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors.full_messages.to_xml, :status => :bad_request }\n format.json { render :json => @question.errors.full_messages.join(\"\\n\").to_json, :status => :bad_request }\n end\n end\n end",
"def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mispronunciation = Mispronunciation.find(params[:id])\n\n respond_to do |format|\n if @mispronunciation.update_attributes(params[:mispronunciation])\n format.html { redirect_to @mispronunciation, :notice => 'Mispronunciation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @mispronunciation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam\r\n @exam = Exam.find(params[:id])\r\n end",
"def update\n @experience = Experience.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment_info.update(assessment_info_params)\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_info }\n else\n format.html { render :edit }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n self.params[:user_submit][:user_answers_attributes].each do |key,value|\n params[:user_submit][:user_answers_attributes][key] = params[:user_submit][:user_answers_attributes][key].merge(:user_id => current_user.id)\n end\n @user_submit = UserSubmit.find(params[:id])\n @user_submit.update_attributes(params[:user_submit])\n @user_submit.user = current_user\n #@user_submit.exam_id = @examid\n respond_to do |format|\n @user_submit.locked = 1\n @user_submit.grade = @user_submit.exam.calc_grade(@user_submit)\n if @user_submit.save\n @user_submit.exam.locked = 1\n @user_submit.exam.save\n @user_submit.exam.questions.each do |useq|\n useq.locked = 1\n useq.answers.each do |uqa|\n uqa.locked = 1\n uqa.save\n end\n end\n \n format.html { redirect_to exams_url, notice: 'User submit was successfully created.' }\n format.json { render json: @user_submit, status: :created, location: @user_submit }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @user_submit.errors, status: :unprocessable_entity }\n format.html { redirect_to exams_url, notice: 'NOTICE! You may only submit answers for this exam once. See your instructor for permission to re-take the exam.' }\n end\n end\n end",
"def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @pain_assessment.author_id = current_user.id\n\n respond_to do |format|\n if @pain_assessment.update(pain_assessment_params)\n format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_assessment }\n else\n format.html { render :edit }\n format.json { render json: @pain_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n cnt = @attendance.num_of_edit + 1\n @attendance.update(num_of_edit: cnt)\n respond_to do |format|\n if @attendance.update(attendance_params)\n format.html { redirect_to @attendance, notice: 'Attendance was successfully updated.' }\n format.json { render :show, status: :ok, location: @attendance }\n else\n format.html { render :edit }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end",
"def set_exam\n @exam = Exam.find(params[:id])\n end"
] | [
"0.6895557",
"0.68855846",
"0.6880162",
"0.6808966",
"0.6785631",
"0.6678732",
"0.6678732",
"0.6678732",
"0.6678732",
"0.6628142",
"0.65718216",
"0.6540536",
"0.6492062",
"0.64654267",
"0.6451805",
"0.6390057",
"0.6369078",
"0.63637996",
"0.634729",
"0.63406545",
"0.6309019",
"0.63084334",
"0.6287542",
"0.6253664",
"0.62384903",
"0.6236078",
"0.6208359",
"0.6187005",
"0.61591434",
"0.61256826",
"0.6107755",
"0.60387963",
"0.60370463",
"0.6023266",
"0.6015673",
"0.60115206",
"0.5978211",
"0.5961522",
"0.59367204",
"0.5936662",
"0.5934819",
"0.5918689",
"0.59052694",
"0.59019125",
"0.5897142",
"0.5885598",
"0.58780295",
"0.5875754",
"0.58755046",
"0.5869884",
"0.5865361",
"0.58507544",
"0.5840822",
"0.58398366",
"0.5835995",
"0.58346796",
"0.58288604",
"0.58109576",
"0.5808272",
"0.5801847",
"0.5801721",
"0.58005583",
"0.5796258",
"0.5791605",
"0.57894415",
"0.5783311",
"0.57778966",
"0.5771926",
"0.5771926",
"0.57687473",
"0.57684463",
"0.57681483",
"0.57680327",
"0.57663393",
"0.57652026",
"0.5762594",
"0.5751025",
"0.57475656",
"0.57455707",
"0.5741823",
"0.57359034",
"0.57350796",
"0.5725912",
"0.57247096",
"0.5723603",
"0.57220316",
"0.5716482",
"0.5716295",
"0.57147217",
"0.57122195",
"0.5707752",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011",
"0.5707011"
] | 0.6901353 | 0 |
DELETE /exam_managements/1 DELETE /exam_managements/1.json | def destroy
@exam_management.destroy
respond_to do |format|
format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_set.destroy\n respond_to do |format|\n format.html { redirect_to exam_sets_url, notice: 'Exam set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to patient_url(@patient), notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_exam.destroy\n respond_to do |format|\n format.html { redirect_to first_exams_url, notice: 'First exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_option = ExamOption.find(params[:id])\n @exam_option.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n authorize @exam\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @introexam.destroy\n respond_to do |format|\n format.html { redirect_to introexams_url, notice: 'Introexam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n authorize! :delete, @exam\n @exam.destroy\n redirect_to exams_exam_group_path(@exam.exam_group)\n end",
"def destroy\n @exam_student.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Odjavili ste ispit.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mx_assessment.destroy\n respond_to do |format|\n format.html { redirect_to mx_assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_user = ExamUser.find(params[:id])\n @exam_user.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @proyecto_minero_exam.destroy\n respond_to do |format|\n format.html { redirect_to proyecto_minero_exams_url, notice: 'Proyecto minero exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to @examination.project }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权删除别人编写的考试\"\n end\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: '成功删除考试.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thesis_examination.destroy\n respond_to do |format|\n format.html { redirect_to thesis_examinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_setting.destroy\n respond_to do |format|\n format.html { redirect_to exam_settings_url, notice: 'Exam setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = @department.assessments.find(params[:id])\n @assessment.destroy\n respond_to do |format|\n flash[:notice] = \"Aspek Penilaian berhasil dihapus, #{undo_link(@assessments)}\"\n format.html { redirect_to assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @examination = Examination.find(params[:id])\r\n @examination.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(list_examinations_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @exam_subject.destroy\n respond_to do |format|\n format.html { redirect_to exam_subjects_url, notice: 'Exam subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exp_detail = ExpDetail.find(params[:id])\n @exp_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to exp_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_code = ExamCode.find(params[:id])\n @exam_code.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_codes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n @exam_group = ExamGroup.shod(params[:id])\n authorize! :delete, @exam_group\n batch = @exam_group.batch\n @exam_group.destroy\n flash[:notice] = 'Exam Group deleted successfully!'\n redirect_to exam_group_path(batch)\n end",
"def destroy\n @exam_mark.destroy\n respond_to do |format|\n format.html { redirect_to exam_marks_url, notice: 'Exam mark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advancement = Advancement.find(params[:id])\n @advancement.destroy\n\n respond_to do |format|\n format.html { redirect_to advancements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admintreatmentmechanical.destroy\n respond_to do |format|\n format.html { redirect_to admintreatmentmechanicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @written_exam.destroy\n respond_to do |format|\n format.html { redirect_to written_exams_url, notice: 'Written exam was successfully destroyed.' }\n end\n end",
"def destroy\n @experiencedetail = Experiencedetail.find(params[:id])\n @experiencedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to experiencedetails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n need_admin!\n\n @manual = Manual.find(params[:id])\n @manual.destroy\n\n respond_to do |format|\n format.html { redirect_to manuals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @remission_guide.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La Guía de Remisión se eliminó satisfactoriamente.'\n redirect_to remission_guides_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnairedetail.destroy\n respond_to do |format|\n format.html { redirect_to questionnairedetails_url, notice: 'Questionnairedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment_criterion_detail.destroy\n respond_to do |format|\n format.html { redirect_to assessment_criterion_details_url, notice: 'Assessment criterion detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_battery.destroy\n respond_to do |format|\n format.html { redirect_to exam_batteries_url, notice: 'Exam battery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mision = Mision.find(params[:id])\n @mision.destroy\n\n respond_to do |format|\n format.html { redirect_to misions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = @question.exam\n @question.destroy\n redirect_to overview_exam_path(@exam), notice: _('Question was successfully updated.')\n\n end",
"def destroy\r\n @exam.destroy\r\n redirect_to exams_url, notice: \"Exam was successfully destroyed.\"\r\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admission.destroy\n respond_to do |format|\n format.html { redirect_to admissions_url, notice: 'Admission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exapmle.destroy\n respond_to do |format|\n format.html { redirect_to exapmles_url, notice: 'Exapmle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mision_mision = MisionMision.find(params[:id])\n @mision_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to mision_misions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_interview = Interview.find(params[:id])\n @admin_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admission.destroy\n respond_to do |format|\n format.html { redirect_to admissions_url, notice: 'Admission information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_result.destroy\n respond_to do |format|\n format.html { redirect_to exam_results_url, notice: 'Exam result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requisition.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @amendment = Amendment.find(params[:id])\n @amendment.destroy\n\n respond_to do |format|\n format.html { redirect_to amendments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultum = Consultum.find(params[:id])\n @consultum.destroy\n\n respond_to do |format|\n format.html { redirect_to consulta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skill_assessment.destroy\n respond_to do |format|\n format.html { redirect_to skill_assessments_url, notice: 'Skill assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n @calculated_data_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to calculated_data_assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accident_item.destroy\n respond_to do |format|\n format.html { redirect_to accident_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = Assessment.find(params[:id])\n @assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medical_test.destroy\n respond_to do |format|\n format.html { redirect_to medical_tests_url, notice: 'Medical test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumni = Alumni.find(params[:id])\n @alumni.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @management.destroy\n respond_to do |format|\n format.html { redirect_to managements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admintreatmentfumigation.destroy\n respond_to do |format|\n format.html { redirect_to admintreatmentfumigations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_accomplishment.destroy\n respond_to do |format|\n format.html { redirect_to education_accomplishments_url, notice: 'Education accomplishment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_detail.destroy\n respond_to do |format|\n format.html { redirect_to education_details_url, notice: 'Education detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteAssignment\n @assignment = Assignment.find(params[:assignment_id])\n @assignment.destroy\n respond_to do |format|\n format.html {redirect_to add_objective_to_student_path, notice: 'Assignment was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n \n end",
"def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = Content.find(params[:id])\n @assessment.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to assessments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @muscle_diary.destroy\n respond_to do |format|\n format.html { redirect_to muscle_diaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examination.destroy\n\n redirect_to examinations_url, notice: 'Simulate test was successfully destroyed.'\n\n\n end",
"def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7551792",
"0.7548073",
"0.7528161",
"0.7385695",
"0.7367076",
"0.73138744",
"0.73138744",
"0.73138744",
"0.72853357",
"0.7240872",
"0.7238346",
"0.7214121",
"0.7206823",
"0.7203359",
"0.7180046",
"0.71610653",
"0.7146668",
"0.71156037",
"0.71142673",
"0.7108968",
"0.71011966",
"0.7092572",
"0.7085396",
"0.7070415",
"0.7055531",
"0.7049773",
"0.70486003",
"0.7025887",
"0.69968027",
"0.69751555",
"0.68841803",
"0.68747807",
"0.6852818",
"0.6849622",
"0.6833008",
"0.68316376",
"0.68293333",
"0.68245494",
"0.6790907",
"0.6788416",
"0.67695546",
"0.67668134",
"0.67339545",
"0.67317665",
"0.67302495",
"0.67302495",
"0.67302495",
"0.67253035",
"0.6705171",
"0.6703282",
"0.6687729",
"0.66831136",
"0.6677809",
"0.6675937",
"0.6675057",
"0.6673487",
"0.66734076",
"0.6669872",
"0.6665544",
"0.6662584",
"0.6662584",
"0.6655737",
"0.66541094",
"0.66508925",
"0.66508925",
"0.6648768",
"0.6641939",
"0.6640995",
"0.66381407",
"0.663631",
"0.663631",
"0.66353554",
"0.6635069",
"0.6632953",
"0.6626112",
"0.66221714",
"0.6610583",
"0.66010267",
"0.65993035",
"0.65992564",
"0.6596992",
"0.6593632",
"0.6591691",
"0.6587124",
"0.6584709",
"0.6584133",
"0.65832776",
"0.65747076",
"0.65736264",
"0.6568696",
"0.6568242",
"0.6567672",
"0.6567009",
"0.65652966",
"0.6563472",
"0.6561959",
"0.6561428",
"0.65598696",
"0.65597963",
"0.65592986"
] | 0.753681 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_exam_management
@exam_management = ExamManagement.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def exam_management_params
params[:exam_management]
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 |
Replace this with your real tests. | def test_truth
assert true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def private; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def test_method\n end",
"def before_test(test); end",
"def before_test(test); end",
"def graffiti_test\n end",
"def test_truth\n end",
"def test_should_get_index \n get :index\n assert_response :success #making sure the request was successful\n assert_not_nil (:products) # ensuring that it assigns a valid products instance variable.\n end",
"def test_case; end",
"def test_cases; end",
"def running_test_case; end",
"def test_connection\n end",
"def testloop\n \n end",
"def should; super end",
"def test_nothing\n end",
"def default_test\r\n end",
"def my_tests\n end",
"def test_setup\r\n \r\n end",
"def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end",
"def testing_end\n end",
"def test_next_song\n \n \n assert true\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def assertions; end",
"def assertions; end",
"def test_hack\n assert(true)\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end",
"def teardown; end",
"def teardown; end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def before_assert\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def tests_song_not_found\n assert_equal =\n end\n\nend",
"def test_playlist\n end",
"def test_listchunk_attributes\n\t\t\n\tend",
"def love_test\nend",
"def test_entry_attrs\n raise \"Implement this method in your test class\"\n end",
"def test_truth\n assert true\n end",
"def stest_method_1(test); end",
"def teardown\r\n end",
"def default_test\n end",
"def test_037\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n\n # you have no relevance\n filtering('3')\n assert !is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n assert is_text_present(_('A PU does not exist.'))\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def run_fe_tests\n end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def setup; end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end",
"def test_BooksForAnAuthor\n loginRegisterBazzarVoice\n writeReview \n assert true \n end"
] | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6385941",
"0.6354074",
"0.6354074",
"0.6350063",
"0.6317573",
"0.6271346",
"0.62341285",
"0.6210424",
"0.6183045",
"0.61626923",
"0.61574936",
"0.6137384",
"0.61362237",
"0.61194503",
"0.611745",
"0.61087",
"0.6098303",
"0.606717",
"0.6058555",
"0.6057699",
"0.6057699",
"0.6057699",
"0.6057699",
"0.6045397",
"0.6045397",
"0.6029009",
"0.60160005",
"0.60160005",
"0.60160005",
"0.6014079",
"0.5998994",
"0.5998994",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5989936",
"0.59822077",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.5950605",
"0.59497803",
"0.5943133",
"0.59424186",
"0.5932352",
"0.59296894",
"0.5929659",
"0.5917424",
"0.59144044",
"0.5913393",
"0.5905494",
"0.5899468",
"0.58910733",
"0.58910733",
"0.58910733",
"0.5889112",
"0.5883961",
"0.5883961",
"0.5880121",
"0.5877717"
] | 0.0 | -1 |
for a URL like the fixture is expected to be spec/fixures/CertiPathBridgeCAG3.p7c | def stub_p7c(url)
fixture = File.basename(url)
stub_request(:get, url)
.to_return(body: File.read(File.join('spec/fixtures/', fixture)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ca_path_name\n uri = URI.parse('https://www.amazon.com')\n http = Net::HTTP.new(uri.host, uri.port)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_path = path(\"fixture/ca_path/\")\n http.use_ssl = true\n response = http.start do |s|\n assert s.get(uri.request_uri).length > 0\n end\n end",
"def test_pathlen_does_not_appear\n uri = URI.parse('https://www.paypal.com/')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # right trust anchor for www.amazon.com\n http.ca_file = path('fixture/verisign_c3.pem')\n response = http.start do |s|\n assert s.get(uri.request_uri).length > 0\n end\n end",
"def test_srpm_spec_url\n get '/srpm/Sisyphus/glibc/spec'\n assert_equal 'http://packages.altlinux.org/ru/Sisyphus/srpms/glibc/spec', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch51/glibc/spec'\n assert_equal 'http://packages.altlinux.org/ru/5.1/srpms/glibc/spec', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/p5/glibc/spec'\n assert_equal 'http://packages.altlinux.org/ru/Platform5/srpms/glibc/spec', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch41/glibc/spec'\n assert_equal 'http://packages.altlinux.org/ru/4.1/srpms/glibc/spec', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch4/glibc/spec'\n assert_equal 'http://packages.altlinux.org/ru/4.0/srpms/glibc/spec', last_response.location\n assert_equal 301, last_response.status\n end",
"def url\n \"http://isitruby19.com/#{spec.name}\"\n end",
"def url\n \"http://isitruby19.com/#{spec.name}\"\n end",
"def fake_url\n protocol = rand(10) > 8 ? \"http\" : \"https\"\n domain = (rand(3)+2).times.map{ rand(2 ** 12).to_s(32) }.join(\".\")\n path = words(rand(5)).join(\"/\")\n \n \"#{protocol}://#{domain}/#{path}\"\nend",
"def build_url_test_data\n data = []\n\n # format: [<test-url> <...expected-http-codes> <expected-final-redirect-url>?]\n\n # hub3.com\n data << %w{ http://hub3.com 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.com 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.com 200 }\n data << %w{ https://www.hub3.com 301 200 https://hub3.com/ }\n\n # hub3.co\n data << %w{ http://hub3.co 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.co 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.co 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3.co 301 200 https://hub3.com/ }\n\n # hub3solutions.com\n data << %w{ http://hub3solutions.com 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3solutions.com 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3solutions.com 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3solutions.com 301 200 https://hub3.com/ }\n\n # hub3.solutions\n data << %w{ http://hub3.solutions 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.solutions 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.solutions 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3.solutions 301 200 https://hub3.com/ }\n\n # officesnake.com\n data << %w{ http://officesnake.com 301 200 https://officesnake.com/ }\n data << %w{ http://www.officesnake.com 301 200 https://officesnake.com/ }\n data << %w{ https://officesnake.com 200 }\n data << %w{ https://www.officesnake.com 301 200 https://officesnake.com/ }\n\n # pandify.com\n data << %w{ http://pandify.com 301 200 https://pandify.com/ }\n data << %w{ http://www.pandify.com 301 200 https://pandify.com/ }\n data << %w{ https://pandify.com 200 }\n data << %w{ https://www.pandify.com 301 200 https://pandify.com/ }\n\n # hitpic.me\n data << %w{ http://hitpic.me 301 200 https://hitpic.me/ }\n data << %w{ http://www.hitpic.me 301 200 https://hitpic.me/ }\n data << %w{ https://hitpic.me 200 }\n data << %w{ https://www.hitpic.me 301 200 https://hitpic.me/ }\n\n # ustasb.com\n data << %w{ http://ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ http://www.ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ https://ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ https://www.ustasb.com 301 200 https://brianustas.com/ }\n\n # brianustas.com\n data << %w{ http://brianustas.com 301 200 https://brianustas.com/ }\n data << %w{ http://www.brianustas.com 301 200 https://brianustas.com/ }\n data << %w{ https://brianustas.com 200 }\n data << %w{ https://www.brianustas.com 301 200 https://brianustas.com/ }\n\n data << %w{ https://brianustas.com/knightly-dashboard-demo/ 200 }\n data << %w{ https://brianustas.com/knightly-dashboard-demo 301 200 https://brianustas.com/knightly-dashboard-demo/ }\n data << %w{ https://brianustas.com/knightly-demo/ 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/knightly-demo 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/campus-safety-dashboard/ 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/campus-safety-dashboard 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n\n data << %w{ https://brianustas.com/where-in-the-world/ 200 }\n data << %w{ https://brianustas.com/where-in-the-world 301 200 https://brianustas.com/where-in-the-world/ }\n data << %w{ https://brianustas.com/whereintheworld/ 301 200 https://brianustas.com/where-in-the-world/ } # legacy\n data << %w{ https://brianustas.com/whereintheworld 301 200 https://brianustas.com/where-in-the-world/ } # legacy\n\n data << %w{ https://brianustas.com/emoji-soup/ 200 }\n data << %w{ https://brianustas.com/emoji-soup 301 200 https://brianustas.com/emoji-soup/ }\n data << %w{ https://brianustas.com/emojisoup/ 301 200 https://brianustas.com/emoji-soup/ } # legacy\n data << %w{ https://brianustas.com/emojisoup 301 200 https://brianustas.com/emoji-soup/ } # legacy\n\n data << %w{ https://brianustas.com/dunkin-donuts-auto-survey/ 200 }\n data << %w{ https://brianustas.com/dunkin-donuts-auto-survey 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ }\n data << %w{ https://brianustas.com/free-donut/ 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/free-donut 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/freedonut/ 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/freedonut 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n\n data << %w{ https://brianustas.com/cubecraft/ 200 }\n data << %w{ https://brianustas.com/cubecraft 301 200 https://brianustas.com/cubecraft/ }\n\n data << %w{ https://brianustas.com/infinite-jest-music/ 200 }\n data << %w{ https://brianustas.com/infinite-jest-music 301 200 https://brianustas.com/infinite-jest-music/ }\n\n data << %w{ https://brianustas.com/office-snake/ 301 200 https://officesnake.com }\n data << %w{ https://brianustas.com/office-snake 301 200 https://officesnake.com }\n data << %w{ https://brianustas.com/officesnake/ 301 200 https://officesnake.com } # legacy\n data << %w{ https://brianustas.com/officesnake 301 200 https://officesnake.com } # legacy\n\n data << %w{ https://brianustas.com/sitemap.xml 200 }\n data << %w{ https://brianustas.com/robots.txt 200 }\n data << %w{ https://brianustas.com/keybase.txt 200 }\n data << %w{ https://brianustas.com/portfolio 301 200 https://brianustas.com/blog }\n\n data.sort.map do |d|\n ret = {\n url: d[0],\n http_codes: d[1..-1],\n }\n\n # Was a redirect URL provided?\n if (/^https?:/ =~ d.last) == 0\n ret[:final_redirect_url] = ret[:http_codes].pop\n end\n\n ret\n end\nend",
"def specs_url\n \"http://#{@host}/#{SPECS_ARCHIVE_FILE}\"\n end",
"def prepare(spec)\n URI.decode(spec)\n end",
"def validate_source_url(spec)\n return if spec.source.nil? || spec.source[:http].nil?\n url = URI(spec.source[:http])\n return if url.scheme == 'https' || url.scheme == 'file'\n warning('http', \"The URL (`#{url}`) doesn't use the encrypted HTTPS protocol. \" \\\n 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\\\n 'This will be an error in future releases. Please update the URL to use https.')\n end",
"def patched_url\n result = url\n return result if result.start_with?('/', 'http')\n \"/#{result}\"\n end",
"def test_webhook(url)\n URI(url).host == \"fabrikam-fiber-inc.visualstudio.com\"\n end",
"def consume_bad_url; end",
"def test_url\n get('/html/urltest')\n assert last_response.ok?\n assert_equal File.new(\"./results/urltest.ml\").read, last_response.body\n\n get('/html/urltest/1')\n assert last_response.ok?\n assert_equal File.new(\"./results/urltest-part.ml\").read, last_response.body\n end",
"def test_process_url_params_idempotent\n # verify that using url method from RestClient doesn't change existing url\n request_url=@@dummy_host+\"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url).url\n #puts \"full_request_url: [#{full_request_url}]\"\n refute_nil full_request_url\n assert_equal(request_url, full_request_url)\n end",
"def test_CC_web_resource\n # CC -!- DATABASE: NAME=ResourceName[; NOTE=FreeText][; WWW=WWWAddress][; FTP=FTPAddress].\n # CC -!- WEB RESOURCE: NAME=ResourceName[; NOTE=FreeText]; URL=WWWAddress.\n # The length of these lines may exceed 75 characters because long URL addresses are not wrapped into multiple lines.\n assert(true)\n end",
"def fake_url?\n url =~ /^\\d\\d\\d\\d-/\n end",
"def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end",
"def fix_oneoff url\n begin\n uri = URI.parse url\n return (\"\" == uri.path) ? url + '/' : url\n rescue\n #puts \"Ran into issue processing #{url}\"\n end\n end",
"def auth_workarounds(url)\n # crepeerase workaround\n if(url.include?('crepeerase') && url.include?('.grdev.'))\n env = url.scan(/.crepeerase.([^.]+)/).first.first\n @browser.driver.browser.get \"https://storefront:Grcweb123@www.crepeerase.#{env}.dw2.grdev.com\"\n end\n end",
"def pull_url(string)\n return Dish(@catchpoint.get(\"tests?url=#{string}\"))\n end",
"def test_valid_unc_uris\n [\n ['file:////example.com/Share/dir/file.ext', '//example.com/Share/dir/file.ext', '\\\\\\\\example.com\\\\Share\\\\dir\\\\file.ext'],\n ['file://///example.com/Share/dir/file.ext', '//example.com/Share/dir/file.ext', '\\\\\\\\example.com\\\\Share\\\\dir\\\\file.ext'],\n\n ['file:////localhost/Share/dir/file.ext', '//localhost/Share/dir/file.ext', '\\\\\\\\localhost\\\\Share\\\\dir\\\\file.ext'],\n ['file://///localhost/Share/dir/file.ext', '//localhost/Share/dir/file.ext', '\\\\\\\\localhost\\\\Share\\\\dir\\\\file.ext'],\n ].each do |str, path, unc|\n uri = URI.parse(str)\n assert_kind_of( URI::FileCommon, uri )\n assert_equal( path, uri.path )\n\n assert_equal( false, uri.local?(localhost: false) )\n assert_equal( false, uri.local?(localhost: true) )\n assert_equal( false, uri.local? )\n assert_equal( false, uri.local?(localhost: :any) )\n\n assert_raise(RuntimeError) { uri.to_file_path(localhost: false) }\n assert_raise(RuntimeError) { uri.to_file_path(localhost: true) }\n assert_raise(RuntimeError) { uri.to_file_path }\n assert_raise(RuntimeError) { uri.to_file_path(localhost: :any) }\n\n assert_equal( unc, uri.to_unc(localhost: false) )\n assert_equal( unc, uri.to_unc(localhost: true) )\n assert_equal( unc, uri.to_unc )\n assert_equal( unc, uri.to_unc(localhost: :any) )\n end\n end",
"def ensure_http \n url.ensure_http\n end",
"def test_srpm_url\n get '/srpm/Sisyphus/glibc'\n assert_equal 'http://packages.altlinux.org/ru/Sisyphus/srpms/glibc', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch51/glibc'\n assert_equal 'http://packages.altlinux.org/ru/5.1/srpms/glibc', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/p5/glibc'\n assert_equal 'http://packages.altlinux.org/ru/Platform5/srpms/glibc', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch41/glibc'\n assert_equal 'http://packages.altlinux.org/ru/4.1/srpms/glibc', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch4/glibc'\n assert_equal 'http://packages.altlinux.org/ru/4.0/srpms/glibc', last_response.location\n assert_equal 301, last_response.status\n end",
"def test_readings_url_must_start_with_http_09\n r = Reading.create(url: \"http://www.boomboomroom.com\")\n assert r.url.include?(\"http\")\n s = Reading.new(url: \"zombo.com\")\n refute s.save\n end",
"def check_uri_build\n\n end",
"def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end",
"def file_uri_scheme; end",
"def get_full_url(path)\n return \"http://127.0.0.1:#{Capybara.server_port}#{path}\"\nend",
"def test_url_param()\n # Parameters for the API call\n url = 'https://www.shahidisawesome.com/and/also/a/narcissist?thisis=aparameter&another=one'\n\n # Perform the API call through the SDK function\n result = self.class.controller.url_param(url)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_nasty_pound_header\n parser = HttpParser.new\n nasty_pound_header = \"GET / HTTP/1.1\\r\\nX-SSL-Bullshit: -----BEGIN CERTIFICATE-----\\r\\n\\tMIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\\r\\n\\tETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\\r\\n\\tAkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\\r\\n\\tdWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBbMQswCQYDVQQGEwJV\\r\\n\\tSzERMA8GA1UEChMIZVNjaWVuY2UxEzARBgNVBAsTCk1hbmNoZXN0ZXIxCzAJBgNV\\r\\n\\tBAcTmrsogriqMWLAk1DMRcwFQYDVQQDEw5taWNoYWVsIHBhcmQYJKoZIhvcNAQEB\\r\\n\\tBQADggEPADCCAQoCggEBANPEQBgl1IaKdSS1TbhF3hEXSl72G9J+WC/1R64fAcEF\\r\\n\\tW51rEyFYiIeZGx/BVzwXbeBoNUK41OK65sxGuflMo5gLflbwJtHBRIEKAfVVp3YR\\r\\n\\tgW7cMA/s/XKgL1GEC7rQw8lIZT8RApukCGqOVHSi/F1SiFlPDxuDfmdiNzL31+sL\\r\\n\\t0iwHDdNkGjy5pyBSB8Y79dsSJtCW/iaLB0/n8Sj7HgvvZJ7x0fr+RQjYOUUfrePP\\r\\n\\tu2MSpFyf+9BbC/aXgaZuiCvSR+8Snv3xApQY+fULK/xY8h8Ua51iXoQ5jrgu2SqR\\r\\n\\twgA7BUi3G8LFzMBl8FRCDYGUDy7M6QaHXx1ZWIPWNKsCAwEAAaOCAiQwggIgMAwG\\r\\n\\tA1UdEwEB/wQCMAAwEQYJYIZIAYb4QgEBBAQDAgWgMA4GA1UdDwEB/wQEAwID6DAs\\r\\n\\tBglghkgBhvhCAQ0EHxYdVUsgZS1TY2llbmNlIFVzZXIgQ2VydGlmaWNhdGUwHQYD\\r\\n\\tVR0OBBYEFDTt/sf9PeMaZDHkUIldrDYMNTBZMIGaBgNVHSMEgZIwgY+AFAI4qxGj\\r\\n\\tloCLDdMVKwiljjDastqooXSkcjBwMQswCQYDVQQGEwJVSzERMA8GA1UEChMIZVNj\\r\\n\\taWVuY2UxEjAQBgNVBAsTCUF1dGhvcml0eTELMAkGA1UEAxMCQ0ExLTArBgkqhkiG\\r\\n\\t9w0BCQEWHmNhLW9wZXJhdG9yQGdyaWQtc3VwcG9ydC5hYy51a4IBADApBgNVHRIE\\r\\n\\tIjAggR5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMudWswGQYDVR0gBBIwEDAO\\r\\n\\tBgwrBgEEAdkvAQEBAQYwPQYJYIZIAYb4QgEEBDAWLmh0dHA6Ly9jYS5ncmlkLXN1\\r\\n\\tcHBvcnQuYWMudmT4sopwqlBWsvcHViL2NybC9jYWNybC5jcmwwPQYJYIZIAYb4QgEDBDAWLmh0\\r\\n\\tdHA6Ly9jYS5ncmlkLXN1cHBvcnQuYWMudWsvcHViL2NybC9jYWNybC5jcmwwPwYD\\r\\n\\tVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NhLmdyaWQt5hYy51ay9wdWIv\\r\\n\\tY3JsL2NhY3JsLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAS/U4iiooBENGW/Hwmmd3\\r\\n\\tXCy6Zrt08YjKCzGNjorT98g8uGsqYjSxv/hmi0qlnlHs+k/3Iobc3LjS5AMYr5L8\\r\\n\\tUO7OSkgFFlLHQyC9JzPfmLCAugvzEbyv4Olnsr8hbxF1MbKZoQxUZtMVu29wjfXk\\r\\n\\thTeApBv7eaKCWpSp7MCbvgzm74izKhu3vlDk9w6qVrxePfGgpKPqfHiOoGhFnbTK\\r\\n\\twTC6o2xq5y0qZ03JonF7OJspEd3I5zKY3E+ov7/ZhW6DqT8UFvsAdjvQbXyhV8Eu\\r\\n\\tYhixw1aKEPzNjNowuIseVogKOLXxWI5vAi5HgXdS0/ES5gDGsABo4fqovUKlgop3\\r\\n\\tRA==\\r\\n\\t-----END CERTIFICATE-----\\r\\n\\r\\n\"\n req = parser.env\n parser.buf << nasty_pound_header.dup\n\n assert nasty_pound_header =~ /(-----BEGIN .*--END CERTIFICATE-----)/m\n expect = $1.dup\n expect.gsub!(/\\r\\n\\t/, ' ')\n assert_equal req, parser.parse\n assert_equal '', parser.buf\n assert_equal expect, req['HTTP_X_SSL_BULLSHIT']\n end",
"def test_srpm_get_url\n get '/srpm/Sisyphus/glibc/get'\n assert_equal 'http://packages.altlinux.org/ru/Sisyphus/srpms/glibc/get', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch51/glibc/get'\n assert_equal 'http://packages.altlinux.org/ru/5.1/srpms/glibc/get', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/p5/glibc/get'\n assert_equal 'http://packages.altlinux.org/ru/Platform5/srpms/glibc/get', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch41/glibc/get'\n assert_equal 'http://packages.altlinux.org/ru/4.1/srpms/glibc/get', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch4/glibc/get'\n assert_equal 'http://packages.altlinux.org/ru/4.0/srpms/glibc/get', last_response.location\n assert_equal 301, last_response.status\n end",
"def beef_url_str\n \"#{beef_proto}://#{beef_host}:#{beef_port}\"\n end",
"def test_cert\n curl = Curl::Easy.new(TestServlet.url)\n curl.cert= File.join(File.dirname(__FILE__),\"cert.pem\")\n assert_match(/cert.pem$/,curl.cert)\n end",
"def sierra_856_perfect?\n @url == self.proper.proper_856_content\n end",
"def test_inexistent_local_name\n assert_equal(\"\", N::URI.new(\"http://somethingelse.com/\").local_name)\n end",
"def chorus_url\n /ju=(.*)&/.match(@openx_url)[1]\n end",
"def URI(url); end",
"def url\n if @resource.element\n @resource.uri.sub /\\{.*\\}/, @testcase.id.to_s\n else\n @resource.uri\n end\n end",
"def raw_url(file_name)\n fail('Requires implementation')\n end",
"def to_real_url(url, test_case = nil, &bl)\n case config.host\n when Proc\n config.host.call(url, test_case)\n when String\n url =~ /^http/ ? url : \"#{config.host}#{url}\"\n else\n return url if url =~ /^http/\n return yield(url) if block_given?\n raise \"Unable to resolve `#{url}` : no host resolver provided\\nSee `Configuration#host=\"\n end\n end",
"def resolved_uri; end",
"def url\n raise\n end",
"def invalid_url?(url)\n url.include? 'hurl.it'\n end",
"def load_url_spec\n path = self.class.spec_path\n specs = []\n Dir.new(path).entries.sort.each do |dir_entry|\n specs.push *YAML.load_file(path+dir_entry) if load_spec?( dir_entry )\n end\n @spec = Testcase.expand_specs(specs, @configuration)\n end",
"def url_has_a_dot_in?\n (external_resource_url =~ /\\./ )\n end",
"def get_test_url(version, suite, num, suffix = nil)\n suffix ||= case suite\n when /xhtml/ then \"xhtml\"\n when /html/ then \"html\"\n when /svg/ then \"svg\"\n else \"xml\"\n end\n\n url(\"/test-suite/test-cases/#{version}/#{suite}/#{num}.#{suffix}\").\n sub(/localhost:\\d+/, HOSTNAME) # For local testing\n end",
"def test_match\n reg = RustRegexp.new(\"(https?://[^/]+)[-a-zA-Z0-9./]+\")\n assert_false reg.match(\"http://masamitsu-murase.12345/hoge.html\").nil?\n assert_nil reg.match(\"http:///masamitsu-murase.12345/hoge.html\")\n end",
"def test_allow_colons_in_path_component\n assert_sanitized \"<a href=\\\"./this:that\\\">foo</a>\"\n end",
"def test_allow_colons_in_path_component\n assert_sanitized(\"<a href=\\\"./this:that\\\">foo</a>\")\n end",
"def FIXME_test_should_raise_exception_if_we_get_bogus_certificate_in_api_response\n CONFIG[\"experian\"][\"host\"] = \"www.experian.com\"\n CONFIG[\"experian\"][\"path\"] = \"/lookupServlet1?lookupServiceName=AccessPoint&lookupServiceVersion=1.0&serviceName=NetConnect&serviceVersion=0.2&responseType=text/plain\"\n EXPERIAN[:accept_responses] = true\n \n user = User.new(\n :first_name => \"Lorna\",\n :last_name => \"Rodriguez-Medina\",\n :ssn => \"897781853\",\n :phone => \"9035452514\",\n :address1 => \"2510 JO LYN LN\",\n :city => \"ARLINGTON\",\n :state_province => \"TX\",\n :postal_code => \"76014\",\n :dob => Date.new(1933,1,1))\n\n assert_raise InvalidExperianUrl do\n experian = Experian::Service.new(user)\n experian.check_user\n end\n end",
"def validate_url\r\n url = @hostname\r\n #puts \"DEBUG: url: \" + url\r\n \r\n url_part = []\r\n url_parts = url.split('.') \r\n #puts \"DEBUG: url_parts[0]: \" + url_parts[0]\r\n \r\n if url_parts[0].is_a? Numeric \r\n validate_sub_url(url_parts[0])\r\n validate_sub_url(url_parts[1])\r\n validate_sub_url(url_parts[2])\r\n validate_sub_url(url_parts[3])\r\n else # letters\r\n #puts \"URL just letters\"\r\n end\r\n ping_url\r\n end",
"def test_valid_nonlocal_uris\n [\n ['file://example.com/Share/dir/file.ext', 'example.com', '/Share/dir/file.ext', '\\\\\\\\example.com\\\\Share\\\\dir\\\\file.ext'],\n ['file://example.com/Share/dir/file.ext', 'example.com', '/Share/dir/file.ext', '\\\\\\\\example.com\\\\Share\\\\dir\\\\file.ext'],\n ].each do |str, host, path, unc|\n uri = URI.parse(str)\n assert_kind_of( URI::FileCommon, uri )\n assert_equal( path, uri.path )\n assert_equal( host, uri.host )\n\n assert_equal( false, uri.local?(localhost: false) )\n assert_equal( false, uri.local?(localhost: true) )\n assert_equal( false, uri.local? )\n assert_equal( true, uri.local?(localhost: :any) )\n\n assert_raise(RuntimeError) { uri.to_file_path(localhost: false) }\n assert_raise(RuntimeError) { uri.to_file_path(localhost: true) }\n assert_raise(RuntimeError) { uri.to_file_path }\n assert_equal( path, uri.to_file_path(localhost: :any) )\n\n assert_equal( unc, uri.to_unc(localhost: false) )\n assert_equal( unc, uri.to_unc(localhost: true) )\n assert_equal( unc, uri.to_unc )\n assert_raise(RuntimeError) { uri.to_unc(localhost: :any) }\n end\n end",
"def long_url_with_protocol\n if self.long_url[0..7]=='https://' or self.long_url[0..6]=='http://'\n return self.long_url\n else\n return 'https://'+ self.long_url\n end\n end",
"def url(name)\n compliance_data.dig(:information_urls, name)\n end",
"def web_url(filename, version=nil)\n fail NotImplementedError\n end",
"def test_srpm_spec_url_with_locale\n ['en', 'ru', 'br'].each do |locale|\n get \"/#{locale}/srpm/Sisyphus/glibc/spec\"\n assert_equal \"http://packages.altlinux.org/#{locale}/Sisyphus/srpms/glibc/spec\", last_response.location\n assert_equal 301, last_response.status\n\n get \"/#{locale}/srpm/Branch51/glibc/spec\"\n assert_equal \"http://packages.altlinux.org/#{locale}/5.1/srpms/glibc/spec\", last_response.location\n assert_equal 301, last_response.status\n\n get \"/#{locale}/srpm/p5/glibc/spec\"\n assert_equal \"http://packages.altlinux.org/#{locale}/Platform5/srpms/glibc/spec\", last_response.location\n assert_equal 301, last_response.status\n\n get \"/#{locale}/srpm/Branch41/glibc/spec\"\n assert_equal \"http://packages.altlinux.org/#{locale}/4.1/srpms/glibc/spec\", last_response.location\n assert_equal 301, last_response.status\n\n get \"/#{locale}/srpm/Branch4/glibc/spec\"\n assert_equal \"http://packages.altlinux.org/#{locale}/4.0/srpms/glibc/spec\", last_response.location\n assert_equal 301, last_response.status\n end\n end",
"def test_to_s\n GIT_URLS.each do |url_data|\n url = url_data[:url]\n to_s = Git::URL.parse(url).to_s\n assert_equal(url, to_s, \"Parsed URI#to_s does not return the original URL '#{url}' correctly\")\n end\n end",
"def surl(service)\n service_url = @env == :stable ? API_URL : SANDBOX_API_URL\n service_url = service_url + \"/\" + service\n service_url.gsub!('www', 'usercontent') if service.to_s == 'image'\n service_url\n end",
"def test_server_to_refuse_invalid_path\n %w[` > < |].each do |char|\n @payload[:path] = char\n response = api.create_endpoint(**@payload)\n\n assert(response.success?)\n assert_equal(422, response.status_code)\n end\n end",
"def fix_hostname_in_response_url\n self.padlet_url.gsub!(/.*padlet\\.com/, \"http://#{PadletWrapper.hostname}\")\n end",
"def get(url)\n begin\n uri = URI.parse(url.strip)\n rescue URI::InvalidURIError\n uri = URI.parse(URI.escape(url.strip))\n end\n\n # simple hack to read in fixtures instead of url for tests\n fixture = \"#{File.dirname(__FILE__)}/../fixtures#{uri.path}\"\n File.read(fixture) if File.exist?(fixture)\n end",
"def test_absolute_uri_uri_parse\n \"#{URI::REGEXP::PATTERN::UNRESERVED};:&=+$,\".split(//).each do |char|\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://#{char}@example.com/ HTTP/1.0\\r\\n\\r\\n\"\n assert_equal req, parser.headers(req, http)\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/', req['REQUEST_URI']\n assert_equal '/', req['REQUEST_PATH']\n assert_equal '', req['QUERY_STRING']\n\n assert_equal 'example.com', req['HTTP_HOST']\n assert_equal 'example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", http\n assert ! parser.keepalive?\n end\n end",
"def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end",
"def clean_url\n return # Not yet implemented\n end",
"def human_url\n return data()['project_uri']\n end",
"def resolve_url url_array\n url_array.each do |url_str|\n url = URI.parse(url_str)\n req = Net::HTTP.new(url.host, url.port)\n\n begin\n Timeout.timeout(5) do\n res = req.request_head(url.path)\n\n if res.code == \"200\"\n return url_str\n end\n end\n rescue Timeout::Error\n puts \"URL #{url_str} did not respond in 5 seconds.\"\n next\n end\n end\n return \"\"\nend",
"def url() read_attribute_w_fallbacks( :url, :auto_url ); end",
"def test_it_communicates_only_with_the_HubSpot_API\n expected = 'https://forms.hubspot.com/uploads/form/v2/'\n assert_equal expected, Hubspotter::Contact::BASE_URI\n end",
"def sanatize_url(url)\n uri = URI.parse(url);\n cleaned_url = \"https://\" + uri.host + uri.path\n end",
"def ssl_url( url )\n if url =~ /^https:.*/\n url\n else\n if url =~ /http:\\/\\/.+zz.s3.amazonaws.com.*$/\n url.match(/^http:\\/\\/(.*).s3.amazonaws.com(.*)$/)\n \"//s3.amazonaws.com/#{$1}#{$2}\"\n else\n url.gsub(/^http:/,'https:')\n end\n end\n end",
"def cover_fetcher\n if ENV['CI']\n File.open('./spec/factories/images/crysis.jpg')\n else\n # TODO: Make the dimensions more random.\n URI.open(\"#{Faker::LoremPixel.image(size: '560x800', is_gray: false)}/\")\n end\nend",
"def spec_with_url(url, spec_name = nil)\n name = url.split('/').last\n name = name.chomp('.git') if name.end_with?('.git')\n name = spec_name unless spec_name.nil?\n\n target_dir = TRY_TMP_DIR + name\n target_dir.rmtree if target_dir.exist?\n\n downloader = Pod::Downloader.for_target(target_dir, :git => url)\n downloader.download\n\n spec_file = Pathname.glob(target_dir + \"#{name}.podspec{,.json}\").first\n Pod::Specification.from_file(spec_file)\n end",
"def build_url(url)\n # this will remove any of the blank spaces. There is no reason for blank space in the url or brake lines\n url = url.gsub(\" \", \"\").gsub(/\\n/, \"\").gsub(/\\r/, \"\")\n \n \n # Step one tells me that the uri does have a http or a https to use\n one = url.slice(/(https|http)/)\n if one.nil?\n request_response = \"http://\"\n uri_split = url.split(\".\")\n else\n request_response = url.split(\"//\")[0] + \"//\"\n uri_split = url.split(\"//\")[1].split(\".\")\n end\n \n # Step two and three check for the .com and www at the begging. \n # The count is to make sure that is it missing something and not just taking the place of a sub domain.\n if uri_split.count <= 2\n two = url.slice(/(com|gov|org|net|mobi)/)\n three = url.slice(/(www)/)\n # don't add if the thing is there\n if three.nil?\n uri_split.unshift(\"www\")\n end\n if two.nil?\n uri_split << \"com\"\n end\n end\n path_seperator = uri_split[uri_split.length - 1].split(/\\//)\n if path_seperator && path_seperator.length <= 1\n uri_split[uri_split.length - 1] = path_seperator\n end\n string = uri_split.map{ |split| split }.join(\".\").to_s\n # I can't figure this part out but it sucks\n path_thing = string.split(/\\//) \n unless url.blank?\n url = request_response + string\n end\n end",
"def test_nonascii_suburls_download\n @wayback_machine_downloader = WaybackMachineDownloader.new(\n base_url: 'https://en.wikipedia.org/wiki/%C3%84')\n # Once just for the downloading...\n @wayback_machine_downloader.download_files\n end",
"def proper_url? \n\t\tif !(self.long_url.start_with?('http://') || self.long_url.start_with?('https://'))\n\t\t\terrors.add(:long_url, \"is in invalid format.\")\n\t\tend \n\tend",
"def test_url_path\n invoice = Factory(:invoice)\n invoice.path = \"#{RAILS_ROOT}//public/invoices/myinvoice.pdf\"\n \n assert_equal( \"/invoices/myinvoice.pdf\", invoice.url_path )\n end",
"def assert_url\n begin\n URI.parse(url)\n return true\n rescue URI::InvalidURIError => e\n errors.add(\"url\", \"has invalid format\")\n return false\n end\n end",
"def initial_url\n options.fetch(:url) { \"https://#{FaaInfo.domain}/\" }\n end",
"def long_url_with_explicit_protocol\n URI.parse(long_url).instance_of?(URI::Generic) ? \"http://#{long_url}\" : long_url\n end",
"def get_response_url\n\tdoc = Nokogiri::HTML(open(lease_break_url))\nend",
"def uri_host; end",
"def test_https_required\n RestClient.post url, {} if URI(url).scheme == 'http'\n true\n rescue => e\n case e.message\n when /406/\n true\n else\n raise e\n end\n end",
"def assert_authrep_url_with_params(str, protocol = 'http')\n authrep_url = \"#{protocol}://#{@host}/transactions/authrep.xml?provider_key=#{@client.provider_key}\"\n params = str # unless str.scan(/log/)\n params << \"&%5Busage%5D%5Bhits%5D=1\" unless params.scan(/usage.*hits/)\n parsed_authrep_url = URI.parse(authrep_url + params)\n # set to have the client working\n body = '<status>\n <authorized>true</authorized>\n <plan>Ultimate</plan>\n </status>'\n\n # this is the actual assertion, if fakeweb raises the client is submiting with wrong params\n FakeWeb.register_uri(:get, parsed_authrep_url, :status => ['200', 'OK'], :body => body)\n end",
"def assert_authrep_url_with_params(str, protocol = 'http')\n authrep_url = \"#{protocol}://#{@host}/transactions/authrep.xml?provider_key=#{@client.provider_key}\"\n params = str # unless str.scan(/log/)\n params << \"&%5Busage%5D%5Bhits%5D=1\" unless params.scan(/usage.*hits/)\n parsed_authrep_url = URI.parse(authrep_url + params)\n # set to have the client working\n body = '<status>\n <authorized>true</authorized>\n <plan>Ultimate</plan>\n </status>'\n\n # this is the actual assertion, if fakeweb raises the client is submiting with wrong params\n FakeWeb.register_uri(:get, parsed_authrep_url, :status => ['200', 'OK'], :body => body)\n end",
"def cert_path; end",
"def cert_path; end",
"def test_valid_localhost_uris\n [\n ['file://localhost/path/to/file', '/path/to/file', '\\\\\\\\localhost\\\\path\\\\to\\\\file'],\n ].each do |str, path, unc|\n uri = URI.parse(str)\n assert_kind_of( URI::FileCommon, uri )\n assert_equal( path, uri.path )\n\n assert_equal( false, uri.local?(localhost: false) )\n assert_equal( true, uri.local?(localhost: true) )\n assert_equal( true, uri.local? )\n assert_equal( true, uri.local?(localhost: :any) )\n\n assert_raise(RuntimeError) { uri.to_file_path(localhost: false) }\n assert_equal( path, uri.to_file_path(localhost: true) )\n assert_equal( path, uri.to_file_path )\n assert_equal( path, uri.to_file_path(localhost: :any) )\n\n assert_equal( unc, uri.to_unc(localhost: false) )\n assert_raise(RuntimeError) { uri.to_unc(localhost: true) }\n assert_raise(RuntimeError) { uri.to_unc }\n assert_raise(RuntimeError) { uri.to_unc(localhost: :any) }\n end\n end",
"def test_ca_cert\n curl = Curl::Easy.new(TestServlet.url)\n curl.cacert= File.join(File.dirname(__FILE__),\"cacert.pem\")\n assert_match(/cacert.pem$/, curl.cacert)\n end",
"def test_srpm_changelog_url\n get '/srpm/Sisyphus/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/Sisyphus/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch51/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/5.1/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/p5/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/Platform5/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch41/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/4.1/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch4/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/4.0/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n end",
"def convert_to_valid(url)\n return nil if url =~ /.jpg$/i\n url.insert(0, @main_url.first(5)) if url.start_with? '//'\n link = URI(url)\n main_page = URI(@main_url)\n if link && link.scheme && link.scheme.empty?\n link.scheme = main_page.scheme\n elsif link.nil?\n return nil\n end\n if link.scheme =~ /^http/\n request = link.to_s\n else\n request = nil\n end\n request\n rescue\n link\n end",
"def main_url(secure)\n url = \"http#{secure ? \"s\" : \"\"}://#{secure ? \"book.\" : \"\"}\"\n url += (Configuration.hostname ||= \"api.ean.com\") + \"/ean-services/rs/hotel/v3/\"\n url\n end",
"def shorten_url(url)\n res = http_post(\"http://crash.io\", :url => url)\n if res.status == 201\n res.headers['location']\n else\n url\n end\n rescue TimeoutError\n url\n end",
"def stub_request_with_address(address, body = nil)\n #filename = \"#{address.gsub(/\\s/, '_')}.json\"\n #filename = File.read \"test/fixtures/#{filename}\"\n # Webmock shows URLs with '%20' standing for space, but uri_encode susbtitutes with '+'\n # So let's fix\n #addr_in_uri = address.uri_encode.gsub(/\\+/, \"%20\")\n # Stub request, which URL matches Regex\n #stub_request(:get, /http:\\/\\/maps.googleapis.com\\/maps\\/api\\/geocode\\/json\\?address=#{addr_in_uri}/).\n # to_return(status => 200, :body => body || filename, :headers => {})\nend",
"def consume_url; end",
"def verify_pcgw_url(pcgw_id)\n url = URI.parse(\"https://pcgamingwiki.com/wiki/#{pcgw_id}\")\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.code == \"200\"\n return true\n elsif res.code == \"404\"\n return false\n else\n return false\n end\nend",
"def verify_url!\n fail InvalidUrlException unless uri.to_s =~ URI::regexp\n fail UnsupportedFileException if !valid_readers_format? && !valid_file_format?\n end",
"def url\n Faker::Internet.url\n end",
"def url\n Faker::Internet.url\n end",
"def test_url_from_environment\n pool_config = resolve_db_config :production, \"production\" => \"abstract://foo?encoding=utf8\"\n\n assert_equal({\n adapter: \"abstract\",\n host: \"foo\",\n encoding: \"utf8\"\n }, pool_config.configuration_hash)\n end"
] | [
"0.62057793",
"0.61017436",
"0.6044438",
"0.5995589",
"0.5995589",
"0.5980684",
"0.5884771",
"0.5880114",
"0.5871856",
"0.5869041",
"0.5832278",
"0.58309627",
"0.5753628",
"0.57271135",
"0.56682533",
"0.56628823",
"0.56373787",
"0.557301",
"0.55467206",
"0.5543499",
"0.5507955",
"0.54969144",
"0.54696417",
"0.5466649",
"0.5465772",
"0.5450517",
"0.5447766",
"0.5444632",
"0.5414023",
"0.54082036",
"0.5401378",
"0.5397308",
"0.53968686",
"0.5393063",
"0.53897303",
"0.53896075",
"0.53713536",
"0.5364719",
"0.53518856",
"0.535152",
"0.53482676",
"0.534506",
"0.5335796",
"0.5310394",
"0.5298011",
"0.5292596",
"0.5288705",
"0.5286887",
"0.52669555",
"0.52571267",
"0.5255666",
"0.52494454",
"0.52307165",
"0.52238464",
"0.5219644",
"0.5209597",
"0.5199007",
"0.5192767",
"0.5190065",
"0.516972",
"0.5164358",
"0.5159126",
"0.51579773",
"0.5154526",
"0.5153038",
"0.5152458",
"0.51501596",
"0.5147741",
"0.5136852",
"0.5129551",
"0.51284015",
"0.512741",
"0.51265967",
"0.5126031",
"0.5121156",
"0.51208687",
"0.5120066",
"0.51111776",
"0.51085705",
"0.5103663",
"0.509934",
"0.50932497",
"0.50922424",
"0.50896645",
"0.50896645",
"0.5087513",
"0.5087513",
"0.5082236",
"0.50749516",
"0.5074301",
"0.50678456",
"0.5064068",
"0.50570893",
"0.50485945",
"0.5048227",
"0.5043074",
"0.5041035",
"0.5036778",
"0.5036778",
"0.5034724"
] | 0.58757395 | 8 |
TODO: Review code below this line, it was pretty much a copy and paste from VirtualBox base driver and has no tests | def execute(*command, &block)
# Get the options hash if it exists
opts = {}
opts = command.pop if command.last.is_a?(Hash)
tries = 0
tries = 3 if opts[:retryable]
sleep = opts.fetch(:sleep, 1)
# Variable to store our execution result
r = nil
retryable(:on => LXC::Errors::ExecuteError, :tries => tries, :sleep => sleep) do
# Execute the command
r = raw(*command, &block)
# If the command was a failure, then raise an exception that is
# nicely handled by Vagrant.
if r.exit_code != 0
if @interrupted
@logger.info("Exit code != 0, but interrupted. Ignoring.")
else
raise LXC::Errors::ExecuteError, :command => command.inspect
end
end
end
# Return the output, making sure to replace any Windows-style
# newlines with Unix-style.
r.stdout.gsub("\r\n", "\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_vmware_vbox_vm(client_name)\n modify_vbox_vm(client_name,\"rtcuseutc\",\"on\")\n modify_vbox_vm(client_name,\"vtxvpid\",\"on\")\n modify_vbox_vm(client_name,\"vtxux\",\"on\")\n modify_vbox_vm(client_name,\"hwvirtex\",\"on\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVersion\",\"None\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardVendor\",\"Intel Corporation\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardProduct\",\"440BX Desktop Reference Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor\",\"VMware, Inc.\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct\",\"VMware Virtual Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor\",\"Phoenix Technologies LTD\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion\",\"6.0\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiChassisVendor\",\"No Enclosure\")\n vbox_vm_uuid = get_vbox_vm_uuid(client_name)\n vbox_vm_uuid = \"VMware-\"+vbox_vm_uuid\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial\",vbox_vm_uuid)\n return\nend",
"def configure_vs_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Linux_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def configure_ob_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Linux_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def make_proxmox_vm(vm)\n # * Disk: Use a SSD if possible. Preallocated might provide faster access.\n hd_file=@disk_folder+\"/#{vm}-HD.vdi\"\n\n # NOTE! Lots of code also available for inspiration in\n # /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/driver/version_4_3.rb\n\n\n unless(File.file?(@install_iso))\n raise \"ERROR - you need to download the ISO file at #{@install_iso} from https://www.proxmox.com/downloads\"\n end\n\n ide_storage_name=\"IDE Controller for #{vm}\"\n description = \"Proxmox-in-Virtualbox generated by https://github.com/mrjcleaver/proxmox-setup \\n\" + \\\n \"Generated \"+Time.now.to_s+ \" using \"+@install_iso\n\n # http://nakkaya.com/2012/08/30/create-manage-virtualBox-vms-from-the-command-line/\n # https://www.virtualbox.org/manual/ch08.html\n run_shell_cmd(\"VBoxManage createvm --name '#{vm}' --register\")\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --description '#{description}'\")\n # Note: Enabling the I/O APIC is required for 64-bit guest operating systems (page 48, manual)\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --memory '#{@ram_mb}' --acpi on --ioapic on --boot1 dvd --vram 12\")\n\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --ostype Debian --audio none\")\n\n run_shell_cmd(\"VBoxManage createhd --filename '#{hd_file}' --size '#{@hd_size_mb}' --variant Fixed\")\n run_shell_cmd(\"VBoxManage storagectl '#{vm}' --name '#{ide_storage_name}' --add ide\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 0 --device 0 --type hdd --medium '#{hd_file}' --nonrotational=#{@hd_on_ssd}\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 1 --device 0 --type dvddrive --medium '#{@install_iso}'\")\n\n run_shell_cmd(\"VBoxManage setextradata '#{vm}' GUI/MouseCapturePolicy Default\")\nend",
"def configure_vbox_vm(client_name,client_mac,client_os)\n check_vbox_is_installed()\n if $default_vm_network.match(/hostonly/)\n vbox_nic_name = check_vbox_hostonly_network()\n end\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n vbox_disk_name = vbox_vm_dir+\"/\"+client_name+\".vdi\"\n vbox_socket_name = \"/tmp/#{client_name}\"\n vbox_controller = get_vbox_controller()\n check_vbox_vm_doesnt_exist(client_name)\n register_vbox_vm(client_name,client_os)\n add_controller_to_vbox_vm(client_name,vbox_controller)\n create_vbox_hdd(client_name,vbox_disk_name)\n add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n add_memory_to_vbox_vm(client_name)\n vbox_socket_name = add_socket_to_vbox_vm(client_name)\n add_serial_to_vbox_vm(client_name)\n if $default_vm_network.match(/bridged/)\n vbox_nic_name = get_bridged_vbox_nic()\n add_bridged_network_to_vbox_vm(client_name,vbox_nic_name)\n else\n add_nonbridged_network_to_vbox_vm(client_name,vbox_nic_name)\n end\n set_vbox_vm_boot_priority(client_name)\n add_cdrom_to_vbox_vm(client_name)\n if client_mac.match(/[0-9]/)\n change_vbox_vm_mac(client_name,client_mac)\n else\n client_mac = get_vbox_vm_mac(client_name)\n end\n if $client_os == \"ESXi\"\n configure_vmware_esxi_vbox_vm(client_name)\n end\n puts \"Created:\\tVirtualBox VM \"+client_name+\" with MAC address \"+client_mac\n return\nend",
"def configure_virtualbox(host,vmcfg)\n host.vm.provider \"virtualbox\" do |pcfg|\n pcfg.memory = vmcfg['vm']['memory'] if vmcfg['vm']['memory']\n pcfg.customize [\"modifyvm\", :id, \"--cpus\", vmcfg['vm']['cpu']] if vmcfg['vm']['cpu'] \n end\nend",
"def configure_nb_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"NetBSD\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def configure_ps_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Ubuntu\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def ubuntu_box(config, version)\n config.vm.box = \"opscode-ubuntu-#{version}\" \n config.vm.box_url = \"http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-#{version}_chef-provisionerless.box\"\nend",
"def configure_ai_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os=\"Solaris11_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def setup\n java.lang.System.setProperty(\"vbox.home\", Travis::Worker.config.vms.vbox_home)\n\n require 'vboxjxpcom.jar'\n\n java_import 'org.virtualbox_4_1.VirtualBoxManager'\n java_import 'org.virtualbox_4_1.VBoxEventType'\n java_import 'org.virtualbox_4_1.LockType'\n java_import 'org.virtualbox_4_1.MachineState'\n java_import 'org.virtualbox_4_1.IMachineStateChangedEvent'\n java_import 'org.virtualbox_4_1.DeviceType'\n java_import 'org.virtualbox_4_1.AccessMode'\n java_import 'org.virtualbox_4_1.MediumType'\n java_import 'org.virtualbox_4_1.SessionState'\n end",
"def configure_ay_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"OpenSUSE\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def vboxchk(session)\n vm = false\n vboxprocs = [\n \"vboxservice.exe\",\n \"vboxtray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vboxprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\DSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"VBoxMouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxGuest\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxService\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxSF\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualBox\" },\n :update => :unique_data\n )\n print_good(\"This is a Sun VirtualBox Virtual Machine\")\n return \"VirtualBox\"\n end\n end",
"def populate_fusion_vm_vmx_info(client_name,client_mac,client_os)\n vmx_info = []\n vmx_info.push(\".encoding,UTF-8\")\n vmx_info.push(\"config.version,8\")\n vmx_info.push(\"virtualHW.version,10\")\n vmx_info.push(\"vcpu.hotadd,TRUE\")\n vmx_info.push(\"scsi0.present,TRUE\")\n if client_os.match(/windows7srv-64/)\n vmx_info.push(\"scsi0.virtualDev,lsisas1068\")\n else\n vmx_info.push(\"scsi0.virtualDev,lsilogic\")\n end\n vmx_info.push(\"sata0.present,TRUE\")\n vmx_info.push(\"memsize,#{$default_vm_mem}\")\n vmx_info.push(\"mem.hotadd,TRUE\")\n vmx_info.push(\"scsi0:0.present,TRUE\")\n vmx_info.push(\"scsi0:0.fileName,#{client_name}.vmdk\")\n vmx_info.push(\"sata0:1.present,FALSE\")\n vmx_info.push(\"floppy0.fileType,device\")\n vmx_info.push(\"floppy0.fileName,\")\n vmx_info.push(\"floppy0.clientDevice,FALSE\")\n vmx_info.push(\"ethernet0.present,TRUE\")\n vmx_info.push(\"ethernet0.connectionType,#{$default_vm_network}\")\n vmx_info.push(\"ethernet0.virtualDev,e1000\")\n vmx_info.push(\"ethernet0.wakeOnPcktRcv,FALSE\")\n vmx_info.push(\"ethernet0.addressType,static\")\n vmx_info.push(\"ethernet0.linkStatePropagation.enable,TRUE\")\n vmx_info.push(\"usb.present,TRUE\")\n vmx_info.push(\"ehci.present,TRUE\")\n vmx_info.push(\"ehci.pciSlotNumber,35\")\n vmx_info.push(\"sound.present,TRUE\")\n if client_os.match(/windows7srv-64/)\n vmx_info.push(\"sound.virtualDev,hdaudio\")\n end\n vmx_info.push(\"sound.fileName,-1\")\n vmx_info.push(\"sound.autodetect,TRUE\")\n vmx_info.push(\"mks.enable3d,TRUE\")\n vmx_info.push(\"pciBridge0.present,TRUE\")\n vmx_info.push(\"pciBridge4.present,TRUE\")\n vmx_info.push(\"pciBridge4.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge4.functions,8\")\n vmx_info.push(\"pciBridge5.present,TRUE\")\n vmx_info.push(\"pciBridge5.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge5.functions,8\")\n vmx_info.push(\"pciBridge6.present,TRUE\")\n vmx_info.push(\"pciBridge6.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge6.functions,8\")\n vmx_info.push(\"pciBridge7.present,TRUE\")\n vmx_info.push(\"pciBridge7.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge7.functions,8\")\n vmx_info.push(\"vmci0.present,TRUE\")\n vmx_info.push(\"hpet0.present,TRUE\")\n vmx_info.push(\"usb.vbluetooth.startConnected,TRUE\")\n vmx_info.push(\"tools.syncTime,TRUE\")\n vmx_info.push(\"displayName,#{client_name}\")\n vmx_info.push(\"guestOS,#{client_os}\")\n vmx_info.push(\"nvram,#{client_name}.nvram\")\n vmx_info.push(\"virtualHW.productCompatibility,hosted\")\n vmx_info.push(\"tools.upgrade.policy,upgradeAtPowerCycle\")\n vmx_info.push(\"powerType.powerOff,soft\")\n vmx_info.push(\"powerType.powerOn,soft\")\n vmx_info.push(\"powerType.suspend,soft\")\n vmx_info.push(\"powerType.reset,soft\")\n vmx_info.push(\"extendedConfigFile,#{client_name}.vmxf\")\n vmx_info.push(\"uuid.bios,56\")\n vmx_info.push(\"uuid.location,56\")\n vmx_info.push(\"replay.supported,FALSE\")\n vmx_info.push(\"replay.filename,\")\n vmx_info.push(\"pciBridge0.pciSlotNumber,17\")\n vmx_info.push(\"pciBridge4.pciSlotNumber,21\")\n vmx_info.push(\"pciBridge5.pciSlotNumber,22\")\n vmx_info.push(\"pciBridge6.pciSlotNumber,23\")\n vmx_info.push(\"pciBridge7.pciSlotNumber,24\")\n vmx_info.push(\"scsi0.pciSlotNumber,16\")\n vmx_info.push(\"usb.pciSlotNumber,32\")\n vmx_info.push(\"ethernet0.pciSlotNumber,33\")\n vmx_info.push(\"sound.pciSlotNumber,34\")\n vmx_info.push(\"vmci0.pciSlotNumber,36\")\n vmx_info.push(\"sata0.pciSlotNumber,37\")\n if client_os.match(/windows7srv-64/)\n vmx_info.push(\"scsi0.sasWWID,50 05 05 63 9c 8f c0 c0\")\n end\n vmx_info.push(\"ethernet0.generatedAddressOffset,0\")\n vmx_info.push(\"vmci0.id,-1176557972\")\n vmx_info.push(\"vmotion.checkpointFBSize,134217728\")\n vmx_info.push(\"cleanShutdown,TRUE\")\n vmx_info.push(\"softPowerOff,FALSE\")\n vmx_info.push(\"usb:1.speed,2\")\n vmx_info.push(\"usb:1.present,TRUE\")\n vmx_info.push(\"usb:1.deviceType,hub\")\n vmx_info.push(\"usb:1.port,1\")\n vmx_info.push(\"usb:1.parent,-1\")\n vmx_info.push(\"checkpoint.vmState,\")\n vmx_info.push(\"sata0:1.startConnected,FALSE\")\n vmx_info.push(\"usb:0.present,TRUE\")\n vmx_info.push(\"usb:0.deviceType,hid\")\n vmx_info.push(\"usb:0.port,0\")\n vmx_info.push(\"usb:0.parent,-1\")\n vmx_info.push(\"ethernet0.address,#{client_mac}\")\n vmx_info.push(\"floppy0.present,FALSE\")\n vmx_info.push(\"serial0.present,TRUE\")\n vmx_info.push(\"serial0.fileType,pipe\")\n vmx_info.push(\"serial0.yieldOnMsrRead,TRUE\")\n vmx_info.push(\"serial0.startConnected,TRUE\")\n vmx_info.push(\"serial0.fileName,/tmp/#{client_name}\")\n vmx_info.push(\"scsi0:0.redo,\")\n if client_os.match(/vmkernel/)\n vmx_info.push(\"monitor.virtual_mmu,hardware\")\n vmx_info.push(\"monitor.virtual_exec,hardware\")\n vmx_info.push(\"vhv.enable,TRUE\")\n vmx_info.push(\"monitor_control.restrict_backdoor,TRUE\")\n vmx_info.push(\"numvcpus,2\")\n end\n return vmx_info\nend",
"def configure_vmware_esxi_vbox_vm(client_name)\n configure_vmware_esxi_defaults()\n modify_vbox_vm(client_name,\"cpus\",$default_vm_vcpu)\n configure_vmware_vbox_vm(client_name)\n return\nend",
"def create_vbox_hdd(client_name,vbox_disk_name)\n message = \"Creating:\\tVM hard disk for \"+client_name\n command = \"VBoxManage createhd --filename \\\"#{vbox_disk_name}\\\" --size \\\"#{$default_vm_size}\\\"\"\n execute_command(message,command)\n return\nend",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def execute\n log.info 'Creating the Basic VM'\n placement_spec = VMPlacementHelper.get_placementspec_vm(service_manager.vapi_config, datacenter_name, folder_name, datastore_name)\n standard_network = NetworkHelper.get_standard_network_mapping(service_manager.vapi_config, @datacenter_name, standard_portgroup_name)\n boot_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('type' => VCENTER_HARDWARE_DISK_CLASS::HostBusAdapterType::SCSI,\n 'scsi' => VCENTER_HARDWARE_MODULE::ScsiAddressSpec.new('bus'=>0,'unit'=>0),\n 'new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new() )\n data_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new())\n ethernet_nic_0 = VCENTER_HARDWARE_ETHERNET_CLASS::CreateSpec.new('start_connected' => true,\n 'backing' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingSpec.new(\n 'type' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingType::STANDARD_PORTGROUP,\n 'network' => standard_network))\n boot_device_order = [VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::ETHERNET),\n VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::DISK)]\n vm_create_spec = VCENTER_VM_CLASS::CreateSpec.new('name' => vm_name,\n 'guest_OS' => VCENTER_VM_GUESTOS_CLASS::WINDOWS_8_64,\n 'placement' => placement_spec,\n 'disks' => [boot_disk, data_disk],\n 'nics' => [ethernet_nic_0],\n 'boot_devices' => boot_device_order)\n log.info 'The CreateVM Spec is '\n #Pretty print the create spec of the VM.\n pp vm_create_spec\n vm_id = vm_svc.create(vm_create_spec)\n log.info \"Created vm #{vm_name} with the VM Identifier #{vm_id}\"\n end",
"def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n # cpu & memory\n cpu = vm.get_cpu\n memory = vm.get_memory\n \n # nat port\n nat_map = vm.get_nat_map\n \n # list of interfaces\n interfaces = vm.get_interfaces\n bridged_interface = vm.get_bridged_interface\n \n # synced_folder\n synced_folders = vm.get_synced_folders\n \n # box info\n box_name = vm.box.name\n box_user = vm.box.user\n box_pass = vm.box.pass\n \n switch_type = vm.switch_type\n switch_ver = vm.switch_ver \n \n link_prefix=Link.instance.link_prefix\n \n interface_count = interfaces.length\n if bridged_interface != \"\"\n interface_count += 1\n end\n \n config.vm.define \"#{hostname}\" do |cfg|\n cfg.vm.box = box_name\n cfg.vm.boot_timeout = 90\n \n cfg.ssh.username = box_user\n cfg.ssh.password = box_pass\n \n for i in interfaces\n cfg.vm.network \"private_network\", auto_config: false, virtualbox__intnet: \"#{link_prefix}_switch_interface_#{i}\" \n end\n \n # bridged interface to have external network connectivity\n # VBoxManage list bridgedifs 로 확인 가능\n if bridged_interface != \"\"\n cfg.vm.network \"public_network\", auto_config: false, bridge: \"#{bridged_interface}\"\n end\n \n #if switch_type != \"\"\n # cfg.vm.provision :shell, :path => \"../common/install_#{switch_type}_#{switch_ver}.sh\"\n #end\n if File.exist?(\"init_node_#{hostname}.sh\")\n cfg.vm.provision :shell, :path => \"init_node_#{hostname}.sh\"\n end\n \n cfg.vm.provider \"virtualbox\" do |v|\n v.cpus = cpu\n v.memory = memory\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n \n # 스위칭에 이용하는 인터페이스에 대해서 promiscuous mode를 allow vms로 설정해줌\n for i in 2..(interface_count + 1)\n v.customize [\"modifyvm\", :id, \"--nicpromisc#{i}\", \"allow-all\"] \n end\n #v.gui = true\n end\n \n # nat_map = {1 => {\"ssh\" => 2222 }, 2 => {\"web\" => 2280}}\n # TODO: avoid port collision\n if (defined? nat_map)\n nat_map.each do |port_name, port_map| \n port_map.each do |guest_port, host_port|\n cfg.vm.network :forwarded_port, guest: guest_port, host: \"#{host_port}\", id: \"#{port_name}\" \n end\n end\n end\n \n if (defined? synced_folders)\n synced_folders.each do |host_folder, gst_folder|\n cfg.vm.synced_folder \"#{host_folder}\", \"#{gst_folder}\", disabled: false\n end\n end \n \n end\n end\nend",
"def check_vbox_hostonly_network()\n message = \"Checking:\\tVirtualBox hostonly network exists\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if !if_name.match(/vboxnet/)\n message = \"Plumbing:\\tVirtualBox hostonly network\"\n command = \"VBoxManage hostonlyif create\"\n execute_command(message,command)\n message = \"Finding:\\tVirtualBox hostonly network name\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if_name = if_name.gsub(/'/,\"\")\n message = \"Disabling:\\tDHCP on \"+if_name\n command = \"VBoxManage dhcpserver remove --ifname #{if_name}\"\n execute_command(message,command)\n end\n message = \"Checking:\\tVirtualBox hostonly network \"+if_name+\" has address \"+$default_hostonly_ip\n command = \"VBoxManage list hostonlyifs |grep 'IPAddress' |awk '{print $2}' |head -1\"\n host_ip = execute_command(message,command)\n host_ip = host_ip.chomp\n if !host_ip.match(/#{$default_hostonly_ip}/)\n message = \"Configuring:\\tVirtualBox hostonly network \"+if_name+\" with IP \"+$default_hostonly_ip\n command = \"VBoxManage hostonlyif ipconfig #{if_name} --ip #{$default_hostonly_ip} --netmask #{$default_netmask}\"\n execute_command(message,command)\n end\n gw_if_name = get_osx_gw_if_name()\n check_osx_nat(gw_if_name,if_name)\n return if_name\nend",
"def add_controller_to_vbox_vm(client_name,vbox_controller)\n message = \"Adding:\\t\\tController to VirtualBox VM\"\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"#{$vbox_disk_type}\\\" --add \\\"#{$vbox_disk_type}\\\" --controller \\\"#{vbox_controller}\\\"\"\n execute_command(message,command)\n return\nend",
"def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n # cpu & memory\n cpu = vm.get_cpu\n memory = vm.get_memory\n \n # nat port\n ssh_nat_port = vm.get_ssh_nat_port\n http_nat_port = vm.get_http_nat_port\n novnc_nat_port = vm.get_novnc_nat_port \n \n # list of interfaces\n interfaces = vm.get_interfaces\n bridged_interface = vm.get_bridged_interface\n \n # box info\n box_name = vm.box.name\n box_user = vm.box.user\n box_pass = vm.box.pass\n \n switch_type = vm.switch_type\n switch_ver = vm.switch_ver \n \n # IMPORTANT: use your own link_prefix to avoid duplication error with other vagrant instances\n link_prefix=File.basename(Dir.getwd)\n \n interface_count = interfaces.length\n if bridged_interface != \"\"\n interface_count += 1\n end\n \n config.vm.define \"#{hostname}\" do |cfg|\n cfg.vm.box = box_name\n cfg.vm.boot_timeout = 90\n \n cfg.ssh.username = box_user\n cfg.ssh.password = box_pass\n \n for i in interfaces\n cfg.vm.network \"private_network\", auto_config: false, virtualbox__intnet: \"#{link_prefix}_switch_interface_#{i}\" \n end\n \n # bridged interface to have external network connectivity\n if bridged_interface != \"\"\n cfg.vm.network \"public_network\", auto_config: false, bridge: \"#{bridged_interface}\"\n end\n \n #if switch_type != \"\"\n # cfg.vm.provision :shell, :path => \"../common/install_#{switch_type}_#{switch_ver}.sh\"\n #end\n \n if File.exist?(\"init_node_#{hostname}.sh\")\n cfg.vm.provision :shell, :path => \"init_node_#{hostname}.sh\"\n end\n \n cfg.vm.provider \"virtualbox\" do |v|\n v.cpus = cpu\n v.memory = memory\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n \n # 스위칭에 이용하는 인터페이스에 대해서 promiscuous mode를 allow vms로 설정해줌\n for i in 2..(interface_count + 1)\n v.customize [\"modifyvm\", :id, \"--nicpromisc#{i}\", \"allow-all\"] \n end\n v.gui = true\n end\n \n if ssh_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 22, host: \"#{ssh_nat_port}\", id: \"ssh\"\n end\n \n if http_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 80, host: \"#{http_nat_port}\", id: \"http\" \n end\n \n if novnc_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 6080, host: \"#{novnc_nat_port}\", id: \"novnc\" \n end\n \n cfg.vm.synced_folder \"../common\", \"/root/common\", disabled: false\n end\n end\nend",
"def define_driver\n { 'name' => 'solusvm',\n 'privileged' => 'true'\n }\n end",
"def virtualboxorafix(vb)\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/Leaf', '0x4']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/SubLeaf', '0x4']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/eax', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/ebx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/ecx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/edx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/SubLeafMask', '0xffffffff']\nend",
"def configure_vagrant_machine(hostname, vm, cpus, memory)\n is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\n\n vm.box = 'bento/ubuntu-16.04'\n vm.hostname = hostname\n\n vm.provider 'virtualbox' do |vb, override|\n # NAT settings so network isn't super slow\n override.vm.network :private_network, ip: \"192.168.100.50\"\n vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']\n vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']\n vb.cpus = cpus\n vb.memory = memory\n vb.name = \"vagrant-#{hostname}\"\n\n if is_windows\n override.vm.synced_folder \".\", \"/vagrant\", mount_options: [\"fmode=700\"]\n end\n end\n\n vm.provider 'parallels' do |prl, override|\n override.vm.network :private_network, ip: \"192.168.100.50\"\n prl.update_guest_tools = true\n prl.optimize_power_consumption = false\n prl.cpus = cpus\n prl.memory = memory\n prl.name = \"vagrant-#{hostname}\"\n end\nend",
"def configure_js_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"OpenSolaris_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def set_cpu_and_ram(vm_name, vm_config, cpu, ram) \n\n ram_in_gb = (ram / 1024.0)\n\n # round evertything that bigger that 1\n if ram_in_gb >= 1\n ram_in_gb = ram_in_gb.round\n end\n\n log_info_light(\"#{vm_name}: #{ram_in_gb}Gb RAM, #{cpu} CPU\")\n\n vm_config.vm.provider \"virtualbox\" do |v|\n \n v.linked_clone = false\n \n v.memory = ram\n v.cpus = cpu\n \n v.gui = false\n \n v.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] \n v.customize [\"modifyvm\", :id, \"--vram\", 32]\n\n v.customize [\"modifyvm\", :id, \"--audio\", \"none\"]\n v.customize [\"modifyvm\", :id, \"--usb\", \"off\"]\n \n # if Vagrant::VERSION >= '2.2.3'\n # # Vagrant has detected a configuration issue which exposes a vulnerability with the installed version of VirtualBox\n # # Ensure the guest is trusted to use this configuration or update the NIC type using one of the methods below:\n # # https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type\n \n # v.default_nic_type = \"82543GC\"\n # end\n\n # https://github.com/hashicorp/vagrant/issues/6812#issuecomment-171981576\n # Vagrant is reconnecting from scratch, sometimes literally before each command in negotiating loop\n v.customize ['modifyvm', :id, \"--natdnshostresolver1\", \"off\"]\n end\n \n # tracking only our own boxes\n # subpoint | uplift\n box_name = 'other'\n box_version = 'other'\n\n begin\n box_name = vm_config.vm.box()\n rescue => e\n box_name = 'not_set'\n end\n\n if( box_name.to_s.downcase.start_with?('subpoint') || box_name.to_s.downcase.start_with?('uplift') ) \n begin\n box_version = vm_config.vm.box_version()\n rescue => e\n box_version = 'not_set'\n end\n else \n box_name = 'other'\n box_version = 'other'\n end\n\n data = {\n 'vm_name': vm_name,\n 'cpus': cpu,\n 'memory': ram,\n 'box_name': box_name,\n 'box_version': box_version\n }\n\n _track_ai_event(__method__, data)\n end",
"def define_machine_name(config, name)\n config.vm.provider \"virtualbox\" do |v|\n v.name = name\n end\nend",
"def configure_vmware_fusion(host,vmcfg)\n host.vm.provider \"vmware_fusion\" do |pcfg|\n pcfg.vmx['memsize'] = vmcfg['vm']['memory'] if vmcfg['vm']['memory']\n pcfg.vmx['numvcpus'] = vmcfg['vm']['cpu'] if vmcfg['vm']['cpu']\n end\nend",
"def small(config)\n config.vm.provider \"virtualbox\" do |v|\n v.memory = 512 \n v.cpus = 1\n end\nend",
"def populate_fusion_vm_vmx_info(options)\n case options['os-type'].to_s\n when /vmware|esx|vsphere/\n if options['release'].to_s.match(/[0-9]/)\n if options['release'].to_s.match(/\\./)\n guest_os = \"vmkernel\"+options['release'].to_s.split(\".\")[0]\n else\n guest_os = \"vmkernel\"+options['release']\n end\n else\n guest_os = \"vmkernel7\"\n end\n else\n guest_os = options['os-type'].to_s\n end\n if options['uuid'] == options['empty'] or !options['uuid'].to_s.match(/[0-9]/)\n options['uuid'] = options['mac'].to_s.downcase.gsub(/\\:/,\" \")+\" 00 00-00 00 \"+options['mac'].to_s.downcase.gsub(/\\:/,\" \")\n end\n version = options['hwversion'].to_s\n version = version.to_i\n vmx_info = []\n vmx_info.push(\".encoding,UTF-8\")\n vmx_info.push(\"config.version,8\")\n if version > 6\n if version > 7\n if version >= 8\n if version >= 9\n if version >= 10\n if version >= 13 \n vmx_info.push(\"virtualHW.version,20\")\n options['hwversion'] = \"20\"\n else\n vmx_info.push(\"virtualHW.version,18\")\n options['hwversion'] = \"18\"\n end\n else\n vmx_info.push(\"virtualHW.version,16\")\n options['hwversion'] = \"16\"\n end\n else\n vmx_info.push(\"virtualHW.version,12\")\n options['hwversion'] = \"12\"\n end\n else\n vmx_info.push(\"virtualHW.version,11\")\n options['hwversion'] = \"11\"\n end\n end\n else\n vmx_info.push(\"virtualHW.version,10\")\n options['hwversion'] = \"10\"\n end\n vmx_info.push(\"vcpu.hotadd,FALSE\")\n vmx_info.push(\"scsi0.present,TRUE\")\n if options['service'].to_s.match(/el_8|vsphere|esx|vmware/) || options['os-type'].to_s.match(/vsphere|esx|vmware|el_6/)\n vmx_info.push(\"scsi0.virtualDev,pvscsi\")\n else\n if options['os-type'].to_s.match(/windows7srv-64/)\n vmx_info.push(\"scsi0.virtualDev,lsisas1068\")\n else\n vmx_info.push(\"scsi0.virtualDev,lsilogic\")\n end\n end\n if options['biostype'].to_s.match(/efi/)\n vmx_info.push(\"firmware,efi\")\n end\n vmx_info.push(\"scsi0:0.present,TRUE\")\n vmx_info.push(\"scsi0:0.fileName,#{options['name']}.vmdk\")\n vmx_info.push(\"memsize,#{options['memory']}\")\n vmx_info.push(\"mem.hotadd,FALSE\")\n if options['file'] != options['empty']\n vmx_info.push(\"ide0.present,TRUE\")\n vmx_info.push(\"ide0:0.present,TRUE\")\n vmx_info.push(\"ide0:0.deviceType,cdrom-image\")\n vmx_info.push(\"ide0:0.filename,#{options['file']}\")\n else\n #vmx_info.push(\"ide0:0.deviceType,none\")\n #vmx_info.push(\"ide0:0.filename,\")\n end\n vmx_info.push(\"ide0:0.startConnected,TRUE\")\n vmx_info.push(\"ide0:0.autodetect,TRUE\")\n# vmx_info.push(\"sata0:1.present,FALSE\")\n# vmx_info.push(\"floppy0.fileType,device\")\n# vmx_info.push(\"floppy0.fileName,\")\n# vmx_info.push(\"floppy0.clientDevice,FALSE\")\n vmx_info.push(\"ethernet0.present,TRUE\")\n vmx_info.push(\"ethernet0.noPromisc,FALSE\")\n vmx_info.push(\"ethernet0.connectionType,#{options['vmnetwork']}\")\n if options['os-type'].to_s.match(/vmware|esx|vsphere/)\n vmx_info.push(\"ethernet0.virtualDev,vmxnet3\")\n else\n vmx_info.push(\"ethernet0.virtualDev,e1000\")\n end\n vmx_info.push(\"ethernet0.wakeOnPcktRcv,FALSE\")\n if options['dhcp'] == false\n vmx_info.push(\"ethernet0.addressType,static\")\n else\n if options['service'].to_s.match(/vmware|vsphere|esx/)\n vmx_info.push(\"ethernet0.addressType,vpx\")\n else\n vmx_info.push(\"ethernet0.addressType,generated\")\n end\n end\n if !options['mac'] == options['empty']\n if options['dhcp'] == false\n vmx_info.push(\"ethernet0.address,#{options['mac']}\")\n else\n vmx_info.push(\"ethernet0.GeneratedAddress,#{options['mac']}\")\n end\n end\n vmx_info.push(\"ethernet0.linkStatePropagation.enable,TRUE\")\n# vmx_info.push(\"usb.present,TRUE\")\n if options['service'].to_s.match(/el_8|vsphere|esx|vmware/) || options['os-type'].to_s.match(/vsphere|esx|vmware|el_6/)\n vmx_info.push(\"ehci.present,TRUE\")\n vmx_info.push(\"ehci.pciSlotNumber,35\")\n end\n vmx_info.push(\"sound.present,TRUE\")\n if options['os-type'].to_s.match(/windows7srv-64/)\n vmx_info.push(\"sound.virtualDev,hdaudio\")\n end\n vmx_info.push(\"sound.fileName,-1\")\n vmx_info.push(\"sound.autodetect,TRUE\")\n vmx_info.push(\"mks.enable3d,TRUE\")\n vmx_info.push(\"pciBridge0.present,TRUE\")\n vmx_info.push(\"pciBridge4.present,TRUE\")\n vmx_info.push(\"pciBridge4.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge4.functions,8\")\n vmx_info.push(\"pciBridge5.present,TRUE\")\n vmx_info.push(\"pciBridge5.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge5.functions,8\")\n vmx_info.push(\"pciBridge6.present,TRUE\")\n vmx_info.push(\"pciBridge6.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge6.functions,8\")\n vmx_info.push(\"pciBridge7.present,TRUE\")\n vmx_info.push(\"pciBridge7.virtualDev,pcieRootPort\")\n vmx_info.push(\"pciBridge7.functions,8\")\n vmx_info.push(\"vmci0.present,TRUE\")\n vmx_info.push(\"hpet0.present,TRUE\")\n# vmx_info.push(\"usb.vbluetooth.startConnected,FALSE\")\n vmx_info.push(\"tools.syncTime,TRUE\")\n vmx_info.push(\"guestOS,#{guest_os}\")\n vmx_info.push(\"nvram,#{options['name']}.nvram\")\n vmx_info.push(\"virtualHW.productCompatibility,hosted\")\n vmx_info.push(\"tools.upgrade.policy,upgradeAtPowerCycle\")\n vmx_info.push(\"powerType.powerOff,soft\")\n vmx_info.push(\"powerType.powerOn,soft\")\n vmx_info.push(\"powerType.suspend,soft\")\n vmx_info.push(\"powerType.reset,soft\")\n vmx_info.push(\"displayName,#{options['name']}\")\n vmx_info.push(\"extendedConfigFile,#{options['name']}.vmxf\")\n vmx_info.push(\"uuid.bios,#{options['uuid']}\")\n vmx_info.push(\"uuid.location,#{options['uuid']}\")\n vmx_info.push(\"uuid.action,keep\")\n vmx_info.push(\"replay.supported,FALSE\")\n vmx_info.push(\"replay.filename,\")\n vmx_info.push(\"pciBridge0.pciSlotNumber,17\")\n vmx_info.push(\"pciBridge4.pciSlotNumber,21\")\n vmx_info.push(\"pciBridge5.pciSlotNumber,22\")\n vmx_info.push(\"pciBridge6.pciSlotNumber,23\")\n vmx_info.push(\"pciBridge7.pciSlotNumber,24\")\n vmx_info.push(\"scsi0.pciSlotNumber,16\")\n# vmx_info.push(\"usb.pciSlotNumber,32\")\n vmx_info.push(\"ethernet0.pciSlotNumber,33\")\n vmx_info.push(\"sound.pciSlotNumber,34\")\n vmx_info.push(\"vmci0.pciSlotNumber,36\")\n# if version >= 8\n# vmx_info.push(\"sata0.pciSlotNumber,-1\")\n# else\n# vmx_info.push(\"sata0.pciSlotNumber,37\")\n# end\n if options['os-type'].to_s.match(/windows7srv-64/)\n vmx_info.push(\"scsi0.sasWWID,50 05 05 63 9c 8f c0 c0\")\n end\n vmx_info.push(\"ethernet0.generatedAddressOffset,0\")\n# vmx_info.push(\"vmci0.id,-1176557972\")\n vmx_info.push(\"vmotion.checkpointFBSize,134217728\")\n vmx_info.push(\"cleanShutdown,TRUE\")\n vmx_info.push(\"softPowerOff,FALSE\")\n# vmx_info.push(\"usb:1.speed,2\")\n# vmx_info.push(\"usb:1.present,TRUE\")\n# vmx_info.push(\"usb:1.deviceType,hub\")\n# vmx_info.push(\"usb:1.port,1\")\n# vmx_info.push(\"usb:1.parent,-1\")\n vmx_info.push(\"checkpoint.vmState,\")\n# vmx_info.push(\"sata0:1.startConnected,FALSE\")\n# vmx_info.push(\"usb:0.present,TRUE\")\n# vmx_info.push(\"usb:0.deviceType,hid\")\n# vmx_info.push(\"usb:0.port,0\")\n# vmx_info.push(\"usb:0.parent,-1\")\n if options['dhcp'] == true\n vmx_info.push(\"ethernet0.GeneratedAddress,#{options['mac']}\")\n else\n vmx_info.push(\"ethernet0.address,#{options['mac']}\")\n end\n vmx_info.push(\"floppy0.present,FALSE\")\n vmx_info.push(\"serial0.present,TRUE\")\n vmx_info.push(\"serial0.fileType,pipe\")\n vmx_info.push(\"serial0.yieldOnMsrRead,TRUE\")\n vmx_info.push(\"serial0.startConnected,TRUE\")\n vmx_info.push(\"serial0.fileName,/tmp/#{options['name']}\")\n vmx_info.push(\"scsi0:0.redo,\")\n if options['os-type'].to_s.match(/vmkernel/)\n vmx_info.push(\"monitor.virtual_mmu,hardware\")\n vmx_info.push(\"monitor.virtual_exec,hardware\")\n vmx_info.push(\"vhv.enable,TRUE\")\n vmx_info.push(\"monitor_control.restrict_backdoor,TRUE\")\n end\n if options['vcpus'].to_i > 1\n vmx_info.push(\"numvcpus,#{options['vcpus']}\")\n end\n vmx_info.push(\"isolation.tools.hgfs.disable,FALSE\")\n vmx_info.push(\"hgfs.mapRootShare,TRUE\")\n vmx_info.push(\"hgfs.linkRootShare,TRUE\")\n if version >= 8\n vmx_info.push(\"acpi.smbiosVersion2.7,FALSE\")\n vmx_info.push(\"numa.autosize.vcpu.maxPerVirtualNode,2\")\n vmx_info.push(\"numa.autosize.cookie,10001\")\n vmx_info.push(\"migrate.hostlog,#{options['name']}-#{options['mac']}.hlog\")\n end\n if options['sharedfolder'].to_s.match(/[a-z,A-Z]/)\n vmx_info.push(\"sharedFolder0.present,TRUE\")\n vmx_info.push(\"sharedFolder0.enabled,TRUE\")\n vmx_info.push(\"sharedFolder0.readAccess,TRUE\")\n vmx_info.push(\"sharedFolder0.writeAccess,TRUE\")\n vmx_info.push(\"sharedFolder0.hostPath,#{options['sharedfolder']}\")\n vmx_info.push(\"sharedFolder0.guestName,#{options['sharedmount']}\")\n vmx_info.push(\"sharedFolder0.expiration,never\")\n vmx_info.push(\"sharedFolder.maxNum,1\")\n end\n if options['vnc'] == true\n vmx_info.push(\"RemoteDisplay.vnc.enabled,TRUE\")\n vmx_info.push(\"RemoteDisplay.vnc.port,5900\")\n vmx_info.push(\"RemoteDisplay.vnc.password,#{options['vncpassword']}\")\n# vmx_info.push(\"signal.suspendOnHUP=TRUE\" )\n# vmx_info.push(\"signal.powerOffOnTERM,TRUE\")\n end\n return options,vmx_info\nend",
"def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend",
"def test_lv_ops\n lvname = \"testlv_#{Time.now.to_i}\"\n bd = nil\n\n #\n # Test creating the LV\n #\n # vgroup does not exist\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('lkjwf99ex', lvname, 1024)\n bd.create\n end\n # invalid lv size\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 100000000024)\n bd.create\n end\n\n assert_nothing_raised do \n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 1024)\n bd.create\n end\n # device is formatted by default, check it\n if `blkid /dev/mapper/localvg-#{lvname}` !~ /TYPE=\"ext3\"/\n assert false\n end\n \n assert(bd.config_string == \"'phy:/dev/localvg/#{lvname},sda1,w'\")\n assert( File.exist? \"/dev/mapper/localvg-#{lvname}\")\n\n # lv already exists\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 1024)\n bd.create\n end\n\n\n #\n # Test formatting the LV\n #\n bd.format\n if `blkid /dev/mapper/localvg-#{lvname}` !~ /TYPE=\"ext3\"/\n assert false\n end\n \n #\n # Test mouting the LV\n #\n mdir = bd.mount\n assert(`mount | grep #{mdir}` =~ /#{mdir}/)\n assert_raises Exception do\n bd.mount\n end\n \n #\n # Test umounting the LV\n #\n bd.umount\n assert(`mount | grep #{mdir}`.strip.chomp.empty?)\n Dir.rmdir mdir\n\n #\n # Test deleting the LV\n #\n bd.delete\n assert( !File.exist?(\"/dev/mapper/localvg-#{lvname}\") )\n end",
"def add_cdrom_to_vbox_vm(client_name)\n message = \"Attaching:\\tCDROM to VM \"+client_name\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"cdrom\\\" --add \\\"sata\\\" --controller \\\"IntelAHCI\\\"\"\n execute_command(message,command)\n if File.exist?($vbox_additions_iso)\n message = \"Attaching:\\tISO \"+$vbox_additions_iso+\" to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"cdrom\\\" --port 0 --device 0 --type dvddrive --medium \\\"#{$vbox_additions_iso}\\\"\"\n execute_command(message,command)\n end\n return\nend",
"def add_serial_to_vbox_vm(client_name)\n message = \"Adding:\\t\\tSerial Port to \"+client_name\n command = \"VBoxManage modifyvm \\\"#{client_name}\\\" --uart1 0x3F8 4\"\n execute_command(message,command)\n return\nend",
"def clone_vm\n\n resource[:network_interfaces] = resource[:network_interfaces].reject do |n|\n n['portgroup']== 'VM Network'\n end\n\n vm_name = resource[:name]\n\n dc = vim.serviceInstance.find_datacenter(resource[:template_datacenter])\n template = findvm_by_name(dc.vmFolder, resource[:template]) or raise(Puppet::Error, \"Unable to find template #{resource[:template]}.\")\n template_cd_drive = template.config.hardware.device.select{ |d|d.deviceInfo.label.include?(\"CD/DVD\")}\n\n vm_devices=[]\n if resource[:network_interfaces]\n template_networks = template.config.hardware.device.collect{|x| x if x.class < RbVmomi::VIM::VirtualEthernetCard}.compact\n delete_network_specs = template_networks.collect do |nic|\n RbVmomi::VIM.VirtualDeviceConfigSpec(\n :device => nic,\n :operation => RbVmomi::VIM.VirtualDeviceConfigSpecOperation('remove')\n )\n end\n vm_devices.push(*delete_network_specs)\n vm_devices.push(*network_specs)\n vm_devices.push(*cdrom_spec) if template_cd_drive.empty?\n end\n\n config_spec = RbVmomi::VIM.VirtualMachineConfigSpec(\n :name => vm_name,\n :memoryMB => resource[:memory_mb],\n :numCPUs => resource[:num_cpus],\n :numCoresPerSocket => resource[:num_cpus],\n :deviceChange => vm_devices\n )\n\n if resource[:guest_custom_spec]\n # get the vm custom spec from the inventory\n specManager = vim.serviceContent.customizationSpecManager\n vm_custom_spec_name = resource[:guest_custom_spec]\n customization = specManager.GetCustomizationSpec(:name => vm_custom_spec_name)\n if customization.nil?\n raise(Puppet::Error, \"SpecManager could not find the guest customization spec, '#{vm_custom_spec_name}'\")\n end\n spec = RbVmomi::VIM.VirtualMachineCloneSpec(\n :location => relocate_spec,\n :powerOn => (resource[:power_state] == :poweredOn),\n :template => false,\n :customization => customization.spec,\n :config => config_spec\n )\n elsif resource[:guest_customization].to_s == 'true'\n Puppet.notice \"Customizing the guest OS.\"\n # Calling getguestcustomization_spec method in case guestcustomization\n # parameter is specified with value true\n network_interfaces = template.summary.config.numEthernetCards\n spec = RbVmomi::VIM.VirtualMachineCloneSpec(\n :location => relocate_spec,\n :powerOn => (resource[:power_state] == :poweredOn),\n :template => false,\n :customization => customization_spec(network_interfaces),\n :config => config_spec\n )\n else\n spec = RbVmomi::VIM.VirtualMachineCloneSpec(\n :location => relocate_spec,\n :powerOn => (resource[:power_state] == :poweredOn),\n :template => false,\n :config => config_spec\n )\n end\n\n template.CloneVM_Task(\n :folder => datacenter.vmFolder,\n :name => vm_name,\n :spec => spec\n ).wait_for_completion\n end",
"def virtualbox_version()\n vboxmanage = Vagrant::Util::Which.which(\"VBoxManage\") || Vagrant::Util::Which.which(\"VBoxManage.exe\")\n if vboxmanage != nil\n s = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')\n s = s.stdout.strip!\n s = s.split('_').first\n return s\n else\n return nil\n end\nend",
"def virtualbox_version()\n vboxmanage = Vagrant::Util::Which.which(\"VBoxManage\") || Vagrant::Util::Which.which(\"VBoxManage.exe\")\n if vboxmanage != nil\n s = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')\n s = s.stdout.strip!\n s = s.split('_').first\n return s\n else\n return nil\n end\nend",
"def list_ai_vbox_vms()\n search_string = \"sol.11\"\n list_vbox_vms(search_string)\n return\nend",
"def vcap_commands\n\nend",
"def virtualbox_version\n cmd = windows? ?\n '\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NUL' :\n 'VBoxManage -v 2>/dev/null'\n `#{cmd}`[/[\\d\\.]+/] rescue nil\nend",
"def get_console(vmid)\n\n begin\n vm_xml = REXML::Document.new( %x[onevm show #{vmid} -x] )\n rescue\n puts \"Cannot find VMID #{vmid}: is OpenNebula up?\"\n return nil\n end\n\n max_seq = -1;\n hyp_name = nil;\n vmm_mad = nil;\n\n vm_xml.elements.each('//VM/HISTORY_RECORDS/HISTORY') do |hist|\n\n seq = hist.elements['SEQ']\n if (seq)\n seq = seq.text.to_i\n else\n next\n end\n\n if (seq > max_seq)\n max_seq = seq\n hyp_name = hist.elements['HOSTNAME']\n vmm_mad = hist.elements['VMMMAD']\n if (hyp_name)\n hyp_name = hyp_name.text\n end\n if (vmm_mad)\n vmm_mad = vmm_mad.text\n vmm_mad = vmm_mad[4..vmm_mad.length-3]\n end\n end\n\n end\n\n if (hyp_name != nil)\n puts \"Connecting console of VMID #{vmid} from hypervisor #{hyp_name}...\"\n\n if (vmm_mad == 'xen')\n system(\"ssh #{hyp_name} -t xm console one-#{vmid}\")\n else\n system(\"ssh #{hyp_name} -t \" +\n \"virsh --connect qemu:///system console one-#{vmid}\")\n end\n\n return ($? >> 8)\n\n end\n\n # If we are here, no hypervisor has been found\n #puts \"No hypervisor currently associated to VMID #{vmid}.\"\n return -1\n\nend",
"def define_vm config, role, index, ip, memory = 512\n id = (index + 1).to_s.rjust(3, '0')\n config.vm.define \"#{role}_#{id}\" do |box|\n box.vm.customize [ \"modifyvm\", :id, \"--memory\", memory ]\n box.vm.box = \"centos_6_3\"\n box.vm.box_url = \"https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box\"\n box.vm.network :hostonly, \"192.168.34.#{ip}\", :netmask => \"255.255.255.0\"\n box.vm.host_name = \"#{role.downcase.gsub(/[^a-z0-9]+/, '-')}-#{id}.esi.dev\"\n #box.vm.provision :shell, :path => \"script/bootstrap-vm.sh\"\n box.vm.provision :puppet, :module_path => \"modules\" do |p|\n p.manifests_path = \"manifests\"\n p.manifest_file = \"site.pp\"\n end\n end\nend",
"def configure_ks_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n if client_arch.match(/i386/)\n client_os = \"RedHat\"\n else\n client_os = \"RedHat_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def add_memory_to_vbox_vm(client_name)\n message = \"Adding:\\t\\tMemory to VM \"+client_name\n command = \"VBoxManage modifyvm \\\"#{client_name}\\\" --memory \\\"#{$default_vm_mem}\\\"\"\n execute_command(message,command)\n return\nend",
"def connect_vbox_adapter(vm, adapter, type, address)\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --nictype1 virtio --nic1 #{type} --bridgeadapter1 '#{adapter}'\")\n end",
"def defineControlVM(control, vmName)\n\tcontrol.vm.hostname = vmName\n\tcontrol.vm.box = \"https://cloud-images.ubuntu.com/vagrant/utopic/%s/utopic-server-cloudimg-amd64-vagrant-disk1.box\" % $controlRequestImagePath\n\tcontrol.vm.network :private_network, ip: \"10.10.10.10\"\n\n\t# Forward our Docker registry port to the outside world.\n\tcontrol.vm.network \"forwarded_port\", guest: 5000, host: $controlDockerRegistryPort, auto_correct: true\n\n\t# Enabled serial logging if the user asked for it.\n\tsetUpSerialLogging vmName\n\n\t# Build the log directory where all internal control machines logs will go to.\n\tlogFile = setUpProvisionLogging vmName\n\n\t# Provision the machines.\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlBase.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlFiles.sh\", :privileged => false, :args => \"%s %s\" % [logFile, $coreInstances]\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlAnsible.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlDocker.sh\", :privileged => false, :args => \"%s\" % logFile\n\tcontrol.vm.provision :shell, :path => \"automation/vagrant/tasks/ProvisionControlRegistry.sh\", :privileged => false, :args => \"%s\" % logFile\nend",
"def attach_volumes(node, disk_sizes)\n if $provider == :virtualbox\n node.vm.provider :virtualbox do |v, override|\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(File.dirname(File.expand_path(__FILE__)), \".virtualbox\", \"#{node.vm.hostname}-#{disk_num}.vdi\")\n unless File.exist?(diskname)\n v.customize ['createhd', '--filename', diskname, '--size', disk_size * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_num, '--device', 0, '--type', 'hdd', '--medium', diskname]\n end\n end\n end\n\n if $provider == :vmware_fusion\n node.vm.provider :vmware_fusion do |v, override|\n vdiskmanager = '/Applications/VMware\\ Fusion.app/Contents/Library/vmware-vdiskmanager'\n unless File.exist?(vdiskmanager)\n dir = File.join(File.dirname(File.expand_path(__FILE__)), \".vmware\")\n unless File.directory?( dir )\n Dir.mkdir dir\n end\n\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(dir, \"#{node.vm.hostname}-#{disk_num}.vmdk\")\n unless File.exist?(diskname)\n `#{vdiskmanager} -c -s #{disk_size}GB -a lsilogic -t 1 #{diskname}`\n end\n\n v.vmx[\"scsi0:#{disk_num}.filename\"] = diskname\n v.vmx[\"scsi0:#{disk_num}.present\"] = 'TRUE'\n v.vmx[\"scsi0:#{disk_num}.redo\"] = ''\n end\n end\n end\n end\n\n if $provider == :parallels\n node.vm.provider :parallels do |v, override|\n disk_sizes.each do |disk_size|\n v.customize ['set', :id, '--device-add', 'hdd', '--size', disk_size * 1024]\n end\n end\n end\n\nend",
"def set_provider_config(vm_instance, ci_vm_definition)\n \n vm_instance.vm.provider :virtualbox do |vm|\n \n vm.linked_clone = ci_vm_definition[\"clone\"] || false\n \n vm.customize [\"modifyvm\", :id, \"--memory\", ci_vm_definition[\"memory\"] ]\n vm.customize [\"modifyvm\", :id, \"--cpus\", ci_vm_definition[\"cpu\"] ]\n\n vm.customize [\"modifyvm\", :id, \"--vram\", \"256\"]\n if ci_vm_definition[\"3d\"] == true then\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"on\"]\n else\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"off\"]\n end\n \n if ci_vm_definition[\"sound\"] == true then\n vm.customize [\"modifyvm\", :id, \"--audio\", \"null\", \"--audiocontroller\", \"hda\"]\n end\n \n vm.customize [\"modifyvm\", :id, \"--ioapic\", \"on\"]\n vm.customize [\"setextradata\", \"global\", \"GUI/SuppressMessages\", \"all\"]\n \n vm.gui = ci_vm_definition[\"gui\"] || true\n end\n \n vm_instance.vm.box = ci_vm_definition[\"box\"]\n \n end",
"def configure_vmware_vcenter_vbox_vm(client_name)\n configure_vmware_vcenter_defaults()\n configure_vmware_vbox_vm(client_name)\n return\nend",
"def get_virtualbox_version\n begin\n if windows?\n ver = `\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NULL`\n else\n ver = `VBoxManage -v 2>/dev/null`\n end\n rescue\n ver = ''\n end\n ver.gsub(/r.*/m, '')\nend",
"def register_vbox_vm(client_name,client_os)\n message = \"Registering:\\tVM \"+client_name\n command = \"VBoxManage createvm --name \\\"#{client_name}\\\" --ostype \\\"#{client_os}\\\" --register\"\n execute_command(message,command)\n return\nend",
"def create_vm\n if new_resource.clone\n clone_vm\n else\n data = {\n vmid: vmid,\n bootdisk: 'virtio0',\n cores: INSTANCE_SIZE[new_resource.size]['cpu'],\n memory: INSTANCE_SIZE[new_resource.size]['memory'],\n ide2: \"#{new_resource.cdrom},media=cdrom\",\n numa: (new_resource.numa ? 1 : 0),\n ostype: get_type(new_resource.ostype),\n sockets: 1,\n virtio0: \"#{new_resource.storage}:/vm-#{vmid}-disk-1.qcow2,size=#{new_resource.disk}\"\n }.merge(new_resource.net)\n data.merge(hugepages: new_resource.hugepages) if new_resource.hugepages\n api.post(\"/nodes/#{new_resource.host}/qemu\", data)\n end\nend",
"def check_vbox_vm_doesnt_exist(client_name)\n message = \"Checking:\\tVM \"+client_name+\" doesn't exist\"\n command = \"VBoxManage list vms\"\n host_list = execute_command(message,command)\n if host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM #{client_name} already exists\"\n exit\n end\n return\nend",
"def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend",
"def create_test_interface\n cmd_out = `VBoxManage hostonlyif create`\n network_description = cmd_out.match(/.*'(.*)'.*/).captures[0]\n `VBoxManage.exe hostonlyif ipconfig \\\"#{network_description}\\\" --ip #{TEST_IP}`\n sleep 3\n network_description\n end",
"def create_test_interface\n cmd_out = `VBoxManage hostonlyif create`\n network_description = cmd_out.match(/.*'(.*)'.*/).captures[0]\n `VBoxManage.exe hostonlyif ipconfig \\\"#{network_description}\\\" --ip #{TEST_IP}`\n sleep 3\n network_description\n end",
"def configure_vm(vm, **opts)\n\n vm.box = opts.fetch(:box, \"bento/ubuntu-16.04\")\n vm.network :private_network, ip: opts[:private_ip]\n\n vm.provider \"virtualbox\" do |vb|\n vb.memory = 4096\n vb.cpus = 2\n end\n \n # Disable default share, because we dont use it\n vm.synced_folder \".\", \"/vagrant\", disabled: true\nend",
"def resizeDisk(vm, disk_number, new_disk_size_in_kb)\n $evm.log(:info, \"Doing object_send\")\n\n vm.object_send('instance_eval', '\n def do_stuff(myevm, diskIndex, new_disk_size_in_kb)\n myevm.log(\"info\", \"VMware_HotResize_Disk - test\")\n devs = nil\n with_provider_object{ |vimVm| \n devs = vimVm.send(:getProp, \"config.hardware\")[\"config\"][\"hardware\"][\"device\"]\n myevm.log(\"info\", \"VMware_HotResize_Disk: #{devs.inspect}\")\n }\n matchedDev = nil\n currentDiskIndex = 0\n myevm.log(\"info\", \"VMWare_HotResize_Disk: looking for disk at index #{diskIndex}\")\n devs.each do | dev |\n myevm.log(\"info\", \"VMWare_HotResize_Disk: testing dev #{dev.xsiType} #{dev.inspect}\")\n next if dev.xsiType != \"VirtualDisk\"\n myevm.log(\"info\", \"VMWare_HotResize_Disk: disk #{dev.inspect}\")\n if diskIndex == currentDiskIndex\n matchedDev = dev\n break\n end\n currentDiskIndex += 1\n end\n \n myevm.log(\"info\", \"VMware_HotResize_Disk Matched Dev #{matchedDev.inspect}\")\n currentSizeKB = matchedDev[\"capacityInKB\"].to_i\n myevm.log(\"info\", \"VMware_HotResize_Disk: Current Size #{currentSizeKB}\")\n myevm.log(\"info\", \"VMware_HotResize_Disk: Requested Size #{new_disk_size_in_kb}\")\n raise \"resizeDisk: disk #{diskIndex} not found\" unless matchedDev\n raise \"cannot shrink disk #{matchedDev} to #{new_disk_size_in_kb}\" if currentSizeKB > new_disk_size_in_kb.to_i\n\n vmConfigSpec = VimHash.new(\"VirtualMachineConfigSpec\") do |vmcs|\n vmcs.deviceChange = VimArray.new(\"ArrayOfVirtualDeviceConfigSpec\") do |vmcs_vca|\n vmcs_vca << VimHash.new(\"VirtualDeviceConfigSpec\") do |vdcs|\n vdcs.operation = \"edit\".freeze\n vdcs.device = VimHash.new(\"VirtualDisk\") do |vDev|\n vDev.key = matchedDev[\"key\"]\n vDev.controllerKey = matchedDev[\"controllerKey\"]\n vDev.unitNumber = matchedDev[\"unitNumber\"]\n vDev.backing = matchedDev[\"backing\"]\n vDev.capacityInKB = new_disk_size_in_kb\n end\n end\n end\n end\n myevm.log(\"info\", \"VMware_HotResize_Disk #{vmConfigSpec.inspect}\")\n with_provider_object {|vimVm| vimVm.send(:reconfig, vmConfigSpec) }\n myevm.log(\"info\", \"VMware_HotResize_Disk Sent Reconfigure Successfully\")\n end')\n begin\n vm.object_send('do_stuff', $evm, disk_number, new_disk_size_in_kb)\n rescue => myerr\n $evm.log(:error, \"Error occurred communicating with vSphere API: #{myerr.class} #{myerr} #{myerr.backtrace.join(\"\\n\")}\")\n exit MIQ_STOP\n end\nend",
"def change_vbox_vm_mac(client_name,client_mac)\n message = \"Setting:\\tVirtualBox VM \"+client_name+\" MAC address to \"+client_mac\n if client_mac.match(/:/)\n client_mac = client_mac.gsub(/:/,\"\")\n end\n command = \"VBoxManage modifyvm #{client_name} --macaddress1 #{client_mac}\"\n execute_command(message,command)\n return\nend",
"def wait_for_guestcontrol\n until boot_complete? do\n print \"Waiting for #{@vbox_name} to be available for guestcontrol...\\n\" if @verbose\n sleep 3\n end\n end",
"def configure_vs_pxe_client(options)\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_boot_file = \"boot.cfg.01\"+tftp_pxe_file\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = options['tftpdir']+\"/\"+tftp_pxe_file\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere TFTP directory\")\n end\n check_dir_exists(options,options['tftpdir'])\n check_dir_owner(options,options['tftpdir'],options['uid'])\n if !File.exist?(test_file)\n message = \"Information:\\tCreating PXE boot file for \"+options['name']+\" with MAC address \"+options['mac']\n if options['biostype'].to_s.match(/efi/)\n efi_boot_file = options['service'].to_s+\"/efi/boot/bootx64.efi\"\n command = \"cd #{options['tftpdir']} ; ln -s #{efi_boot_file} #{tftp_pxe_file}\"\n else\n pxelinux_file = options['service']+\"/usr/share/syslinux/pxelinux.0\"\n command = \"cd #{options['tftpdir']} ; ln -s #{pxelinux_file} #{tftp_pxe_file}\"\n end\n execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere PXE configuration directory\")\n end\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n ks_url = \"http://\"+options['hostip']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n #ks_url = \"http://\"+options['hostip']+\"/clients/\"+options['service']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n mboot_file = options['service']+\"/mboot.c32\"\n if options['biostype'].to_s.match(/efi/)\n pxe_cfg_dir = options['tftpdir'].to_s+\"/\"+options['mac'].gsub(/:/,\"-\")\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n else\n pxe_cfg_file1 = options['mac'].to_s.gsub(/:/,\"-\")\n pxe_cfg_file1 = \"01-\"+pxe_cfg_file1\n pxe_cfg_file1 = pxe_cfg_file1.downcase\n pxe_cfg_file1 = pxe_cfg_dir+\"/\"+pxe_cfg_file1\n pxe_cfg_file2 = options['mac'].split(\":\")[0..3].join+\"-\"+options['mac'].split(\":\")[4..5].join+\"-0000-0000-\"+options['mac'].gsub(/\\:/,\"\")\n pxe_cfg_file2 = pxe_cfg_file2.downcase\n pxe_cfg_file2 = pxe_cfg_dir+\"/\"+pxe_cfg_file2\n for pxe_cfg_file in [ pxe_cfg_file1, pxe_cfg_file2 ]\n verbose_output(options,\"Information:\\tCreating Menu config file #{pxe_cfg_file}\")\n file = File.open(pxe_cfg_file,\"w\")\n if options['serial'] == true\n file.write(\"serial 0 115200\\n\")\n end\n file.write(\"DEFAULT ESX\\n\")\n file.write(\"LABEL ESX\\n\")\n file.write(\"KERNEL #{mboot_file}\\n\")\n if options['text'] == true\n if options['serial'] == true\n file.write(\"APPEND -c #{tftp_boot_file} text gdbPort=none logPort=none tty2Port=com1 ks=#{ks_url} +++\\n\")\n else\n file.write(\"APPEND -c #{tftp_boot_file} text ks=#{ks_url} +++\\n\")\n end\n else\n file.write(\"APPEND -c #{tftp_boot_file} ks=#{ks_url} +++\\n\")\n end\n file.write(\"IPAPPEND 1\\n\")\n file.close\n print_contents_of_file(options,\"\",pxe_cfg_file)\n end\n end\n if options['biostype'].to_s.match(/efi/)\n tftp_boot_file = options['tftpdir'].to_s+\"/01-\"+options['mac'].to_s.gsub(/:/,\"-\").downcase+\"/boot.cfg\"\n else\n tftp_boot_file = options['tftpdir'].to_s+\"/\"+options['service'].to_s+\"/\"+tftp_boot_file\n end\n esx_boot_file = options['tftpdir'].to_s+\"/\"+options['service'].to_s+\"/boot.cfg\"\n if options['verbose'] == true\n handle_output(options,\"Creating:\\tBoot config file #{tftp_boot_file}\")\n end\n copy=[]\n file=IO.readlines(esx_boot_file)\n file.each do |line|\n line=line.gsub(/\\//,\"\")\n if options['text'] == true\n if line.match(/^kernelopt/)\n if not line.match(/text/)\n line = line.chomp+\" text\\n\"\n end\n end\n end\n if line.match(/^kernelopt/)\n line = \"kernelopt=ks=#{ks_url}\\n\"\n end\n if options['serial'] == true\n if line.match(/^kernelopt/)\n if not line.match(/nofb/)\n line = line.chomp+\" nofb com1_baud=115200 com1_Port=0x3f8 tty2Port=com1 gdbPort=none logPort=none\\n\"\n end\n end\n end\n if line.match(/^title/)\n copy.push(line)\n copy.push(\"prefix=#{options['service']}\\n\")\n else\n if !line.match(/^prefix/)\n copy.push(line)\n end\n end\n end\n tftp_boot_file_dir = File.dirname(tftp_boot_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere TFTP boot file directory\")\n end\n check_dir_exists(options,tftp_boot_file_dir)\n check_dir_owner(options,options['tftpdir'],options['uid'])\n check_dir_owner(options,tftp_boot_file_dir,options['uid'])\n File.open(tftp_boot_file,\"w\") {|file_data| file_data.puts copy}\n check_file_owner(options,tftp_boot_file,options['uid'])\n print_contents_of_file(options,\"\",tftp_boot_file)\n return\nend",
"def create_vm(config, node_name)\n config.vm.define node_name do |vm|\n vm.vm.host_name = node_name\n vm.vm.network \"private_network\", type: \"dhcp\"\n vm.vm.box = \"ubuntu/xenial64\"\n end\nend",
"def stdopt(\n config, hostname:, cpus: 1, memory_mb: 1024, box: \"ubuntu/focal64\"\n)\n config.vm.box = box\n config.vm.hostname = hostname\n\n config.ssh.forward_agent = true\n\n config.vm.synced_folder \".\", \"/host_share\"\n\n config.vm.provider \"virtualbox\" do |vbox|\n vbox.linked_clone = true\n vbox.cpus = cpus\n vbox.memory = memory_mb\n # Force allocation of all specified VM memory at start. Change the 1 below\n # to 0 to allow for \"as needed allocation\".\n vbox.customize [\"setextradata\", :id, \"VBoxInternal/RamPreAlloc\", 1]\n end\nend",
"def osd_select\n \n end",
"def change_vbox_vm_cpu(client_name,client_cpus)\n message = \"Setting:\\tVirtualBox VM \"+client_name+\" CPUs to \"+client_cpus\n command = \"VBoxManage modifyvm #{client_name} --cpus #{client_cpus}\"\n execute_command(message,command)\n return\nend",
"def try_vbguest\n vbguest = Vbguest.new(config, settings)\n vbguest.configure\n end",
"def read_virtio\n begin\n @virtios = Virtio.find(:all)\n doc = REXML::Document.new \"<virtio_vms/>\"\n \n #<vm_num>2</vm_num>\n\tvm_num_node = doc.root.add_element \"vm_num\"\n\tvm_count = @virtios.size\n\tvm_num_node.text =vm_count\n\t\n\t#<virtio_vm>\n\t# <vmdomid>1</vmdomid>\n\t#</virtio_vm>\n\t@virtios.each do |virtio|\n\t virtio_node = doc.root.add_element \"virtio_vm\"\n\t vmdomid_node = virtio_node.root.add_element \"vmdomid\"\n\t vmdomid_node.text = virtio.domid\n\t virtio_node.add vmdomid_node\n\tend\n render :inline =>doc.to_s\n rescue Exception => e\n puts \"kkk2\"\n end\n end",
"def make_virtualbox_vm(options)\n @colour.notify \"Ensuring following commands run from directory '#{options[:project_dir]}/Vagrantfile'\"\n @colour.notify 'Executing vagrant up (this may take a while)'\n\n system \"cd '#{options[:project_dir]}' && vagrant up #{'--debug' if options[:debug]} #{'--no-color' if options[:disable_colour]}\"\n\n return options\nend",
"def devbox_user_command(cmd)\n command(\"sudo -u vagrant bash -i -c '#{cmd}; exit $?'\")\nend",
"def villian; end",
"def create_iscsi_disks(vbox, name)\n unless controller_exists(name, 'SATA Controller')\n vbox.customize ['storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata']\n end\n\n dir = \"#{ENV['HOME']}/VirtualBox\\ VMs/vdisks\"\n Dir.mkdir dir unless File.directory?(dir)\n\n osts = (1..20).map { |x| [\"OST#{x}\", '5120'] }\n\n [\n %w[mgt 512],\n %w[mdt0 5120]\n ].concat(osts).each_with_index do |(name, size), i|\n file_to_disk = \"#{dir}/#{name}.vdi\"\n port = (i + 1).to_s\n\n unless File.exist?(file_to_disk)\n vbox.customize ['createmedium',\n 'disk',\n '--filename',\n file_to_disk,\n '--size',\n size,\n '--format',\n 'VDI',\n '--variant',\n 'fixed']\n end\n\n vbox.customize ['storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', port,\n '--type', 'hdd',\n '--medium', file_to_disk,\n '--device', '0']\n\n vbox.customize ['setextradata', :id,\n \"VBoxInternal/Devices/ahci/0/Config/Port#{port}/SerialNumber\",\n name.ljust(20, '0')]\n end\nend",
"def get_vbox_vm_dir(client_name)\n message = \"Getting:\\tVirtualBox VM directory\"\n command = \"VBoxManage list systemproperties |grep 'Default machine folder' |cut -f2 -d':' |sed 's/^[ ]*//g'\"\n vbox_vm_base_dir = execute_command(message,command)\n vbox_vm_base_dir = vbox_vm_base_dir.chomp\n if !vbox_vm_base_dir.match(/[A-z]/)\n vbox_vm_base_dir=$home_dir+\"/VirtualBox VMs\"\n end\n vbox_vm_dir = \"#{vbox_vm_base_dir}/#{client_name}\"\n return vbox_vm_dir\nend",
"def docker_host d\n d.vagrant_machine = \"#{DOCKER_HOST_NAME}\"\n d.vagrant_vagrantfile = \"#{DOCKER_HOST_VAGRANTFILE}\"\nend",
"def configure_node(node)\n node.vm.box = \"debian/jessie64\"\n node.vm.box_check_update = true\n node.vm.synced_folder \"./data\", \"/data\"\n\n node.vm.provider \"virtualbox\" do |v|\n v.gui = false\n v.memory = \"2048\"\n v.cpus = 2\n v.customize [\"modifyvm\", :id, \"--cpuexecutioncap\", \"100\"]\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n v.default_nic_type = \"82545EM\"\n end\n\n node.vm.provision \"shell\", inline: <<-SHELL\n apt-get -y update\n apt-get -y install build-essential\n apt-get -y install cmake\n apt-get -y install emacs\n apt-get -y install ninja-build\n apt-get -y install git\n apt-get -y install htop\n apt-get -y install zsh\n apt-get -y upgrade\n SHELL\nend",
"def create_fusion_vm_disk(options,fusion_vm_dir,fusion_disk_file)\n if File.exist?(fusion_disk_file)\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM disk '#{fusion_disk_file}' already exists for #{options['name']}\")\n quit(options)\n end\n check_dir_exists(options,fusion_vm_dir)\n if options['host-os-name'].to_s.match(/Darwin/)\n vdisk_bin = \"/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager\"\n else\n vdisk_bin = \"/usr/bin/vmware-vdiskmanager\"\n end\n message = \"Creating \\t#{options['vmapp']} disk '\"+fusion_disk_file+\"' for \"+options['name']\n command = \"cd \\\"#{fusion_vm_dir}\\\" ; \\\"#{vdisk_bin}\\\" -c -s \\\"#{options['size']}\\\" -a LsiLogic -t 0 \\\"#{fusion_disk_file}\\\"\"\n execute_command(options,message,command)\n return\nend",
"def create_vnc_console\n if @host_ip == IPSocket.getaddress(Socket.gethostname)\n prefix = ''\n else\n prefix = \"#{PveHelper::CMD_SSH_EXEC} #{@host_ip} \" \n end\n \n port = VirtualMachine.next_vnc_port\n timeout = 1\n if port and self.running?\n @vnc_port = port\n \n # generate random password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n @vnc_password = \"\"\n # password length is 8 as vnc server only accept 8 chars in maxium\n 1.upto(8) { |i| @vnc_password << chars[rand(chars.size-1)] } \n \n pwdfile = \"/tmp/.vncpwd.#{rand()}\"\n \n File.open(pwdfile, 'w') {|f| f.write(@vnc_password)}\n \n if @type == 'vz'\n if @status == 'running'\n vzcmd = \"/usr/sbin/vzctl enter #{@id}\"\n elsif @status == 'mounted'\n vzcmd = \"/usr/bin/pvebash #{@id} root\"\n else\n vzcmd = \"/usr/bin/pvebash #{@id} private\"\n end\n elsif @type == 'qm'\n vzcmd = \"/usr/sbin/qm monitor #{@id}\"\n else\n vzcmd = \"/bin/true\" # should not be reached\n end\n \n cmdstr = \"/usr/bin/vncterm -rfbport #{@vnc_port} -passwdfile rm:#{pwdfile} -timeout #{timeout} -c #{prefix} #{vzcmd} &\";\n \n puts \"cmd: #{cmdstr}\"\n return system(cmdstr)\n end\n \n end",
"def create_vm(vm_name, storage_acct, subnet, public_ip)\n location = WEST_EU\n\n puts \"Creating security group...\"\n params_nsg = NetworkModels::NetworkSecurityGroup.new.tap do |sg|\n sr = NetworkModels::SecurityRule.new.tap do |rule|\n rule.name = 'main'\n rule.description = 'default rule'\n rule.protocol = '*'\n rule.source_address_prefix = '*'\n rule.destination_address_prefix = '*'\n rule.source_port_range = '*'\n rule.access = 'Allow'\n rule.priority = 100\n rule.direction = 'Inbound'\n rule.destination_port_ranges = ['22','80', '443', '50051']\n end\n\n sg.location = WEST_EU\n sg.security_rules = [ sr ]\n end\n nsg = @network_client.network_security_groups.create_or_update(GROUP_NAME,'coffe-grpc_rules', params_nsg)\n\n puts \"Creating a network interface for the VM #{vm_name}\"\n print_item nic = @network_client.network_interfaces.create_or_update(\n GROUP_NAME,\n \"nic-#{vm_name}\",\n NetworkModels::NetworkInterface.new.tap do |interface|\n interface.location = WEST_EU\n interface.network_security_group = nsg\n interface.ip_configurations = [\n NetworkModels::NetworkInterfaceIPConfiguration.new.tap do |nic_conf|\n nic_conf.name = \"nic-#{vm_name}\"\n nic_conf.private_ipallocation_method = NetworkModels::IPAllocationMethod::Dynamic\n nic_conf.subnet = subnet\n nic_conf.public_ipaddress = public_ip\n end\n ]\n end\n )\n\n puts 'Creating a Ubuntu 16.04.0-LTS Standard DS2 V2 virtual machine w/ a public IP'\n vm_create_params = ComputeModels::VirtualMachine.new.tap do |vm|\n vm.location = location\n vm.os_profile = ComputeModels::OSProfile.new.tap do |os_profile|\n os_profile.computer_name = vm_name\n os_profile.admin_username = @conf[:user]\n os_profile.admin_password = 'Asd1234554321'\n end\n\n vm.storage_profile = ComputeModels::StorageProfile.new.tap do |store_profile|\n store_profile.image_reference = ComputeModels::ImageReference.new.tap do |ref|\n ref.publisher = 'canonical'\n ref.offer = 'UbuntuServer'\n ref.sku = '16.04.0-LTS'\n ref.version = 'latest'\n end\n store_profile.os_disk = ComputeModels::OSDisk.new.tap do |os_disk|\n os_disk.name = \"os-disk-#{vm_name}\"\n os_disk.caching = ComputeModels::CachingTypes::None\n os_disk.create_option = ComputeModels::DiskCreateOptionTypes::FromImage\n os_disk.vhd = ComputeModels::VirtualHardDisk.new.tap do |vhd|\n vhd.uri = \"https://#{storage_acct.name}.blob.core.windows.net/rubycontainer/#{vm_name}.vhd\"\n end\n end\n end\n\n vm.hardware_profile = ComputeModels::HardwareProfile.new.tap do |hardware|\n hardware.vm_size = ComputeModels::VirtualMachineSizeTypes::StandardDS2V2\n end\n\n vm.network_profile = ComputeModels::NetworkProfile.new.tap do |net_profile|\n net_profile.network_interfaces = [\n ComputeModels::NetworkInterfaceReference.new.tap do |ref|\n ref.id = nic.id\n ref.primary = true\n end\n ]\n end\n end\n\n vm_create_params.os_profile.linux_configuration = ComputeModels::LinuxConfiguration.new.tap do |linux|\n linux.disable_password_authentication = false\n linux.ssh = ComputeModels::SshConfiguration.new.tap do |ssh_config|\n keys = []\n @conf[:access].each do |key|\n k = ComputeModels::SshPublicKey.new.tap do |pub_key|\n pub_key.key_data = key\n pub_key.path = '/home/user_admin/.ssh/authorized_keys'\n end\n keys << k\n end\n ssh_config.public_keys = keys\n end\n end\n\n print_item vm = @compute_client.virtual_machines.create_or_update(GROUP_NAME, vm_name, vm_create_params)\n vm\nend",
"def user_os_complex\r\n end",
"def configure_node(node)\n node.vm.box = \"ubuntu/bionic64\"\n node.vm.box_check_update = true\n node.vm.synced_folder \"./data\", \"/data\"\n node.vm.network \"public_network\"\n node.vm.network \"private_network\", type: \"dhcp\"\n\n node.vm.provider \"virtualbox\" do |v|\n v.gui = false\n v.memory = \"2048\"\n v.cpus = 2\n v.customize [\"modifyvm\", :id, \"--cpuexecutioncap\", \"100\"]\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n v.default_nic_type = \"82545EM\"\n end\n\n node.vm.provision \"shell\", inline: <<-SHELL\n apt -y update\n apt -y install build-essential\n apt -y install emacs25-nox\n apt -y install htop\n apt -y install zsh\n apt -y upgrade\n SHELL\nend",
"def new_disk_ide\n Libvirt::Spec::Device.get(:disk).new.tap do |disk|\n disk.type = :file\n disk.device = :disk\n disk.target_dev = :hda\n disk.target_bus = :ide\n end\n end",
"def setup(machine)\n\n machine.bindfs.debug = true\n \n machine.vm.provider :virtualbox do |provider, _|\n provider.memory = 512\n provider.cpus = 2\n end\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-symbol\", chown_ignore: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-string\", \"chown-ignore\" => true\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-option\", owner: \"root\"\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-flag\", \"create-as-user\" => true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-short-option\", r: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-without-explicit-owner\", owner: nil\n\n # This should fail\n machine.bindfs.bind_folder \"/etc3\", \"/etc-nonexit\"\n\n # These should also fail\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-user\", user: \"nonuser\", after: :provision\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-group\", group: \"nongroup\", after: :provision \n\nend",
"def virtualbox_nonrunning_vm_guids\n running_vms_guids = []\n `vboxmanage list runningvms`.scan(/{(.*)}/) { running_vms_guids << Regexp.last_match(1) }\n vm_guids = []\n `vboxmanage list vms`.scan(/{(.*)}/) { vm_guids << Regexp.last_match(1) unless running_vms_guids.include?(Regexp.last_match(1)) }\n\n vm_guids\nend",
"def virtual_guest_template\n template = {\n \"startCpus\" => @cores.to_i,\n \"maxMemory\" => @memory.to_i * 1024, # we let the user specify memory in GB, but the API expects maxMemory in MB.\n \"hostname\" => @hostname,\n \"domain\" => @domain,\n\n # Note : for the values below, we want to use the constants \"true\" and \"false\" not nil\n # the nil value (while false to Ruby) will not translate to XML properly\n \"localDiskFlag\" => !!@use_local_disk,\n \"hourlyBillingFlag\" => !!@hourly\n }\n\n template['dedicatedAccountHostOnlyFlag'] = true if @dedicated_host_only\n template['privateNetworkOnlyFlag'] = true if @private_network_only\n\n template['datacenter'] = {\"name\" => @datacenter.name} if @datacenter\n template['userData'] = [{'value' => @user_metadata}] if @user_metadata\n template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed\n template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI\n template['postInstallScriptUri'] = @provision_script_uri.to_s if @provision_script_uri\n template['primaryNetworkComponent'] = { \"networkVlan\" => { \"id\" => @public_vlan_id.to_i } } if @public_vlan_id\n template['primaryBackendNetworkComponent'] = { \"networkVlan\" => {\"id\" => @private_vlan_id.to_i } } if @private_vlan_id\n template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids\n template['supplementalCreateObjectOptions'] = @supplementalCreateObjectOptions if @supplementalCreateObjectOptions\n\n if @image_template\n template['blockDeviceTemplateGroup'] = {\"globalIdentifier\" => @image_template.global_id}\n elsif @os_reference_code\n template['operatingSystemReferenceCode'] = @os_reference_code\n end\n\n if @disks && !@disks.empty?\n template['blockDevices'] = []\n\n # According to the documentation for +createObject+,\n # device number 1 is reserved for the SWAP disk of the computing instance.\n # So we assign device 0 and then assign the rest starting at index 2.\n @disks.each_with_index do |disk, index|\n device_id = (index >= 1) ? index + 1 : index\n template['blockDevices'].push({\"device\" => \"#{device_id}\", \"diskImage\" => {\"capacity\" => disk}})\n end\n end\n\n template\n end",
"def configure_vs_fusion_vm(options)\n options['os-type'] = get_vs_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend",
"def create_gdom_disk(options)\n client_disk = options['q_struct']['gdom_disk'].value\n disk_size = options['q_struct']['gdom_size'].value\n disk_size = disk_size.downcase\n vds_disk = options['name']+\"_vdisk0\"\n if not client_disk.match(/\\/dev/)\n if not File.exist?(client_disk)\n message = \"Information:\\tCreating guest domain disk \"+client_disk+\" for client \"+options['name']\n command = \"mkfile -n #{disk_size} #{client_disk}\"\n output = execute_command(options,message,command)\n end\n end\n message = \"Information:\\tChecking Virtual Disk Server device doesn't already exist\"\n command = \"ldm list-services |grep 'primary-vds0' |grep '#{vds_disk}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n message = \"Information:\\tAdding disk device to Virtual Disk Server\"\n command = \"ldm add-vdsdev #{client_disk} #{vds_disk}@primary-vds0\"\n output = execute_command(options,message,command)\n end\n return\nend",
"def private; end",
"def docker_login_vagrant(config)\n\n config.vm.provision \"shell\", privileged: false, inline: <<-SHELL\n docker login --username=testuser --password=testpassword util.io\n SHELL\n\nend",
"def vm_memory\n $vb_memory.nil? ? $vm_memory : $vb_memory\nend",
"def vm_memory\n $vb_memory.nil? ? $vm_memory : $vb_memory\nend",
"def inspect\n state_provider = \"[#{box_state} (#{provider})]\"\n \"#{name.ljust(max_length)} #{state_provider.ljust(max_length)} [VM OS <-- #{guest_os}]\"\n end",
"def vbox_version\n command=\"#{@vboxcmd} --version\"\n shell_results=shell_exec(\"#{command}\",{:mute => true})\n version=shell_results.stdout.strip.split(/[^0-9\\.]/)[0]\n return version\n end",
"def devbox_user_gui_command(cmd)\n if Chef::Sugar::Docker.docker?(@node)\n devbox_user_command \"xvfb-run #{cmd}\"\n else\n devbox_user_command \"DISPLAY=:0 #{cmd}\"\n end\nend",
"def detach_file_from_parallels_vm(options)\n message = \"Information:\\tAttaching Image \"+options['file']+\" to \"+options['name']\n command = \"prlctl set \\\"#{options['name']}\\\" --device-set cdrom0 --disable\\\"\"\n execute_command(options,message,command)\n return\nend",
"def unconfigure_vbox_vm(client_name)\n check_vbox_is_installed()\n exists = check_vbox_vm_exists(client_name)\n if exists == \"no\"\n puts \"VirtualBox VM \"+client_name+\" does not exist\"\n exit\n end\n stop_vbox_vm(client_name)\n sleep(5)\n message = \"Deleting:\\tVirtualBox VM \"+client_name\n command = \"VBoxManage unregistervm #{client_name} --delete\"\n execute_command(message,command)\n return\nend",
"def configure_providers(host,vmcfg)\n providers = [ 'virtualbox', 'vmware_fusion' ]\n vmcfg['vm']['gui'] ||= false\n providers.each do |p|\n host.vm.provider p do |pcfg|\n pcfg.gui = true if vmcfg['vm']['gui']\n end\n begin\n send(\"configure_#{p}\",host,vmcfg)\n rescue NoMethodError\n # do nothing\n end\n end\nend",
"def defineCommonVM(config)\n\tconfig.ssh.insert_key = true\n\n\t# Configure how much memory and CPU cores each VM should have.\n\tconfig.vm.provider :virtualbox do |vb|\n\t\tvb.gui = $vmGUIEnabled\n\t\tvb.memory = $vmMemory\n\t\tvb.cpus = $vmCPUCores\n\tend\nend",
"def get_parallels_disk(options)\n message = \"Information:\\tDetermining directory for Parallels VM \"+options['name']\n command = \"prlctl list #{options['name']} --info |grep image |awk '{print $4}' |cut -f2 -d=\"\n vm_dir = execute_command(options,message,command)\n vm_dir = vm_dir.chomp.gsub(/'/,\"\")\n return vm_dir\nend",
"def info_kvm(kvm_name)\n puts \"#{kvm_name}\"\n puts \" Type: #{kvm_type(kvm_name)}\"\n puts \" Address: #{kvm_ip(kvm_name)}\"\nend",
"def mk_proxmox_vm(server,name,ram_size_mb,disk_size_mb,cores)\n\n id = Proxmox::Proxmox.next_free_qemu_id(server.nodes)\n nodename = $proxmox_node\n node = server.node_by_name(nodename)\n storage = node.storage_by_free_space(disk_size_mb)\n if !storage then\n puts \"cannot create vm: reason: cannot get a storage to provide \" + disk_size_mb.to_s + \" MB space\"\n return\n end\n if node.free_ram_mb() < ram_size_mb then\n puts \"cannot create vm: reason: node has insufficient ram: \" + ram_size_mb.to_s + \" MB space requested, \" + node.free_ram_mb().to_s + \" MB available\"\n return\n end\n\n storname = storage.storage()\n\n disk_id = SecureRandom.uuid().byteslice(0,8)\n vol_name = \"vm-\"+ id.to_s + \"-disk-\" + disk_id\n vol_size = disk_size_mb.to_s + \"M\"\n vol_format = \"raw\"\n vol_vm_id = id\n disk_name = storage.create_disk(vol_name , disk_size_mb.to_s + \"M\", \"raw\",id)\n if /error/.match(disk_name) then\n puts \"cannot create vm: reason: error creating vm storage: \" + disk_name.to_s\n return\n end\n\n data = {\n \"onboot\" => \"1\",\n \"boot\" => \"ndc\",\n \"sockets\" => cores,\n \"memory\" => ram_size_mb,\n \"virtio0\" => disk_name+\",cache=unsafe,size=\"+ (Float(disk_size_mb/1024)).floor.to_s+\"G\",\n \"kvm\" => \"1\",\n \"net0\" => \"e1000,bridge=vmbr0\",\n \"net1\" => \"e1000,bridge=vmbr1\",\n \"ostype\" => \"l26\", # linux 2.6/3.x/4.x kernel\n \"name\" => name, \n \"vmid\" => id\n }\n\n node.create_qemu(data)\nend",
"def configure_ob_fusion_vm(options)\n options['os-type'] = get_ob_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend"
] | [
"0.64217657",
"0.64150083",
"0.6336082",
"0.6271",
"0.6229963",
"0.6147014",
"0.6101017",
"0.60893047",
"0.60614574",
"0.60469615",
"0.5993159",
"0.59561354",
"0.5870823",
"0.58669585",
"0.5860617",
"0.58535385",
"0.58292145",
"0.58032453",
"0.57781637",
"0.57720804",
"0.57500196",
"0.5724721",
"0.57243997",
"0.5714317",
"0.5713161",
"0.5707667",
"0.57047534",
"0.5692757",
"0.56842387",
"0.564403",
"0.5635772",
"0.5633785",
"0.5633128",
"0.5626199",
"0.56050503",
"0.56013983",
"0.5595695",
"0.5595695",
"0.5573151",
"0.5569972",
"0.5560549",
"0.5555962",
"0.553807",
"0.5524335",
"0.5520309",
"0.5518298",
"0.55110747",
"0.5506816",
"0.54945606",
"0.548782",
"0.54856884",
"0.54853696",
"0.5482502",
"0.5474417",
"0.54593676",
"0.545778",
"0.54572535",
"0.54424334",
"0.54391086",
"0.5437498",
"0.54286575",
"0.5418446",
"0.5409205",
"0.5408889",
"0.53822094",
"0.53666836",
"0.5366612",
"0.5365894",
"0.53654397",
"0.53631413",
"0.53399575",
"0.53275937",
"0.5307501",
"0.53072995",
"0.5304593",
"0.5302946",
"0.5297174",
"0.5291669",
"0.5289625",
"0.5288235",
"0.5284839",
"0.5279114",
"0.52766407",
"0.5275851",
"0.5267178",
"0.52659315",
"0.5264179",
"0.52613175",
"0.5261271",
"0.5261271",
"0.5257624",
"0.52507377",
"0.52480435",
"0.5242999",
"0.523966",
"0.52330536",
"0.5225733",
"0.5220951",
"0.521138",
"0.52099806",
"0.52060366"
] | 0.0 | -1 |
Remembers a user in the database for use in presistent sessions | def remember
self.remember_token = User.new_token
# 'update_attribute' relieves me of the requirement to provide password when updating
update_attribute(:remember_digest, User.digest(remember_token))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end",
"def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first\n if token\n if token.user == user\n token.touch\n return user\n else\n token.destroy\n end\n end\n end\n if user\n session[:authpwn_suid] = Tokens::SessionUid.random_for(user,\n request.remote_ip, request.user_agent || 'N/A').suid\n else\n session.delete :authpwn_suid\n end\n end",
"def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end",
"def change_password\n @user = User.find_by_id(session[:remember_token])\n end",
"def with_user(new_user, &block)\n begin\n set_user(new_user)\n yield exists?(:previous_user) ? fetch(:previous_user) : nil\n ensure\n reset_user\n end\n \n clear_sessions\n end",
"def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end",
"def lookup_user\n reset_session #use this when they ask you to find a user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def alter_current_user(&block)\n user = current_user\n user = User.find(user.id) if user.frozen? # Since we're modifying it, we can't use the one from memcached.\n yield(user)\n user.save if logged_in?\n $CACHE.delete(\"users/#{session[:user_id]}\")\n set_current_user(user)\n user\n end",
"def resetpass\r\n @user = User.new\r\n end",
"def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end",
"def reset_current_user(user_x)\n user = User === user_x ? user_x : User.find(user_x)\n unless user.nil? || current_user_id == user.id\n clear_auth_cookie\n reset_user_session\n set_current_user(user)\n end \n end",
"def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end",
"def recreate_testuser\n result = User.new(id: TESTUSER_ID, username: TESTUSER_NAME, password: TESTUSER_PASSWORD, email:TESTUSER_EMAIL).save\n puts \"Recreate testuser -> #{result}\"\nend",
"def remember\n self.remember_token = User.new_token\n #so @user.remember_token = some random string\n update_attribute(:remember_digest, User.digest(remember_token))\n #so the User in the database has its remember_digest collumn updated to the Bcrypt of the remember_token\n end",
"def change_password\n @user=User.find(current_user)\n end",
"def set_current_user(user)\n sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)\n cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }\n user.remember_token = sha1\n user.save\n @current_user = user\n end",
"def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end",
"def sign_in(user)\n sign_out\n\n user.touch(:last_login_at)\n user_session = user.sessions.new(ip_address: request.remote_ip, user_agent: request.user_agent)\n if user_session.save\n user.password_resets.delete_all\n @current_session = user_session\n end\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:id]) if @user.nil && session[: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_remittent\n @user = User.find(params[:id])\n end",
"def set_user\n @user = User.find_by_id(params[:id])\n require_same_user\n #redirect_to signin_path unless @user #for a route that does not exist redirect it back to home page\n end",
"def fetch_user\n\n # Check if user_id in the session is the id of a real user in our db. If it is, we will get the user object in @current_user; if not, we will get nil\n if session[:user_id].present?\n @current_user = User.find_by id: session[:user_id]\n end\n\n # If we did get nil from the above query, delete the session because the user_id is stale (invalid)\n if @current_user.nil?\n session[:user_id] = nil # unless @current_user.present?\n end\n\n end",
"def remember\n self.remember_token = User.new_token\n\n # update_attribute bypasses validations, since we don't have user's password\n # here, which is normally necessary for changing records on the table\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def set_user(user, pass)\n set :user, user\n set :password, pass\n close_sessions\nend",
"def change_password\n @user = current_user\n end",
"def change_password\n @user = current_user\n end",
"def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def reuse\n nil unless User.safe_find(params[:id]) == User.current\n end",
"def remember\n # give the variable to \"self\", the user\n # sets the remember_token attribute of the user object\n self.remember_token = User.new_token\n # update attribute of the User, bypass validations (password), hash the\n # remember_token using digest (not totally sure that's right)\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def set_user\n @user = User.where(:username => params[:id]).first!\n end",
"def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end",
"def reload\n\t\t# Just to be sure we have all the fields\n\t\tu = User.find(:first, :conditions => [\"login = ? AND confirmed=1\", self.login])\n\t\tself.validkey = u.validkey\n\t\tself.newemail = u.newemail\n\t\tself.ident = true\n\t\tself.id = u.id\n\t\tu.ident = true\n\t\treturn u\n\tend",
"def update_identity_user(identity, user)\n identity.update_attributes(user_id: user.id) if identity.user != user \n end",
"def remember\n self.login_token = User.new_token\n update_attribute(:login_digest, User.digest(self.login_token))\n end",
"def current_user\n if session[:user_id] # Do not know how to check for nil session expires. #TODO - figure out session expires\n @current_user = User.create_from_database(session[:user_id].to_i)\n else\n session.clear\n @message = \"You are not logged in. Please log in.\"\n redirect \"/login\"\n end \n end",
"def restore_last_user\n return @last_user if @last_user\n if session[:last_user_id].present?\n @last_user = User.find_by_id(session[:last_user_id])\n message = translate(\"users.sign_in_back\", user: @last_user.name)\n set_flash_message(message, :success, false)\n session.destroy()\n session[:id] = @last_user.id if @last_user.present?\n return @last_user\n end\n end",
"def remember user\n # generates the remember token and saves it's encrypted form to the db\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end",
"def fetch_user\n @current_user = User.find_by(:id => session[:user_id]) if session[:user_id]\n\n session[:user_id] = nil unless @current_user.present?\n end",
"def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def sign_in(user)\n remember_token = User.new_remember_token # create a new remember token\n cookies.permanent[:remember_token] = remember_token # save the remember token on the client side as a cookie\n user.update_attributes remember_token: User.hash(remember_token) # save the remember token on the server side in the DB\n self.current_user = user\n end",
"def set_user_id\n User.stats.limit(2).each do |user|\n self.user_id = user['id']\n\n # prevents us from setting back to the same user\n if self.changes['user_id'][0] != self.changes['user_id'][0]\n break\n end\n end\n end",
"def remember\n self.remember_token = User.new_token\n # Writes token to db\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def user_from_remember_token\n\t\t\tUser.authenticate_with_salt(*remember_token)\n\t\tend",
"def store_issuer\n user = User.find_or_create_by(slack_id: @params[:user_id])\n user.update(username: @params[:user_name]) # in case they have changed their username\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(guest_user_id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def assign_user\n #If @user is already assigned (by multi_authenticate), stop here and don't create a user\n return @user if @user.present?\n\n #Otherwise, generates a user with IP & user_agent\n user_ip_adress = request.remote_ip\n user_agent = request.user_agent\n user_cookie = cookies[\"user_id\"]\n \n @user = User.create(ip_adress: user_ip_adress, user_agent: user_agent) #generates a new user with a user_cookie\n cookies.permanent[\"user_id\"] = { value: @user.user_cookie } #stores the user_cookie in the cookies of the client\n end",
"def remember\n self.remember_token = User.new_token\n self.update_attribute :remember_digest, User.digest(remember_token)\n end",
"def change_password\n @user = User.new\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def remember #this is also called a user.remember method\n self.remember_token = User.new_token #save the generated token into a class variable called remember_token, accessible in the whole User class with attr_accessor\n update_attribute(:remember_digest, User.digest(remember_token)) #to update the database we use the remember token that has been generated, encrypt it with digest method, then save to database\n end",
"def create_guest_user!\n # bah, this may not be entirely guaranteed to be unique\n # but it would be hard for it to collide, good enough. Actually\n # if the rails session id isn't unique, it's gonna cause problems\n # for more than just us, we should be good with just that even.\n unique_token = \"#{request.session_options[:id]}_#{(Time.now.to_f * 1000.0).to_i}_#{Process.pid}\"\n\n new_user = User.new.tap do |u|\n u.login = \"GUEST_USER_#{unique_token}\"\n u.guest = true\n u.save!\n end\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def reauthenticate \n\t\t\tself.login(@email, @password)\n\t\tend",
"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 remember\n self.remember_token = User.new_token\n self.update_attribute(:remember_digest, User.digest(self.remember_token))\n end",
"def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end",
"def current_user=(new_user)\n current_session.user = new_user\n end",
"def reset_user\n sitrack_user = SitrackUser.find_by_ssm_id(current_user.id, :include => :sitrack_views)\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def backdoor\n user = User.find_by_uid(\"test@user.edu\")\n session[:user_id] = user.id\n redirect_to root_url\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def current_user=(new_user)\n session[:user_id] = new_user ? new_user.id : nil\n end",
"def current_user=(new_user)\n session[:user_id] = new_user ? new_user.id : nil\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def guest_user(with_retry = true)\n # Cache the value the first time it's gotten.\n @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user if with_retry\n end",
"def remember\n self.remember_token=User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def set_current_user(user)\n if user.new_record?\n set_unlogged_in_user(user)\n else\n set_logged_in_user(user)\n end\n end",
"def remember\n self.remember_token = User.new_token\n # encrypt remember_token and save it in :remember_digest field in db\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def maintain_session_and_user\n if session[:id]\n if @application_session = Session.find_by_id(session[:id])\n @application_session.update_attributes(:ip_address => request.remote_addr, :path => request.path_info)\n @user = @application_session.person\n else\n flash[:notice] = \"Excuse me, but your session data appears to be outdated. Do you mind logging in again?\"\n session[:id] = nil\n redirect_to(root_url) #If he has an incorrect session id, send to root\n end\n end\n end",
"def remember\n self.remember_token = User.generate_remember_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end",
"def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end"
] | [
"0.702948",
"0.6555715",
"0.6535143",
"0.6432948",
"0.6322701",
"0.6273564",
"0.6240582",
"0.62013775",
"0.6187015",
"0.6182969",
"0.61562073",
"0.6121879",
"0.6093624",
"0.60839635",
"0.6082462",
"0.60799545",
"0.6067676",
"0.6059618",
"0.604971",
"0.604039",
"0.6016863",
"0.6016863",
"0.5995096",
"0.5992338",
"0.5991053",
"0.5988533",
"0.598788",
"0.59878343",
"0.59878343",
"0.5983874",
"0.5980494",
"0.5978597",
"0.5969471",
"0.59658015",
"0.59658015",
"0.59638673",
"0.5963632",
"0.5958795",
"0.5958622",
"0.59542763",
"0.59534",
"0.59516364",
"0.59499",
"0.59415257",
"0.59388906",
"0.592098",
"0.5920179",
"0.5918276",
"0.59140277",
"0.59086436",
"0.5906843",
"0.5900276",
"0.5900185",
"0.5896522",
"0.58960134",
"0.58944947",
"0.5892082",
"0.589198",
"0.58890766",
"0.5882997",
"0.58791906",
"0.5878632",
"0.58767074",
"0.58767074",
"0.58766806",
"0.5875984",
"0.5875125",
"0.58736944",
"0.5873158",
"0.5872607",
"0.58689654",
"0.58686864",
"0.58631134",
"0.58585906",
"0.58585906",
"0.5851307",
"0.5851307",
"0.58480126",
"0.5847242",
"0.5847242",
"0.5847242",
"0.5847242",
"0.5847242",
"0.5846813",
"0.584641",
"0.5843661",
"0.58382046",
"0.5836844",
"0.5827166",
"0.5826747",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493",
"0.58259493"
] | 0.0 | -1 |
Returns true if the given token matches the digest | def authenticated?(attribute, token)
# 'send' (in fact its 'self.send' but 'self can be omitted in this context')
# is a method that receives a method name, either in symbol or string format,
# and applies it to the base argument (in this case, 'self').
# String interpolation is used because we only know whether it's
# the user's remember token or activation token at run time. Symbols are interpolated as strings.
digest = send("#{attribute}_digest")
return false if digest.nil?
BCrypt::Password.new(digest).is_password?(token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n # Decrypts the digest and compares it to the token.\n end",
"def authenticated?(token, digest = nil)\n return false if digest.present? && BCrypt::Password.new(digest).is_password?(token)\n end",
"def validate_token(digest, token)\n if token.nil? || digest.nil?\n false\n else\n BCrypt::Password.new(digest).is_password?(token)\n end\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest.is_digest_for? token\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest == Digest::SHA1.hexdigest(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest == Digest::SHA1.hexdigest(token)\n end",
"def authenticated_with_token?(token)\n return false if token.nil?\n token == remember_digest\n end",
"def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signature = CGI.unescape(token[/&HMACSHA256=(.*)$/, 1])\n bare_token = token.gsub(/&HMACSHA256=(.*)$/, '')\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(shared_secret)).update(bare_token.toutf8).digest).strip\n return original_signature == signature\n end",
"def match_token(token)\n return true\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n # when digest nil ist soll die methode false zurückgeben damit Bcrypt keinen Fehler hervorrufen kann, wenn man sich bei zwei BRowsern eingeloggt hat und sich nur bei einem abmeldet, aber beide schließt.\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) #takes a token, hashes it and compares it to the original hash_digest from the database. If hash_digest of given token is equal to the one saved in the database, authenticatedß returns true.\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\") # no need for self.send as we're in the user model\n return false if digest.nil?\n # verify the token matches the digest\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n \n digest = send(\"#{attribute}_digest\")\n \n return false if digest.blank? \n #ry.binding\n \n #BCrypt::Password.new will fail with invalid_hash as the new hash not having the valid_hash? coming tru for BCrypt gem.\n #It should be passed all the params as in cost and salt, so that it can be successfully be parsed. Otherwise use create.\n #https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb\n # alias is_password, :== \n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.try(\"#{attribute}_digest\")\n return false if digest.nil?\n ::BCrypt::Password.new(digest) == token\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) \n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n \tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n \tend",
"def matches?( crypted, *tokens )\n crypted == join_tokens( tokens )\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_token_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute ,token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) #remeber_token variabile locale non della classe\n end",
"def authenticated?(auth_token)\n return false if auth_token_digest.nil?\n BCrypt::Password.new(auth_token_digest).is_password? (auth_token)\n end",
"def authenticated?(attribute, token)\n\tdigest = send(\"#{attribute}_digest\")\n\treturn false if digest.nil?\n\tBCrypt::Password.new(digest).is_password?(token)\nend",
"def authenticated?(attribute,token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n \tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n \t\tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n digest.present? ? BCrypt::Password.new(digest).is_password?(token) : false\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n \treturn false if digest.nil? # fix kada imamo 2 browsera\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n\n end",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil? \n \n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def require_token\n today = Time.now\n today_string = today.to_date.to_s\n yesterday_string = today.yesterday.to_date.to_s\n return false unless [today_string, yesterday_string].include?(params[:salt])\n params[:token] == token_with_salt(params[:salt])\n end",
"def authenticated?(token)\n digest = self.otp_digest\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def hashes_match?\n ar = @ar.clone\n\n digest_value = ar.at_css(\n 'xmlns|DigestValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content.strip\n\n ar.at_css(\n \"xmlns|Signature\",\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).remove\n\n actual_digest = calculate_digest(ar)\n\n if digest_value == actual_digest\n true\n else\n false\n end\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end"
] | [
"0.7857136",
"0.75394505",
"0.743387",
"0.7321885",
"0.714117",
"0.714117",
"0.71279824",
"0.7091808",
"0.705077",
"0.6928193",
"0.6892255",
"0.6887895",
"0.6860336",
"0.6815546",
"0.6793302",
"0.678842",
"0.67861015",
"0.678452",
"0.67813665",
"0.67691225",
"0.6757527",
"0.67563987",
"0.6738151",
"0.67285985",
"0.67285264",
"0.67263824",
"0.67236006",
"0.6713979",
"0.6706749",
"0.67005587",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.6697641",
"0.66975904",
"0.66963786",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66899925",
"0.66887474",
"0.668866",
"0.665649",
"0.66473365",
"0.6646231",
"0.6646231",
"0.6646231",
"0.6646231",
"0.6646231",
"0.6646231"
] | 0.0 | -1 |
Sends password reset email. | def send_password_reset_email
UserMailer.password_reset(self).deliver_now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_passwordreset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver!\r\n end",
"def send_password_reset_email\n AgentMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n PasswordResetMailer.password_reset_email(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_reset_email\n\t\tUserMailer.reset_password(self).deliver_now\n\tend",
"def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def send_password_reset_email\n \tUserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n create_password_reset_digest\n update_attribute(:sent_reset_at, Time.zone.now)\n UserMailer.password_reset(self).deliver_later\n end",
"def send_password_reset_email\n\t\tMemberMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n GolferMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n #UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end"
] | [
"0.87891245",
"0.86781377",
"0.86781377",
"0.8662409",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.86614615",
"0.8657558",
"0.86509216",
"0.86493695",
"0.864714",
"0.8631843",
"0.8631843",
"0.8631843",
"0.8631843",
"0.8631843",
"0.8631843",
"0.8627135",
"0.86175627",
"0.8582117",
"0.8541502",
"0.8540401",
"0.85380363",
"0.8529941",
"0.8517764",
"0.8516587",
"0.84987366",
"0.8480583",
"0.8480583",
"0.8480583",
"0.8480583",
"0.8480583",
"0.8480583",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324",
"0.84728324"
] | 0.85449773 | 26 |
Sets the password reset attributes | def create_reset_digest
self.reset_token = User.new_token
update_columns(reset_digest: User.digest(reset_token), reset_sent_at: Time.zone.now)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end",
"def set_password_reset\n self.make_password_reset_code\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end",
"def reset_password(password)\n self.termpassword = password\n save\n end",
"def send_reset_password_instructions\n end",
"def password_set(password)\n self.password.set password\n self.passwordconfirm.set password\n end",
"def attempt_set_password(params)\n\t p = {}\n\t p[:password] = params[:password]\n\t p[:password_confirmation] = params[:password_confirmation]\n\t update_attributes(p)\n end",
"def attempt_set_password(params)\n p={}\n p[:password]=params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def reset_password\n update_attribute(:password_reset_code, nil)\n @reset_password = true\n end",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token if self.class.require_password_confirmation\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes p\n end",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token\n end",
"def reset_password() \n self.password_confirmation = self.password = self.login\n \n self.save\n end",
"def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end",
"def set_initial_password_reset!\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc\n save(validate: false)\n raw\n end",
"def password_reset\n applicant = Applicant.first\n applicant.reset_token = Applicant.new_token\n ApplicantMailer.applicant_password_reset(applicant)\n end",
"def attempt_set_password(params)\n update_attributes(password: params[:password], password_confirmation: params[:password_confirmation])\n end",
"def send_reset_password_instructions(attributes = T.unsafe(nil)); end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n ShepherdMailer.password_reset(shepherd)\n end",
"def password_reset\n tester = Tester.first\n tester.reset_token = Tester.new_token\n TesterMailer.password_reset(tester)\n end",
"def reset_password\n\t\tself.password_reset_token = User.new_token\n\t\tupdate_columns(password_reset_digest: User.digest(self.password_reset_token), password_reset_sent_at: Time.zone.now)\n\tend",
"def send_password_resets\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save!\n NotificationsMailer.password_reset_mail(self).deliver\n end",
"def password_reset\n employee = Employee.first\n employee.reset_token = Employee.new_token\n EmployeeMailer.password_reset(employee)\n end",
"def reset_password\n temporary_password = ActiveSupport::SecureRandom.base64(6)\n self.password = temporary_password\n self.password_confirmation = temporary_password\n temporary_password\n end",
"def send_reset_password_instructions; end",
"def reset_password!\n password = PasswordGenerator.random_pronouncable_password(3)\n self.password = password\n self.password_confirmation = password\n save\n UserMailer.deliver_reset_password(self)\n end",
"def reset_password!\n reset_password\n save_without_session_maintenance(validate: false)\n end",
"def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end",
"def create_reset_digest\n totp = ROTP::TOTP.new(\"base32secret3232\")\n self.reset_token = totp.now\n update_attribute(:reset_password_token, self.reset_token)\n update_attribute(:reset_password_sent_at, Time.zone.now)\n end",
"def set_password_reset_request\n @password_reset_request = PasswordResetRequest.find(params[:id])\n end",
"def password_reset\n doctor = Doctor.first\n doctor.reset_token = Doctor.new_token\n DoctorMailer.password_reset(doctor)\n end",
"def password_reset\n participant = Participant.first\n participant.reset_token = Participant.new_token\n ParticipantMailer.password_reset(participant)\n end",
"def reset_password\n @user = User.last\n @user.password_reset_token = \"12345\"\n @user.password_reset_sent_at = Time.zone.now\n mail = UserMailer.reset_password(@user)\n end",
"def password_reset\n user = SbUser.first\n user.reset_token = SbUser.new_token\n SbuserMailer.password_reset(user)\n\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = Customer.last\n user.reset_token = Customer.new_token\n CustomerMailer.password_reset(user)\n end",
"def password_reset\n owner = Owner.first\n owner.reset_token = Owner.new_token\n Owner::UserMailer.password_reset(owner)\n end",
"def password_reset\n \tuser = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token #присваивается значение токена сброса пароля\n UserMailer.password_reset(user)\n end",
"def send_reset_password_instructions(attributes = {})\n recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)\n recoverable.send_reset_password_instructions if recoverable.persisted?\n recoverable\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n member = Member.first\n member.reset_token = Member.new_token\n MemberMailer.password_reset(member)\n end",
"def reset_password(new_password, new_password_confirmation); end",
"def password_reset\n player = Player.first\n player.reset_token = Player.new_token\n PlayerMailer.password_reset(player)\n end",
"def password_reset\nemployee = Employee.first\nemployee.reset_token = Employee.new_token\nEmployeeMailer.password_reset(employee)\nend",
"def password_reset\n # ShopMailer.password_reset\n shop = Shop.first\n shop.reset_token = Shop.new_token\n ShopMailer.password_reset(shop)\n end",
"def reset_password!(user)\n self.class.ignore_blank_passwords = false\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n save\n end",
"def reset_password!\n reset_password\n save_without_session_maintenance(false)\n end",
"def password_reset\n user = Volunteer.first\n user.reset_token = Volunteer.new_token\n VolunteerMailer.password_reset(user)\n end",
"def reset_password\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.now\n save!\n UserMailer.delay.password_reset(self)\n end",
"def password_reset\n user = Investor.first\n user.activation_token = Investor.new_token\n NemabollonMailer.password_reset(user)\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n update_attributes!(password_reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver\n end",
"def reset!\n self.password_cost = 9\n end",
"def password_reset\n user = User.first\n user.password_reset_token = new_token\n email = EmailAddress.find_by(id: user.primary_email_address_id).email\n UserMailer.password_reset(user, email)\n end",
"def reset_password!\n verifications.password_reset.create(recipient: address)\n end",
"def set_password\n @password = Password.last\n @new_password = Password.new\n end",
"def reset_password!\n new_password = Digest::MD5.hexdigest(Time.now.to_s.split(//).sort_by {rand}.join)[0, 10]\n self.password = new_password\n self.password_confirmation = new_password\n save!\n end",
"def password_reset\n user = RailsTutorial::Sample::User.first\n user.reset_token = RailsTutorial::Sample::User.new_token\n RailsTutorial::Sample::UserMailer.password_reset(user)\n end",
"def create_reset_digest\r\n update_attribute(:reset_password_sent_at, Time.zone.now)\r\n end",
"def password_reset\n gamer = Gamer.first\n gamer.reset_token = Gamer.new_token\n GamerMailer.password_reset(gamer)\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def send_password_reset\r\n # Generate password reset token\r\n self.password_reset_token = SecureRandom.urlsafe_base64\r\n # Set timestamp of when password reset was sent\r\n self.password_reset_sent_at = Time.zone.now\r\n # Do not run data validation upon saving the user\r\n save!(validate: false)\r\n # Notify the user that password reset instructions have been sent to their email\r\n UserMailer.password_reset(self).deliver\r\n end",
"def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end",
"def reset_password\n new_password = SecureRandom.hex(5)\n update_attributes!(:password => new_password )\n return new_password\n end",
"def disable_password_reset\n @attributes[:disable_password_reset]\n end",
"def reset_params\n params.permit(:reset_password_token, :password, :password_confirmation)\n end",
"def reset_user_password\n temp_password = generate_password(20)\n User.update_all(\"activation_code = '#{temp_password}', recently_reset = 1, updated_at = '#{Time.now}'\", \"id = #{self.id}\")\n UserMailer.reset_password(self.id, temp_password).deliver\n end",
"def password_reset\n user = User.first\n user.create_reset_digest\n UserMailer.password_reset(user.id, user.reset_token)\n end",
"def send_password_reset\n self.password_reset_sent_at = Time.now\n update_attribute(:password_reset_token, genrate_tokn(:password_reset_token) )\n UserMailer.password_reset(self).deliver\n end",
"def password_reset_request\n end",
"def send_password_reset\n \tgenerate_reset_token(:password_reset_token)\n \tself.password_reset_sent_at = Time.zone.now\n \tsave!(validate: false)\n \tUserMailer.password_reset(self).deliver\n end",
"def send_reset_password_instructions \n if self.confirmed?\n super \n else\n errors.add :base, \"You must receive an invitation before you set your password.\" \n end\n end",
"def reset_password!(user)\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n save\n end"
] | [
"0.7346467",
"0.72117406",
"0.71095175",
"0.6930916",
"0.68712664",
"0.68263495",
"0.6816177",
"0.6814454",
"0.6810618",
"0.6797832",
"0.6779232",
"0.6750862",
"0.675002",
"0.6744577",
"0.6740439",
"0.67244756",
"0.67201275",
"0.6704257",
"0.66986483",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.66656804",
"0.6647431",
"0.664322",
"0.66309035",
"0.6630674",
"0.6615894",
"0.6602706",
"0.65820783",
"0.6568294",
"0.6551306",
"0.65451443",
"0.6536271",
"0.6519197",
"0.6515598",
"0.651156",
"0.6508162",
"0.6507514",
"0.6504046",
"0.64944637",
"0.6491074",
"0.64853543",
"0.6478053",
"0.6468212",
"0.6452437",
"0.6452437",
"0.6452437",
"0.6452437",
"0.6452437",
"0.6452437",
"0.6452437",
"0.64470565",
"0.64470565",
"0.6434182",
"0.6432129",
"0.64244217",
"0.6413099",
"0.6365982",
"0.6364186",
"0.63641787",
"0.6355185",
"0.6343216",
"0.63286054",
"0.6311045",
"0.6303419",
"0.6302998",
"0.63020116",
"0.6296761",
"0.62927353",
"0.62886554",
"0.6283078",
"0.62813336",
"0.6279503",
"0.6279503",
"0.6279503",
"0.6278292",
"0.62708086",
"0.6261021",
"0.625805",
"0.625216",
"0.6251243",
"0.62498343",
"0.62487024",
"0.6243326",
"0.6241291",
"0.6241275",
"0.6232541"
] | 0.0 | -1 |
Returns true if a password reset has expired. | def password_reset_expired?
reset_sent_at < 2.hours.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset_expired?\n reset_sent_at < Settings.timeout_reset_password.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # password reset sent earlier than two hours ago.\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # reads as password reset sent earlier than 2 hours ago\n end",
"def password_reset_expired?\n reset_password_sent_at < 1.hours.ago\n end",
"def password_reset_expired?\r\n reset_sent_at < 2.hours.ago\r\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago rescue true\n end",
"def password_reset_expired?\n reset_sent_at && (reset_sent_at < 2.hours.ago)\n end",
"def password_reset_expired?\n reset_sent_at.nil? || reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n\t\tself.reset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n # Is password reset sent EARLIER than two ours ago?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n \n # “Password reset sent earlier than two hours ago.” \n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n # Read as 'password reset sent earlier than two hours ago'.\n end",
"def password_reset_expired?\n reset_sent_at < 24.hours.ago\n end",
"def password_reset_expired?\n # read this as \"password reset sent earlier than 2 hours ago\"\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n # TODO: the '2' hour expiration should be defined in an app constant\n self.password_reset_sent_at < 2.hours.ago\n end",
"def is_password_reset_expired?\n password_reset_sent_at < 6.hours.ago\n end",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago # date helpers\n\tend"
] | [
"0.8866848",
"0.8742425",
"0.87405956",
"0.869067",
"0.86877984",
"0.86600757",
"0.86578995",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.8651915",
"0.8649047",
"0.86207587",
"0.8620148",
"0.86081725",
"0.85921174",
"0.85636353",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.85509175",
"0.8548381",
"0.8532137",
"0.85205406",
"0.85158783",
"0.84688014"
] | 0.86076194 | 26 |
Returns a user's status feed. | def feed
# Using a sub-select is more efficient. The entire query is performed in the database.
following_ids = "SELECT followed_id FROM relationships
WHERE follower_id = :user_id"
Micropost.where("user_id IN (#{following_ids})
OR user_id = :user_id", user_id: id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed\n get '/users/self/feed', auth_params\n end",
"def user_live_feed(user_id, params = {})\n get(\"/v1/users/#{user_id}/live\", params)\n end",
"def username_feed(username)\n\t\t\tid = search_user(username)['data'][0]['id']\n\t\t\tfeed = user_feed(id)\t\t\t\n\t\t\treturn feed\n\t\tend",
"def index\n @user_feeds = UserFeed.find_all_by_user_id(current_user.id)\n end",
"def status\n Twitter::Status.new(@status.merge(:user => self.to_hash.delete(:status))) if @status\n end",
"def feed_status_summary feed\n entry_report =\n case nmatches = feed.feed_entries.size\n when 0\n \"No entries\"\n when 1\n \"One entry\"\n else\n \"#{nmatches} entries\"\n end\n time_report = (feed.updated_at.today?) ? \"Today\" : \"#{time_ago_in_words feed.updated_at} ago\"\n update_button = feed_update_button feed\n \"#{entry_report}/<br>#{time_report} #{update_button}\".html_safe\n end",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Status.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"def feed\n FeedItem.from_users_followed_by(self)\n end",
"def show\n @entries = @feed.entries.for_user(current_user.id, @@per_page).paginate(page: params[:page], per_page: @@per_page).set_read_attribute\n @unread_entries_count = @feed.entries.for_user(current_user.id,nil).where(reads: {read: false}).count\n end",
"def user_timeline(options = {})\n @req.get(\"/1.1/statuses/user_timeline.json\", options)\n end",
"def query\n url = \"/statuses/friends_timeline.xml\"\n uri = URI.parse(@source.url+url)\n\n # Login authentication. The logic is taken from basecamp_projects.rb\n req = Net::HTTP::Get.new(uri.path, 'Accept' => 'application/xml')\n req.basic_auth @source.login, @source.password\n\n res = Net::HTTP.start(uri.host,uri.port) do |http|\n http.request(req)\n end\n xml_data = XmlSimple.xml_in(res.body); \n @result = xml_data[\"status\"]\n end",
"def statuses\n api.get('status')\n end",
"def get_presence_status(user)\n make_request(:get, \"/presence/#{user}/status\").parsed_response\n end",
"def index\n @event_user_statuses = EventUserStatus.all\n end",
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def user_timeline(username, limit)\n unless @twitterclient\n configinit\n end\n options = {\n :count => limit,\n :include_rts => true\n }\n @twitterclient.user_timeline(username, options)\n end",
"def user_timeline(options={})\n perform_get(\"statuses/user_timeline.#{Twitter.format}\", options)\n end",
"def show\n @event_user_status = EventUserStatus.find(params[:id])\n end",
"def next_public_timeline\n #If this is not the first call of this method, the 'since_id'\n #parameter will be used to fetch entries from that position on.\n param_str = @last_id ? \"?since_id=#{@last_id}\" : \"\"\n doc = REXML::Document.new open(\"http://twitter.com/statuses/public_timeline.xml#{param_str}\").read\n statuses = []\n doc.elements.each(\"/statuses/status\") do |status| \n user = status.elements['user']\n location = user.elements['location'].text || \"unknown\"\n time = Time.parse(status.elements['created_at'].text).strftime(\"%Y%m%d%H%M%S\")\n statuses << {:id => status.elements['id'].text, \n :text => status.elements['text'].text, \n :username => user.elements['name'].text,\n :userid => user.elements['id'].text,\n :time => time,\n :location => location}\n end\n statuses\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def feed\n Post.from_users_followed_by(self)\n end",
"def feed\n Post.from_users_followed_by(self)\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def feed\n\t\t# This is preliminary. See \"Following users\" for the full implementation.\n\t\t#Micropost.where(\"user_id = ?\", id) # \"?\" ensures variable 'id' is properly escaped\n\t\t\t\t\t\t\t# before being used in SQL query\n\t\t\t\t\t\t\t# same as 'microposts' - which references all microposts of the user\n\t\t\t\t\t\t\t# But eventually want not just this user's microposts -- but the\n\t\t\t\t\t\t\t# microposts of the folks he's following\n\t\t\t\t\t\t\t# Otherwise user.microposts would've been fine, rather we want user.feed\n\t\t# rather than show posts by user, show posts by users the user follows\n\t\tMicropost.from_users_followed_by(self) \n\tend",
"def get_user_timeline( id=nil, login=@login, password=@password, type='xml', count=nil )\n \n http = Net::HTTP.new('twitter.com', 80)\n data = http.start do |http_inst|\n path = \"/statuses/user_timeline.#{type}\"\n if id == nil then id = login end\n path += \"?id=#{id}\"\n if count != nil \n path += \"&count=#{count}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n end",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end",
"def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end",
"def status_getuser!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETUSER\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def show\n @user = nil\n id_or_name = params[:id]\n begin\n @user = User.find(id_or_name)\n rescue\n @user = User.find_by_name(id_or_name)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml {\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! directive_tag=:xml, :encoding=> 'utf-8'\n render :xml => xml.user {|u|\n u.id(@user.id)\n u.name(@user.name)\n u.statuses {|ss|\n @user.statuses.each {|stat|\n ss.status {|s|\n s.id(stat.id)\n s.user_id(stat.user_id)\n s.text(stat.text)\n s.geo_tag(stat.geo_tag)\n s.created_at(stat.created_at)\n }\n }\n }\n }\n }\n end\n end",
"def getAllUserFeed(userID)\n i = 0\n feed = Array.new\n feed[i] = getUserProfileFeed(userID, 0, 0)\n count = feed[i][\"count\"]\n i += 1\n while count > 0\n feed[i] = getUserProfileFeed(userID, feed[i-1][\"last_document_id\"], feed[i-1][\"last_event_id\"])\n count = feed[i][\"count\"]\n i += 1\n end\n feed\n end",
"def user_timeline(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/user_timeline', args), params_from_args(args)\n end",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend",
"def index\n follow_ids = current_user.friends.collect { |friend| friend.friend.id }\n follow_ids << current_user.id\n @statuses = Status.find(:all, :conditions => ['user_id IN (?)', follow_ids]).sort_by { |status| status.created_at }.reverse\n @status = Status.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def feeds\n @user = current_user\n @subscribed_ids = @user.subscriptions.pluck(:feed_uid)\n end",
"def status\n statuses.find(:first, :order => \"updated_at DESC\")\n end",
"def to_usmf status\n\n\t\tusmf = USMF.new\n\t\tuser = User.new\n\n\t\tstatus = JSON.parse(status)\n\t\tif status.has_key? 'Error'\n\t\t\tlogger.error(\"tweet malformed\")\n\t\t\traise \"status malformed\"\n\t\tend\n\n\t\t#Retrieving a status from Twitter\n\t\tusmf.service = \"Twitter\"\n\t\tusmf.id = status[\"id_str\"]\n\t\t\n\n\t\tx = status[\"coordinates\"]\n\t\tunless x==nil\n\t\t\tusmf.geo = x[\"coordinates\"]\n\t\tend\n\t\t\n\t\tusmf.application = status[\"source\"]\n\t\t\n\n\t\tx = status[\"place\"]\n\t\tunless x == nil\n\t\t\tusmf.location = x[\"full_name\"] + \" , \" + x[\"country\"]\n\t\tend\n\n\t\tusmf.date = status[\"created_at\"]\n\t\tusmf.text = status[\"text\"]\n\t\tusmf.description = status[\"in_reply_to_status_id_str\"]\n\t\tusmf.likes = status[\"retweet_count\"]\n\n\t\t#Retrieving user\n\t\tx = status[\"user\"]\n\t\tunless x == nil\n\t\t\tuser.name = x[\"screen_name\"]\n\t\t\tuser.real_name = x[\"name\"]\n\t\t\tuser.id = x[\"id_str\"]\n\t\t\tuser.language = x[\"lang\"]\n\n\t\t\tunless x[\"time_zone\"] == nil and x[\"utc_offset\"] == nil\n\t\t\t\tuser.utc = x[\"time_zone\"].to_s + \" + \" + x[\"utc_offset\"].to_s\n\t\t\tend\n\n\t\t\tuser.description = x[\"description\"]\n\t\t\tuser.avatar = x[\"profile_image_url_https\"]\n\t\t\tuser.location = x[\"location\"]\n\t\t\tuser.subscribers = x[\"followers_count\"]\n\t\t\tuser.subscriptions = x[\"friends_count\"]\n\t\t\tuser.postings = x[\"statuses_count\"]\n\t\t\tuser.profile = \"https://twitter.com/#!/#{user.name}\"\n\t\t\tuser.website = x[\"url\"]\n\n\t\t\tusmf.user = user\n\t\t\tusmf.source = \"https://twitter.com/#{usmf.user.name}/status/#{usmf.id}\"\n\t\tend\n\t\t\n\n\t\tusmf.to_users = []\n\t\tusmf.links = []\n\n\t\t#Retrieving entities\n\n\t\tentities = status[\"entities\"]\n\t\tunless entities == nil\n\t\t\n\t\t#Retrieving URLs\n\n\t\t\tx = entities[\"urls\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\tl = Link.new\n\t\t\t\t\tl.href = item[\"url\"]\n\t\t\t\t\t\n\t\t\t\t\tusmf.links << l\n\t\t\t\tend\n\t\t\tend\n\n\t\t#Retrieving all media content\n\n\t\t\tx = entities[\"media\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\tl = Link.new\n\t\t\t\t\tl.title = item[\"type\"]\n\t\t\t\t\tl.thumbnail = item[\"media_url\"]\n\t\t\t\t\tl.href = item[\"url\"]\n\t\t\t\t\t\n\t\t\t\t\tusmf.links << l\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#Retrieving hashtags\n\n\t\t\tx = entities[\"hashtags\"]\n\t\t\tunless x == nil\n\n\t\t\t\tusmf.keywords = \"\"\n\t\t\t\tx.each do |h| \n\n\t\t\t\t\tusmf.keywords += h[\"text\"] + \", \"\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Retrieving mentions\n\n\t\t\tx = entities[\"user_mentions\"]\n\t\t\tunless x == nil\n\t\t\t\tx.each do |item|\n\t\t\t\t\ttu = ToUser.new\n\n\t\t\t\t\ttu.name = item[\"screen_name\"]\n\t\t\t\t\ttu.id = item[\"id_str\"]\n\n\t\t\t\t\tif item[\"id_str\"] == status[\"in_reply_to_user_id_str\"]\n\t\t\t\t\t\ttu.service = \"reply\"\n\t\t\t\t\telse\n\t\t\t\t\t\ttu.service = \"mention\"\n\t\t\t\t\tend\n\t\t\t\t\tunless status[\"in_reply_to_status_id_str\"] == nil\n\t\t\t\t\t\ttu.title = status[\"in_reply_to_status_id_str\"]\n\t\t\t\t\t\ttu.href = \"https://twitter.com/#{tu.name}/status/#{tu.title}\"\n\t\t\t\t\tend\n\n\t\t\t\t\tusmf.to_users << tu\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\tusmf\n\n\tend",
"def status(id)\n get(\"mailers/status/#{id.to_i}\")\n end",
"def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end",
"def feed_target\n User.find_by(id: feed_id)\n end",
"def rss\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 # If the everybody flag is set, respond with feed items about everybody\n # on Blavel\n # Otherwise, respond with feed items only about the people that the\n # current user is following\n @everybody = params[:everybody]\n if @everybody\n @feed_items = gather_feed_items\n else\n @feed_items = gather_feed_items(current_user)\n end\n\n rescue ActiveRecord::RecordNotFound => error\n logger.info error\n flash[:notice] = 'The user you requested does not exist.'\n redirect_to '/'\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end",
"def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def show\n if @user != current_user\n redirect_to :action => 'feed', :id => @user.id\n end\n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def profile_feeds(is_current_user = false)\n res = @user.contents.includes(:hash_tags, :owner, :user).ignore_daily_devotions\n unless is_current_user\n @user.user_anonymities.pluck(:start_time, :end_time).each do |range|\n res = res.where.not(created_at: range.first..(range.last || Time.current))\n end\n end\n res.order(created_at: :desc).page(@page).per(@per_page)\n end",
"def public_timeline\n call( 'statuses/public_timeline.json' )\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.from_users_followed_by(self)\n end",
"def get_user_calendar_xml # :nodoc:\n response = session.get(USER_FEED)\n Nokogiri::XML(response.body)\n end",
"def get_feed\n return unless @access_granted\n begin\n raw_activity_feed = @worker.fetch_user_activity\n @processed_feed = @processor.process_feed(raw_activity_feed)\n rescue Exception => e\n Rails.logger.info \"#{self.class.name} with exception: #{e.message}\"\n end\n end",
"def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n \tend",
"def set_user_feed\n @feed = current_user.subscriptions.find(params[:id])\n end",
"def fetch_user_timeline\n statuses = client.user_timeline(user_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :posted)\n update_max_user_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def statuses; end",
"def get_user_status(user_id)\n\t\treturn nil if not party_list[user_id]\n\t\treturn party_list[user_id][:status]\n\tend",
"def status\n get_json('status.json')\n end",
"def feed\n Answer.where(\"user_id = ?\", id)\n end",
"def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end",
"def feed\n # defer to Micropost.from_users_followed_by\n Micropost.from_users_followed_by(self)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def index\n @feeds = current_user.subscriptions.ordered_by_title\n @entries = current_user.entries.for_user(current_user.id, @@per_page).paginate(page: params[:page], per_page: @@per_page).set_read_attribute\n @unread_entries_count = current_user.reads.where(read: false).count \n end",
"def feed\n if current_user\n feed = []\n Event.where(user_id: current_user.id).each do |event|\n event.comments.each do |comment|\n if (DateTime.current - comment.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << comment\n end\n end\n event.file_attachments.each do |file|\n if (DateTime.current - file.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << file\n end\n end\n end\n respond_with feed\n else\n redirect_to root_path\n end\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def feed\n Micropost.where(\"user_id = ?\", id)\n end",
"def user_timeline(screen_name)\n #need to handle invalid data\n @client.user_timeline(screen_name).take(20)\n end",
"def read_users(status=nil)\n # if a filter is provided for the status then set it otherwise just search for people\n # Note: The filter will not capture users that do not have their status set. \n if status\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:status].to_s, status ? status : \"*\")\n else\n filter = Net::LDAP::Filter.eq(:objectClass, \"inetOrgPerson\")\n end\n return search_map_user_fields(filter)\n end",
"def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end",
"def status\n get('/api/status')\n end",
"def index\n @feed_items = @user.feed_items\n render json: @feed_items\n end",
"def friend_feed(options={})\n get('/feed', options)\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def feed\n Post.where(\"user_id IN (?) OR user_id = ?\", friend_ids, id).feed\n end",
"def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end",
"def status_for(user)\n return \"NEW!\" if user.last_logout.nil?\n\n\n if created_at > user.last_logout\n \"NEW!\"\n elsif updated > user.last_logout\n \"UPDATED!\"\n else\n \"\"\n end\n end",
"def feed\n Survey.where(\"user_id = ?\", id)\n end",
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def index\n @master_user_statuses = MasterUserStatus.all\n end",
"def get_activity (user)\n user_state[user]\n end",
"def show\n @users = User.where(validate_status: 1)\n end"
] | [
"0.6737085",
"0.66459346",
"0.6458702",
"0.63994145",
"0.6398368",
"0.6332916",
"0.6291411",
"0.62239045",
"0.6168492",
"0.6140585",
"0.61130196",
"0.6111324",
"0.60560274",
"0.6045318",
"0.60336715",
"0.6002429",
"0.5992754",
"0.59684235",
"0.5960727",
"0.59190536",
"0.59177595",
"0.59177595",
"0.5912898",
"0.5912898",
"0.5887916",
"0.5882246",
"0.58679247",
"0.5854399",
"0.5845294",
"0.5844251",
"0.58437526",
"0.5842074",
"0.58406293",
"0.5821292",
"0.5810846",
"0.5810846",
"0.5810846",
"0.57911855",
"0.5788397",
"0.57809174",
"0.57800424",
"0.5776642",
"0.5775065",
"0.5765634",
"0.5765276",
"0.57617533",
"0.5757431",
"0.5755286",
"0.575",
"0.57488513",
"0.5732055",
"0.57191277",
"0.57102746",
"0.5707216",
"0.5707216",
"0.5706055",
"0.5706055",
"0.5706055",
"0.5706055",
"0.5706055",
"0.5706055",
"0.5706055",
"0.5706055",
"0.57004184",
"0.5694403",
"0.56938064",
"0.5693177",
"0.56890744",
"0.56811106",
"0.56784236",
"0.5678077",
"0.5657327",
"0.56544155",
"0.56503624",
"0.5642564",
"0.56407136",
"0.56375575",
"0.56316996",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56299144",
"0.56298494",
"0.5628777",
"0.56098264",
"0.56086487",
"0.56052876",
"0.5603349",
"0.56002504",
"0.55932665",
"0.55899185",
"0.55844605",
"0.5583512",
"0.5581353",
"0.55737555",
"0.55723387",
"0.55665916"
] | 0.0 | -1 |
Returns true if the current user is following the other user. | def following?(other_user)
following.include?(other_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n\t\t\tfollowing.include?(other_user)\n\t\tend",
"def following?(other_user)\n current_user.following.include?(other_user)\n end",
"def following?(other_user)\n\t following.include?(other_user)\n\tend",
"def following?(other_user)\n following.exists?(other_user.id)\n end",
"def following?(other_user)\n\t following.include?(other_user)\n \tend",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end"
] | [
"0.85312015",
"0.85117656",
"0.85117656",
"0.85117656",
"0.84812355",
"0.84812355",
"0.84812355",
"0.84812355",
"0.84238315",
"0.8413351",
"0.8333338",
"0.83173794",
"0.83137536",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666",
"0.83066666"
] | 0.8340864 | 21 |
Converts email to all lowercase. | def downcase_email
self.email.downcase!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downcase_email\n\t email.downcase!\n\t end",
"def downcase_email\n email.downcase!\n end",
"def lowercase_email\n email.downcase! if email.present?\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n\t\t\t# self.email = email.downcase\n\t\t\temail.downcase!\n\t\tend",
"def downcase_email\n \t email.downcase!\n \t end",
"def normalize\n @normalized_email = email.downcase\n normalized_email\n end",
"def downcase_email\n # self.email = email.downcase\n email.downcase!\n end",
"def downcase_email\n self.email.downcase!\n end",
"def downcase_email\n self.email.downcase!\n end",
"def downcase_email\n self.email.downcase!\n end",
"def downcase_email\n email.downcase\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n email.downcase!\n end",
"def downcase_email\n\t self.email = email.downcase\n\t end",
"def downcase_email\n email.downcase! #same as self.email = email.downcase\n end",
"def downcase_email\n email.downcase if email\n end",
"def downcase_email\r\n self.email = email.downcase\r\n end",
"def downcase_email\n self.email.downcase!\n end",
"def upcase_email_for_lansa(email_address)\n email_address.strip.upcase\n end",
"def downcase_email\n return if email.present?\n\n email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase if self.email?\n end",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n\t\tself.email = email.downcase\n\tend",
"def downcase_email\n self.email = email.downcase if self.email\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n #self.email = email.downcase\n email.downcase!\n end",
"def downcase_email\n\t\t\tself.email = email.downcase\n\t\tend",
"def downcase_email\n\t\t\tself.email = email.downcase\n\t\tend",
"def downcase_email\n\t\t\tself.email = email.downcase\n\t\tend",
"def downcase_email\n\t\t\tself.email = email.downcase\n\t\tend",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = self.email.delete(' ').downcase\n end",
"def lower_email\n self.email.downcase!\n self.name.downcase!\n end",
"def downcase_email\n unless self.email == nil\n self.email = email.downcase\n end\n end",
"def downcase_email\n self.email=email.downcase\n end",
"def scrub_email_address\n self.email_address.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end",
"def downcase_email\n self.email = email.downcase\n end"
] | [
"0.8380517",
"0.8339932",
"0.8242504",
"0.82153374",
"0.82153374",
"0.82153374",
"0.82153374",
"0.8192566",
"0.8161937",
"0.8131639",
"0.8121609",
"0.80987734",
"0.80987734",
"0.80987734",
"0.80724174",
"0.80567265",
"0.80567265",
"0.80567265",
"0.80567265",
"0.7995695",
"0.79493546",
"0.79492545",
"0.7946815",
"0.7941056",
"0.79397255",
"0.79375124",
"0.7910245",
"0.7910245",
"0.7910245",
"0.7910245",
"0.789384",
"0.78903323",
"0.78903323",
"0.78791744",
"0.78744006",
"0.78732336",
"0.78732336",
"0.78732336",
"0.78732336",
"0.78732336",
"0.7870142",
"0.78699356",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78521395",
"0.78515804",
"0.7851243",
"0.7849554",
"0.7842238",
"0.7842238",
"0.7842238",
"0.7842238",
"0.784156",
"0.784156",
"0.7838761",
"0.78177863",
"0.78153497",
"0.776998",
"0.77623004",
"0.7757589",
"0.7742339"
] | 0.8112856 | 11 |
Creates and assigns the activation token and digest | def create_activation_digest
self.activation_token = User.new_token
# Since the user model has an 'activation_digest' attribute,
# the following will be automatically saved to the database upon user creation
self.activation_digest = User.digest(activation_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_token_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Direccion.new_token\n self.activation_digest = Direccion.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(self.activation_token)\n end",
"def create_activation_digest\n self.activation_token = Profile.new_token\n self.activation_digest = Profile.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Person.new_token\n self.activation_digest = Person.digest(activation_token)\n end",
"def create_activation_digest\n # Create the token and digest.\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token=User.new_token\n self.activation_digest=User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Gamer.new_token\n self.activation_digest = Gamer.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token=User.new_token\n self.activation_digest=User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Admin.new_token\n self.activation_digest = Admin.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n\t self.activation_token = User.new_token\n\t self.activation_digest = User.digest(activation_token)\n\t end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.token\n self.activation_digest = User.digest(self.activation_token)\n end",
"def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend",
"def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend",
"def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend",
"def create_activation_digest\n\t\tself.activation_token = User.new_token\n\t\tself.activation_digest = User.digest(activation_token)\n\tend",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n\t\t\tself.activation_token = User.new_token\n\t\t\tself.activation_digest = User.digest(activation_token)\n\t\tend",
"def create_activation_digest\n\t\t\tself.activation_token = User.new_token\n\t\t\tself.activation_digest = User.digest(activation_token)\n\t\tend",
"def create_activation_digest\n\t\t\tself.activation_token = User.new_token\n\t\t\tself.activation_digest = User.digest(activation_token)\n\t\tend",
"def create_activation_digest\n #create the token and digest here\n self.activation_token = Doctor.new_token\n self.activation_digest = Doctor.digest(activation_token)\n end",
"def create_activation_digest\n self.activation_token = Staff.new_token\n self.activation_digest = Staff.digest(activation_token)\n end",
"def create_activation_digest\n # PRzypisanie wygenerowanego tokenu, przy pomocy funkcji new_token\n self.activation_token = User.new_token\n # zakodowanie activation tokenu. \n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest # self is only used for assignments, hence\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest\n\t\t\tself.activation_token = User.new_token\n\t\t\tself.activation_digest = User.digest(activation_token)\n\t\tend",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n $activation_token = activation_token #to support cucumber activation tests\n end",
"def create_activation_digest\n self.activation_token = Member.new_token\n self.activation_digest = Member.digest(self.activation_token)\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.update_attribute(:activation_digest, User.digest(activation_token))\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n update_attribute(:activation_digest, User.digest(activation_token))\n end",
"def create_activation_digest\n\t\t\tself.activation_token = Member.new_token\n\t\t\tself.activation_digest = Member.digest(activation_token)\n\t\tend",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(remember_token)\n end",
"def create_activation_digest\n self.activation_token = Band.new_token\n self.activation_digest = Band.digest(activation_token)\n end",
"def create_activation_digest\r\n self.activation_token = def new_token\r\n self.activation_digest = User.digest(activation_token)\r\n end\r\nend",
"def create_activation_digest #before user creation completion, assign a token and digest to that user in the database for account activation\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end",
"def create_activation_digest # called by before_create so auto save into DB\n self.activation_token = User.new_token # vitrual abttribute\n self.activation_digest = User.digest activation_token # abttribute in DB\n end",
"def create_activation_digest\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n if new_record?\n return\n else\n update_columns(activation_digest: User.digest(activation_token))\n end \n end",
"def create_activation_digest\n self.activation_code = User.new_code\n update_columns(activation_digest: User.digest(activation_code), \n activation_sent_at: Time.zone.now)\n end",
"def create_registration_digest\n self.registration_token = LocalIdentity.new_token\n update_attribute(:registration_digest, LocalIdentity.digest(self.registration_token))\n end",
"def create_activation_token\n payload = { email: self.email }\n self.activation_token = JsonWebToken.encode(payload)\n end"
] | [
"0.8696872",
"0.8685808",
"0.8668821",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86506444",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.86467624",
"0.8641853",
"0.86381954",
"0.863171",
"0.86262524",
"0.8621547",
"0.86190665",
"0.8605611",
"0.8603339",
"0.8602794",
"0.8595471",
"0.85954547",
"0.85948384",
"0.85948384",
"0.85948384",
"0.85948384",
"0.85948384",
"0.85948384",
"0.85948384",
"0.85948384",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.8591352",
"0.85903084",
"0.8556046",
"0.8552408",
"0.85482264",
"0.85482264",
"0.8546512",
"0.8542545",
"0.8542545",
"0.8542545",
"0.8542545",
"0.85345453",
"0.85288656",
"0.84960806",
"0.84960806",
"0.84960806",
"0.848923",
"0.8487921",
"0.8483313",
"0.8481057",
"0.8480869",
"0.8475567",
"0.84541357",
"0.8435303",
"0.84177667",
"0.838739",
"0.83029747",
"0.8255649",
"0.823899",
"0.82241595",
"0.80394846",
"0.7824271",
"0.73099566",
"0.7184964",
"0.6926942"
] | 0.83503246 | 91 |
Options: "null_value" => "_null_" | def initialize field, options = {}
@field = field
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_null\n allow = opts[ :null ]\n allow.nil? || allow\n end",
"def set_null(params)\n params == \"NA\" ? \"null\" : params\n end",
"def format_value_to_null(_value)\n 'null'\n end",
"def optionalize\n without_values(nil)\n end",
"def replace_null(value)\n return 'U' if value.nil?\n\n value\nend",
"def null\n end",
"def null?; false end",
"def allow_nil?\n @opts.fetch(:allow_nil, false)\n end",
"def null?\n false\n end",
"def null?\n false\n end",
"def replace_nil\n lambda { |val| val.nil? ? 'NULL' : val }\n end",
"def set_ps_arg_nil(cps, i)\n cps.setNull(i, cps.getParameterMetaData.getParameterType(i))\n end",
"def null?; @null; end",
"def displayNull \n \"displayNull\" \n end",
"def set_ps_arg_nil(cps, i)\n cps.setNull(i, JavaSQL::Types::NULL)\n end",
"def build_null_object(value)\n Class.new(base_class) {\n @option = value\n @index = 0\n delegate :blank?, :nil?, :to => :option\n }.new\n end",
"def objNull \n \"objNull\" \n end",
"def nil \n \"nil\" \n end",
"def short(options = T.unsafe(nil)); end",
"def null?\n true\n end",
"def inspect\n 'null'\n end",
"def inspect\n 'null'\n end",
"def nil?; false; end",
"def is_null\n @value, @operator = nil, :is_null\n self\n end",
"def nullable\n self['nullable']\n end",
"def null_or_value(value)\n return \"NULL\" if value.empty?\n # Escape any single quotes to encure values returned do not not cause\n # issues with the SQL insert statement\n return \"'#{value.gsub(\"'\", \"\\\\\\\\'\")}'\"\nend",
"def null\n Sass::Script::Value::Null.new\n end",
"def default(options = T.unsafe(nil)); end",
"def null?\n false\n end",
"def null?\n false\n end",
"def null?\n true\n end",
"def enforce_not_null(options = {})\n args = build_validation_args(options, :not_null, :blank)\n return if args.first.is_a?(Hash)\n validates_presence_of(*args)\n end",
"def nil_if_blank\n NULL_ATTRS.each { |attr| self[attr] = nil if self[attr].blank? }\n end",
"def null?\n false\n end",
"def write_nil\n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end",
"def test_as_json_object_null\n obj = Orange.new(true, 58)\n json = Oj.dump(obj, :mode => :null)\n assert_equal('null', json)\n end",
"def set_nil(value)\n value.nil? ? NullObject.instance : value\n end",
"def null_byte_parameter_value(key, value)\n nil\n end",
"def recommended_value; nil; end",
"def nil?() true; end",
"def option(criteria = T.unsafe(nil)); end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def default_nulls_option(direction)\n case direction\n when :asc then :last\n when :desc then :first\n else raise \"Bad direction: #{direction.inspect}\"\n end\n end",
"def test_object_null\n obj = Jam.new(true, 58)\n json = Oj.dump(obj, :mode => :null)\n assert_equal('null', json)\n end",
"def process_nil(exp)\n return \"NULL\"\n end",
"def null?\n false\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nil?() end",
"def nil?() end",
"def add_option(name, value = T.unsafe(nil)); end",
"def allow_empty_options\n true\n end",
"def format_null(params = {}, &block)\n component[:null_formatter] = (params[:using] or block)\n component[:null_formatter] ||= proc do |value|\n params[:with] % value\n end\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def toggle_param_zero(obj)\n if obj.value.to_s == \"0\"\n obj.value = nil\n else\n obj.value = \"0\"\n end\n return obj\n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil unless args[:byte_size].present?\n args\n end",
"def process_nil(exp)\n return \"Qnil\"\n end",
"def null?\n @kind == :null_kw\n end",
"def null \n return @raw.null \n end",
"def teamMemberNull \n \"teamMemberNull\" \n end",
"def scaffold_search_null_options\n @scaffold_search_null_options ||= scaffold_attributes(:search).reject{|f| scaffold_table_column_type(f).nil?}.collect{|f| [scaffold_column_name(f), f]}\n end",
"def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end",
"def flow_null_values\n return @flow_null_values\n end",
"def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend",
"def numberOptStr\n nil\n end",
"def convert_nillable_string(value, definition)\n value == '-' ? nil : value\n end",
"def is_not_null\n @operator = :is_null\n @negated = true\n self\n end",
"def sql_null_to_blank\n self.map {|v| \"IFNULL(#{v}, '')\" }\n end",
"def set_defaults(options = T.unsafe(nil)); end",
"def data_with_nils\n to_a\n end",
"def default_parameter_for(options)\n default, allow_nil = options.values_at(:default, :allow_nil)\n return ' nil' if default.nil? && allow_nil\n return '' if default.nil? && !allow_nil\n\n \" #{prefix(default)}#{default}#{suffix(default)}\"\n end",
"def or_nil\n get_or_else(nil)\n end",
"def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end",
"def nullable=(val)\n self['nullable'] = val\n end",
"def nullp\n self.parse_null.singleton?\n end",
"def convert_nillable_string(value, _definition)\n value == '-' ? nil : value\n end",
"def nil?\r\n false\r\n end",
"def flow_null_values=(value)\n @flow_null_values = value\n end",
"def optional; end",
"def grpNull \n \"grpNull\" \n end",
"def nil?\n true\n end",
"def nil?\n true\n end",
"def map_null(ident, &block) ; map_primitive(:null, ident, &block) ; end",
"def concat_null(fields) # :nodoc:\n @concat.gsub(/\\%s/, subs(@nul, fields).join(','))\n end",
"def fix_nil_time_values\n if params[:response] && params[:response][:answers_attributes]\n params[:response][:answers_attributes].each do |key, attribs|\n if attribs[\"time_value(4i)\"].blank? && attribs[\"time_value(5i)\"].blank?\n %w[1 2 3].each { |i| params[:response][:answers_attributes][key][\"time_value(#{i}i)\"] = \"\" }\n end\n end\n end\n end",
"def nullable?\n mode == \"NULLABLE\"\n end",
"def controlNull \n \"controlNull\" \n end",
"def serialize(options = T.unsafe(nil)); end",
"def serialize(options = T.unsafe(nil)); end",
"def replace_nil_to_blank(data)\n data[data.index(nil)] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index(nil)\n data[data.index('')] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index('')\n data\n end",
"def scaffold_search_null_options\n @scaffold_search_null_options ||= scaffold_search_fields_replacing_associations.collect do |field|\n [scaffold_column_name(field), field] if columns_hash[field]\n end.compact\n end",
"def nullable?\n @nullable\n end"
] | [
"0.70210624",
"0.7016927",
"0.69164056",
"0.688695",
"0.6710271",
"0.6666045",
"0.6512412",
"0.6500791",
"0.6331238",
"0.6331238",
"0.6280449",
"0.6262283",
"0.6252102",
"0.62466925",
"0.6231183",
"0.6209968",
"0.62059504",
"0.6170421",
"0.61517316",
"0.60883665",
"0.6084081",
"0.6084081",
"0.6068402",
"0.6050735",
"0.6049926",
"0.6047978",
"0.6027564",
"0.5973252",
"0.59704196",
"0.59704196",
"0.5966343",
"0.59542495",
"0.594973",
"0.5930016",
"0.59299046",
"0.592858",
"0.59238976",
"0.5904564",
"0.5902862",
"0.5899841",
"0.58952636",
"0.5887281",
"0.58856463",
"0.58852303",
"0.58835375",
"0.5879926",
"0.5875447",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5867018",
"0.5852373",
"0.5852373",
"0.5835308",
"0.58330894",
"0.58261335",
"0.58185685",
"0.58158135",
"0.5803902",
"0.5800817",
"0.5781212",
"0.57652247",
"0.5763999",
"0.5759718",
"0.57332796",
"0.5731441",
"0.5731132",
"0.57271403",
"0.57203895",
"0.57031566",
"0.56874955",
"0.5678763",
"0.56741095",
"0.5666224",
"0.56490254",
"0.5641039",
"0.56341356",
"0.5626271",
"0.56210566",
"0.5619337",
"0.56179297",
"0.56161314",
"0.5602582",
"0.55838066",
"0.55838066",
"0.55698675",
"0.55661714",
"0.55658114",
"0.55645907",
"0.55619",
"0.55352527",
"0.55352527",
"0.5533438",
"0.5531635",
"0.5518426"
] | 0.0 | -1 |
FIXME this straightsum approach is incomplete also, PostgreSQL should be doing this | def estimate
e = 0
@@mappings.each do |k,v|
counts = eval v.pluralize
counts.each do |obj|
if obj.respond_to? 'population_estimate'
e = e + obj.population_estimate
elsif obj.respond_to? 'population_estimate_min'
# handles the Other case which just has a range
e = e + obj.population_estimate_min
else
strata = eval "obj.#{v}_strata"
strata.each do |stratum|
e = e + stratum.population_estimate
end
end
end
end
e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum; end",
"def sum(column)\n result = all\n\n if result.any?\n result.inject(0.0) do |acc, record|\n if value = record.public_send(column)\n acc += value\n end\n\n acc\n end\n end\n end",
"def visit_axiom_aggregate_sum(sum)\n aggregate_function_sql(SUM, sum)\n end",
"def column_sum(input_query, key)\n input_query.sum(key)\n end",
"def odb_sum\n \"sum(#{to_s})\"\n end",
"def subtotal\n #SQL version of summing which is much faster than Ruby\n line_items.select(\"SUM(quantity * price) AS sum\")[0].sum\n # Ruby version of sum\n # line_items.to_a.sum {|item| item.total}\nend",
"def total_sum\n rows.collect(&:sum_with_vat).sum\n end",
"def sum\n flatten.compact.inject(:+)\n end",
"def sequence_sum\n reduce(:+)\n end",
"def sum\n self.inject(:+)\n end",
"def matrixElementsSum(matrix)\r\n(0..matrix.length-2).each do |floor_number|\r\n\r\n (0..matrix[floor_number].length-1).each do |column_number|\r\n if matrix[floor_number][column_number] == 0\r\n matrix[floor_number+1].delete_at(column_number)\r\n matrix[floor_number+1].insert(column_number, 0)\r\n end\r\n end\r\n \r\nend\r\n\r\nreturn matrix.flatten.inject(:+)\r\n\r\nend",
"def sum\n [@r,@g,@b].inject(:+)\n end",
"def sum\n\t\treturn self.reduce(:+)\n\tend",
"def rowsum a,row\n sum=0\n 0.upto(4){|i| sum+=a[row][i]}\n return sum.to_f\nend",
"def sum\n reduce(0, &:+)\n end",
"def calculate_sum\n 1000000000000\n end",
"def record_sum(session, record_type, database)\n session.send(database).select_one( \\\n \"select sum(number1) + sum(number2) + sum(number3) + sum(number4) as sum\n from big_scan where diff_type = '#{record_type}'\")['sum'].to_f\n end",
"def sum(attr)\n col = column(attr)\n if col.empty?\n 0\n else\n col.reduce(&:+)\n end\n end",
"def sum_column(column_name)\n @result.inject(0.0) { |sum, item_hash|\n if item_hash.has_key?(column_name)\n sum + item_hash[column_name].to_f\n else\n sum\n end\n }\n end",
"def total(rows)\n rows.map { |row| row[\"Money we made\"].to_i }.reduce(:+)\nend",
"def a_very_big_sum arr\n arr.reduce(:+)\n end",
"def sum\n transactions.sum(:amount)\n end",
"def sum\n transactions.sum(:amount)\n end",
"def find_sum\n self.inject(0) { |sum, x| sum + x.to_f }\n end",
"def sum(i) \n i.inject(:+)\nend",
"def sum(sums)\r\n if sums.empty?\r\n 0\r\n else\r\n sums.reduce(:+)\r\n end\r\nend",
"def aVeryBigSum(ar)\n ar.reduce(:+)\nend",
"def sum(memo, tuple)\n sums.each_with_object(memo.dup){|(attribute,summarizer),new_tuple|\n new_tuple[attribute] = summarizer.sum(memo[attribute], tuple[attribute])\n }\n end",
"def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend",
"def sum n\n\tbegin\n\tn.reduce(:+)\n\trescue \n\t\tn.map!{|x| x.is_a?(Array) ? x.reduce(:+) : x }\n\t\tsum n\n\tend\n\tp n.reduce(:+)\nend",
"def sums_all_elements(input)\n input.inject(:+)\n end",
"def sum col_name,field2sum,*fields, &block\n key = key_fields [field2sum] + fields\n @stats[key] = [] unless @stats[key]\n @stats[key] << SumField.new(col_name,block)\n end",
"def sum_of_sums(array)\r\nend",
"def summing_method\n @summed_array = @single_digit_array.sum\n end",
"def element_sum\n\t\tif !self.numeric?\n\t\t\treturn false\n\t\tend\n\t\treturn self.inject(0) {|memo,n| memo + n}\t\n\tend",
"def sum(element)\n element.reduce(:+)\nend",
"def sum_create\n total = add_create.reduce(:+)\nend",
"def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend",
"def sum(arr)\n\tarr.inject (:+)\n\nend",
"def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend",
"def sum(addends)\n addends.inject(0, :+)\n end",
"def sum_using_each(array)\n end",
"def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend",
"def hash_sum(hash)\n return 0 if hash.empty?\n hash.values.inject(&:+)\nend",
"def sum_of_sums(array)\n\n sums_array = []\n\n sum = 0\n array.each do |value|\n sum += value\n sums_array << sum\n end\n \n sums_array.sum\nend",
"def sum_of_sums(arry)\n index = 1\n sum_of_arry = 0\n while index <= arry.size\n sum_of_arry = sum_of_arry + arry.take(index).sum\n index += 1\n end\n puts sum_of_arry\nend",
"def sum\n inject(0) { |acc, i| acc + i }\n end",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum(datablock)\n agg = 0\n datablock.each_char { |a| agg += a.ord}\n return agg\n end",
"def calcular_total hash\n p hash.inject(0) { |sum, tuple| sum += tuple[1] }\n end",
"def sum(data)\n return data.inject{ |sum, n| sum + n }\n end",
"def sum\n self.reduce('lambda{|sum, item| sum + item}')\n end",
"def total(a)\n\ta.reduce(:+)\nend",
"def sum(heading)\n sum = 0\n @rows.each {|row| sum += (row.data[index(heading)].blank? ? 0.0 : row.data[index(heading)])}\n sum\n end",
"def sum_upon_sums(array)\n\nend",
"def sum (tableau)\n chiffre = 0\n tableau.each do |element|\n chiffre = chiffre + element\n end\n return chiffre\nend",
"def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend",
"def naive_parts_sums(ls)\n out_array = []\n while ls.length > 0\n current_sum = ls.sum\n out_array << current_sum\n ls.shift\n end\n out_array << 0\n return out_array\nend",
"def total(array)\n\tarray.inject(:+)\nend",
"def sum(num, total) => total += num",
"def row_totals(rows_in, tot_out)\n\t\tfor logrow in rows_in\n\t\t\t@numeric_col.each do |fld|\n\t\t\t\ttot_out[fld] += logrow.send(fld) if logrow.send(fld)\n\t\t\tend\n\t\tend\n\t\t@numeric_col.each do |fld|\n\t\t\ttot_out[fld] = '' if tot_out[fld] == 0\n\t\tend\n\tend",
"def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend",
"def running_total(numbers)\n sum = 0\n running_sums = []\n numbers.each_with_object(running_sums) do |number, array|\n sum += number\n array << sum\n end\n \n running_sums\nend",
"def part_sums(ls)\n array_of_sum = ls.sum\n return_sums = [array_of_sum]\n ls.each do |val|\n array_of_sum -= val\n return_sums << sum\n end\n sums\nend",
"def parts_sums(ls)\n ls.reduce([ls.sum]) {|s,n| s << s.last - n}\nend",
"def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend",
"def sum(i)\n sum = i.digits.reduce(:+)\n sum\nend",
"def sum roll\n roll.reduce &:+\n end",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def sum_of_sums(array)\n results = []\n\n loop do \n break if array.empty?\n results << array.inject(:+)\n array.pop\n end\n\n results.inject(:+)\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def total(array)\n array.inject(:+)\nend",
"def sum(array)\n\tarray.reduce(:+)\nend",
"def sum_values(arr)\n arr.inject(:+)\n end",
"def sum(a)\n a.reduce(&:+)\nend",
"def sum_values\n points.sum\n end",
"def sum_book( half_orderbook )\n\n half_orderbook.inject(0.0) do |xs, row |\n xs + row[0].to_f * row[1].to_f\n end\n end",
"def ndp_sum; self[:ndp_sum].to_i; end",
"def computeSum(nodes, break_point_index)\n result = Total.new(width: @sum.width, stretch: @sum.stretch, shrink: @sum.shrink)\n\n for i in break_point_index .. nodes.length - 1\n if nodes[i].glue?\n result.width += nodes[i].width\n result.stretch += nodes[i].stretch\n result.shrink += nodes[i].shrink\n\n elsif nodes[i].box? || (nodes[i].penalty? && nodes[i].penalty == -Infinity && i > break_point_index)\n break\n end\n end\n return result\n end",
"def sum arr\n arr.inject(0, :+) \nend",
"def get_sum(a, b)\n [a,b].reduce(&:+)\nend",
"def total(arr)\n arr.inject(:+)\nend",
"def amount_sum_for(meth)\n entries.select(&meth).map{ |entry| entry.amount.to_i }.compact.inject(&:+) || 0\n end",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend",
"def for_sum(input)\n output = 0\n input.each do |el|\n output += el\n end\n output\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def reduce_to_total(source_array, starting_point = 0)\n #source_array.reduce(starting_point) {|sum, n| sum + n}\n i = 0\n sum = starting_point\n while i < source_array.length do\n sum = sum + source_array[i]\n i += 1\n end\n return sum\nend",
"def sum(p = nil)\n output = self.compact\n if p.nil?\n return output.inject(0){ |memo,n| memo + n.to_f }\n else\n return output.inject(0){ |memo,n| memo + n.send(p).to_f }\n end\n end",
"def parts_sums(ls)\n # your code\n sums = []\n \n i = 0\n loop do\n sum = ls.reduce(0){|num, sum| num + sum}\n sums.push(sum)\n ls.shift()\n if i == ls.length\n break \n end\n end\n if sums.length > 1\n sums.push(0)\n end\n sums\n end",
"def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum(arr)\n arr.reduce(0, :+)\nend",
"def sum_expense(expenses)\n sum = expenses.sum\n return sum\nend",
"def square_of_sum(vals)\n vals.reduce(:+) ** 2\nend",
"def total(arr)\n return arr.inject(:+)\nend",
"def aVeryBigSum(ar)\n sum = ar.sum\nreturn sum\nend",
"def total(array)\n\tsum = array.inject(0, :+)\nend",
"def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend"
] | [
"0.6658209",
"0.6530124",
"0.6527941",
"0.6433709",
"0.6385949",
"0.63739604",
"0.6357413",
"0.6303917",
"0.6272823",
"0.6270746",
"0.62623036",
"0.6221295",
"0.6210003",
"0.62016964",
"0.61695623",
"0.61660933",
"0.6165906",
"0.6152174",
"0.6061705",
"0.6043078",
"0.5978181",
"0.5972266",
"0.5972266",
"0.59478414",
"0.5945795",
"0.59405905",
"0.59126365",
"0.5898259",
"0.5888245",
"0.58830386",
"0.58679557",
"0.58559155",
"0.58533204",
"0.5849381",
"0.58277047",
"0.5827408",
"0.581844",
"0.5813005",
"0.5811158",
"0.57989055",
"0.57917666",
"0.5785922",
"0.5785312",
"0.57850665",
"0.5781845",
"0.5781109",
"0.57724047",
"0.5759524",
"0.57505065",
"0.57503355",
"0.5748049",
"0.5747369",
"0.5746943",
"0.5746461",
"0.57296556",
"0.57263505",
"0.57201105",
"0.57183295",
"0.5702714",
"0.56963015",
"0.5695619",
"0.5693848",
"0.56907964",
"0.56892073",
"0.5688684",
"0.5683532",
"0.5682949",
"0.5675058",
"0.56715703",
"0.56712544",
"0.5668301",
"0.5668217",
"0.5666349",
"0.56595093",
"0.5658015",
"0.5654748",
"0.5654072",
"0.5648167",
"0.5643295",
"0.563968",
"0.56364536",
"0.56320894",
"0.563039",
"0.5628576",
"0.5628576",
"0.56243795",
"0.5622652",
"0.56209207",
"0.5618548",
"0.5618118",
"0.5613527",
"0.56097",
"0.5604369",
"0.5604291",
"0.56029767",
"0.5598126",
"0.55973244",
"0.5591886",
"0.5589193",
"0.5583805",
"0.5583341"
] | 0.0 | -1 |
Create a new Chef::Catalog object. | def initialize
@name = ''
@public = ''
@description = ''
@nspath = ''
@cis = Mash.new
@relations = Mash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @chef = Chef.new\n end",
"def initialize(catalog, conf = nil)\n @catalog = catalog\n super conf\n end",
"def initialize(catalog, conf = nil)\n @catalog = catalog\n super conf\n end",
"def build_catalog(logger)\n if @facts_terminus != 'facter'\n facts_obj = OctocatalogDiff::CatalogUtil::Facts.new(@options, logger)\n logger.debug \"Start retrieving facts for #{@node} from #{self.class}\"\n @options[:facts] = facts_obj.facts\n logger.debug \"Success retrieving facts for #{@node} from #{self.class}\"\n end\n\n bootstrap(logger)\n result = run_puppet(logger)\n @retries = result[:retries]\n if (result[:exitcode]).zero?\n begin\n @catalog = ::JSON.parse(result[:stdout])\n @catalog_json = result[:stdout]\n @error_message = nil\n rescue ::JSON::ParserError => exc\n @catalog = nil\n @catalog_json = nil\n @error_message = \"Catalog has invalid JSON: #{exc.message}\"\n end\n else\n @error_message = result[:stderr]\n @catalog = nil\n @catalog_json = nil\n end\n end",
"def create\n @catalog = Catalog.new(catalog_params)\n\n respond_to do |format|\n if @catalog.save\n format.html { redirect_to @catalog, notice: 'Catalog was successfully created.' }\n format.json { render :show, status: :created, location: @catalog }\n else\n format.html { render :new }\n format.json { render json: @catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n return false unless authorize(permissions = [\"administer_catalog\"])\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end",
"def catalog(path, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n puts \"DEBUG: Creating catalog in #{path}\" if debug\n # create the groups for the catalog - for now, just groups. other catalogs may be added later\n cat = { 'barclamps'=>{} }\n barclamps = File.join CROWBAR_PATH, 'barclamps'\n list = Dir.entries(barclamps).find_all { |e| e.end_with? '.yml'}\n # scan the installed barclamps\n list.each do |bc_file|\n puts \"Loading #{bc_file}\" if debug\n bc = YAML.load_file File.join(barclamps, bc_file)\n name = bc['barclamp']['name']\n cat['barclamps'][name] = {} if cat['barclamps'][name].nil?\n description = bc['barclamp']['description']\n if description.nil?\n puts \"Trying to find description\" if debug\n [ File.join(path, '..', name, 'chef', 'data_bags', 'crowbar', \"bc-template-#{name}.json\"), \\\n File.join(path, '..', \"barclamp-#{name}\", 'chef', 'data_bags', 'crowbar', \"bc-template-#{name}.json\")].each do |f|\n next unless File.exist? f\n s = JSON::load File.open(f, 'r')\n description = s['description'] unless s.nil?\n\tbreak if description\n end\n end\n # template = File.join path, name,\n puts \"Adding catalog info for #{bc['barclamp']['name']}\" if debug \n cat['barclamps'][name]['description'] = description || \"No description for #{bc['barclamp']['name']}\"\n cat['barclamps'][name]['user_managed'] = (bc['barclamp']['user_managed'].nil? ? true : bc['barclamp']['user_managed']) \n puts \"#{name} #{bc['barclamp']['user_managed']}\" if name === 'dell-branding'\n bc['barclamp']['member'].each do |meta|\n cat['barclamps'][meta] = {} if cat['barclamps'][meta].nil?\n cat['barclamps'][meta]['members'] = {} if cat['barclamps'][meta]['members'].nil?\n cat['barclamps'][meta]['members'][name] = bc['crowbar']['order']\n end if bc['barclamp']['member']\n\n cat['barclamps'][name]['order'] = bc['crowbar']['order'] if bc['crowbar']['order']\n cat['barclamps'][name]['run_order'] = bc['crowbar']['run_order'] if bc['crowbar']['run_order']\n cat['barclamps'][name]['chef_order'] = bc['crowbar']['chef_order'] if bc['crowbar']['chef_order']\n if bc['git']\n cat['barclamps'][name]['date'] = bc['git']['date'] if bc['git']['date']\n cat['barclamps'][name]['commit'] = bc['git']['commit'] if bc['git']['commit']\n end\n \n end\n File.open( File.join(CROWBAR_PATH, 'config', 'catalog.yml'), 'w' ) do |out|\n YAML.dump( cat, out )\n end\nend",
"def compile_catalog( node = nil )\n Puppet.settings.handlearg(\"--confdir\", @puppetcfg['confdir'])\n begin\n Puppet.initialize_settings unless Puppet.settings.send(:global_defaults_initialized?)\n rescue NameError\n Puppet.parse_config\n end\n # reset confdir in case it got overwritten\n @puppetcfg.each do |option,value|\n Puppet.settings.handlearg(\"--#{option}\", value)\n end\n\n unless node.is_a?(Puppet::Node)\n node = Puppet::Node.new(@facts['hostname'], :classes => @klass)\n node.merge(@facts)\n end\n\n # Compile our catalog\n begin\n @catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)\n rescue NameError\n @catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)\n end\n\n # XXX could not find this in puppet\n catalog_resources.each do |resource|\n next unless resource[:alias]\n resource[:alias].each do |a|\n # \"foo\" -> \"Package[foo]\"\n @aliases[\"#{resource.type}[#{a}]\"] = resource\n end\n end\n end",
"def create_catalog(catalog_info)\n @slug ||= catalog_info['slug']\n # Check if such a catalog already exists\n catalog = Catalog.find_by(slug: @slug)\n raise \"ERROR. Catalog '#{@slug}' already exists. Please specify a unique catalog slug.\" unless catalog.nil?\n\n Catalog.new(catalog_info.merge(\"slug\" => @slug)).save\n end",
"def create_ral_catalog(context)\n catalog = context.catalog\n catalog = catalog.call if catalog.is_a? Proc\n ral_catalog = catalog.to_ral\n ral_catalog.resources.each do |resource|\n generate_additional_resources ral_catalog, resource\n end\n lambda { ral_catalog }\n end",
"def create_blacklight_catalog\n copy_file \"catalog_controller.rb\", \"app/controllers/catalog_controller.rb\"\n end",
"def initialize(*args)\n super\n @action = :create\n @provider = Chef::Provider::LinodeDomainApi\nend",
"def setup_catalog\n [\n {product_name: 'bamba', photo_url: 'dummy_url1', barcode: 'xxx1', sku: 111, price: 2.23, producer: 'Nestle'},\n {product_name: 'apple', photo_url: 'dummy_url2', barcode: 'xxx2', sku: 555, price: 4.66, producer: 'WFM'},\n {product_name: 'tapu chepse', photo_url: 'dummy_url3', barcode: 'xxx3', sku: 1111444, price: 7.33, producer: 'Nestle'}\n ].each do |data|\n Catalog.create(data)\n end\n end",
"def create_channel_catalog(request, opts = {})\n data, _status_code, _headers = create_channel_catalog_with_http_info(request, opts)\n return data\n end",
"def create\n @catalog = Catalog.new(catalog_params)\n @catalog.user = current_user\n respond_to do |format|\n if @catalog.save\n format.html { redirect_to @catalog }\n format.json { render :show, status: :created, location: @catalog }\n else\n format.html { render :new }\n format.json { render json: @catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_catalog = ProductCatalog.new(product_catalog_params)\n\n respond_to do |format|\n if @product_catalog.save\n format.html { redirect_to @product_catalog, notice: 'Product catalog was successfully created.' }\n format.json { render :show, status: :created, location: @product_catalog }\n else\n format.html { render :new }\n format.json { render json: @product_catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return false unless authorize(permissions = [\"administer_catalog\"])\n file = params[:catalog][:dump]\n params[:catalog].delete(:dump)\n @catalog = Catalog.new( params[:catalog])\n importer=ImporterManager.instance.import_methods[@catalog.catalog_type.import_method]\n if file\n #begin\n importer.import @catalog,file\n #rescue\n #@catalog.errors.add_to_base t(\"admin.catalog.errors.import_file_invalid\")\n #end\n \n else\n if importer.class!=Importer::DummyCatalogImporter\n @catalog.errors.add_to_base t(\"admin.catalog.errors.import_file_not_blank\")\n else\n importer.import @catalog\n end\n end\n \n respond_to do |format|\n if @catalog.errors.empty?\n flash.now[:notice] = t('admin.catalog.flash.created')\n if(!@catalog.catalog_type.active_catalog)\n @catalog.catalog_type.active_catalog_id = @catalog.id\n @catalog.catalog_type.save\n end\n format.html { redirect_to(@catalog) }\n format.xml { render :xml => @catalog, :status => :created, :location => @catalog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog.errors, :status => :unprocessable_entity }\n end\n\n \n end\n end",
"def catalog(path)\n # create the groups for the catalog - for now, just groups. other catalogs may be added later\n cat = { 'barclamps'=>{} }\n barclamps = File.join CROWBAR_PATH, 'barclamps'\n list = Dir.entries(barclamps).find_all { |e| e.end_with? '.yml'}\n # scan the installed barclamps\n list.each do |bc_file|\n bc = YAML.load_file File.join(barclamps, bc_file)\n name = bc['barclamp']['name']\n cat['barclamps'][name] = {} if cat['barclamps'][name].nil?\n description = bc['barclamp']['description']\n if description.nil?\n schema = File.join(path, '..', name, 'chef', 'data_bags', 'crowbar', \"bc-template-#{name}.json\")\n # second try based on different name pattern\n schema = File.join(path, '..', \"barclamp-#{name}\", 'chef', 'data_bags', 'crowbar', \"bc-template-#{name}.json\") unless File.exist? schema\n if File.exist? schema \n s = JSON::load File.open(schema, 'r')\n description = s['description'] unless s.nil?\n end\n end\n # template = File.join path, name, \n cat['barclamps'][name]['description'] = description\n cat['barclamps'][name]['user_managed'] = (bc['barclamp']['user_managed'].nil? ? true : bc['barclamp']['user_managed'])\n puts \"#{name} #{bc['barclamp']['user_managed']}\" if name === 'dell-branding'\n bc['barclamp']['member'].each do |meta|\n cat['barclamps'][meta] = {} if cat['barclamps'][meta].nil?\n cat['barclamps'][meta]['members'] = {} if cat['barclamps'][meta]['members'].nil?\n cat['barclamps'][meta]['members'][name] = bc['crowbar']['order']\n end\n end\n File.open( File.join(CROWBAR_PATH, 'config', 'catalog.yml'), 'w' ) do |out|\n YAML.dump( cat, out )\n end\n end",
"def initialize(name, location, capacity, category, chef_name)\n @name = name\n @location = location\n @capacity = capacity\n @category = category\n @reservations = []\n @chef = Chef.new(chef_name, self) # INSTANCE OF A CHEF\n end",
"def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end",
"def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end",
"def create\n=begin\n @catalog = Catalog.new(params[:catalog])\n\n respond_to do |format|\n if @catalog.save\n format.html { redirect_to(@catalog, :notice => 'Catalog was successfully created.') }\n format.xml { render :xml => @catalog, :status => :created, :location => @catalog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog.errors, :status => :unprocessable_entity }\n end\n end\n=end\n end",
"def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)\nsuper if defined?(::Chef::ResourceBuilder)\n @type = type\n @name = name\n @created_at = created_at\n @params = params\n @run_context = run_context\n @cookbook_name = cookbook_name\n @recipe_name = recipe_name\n @enclosing_provider = enclosing_provider\n end",
"def create\n @catalog_product = CatalogProduct.new(params[:catalog_product])\n\n respond_to do |format|\n if @catalog_product.save\n flash[:notice] = 'CatalogProduct was successfully created.'\n format.html { redirect_to(@catalog_product) }\n format.xml { render :xml => @catalog_product, :status => :created, :location => @catalog_product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n data = CatalogItem.new(name: params[:name], description: params[:description])\n data.save\n render json: data\n end",
"def catalogue\n @catalogue ||= [\n Product.new( \"001\", \"Lavender heart\", 9.25 ),\n Product.new( \"002\", \"Personalised cufflinks\", 45.00 ),\n Product.new( \"003\", \"Kids T-shirt\", 19.95 )\n ]\n end",
"def catalogue\n @catalogue ||= [\n Product.new( \"001\", \"Lavender heart\", 9.25 ),\n Product.new( \"002\", \"Personalised cufflinks\", 45.00 ),\n Product.new( \"003\", \"Kids T-shirt\", 19.95 )\n ]\n end",
"def initialize(catalog, item_id = nil, conf = nil)\n @catalog = catalog\n @item_id = item_id\n super conf\n end",
"def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end",
"def create\n @item_catalog = ItemCatalog.new(params[:item_catalog])\n\n respond_to do |format|\n if @item_catalog.save\n format.html { redirect_to @item_catalog, notice: 'Item catalog was successfully created.' }\n format.json { render json: @item_catalog, status: :created, location: @item_catalog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def catalog=(value)\n @catalog = value\n end",
"def set_catalog\n @catalog = Catalog.friendly.find(params[:id])\n end",
"def initialize(name, city, capacity, category, chef_name)\n @name = name\n @city = city\n @capacity = capacity\n @category = category\n @reservations = [] # array of name\n @chef = Chef.new(chef_name, self) # instance of a Chef\n end",
"def initialize(node=nil)\n @node = node \n @cookbook_loader = Chef::CookbookLoader.new\n @collection = Chef::ResourceCollection.new\n @definitions = Hash.new\n @recipes = Array.new\n @default_attributes = Array.new\n @override_attributes = Array.new\n\n load_libraries\n load_providers\n load_resources\n load_attributes\n load_definitions\n load_recipes\n end",
"def init\n create_file options[:inventory_config] do\n<<-YML\n# sources:\n# - \"https://supermarket.getchef.com\"\n# cookbooks:\n# cookbook-name:\n# versions:\n# - \"~> 4.0.2\"\n# - \"> 5.0.0\"\n# git:\n# location: url | path\n# branches:\n# - a_branch_name\n# refs:\n# - SHA\n\nYML\n end\n end",
"def new\n @cabal=Cabal.new\n end",
"def set_catalog\n @catalog = present(Catalog::Show).model\n end",
"def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"def create\n @catalog_category = CatalogCategory.new(catalog_category_params)\n\n respond_to do |format|\n if @catalog_category.save\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :created, location: @catalog_category }\n else\n format.html { render :new }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(label, name, summary, arch, parent)\n @connection.call('channel.software.create', @sid, label, name, summary, arch, parent)\n end",
"def create\n @status_catalog = StatusCatalog.new(status_catalog_params)\n\n respond_to do |format|\n if @status_catalog.save\n format.html { redirect_to @status_catalog, notice: 'Status catalog was successfully created.' }\n format.json { render :show, status: :created, location: @status_catalog }\n else\n format.html { render :new }\n format.json { render json: @status_catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_catalog(catalogId)\n params = {\n 'method' => :get,\n 'command' => \"/catalog/#{catalogId}\"\n }\n\n response, headers = send_request(params)\n description = response.css(\"Description\").first\n description = description.text unless description.nil?\n\n items = {}\n response.css(\"CatalogItem[type='application/vnd.vmware.vcloud.catalogItem+xml']\").each do |item|\n items[item['name']] = item['href'].gsub(\"#{@api_url}/catalogItem/\", \"\")\n end\n { :description => description, :items => items }\n end",
"def create_catalog_item request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_catalog_item_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::RecommendationEngine::V1beta1::CatalogItem.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n tmpl = ERB.new(load_erb_file('metadata.erb'))\n @cookbook = @opts[:cookbook]\n @maintainer = @opts[:souschef][:maintainer]\n @maintainer_email = @opts[:souschef][:maintainer_email]\n @license = @opts[:souschef][:license]\n data = tmpl.result(binding)\n\n info 'Updating metadata.rb'\n write_file(cookbook_file_path('metadata.rb'), data)\n end",
"def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end",
"def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end",
"def create(id, name: nil, type: :PRODUCTION, labels: nil, clusters: nil)\n end",
"def catalog\n puts \"library.catalog\"\n ap self.inspect\n end",
"def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end",
"def init(new_resource)\n begin\n require 'rightscale_tools'\n rescue LoadError\n Chef::Log.warn \" This database cookbook requires our 'rightscale_tools' gem.\"\n Chef::Log.warn \" Please contact Rightscale to upgrade your account.\"\n end\n mount_point = new_resource.name\n version = node[:db][:version].to_f > 5.1 ? :mysql55 : :mysql\n Chef::Log.info \" Using version: #{version} : #{node[:db][:version]}\"\n\n RightScale::Tools::Database.factory(version, new_resource.user, new_resource.password, mount_point, Chef::Log)\n end",
"def create\n @catalogo = Catalogo.new(catalogo_params)\n\n respond_to do |format|\n if @catalogo.save\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @catalogo }\n else\n format.html { render action: 'new' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end",
"def create\n @catalog_product_attributes = CatalogProductAttributes.new(params[:catalog_product_attributes])\n\n respond_to do |format|\n if @catalog_product_attributes.save\n flash[:notice] = 'CatalogProductAttributes was successfully created.'\n format.html { redirect_to(@catalog_product_attributes) }\n format.xml { render :xml => @catalog_product_attributes, :status => :created, :location => @catalog_product_attributes }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog_product_attributes.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def create\n start = Time.now\n debug 'Downloading new collector installer.'\n collector = get_agent_by_description(nil, resource[:description], 'id')\n if collector\n if resource[:architecture].include?('64')\n installation_binary = \"#{resource[:install_dir]}logicmonitorsetup#{collector['id']}_64.bin\"\n arch = Puppet::Provider::Logicmonitor::LINUX_64\n else\n installation_binary = \"#{resource[:install_dir]}logicmonitorsetup#{collector['id']}_32.bin\"\n arch = Puppet::Provider::Logicmonitor::LINUX_32\n end\n File.open(installation_binary, 'w+') do |file|\n file.write(rest(nil,\n Puppet::Provider::Logicmonitor::COLLECTOR_DOWNLOAD_ENDPOINT % [collector['id'], arch],\n Puppet::Provider::Logicmonitor::HTTP_GET,\n nil,\n nil,\n true))\n end\n debug \"Download Finished in #{(Time.now - start) * 1000.0} ms\"\n install_start = Time.now\n debug 'Installing Collector'\n File.chmod(0755, installation_binary)\n `#{installation_binary} -y`\n debug \"Collector Install took #{(Time.now-install_start)*1000.0} ms\"\n debug \"Total took #{(Time.now-start)*1000.0} ms\"\n end\n end",
"def new\n @catalog_product = CatalogProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product }\n end\n end",
"def create\n execute ['cmd', '/c', INSTALLUTIL, @resource[:arguments], @resource[:path]].flatten.compact.join(' ')\n end",
"def new\n @catalog_product_attributes = CatalogProductAttributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_product_attributes }\n end\n end",
"def parse_catalog(catalog)\n classes = nil\n resources = nil\n results = Hash.new()\n\n if catalog.is_a?(String)\n begin\n JSON.parse!(catalog)\n rescue\n raise InternalError.new(sprintf('unable to parse catalog[%s] as JSON', catalog))\n end\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('classes')\n raise InternalError.new(sprintf('catalog does not contain a classes key[%s]', catalog))\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('resources')\n raise InternalError.new(sprintf('catalog does not contain a resources key[%s]', catalog))\n end\n\n raw_resources = catalog['data']['resources']\n\n raw_resources.each do |r|\n # samples of eacb type of resource is available at\n # https://github.com/chorankates/rouster/issues/20#issuecomment-18635576\n #\n # we can do a lot better here\n type = r['type']\n case type\n when 'Class'\n classes.push(r['title'])\n when 'File'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :file\n resources[name][:directory] = false\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:file] = true\n resources[name][:group] = r['parameters'].has_key?('group') ? r['parameters']['group'] : nil\n resources[name][:mode] = r['parameters'].has_key?('mode') ? r['parameters']['mode'] : nil\n resources[name][:owner] = r['parameters'].has_key?('owner') ? r['parameters']['owner'] : nil\n resources[name][:contains] = r.has_key?('content') ? r['content'] : nil\n\n when 'Group'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :group\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n\n when 'Package'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :package\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:version] = r['ensure'] =~ /\\d/ ? r['ensure'] : nil\n\n when 'Service'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :service\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:state] = r['ensure']\n\n when 'User'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :user\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:home] = r['parameters'].has_key?('home') ? r['parameters']['home'] : nil\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n resources[name][:group] = r['parameters'].has_key?('groups') ? r['parameters']['groups'] : nil\n resources[name][:shell] = r['parameters'].has_key?('shell') ? r['parameters']['shell'] : nil\n resources[name][:uid] = r['parameters'].has_key?('uid') ? r['parameters']['uid'] : nil\n\n else\n raise NotImplementedError.new(sprintf('parsing support for [%s] is incomplete', type))\n end\n\n end\n\n # remove all nil references\n resources.each_key do |name|\n resources[name].each_pair do |k,v|\n unless v\n resources[name].delete(k)\n end\n end\n end\n\n\n results[:classes] = classes\n results[:resources] = resources\n\n results\n end",
"def set_catalog\n id = params[:id].nil? ? params[:catalog_id] : params[:id]\n @catalog = Catalog.find(id)\n end",
"def new\n @cat = Cat.new\n end",
"def new\n @cat = Cat.new\n end",
"def catalog; end",
"def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end",
"def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end",
"def create(name, config)\n # @step: validate the user defined options\n validate(config)\n\n # @step: create the infrastructure deployment\n begin\n provision_aks(name, config)\n rescue StandardError => e\n raise InfrastructureError, \"failed to provision cluster, error: #{e}\"\n end\n\n # @step: bootstrap the cluster\n begin\n provision_cluster(name, config)\n rescue StandardError => e\n raise InfrastructureError, \"failed to bootstrap cluster, error: #{e}\"\n end\n end",
"def create\n name_to_const.new\n end",
"def set_catalog\n @catalog = Catalog.find(params[:catalog_id])\n end",
"def create\n @catalog = Catalog.new(params[:catalog])\n\n respond_to do |format|\n if @catalog.save\n #archive = File.open(\"#{@catalog.archive.path}\")\n #new_name = rand(1000*1000).to_i.abs.to_s + \".zip\"\n #splits_file = File.split(archive)\n #File.rename(\"#{splits_file[0]}/#{splits_file[1]}\", \"#{splits_file[0]}/#{new_name}\")\n #@catalog.update_attribute(\"archive_file_name\", new_name)\n format.html { redirect_to(@catalog, :notice => 'Минус загружен') }\n format.xml { render :xml => @catalog, :status => :created, :location => @catalog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end",
"def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end",
"def create_resource(env)\n env[:ui].info(\"Creating machine\")\n\n config = env[:machine].provider_config\n vra = env[:vra]\n\n EntitledItemsCollection.fetch(env[:vra])\n .find_by_id(config.catalog_item_id)\n .request(cpus: config.cpus,\n memory: config.memory,\n requested_for: config.requested_for,\n subtenant_id: config.subtenant_id,\n lease_days: config.lease_days) { |req|\n config.extra_entries.types.each do |type|\n config.extra_entries.of_type(type).each do |k,v|\n req.set_parameter(k, type, v)\n end\n end\n }\n .join\n .machine\n end",
"def resources2catalog(*resources)\n if resources[0].is_a?(Puppet::Resource::Catalog)\n config = resources.shift\n resources.each { |r| config.add_resource r } unless resources.empty?\n elsif resources[0].is_a?(Puppet::Type.type(:component))\n raise ArgumentError, \"resource2config() no longer accpts components\"\n comp = resources.shift\n comp.delve\n else\n config = Puppet::Resource::Catalog.new\n resources.each { |res| config.add_resource res }\n end\n config\n end",
"def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end",
"def fetch_catalog(logger)\n api_version = @options[:puppet_master_api_version] || DEFAULT_PUPPET_SERVER_API\n api = puppet_catalog_api[api_version]\n raise ArgumentError, \"Unsupported or invalid API version #{api_version}\" unless api.is_a?(Hash)\n\n logger.debug \"Retrieve catalog from #{api[:url]} environment #{@options[:branch]}\"\n\n more_options = { headers: { 'Accept' => 'text/pson' }, timeout: @timeout }\n post_hash = api[:parameters]\n response = OctocatalogDiff::Util::HTTParty.post(api[:url], @options.merge(more_options), post_hash, 'puppet_master')\n\n logger.debug \"Response from #{api[:url]} environment #{@options[:branch]} was #{response[:code]}\"\n\n unless response[:code] == 200\n @error_message = \"Failed to retrieve catalog from #{api[:url]}: #{response[:code]} #{response[:body]}\"\n @catalog = nil\n @catalog_json = nil\n return\n end\n\n @catalog = response[:parsed]\n @catalog_json = ::JSON.generate(@catalog)\n @error_message = nil\n end",
"def set_product_catalog\n @product_catalog = ProductCatalog.find(params[:id])\n end",
"def create!(params={})\n raise ArgumentError, \"Error: product, component, summary, version are required args\" unless check_params([:product, :component, :summary, :version], params)\n rpc_call :create, params\n end",
"def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end",
"def create\n properties = [ resource[:name],\n resource[:user],\n resource[:group],\n resource[:config],\n resource[:mode],\n ]\n\n qmgmt(['volume', 'create'] + properties)\n end",
"def set_catalog\n @catalog = Catalog.find_by(slug: params[:id])\n\n if @catalog.blank?\n @catalog = Catalog.find(params[:id])\n end\n end",
"def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end",
"def create\n in_directory do\n raise(\"Please use a specific Condom class, not Base.\")\n end\n end",
"def create\n @box = Box.new(params[:box])\n\n catalog = current_user.catalogs.find(@box.catalog_id)\n if catalog.nil?\n raise 'Catalog does not exist'\n end\n\n respond_to do |format|\n if @box.save\n format.html { redirect_to catalog_path(@box.catalog), :notice => 'Box was successfully created.' }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def new\n @role = System::Role.new\n end",
"def new\n\t \t@product = Product.new\n\t end",
"def create_product(id=nil, name=nil, params={})\n # For purposes of testing, you can omit id and name to create with\n # random strings.\n id ||= rand(100000).to_s #id has to be a number. OID encoding fails otherwise\n name ||= random_string('testproduct')\n product = @cp.create_product(id, name, params)\n @products << product\n return product\n end",
"def create(options = {})\n optional = [:description,\n \t\t\t :compatible_with,\n \t\t\t :script_type\n ]\n params.required(:label).accepts(optional).validate!(options)\n response = request(:post, \"/recipes.json\", default_params(options))\n response['recipe']\n end",
"def init(new_resource)\n begin\n require 'rightscale_tools'\n rescue LoadError\n Chef::Log.warn(\" This database cookbook requires our premium 'rightscale_tools' gem.\")\n Chef::Log.warn(\" Please contact Rightscale to upgrade your account.\")\n end\n mount_point = new_resource.name\n RightScale::Tools::Database.factory(:postgres, new_resource.user, new_resource.password, mount_point, Chef::Log)\n end",
"def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end",
"def _create_chef_node(&block)\n step(\" creating chef node\", :green)\n @chef_node = Chef::Node.new\n @chef_node.name(fullname)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_client.post_rest('nodes', @chef_node)\n end",
"def new\n @item_catalog = ItemCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_catalog }\n end\n end",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def create\n @catalogo = Catalogo.new(catalogo_params)\n respond_to do |format|\n if @catalogo.save\n format.html { redirect_to @catalogo, notice: 'Registro creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @catalogo }\n else\n format.html { render action: 'new' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Puppet.debug(\"Puppet::Provider::Glance: creating glance image #{resource[:name]}\")\n\n if resource[:image]\n raise Puppet::Error, \"Failed to locate glance image #{resource[:image]}\" unless File.exists?resource[:image]\n end\n\n # generate all options and ensure public is Yes.\n opt = [resource[:name] ? \"name=\\\"#{resource[:name]}\\\"\" : nil,\n resource[:public] ? \"is_public=true\" : nil,\n resource[:disk] ? \"disk_format=#{resource[:disk]}\" : nil,\n resource[:container] ? \"container_format=#{resource[:container]}\": nil,\n resource[:location] ? \"location=#{resource[:location]}\" : nil,\n resource[:image] ? \"< #{resource[:image]}\" : nil]\n\n # unfortunately we can't use glance(..) because it doesn't handle the redirection < ... \n #glance(\"add\", opt.compact)\n\n command = \"glance add #{opt.compact.join(\" \")}\"\n\n Puppet.debug(\"Puppet::Provider::Glance: executing #{command}\")\n Kernel.system command\n end",
"def create\n # @catalog = current_user.catalogs.new(catalog_params)\n\n #respond_to do |format|\n # if @catalog.save\n # format.html { redirect_to @catalog, notice: 'Catalog was successfully created.' }\n # else\n # format.html { render :new }\n # end\n #end\n end",
"def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end",
"def new_resource(*args)\n Freemle::Client::Resource.new(*args)\n end",
"def set_catalogue\n @catalogue = Catalogue.friendly.find(params[:id])\n end",
"def new\n @catogory = Catogory.new\n end",
"def create_cluster_role\n @cluster_role_name = \"#{name}-cluster\"\n @cluster_role = new_chef_role(@cluster_role_name, cluster)\n role(@cluster_role_name, :own)\n end"
] | [
"0.65114766",
"0.6408157",
"0.6408157",
"0.6232818",
"0.6134841",
"0.61303484",
"0.60200423",
"0.59663665",
"0.5885244",
"0.58741844",
"0.58663607",
"0.5852079",
"0.5837976",
"0.58337486",
"0.57464826",
"0.5735152",
"0.5674026",
"0.5668682",
"0.5656703",
"0.56287915",
"0.56287915",
"0.5625357",
"0.5607396",
"0.55428594",
"0.55086887",
"0.5502417",
"0.5502417",
"0.5495543",
"0.5480319",
"0.546828",
"0.5464394",
"0.5433105",
"0.54302615",
"0.5425031",
"0.53956217",
"0.53942907",
"0.5394158",
"0.539379",
"0.539379",
"0.5388537",
"0.5373252",
"0.537295",
"0.535934",
"0.5356872",
"0.53483623",
"0.53448766",
"0.5338242",
"0.53099644",
"0.5307884",
"0.53052753",
"0.52927566",
"0.5288683",
"0.52608806",
"0.5242992",
"0.523594",
"0.52252394",
"0.522034",
"0.52136904",
"0.52135384",
"0.5208974",
"0.52056354",
"0.5197388",
"0.5197388",
"0.5195667",
"0.51911443",
"0.51869357",
"0.5186153",
"0.51831114",
"0.5180951",
"0.51643914",
"0.51608676",
"0.51608676",
"0.51555926",
"0.51368636",
"0.5130936",
"0.51285416",
"0.51131815",
"0.510206",
"0.5083958",
"0.5075723",
"0.5073563",
"0.50700694",
"0.5069575",
"0.505512",
"0.5054444",
"0.5048652",
"0.50465333",
"0.5039584",
"0.5026356",
"0.50218916",
"0.50017893",
"0.50001013",
"0.49988967",
"0.4996391",
"0.4995708",
"0.49949035",
"0.4991022",
"0.49894673",
"0.49859202",
"0.49837044",
"0.4979407"
] | 0.0 | -1 |
Serialize this object as a hash | def to_json(*a)
to_hash.to_json(*a)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n JSON.dump(@hash)\n end",
"def to_hash\n @_hash_\n end",
"def to_hash\n @hash\n end",
"def serialize\n self.to_hash.to_json\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 @hash ||= self.to_a.hash\n end",
"def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def to_hash() end",
"def hash\n to_h.hash ^ self.class.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 serialize\n JSON.generate(to_h)\n end",
"def hash\n [self.class, to_s].hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n return to_s.hash\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def hash\n to_a.hash\n end",
"def hash\n [self.class, to_s].hash\n end",
"def to_hash\n return self\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_h\n recursive_serialization(self)\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def to_hash\n object\n end",
"def serialize(hash)\n { Arguments::OBJECT_SERIALIZER_KEY => self.class.name }.merge!(hash)\n end",
"def hash\n data.hash\n end",
"def serializable_hash(_options = nil)\n fail NotImplementedError, 'This is an abstract method. Should be implemented at the concrete adapter.'\n end",
"def to_hash\n @_hash.dup\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def to_h\n Hash[ self ]\n end",
"def to_hash\n @hash.dup\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def to_hash\n to_a.hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def as_hash\n @hash\n end",
"def hash\n @hash\n end",
"def to_hash\n Hash[self]\n end",
"def hash\n @__set.to_a.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash\n h = super\n h['uid'] = @uid\n h\n end",
"def output_hash; end",
"def to_hash()\n @data\n end",
"def serialize(hash)\n {Arguments::OBJECT_SERIALIZER_KEY => self.class.name}.merge!(hash)\n end",
"def to_hash\n @data.to_hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def serializable_hash\n self.attributes\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def to_hash\n @data\n end",
"def to_h\n @_hash.dup\n end",
"def hash\n model.hash + key.hash\n end",
"def __hash\n @hash\n end",
"def to_hash\n @data\n end",
"def to_hash\n self.hash.merge!(:errors => self.errors)\n self.hash.merge!(:valid? => self.valid)\n self.hash\n # binding.pry\n Stamps.format.to_s.downcase == 'hashie' ? Hashie::Trash.new(@hash) : self.hash\n end",
"def to_h\n @hash.dup\n end",
"def serialize\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def to_hash\n @hash.dup\n end",
"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 to_dict\n @hash\n end",
"def hash\r\n @_hash ||= _hash\r\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 to_h\n @hash.dup\n end",
"def hash\n @hash.hash\n end",
"def serializable_hash options=nil\n hash = super\n eav_attributes_list.each do |attribute|\n hash[attribute] = self.send(attribute)\n end\n\n hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def to_hash\n {:hashes => @hashes}\n end",
"def hash\n self.state.hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n self.class.name.hash\n end"
] | [
"0.81273913",
"0.77855784",
"0.77548593",
"0.77375627",
"0.7666434",
"0.7666434",
"0.75483555",
"0.7526138",
"0.75173",
"0.7508914",
"0.750206",
"0.7472599",
"0.7439899",
"0.7439899",
"0.7439899",
"0.7428211",
"0.74079853",
"0.7393187",
"0.7383238",
"0.7358389",
"0.73462814",
"0.7327338",
"0.7325176",
"0.7321016",
"0.7260274",
"0.7216137",
"0.7208534",
"0.7180275",
"0.7179514",
"0.7140078",
"0.7122892",
"0.71156204",
"0.71155834",
"0.7097166",
"0.7083358",
"0.7083358",
"0.70624375",
"0.7062197",
"0.7062197",
"0.7062197",
"0.70610416",
"0.7061009",
"0.70527667",
"0.70519114",
"0.70396876",
"0.70343196",
"0.7015978",
"0.7015978",
"0.7015978",
"0.7015978",
"0.7015978",
"0.7015978",
"0.7005464",
"0.70054245",
"0.6999324",
"0.69902486",
"0.69872004",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69836766",
"0.69833165",
"0.6944934",
"0.6943829",
"0.6935412",
"0.6934359",
"0.6924412",
"0.69192404",
"0.6918523",
"0.6913515",
"0.6911458",
"0.689888",
"0.689888",
"0.689888",
"0.6894562",
"0.6894562",
"0.68756527",
"0.6872954",
"0.6868469",
"0.6850457",
"0.6850225",
"0.6842584",
"0.68398166",
"0.6833019",
"0.68209434",
"0.68126875",
"0.680429",
"0.6803779",
"0.6803779",
"0.6803779",
"0.6803779",
"0.6803779",
"0.6803779",
"0.6803779",
"0.67929476"
] | 0.0 | -1 |
GET /legalstatuses GET /legalstatuses.json | def index
@legalstatuses = Legalstatus.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def index\n @statuses = Status.all\n end",
"def index\n @statuses = Status.all\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def index\n @statuses = Status.search.page params[:page]\n end",
"def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend",
"def index\n @married_statuses = MarriedStatus.all\n end",
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def statuses\n api.get('status')\n end",
"def index\n @course_statuses = CourseStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course_statuses }\n end\n end",
"def status\n sanitized = whitelist(params, :status)\n\n @travel = Travels::Travel.find(sanitized[:id])\n\n respond_to do |format|\n format.html # status.html.erb\n format.json { render json: { status: @travel.state.to_s } }\n end\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def index\n @reqstatuses = Reqstatus.all\n end",
"def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend",
"def index\n @swit_statuses = SwitStatus.all\n end",
"def index\n @organization_statuses = @organization.organization_statuses # .paginate(:page => params[:page]).per_page(10)\n end",
"def index\n @lesson_statuses = LessonStatus.all\n end",
"def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end",
"def current_statuses_three\n @current_statuses = CurrentStatus.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @current_statuses}\n end\n end",
"def index\n @rh21_statuses = Rh21Status.all\n end",
"def index\n @search = Status.search(params[:search], :order => \"id DESC\")\n @statuses = @search.paginate(:page => params[:page], :order => \"id DESC\")\n\n @statuses = @statuses.where(:uid => params[:uid]) unless params[:uid].nil?\n @statuses = @statuses.where(:screen_name => params[:screen_name]) unless params[:screen_name].nil?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n end\n end",
"def index\n @technician_statuses = TechnicianStatus.all\n end",
"def index\n @mstatuses = Mstatus.all\n end",
"def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend",
"def index\n @barrel_statuses = BarrelStatus.all\n end",
"def status\n get('/api/status')\n end",
"def index\n @mission_statuses = MissionStatus.all\n end",
"def index\n @entity_statuses = EntityStatus.all\n end",
"def index\n @idea_statuses = IdeaStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @idea_statuses }\n end\n end",
"def index\n @search = MaritalStatus.search(params[:search])\n @marital_statuses = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @marital_statuses }\n end\n end",
"def statuses; end",
"def index\n @application_statuses = ApplicationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_statuses }\n end\n end",
"def index\n @contract_statuses = ContractStatus.all\n end",
"def index\n @learning_statuses = LearningStatus.all\n end",
"def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end",
"def index\n @course_taken_statuses = CourseTakenStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_taken_statuses }\n end\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def index\n @health_statuses = HealthStatus.all\n end",
"def build_statuses(options = {})\n build_statuses_resource(options)\n end",
"def index\n authenticate_user! if params[:page]\n @statuses = Status.all.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Statuse\n end",
"def public_timeline\n call( 'statuses/public_timeline.json' )\n end",
"def index\n @registration_statuses = RegistrationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_statuses }\n end\n end",
"def status\n get_json('status.json')\n end",
"def status(status_id)\n response = @client.get(\"/api/v1/statuses/#{status_id}\")\n return JSON.parse(response.body)\n end",
"def index\n @typeofstatuses = Typeofstatus.all.page params[:page]\n end",
"def index\n @legal_entities = LegalEntity.all\n end",
"def index\n @invstatuses = Invstatus.all\n end",
"def statuses_911_list\n payload[:statuses].nil? ? nil : payload[:statuses]\n end",
"def index\n #@statuses = Status.all\n #@statuses = Status.where(:private => false).or(:user_id => current_user).paginate(page: params[:page], per_page: 50).order('created_at DESC')\n #@statuses = Status.where('private=? OR user_id=?', false, current_user).paginate(page: params[:page], per_page: 50).order('created_at DESC')\n @statuses = Status.paginate(page: params[:page], per_page: 50).order('created_at DESC')\n end",
"def index\n @booking_statuses = BookingStatus.all\n end",
"def index\n @inventory_statuses = InventoryStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_statuses }\n end\n end",
"def index\n @client_statuses = ClientStatus.all\n end",
"def set_legalstatus\n @legalstatus = Legalstatus.find(params[:id])\n end",
"def index\n @asset_statuses = AssetStatus.all\n end",
"def index\n @player_statuses = PlayerStatus.all\n end",
"def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end",
"def parseResults( resp )\n data = JSON.parse(resp.body)\n\treturn data['statuses']\nend",
"def index\n @type = params[:type] || 'raw'\n if @type == 'raw'\n condition = [\"domain = ? and state is null\", \"thevoice\"]\n elsif @type == 'auditing'\n condition = [\"domain = ? and state = ?\", \"thevoice\", 'auditing']\n elsif @type == 'pool'\n condition = [\"domain = ? and state = ? and id in (?)\", \"thevoice\", 'sent', Feed.all.map(&:status_id)]\n elsif @type == 'sent'\n condition = [\"domain = ? and state = ?\", \"thevoice\", 'sent']\n else\n condition = [\"domain = ?\",\"thevoice\"]\n end\n\n @statuses = Status.find(:all, :conditions => condition, :order => 'id DESC').paginate(:page => params[:page], :per_page => 20)\n @bulletin = Bulletin.new\n @bulletins = Bulletin.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def index\n @book_statuses = BookStatus.all\n end",
"def index\n @bookstatuses = Bookstatus.all\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections statuses, :to => Facebook::Graph::Generic\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def index\n render json: Loan.all\n end",
"def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend",
"def index\n\t\t@leads = Lead.all\n\t\t\n\t\t\n\n\t\tlogger.info params[:status]\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @leads }\n\t\tend\n\tend",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end",
"def index\n if params[:status]\n @tickets = Ticket.where(status: params[:status])\n else\n @tickets = Ticket.all\n @tickets_waiting = Ticket.where(status:\"waiting\")\n @tickets_resolved = Ticket.where(status:\"resolved\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end",
"def index\n @project_statuses = Project::Status.all\n end",
"def list_timeline(list_owner_screen_name, slug, options={})\n perform_get(\"#{list_owner_screen_name}/lists/#{slug}/statuses.#{Twitter.format}\", options)\n end",
"def index\n @sa_request_statuses = SaRequestStatus.all\n end",
"def index\n @suggestions = Suggestion.all\n if params[:status] and params[:status] != \"All\"\n @suggestions = @suggestions.where(\"status like ?\", \"%#{params[:status]}%\")\n end\n end",
"def index\n @listing_statuses = ListingStatus.find(:all, :select => 'id, description, position, is_final', :order => 'description')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @listing_statuses }\n end\n end",
"def index\n @relationship_statuses = RelationshipStatus.all\n end",
"def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end",
"def index\n if params[:status] \n status = params[:status].to_sym\n if Status.statuses.has_key? status\n status_id = Status.statuses[status] \n @tickets = Ticket.where(status_id: status_id)\n end\n elsif params[:search]\n search = Ticket.search{fulltext params[:search]}\n @tickets = search.results\n else\n @tickets = Ticket.all\n end\n end",
"def index\n @antrag_statuses = AntragStatus.all\n end",
"def ineligible_statuses\n ['1 Day Loan',\n '1 Week No Renew',\n '1 Week No Renew Equip',\n '2 Day Loan',\n '24 Hour Loan',\n '3 Day Loan',\n 'Audio Recorder',\n 'Due at Closing',\n 'Journal Loan',\n 'Music CD/DVD',\n 'Pass',\n 'See Note Above',\n 'Two Week Loan']\n end",
"def list_possible_status_ids\n\tstatustypes = @client.Status.all\n\tstatustypes.each do |status|\n\t\tputs \"#{status.id}\\t#{status.name}\"\n\tend\nend",
"def marketing_statuses\n sources = []\n changed_sources = []\n\n \n # collect l2l source source\n @resident.sources.where(:property_id => params[:prop_id]).each_with_index do |s, i|\n pp \"#{s.status}, #{s.status_date}, #{s.created_at}\"\n if s.status\n sources << {\n :status => s.status,\n :status_date => s.created_at,\n :move_in => s.move_in,\n :move_out => s.move_out\n }\n end\n end\n\n #collect only changed source (status & status_date changed)\n # must order by status_date asc, status_date always exists\n sorted_sources = sources.sort{|a, b| a[:status_date] <=> b[:status_date] }\n sorted_sources.each_with_index do |s, i|\n if i == 0\n changed_sources << s\n\n elsif s[:status] != sorted_sources[i-1][:status]\n changed_sources << s\n\n end\n end\n\n\n @statuses = changed_sources.sort{|a, b| b[:status_date] <=> a[:status_date] }\n \n render :json => @statuses.collect{|n| \n {\n :status => n[:status],\n :status_date => n[:status_date].to_s(:utc_date),\n :move_in => pretty_move_in(n[:move_in]),\n :move_out => pretty_move_in(n[:move_out])\n }\n }\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def index\n @member_statuses = MemberStatus.all\n end",
"def index\n @project_statuses = ProjectStatus.all\n end",
"def index\n @service_statuses = ServiceStatus.all\n end",
"def list\n if params[:status] == 'open'\n render :json => ExpaPerson.list_open(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'applied'\n render :json => ExpaPerson.list_applied(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'accepted'\n render :json => ExpaPerson.list_approved(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'realizing'\n render :json => ExpaPerson.list_realized(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'completed'\n render :json => ExpaPerson.list_completed(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n else\n render :json => ExpaPerson.listing(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def create_statuses\n end",
"def create_statuses\n end",
"def index\n statuses_dashboard\n end",
"def load_statuses\n return unless File.exist?(@status_path)\n\n File.open(@status_path, 'r') do |file|\n @statuses = JSON.parse(file.read)\n end\n end",
"def show\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_status }\n end\n end",
"def list\r\n #page = params[:page].nil? ? 0 : params[:page]\r\n tweets = Tweet.all\r\n render json: tweets\r\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n \n @page = params[:page].to_i\n if @page == 0\n @page = 1\n end\n @page = @page + 1 \n \n # @statuses = Status.find(:all, :order => \"created_at DESC\")\n @statuses = Status.paginate :page => params[:page], :order => 'created_at DESC' #, :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n format.js\n end\n end",
"def show\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n end\n\n begin\n timelines = client.user_timeline(@club.twitter_id)\n @tweets = []\n rescue\n end\n\n if timelines.present?\n timelines.each do |timeline_tweet|\n tweet = client.status(timeline_tweet.id)\n @tweets << tweet.text\n end\n end\n end"
] | [
"0.6845886",
"0.6465115",
"0.6465115",
"0.6464044",
"0.636774",
"0.62718093",
"0.6264999",
"0.6180492",
"0.6174048",
"0.61573136",
"0.61374754",
"0.61334693",
"0.60591936",
"0.6051795",
"0.6031431",
"0.60227746",
"0.60095674",
"0.5990998",
"0.59709334",
"0.59526783",
"0.5945871",
"0.59291095",
"0.5913221",
"0.59014434",
"0.5883474",
"0.58832663",
"0.58743095",
"0.5835246",
"0.58173037",
"0.57876563",
"0.5775155",
"0.57593983",
"0.57567155",
"0.5753496",
"0.5746595",
"0.57450765",
"0.5742595",
"0.57353365",
"0.5734081",
"0.5728647",
"0.5726576",
"0.5717089",
"0.5716153",
"0.5712613",
"0.5703948",
"0.5703008",
"0.5694943",
"0.5693929",
"0.5685087",
"0.5680826",
"0.5673699",
"0.5670179",
"0.5664983",
"0.56616986",
"0.5657714",
"0.56491286",
"0.56423324",
"0.5637036",
"0.56365097",
"0.56267303",
"0.5621235",
"0.5620846",
"0.5614219",
"0.5601944",
"0.55978566",
"0.5597165",
"0.5592047",
"0.5586497",
"0.5579278",
"0.55758387",
"0.55608565",
"0.5558817",
"0.5554515",
"0.5539874",
"0.5529604",
"0.55228734",
"0.55199194",
"0.5518927",
"0.5516948",
"0.55117404",
"0.55026835",
"0.55025035",
"0.55024827",
"0.5501264",
"0.54972553",
"0.5492196",
"0.5484216",
"0.5476337",
"0.54758406",
"0.54695845",
"0.5468783",
"0.5463691",
"0.5463691",
"0.54625523",
"0.54556173",
"0.5453036",
"0.5424278",
"0.542415",
"0.5423249",
"0.54229236"
] | 0.7404985 | 0 |
GET /legalstatuses/1 GET /legalstatuses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end",
"def index\n @legalstatuses = Legalstatus.all\n end",
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def index\n @statuses = Status.all\n end",
"def index\n @statuses = Status.all\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def index\n @statuses = Status.search.page params[:page]\n end",
"def status\n sanitized = whitelist(params, :status)\n\n @travel = Travels::Travel.find(sanitized[:id])\n\n respond_to do |format|\n format.html # status.html.erb\n format.json { render json: { status: @travel.state.to_s } }\n end\n end",
"def show\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:get, params[:id])\n format.html # show.rhtml\n format.json { render :json => @tweet.to_json }\n format.xml { render :xml => @tweet.to_xml }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format)\n end\n end\n end",
"def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend",
"def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end",
"def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def status(status_id)\n response = @client.get(\"/api/v1/statuses/#{status_id}\")\n return JSON.parse(response.body)\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"def status\n get('/api/status')\n end",
"def index\n @search = Status.search(params[:search], :order => \"id DESC\")\n @statuses = @search.paginate(:page => params[:page], :order => \"id DESC\")\n\n @statuses = @statuses.where(:uid => params[:uid]) unless params[:uid].nil?\n @statuses = @statuses.where(:screen_name => params[:screen_name]) unless params[:screen_name].nil?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n end\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def public_timeline\n call( 'statuses/public_timeline.json' )\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end",
"def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def status\n get_json('status.json')\n end",
"def current_statuses_three\n @current_statuses = CurrentStatus.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @current_statuses}\n end\n end",
"def show\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_status }\n end\n end",
"def index\n @course_statuses = CourseStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course_statuses }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def show\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n config.access_token = ENV[\"TWITTER_ACCESS_TOKEN\"]\n config.access_token_secret = ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"]\n end\n\n begin\n timelines = client.user_timeline(@club.twitter_id)\n @tweets = []\n rescue\n end\n\n if timelines.present?\n timelines.each do |timeline_tweet|\n tweet = client.status(timeline_tweet.id)\n @tweets << tweet.text\n end\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def statuses\n api.get('status')\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def index\n @married_statuses = MarriedStatus.all\n end",
"def index\n @swit_statuses = SwitStatus.all\n end",
"def index\n @reqstatuses = Reqstatus.all\n end",
"def index\n @mstatuses = Mstatus.all\n end",
"def show\n @watcher = Watcher.includes(:tweets).friendly.find(params[:id])\n @statuses = Status.all\n respond_to do |format|\n format.html { render :show, offset: params[:offset]}\n format.json { render json: @watcher.tweets }\n end\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def parseResults( resp )\n data = JSON.parse(resp.body)\n\treturn data['statuses']\nend",
"def index\n @rh21_statuses = Rh21Status.all\n end",
"def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end",
"def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def print_timeline(response)\n \n tweets = response[\"statuses\"]\n \n for tweet in tweets\n puts tweet[\"user\"][\"screen_name\"]\n puts tweet[\"text\"]\n end\n \nend",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end",
"def show\r\n tweet = Tweet.find(params[:id])\r\n render json: tweet\r\n end",
"def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend",
"def get_tweet_by_id(id)\n tweet = Twitter.status(id)\n {:message => tweet.text, :author => tweet.user.screen_name, :date => tweet.created_at} \n end",
"def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end",
"def index\n @search = MaritalStatus.search(params[:search])\n @marital_statuses = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @marital_statuses }\n end\n end",
"def show\n @twitter_id = TwitterId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_id }\n end\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def index\n @lesson_statuses = LessonStatus.all\n end",
"def index\n @application_statuses = ApplicationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_statuses }\n end\n end",
"def index\n @type = params[:type] || 'raw'\n if @type == 'raw'\n condition = [\"domain = ? and state is null\", \"thevoice\"]\n elsif @type == 'auditing'\n condition = [\"domain = ? and state = ?\", \"thevoice\", 'auditing']\n elsif @type == 'pool'\n condition = [\"domain = ? and state = ? and id in (?)\", \"thevoice\", 'sent', Feed.all.map(&:status_id)]\n elsif @type == 'sent'\n condition = [\"domain = ? and state = ?\", \"thevoice\", 'sent']\n else\n condition = [\"domain = ?\",\"thevoice\"]\n end\n\n @statuses = Status.find(:all, :conditions => condition, :order => 'id DESC').paginate(:page => params[:page], :per_page => 20)\n @bulletin = Bulletin.new\n @bulletins = Bulletin.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def mentions(params = {})\n get \"statuses/mentions\", params\n end",
"def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end",
"def index\n @idea_statuses = IdeaStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @idea_statuses }\n end\n end",
"def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end",
"def show\n @new_status = NewStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @new_status }\n end\n end",
"def friends_timeline(params = {})\n get \"statuses/friends_timeline\", params\n end",
"def full_url\n @full_url ||= (Streaming.streaming_base_url / Streaming.api_version.to_s / \"statuses\" / \"#{@path}.json\")\n end",
"def list\r\n #page = params[:page].nil? ? 0 : params[:page]\r\n tweets = Tweet.all\r\n render json: tweets\r\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def show\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tweet }\n end\n end",
"def twubbles\n @sad_tweets = WordTweet.recent_sad_tweets\n respond_to do |f|\n f.json { render :json => twubbles_json(@sad_tweets) }\n f.html\n end\n end",
"def index\n @registration_statuses = RegistrationStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_statuses }\n end\n end",
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend",
"def next_public_timeline\n #If this is not the first call of this method, the 'since_id'\n #parameter will be used to fetch entries from that position on.\n param_str = @last_id ? \"?since_id=#{@last_id}\" : \"\"\n doc = REXML::Document.new open(\"http://twitter.com/statuses/public_timeline.xml#{param_str}\").read\n statuses = []\n doc.elements.each(\"/statuses/status\") do |status| \n user = status.elements['user']\n location = user.elements['location'].text || \"unknown\"\n time = Time.parse(status.elements['created_at'].text).strftime(\"%Y%m%d%H%M%S\")\n statuses << {:id => status.elements['id'].text, \n :text => status.elements['text'].text, \n :username => user.elements['name'].text,\n :userid => user.elements['id'].text,\n :time => time,\n :location => location}\n end\n statuses\n end",
"def show\n @annual_stat = AnnualStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def get_tweet\r\n begin\r\n\t return $client.status(tweet_id.to_i, tweet_mode: \"extended\")\r\n\t rescue Twitter::Error\r\n\t return nil\r\n\t end\r\n end",
"def show\n @retweet = Retweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retweet }\n end\n end",
"def index\n \n @page = params[:page].to_i\n if @page == 0\n @page = 1\n end\n @page = @page + 1 \n \n # @statuses = Status.find(:all, :order => \"created_at DESC\")\n @statuses = Status.paginate :page => params[:page], :order => 'created_at DESC' #, :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @statuses }\n format.js\n end\n end",
"def index\n @barrel_statuses = BarrelStatus.all\n end",
"def index\n respond_with RawTweet.all\n end",
"def tweet_data\n @politician = Politician.friendly.find(params[:slug])\n @issues = @politician.issues\n \n respond_to do |format|\n format.json {\n render :json => @politician.issues_mention_counts\n }\n end\n end",
"def index\n @tweets = Tweet.all\n\n render json: @tweets\n end",
"def index\n authenticate_user! if params[:page]\n @statuses = Status.all.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n end",
"def status(id)\n get(\"mailers/status/#{id.to_i}\")\n end",
"def index\n @typeofstatuses = Typeofstatus.all.page params[:page]\n end",
"def index\n @health_statuses = HealthStatus.all\n end",
"def index\n chain = Tweet\n chain = chain.since_id(params[:since_id]) if params[:since_id]\n @tweets = chain.all(:order => 'msg_twid ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def statuses; end",
"def show\n @status = Status.find(params[:id])\n end",
"def index\n @status2s = Status2.all\n end",
"def show\n render json: @tweet\n end",
"def index\n @technician_statuses = TechnicianStatus.all\n end",
"def index\n @inventory_statuses = InventoryStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_statuses }\n end\n end",
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format.html { render :edit }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_statuses\n return unless File.exist?(@status_path)\n\n File.open(@status_path, 'r') do |file|\n @statuses = JSON.parse(file.read)\n end\n end",
"def show \n \n @parsed_raw_tweet = ParsedRawTweet.find(params[:id])\n \n @title = \"Positive Sentiment | Parsed Raw Tweet ID: \"+params[:id]\n @keywords = \"\"\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parsed_raw_tweet }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n @stories = @contact.stories.order(\"updated_at desc\")\n # @contact.stories = Story.find(params[:contact_id])\n \n if @contact.twitter.present?\n @tweet = @contact.twitter\n twitter_url = \"http://search.twitter.com/search.json?q=#{@tweet}&include_entities=true&result_type=mixed&limit=10\"\n feeds = JSON.parse(open(twitter_url).read)\n @results = feeds[\"results\"]\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def get_tweet\n\t\tbegin\n\t return $client.status(tweet_id.to_i, tweet_mode: \"extended\")\n\t rescue Twitter::Error\n\t return nil\n\t end\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def show\n @status_ativ = StatusAtiv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ativ }\n end\n end",
"def status\n request :get, \"_status\"\n end",
"def status\n statuses.find(:first, :order => \"updated_at DESC\")\n end"
] | [
"0.66540307",
"0.6653958",
"0.6629162",
"0.63261473",
"0.63261473",
"0.62362653",
"0.62248176",
"0.61528414",
"0.61343324",
"0.6132748",
"0.6103023",
"0.609806",
"0.609794",
"0.6073009",
"0.60718715",
"0.60591614",
"0.60081697",
"0.60052973",
"0.6004673",
"0.59771657",
"0.5946676",
"0.5941721",
"0.5928141",
"0.5924977",
"0.5906433",
"0.5901514",
"0.5890783",
"0.58612067",
"0.58580345",
"0.58580345",
"0.5848156",
"0.5818352",
"0.58176047",
"0.5807618",
"0.57915866",
"0.57857484",
"0.5785591",
"0.5764399",
"0.57537794",
"0.57533926",
"0.57497215",
"0.57351494",
"0.5724031",
"0.57195866",
"0.57040215",
"0.5692499",
"0.568667",
"0.56865776",
"0.56773806",
"0.5669663",
"0.56586134",
"0.56513834",
"0.5644552",
"0.56421226",
"0.56416607",
"0.5637717",
"0.5637243",
"0.563534",
"0.5631347",
"0.5629001",
"0.5622323",
"0.5601484",
"0.5595212",
"0.5593789",
"0.55781144",
"0.5568761",
"0.5568761",
"0.5557694",
"0.5557623",
"0.5556102",
"0.5552639",
"0.5543459",
"0.5543453",
"0.5541667",
"0.55386734",
"0.55378544",
"0.55363977",
"0.55319667",
"0.5530261",
"0.55181986",
"0.55134857",
"0.5505436",
"0.5504868",
"0.54994494",
"0.54971427",
"0.5496015",
"0.5487345",
"0.5473738",
"0.5472845",
"0.54682076",
"0.54633784",
"0.54615176",
"0.54499215",
"0.5449207",
"0.54481405",
"0.544674",
"0.5440496",
"0.5438523",
"0.54353344",
"0.5421512",
"0.54111725"
] | 0.0 | -1 |
POST /legalstatuses POST /legalstatuses.json | def create
@legalstatus = Legalstatus.new(legalstatus_params)
respond_to do |format|
if @legalstatus.save
format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully created.' }
format.json { render :show, status: :created, location: @legalstatus }
else
format.html { render :new }
format.json { render json: @legalstatus.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_statuses\n end",
"def create_statuses\n end",
"def legalstatus_params\n params.require(:legalstatus).permit(:code, :text)\n end",
"def postTweet(status)\n\t\t\t@client.update(status)\n\t\tend",
"def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.state_facebook? && @status.content?\n current_user.facebook(current_user).put_wall_post(@status.content)\n end\n\n if current_user.state_twitter? && @status.content?\n current_user.twitter(current_user).update(@status.content)\n end\n \n respond_to do |format|\n if @status.save\n format.html { redirect_to statuses_url, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { redirect_to statuses_url }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @status = @user.statuses.build(status_params)\n\n #@status = Status.new(status_params)\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @current_statuses = CurrentStatus.new(current_statuses_params)\n\n respond_to do |format|\n if @current_statuses.save\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully created.' }\n format.json { render :show, status: :created, location: @current_statuses }\n else\n format.html { render :new }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet_params\n params.require(:tweet).permit(:status, :zombie_id)\n end",
"def create\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:post, params[:text])\n flash[:notice] = 'Tweet was successfully created.'\n format.html { redirect_to tweet_url(@tweet) }\n format.json { head :created, :location => tweet_url(@tweet) }\n format.xml { head :created, :location => tweet_url(@tweet) }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format, 'new')\n end\n end\n end",
"def index\n @legalstatuses = Legalstatus.all\n end",
"def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('statuses', :post) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end",
"def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end",
"def create\n @status = Status.new(status_params)\n\n if @status.save\n render json: @status\n else\n render json: @status.errors, status: :unprocessable_entity\n end\n end",
"def create\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new(params[:roof_status])\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @roof, notice: 'Спасибо что помогаете нам! Заявка отправлена на модерацию :)' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = current_user.statuses.new(params[:status])\n\n respond_to do |format|\n if @status.save\n current_user.create_activity(@status, 'created')\n format.html { redirect_to profile_path(current_user), notice: 'Status was successfully created.' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story_status = StoryStatus.new(params[:story_status])\n\n respond_to do |format|\n if @story_status.save\n format.html { redirect_to @story_status, :notice => 'Story status was successfully created.' }\n format.json { render :json => @story_status, :status => :created, :location => @story_status }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tw_stat = TwStat.new(tw_stat_params)\n\n respond_to do |format|\n if @tw_stat.save\n format.html { redirect_to @tw_stat, notice: 'Tw stat was successfully created.' }\n format.json { render :show, status: :created, location: @tw_stat }\n else\n format.html { render :new }\n format.json { render json: @tw_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = current_user.tweets.create(params[:tweet])\n respond_with(@tweet, :location => tweet_url(@tweet))\n end",
"def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @new_status = NewStatus.new(params[:new_status])\n\n respond_to do |format|\n if @new_status.save\n format.html { redirect_to @new_status, notice: 'New status was successfully created.' }\n format.json { render json: @new_status, status: :created, location: @new_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_status(name, description, level, image)\n response = @client.post(\"/api/v1/statuses\", { \"name\" => name, \"description\" => description, \"level\" => level, \"image\" => image })\n return JSON.parse(response.body)\n end",
"def create\n @lesson_status = LessonStatus.new(lesson_status_params)\n\n respond_to do |format|\n if @lesson_status.save\n format.html { redirect_to @lesson_status, notice: 'Lesson status was successfully created.' }\n format.json { render :show, status: :created, location: @lesson_status }\n else\n format.html { render :new }\n format.json { render json: @lesson_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin \n new_tweet = Tweet.new(tweet_params)\n if new_tweet.save()\n render(status: 201, json: {tweet: new_tweet})\n else # if validation fails\n render(status: 422, json: {error: new_tweet.errors})\n end\n rescue => error\n render(status: 500, json: {error: \"Internal Server Error: #{error.message}\"})\n end\n end",
"def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @status }\n else\n format.html { render action: 'new' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @married_status = MarriedStatus.new(married_status_params)\n\n respond_to do |format|\n if @married_status.save\n format.html { redirect_to @married_status, notice: 'Married status was successfully created.' }\n format.json { render :show, status: :created, location: @married_status }\n else\n format.html { render :new }\n format.json { render json: @married_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.new(params[:kf_status])\n\n respond_to do |format|\n if @kf_status.save\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\",notice: 'Status was successfully created.' }\n format.json { render json: @kf_status, status: :created, location: @kf_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n @status.user = current_user\n \n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to(statuses_path) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = current_user.tweets.build(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = @user.tweets.build(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to user_tweet_path(@user, @tweet), notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: user_tweet_path(@user, @tweet) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_params\n params.require(:status).permit(:title, :status_type)\n end",
"def create\n @status = Status.new(params[:status])\n @status.save\n\n redirect_to @status, notice: 'Status was successfully created.'\n end",
"def create\n @tweett = Tweett.new(tweett_params)\n\n respond_to do |format|\n if @tweett.save\n format.html { redirect_to @tweett, notice: 'Tweett was successfully created.' }\n format.json { render :show, status: :created, location: @tweett }\n else\n format.html { render :new }\n format.json { render json: @tweett.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = current_user.tweets.new(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_back fallback_location: root_path, notice: 'ツーイトの投稿が完了しました。' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anniversary = Anniversary.new\n form = params[:anniversary]\n @anniversary.anniversary = form[:anniversary]\n @anniversary.description = form[:description]\n\n @anniversary.user_id = current_user.id\n last_anniversary = Anniversary.find(:all, :conditions => ['user_id', '1']).first\n if last_anniversary\n @anniversary.date = last_anniversary.date + 1.days\n else\n @anniversary.date = Date.today + 1.days\n end\n @anniversary.save\n # FIXME 3rd parameter\n tweet_body = \"@#{@anniversary.user.twitter_id} は最高の幸せを噛み締めた。そう、一日は終わったのだ。http://cutend.me:3000/anniversaries/#{@anniversary.id} #cutend\"\n tweet_result = current_user.tweet({:tweet_body => tweet_body, :user => current_user})\n @anniversary.tweet_id = tweet_result[:id].to_i\n\n respond_to do |format|\n if @anniversary.save\n format.html { redirect_to '/anniversaries', notice: 'Anniversary was successfully created.' }\n format.json { render json: @anniversary, status: :created, location: @anniversary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @anniversary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_retweet(status)\n\t@tweet_db[status.retweeted_status.id] ||= {\n\t\t:original => status.retweeted_status,\n\t\t:retweets => {}\n\t}\n\t@tweet_db[status.retweeted_status.id][:retweets][status.id] = status\nend",
"def create\n @tweet = Tweet.new(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: @tweet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = Tweet.new(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: @tweet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @new_tweet = NewTweet.new(new_tweet_params)\n\n respond_to do |format|\n if @new_tweet.save\n format.html { redirect_to @new_tweet, notice: 'New tweet was successfully created.' }\n format.json { render :show, status: :created, location: @new_tweet }\n else\n format.html { render :new }\n format.json { render json: @new_tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityStatus( entity_id, status, inactive_reason, inactive_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['status'] = status\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n return doCurl(\"post\",\"/entity/status\",params)\n end",
"def create\n @posts_status = Posts::Status.new(posts_status_params)\n\n respond_to do |format|\n if @posts_status.save\n format.html { redirect_to @posts_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @posts_status }\n else\n format.html { render :new }\n format.json { render json: @posts_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking_status = BookingStatus.new(booking_status_params)\n\n respond_to do |format|\n if @booking_status.save\n format.html { redirect_to @booking_status, notice: 'Booking status was successfully created.' }\n format.json { render :show, status: :created, location: @booking_status }\n else\n format.html { render :new }\n format.json { render json: @booking_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = Tweet.new(tweet_params)\n \n respond_to do |format|\n if @tweet.save\n format.html { redirect_to tweets_path, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet_params\n params.require(:tweet).permit(:status, :message, :location, :user_id)\n end",
"def tweet_params\n params.require(:tweet).permit(:content, :total_tweet, :retweet)\n end",
"def create\n @marital_status = MaritalStatus.new(params[:marital_status])\n\n respond_to do |format|\n if @marital_status.save\n format.html { redirect_to(@marital_status, :notice => 'Marital status was successfully created.') }\n format.xml { render :xml => @marital_status, :status => :created, :location => @marital_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @marital_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status Type was successfully created.'\n format.html { redirect_to(@status) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'El Estado se creó exitosamente.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @technician_status = TechnicianStatus.new(technician_status_params)\n\n respond_to do |format|\n if @technician_status.save\n format.html { redirect_to @technician_status, notice: 'Technician status was successfully created.' }\n format.json { render :show, status: :created, location: @technician_status }\n else\n format.html { render :new }\n format.json { render json: @technician_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = current_user.tweets.build(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to member_url(current_user), notice: '投稿しました' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_statuses(options = {})\n build_statuses_resource(options)\n end",
"def create\n @learning_status = LearningStatus.new(learning_status_params)\n @learning_status.user = current_user\n\n respond_to do |format|\n if @learning_status.save\n format.html { redirect_to @learning_status, notice: 'Learning status was successfully created.' }\n format.json { render :show, status: :created, location: @learning_status }\n else\n format.html { render :new }\n format.json { render json: @learning_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def statusing_params\n params.require(:statusing).permit(:status_id)\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to status_url(@status) }\n format.xml { head :created, :location => status_url(@status) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invite_status = InviteStatus.new(params[:invite_status])\n\n respond_to do |format|\n if @invite_status.save\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully created.' }\n format.json { render json: @invite_status, status: :created, location: @invite_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render json: @tweet_api\n end",
"def create\n @tweet = Tweet.create(:user_id => current_user.id, :text => tweet_params[:text])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status\n @way.status = request.raw_post\n @way.save!\n render :text => @way.status\n end",
"def create(account, status, opts = {})\n params = { status: status }.merge!(opts)\n resource = RESOURCE_CREATE % { account_id: account.id }\n response = TwitterAds::Request.new(account.client, :post, resource, params: params).perform\n response.body[:data]\n end",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def status_params\n params.require(:status).permit(:title)\n end",
"def create\n @bookstatus = Bookstatus.new(bookstatus_params)\n\n respond_to do |format|\n if @bookstatus.save\n format.html { redirect_to @bookstatus, notice: \"Bookstatus was successfully created.\" }\n format.json { render :show, status: :created, location: @bookstatus }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bookstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_params\n params.require(:status).permit(:counted)\n end",
"def create\n username = params[:username]\n tweets = timeline_query username\n tweet_sentiment_list = get_sentiment(tweets)\n redirect_to :action => \"index\", :tweets => tweet_sentiment_list\n end",
"def add_status( thing, statusArray )\n data = {\n token: @applicationToken,\n thing_id: thing.id,\n id: 'null',\n status_array: statusArray\n }\n @httpHelper.post_data( 'status', data )\n end",
"def create\n @book_status = BookStatus.new(book_status_params)\n\n respond_to do |format|\n if @book_status.save\n format.html { redirect_to @book_status, notice: 'Book status was successfully created.' }\n format.json { render :show, status: :created, location: @book_status }\n else\n format.html { render :new }\n format.json { render json: @book_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @tweet = Tweet.new(tweet_params)\r\n @tweet.user = current_user\r\n \r\n respond_to do |format|\r\n if @tweet.save\r\n format.html { redirect_to @tweet, notice: \"Tweet was successfully created.\" }\r\n format.json { render :show, status: :created, location: @tweet }\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def tweet_params\n params.require(:tweet).permit(:tweet)\n end",
"def create\n @annual_stat = AnnualStat.new(params[:annual_stat])\n\n respond_to do |format|\n if @annual_stat.save\n format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully created.' }\n format.json { render json: @annual_stat, status: :created, location: @annual_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annual_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = Tweet.create(tweet_params)\n\n @tweet = get_tagged(@tweet)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to home_path, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relationship_status = RelationshipStatus.new(relationship_status_params)\n\n respond_to do |format|\n if @relationship_status.save\n format.html { redirect_to @relationship_status, notice: 'Relationship status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @relationship_status }\n else\n format.html { render action: 'new' }\n format.json { render json: @relationship_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def statusing_params\n params.require(:statusing).permit(:status_id)\n end",
"def tweet_params\n params.require(:tweet).permit(:content, :active)\n end",
"def create\n @tweet_collection = TweetCollection.new(tweet_collection_params)\n Tweet.tweets.each {|t| @tweet_collection.tweets << t}\n \n respond_to do |format|\n if @tweet_collection.save\n format.html { redirect_to @tweet_collection, notice: 'Tweet collection was successfully created.' }\n format.json { render :show, status: :created, location: @tweet_collection }\n else\n format.html { render :new }\n format.json { render json: @tweet_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_ativ = StatusAtiv.new(params[:status_ativ])\n\n respond_to do |format|\n if @status_ativ.save\n format.html { redirect_to @status_ativ, notice: 'Status ativ was successfully created.' }\n format.json { render json: @status_ativ, status: :created, location: @status_ativ }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_ativ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = Tweet.new(tweet_params)\n @tweet.user_vote = 0\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @health_status = HealthStatus.new(health_status_params)\n\n respond_to do |format|\n if @health_status.save\n format.html { redirect_to @health_status, notice: 'Health status was successfully created.' }\n format.json { render :show, status: :created, location: @health_status }\n else\n format.html { render :new }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweeeet = current_user.tweeeets.build(tweeeet_params)\n\n respond_to do |format|\n if @tweeeet.save\n format.html { redirect_to root_path, notice: 'Tweet creado con éxito!' }\n format.json { render :show, status: :created, location: @tweeeet }\n else\n format.html { render :new }\n format.json { render json: @tweeeet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to(@status, :notice => 'Status was successfully created.') }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @typeofstatus = Typeofstatus.new(typeofstatus_params)\n\n respond_to do |format|\n if @typeofstatus.save\n format.html { redirect_to @typeofstatus, notice: 'Typeofstatus was successfully created.' }\n format.json { render :show, status: :created, location: @typeofstatus }\n else\n format.html { render :new }\n format.json { render json: @typeofstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def married_status_params\n params.require(:married_status).permit(:name)\n end",
"def release_params\n params.require(:statuses_step_release).permit(:status)\n end",
"def create\n @counter = 0\n @teamstat = Teamstat.new(teamstat_params)\n\n @teamstat.toon_db = @teamstat.input.strip.split(/[\\r\\n ,]+/)\n @teamstat.toon_db.pop if @teamstat.toon_db[-1]==\"\\r\\n\"\n \n @teamstat.toon_db.each { |toonrealm| add_toon(toonrealm)}\n\n respond_to do |format|\n if @teamstat.save\n format.html { redirect_to @teamstat, notice: 'Teamstat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teamstat }\n else\n format.html { render action: 'new' }\n format.json { render json: @teamstat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reqstatus = Reqstatus.new(reqstatus_params)\n\n respond_to do |format|\n if @reqstatus.save\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reqstatus }\n else\n format.html { render action: 'new' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_akun = StatusAkun.new(status_akun_params)\n\n respond_to do |format|\n if @status_akun.save\n format.html { redirect_to @status_akun, notice: 'Status akun was successfully created.' }\n format.json { render :show, status: :created, location: @status_akun }\n else\n format.html { render :new }\n format.json { render json: @status_akun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def create\n @subcontractor_status = SubcontractorStatus.new(subcontractor_status_params)\n\n respond_to do |format|\n if @subcontractor_status.save\n format.html { redirect_to subcontractor_statuses_url, notice: 'Subcontractor status was successfully created.' }\n format.json { render :show, status: :created, location: @subcontractor_status }\n else\n format.html { render :new }\n format.json { render json: @subcontractor_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status\n sanitized = whitelist(params, :status)\n\n @travel = Travels::Travel.find(sanitized[:id])\n\n respond_to do |format|\n format.html # status.html.erb\n format.json { render json: { status: @travel.state.to_s } }\n end\n end",
"def create\n @searchstatus = Searchstatus.new(params[:searchstatus])\n\n respond_to do |format|\n if @searchstatus.save\n format.html { redirect_to @searchstatus, notice: 'Search status was successfully created.' }\n format.json { render json: @searchstatus, status: :created, location: @searchstatus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @searchstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tweet = Tweet.new(tweet_params)\n @tweet.user = current_user\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to root_path, notice: \"Tweet creado felizmente.\" }\n format.json { redirect_to root_path, status: :created, location: @tweet }\n else\n format.html { redirect_to root_path, notice: \"No se puede tuitear nada.\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def status_params\n params.require(:status).permit(:name)\n end",
"def create\n @status = Status.new(status_params)\n @status.character = @character\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to game_character_path(@game, @character), flash: { success: I18n.t('flash_messages.success.created', model: I18n.t('model.status')) } }\n format.json { render :show, status: :created, location: @status }\n else\n flash.now[:error] = I18n.t('flash_messages.error.form')\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def consume_statuses(statuses)\n statuses.map! do |status|\n NLP.normalize(status)\n end\n\n text = statuses.join(\"\\n\").encode('UTF-8', invalid: :replace)\n\n # adds the new sentence structures into the sentence array\n # instead of overwriting it\n mass_tikify(text).each do |sentence|\n @sentences << sentence\n end\n \n # if we're gonna keep the keyword limit at 200 and we want to preserve\n # our old keywords array then my solution is to union the new array\n # with the old, randomize them and take the first 200\n @keywords = @keywords.union(NLP\n .keywords(text)\n .top(200)\n .map(&:to_s)).sample(200)\n\n nil\n end",
"def create\n \n # API Status Update - Basic Authentication\n if !session[\"user_id\"]\n authenticate_or_request_with_http_basic do |username, password|\n if request.url.index('localhost')\n user = User.find(:first, :conditions => ['username LIKE ?', username.strip])\n else\n user = User.find(:first, :conditions => ['username ILIKE ?', username.strip])\n end\n\n if user && user.authenticate(password)\n session[\"user_id\"] = user.id\n end\n end\n end\n \n\n respond_to do |format|\n \n if params[:status] and params[:status][:message] \n postmessage = params[:status][:message]\n elsif params[:message] \n postmessage = params[:message]\n end\n \n if session[\"user_id\"] and postmessage\n\n @status = Status.new \n @status.user_id = session[\"user_id\"]\n @status.message = postmessage \n @status.save\n \n @activity = Activity.new\n @activity.user_id = session[\"user_id\"]\n @activity.status_id = @status.id\n @activity.council_id = @council.id\n @activity.save\n \n # Check if message includes a mention \n txtcall = @status.message.gsub(\"@\", \"\")\n txtarray = txtcall.split(\" \")\n if request.url.index('localhost')\n @mention = User.find(:first, :conditions => ['username LIKE ?', txtarray[0]])\n else\n @mention = User.find(:first, :conditions => ['username ILIKE ?', txtarray[0]])\n end\n \n if @mention and @mention.email and @mention.allowemail != false\n begin\n MentionMailer.alerter(session[:username], @mention.username, session[:image], @mention.email, @activity.id.to_s).deliver\n rescue\n end\n end \n \n # Tweet\n if session['access_token'] and params[:status][:twitter] == \"1\"\n @client.update(@status.message)\n end \n \n # FB\n if session['fbtoken'] and params[:status][:facebook] == \"1\"\n RestClient.post 'https://graph.facebook.com/' + session['fbid'] + '/feed', :access_token => session['fbtoken'], :message => @status.message\n end\n \n \n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n # format.json { render json: @status, status: :created, location: @status }\n format.js { render :action => 'create.js.coffee', :content_type => 'text/javascript'}\n format.json { render :json => @status}\n else\n format.html { render action: \"new\" }\n format.json { }\n end\n end\n end",
"def situations_arrivals_country_params\n params.require(:current_statuses).permit(:name, :slug, :description, :percentage_profile)\n end",
"def status_params\n params.require(:status).permit(:game_id, :character_id, :name, :race, :description, :biography)\n end",
"def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end",
"def tweett_params\n params.require(:tweett).permit(:tweett)\n end",
"def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.65436524",
"0.65436524",
"0.6144123",
"0.6125193",
"0.6115143",
"0.6028511",
"0.5986845",
"0.5928423",
"0.5866472",
"0.5856229",
"0.5829015",
"0.58262753",
"0.5793527",
"0.5783653",
"0.5739105",
"0.5720138",
"0.57171315",
"0.56681",
"0.5646018",
"0.56075555",
"0.5572053",
"0.5570115",
"0.5549738",
"0.55344886",
"0.5532393",
"0.5487823",
"0.5450906",
"0.54406923",
"0.54338837",
"0.54326147",
"0.5428769",
"0.5425642",
"0.54151016",
"0.54131943",
"0.54101366",
"0.53938913",
"0.5392319",
"0.5392319",
"0.53887904",
"0.537329",
"0.53676075",
"0.53635246",
"0.5362073",
"0.5353911",
"0.5348815",
"0.5346675",
"0.5346657",
"0.5345131",
"0.53403986",
"0.5339911",
"0.532518",
"0.53237987",
"0.53168195",
"0.5313924",
"0.530156",
"0.52954596",
"0.5289902",
"0.52802527",
"0.5277369",
"0.52765375",
"0.52748567",
"0.5271677",
"0.5264929",
"0.52648765",
"0.5264147",
"0.52610415",
"0.52540374",
"0.52530736",
"0.5252567",
"0.5251477",
"0.52459294",
"0.52455",
"0.52423346",
"0.5238348",
"0.52339953",
"0.52296615",
"0.5226938",
"0.5221575",
"0.5217772",
"0.5215547",
"0.52148813",
"0.52141523",
"0.52120364",
"0.5210683",
"0.5209373",
"0.5207926",
"0.52059203",
"0.5202837",
"0.5202079",
"0.5197744",
"0.51933527",
"0.5191349",
"0.51890576",
"0.518655",
"0.5185996",
"0.5180483",
"0.51701695",
"0.51675475",
"0.5166324",
"0.5162857"
] | 0.6317618 | 2 |
PATCH/PUT /legalstatuses/1 PATCH/PUT /legalstatuses/1.json | def update
respond_to do |format|
if @legalstatus.update(legalstatus_params)
format.html { redirect_to @legalstatus, notice: 'Legalstatus was successfully updated.' }
format.json { render :show, status: :ok, location: @legalstatus }
else
format.html { render :edit }
format.json { render json: @legalstatus.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format.html { render :edit }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n #LA\n #@status = current_user.statuses.find(status_params)\n\n #if (status_params) && (status_params).has_key?(:user_id)\n # (status_params).delete(:user_id) \n #end\n\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to statuses_url, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ticket = Ticket.find(params[:id])\n status = params[:status]\n\n if status and ticket.update_attributes(status: status)\n render json: {\"notice\"=>\"status updated successfully to '#{status}'\"}\n else\n render json: {\"alert\"=>\"status not updated. check params.\"}\n end\n end",
"def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end",
"def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reqstatus.update(reqstatus_params)\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n if can? :update, @status\n respond_to do |format|\n\n if @status.update(status_params)\n\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end",
"def update\n @new_status = NewStatus.find(params[:id])\n\n respond_to do |format|\n if @new_status.update_attributes(params[:new_status])\n format.html { redirect_to @new_status, notice: 'New status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status(new_stat)\n\n attrs = ActionController::Parameters.new({status: new_stat, req_to_del_at: nil})\n self.update_attributes(attrs.permit(Team::PERMIT_BASE))\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n if @story_status.update_attributes(params[:story_status])\n format.html { redirect_to @story_status, :notice => 'Story status was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n if @request_status.update_attributes(params[:request_status])\n format.html { redirect_to @request_status, notice: 'Request status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"statuses/#{attrs[:id]}\", :put) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"def update_status(payload, status)\n sha = payload.after\n repo = payload.repository.full_name\n state, description = status.first\n\n # setup http post\n uri = URI.parse(\"#{GITHUB_ROOT}/repos/#{repo}/statuses/#{sha}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n # post to GitHub\n params = {:state => state, :description => description, :context => CONTEXT}\n http.post(uri.path, params.to_json, HEADERS)\nend",
"def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end",
"def update_status\n update_params = {status: params[:status]}\n update_params[:password] = \"\" if params[:object] == \"User\"\n\n model = params[:object].constantize\n object = model.find(params[:status_id])\n if object.update_attributes(update_params)\n render json: {success:{msg: \"Updated #{params[:object]}\", id: object.id.to_s}}\n else \n render json: {failure:{msg: object.errors.full_messages.first}}\n end\n end",
"def update\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.find(params[:id])\n\n respond_to do |format|\n if @kf_status.update_attributes(params[:kf_status])\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\", notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tweet.update(tweet_params)\n respond_with(@tweet)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n @survey_url_id = args[:survey_url_id] if args.key?(:survey_url_id)\n end",
"def update\n respond_to do |format|\n if @sa_request_status.update(sa_request_status_params)\n format.html { redirect_to @sa_request_status, notice: 'Sa request status was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request_status }\n else\n format.html { render :edit }\n format.json { render json: @sa_request_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status_request.update(status_request_params)\n format.html { redirect_to @status_request, notice: 'Status request was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_request }\n else\n format.html { render :edit }\n format.json { render json: @status_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @health_status.update(health_status_params)\n format.html { redirect_to @health_status, notice: 'Health status was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_status }\n else\n format.html { render :edit }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tw_stat.update(tw_stat_params)\n format.html { redirect_to @tw_stat, notice: 'Tw stat was successfully updated.' }\n format.json { render :show, status: :ok, location: @tw_stat }\n else\n format.html { render :edit }\n format.json { render json: @tw_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @status_task = StatusTask.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @status_task.update_attributes(params[:status_task])\r\n format.html { redirect_to @status_task, notice: 'Status task was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @status_task.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @timeline.update(timeline_params)\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n flash[:notice] = 'Status Type was successfully updated.'\n format.html { redirect_to(@status) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_status\n @user = User.find(params[:data])\n\n respond_to do |format|\n if @user.update_attributes(status: params[:status])\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n\n respond_to do |format|\n if @marital_status.update_attributes(params[:marital_status])\n format.html { redirect_to(@marital_status, :notice => 'Marital status was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @marital_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n \t update_user_book = UsersBook.find(params[:id])\n \t update_user_book.status = params[:status]\n\n \t render :json => {:status => \"success\"}\n end",
"def update\r\n respond_to do |format|\r\n if @tweet.update(tweet_params)\r\n format.html { redirect_to @tweet}\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @married_status.update(married_status_params)\n format.html { redirect_to @married_status, notice: 'Married status was successfully updated.' }\n format.json { render :show, status: :ok, location: @married_status }\n else\n format.html { render :edit }\n format.json { render json: @married_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update\n @status = @object\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n flash[:notice] = 'Status was successfully updated.'\n format.html { redirect_to status_url(@status) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @status.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to user_tweet_path(@user, @tweet), notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @status_content = args[:status_content] if args.key?(:status_content)\n @status_file_name = args[:status_file_name] if args.key?(:status_file_name)\n end",
"def update\n @dispatching = Dispatching.find(params[:id])\n workflow = @dispatching.workflow\n respond_to do |format|\n if params[:warranty] == \"进厂\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"vehicle\")\n workflow.user_ids = params[:repairman_ids]\n workflow.users.each do |user|\n user.update_attributes(:status => \"busy\")\n end\n format.json { head :ok }\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n elsif params[:warranty] == \"救援\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"newpart\")\n format.json {head :ok}\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update_statuses(opts = {})\n response = Crocodoc.connection.get 'document/status',\n :uuids => @documents.values.map{|doc| doc.uuid }.join(',')\n response.body.each do |resp|\n @documents[resp['uuid']].status = resp\n end\n end",
"def update\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rh21_status.update(rh21_status_params)\n format.html { redirect_to @rh21_status, notice: 'Rh21 status was successfully updated.' }\n format.json { render :show, status: :ok, location: @rh21_status }\n else\n format.html { render :edit }\n format.json { render json: @rh21_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n if @invite_status.update_attributes(params[:invite_status])\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@headline, headline_params)\n end",
"def update\n respond_to do |format|\n if @subcontractor_status.update(subcontractor_status_params)\n format.html { redirect_to @subcontractor_status, notice: 'Subcontractor status was successfully updated.' }\n format.json { render :show, status: :ok, location: @subcontractor_status }\n else\n format.html { render :edit }\n format.json { render json: @subcontractor_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @swit_status.update(swit_status_params)\n format.html { redirect_to @swit_status, notice: 'Swit status was successfully updated.' }\n format.json { render :show, status: :ok, location: @swit_status }\n else\n format.html { render :edit }\n format.json { render json: @swit_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @status = Status.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:status])\n flash[:notice] = 'Status was successfully updated.'\n format.html { redirect_to(@status) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @relationship_status.update(relationship_status_params)\n format.html { redirect_to @relationship_status, notice: 'Relationship status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @relationship_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @technician_status.update(technician_status_params)\n format.html { redirect_to @technician_status, notice: 'Technician status was successfully updated.' }\n format.json { render :show, status: :ok, location: @technician_status }\n else\n format.html { render :edit }\n format.json { render json: @technician_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @retweet = Retweet.find(params[:id])\n\n respond_to do |format|\n if @retweet.update_attributes(params[:retweet])\n format.html { redirect_to @retweet, notice: 'Retweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status2.update(status2_params)\n format.html { redirect_to @status2, notice: 'Status2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @status2 }\n else\n format.html { render :edit }\n format.json { render json: @status2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n if @timeline.update_attributes(params[:timeline])\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n if @timeline.update_attributes(params[:timeline])\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_status.update(contract_status_params)\n format.html { redirect_to @contract_status, notice: 'Contract status was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_status }\n else\n format.html { render :edit }\n format.json { render json: @contract_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @annual_stat = AnnualStat.find(params[:id])\n\n respond_to do |format|\n if @annual_stat.update_attributes(params[:annual_stat])\n format.html { redirect_to @annual_stat, notice: 'Annual stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annual_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timeline.update(timeline_params)\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeline }\n else\n format.html { render :edit }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timeline.update(timeline_params)\n format.html { redirect_to @timeline, notice: 'Timeline was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeline }\n else\n format.html { render :edit }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @format = args[:format] if args.key?(:format)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_status.update(book_status_params)\n format.html { redirect_to @book_status, notice: 'Book status was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_status }\n else\n format.html { render :edit }\n format.json { render json: @book_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end"
] | [
"0.66764855",
"0.64086103",
"0.6344793",
"0.6315379",
"0.6261616",
"0.6235401",
"0.62259835",
"0.62110996",
"0.61854464",
"0.61854464",
"0.61702174",
"0.61626023",
"0.6150136",
"0.6131052",
"0.6131052",
"0.61271745",
"0.6063575",
"0.60505676",
"0.60452765",
"0.6038075",
"0.602767",
"0.59955287",
"0.59859455",
"0.5947986",
"0.59238434",
"0.5903576",
"0.5901391",
"0.5900453",
"0.58963007",
"0.5884653",
"0.58844054",
"0.5882552",
"0.5877009",
"0.5870982",
"0.5859531",
"0.5852815",
"0.5850974",
"0.5834326",
"0.58197343",
"0.58184695",
"0.58111775",
"0.5806249",
"0.5797912",
"0.5795865",
"0.5795865",
"0.5795865",
"0.5795865",
"0.5795865",
"0.5795865",
"0.57935977",
"0.5790466",
"0.5790128",
"0.57870585",
"0.57854253",
"0.57846254",
"0.57846254",
"0.57846254",
"0.5784101",
"0.5782146",
"0.5782146",
"0.5782146",
"0.5782146",
"0.5782146",
"0.5782146",
"0.577672",
"0.5776257",
"0.5769916",
"0.5769403",
"0.57691723",
"0.5767943",
"0.5767395",
"0.5765515",
"0.5764162",
"0.57576233",
"0.57542145",
"0.5744978",
"0.5744141",
"0.5744141",
"0.5742778",
"0.57371753",
"0.5735438",
"0.5735438",
"0.57347196",
"0.5734605",
"0.5734506",
"0.5729394",
"0.5727934",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522",
"0.5719522"
] | 0.62303233 | 6 |
DELETE /legalstatuses/1 DELETE /legalstatuses/1.json | def destroy
@legalstatus.destroy
respond_to do |format|
format.html { redirect_to legalstatuses_url, notice: 'Legalstatus was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @new_status = NewStatus.find(params[:id])\n @new_status.destroy\n\n respond_to do |format|\n format.html { redirect_to new_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n flash[:notice] = 'Status deleted'\n \n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @current_statuses.destroy\n respond_to do |format|\n format.html { redirect_to current_statuses_url, notice: 'Current Statuses was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_status = StoryStatus.find(params[:id])\n @story_status.destroy\n\n respond_to do |format|\n format.html { redirect_to story_statuses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rh21_status.destroy\n respond_to do |format|\n format.html { redirect_to rh21_statuses_url, notice: 'Rh21 status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuss_url) }\n format.xml { head :ok }\n end\n end",
"def delete_status(id)\n delete(\"/statuses/#{id}\")\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n redirect_to statuses_url\n end",
"def destroy\n @reqdevstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqdevstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @searchstatus = Searchstatus.find(params[:id])\n @searchstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to searchstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contaminationstatus.destroy\n respond_to do |format|\n format.html { redirect_to contaminationstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kf_status = Kf::Status.find(params[:id])\n @kf_status.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @civil_status = CivilStatus.find(params[:id])\n @civil_status.destroy\n\n respond_to do |format|\n format.html { redirect_to civil_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sa_request_status.destroy\n respond_to do |format|\n format.html { redirect_to sa_request_statuses_url, notice: 'Sa request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typeofstatus.destroy\n respond_to do |format|\n format.html { redirect_to typeofstatuses_url, notice: 'Typeofstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if can? :delete, @status\n @status.destroy\n respond_to do |format|\n\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @active_status = ActiveStatus.find(params[:id])\n @active_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(active_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @health_status.destroy\n respond_to do |format|\n format.html { redirect_to health_statuses_url, notice: 'Health status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tw_stat.destroy\n respond_to do |format|\n format.html { redirect_to tw_stats_url, notice: 'Tw stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @married_status.destroy\n respond_to do |format|\n format.html { redirect_to married_statuses_url, notice: 'Married status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite_status = InviteStatus.find(params[:id])\n @invite_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @swit_status.destroy\n respond_to do |format|\n format.html { redirect_to swit_statuses_url, notice: 'Swit status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_request.destroy\n respond_to do |format|\n format.html { redirect_to status_requests_url, notice: 'Status request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mstatus.destroy\n respond_to do |format|\n format.html { redirect_to mstatuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @technician_status.destroy\n respond_to do |format|\n format.html { redirect_to technician_statuses_url, notice: 'Technician status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_record = StatusRecord.find(params[:id])\n @status_record.destroy\n\n respond_to do |format|\n format.html { redirect_to status_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_user_status.destroy\n respond_to do |format|\n format.html { redirect_to master_user_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_akun.destroy\n respond_to do |format|\n format.html { redirect_to status_akun_index_url, notice: 'Status akun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission_status.destroy\n respond_to do |format|\n format.html { redirect_to admin_mission_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson_status.destroy\n respond_to do |format|\n format.html { redirect_to lesson_statuses_url, notice: 'Lesson status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status2.destroy\n respond_to do |format|\n format.html { redirect_to status2s_url, notice: 'Status2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_status.destroy\n respond_to do |format|\n format.html { redirect_to contract_statuses_url, notice: 'Contract status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payumoney_status.destroy\n respond_to do |format|\n format.html { redirect_to payumoney_statuses_url, notice: 'Payumoney status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posts_status.destroy\n respond_to do |format|\n format.html { redirect_to posts_statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrel_status.destroy\n respond_to do |format|\n format.html { redirect_to barrel_statuses_url, notice: 'Barrel status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invstatus.destroy\n respond_to do |format|\n format.html { redirect_to invstatuses_url, notice: 'Invstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcontractor_status.destroy\n respond_to do |format|\n format.html { redirect_to subcontractor_statuses_url, notice: 'Subcontractor status was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent_status = AgentStatus.find(params[:id])\n @agent_status.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timeline.destroy\n respond_to do |format|\n format.html { redirect_to timelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to game_character_path(@game, @character), flash: { success: I18n.t('flash_messages.success.deleted', model: I18n.t('model.status')) } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @learning_status.destroy\n respond_to do |format|\n format.html { redirect_to learning_statuses_url, notice: 'Learning status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_status.destroy\n respond_to do |format|\n format.html { redirect_to store_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itemstatus = Itemstatus.find(params[:id])\n @itemstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstatuses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_path(current_user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:delete, params[:id])\n flash[:message] = \"Tweet with id #{params[:id]} was deleted from Twitter\"\n format.html { redirect_to tweets_url }\n format.json { head :ok }\n format.xml { head :ok }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format)\n end\n end\n end",
"def destroy\n @relationship_status.destroy\n respond_to do |format|\n format.html { redirect_to relationship_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record_status = RecordStatus.find(params[:id])\n @record_status.destroy\n\n respond_to do |format|\n format.html { redirect_to record_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_status.destroy\n respond_to do |format|\n format.html { redirect_to entity_statuses_url, notice: 'Entity status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_status.destroy\n respond_to do |format|\n format.html { redirect_to booking_statuses_url, notice: 'Booking status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_stat.destroy\n respond_to do |format|\n format.html { redirect_to quest_stats_url, notice: 'Quest stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",
"def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end",
"def destroy\n @status = @object\n @status.destroy\n flash[:error] = @status.errors.on_base unless @status.errors.empty?\n\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_status.destroy\n respond_to do |format|\n format.html { redirect_to service_statuses_url, notice: 'Service status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @tweet.destroy\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twitter_id = TwitterId.find(params[:id])\n @twitter_id.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_ids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enginestatus.destroy\n respond_to do |format|\n format.html { redirect_to enginestatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_item.destroy\n respond_to do |format|\n format.html { redirect_to status_items_url, notice: 'El estatus del articulo fue eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_type_status.destroy\n respond_to do |format|\n format.html { redirect_to payment_type_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n @purchase_item_status.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_item_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appointment_status.destroy\n respond_to do |format|\n format.html { redirect_to appointment_statuses_url, notice: 'Appointment status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_status_mod = MediumStatusMod.find(params[:id])\n @medium_status_mod.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_status_mods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player_status.destroy\n respond_to do |format|\n format.html { redirect_to player_statuses_url, notice: 'Player status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usage_status = UsageStatus.find(params[:id])\n @usage_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(usage_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @twenty.destroy\n respond_to do |format|\n format.html { redirect_to twenties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacancy_request_status.destroy\n respond_to do |format|\n format.html { redirect_to vacancy_request_statuses_url, notice: 'Vacancy request status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_status.destroy\n respond_to do |format|\n format.html { redirect_to member_statuses_url, notice: 'Member status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_status = DocumentStatus.find(params[:id])\n @document_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_document_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @annual_stat = AnnualStat.find(params[:id])\n @annual_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to annual_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_status = InventoryStatus.find(params[:id])\n @inventory_status.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timeline = Timeline.find(params[:id])\n @timeline.destroy\n\n respond_to do |format|\n format.html { redirect_to timelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_status.destroy\n respond_to do |format|\n format.html { redirect_to asset_statuses_url, notice: 'Asset status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_status = ProjectStatus.find(params[:id])\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to healths_url, notice: 'Health was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.73920476",
"0.73458785",
"0.73326504",
"0.7237071",
"0.72144437",
"0.7211335",
"0.71939945",
"0.7157266",
"0.7122924",
"0.7085873",
"0.70427907",
"0.70313346",
"0.70313346",
"0.70294374",
"0.70289266",
"0.7002675",
"0.6991998",
"0.69873947",
"0.69333905",
"0.6917524",
"0.690518",
"0.6902048",
"0.6900312",
"0.68934244",
"0.6887359",
"0.68791044",
"0.68576217",
"0.6849827",
"0.68278486",
"0.6811831",
"0.6801898",
"0.67881465",
"0.6778317",
"0.67687565",
"0.6751159",
"0.6741213",
"0.67377985",
"0.6733251",
"0.67276907",
"0.6726958",
"0.6711883",
"0.6703774",
"0.66999775",
"0.66976994",
"0.6694332",
"0.66911334",
"0.66840863",
"0.66800445",
"0.66650647",
"0.6653625",
"0.6652968",
"0.6652154",
"0.66504896",
"0.6646536",
"0.6635495",
"0.66331977",
"0.6632733",
"0.66215175",
"0.66206884",
"0.66137064",
"0.66133374",
"0.66092986",
"0.66021323",
"0.6601256",
"0.6593235",
"0.65897375",
"0.6586394",
"0.6584033",
"0.6578582",
"0.65734893",
"0.6570496",
"0.6568104",
"0.65626526",
"0.6561919",
"0.6561154",
"0.6558907",
"0.65507996",
"0.65462244",
"0.6545798",
"0.65428",
"0.6537014",
"0.65327185",
"0.6528562",
"0.6528322",
"0.6527676",
"0.65255785",
"0.6521518",
"0.65185237",
"0.65181065",
"0.65177774",
"0.65158296",
"0.65099245",
"0.650706",
"0.650706",
"0.65053916",
"0.6503059",
"0.6503006",
"0.65008736",
"0.65003526",
"0.64985704"
] | 0.7413961 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_legalstatus
@legalstatus = Legalstatus.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_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def 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 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 action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n 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 startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def 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 action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); 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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup_signals; 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 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 after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; 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 save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 setup(&blk)\n @setup_block = blk\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 callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\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 duas1(action)\n action.call\n action.call\nend"
] | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def legalstatus_params
params.require(:legalstatus).permit(:code, :text)
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 |
Use callbacks to share common setup or constraints between actions. | def set_credit
@credit = Credit.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def credit_params
params.require(:credit).permit(:amount, :content, :created_user_id, :credit, :completed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n 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",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
Menu Helper not included in Groups Controller... | def link_to_switch_locale( locale, trigger=false )
uparams = params.dup
uparams[:locale] = locale
options = {:title => locale}
options = options.merge({:class => "dropdown-toggle locale-switcher", :"data-toggle" => "dropdown", :"data-target" => "#" }) if trigger
link_to "#{image_tag("flags/#{locale}.png")}#{trigger ? '<b class=\'caret\'></b>' : ''}".html_safe, refinery.url_for(uparams.merge(:only_path => true )), options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])\n menu.push([t(\"menu.users\"), admin_users_path, Proc.new {controller_name == \"users\"}])\n menu.push([t(\"menu.profile\"), admin_profile_path, Proc.new {controller_name == \"profile\"}])\n menu.push([t(\"menu.logout\"), logout_path])\n end\n menu\n end",
"def assigned_menu\n\n end",
"def render_menus \n# student_menu = add_menu('#{@studentb.full_name}')\n student_menu = add_menu('#{image_tag(@studentb.thumb_image,:style=>\";float:left;height:25px;margin-right:10px;\") + \" \" + @studentb.full_name + \" \"}',:action=>'profile')\n student_menu.add_submenu('Profile',:action=>'profile')\n student_menu.add_submenu('Photos',:action=>'photo',:if=>\"@studentb.visible_album_counts(@me) > 0\") \n student_menu.add_submenu('Binder',:action=>'show_notes',:if=>\"@studentb.notes.not_anonymous.size > 0\") \n \n end",
"def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend",
"def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end",
"def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end",
"def menu\n \nend",
"def menu\nend",
"def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end",
"def navlistbar_groups_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take-part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Groups/\"), __method__)\n end",
"def menu # can do custom methods within a method/class\n end",
"def getMenu(menu)\n end",
"def show # Show method\n menu # Show menu method above\n end",
"def nav\n 'nav_admin'\n end",
"def menu_items\n\n menu.items(self)\n\n end",
"def system_menu\n reply = []\n\n reply << if current_user == User.anonymous\n MenuItem.new('Sign In', new_session_path)\n else\n MenuItem.new('Profile', current_user)\n end\n\n reply += [\n MenuItem.new('Dashboard', admin_root_path),\n MenuItem.new('Content', admin_nodes_path, [\n MenuItem.new('New', new_admin_node_path, ScratchPad::Addon::NodeExtension.enabled.sort.map { |extension|\n MenuItem.new(extension.title, new_admin_node_path(:node_type => extension.machine_name))\n })\n ]),\n MenuItem.new('Taxonomy', admin_vocabularies_path, [\n MenuItem.new('New', new_admin_vocabulary_path)\n ]),\n MenuItem.new('Filters', admin_filter_groups_path, [\n MenuItem.new('New', new_admin_filter_group_path)\n ]),\n MenuItem.new('Themes', admin_themes_path, [\n MenuItem.new('Frontend', admin_themes_path(:scope => :frontend)),\n MenuItem.new('Backend', admin_themes_path(:scope => :backend))\n ]),\n MenuItem.new('Users', admin_users_path, [\n MenuItem.new('New', new_admin_user_path)\n ]),\n MenuItem.new('Groups'),\n MenuItem.new('Permissions'),\n MenuItem.new('Settings', admin_settings_path),\n MenuItem.new('Addon Configuration', admin_addon_configurations_path, ScratchPad::Addon::Base.addon_types.map { |addon_type|\n MenuItem.new(addon_type.title.pluralize, admin_addon_configurations_path(addon_type.machine_name))\n })\n ] if authorize\n\n reply\n end",
"def main_Menu_Name\n Goldberg.menu.main_Menu_Name\n end",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend",
"def show\n @menu_item = MenuItem.new\n @menu_group = MenuGroup.find(params[:id])\n @menu_items = MenuItem.where(menu_group_id: @menu_group.id)\n end",
"def display_sub_menu?\n @sub_menus = nil\n\n # sub-menu for Catalog Management\n if controller.is_a?(AdminLeelah::CatalogManagement::CatalogManagementController)\n @sub_menus = {\n '.link.products' => admin_leelah_catalog_management_products_path,\n '.link.categories' => admin_leelah_catalog_management_categories_path,\n }\n # sub-menu for Order Management\n elsif controller.is_a?(AdminLeelah::OrderManagement::OrderManagementController)\n @sub_menus = {\n '.link.orders' => admin_leelah_order_management_orders_path,\n }\n # sub-menu for General Configuration\n elsif controller.is_a?(AdminLeelah::GeneralConfiguration::GeneralConfigurationController)\n @sub_menus = {\n '.link.users' => admin_leelah_general_configuration_users_path,\n }\n end\n\n @sub_menus\n end",
"def menu_group(options = {}, &block)\n pull_class = \"navbar-#{options[:pull]}\" if options[:pull].present?\n content_tag(:ul, class: \"nav navbar-nav #{pull_class}\", &block)\n end",
"def index\n @menu_groups = MenuGroup.where(:user_id => current_user.id).order(id: :asc)\n end",
"def menu\n \n \n\nend",
"def main_menu\n render :partial => 'menus/main_menu'\n end",
"def menu_type\n\t\t\"secondary\" if controller_name == \"users\"\n\tend",
"def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms/media',\n :options => {:title => app.t.media_admin_menu.album_management,\n :link_route => \"/admin/media/album\",\n :description => 'The albums admin tools to create and modify media albums.',\n :module => 'cms',\n :weight => 2}}] \n \n end",
"def menu_items\n menu.items(self)\n end",
"def menu_items\n menu.items(self)\n end",
"def display_menu\n if project?\n content_tag(:div, :id => 'menu') do\n render :partial => 'layouts/menu_nav'\n end\n end\n end",
"def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end",
"def setup_side_menu_items\n @site_menu_items ||= []\n end",
"def goldberg_suckerfish_menu\n \n\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_suckerfish.rhtml\", :use_full_path => false, :locals => {:items => Goldberg.menu.get_menu(0)}\n end",
"def build_menu\n comment = table_info['comment']\n # #puts \"build Rails menu for #{model_name} (#{comment}) in\n # app/views/shared\"\n @@menus << { :model_name => model_name, :comment => comment, :route => \"/\"+ plural_table_name}\n \n end",
"def menu(context={})\n \n app = context[:app]\n\n menu_items = [{:path => '/system',\n :options => {\n \t:title => app.t.system_admin_menu.system_menu,\n :description => 'System menu',\n :module => :system,\n :weight => 0\n }\n },\n {:path => '/system/logger', \n :options => {:title => app.t.system_admin_menu.logger,\n :link_route => \"/admin/logger\",\n :description => 'Reads the logs',\n :module => :system,\n :weight => 1}\n },\n {:path => '/system/business-events', \n :options => {:title => app.t.system_admin_menu.business_event,\n :link_route => \"/admin/business-events\",\n :description => 'Manages business events',\n :module => :system,\n :weight => 0}\n }\n ] \n \n end",
"def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms',\n :options => {:title => app.t.cms_admin_menu.cms_menu,\n :description => 'Content management', \n :module => 'cms',\n :weight => 10}},\n {:path => '/cms/newcontent',\n :options => {:title => app.t.cms_admin_menu.content_new,\n :link_route => \"/admin/cms/content/new\",\n :description => 'Creates a new content.',\n :module => 'cms',\n :weight => 6}}, \n {:path => '/cms/contenttypes',\n :options => {:title => app.t.cms_admin_menu.contenttype_management,\n :link_route => \"/admin/cms/content-types\",\n :description => 'Manages the content types: creation and update of content types.',\n :module => 'cms',\n :weight => 5}}, \n {:path => '/cms/contents',\n :options => {:title => app.t.cms_admin_menu.content_management,\n :link_route => \"/admin/cms/contents\",\n :description => 'Contents explorer.',\n :module => 'cms',\n :weight => 4}},\n {:path => '/cms/comments',\n :options => {:title => app.t.cms_admin_menu.comment_management,\n :link_route => \"/admin/cms/comments\",\n :description => 'Comments manager.',\n :module => 'cms',\n :weight => 3}}, \n {:path => '/cms/taxonomies', \n :options => {:title => app.t.cms_admin_menu.taxonomy_management,\n :link_route => \"/admin/cms/taxonomy\",\n :description => 'Manages the taxonomies: creation and update of taxonomies.',\n :module => 'cms',\n :weight => 2}},\n {:path => '/cms/templates', \n :options => {:title => app.t.cms_admin_menu.template_management,\n :link_route => \"/admin/cms/templates\",\n :description => 'Manages template: creation and update of template.',\n :module => 'cms',\n :weight => 1}}, \n {:path => '/cms/redirects',\n :options => {:title => app.t.cms_admin_menu.redirects_management,\n :link_route => \"/admin/cms/redirects\",\n :description => 'Redirects a content',\n :module => 'cms',\n :weight => 12}}, \n {:path => '/sbm',\n :options => {:title => app.t.cms_admin_menu.build_site_menu,\n :description => 'Site building',\n :module => 'cms',\n :weight => 9 }},\n {:path => '/sbm/blocks', \n :options => {:title => app.t.cms_admin_menu.block_management,\n :link_route => \"/admin/cms/blocks\",\n :description => 'Manage the blocks. It allows to discover and configure modules blocks.',\n :module => 'cms',\n :weight => 6}},\n {:path => '/sbm/views',\n :options => {:title => app.t.cms_admin_menu.view_management,\n :link_route => \"/admin/cms/views\",\n :description => 'Manage the views: creation and update of views.',\n :module => 'cms',\n :weight => 5}},\n {:path => '/sbm/menus', \n :options => {:title => app.t.site_admin_menu.menu_management,\n :link_route => \"/admin/cms/menu-management\",\n :description => 'Manage the menus. It allows to define custom menus.',\n :module => :cms,\n :weight => 7}}\n ] \n \n end",
"def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend",
"def admin_menu \n @admin_menu ||= [\n ['overview', :dashboard, {controller: 'gricer/dashboard', action: 'overview'}],\n ['visitors', :menu, [\n ['entry_pages', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'entry_path'}],\n ['referers', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'referer_host'}],\n ['search_engines', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_engine'}],\n ['search_terms', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'search_query'}],\n ['countries', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'country'}],\n ['domains', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'domain'}],\n ['locales', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'requested_locale_major'}]\n ] ],\n ['pages', :menu, [\n ['views', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'path'}],\n ['hosts', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'host'}],\n ['methods', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'method'}],\n ['protocols', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'protocol'}],\n ] ],\n ['browsers', :menu, [\n ['browsers', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.name'}],\n ['operating_systems', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.os'}],\n ['engines', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'agent.engine_name'}],\n ['javascript', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'javascript'}],\n ['java', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'java'}],\n ['silverlight', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'silverlight_major_version'}],\n ['flash', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'flash_major_version'}],\n ['screen_sizes', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_size'}],\n ['color_depths', :spread, {controller: 'gricer/sessions', action: 'spread_stats', field: 'screen_depth'}]\n ] ]\n ]\n end",
"def index\n @root_menus = @system_config.menus.root_menus\n end",
"def main_menu_link; MAIN_MENU_LINK; end",
"def nav_sub_menu_item(sub_menu_label, permission, route = '#', title = '', options = {})\n model_name = route.gsub( /(new|path|admin|_|\\/)/, '').strip.capitalize.singularize.constantize\n controller = route.gsub(/(new|path|admin|_|\\/)/, '').strip.downcase.underscore.pluralize\n sub_menu_label = t(\"activerecord.models.#{sub_menu_label}\")\n action, sub_menu_label = permission.eql?(:create) ? [:new, \"Cadastrar #{sub_menu_label}\"] : [:index, \"Listar #{sub_menu_label}\"]\n new_route = { :controller => \"admin/#{controller}\", :action => action }\n content_tag(:li, link_to(sub_menu_label, new_route, :title => title)) if can? permission, model_name\n end",
"def header_menu\n return [] unless current_user\n permissions = current_user.permissions.pluck(:name)\n permissions << 'administration_section' if current_user.admin_permission?\n MENU['permissions'].select do |key, value|\n value if permissions.include? key\n end\n end",
"def init_menu\n @menus.set_selected(\"dashboard\")\n end",
"def li_navbar_misc\n menu = :misc\n # drop down list for the Misc menu\n sub_menus = {merchandise: admin_merchandise_pieces_path,\n infos_samples: samples_my_studio_infos_path,\n stories: admin_stories_path,\n infos_faqs: faq_my_studio_infos_path}\n dropdown_active, sub_menu_html = navbar_dropdown_sub_menus(menu, sub_menus)\n li_navbar_dropdown_menu(menu, sub_menu_html, dropdown_active)\n end",
"def menu_for(parent, abstract_model = nil, object = nil, only_icon = true) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }\n actions.collect do |action|\n next unless authorized?(action.action_name, abstract_model)\n wording = wording_for(:menu, action)\n href_url = case action.action_name.to_s\n when \"export\"\n \"/admin/#{abstract_model.try(:to_param)}.xls\"\n when \"import\"\n \"/admin/#{abstract_model.try(:to_param)}/import\"\n else\n url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))\n end\n case action.key.to_s\n when \"new\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:left\">\n <a class=\"btn btn-primary\"}\" href=\"#{href_url}\">#{wording}</a>\n </li>\n )\n when \"import\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"export\"\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\" style=\"float:right\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\" style=\"float:left;\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n when \"index\"\n else\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"#{action.pjax? ? 'pjax' : ''}\" href=\"#{href_url}\">\n <span>#{wording}</span>\n </a>\n </li>\n )\n end\n end.join.html_safe\n end",
"def menu_items_html\n @menu_items = MenuItem.where(show: true, type_item: \"Головне меню\").order(order_item: :asc)\n\n @menu = '<ul class=\"nav navbar-nav\">'\n\n @menu_items.each do |m_a|\n if m_a.parent_id == 0\n @menu << \"<li class='dropdown'><a class='dropdown-toggle' aria-expanded='false' aria-haspopup = 'true' data-toggle = 'dropdown' href = '#{m_a.link}' role = 'button' target= 'blank'> #{m_a.title} <span class='caret'></span></a>\" if m_a.type_level == 'Заголовок меню'\n @menu << \"<li > <a href = '#{m_a.link}'> #{m_a.title} </span></a>\" if m_a.type_level == 'Пункт меню'\n\n get_children m_a.id, m_a.type_level\n\n @menu << '</li>'\n end\n end\n @menu << '</ul>'\n # $menu << @menu\n end",
"def nav_menu_item(menu_label, &block)\n \n icon = case menu_label\n when 'category' ; \"<i class='icon-tag'></i>\"\n when 'user' ; \"<i class='icon-user'></i>\"\n when 'post' ; \"<i class='icon-font'></i>\"\n when 'comment' ; \"<i class='icon-comment'></i>\"\n when 'archive' ; \"<i class='icon-upload'></i>\"\n end \n\n menu_label = t(\"activerecord.models.#{menu_label}\")\n content_tag(:li, :class => 'dropdown') do \n link_to(\"#{icon} #{menu_label} <b class='caret'></b>\".html_safe, '#', :class => 'dropdown-toggle', :data => { :toggle => 'dropdown' }) +\n content_tag(:ul, :class => 'dropdown-menu') do \n capture(&block)#yield\n end\n end\n end",
"def create_menus\n @file_menu = menu_bar.add_menu(tr(\"&File\"))\n @currency_menu = menu_bar.add_menu(tr(\"&Currency\"))\n @currency_menu.add_action(@import_file_action)\n @currency_menu.add_action(@import_url_action)\n @token_menu = menu_bar.add_menu(tr(\"&Token\"))\n @token_menu.add_action(@verify_action)\n @token_menu.add_action(@reissue_action)\n menu_bar.add_separator\n @help_menu = menu_bar.add_menu(tr(\"&Help\"))\n @help_menu.add_action(@about_action)\n end",
"def goldberg_main_menu\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml\", :use_full_path => false, :locals => {:level => 0, :depth => 0, :class_attr => nil}\n end",
"def show_in_menu?\n true\n end",
"def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select{ |a| a.http_methods.include?(:get) }\n actions.map do |action|\n wording = wording_for(:menu, action)\n %{\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" class=\"icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a class=\"pjax\" href=\"#{locale_url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => (object.try(:persisted?) && object.try(:id) || nil) })}\">\n <i class=\"#{action.link_icon}\"></i>\n <span#{only_icon ? \" style='display:none'\" : \"\"}>#{wording}</span>\n </a>\n </li>\n }\n end.join.html_safe\n end",
"def generate_menu\n @menu = MenuTree.new\n @menu.add( _('Conference listing'),\n url_for(:controller => '/conferences', :action => 'list') )\n # A link will be generated here and at some other views all over,\n # so we declare a dirty, ugly @link_to_nametags\n @link_to_nametag = CertifFormat.for_personal_nametag\n\n if @user.nil?\n @menu.add(_('Log in'),\n url_for(:controller => '/people', :action => 'login'))\n @menu.add(_('New account'),\n url_for(:controller => '/people', :action => 'new'))\n else\n personal = MenuTree.new\n personal.add(_('Basic information'),\n url_for(:controller => '/people', :action => 'account'))\n personal.add(_('Update your personal information'),\n url_for(:controller => '/people', :action => 'personal'))\n personal.add(_('Change password'),\n url_for(:controller => '/people', :action => 'password'))\n personal.add(_('My public profile'),\n url_for(:controller => '/people', :action => 'profile',\n :id => @user.id))\n @link_to_nametag and personal.add(_('Generate nametag'),\n url_for(:controller => '/people', :action => 'my_nametag'))\n @user.can_submit_proposals_now? and\n personal.add(_('My proposals'),\n url_for(:controller=>'/people', :action => 'proposals'))\n @user.conferences.size > 0 and\n personal.add(_('Invite a friend'),\n url_for(:controller=>'/people', :action => 'invite'))\n\n @menu.add(_('My account'), nil, personal)\n\n @user.admin_tasks.sort_by(&:sys_name).each do |task|\n begin\n control = \"#{task.sys_name.camelcase}Controller\".constantize\n menu = menu_subtree_for((control.constants.include?('Menu') ?\n control::Menu : []), task)\n rescue NameError\n # Probably caused by an unimplemented controller? A\n # controller which does not implement a menu?\n menu = menu_subtree_for([[_'-*- Unimplemented']], task)\n end\n\n @menu.add(Translation.for(task.qualified_name),\n nil, menu)\n end\n end\n end",
"def hide_dashboard_for_group_admins\n Refinery::Plugins.registered.find_by_name(\"refinery_dashboard\").hide_from_menu = true if current_refinery_user && current_refinery_user.has_role?(\"GroupAdmin\")\n end",
"def menu_router\n selection = display_menu\n case selection\n when 'My List'\n my_list\n when 'Recommendations'\n recommendations_menu\n else\n case_menu(selection)\n end\n end",
"def menu_selection \nend",
"def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend",
"def default\n html = '<div class=\"menu0-div\"><ul>'\n @selected = find_selected\n level_0 = DcBigMenu.where(dc_site_id: @site._id, parent: nil, active: true).sort(order: 1).to_a\n level_0.each do |item|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item)\n next unless can_view\n klas = item.id == @selected.id ? \"menu0-selected\" : \"menu0-item\"\n html << \"<li class='#{klas}'>#{ link_4menu(item) }</li>\\n\"\n end\n html << \"</ul></div>\"\n# submenu\n level_1 = DcBigMenu.where(dc_site_id: @site._id, parent: @selected.id, active: true).sort(order: 1).to_a\n html << \"<div class='menu1-div'><ul>\\n\"\n level_1.each do |item1|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item1)\n next unless can_view\n html << \" <li class='menu1-item'>#{link_4menu(item1)}</li>\\n\"\n end\n html << '</ul></div>'\nend",
"def goldberg_left_menu\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml\", :use_full_path => false, \n :locals => {:level => 1, :depth => (Goldberg.settings.menu_depth - 2),\n :class_attr => 'sidemenu'}\n end",
"def set_menu_group\n @menu_group = MenuGroup.find(params[:id])\n end",
"def add_admin_menu\n tmp_file = \"app/views/layouts/_admin_menu.html.haml\"\n if FileTest.exists?(tmp_file) then\n open(tmp_file, 'a') { |f|\n f.puts ERB.new(\"\\n\\s\\s\\s\\s%li{ 'role'=>'presentation' }=link_to('#{class_name.tableize}', '/#admin/#{class_name.tableize}')\").result(binding)\n }\n end\n tmp_file = \"config/locales/en.yml\"\n if FileTest.exists?(tmp_file) then\n open(tmp_file, 'a') { |f|\n f.puts ERB.new(\"\\n\\s\\sadmin_menu: 'Administration menu'\").result(binding)\n }\n end\n end",
"def default_context_menu\n [\n :row_counter.action,\n \"-\",\n :ctrl_manage.action,\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end",
"def main_menu(include_children=true,&block)\n menu_items = []\n \n if (root_menus=SiteMenu.roots).any?\n # load menu from database\n root_menus.each do |menu|\n menu_items << yield(menu.name, \n render( 'home/menu/with_children', \n :menu => menu, \n :recursive=>include_children,\n :force => true\n )\n ) if menu && (menu.role_needed||0) <= current_role\n end\n else\n # Use default menu\n \n # home\n menu_items = [ ]\n \n # Top pages\n menu_items << top_pages.map { |page|\n yield( page.id.to_s.to_sym, menu_link_to( page.short_title, \"/p/#{page.link_to_title}\" ))\n } if can? :read, Page\n \n # Blogs, Userlist, Comments\n menu_items << yield(:blogs, menu_link_to( t(:blogs), blogs_path )) if can? :read, Blog\n menu_items << yield(:userlist, menu_link_to( t(\"menu.userlist\"), registrations_path)) if can? :read, Page\n menu_items << yield(:comments, menu_link_to( t(\"menu.comments\"), comments_path)) if can? :read, Comment.new\n end\n \n menu_items\n end",
"def menu_for(parent, abstract_model = nil, object = nil) # perf matters here (no action view trickery)\n actions = actions(parent, abstract_model, object).select{ |action| action.http_methods.include?(:get) }\n actions.map do |action|\n %{\n <li class=\"#{action.key}_#{parent}_link #{'active' if current_action?(action)}\">\n <a href=\"#{url_for({ :action => action.action_name, :controller => 'rails_admin/main', :model_name => abstract_model.try(:to_param), :id => object.try(:id) })}\">\n #{wording_for(:menu, action)}\n </a>\n </li>\n }\n end.join.html_safe\n end",
"def index\n @admin_menus = Admin::Menu.all\n end",
"def camaleon_spree_cama_nav_menus(args)\n # Groups\n Spree::Taxonomy.all.each do |taxonomy|\n args[:custom_menus][\"spree_menus\"] = {link: \"\", title: \"Spree #{taxonomy.name.pluralize}\"}\n taxonomy.taxons.each do |taxon|\n args[:custom_menus][\"spree_tax_#{taxon.id}\"] = {link: spree.nested_taxons_path(taxon.permalink), title: taxon.name, kind: 'Spree::Taxon', id: taxon.id}\n end\n end\n\n # Products\n args[:custom_menus][\"spree_menus_products\"] = {link: \"\", title: \"Spree Products\"}\n Spree::Product.reorder(name: :asc).all.each do |product|\n args[:custom_menus][\"spree_product_#{product.id}\"] = {link: spree.product_path(product), title: product.name, kind: 'Spree::Product', id: product.id}\n end\n end",
"def link_menu(resource, options={})\n html= ' '\n if permitted_to? :index, table_symbol_from(resource) then\n if resource.is_a? Symbol then\n model_plural = resource.to_s\n else\n model= singular_table_name_from( resource).pluralize \n end\n a = link_to(tmenu(model_plural), eval(model_plural + \"_path\"), options) \n html = wrap_in_html_container a, 'li', 'menuItem'\n end\n #ebugger\n return html.html_safe\n end",
"def menu_code\n menu = \"<span class=\\\"list-settings\\\" data-list-ref=\\\"#{uid}\\\">\"\n menu << \"<a class=\\\"settings-start\\\"><i></i>' + h('list.menu'.t) + '</a>\"\n menu << '<ul>'\n if table.paginate?\n # Per page\n list = [5, 10, 20, 50, 100, 200]\n list << table.options[:per_page].to_i if table.options[:per_page].to_i > 0\n list = list.uniq.sort\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"pages\\\"><i></i>' + h('list.items_per_page'.t) + '</a><ul>\"\n list.each do |n|\n menu << \"<li data-list-change-page-size=\\\"#{n}\\\" '+(#{var_name(:params)}[:per_page] == #{n} ? ' class=\\\"check\\\"' : '') + '><a><i></i>' + h('list.x_per_page'.t(count: #{n})) + '</a></li>\"\n end\n menu << '</ul></li>'\n end\n\n # Column selector\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"columns\\\"><i></i>' + h('list.columns'.t) + '</a><ul>\"\n for column in table.data_columns\n menu << \"<li data-list-toggle-column=\\\"#{column.name}\\\" class=\\\"' + (#{var_name(:params)}[:hidden_columns].include?(:#{column.name}) ? 'unchecked' : 'checked') + '\\\"><a><i></i>' + h(#{column.header_code}) + '</a></li>\"\n end\n menu << '</ul></li>'\n\n # Separator\n menu << '<li class=\"separator\"></li>'\n # Exports\n ActiveList.exporters.each do |format, _exporter|\n menu << \"<li class=\\\"export export-#{format}\\\">' + link_to(content_tag(:i) + h('list.export_as'.t(exported: :#{format}.t(scope: 'list.export.formats'))), __params.merge(action: :#{generator.controller_method_name}, sort: #{var_name(:params)}[:sort], dir: #{var_name(:params)}[:dir], format: '#{format}')) + '</li>\"\n end\n menu << '</ul></span>'\n menu\n end",
"def current_menu_link_group\n @current_menu_link_group ||= current_menu_link.parent || InternalTab.new\n end",
"def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end",
"def dynamic_menu(options = {})\n render :partial => 'menu/modules/dynamic_menu',\n :locals => {:menu => prepare_links(options)}\n end",
"def add_admin_menu\n if current_user and current_user.can?('view admin menu')\n admin_menu = render_to_string(:partial => 'layouts/shared/admin_menu')\n start_of_body_tag = response.body =~ /<body.*?>/\n if start_of_body_tag\n response.body = response.body.insert(start_of_body_tag, admin_menu)\n end\n end\n end",
"def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n :del.action,\n \"-\", # Adds a separator\n :add_in_form.action,\n :edit_in_form.action\n ]\n end",
"def main()\n main_menu(SHOW_HEADER);\n end",
"def render_raw_menus_partial\n # No-op\n end",
"def type\n \"mymenu\"\n end",
"def streamlined_top_menus\n [\n [\"TBD\", {:action=>\"new\"}]\n ]\n end",
"def build_default_utility_nav\n return if @menus.exists? :utility_navigation\n @menus.menu :utility_navigation do |menu|\n add_current_user_to_menu menu\n add_logout_button_to_menu menu\n end\n end",
"def side_menu\n items = @menu_setup[:main_menu].nil? ? [] : MENU_DATA['menu'][@menu_setup[:main_menu].to_s]['submenus']\n html = \"\"\n\n items.each do |item, opciones|\n active = is_active_side_menu?(opciones['active_submenu'])\n html << content_tag(:li, link_to((opciones['text'] + (active ? ' <i class=\"fa fa-angle-right pull-right\"></i>' : '')).html_safe, opciones['url']), class: active ? 'active' : '')\n end\n\n html.html_safe\n end",
"def header_menu\n\t\tif logged_in?\n\t\t\toutput = []\n\t\t\toutput << link_to(image_tag(\"/images/logged/my_classes.png\"), {:controller => 'classrooms'}) \n\t\t\toutput << link_to(image_tag(\"/images/logged/class_diary.png\"), {:controller => 'diario_de_classe_posts'})\n \n if is_admin?\n output << link_to(image_tag(\"/images/logged/class_diary.jpg\"), {:controller => 'admin'})\n end\t\t\t\n return output.join(\"\\n\")\n\n\t\telse\n\t\t \treturn image_tag(\"/images/unlogged/top.jpg\") \n\t\tend\n\tend",
"def act\n @page_title = _('Bulk_management')\n @page_icon = 'groups.png'\n end",
"def add_menu\n tmp_file = \"app/views/layouts/_menu.html.haml\"\n if FileTest.exists?(tmp_file) then\n open(tmp_file, 'a') { |f|\n f.puts ERB.new(\"\\n%li=link_to('#{class_name.tableize}', '/##{class_name.tableize}')\").result(binding)\n }\n end\n end",
"def main\n if current_user\n redirect_to '/groups' #groups_path\n end\n end",
"def index\n #@fdn_menus = Fdn::Menu.all\n @fdn_menu = Fdn::Menu.top_level.first\n end",
"def crud_menu(class_name)\n class_string = class_name.to_s.underscore.downcase\n m = Menu.new(\"What would you like to do with #{class_string.humanize.downcase.pluralize}?\")\n m.add_menu_item(user_message: [\"Create a new #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/create\")\n m.add_menu_item(user_message: [\"Show all #{class_string.humanize.downcase.pluralize}.\"], method_name: \"#{class_string}/show\")\n m.add_menu_item(user_message: [\"Update a #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/update\")\n m.add_menu_item(user_message: [\"Delete a #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/delete\")\n m\n end",
"def show_admin_menu_items?\n can?(:read, :admin_dashboard)\n end",
"def menu_for(scope, abstract_model = nil, object = nil, only_icon = false) # perf matters here (no action view trickery)\n target_actions =\n (@menu_for ||= {})[scope] ||= actions(scope).select { |a| a.http_methods.include?(:get) }\n\n is_inline = only_icon && current_model.list.inline_menu\n item_class = is_inline ? 'inline-nav-item' : 'nav-item'\n\n target_actions.collect do |target_action|\n next unless target_action.with_bindings(abstract_model: abstract_model, object: object, **rbindings).visible?\n\n extra_item_class = \"text-#{target_action.link_class} border-#{target_action.link_class}\" if only_icon && target_action.link_class\n\n wording = wording_for(:menu, target_action)\n %(\n <li title=\"#{wording if only_icon}\" rel=\"#{'tooltip' if only_icon}\" #{\"data-toggle=\\\"tooltip\\\" data-placement=\\\"#{is_inline ? 'bottom' : 'left'}\\\"\" if only_icon} class=\"icon #{item_class} #{target_action.key}_#{scope}_link\">\n <a class=\"nav-link #{extra_item_class} #{'active' if current_action?(target_action)} #{target_action.remote? ? 'ajax' : ''}\" href=\"#{radmin.url_for(action: target_action.action_name, controller: 'radmin/main', model_name: abstract_model&.to_param, id: object&.id)}\" #{\"data-confirm=\\\"#{target_action.link_confirm_msg}\\\"\" if target_action.link_confirm_msg.presence}>\n #{fa_icon(target_action.link_icon, type: :solid)}\n <span#{only_icon ? \" style='display:none'\" : ''}>#{wording}</span>\n </a>\n </li>\n )\n end.join.html_safe\n end",
"def index\n @security_role_menus = Security::RoleMenu.all\n end",
"def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend",
"def return_menu\n MenuControllerContracts.invariant(self)\n @current_view = @views[0]\n MenuControllerContracts.invariant(self)\n end",
"def refinery_menu_pages\n Menu.new Page.fast_menu\n end",
"def menus\n Vedeu::Menus.registered\n end",
"def define_menu_items\n add_menu_item(\"File storage.\", 1)\n add_menu_item(\"Sqlite3.\", 2)\n end",
"def enabled_menu_items\n RetroAM.sorted_menu_items(enabled_modules)\n end",
"def show\n @security_role_type_menu = Security::RoleTypeMenu.new\n end",
"def create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend",
"def menu_primary\n Lynr::View::Menu.new('Menu', \"/menu/#{@dealership.slug}\", :menu_admin) unless @dealership.nil?\n end",
"def set_admin_menu\n @admin_menu = Menu.find(params[:id])\n end",
"def left_menu\n html = ''\n m = DcBigMenu.find( @parent.page.menu_id )\n# Show menu on same level if selected has no children\n if DcBigMenu.where( parent: @parent.page.menu_id ).limit(1).to_a.size == 0\n m = DcBigMenu.find( m.parent )\n end \n# \n html << \"<div class='menu-left-item-top'>#{m.caption}</div>\"\n DcBigMenu.where( parent: m._id ).sort(order: 1).each do |item|\n html << (item._id == @parent.page.menu_id ? '<div class=\"menu-left-item-selected\">' : '<div class=\"menu-left-item\">')\n html << link_4menu(item) \n html << '</div>'\n end\n# \n html << \"<div class='menu-left-item-bottom'>\"\n if m.parent\n p = DcBigMenu.find( m.parent )\n html << \"▲ #{link_4menu(p)}\"\n end\n html << ' </div>' \nend",
"def render_menu\n render \"#{controller_name}/menu\" if File.exist? File.expand_path(Rails.root.join \"app\", \"views\",controller_name,\"_menu.html.erb\") unless params[:content_only].present?\n end",
"def menu_items\n {\n :dashboard => {\n :content => \"#{link_to \"Dashboard\", url(:root)} [#{active_task_count}]\",\n :position => 1\n },\n :projects => {\n :content => link_to(\"Projects\", url(:projects)),\n :position => 2\n },\n :contexts => {\n :content => link_to(\"Contexts\", url(:contexts)),\n :position => 3\n },\n :new_action => {\n :content => \"+ #{link_to(\"Action\", url(:new_task))}\",\n :position => 4,\n :attrs => { :class => \"right\" }\n }\n }\n end",
"def index\n @custom_menus = @sub_project.custom_menus.all\n end",
"def user_menu_button\n if user_signed_in?\n render 'shared/user_menu_box'\n else\n signup_button +\n login_button\n end\n end"
] | [
"0.6744772",
"0.6721269",
"0.66564834",
"0.6611857",
"0.64854634",
"0.6471733",
"0.6461823",
"0.64451444",
"0.64383954",
"0.6432569",
"0.6418043",
"0.6368616",
"0.6331997",
"0.6271178",
"0.62687194",
"0.62326694",
"0.6224355",
"0.61916786",
"0.6189219",
"0.6177069",
"0.6155254",
"0.61527056",
"0.61399424",
"0.61337155",
"0.61252314",
"0.61200726",
"0.6110188",
"0.6110188",
"0.61096567",
"0.6105347",
"0.60889655",
"0.60715455",
"0.6063488",
"0.60559803",
"0.6052597",
"0.6041502",
"0.6040319",
"0.6009381",
"0.60083175",
"0.5998543",
"0.5994052",
"0.5989736",
"0.59843266",
"0.596597",
"0.59559965",
"0.5955007",
"0.59526604",
"0.59343296",
"0.5929426",
"0.5925838",
"0.5922611",
"0.5918813",
"0.5911866",
"0.59094113",
"0.58939797",
"0.5891708",
"0.5890117",
"0.5886464",
"0.5857245",
"0.585257",
"0.5844388",
"0.5841626",
"0.58357155",
"0.58313745",
"0.5818667",
"0.58090764",
"0.579552",
"0.578931",
"0.5785688",
"0.57850176",
"0.5782205",
"0.5781757",
"0.5775296",
"0.5750696",
"0.57341623",
"0.5707007",
"0.57007754",
"0.57007074",
"0.569751",
"0.5692269",
"0.56907886",
"0.5682006",
"0.5679992",
"0.56777483",
"0.56766146",
"0.5675136",
"0.56707764",
"0.5667242",
"0.5667093",
"0.5665866",
"0.5664613",
"0.56603116",
"0.5659207",
"0.5656988",
"0.5654903",
"0.56502736",
"0.5648682",
"0.56404024",
"0.5637711",
"0.56376874",
"0.5637341"
] | 0.0 | -1 |
Punctuation is not part of the word unless it is a contraction. In order to not have to write an actual language parser, there won't be any punctuation too complex. There will be no "'" that is not part of a contraction. | def alternate_words(string)
unwanted = ["!","@","$","#","%","^","&","*","(",")","-","=","_","+","[","]",":",";",",",".","/","<",">","?","|"]
counter = 0
new_str_arr = Array.new
unwanted.each do |symbol|
string = string.gsub(symbol," ")
end
array_str = string.split(" ");
while counter < array_str.length do
if counter.even?
new_str_arr.push(array_str[counter])
end
counter += 1
end
return new_str_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_word?\n not is_punctuation?\n end",
"def is_punctuation?(str)\n %w(. , ? ! ; :).include?(str)\n end",
"def is_punctuation?\n %w(. ,).include?(wordform)\n end",
"def strip_punctuation(word)\n punctuation_stripping_regexp = /(.+)([^.,?!-_+=@#$%^&*()])/\n word.match(punctuation_stripping_regexp).to_s\nend",
"def speak_as_literal_punctuation(element)\n speak_as(\n element,\n get_regular_expression_of_symbols,\n 'literal-punctuation',\n method(:operation_speak_as_literal_punctuation)\n )\n end",
"def product_punctuation(str)\nend",
"def punctuation\n @input = @input.gsub(/\\p{P}/u, '')\n end",
"def product_punctuation(str)\n\nend",
"def speak_as_no_punctuation(element)\n escape_punctuation = Regexp.escape('!\"#$%&\\'()*+,-./:;<=>?@[]^_`{|}~\\\\')\n speak_as(\n element,\n Regexp.new(\"[#{escape_punctuation}]\"),\n 'no-punctuation',\n method(:operation_speak_as_no_punctuation)\n )\n end",
"def is_punctuation(letter)\n ascii = letter.ord\n ascii < 65 || (ascii > 90 && ascii < 97) || ascii > 122\nend",
"def punctuation?\n PUNCTUATION.include? @kind\n end",
"def remove_punctuation\n gsub /[[:punct:]]/, ''\n end",
"def strip_punctuation(token)\n original_set = token.split('')\n\n array = clean_leading_punctuations(original_set)\n array = clean_trailing_punctuations(array)\n stripped_token = array.join\n\n return token if stripped_token.size <= 2\n\n stripped_token\n end",
"def strip_non_word_characters!\n @raw.gsub!(/[^\\w\\ \\-.,]/, ' ')\n end",
"def with_apostrophe?\n @unit =~ /\\w{1}'\\w+/\n end",
"def get_punctuation(string)\n punctuation?(string) ? string.chars.last : ''\nend",
"def clean_up_word(word)\n\t\tword.strip!\n\t\tword.chomp!(\".\")\n\t\tword.chomp!(\",\")\n\t\tword.chomp!(\"\\\"\")\t\n\t\tword.downcase!\n\tend",
"def speak_as_literal_punctuation_inherit(element)\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n\n isolate_text_node(element)\n\n visit(element, method(:speak_as_literal_punctuation))\n end",
"def remove_punctuation(phrase)\n phrase.gsub(/[^0-9a-z ,]/i, '')\n end",
"def first_word_capitalized_and_ends_with_punctuation?(text)\n text.match(/^[A-Z].+[.!?]$/) ? true : false\nend",
"def remove_punctuation(string)\n punctuation?(string) ? string.chop! : string\nend",
"def handle_agent_corporate_punctuation(name_fields)\n name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}\n\n # The value of subfield g must be enclosed in parentheses.\n g_index = name_fields.find_index {|a| a[0] == \"g\"}\n unless !g_index\n name_fields[g_index][1] = \"(#{name_fields[g_index][1]})\"\n end\n\n # The value of subfield n must be enclosed in parentheses.\n n_index = name_fields.find_index {|a| a[0] == \"n\"}\n unless !n_index\n name_fields[n_index][1] = \"(#{name_fields[n_index][1]})\"\n end\n\n #If subfield $e is present, the value of the preceding subfield must end in a comma.\n #If subfield $n is present, the value of the preceding subfield must end in a comma.\n #If subfield $g is present, the value of the preceding subfield must end in a comma.\n ['e', 'n', 'g'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index || s_index == 0\n preceding_index = s_index - 1\n\n # find preceding field and append a comma if there isn't one there already\n unless name_fields[preceding_index][1][-1] == \",\"\n name_fields[preceding_index][1] << \",\"\n end\n end\n end\n\n # Each part of the name (the a and the b’s) ends in a period, until the name itself is complete, unless there's a subfield after it that takes a different mark of punctuation before it, like an e or it's got term subdivisons like $b LYRASIS $y 21th century.\n\n ['a', 'b'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index\n\n # find field and append a period if there isn't one there already\n unless name_fields[s_index][1][-1] == \".\" || name_fields[s_index][1][-1] == \",\"\n name_fields[s_index][1] << \".\"\n end\n end\n end\n\n apply_terminal_punctuation(name_fields)\n\n return name_fields\n end",
"def isPunctChar(ch)\n return UNICODE_PUNCT_RE =~ ch\n end",
"def ends_with_punctuation?(text)\n text.chars.last.scan(/[[:punct:]]/u).length.positive?\n end",
"def trim_punctuation\n lambda do |rec, accumulator|\n accumulator.collect! {|s| Marc21.trim_punctuation(s)}\n end\n end",
"def operation_speak_as_literal_punctuation(content, index, children)\n data_property_value = 'literal-punctuation'\n unless index.zero?\n children.push(\n create_content_element(content[0..(index - 1)], data_property_value)\n )\n end\n children.push(\n create_aural_content_element(\n \" #{get_description_of_symbol(content[index..index])} \",\n data_property_value\n )\n )\n\n children.push(\n create_visual_content_element(\n content[index..index],\n data_property_value\n )\n )\n\n children\n end",
"def removeQuotesAndPunc sentence\n\t\tquotes = [\"\\\"\",\"'\",\":\",\",\",\".\",\"(\",\")\",\";\",\"!\",\"&\",\"<\",\">\",\"?\",\"-\",\"_\"]\n\t\twords = sentence.split(' ')\n\t\twords.map! do |w|\n\t\t\tw.slice!(1) if quotes.include?(w[0])\n\t\t\tw.slice(-1) if quotes.include?(w[-1])\n\t\t\tw\n\t\tend\n\t\treturn words.join(' ')\n\tend",
"def is_punctuation(token)\n _is_in(token, @punctuation_tags)\n end",
"def speak_as_no_punctuation_inherit(element)\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n\n isolate_text_node(element)\n\n visit(element, method(:speak_as_no_punctuation))\n end",
"def first_word_capitalized_and_ends_with_punctuation?(text)\n if text.match(/^[A-Z].*\\W$/)\n return true\n else false\n end\nend",
"def end_of_sentence?(word)\n count_punct = word[-1].count(\".?!\")\n count_punct >= 1 && !word[0...-1].include?('.') && !@titles_hash[word]\n end",
"def clean_up_punctuation(str)\n str.gsub(%r{[^A-Za-z\\d\\_\\:\\/]}, '')\n end",
"def punctuation?(string)\n signs = [',', '.', ':', ';', '?', '!', '–']\n string.split(//).any? {|character| signs.include?(character) }\nend",
"def remove_punc_and_add_index(word)\n punc_collection = []\n word.chars.each_with_index do |char, index|\n if char.match?(/[',.\\-]/)\n punc_collection << [char, index]\n end\n end\n punc_collection\nend",
"def forward_word\n #forward_regex(/[[:punct:][:space:]]\\w/)\n forward_regex(:word)\n end",
"def product_punctuation(str)\n\tsign_str = \"!.,-;?\"\n\tresult = 1\n\n\tif str == sign_str\n\t\treturn result\n\tend\t\n\n\tnumbers_sign = str.each_char.count {|elem| sign_str.include?(elem)}\n\tresult *= numbers_sign\n\t \nend",
"def end_word?(word)\n !word.nil? && !(word =~ /^*+[?\\.!]$/).nil?\n end",
"def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end",
"def normalize_punctuation(str)\n s = str.dup\n s.gsub! /\\s+/, ' '\n\n s.gsub(/\\s*&,/)\n\n # Collapse w/s around all\n s.gsub! /\\s*([:,&.;])\\s*/, '\\1'\n # Collapse consecutive dupes\n s.gsub! /([.,;&:])+/ , '\\1'\n\n # Collapse leading and trailing punctuation\n s.gsub! /^\\s*[,:&;.]|[.;&:,]\\s*$/, ''\n\n # Add whitespaces\n s.gsub! /([,.;:])(\\S)/, '\\1 \\2'\n s.gsub! /(\\S)([&])(\\S)/, '\\1 \\2 \\3'\n\n s.strip!\n s\n end",
"def test_remove_space_middle_of_id_space\nresult = remove_punctuation(\"sha wn\")\nassert_equal(\"shawn\", result)\nend",
"def operation_speak_as_no_punctuation(content, index, children)\n unless index.zero?\n children.push(\n create_content_element(content[0..(index - 1)], 'no-punctuation')\n )\n end\n children.push(\n create_visual_content_element(\n content[index..index],\n 'no-punctuation'\n )\n )\n\n children\n end",
"def single_word(word)\n if word[0] =~ /[aeiou]/i\n word + \"way\"\n else\n # nueva condicionante para palabras de puras consonantes sin vocales. ej: by\n if word.split(/([aeiou].*)/).length > 1\n # Parte palabra en 2 y lo mete en un array. 1er elemento es de consonat(es) iniciales, 2o la parte restante de la palabra a partir de e incluyendo la primera vocal\n word.split(/([aeiou].*)/)[1] + word.split(/([aeiou].*)/)[0] + \"ay\"\n else\n word.split(/([aeiou].*)/)[0]\n end\n end\nend",
"def pig(word, howmany = 0)\r\n chars = word.split(//)\r\n lastletter_index = word.rindex(/\\w/)\r\n puncs = {}\r\n \r\n #grab punctuation, store info in hash\r\n chars.each_index { |x| puncs[x] = chars.at(x) if chars.at(x) =~ /\\W/ }\r\n\r\n #delete punctuation so we only deal with letters, does nothing if no punc \r\n chars.delete_if {|x| puncs.values.include?(x)} \r\n\r\n #not the most elegant for dealing with starts-with-vowel words, but more modular this way\r\n #skip this swapping stuff if it's a vowel for first letter\r\n if(howmany > 0) \r\n first = chars.slice!(0, howmany) #grab the first n chars, delete grabbed\r\n\r\n if(first[0] == first[0].upcase) #word was capitalized, swap order\r\n chars[0].upcase!\r\n first[0].downcase!\r\n end\r\n\r\n chars += first\r\n end\r\n\r\n #add back punctuation if it existed, does nothing if no punc\r\n puncs.keys.each { |key| chars.insert(key, puncs[key]) }\r\n \r\n #length == 1 means we got a single vowel like \"I\"; different rule\r\n chars.length == 1 ? chars << \"way\" : chars.insert(lastletter_index + 1, \"ay\") \r\n return chars.join(\"\")\r\nend",
"def validate_no_single_punctuation_or_whitespace_char_formatting(content_at_file, el, el_stack, errors, warnings)\n # ImplementationTag #punctuation_characters\n punctuation_chars = %(!()+,-./:;?[]—‘’“”…\\u2011\\u00A0\\u202F\\uFEFF\\u2028)\n if(1 == (pt = el.to_plain_text).length) && pt =~ /\\A[\\s\\n#{ Regexp.escape(punctuation_chars) }]\\z/\n # Single punctuation or whitespace character\n report_error = nil\n # Handle exceptions:\n if(\n (parent_p_el = el_stack.reverse.detect { |a_el| :p == a_el.type }) &&\n parent_p_el.has_class?('scr')\n )\n # Exception: Inside .scr paragraph: Only check for space\n report_error = [' '].include?(pt)\n elsif el.has_class?('line_break')\n # *.*{: .line_break} is legitimate, don't report as error\n report_error = false\n else\n report_error = true\n end\n\n if report_error\n errors << Reportable.error(\n {\n filename: content_at_file.filename,\n line: el.options[:location],\n context: el.element_summary(0, max_value_length: 0),\n },\n [\n 'Single formatted punctuation or whitespace character',\n \"Type: #{ el.type }, Inner text: #{ pt.inspect }\"\n ]\n )\n end\n end\n end",
"def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end",
"def test_remove_space_end_of_id_space\nresult = remove_punctuation(\"shawn\")\nassert_equal(\"shawn\", result)\nend",
"def remove_trailing_punctuation_from_content_at(txt)\n # ImplementationTag #punctuation_characters\n txt.sub(/[;,…]+\\z/, '')\n end",
"def scan_for_commas(token); end",
"def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end",
"def backward_word\n #backward_regex(/[[:punct:][:space:]]\\w/)\n backward_regex(:word)\n end",
"def remove_punctuation(str)\n str.gsub(/[^0-9A-Za-z]/, '')\n end",
"def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend",
"def word!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n\n\n type = WORD\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 45:5: ( '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\'' | '\\\"' (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\"' )\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == 0x27 )\n alt_3 = 1\n elsif ( look_3_0 == 0x22 )\n alt_3 = 2\n else\n raise NoViableAlternative( \"\", 3, 0 )\n\n end\n case alt_3\n when 1\n # at line 45:7: '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\''\n match( 0x27 )\n # at line 45:12: (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( 0x0, 0x26 ) || look_1_0.between?( 0x28, 0x5b ) || look_1_0.between?( 0x5d, 0xffff ) )\n alt_1 = 1\n elsif ( look_1_0 == 0x5c )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 45:14: ~ ( '\\\\'' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n when 2\n # at line 45:33: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n match( 0x27 )\n\n when 2\n # at line 45:50: '\\\"' (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\"'\n match( 0x22 )\n # at line 45:55: (~ ( '\\\"' | '\\\\\\\\' ) | '\\\\\\\\' . )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( 0x0, 0x21 ) || look_2_0.between?( 0x23, 0x5b ) || look_2_0.between?( 0x5d, 0xffff ) )\n alt_2 = 1\n elsif ( look_2_0 == 0x5c )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 45:57: ~ ( '\\\"' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x21 ) || @input.peek( 1 ).between?( 0x23, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n when 2\n # at line 45:76: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n match( 0x22 )\n\n end\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n\n end",
"def removePunctuation(line)\n line.to_s.gsub(/(^|\\s+)[[:punct:]]+|[[:punct:]]{2,}|[[:punct:]]+(\\s+|$)/,' ').strip \n end",
"def piglatinize_word(word)\r\n # vowel at the start\r\n # 3 consonants\r\n # 2 consonants\r\n # 1 consonant\r\n # count consonants\r\n count = 0\r\n # check if word starts with a vowel\r\n if !consonant?(word[0])\r\n word += \"w\"\r\n else\r\n count += 1\r\n end\r\n \r\n # check if word starts with 3 consonants\r\n if count == 1 && consonant?(word[1]) && consonant?(word[2])\r\n count += 2\r\n word = word.slice(3..-1) + word.slice(0,3)\r\n # check if word starts with 2 consonants if it isn't 3\r\n elsif count == 1 && consonant?(word[1])\r\n word = word.slice(2..-1) + word.slice(0,2)\r\n # check if word starts with 1 consonant if it isn't 3 or 2\r\n elsif count == 1 \r\n word = word.slice(1..-1) + word.slice(0)\r\n end\r\n\r\n # finally add the \"ay\" using += or <<\r\n word+= \"ay\"\r\n end",
"def word?(token)\n token =~ /^[A-Za-z]+$/\n end",
"def missing_alphas(sentence)\n puts sentence\nend",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def pig_latin_word(english)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n if vowels.include?(english[0].downcase)\n english\n else\n vowel_index = english.index(/[aeiouy]/)\n front_half = english.slice!(vowel_index..-1)\n back_half = english\n punct = front_half.slice!(/\\W$/)\n punct = \"\" if punct == nil\n pig_word = front_half + back_half + \"ay\" + punct\n end\nend",
"def puncture\n end",
"def remove_interpunction!(str)\n str.gsub!(/\\A['\"]+|[!,.\"']+\\Z/, '')\n str\n end",
"def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end",
"def allow_short_words\n not @emphasis[:ignore_short_words]\n end",
"def check_fr(word)\n /\\A(\\,|\\?|\\!|\\+)/.match(word) != nil\n end",
"def strip_symbols(name)\n return name.to_s.gsub(/[[:punct:]]/, '')\n end",
"def word_char?(char)\n char =~ /\\w+/\n end",
"def remove_punc(text)\n word_list = []\n\n\n # Checking for correct encoding and reencoding the string if necessary\n if ! text.valid_encoding?\n text = text.encode(\"UTF-16be\", :invalid=>:replace, :replace=>\"?\").encode('UTF-8')\n end\n \n # Removing puctuation\n words = text.split(/[ ,;{}`~!@#$%^&*<>.:\"'|?\\\\()_+=\\/\\[\\]\\-]/)\n \n # Looping though the list, checking for valid words, and changing their case\n for word in words\n word = word[/\\w*/]\n word.downcase!\n word_list.push(word)\n end\n\n # Deleting blanks\n word_list.delete(\"\")\n\n return word_list\n\nend",
"def correct word\n known [word] or known(variation_words word) or [word]\n end",
"def possessify\n return \"#{self}'\" if self =~ /s$/\n return \"#{self}'s\"\n end",
"def single_word?(string)\n !string.strip.include? \" \"\n end",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def lex_en_interp_words; end",
"def words\n @phrase.split(/[^A-Za-z0-9']+/)\n end",
"def select_odd_chars(text)\n text.gsub(/(?!&)([[:punct:]])\\u200c/, \"\\\\1\")\n end",
"def tokenize_without_quot(txt)\n self.tokenize_without_quoted ||= txt.split(Awesome::Definitions::Stopwords::RM_QUOTED_REGEX)\n end",
"def remove_punctuation(str)\n alpha = 'abcdefghijklmnopqrstuvwxyz '\n output_str = ''\n \n str.each_char do |char|\n if alpha.include?(char)\n output_str += char\n end\n end\n\n output_str\nend",
"def badword_QualifiedName(o)\n if o.value == 'bigly'\n acceptor.accept(Issues::INVALID_WORD, o, :text => o.value)\n end\n end",
"def does_not_contain_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n false\n else\n true\n end\nend",
"def pig_latin_word(word)\r\n\tif word[0].downcase =~ /[aeiou]/\r\n\t\tword << \"way\" \r\n\telse\r\n\t\tn = /[aeiou]/.match word.downcase\r\n\t\tn.to_s + n.post_match + n.pre_match + \"ay\"\r\n\tend\r\nend",
"def speak_as_normal(element)\n reverse_speak_as(element, 'spell-out')\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n reverse_speak_as(element, 'digits')\n end",
"def get_true( string, non_significants = /[\\s',\\.\\-\\_]/ )\n string.gsub(non_significants, '').upcase\n end",
"def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end",
"def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal \"the number is \", \"the number is 42\"[/\\D+/]\n assert_equal \"space:\", \"space: \\t\\n\"[/\\S+/]\n assert_equal \" = \", \"variable_1 = 42\"[/\\W+/]\n end",
"def fr_parens(word)\n /\\A(\\(|\\{|\\<|\\\\|\\/)/.match(word) != nil\n end",
"def __hyphen_\n while true # kleene\n\n begin # choice\n _tmp = apply(:_space)\n break if _tmp\n _tmp = apply(:_comment)\n end while false # end choice\n\n break unless _tmp\n end\n _tmp = true # end kleene\n set_failed_rule :__hyphen_ unless _tmp\n return _tmp\n end",
"def lex_en_plain_words; end",
"def lex_en_plain_words; end",
"def lex_en_plain_words; end",
"def blank_word(word)\n @guessword2 = word.gsub(/[a-z]/, '_').split('')\n end",
"def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end",
"def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend",
"def is_valid_word?(word)\n DICTIONARY.include?(word)\n end",
"def _phrase\n _save = self.pos\n\n _save1 = self.pos\n while true # sequence\n _tmp = apply(:_word)\n unless _tmp\n self.pos = _save1\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n if _tmp\n while true\n\n _save2 = self.pos\n while true # sequence\n _tmp = apply(:_word)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save\n end\n set_failed_rule :_phrase unless _tmp\n return _tmp\n end",
"def possessivize(s)\n s + (s[-1,1] == 's' ? \"'\" : \"'s\")\n end",
"def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end",
"def alphanunder\n _str = self\n _alphanum_str = _str.gsub(/[^A-Za-z0-9_\\-\\.@ \\/]/,\"\")\n _under_str = _alphanum_str.gsub(/[ \\/\\.\\-@]/,\"_\")\n _under_str.downcase\n end",
"def test_remove_punctuation_from_id\nresult = remove_punctuation(\"sha?wn\")\nassert_equal(\"shawn\", result)\t\nend",
"def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend",
"def screaming?(word)\n word_array = word.split(//)\n word_array[-1] == \"!\"\nend"
] | [
"0.7231849",
"0.6943074",
"0.68991745",
"0.66488045",
"0.65997034",
"0.65801895",
"0.65178627",
"0.64397717",
"0.6418457",
"0.6399256",
"0.6366257",
"0.6229297",
"0.6225596",
"0.61731094",
"0.611905",
"0.610501",
"0.6044963",
"0.60444134",
"0.60388345",
"0.6016317",
"0.6005543",
"0.5977976",
"0.59625155",
"0.59468",
"0.58416605",
"0.58264774",
"0.5810554",
"0.58105105",
"0.5810466",
"0.57829136",
"0.57581985",
"0.5754323",
"0.57215863",
"0.5708676",
"0.57071275",
"0.56949484",
"0.5692677",
"0.5683972",
"0.56825274",
"0.56745857",
"0.5644444",
"0.5552996",
"0.5532528",
"0.55311316",
"0.5518457",
"0.5515977",
"0.55103207",
"0.55034035",
"0.54892707",
"0.5487174",
"0.5476688",
"0.5464386",
"0.54603827",
"0.54461634",
"0.5440826",
"0.5440075",
"0.5414443",
"0.5411523",
"0.5407498",
"0.5406694",
"0.5397533",
"0.53888875",
"0.5375141",
"0.5372214",
"0.5370745",
"0.53594494",
"0.534504",
"0.5338498",
"0.53290427",
"0.53284526",
"0.53266954",
"0.5320535",
"0.5320535",
"0.5320535",
"0.5311899",
"0.53111804",
"0.53065497",
"0.53041875",
"0.5287713",
"0.5276943",
"0.5275521",
"0.5274329",
"0.52695173",
"0.526755",
"0.5258732",
"0.52534443",
"0.52448",
"0.5229447",
"0.5229447",
"0.5229447",
"0.5219649",
"0.5219233",
"0.52138853",
"0.5213128",
"0.5211941",
"0.5210569",
"0.52068627",
"0.51950663",
"0.5189503",
"0.5184669",
"0.5181668"
] | 0.0 | -1 |
Return Time Range Array | def time_range
range_time = []
(1..12).each do |n|
time = n == 1 ? 12 : n - 1
range_time << "#{time}:00 am"
range_time << "#{time}:30 am"
end
(1..12).each do |n|
time = n == 1 ? 12 : n - 1
range_time << "#{time}:00 pm"
range_time << "#{time}:30 pm"
end
range_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end",
"def time_range\n start_time..end_time\n end",
"def to_a(resolution: :hour)\n return [] if @start.nil? && @finish.nil?\n\n if finish < start\n to_time_array(start, TimeOfDay.new(23), resolution) +\n to_time_array(TimeOfDay.new(0), finish, resolution)\n else\n to_time_array(start, finish, resolution)\n end\n end",
"def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def missing_ranges()\n return [] if @time_map.nil?\n @time_map.missing_ranges()\n end",
"def month_range start_time, end_time\n start_date = start_time.month_start.to_date\n end_date = end_time.month_start.to_date\n current_date = start_date\n result = []\n while current_date <= end_date\n result << current_date.to_time\n current_date = current_date.next_month\n end\n result\nend",
"def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")}:#{end_time.strftime(\"%M\")}\") - 1.second\n timecode_array << \"#{curr_time.strftime(\"%H\").to_i}:#{curr_time.strftime(\"%M\")}\"\n curr_time = curr_time + 30.minutes\n end\n timecode_array_with_days = []\n %w(monday tuesday wednesday thursday friday saturday sunday).each do |day|\n timecode_array_with_days << timecode_array.collect{|t| \"#{t}_#{day}\"}.flatten if read_attribute(day)\n end\n timecode_array_with_days.flatten\n end",
"def load_time_ranges\n @time_ranges = ActiveSupport::HashWithIndifferentAccess.new\n time_ranges = @config['time']\n time_ranges.each do |t,r|\n time_range = ActiveSupport::HashWithIndifferentAccess.new\n src_ranges ||= r\n src_ranges.map { |k,v| time_range[k.to_sym] = rangify_time_boundaries(v) }\n @time_ranges[t.to_sym] = time_range\n end\n\n end",
"def time_range\n return 0 if start_hour.blank? || start_minute.blank?\n\n return 0 if end_hour.blank? || end_minute.blank?\n\n hours_between_times\n end",
"def make_event_times_array(dates_array, hour, min)\n\t\tevent_times = Array.new\n\n\t\tdates_array.each_index do |index|\n\t\t\n\t\t\tevent_times[index] = create_event_time(dates_array[index],hour, min)\n\t\tend\n\n\t\treturn event_times\n\tend",
"def create_int_array\n [first.time_to_int, last.time_to_int]\n end",
"def time_fragments\n []\n end",
"def time_range min, max\n spawn :@trange, [min, max].map { |e| time_to_long e }\n end",
"def to_a(resolution: :hour)\n resolution_multiplier = resolution == :hour ? 60 * 60 : 60\n time_units = ((start - finish) / resolution_multiplier).abs.to_i\n\n Array.new(time_units) do |time_unit|\n start + (time_unit * resolution_multiplier)\n end\n end",
"def get_time_list(from,to)\n time_list = Array.new\n time_list.push(from)\n temp_from = from.split(\" \")[0]\n temp_to = to.split(\" \")[0]\n date_from = Date.parse temp_from\n date_to = Date.parse temp_to\n if date_to < date_from\n puts \"from is starttime,to is endtime\"\n return nil\n end\n time = Array.new\n date_from.upto( date_to){ |i| time.push(i.to_s); time_list.push(\"#{i} 24:00:00\")}\n time_list[time_list.size-1] = to\n return time,time_list\n end",
"def hour_select_array(hour, end_time = false)\n # makes list for time selector in Visits view\n hour = DateTime.now.hour if hour == -1\n array = ((hour-4)..(hour+1)).to_a\n hour >= 12 ? array.delete_if { |a| a < 12 } : array.delete_if { |a| a >= 12 }\n array.map! { |h| h < 0 ? h + 24 : h }\n end_time ? [-1] + array : array\nend",
"def intervals(from = nil, to = nil)\n return [] unless intervals_beginning\n \n from ||= intervals_beginning\n to ||= Time.now.beginning_of_next_day\n intervals = []\n \n @intervals.each do |start, stop|\n if from > start\n if stop > from\n stop = to if to < stop\n intervals.push [from, stop]\n end\n next\n elsif stop > to\n intervals.push [start, to] if start < to\n break\n end\n intervals.push([start, stop])\n end\n \n if @started_at && @started_at < to && to == Time.now.beginning_of_next_day\n intervals.push([@started_at, Time.now])\n end\n \n intervals\n end",
"def get_start_times\n times = []\n self.start_time.split('%').each do |t|\n times.push(DateTime.strptime(t, '%m-%d-%Y %H:%M'))\n end\n times\n end",
"def get_timeslots_12hrs\n \t#create the new array\n \t@timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n @temp_holder = @timeslots[i].split(':')\n @temp_holder[0] = @temp_holder[0].to_i\n if @temp_holder[0] > 12\n @temp_holder[0] = @temp_holder[0] - 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n elsif @temp_holder[0] == 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n else\n @timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return @timeslots_12hrs\n end",
"def active_period\n [[@starting, @from].max, [@to - 1, @ending].min] # -1 sec: include only last unit day\n end",
"def event_range events\n [events.map(&:date).min.to_date, events.map(&:date).max.to_date]\nend",
"def getIndexRange()\n rangeTime = { :min => nil, :max => nil} ;\n rangeX = { :min => nil, :max => nil} ;\n rangeY = { :min => nil, :max => nil} ;\n rangeZ = { :min => nil, :max => nil} ;\n @sumGridTable.keys.sort.each{|index|\n rangeTime[:min] = safeMin(index[0], rangeTime[:min]) ;\n rangeTime[:max] = safeMax(index[0], rangeTime[:max]) ;\n rangeX[:min] = safeMin(index[1][0], rangeX[:min]) ;\n rangeX[:max] = safeMax(index[1][0], rangeX[:max]) ;\n rangeY[:min] = safeMin(index[1][1], rangeY[:min]) ;\n rangeY[:max] = safeMax(index[1][1], rangeY[:max]) ;\n rangeZ[:min] = safeMin(index[1][2], rangeZ[:min]) ;\n rangeZ[:max] = safeMax(index[1][2], rangeZ[:max]) ;\n }\n return [rangeTime, rangeX, rangeY, rangeZ] ;\n end",
"def get_timeslots_12hrs\n #create the new array\n timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n temp_holder = @timeslots[i].split(':')\n temp_holder[0] = temp_holder[0].to_i\n\n if temp_holder[0] > 12\n temp_holder[0] = temp_holder[0] - 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n elsif temp_holder[0] == 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n else\n timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return timeslots_12hrs\n end",
"def to_a\n (@start_date..@end_date).to_a\n end",
"def extract_range(options)\n (options[:range] || (options[:since]..options[:until]))\n .to_time_range.round(options[:granularity]).utc\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def OverlappingRanges(arr)\n\n # code goes here\n return arr \n \nend",
"def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"def find_in_range(time_from:, time_to:, time_windows: time_span_windows)\n #puts \"find_in_range, Recieve: diff: #{(time_to - time_from)}, time_from: #{time_from}, time_to: #{time_to}, time_window_left: #{time_windows.size}\"\n return [] if (time_to - time_from) < shorter_time_window_span\n\n while bucket = time_windows.shift\n next unless found_windows = find_fitting_windows(time_from, time_to, bucket)\n return found_windows +\n find_in_range(time_from: time_from, time_to: found_windows.first.fetch(:window_starts), time_windows: time_windows.clone) +\n find_in_range(time_from: found_windows.last.fetch(:window_finishes), time_to: time_to, time_windows: time_windows.clone)\n end\n end",
"def unfinished_dispatch_time_ranges\n dispatches.where(safe_return: false).map(&:active_time_window)\n end",
"def get_hours_array hours\n hours_array = []\n hours.each { |h| hours_array << h.date }\n return hours_array\n end",
"def fetch_events_time(range_begin_in_secs, range_end_in_secs)\n #\n # collect from_time beginning of day (in seconds)\n #\n frt = self.from_time.beginning_of_day.to_i\n\n case self.recurrence_type\n when \"NO_RECURRENCE\"\n self.no_recurrence_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_DAYS\"\n self.recur_every_n_days_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_WEEKS\"\n self.recur_every_n_weeks_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_MONTHS\"\n self.recur_every_n_months_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_YEARS\"\n self.recur_every_n_years_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_DAYS_OF_WEEK\"\n self.recur_every_days_of_week_dates(range_begin_in_secs, range_end_in_secs, frt)\n else\n []\n end\n end",
"def generate_time_slots(time_entries)\n time_entries.map { |entry| extract_available_slots(entry) }.flatten\n end",
"def xy_array(options={})\n\n values=[]\n if options[:values]\n case options[:values]\n when :positive\n values = @v.collect{|v| v if v>0.0}\n when :negative\n values = @v.collect{|v| v if v<0.0}\n when :non_positive\n values = @v.collect{|v| v if v<=0.0}\n when :non_negative\n values = @v.collect{|v| v if v>=0.0}\n when :non_zero\n values = @v.collect{|v| v if v!=0.0}\n when :zero\n values = @v.collect{|v| v if v==0.0}\n when :all\n values = @v.clone\n else\n raise ArgumentError, \"Option not recognized\"\n end\n else\n values = @v.clone\n end\n hn = Array.new(@v.size, @start_time)\n @v.size.times do |i|\n if values[i].nil?\n hn[i] = nil\n else\n hn[i]+=i.hours\n end\n end\n [hn.compact, values.compact]\n end",
"def tt_range\n ARange.new(ttstart_at, ttend_at)\n end",
"def range(min, max)\n range_array = []\n\n i = min\n while i <= max\n range_array << i\n i += 1\n end\n return range_array\nend",
"def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end",
"def to_a\n result = []\n @intervals.each do |int|\n result << int.to_a\n end\n result\n end",
"def datetimes\n intervals.map do |interval|\n datetimes = []\n datetime = interval.first_datetime\n while datetime <= interval.last_datetime\n datetimes << datetime\n datetime = datetime + frequency.duration\n end\n datetimes\n end\n end",
"def restaurant_time_select\n\t\ttimes = (0..23).map { |hour| [formatted_time(hour), hour] }\n\tend",
"def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end",
"def get_periods(first_start, first_end) \n\t\tperiods = []\n\n\t\tnot_ends = \n\t\t\t(@until.is_a? Fixnum) ?\n\t\t\tlambda {|i,d| i < @until} :\n\t\t\tlambda {|i,d| d < @until}\n\n\t\tduration = first_end - first_start\n\t\tcurrent_start = first_start\n\n\t\ti = 0\n\t\twhile not_ends.call(i, current_start)\n\t\t\tperiods << [current_start, current_start + duration]\n\n\t\t\tcurrent_start += @period_duration\n\t\t\ti +=1\n\t\tend\n\n\t\tperiods\n\tend",
"def create_time_periods(time_period_length = MSecPerHour)\n days = []\n time_periods = nil\n prev_start = @raw_data[0][0] + 1 # cross over into first day\n \n for data in @raw_data\n # Has data crossed over to next day?\n if prev_start > data[0] # Time increases throughout the day...\n days << time_periods if time_periods != nil\n \n cur_time_period = 0\n time_periods = [[]]\n \n puts \"New day: data=#{data[0]}\" if Verbose\n \n # Has data crossed over to next time period?\n elsif data[0] > ((cur_time_period + 1) * time_period_length)\n # Handle cases where the count is 0 for a time period\n while data[0] > ((cur_time_period + 1) * time_period_length)\n cur_time_period += 1\n time_periods[cur_time_period] = []\n end\n \n puts \"New time period: data=#{data[0]}\" if Verbose\n end\n \n time_periods[cur_time_period] << data\n prev_start = data[0]\n end\n \n # Add last time period\n days << time_periods\n days\n end",
"def to_a\n [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone]\n end",
"def events(range_begin = nil, range_end = nil, time_filters_in_secs = [])\n #\n # If range_begin is nil, use from_time attribute from the model.\n #\n range_begin = range_begin || self.from_time\n range_begin = Event.convert_to_datetime(range_begin).beginning_of_day.to_i\n\n #\n # If range_end is nil, use recurrence_end attribute from the model.\n # note: range_end may still be nil if no recurrence_end is specified\n # note: range_end is exclusive. substract with DAY_IN_SECONDS to\n # become inclusive (see arshaw fullcalendar docs)\n #\n range_end = Event.convert_to_datetime(range_end).end_of_day.to_i - DAY_IN_SECONDS if range_end\n range_end = [range_end, self.recurrence_end.try(:end_of_day).try(:to_i)].compact.min\n\n arr = []\n self.fetch_events_time(range_begin, range_end).each do |e|\n event_from_time_in_secs = e +\n (self.from_time.hour * HOUR_IN_SECONDS) +\n (self.from_time.min * MINUTE_IN_SECONDS)\n event_thru_time_in_secs = event_from_time_in_secs + self.duration\n\n unless time_filters_in_secs.include? event_from_time_in_secs\n arr << Event.new(self, event_from_time_in_secs, event_thru_time_in_secs)\n end\n end\n\n arr\n end",
"def segments_for_timestamps(start_timestamp, end_timestamp, granularity)\n start_ts = time_segment_for_timestamp(start_timestamp, granularity)\n end_ts = time_segment_for_timestamp(end_timestamp, granularity)\n\n segments = [start_ts]\n ts = start_ts\n while ts < end_ts\n ts += granularity\n segments << ts\n end\n\n segments\n end",
"def range(start, ending)\n return [] if start >= ending - 1\n retu_arr = range(start, ending - 1)\n retu_arr << ending - 1\nend",
"def get_device_times(id, from, to)\n node = find_start(id, from)\n list = Array.new\n while node && node.value < to_epoch(to) do\n list.push(node.value)\n break unless node.next\n node = node.next\n end\n return list\nend",
"def range(arr)\n\nend",
"def start_times\n \t@start_time1 = self.start_time1\n\n @start_time2 = self.start_time2\n\n @start_time3 = self.start_time3\n\n start_times = [@start_time1, @start_time2, @start_time3]\n end",
"def compute_local_range()\n begin_index = time2index(local_range.begin)\n end_index = time2index(local_range.end, -1) # FIXME this gives an unreachable index causing Exceptions down the line...\n begin_index..end_index\n end",
"def union(range)\n # Return self if nil (nothing new to add) or if it matches the other range (they are equivalent)\n return self.clone if range.nil?\n return self.clone if eql?(range)\n\n # Figure out which range starts earlier (to capture the most time)\n if low <= range.low\n earlier_start = self\n later_start = range\n else\n earlier_start = range\n later_start = self\n end\n \n # Figure out which ranges ends earlier (the more restrictive one)\n if high >= range.high\n earlier_end = self\n later_end = range\n else\n earlier_end = range\n later_end = self\n end\n \n result = []\n # We have continuous Ranges so we can return one Range to encapsulate both\n if earlier_start.contains?(later_start.low)\n result << Range.new(\"TS\", earlier_start.low.clone, later_end.high.clone, nil)\n else\n # The Ranges are disjoint, so we'll need to return two arrays to capture all of the potential times\n result << Range.new(\"TS\", earlier_start.low.clone, earlier_start.high.clone, nil)\n result << Range.new(\"TS\", later_start.low.clone, later_start.high.clone, nil)\n end\n end",
"def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end",
"def times_for_schedule_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_day + 15.hours\n task_time += 1.day if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.day\n end\n\n times\n end",
"def generate_time\n\t\tret = Array.new\n\t\tcount unless @fileinfo[:count]\n\t\ttrigger unless @fileinfo[:trigger]\n\t\tsampling unless @fileinfo[:sampling]\n\n\t\t(0..@fileinfo[:count] - @fileinfo[:trigger] - 1).each {|i| \n\t\t\tret << (i * @fileinfo[:sampling] * 1e-6)\n\t\t}\n\t\treturn ret\n\tend",
"def graph_data(events, minute_range)\n graph_data =[]\n events.each do | e |\n if (Time.now - e.capture_time) / 60 < minute_range\n graph_data << [e.capture_time, e.value]\n end\n end\n return graph_data\n end",
"def range(min, max) # takes some smaller num and then a larger num\n range_arr = [] # initialize new array\n i = min # indice counter @ whatever the first number passed in is\n\n firstnum = min # store val of first num\n lastnum = max # store val of last num\n \n while i <= max\n range_arr << i\n i += 1\n end\n return range_arr\nend",
"def range(start,finish)\n if start == finish\n return [start]\n end\n\n prev_arr = range(start+1, finish)\n prev_arr << start\n return prev_arr\nend",
"def range(min, max)\n \tarr = []\n\tfor i in min..max\n arr << i\n end\n return arr\nend",
"def range(start_num, end_num)\n range_array = []\n range_array << start_num\n\n if(start_num < end_num)\n range_array += range(start_num + 1, end_num)\n end\n\n range_array\nend",
"def to_a\n return [@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec, @t_usec]\n end",
"def range(options = {})\n value.to_time_range((options[:now] or Time.now)) \n end",
"def makeArrayConsecutive2(statues)\n max_value = statues.max\n min_value = statues.min\n result_array = []\n\n if min_value == max_value\n 0\n else\n for i in range(min_value, max_value)\n result_array.append(i)\n end\n end\n result_array.size - statues.size\nend",
"def time_range(rng=self,utc_offset=nil)\n if rng.begin.respond_to?(:sec) && rng.end.respond_to?(:sec)\n utc_offset ||= rng.begin.utc_offset\n Range.new( rng.begin.getlocal(utc_offset),\n rng.end.getlocal(utc_offset),\n rng.respond_to?(:exclude_end?) && rng.exclude_end?\n )\n else\n adj_rng = day_range(rng)\n b,e = adj_rng.begin, adj_rng.end\n Range.new( Time.new(b.year,b.month,b.day,0,0,0,utc_offset), \n Time.new(e.year,e.month,e.day,0,0,0,utc_offset), \n true\n )\n end\n end",
"def parse_time_range(expr, zone = nil)\r\n return nil unless expr && !expr.empty?\r\n zone ||= '+00:00'\r\n expr.split(' - ')[0..1].map {|t| parse_time(t.strip, zone)}\r\n end",
"def boundaries\n [intervals.first[0], intervals.last[1]]\n end",
"def array(n, time, frequency, amplitude, min, max, step = 1.minute)\n prev = self.new(\n time, frequency, amplitude, min, max, 0\n )\n i = 0\n acc = []\n while i < n\n prev = from(prev, step)\n acc << prev.value\n i += 1\n end\n\n acc\n end",
"def unix_time_range(date)\n range_start = Time.parse(date)\n range_end = range_start + DAY_IN_SECONDS\n [range_start.to_i, range_end.to_i]\n end",
"def get_set(start, finish, interval)\n cur_val = start; result = []\n while(cur_val < finish)\n result << cur_val\n cur_val += interval\n end\n result\n end",
"def in_range(*args)\n opts = args.last.kind_of?(Hash) ? args.pop : {}\n limit = opts[:limit]\n count = 1\n t_start, t_end = args.first.kind_of?(Range) ? [args.first.first, args.first.last] : [args.first,args.last]\n\n raise ArgumentError, \"must be a range or two date/time objects\" unless t_start and t_end\n\n self.start = t_start\n\n @in_range ||= begin\n result = []\n loop do\n next!\n break if count > limit if limit\n break if to_date > t_end\n result << to_date\n count += 1\n end\n\n result\n end\n end",
"def range(arr)\narr.max - arr.min\nend",
"def get_array_values(init,type)\n if type == \"fecha\"\n final = Time.new.year\n unidad = \"\"\n elsif type == \"rango\"\n final = 5000\n unidad = \"m2\"\n elsif type == \"aforo\"\n final = 500\n unidad = \"\"\n end\n array_ = []\n\n #((final.to_i).downto(Integer(init))).each do |n|\n (Integer(init)..(final.to_i)).each do |n|\n array_ << \"#{n}#{unidad}\"\n end\n return array_\n end",
"def get_busy_slots(start_min, start_max, time_zone)\n result = Array.new\n @googleCalendars.each do |x|\n result.push(x[:connection].query([x[:id]],start_min, start_max, time_zone))\n end\n return result\n end",
"def parse_time_range(time_string)\n return nil if time_string.nil?\n\n start_time =\n Chronic.parse(time_string.split('-').first.strip).seconds_since_midnight\n end_time =\n Chronic.parse(time_string.split('-').last.strip).seconds_since_midnight\n\n start_time...end_time\nend",
"def split_playtime(start)\r\r\n number = []\r\r\n number[0] = start / 60 / 60\r\r\n number[1] = start / 60 % 60\r\r\n number[2] = start % 60\r\r\n return number\r\r\n end",
"def metrics_time_range(start_time, end_time)\n resource.metrics.for_time_range(start_time, end_time)\n end",
"def get_acceptable_call_times\n AvailableTime.all.map{|m|\n if m.pharmacy_id == self.id #should be interger already but casting just in case\n {\"start\" => m.start_time.strftime(\"%H:%M:%S\"), \"stop\" => m.end_time.strftime(\"%H:%M:%S\")}\n else\n nil\n end\n }.compact\n end",
"def acceptable_years_in_school\n Array(min_year_in_school..max_year_in_school)\n end",
"def range(min, max)\n arr = []\n\n while min <= max\n arr << min\n min += 1\n end\n return arr\nend",
"def range\n [@from, @to]\n end",
"def get_trends_times(selection)\n # this is get_latest_trends_timing but for a selection of times -- it will allow the user to search for cohorts of trends over scalable time as opposed to a single snapshot. It may replace get_latest_trends_timing as it will return however many time-objects specified by the parameter.\n return_array = LocalTrendingEvent.where(country_id: self.id).order(\"time_of_trend desc\")\n times_array = []\n return_array.each do |lte|\n times_array.push(lte.time_of_trend)\n end\n times_array.uniq!\n return times_array[0..selection.to_i]\n end",
"def to_array\n\n [\n @seconds,\n @minutes,\n @hours,\n @days,\n @months,\n @weekdays,\n @monthdays,\n @timezone ? @timezone.name : nil\n ]\n end",
"def time\n\talltime = Array.new\n\tslices = 10\n\ti = 0\n\twhile i < slices.to_i do\n\t\talltime.push(Time.now)\n\t\ti+=1\n\tend\n\tyield\nend",
"def to_a\n [@year, @month, @day, @hour, @min, @sec]\n end",
"def time_travel_offsets\n @time_travel_offsets ||= []\n end",
"def split_playtime(start)\n number = []\n number[0] = start / 60 / 60\n number[1] = start / 60 % 60\n number[2] = start % 60\n return number\n end",
"def get_range(range)\n r = []\n enum = range.to_enum\n begin\n while (x = enum.next) < @size\n r << get_single_key(x)\n end\n rescue StopIteration\n end\n r.empty? ? nil : r\n end",
"def events_in_period\n t0 = start.midnight\n tf = finish.end_of_day\n\n events = []\n while t0 < tf\n t1 = [t0.advance(days: 21), tf].min\n events.concat(dog.stream(t0, t1, tags: @job_tags)[1]['events'])\n t0 = t1\n end\n events\n end",
"def collect\n [@range_low, @range_high]\n end",
"def parse_intervals\n intervals = Array.new\n headers_index = 16\n data_index = headers_index + 1\n headers = @data[headers_index].map!(&:underscore)\n current_interval = nil\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n @_interval_sample_index = data_index + i + 1\n break\n else\n zipped = (headers).zip(@data[data_index + i])\n i = WFWorkoutInterval.new\n Hash[zipped].map { |k,v|\n if k == \"interval\"\n if current_interval == v\n i.subinterval = true\n else\n i.subinterval = false\n end\n current_interval = v\n end\n i.instance_variable_set(\"@#{k}\",v)\n }\n intervals.push(i)\n end\n end\n return intervals\n end",
"def range(min, max)\n new_arr = []\n\n i = min\n while i <= max\n new_arr << i\n i = i + 1 \n end\n\n return new_arr\nend",
"def index\n if params[:date_range].blank?\n @time_slots = TimeSlot.all\n else\n input_start_time =\n input_end_time = \n @time_slots = TimeSlot.where(\"start_time > ? AND end_time < ?\", input_start_time, input_end_time)\n end\n end",
"def range(min, max)\n new_arr = []\n i = min\n while i <= max\n new_arr << i\n i += 1\n end\n return new_arr\n end",
"def range(min, max)\n\ti = min\n \tarry = []\n while i <= max\n arry << i\n i += 1\n end\n return arry\n\nend",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def ranges\n x_start, y_start = absolute(0, 0)\n x_end, y_end = absolute(@diameter - 1, @diameter - 1)\n\n [x_start..x_end, y_start..y_end]\n end",
"def range(arr)\n arr.max - arr.min\nend",
"def range(arr)\n arr.max - arr.min\nend"
] | [
"0.7549909",
"0.7376667",
"0.7167006",
"0.67499447",
"0.67321837",
"0.67124",
"0.66843575",
"0.6673482",
"0.6661179",
"0.66502464",
"0.6642185",
"0.6627762",
"0.65787345",
"0.64759034",
"0.6464391",
"0.64186114",
"0.6390875",
"0.6346739",
"0.63105834",
"0.62871027",
"0.62778425",
"0.6255259",
"0.6240646",
"0.6239279",
"0.6218073",
"0.61758566",
"0.61585504",
"0.61494166",
"0.60975444",
"0.6086575",
"0.6084653",
"0.60795075",
"0.6076644",
"0.60733676",
"0.6054669",
"0.6053823",
"0.6053439",
"0.60516906",
"0.6048539",
"0.6046983",
"0.60453016",
"0.60196954",
"0.6004082",
"0.59814614",
"0.59788597",
"0.59732234",
"0.59654427",
"0.59545106",
"0.5948795",
"0.59472245",
"0.59378797",
"0.59077114",
"0.5889358",
"0.58708453",
"0.5869223",
"0.5867333",
"0.5854179",
"0.585354",
"0.5840326",
"0.5821984",
"0.5819359",
"0.58126295",
"0.5800229",
"0.5797955",
"0.57929105",
"0.5792739",
"0.57905316",
"0.5786375",
"0.5778364",
"0.5771432",
"0.5771147",
"0.57654405",
"0.5762269",
"0.5761136",
"0.57595205",
"0.57563156",
"0.57561517",
"0.5754165",
"0.5745913",
"0.5743925",
"0.57406765",
"0.57395875",
"0.5739202",
"0.57361495",
"0.5734762",
"0.57294756",
"0.5728371",
"0.57255715",
"0.5724196",
"0.5722138",
"0.571186",
"0.5711822",
"0.569573",
"0.56941515",
"0.56929845",
"0.56818",
"0.5678379",
"0.5678314",
"0.5670197",
"0.5670197"
] | 0.7213178 | 2 |
GET /buddyfights GET /buddyfights.json | def index
@buddyfights = Buddyfight.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def breakdown\n @points = current_user.points.limit(5)\n render json: @points, status: 200\n end",
"def index\n @buddies = Buddy.all\n end",
"def index\n @friends = current_user_or_guest.friends.order(:name) \\\n .includes(bills: :participations)\n\n debts = @friends.map { |friend| [friend, friend.debt] }\n owe_you = debts.select { |_, debt| debt > 0 }\n @owe_you = owe_you.map(&:last).sum\n @owe_you_friends = owe_you.sort_by(&:last).map(&:first)\n\n you_owe = debts.select { |_, debt| debt < 0 }\n @you_owe = you_owe.map(&:last).sum.abs\n @you_owe_friends = you_owe.sort_by(&:last).map(&:first)\n\n even = debts.select { |_, debt| debt == 0 }\n @even_friends = even.map(&:first).sort_by(&:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @friends }\n format.json { render json: @friends }\n end\n end",
"def count\n @battles_count = Battle.all\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def index\n @fights = Fight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n end\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def number_of_fights\n BoxingSchedules::Fight.all\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def show\n @buddy_list = current_user.buddy_list\n end",
"def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end",
"def show\n @buddy = Buddy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @buddy }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end",
"def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end",
"def scheduled_fights_scraper\n BoxingSchedules::Scraper.scrape_scheduled_fights\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def index\n @weights = current_user.weights.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def get_friend_count\n response = twitter_user.request(:get, configatron.api_call_url + \"account/totals.json\")\n \n if response.is_a?(Net::HTTPSuccess)\n body = JSON.parse(response.body)\n body[\"friends\"]\n end\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end",
"def index\n @friends = Friend.all\n render json: @friends\n end",
"def show\n @user = User.find(params[:id])\n unless @user.uuid == current_user.uuid\n unless current_user.rels(dir: :outgoing, type: :visits, between: @user).blank?\n rel = current_user.rels(dir: :outgoing, type: :visits, between: @user)\n rel[0].count = rel[0].count + 1\n rel[0].save!\n else\n rel = Visit.new\n rel.from_node = current_user\n rel.to_node = @user\n rel.count = 1\n rel.save!\n end\n current_user.save!\n end\n #@b = current_user.badges(:u, :r).where( uuid: @user.uuid ).pluck(:r)\n #@badges = @b.map {|b| b.badgeType}.uniq\n @uniq_badges = @user.rels(dir: :incoming, type: :badges).each.map {|r| r.badgeType}.uniq\n @all_badges = {}\n @uniq_badges.each do |badge|\n @all_badges[badge] = @user.rels(dir: :incoming, type: :badges).each.select{|r| r.badgeType == badge }.count\n end\n @my_badges = []\n @badges_count = @user.rels(dir: :incoming, type: \"badges\").count\n if current_user.uuid != @user.uuid\n current_user.rels(dir: :outgoing, type: :badges, between: @user).each do |r|\n #current_user.badges(:u, :r).where( uuid: @user.uuid ).each_with_rel do |u, r| \n @my_badges << r[:badgeType]\n end\n end\n @pictures = @user.pictures\n @testimonials = @user.testimonials\n\n unless @user.uuid == current_user.uuid\n @like = current_user.rels(dir: :outgoing, type: :likes, between: @user).blank? ? true : false\n end\n @likes_count = @user.rels(dir: :incoming, type: \"likes\").count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def state_beers\n render json: BreweryDb::ShowBeers.new('state', params[:state]).results\n end",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def index\n @twentyeights = Twentyeight.all\n end",
"def index\n @bid_winners = BidWinner.all\n end",
"def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end",
"def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end",
"def show\n @weights = @rabbit.weights.order(\"registered_on DESC\")\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def index\n #Moving this to the application controller because this isn't called by a partial rendering.\n #@zombie_sightings = ZombieSighting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @zombie_sightings }\n end\n end",
"def show\n render json: @dice\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end",
"def total\n url = \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n begin\n response = RestClient.get \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n if response.code == 200\n @total = JSON.parse response.body\n end\n rescue => e\n logger.error \"Mole Total: #{e.message} - #{url}\"\n @total = { grandTotalRaisedExcludingGiftAid: \"Sorry, JustGiving is unavailable at this time.\" }\n end\n\n respond_to do |format|\n format.html # total.html.erb\n format.json { render json: @total, callback: params[:callback] }\n format.xml { render xml: @total }\n end\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def index\n respond_to do |format|\n format.json {\n user_leaderboard = []\n userid = params[:user_id]\n if userid\n # First, get the list of leaderboard values for current user\n current_user = User.find(userid)\n user_leaderboard << get_leaderboard_values_for_user(userid, current_user.fbid, current_user.fb_name, current_user.membertime)\n\n # Then, get leaderboard values for user's friends\n fbid_array = current_user.fb_friends\n if fbid_array.length > 0\n fbid_array = fbid_array.split(\"|\")\n friends_list = User.where(\"fbid in (?)\", fbid_array)\n\n friends_list.each do |friend|\n user_leaderboard << get_leaderboard_values_for_user(friend.id, friend.fbid, friend.fb_name, friend.membertime)\n end\n end\n\n log_event(:user_leaderboard, :get, user_leaderboard)\n render json: user_leaderboard.as_json\n else\n create_error(:unprocessable_entity, :get, \"\", \"Missing user\")\n end\n }\n end\n end",
"def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end",
"def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @winning_numbers = WinningNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winning_numbers }\n end\n end",
"def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end",
"def show\n @friend = current_user_or_guest.friends \\\n .includes(bills: :participations) \\\n .find(params[:id])\n @bills = current_user_or_guest.bills_with_friend(@friend).decorate\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @friend }\n format.json { render json: @friend }\n end\n end",
"def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend",
"def index\n @user = current_user\n render json: @user.friends\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def badges(options={})\n get('/user_badge', options)\n end",
"def show\n render json: @heartbeat\n end",
"def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end",
"def index\n @bowlers = Bowler.all\n respond_with(@bowlers)\n end",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def index\n @weights = current_user.weights\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end",
"def index\n @my_badges = current_account.my_badges \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_my_badges }\n end\n end",
"def index\n @blood_pressures = BloodPressure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blood_pressures }\n end\n end",
"def index\n @result_fights = ResultFight.where(user_id: current_user.id)\n end",
"def twubbles\n @sad_tweets = WordTweet.recent_sad_tweets\n respond_to do |f|\n f.json { render :json => twubbles_json(@sad_tweets) }\n f.html\n end\n end",
"def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end",
"def index\n if params[:show] == \"upcoming\"\n @games = Game.where(:final => false).order(\"kickoff\")\n else\n @games = Game.order(\"kickoff\")\n end\n\n # Find all tips for the currently logged in user\n setup_user_tips_hash\n setup_winners_right_now\n calculate_odds\n\n # Get the leaders for the sidebar\n @leaders = User.order(\"points DESC\").limit(10)\n\n # Find the latest comment. For the polling to work.\n @last_comment = Comment.order(\"updated_at DESC\").first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end",
"def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def following\n @users = User.find(params[:id]).all_following\n render json: @users\n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def index\n @fighters = Fighter.all\n end",
"def index\n @fighters = Fighter.all\n end",
"def index\n @fighters = Fighter.all\n end",
"def index\n @sights = Sight.all\n end",
"def friends(g)\n \n ip = g.ll\n @friends = @access_token.get(\"/v1/checkins?geolat=#{ip[:lat]}&geolong=#{ip[:long]}\", {'User-Agent' => \"fourrific:#{Fourrific::VERSION}\"}).body \n \n begin\n @friends = Crack::XML.parse(@friends)\n if @friends['unauthorized']\n @error = \"#{@friends['unauthorized']}. Clear your cookies & cache and try again.\"\n elsif @friends['ratelimited']\n @error = \"#{@friends['ratelimited']}. Please try again later.\"\n elsif @friends['error']\n @error = \"#{@friends['error']}\"\n else\n @friends['checkins']['checkin'].each do |checkin|\n checkin['created'] = checkin['created'].to_time.iso8601\n checkin['distance'] = (checkin['distance'].to_i / 1609.344).to_i\n end\n end \n end\n \n \n @friends\n \n end",
"def index\n @nights = Night.all\n end",
"def index\n waiver_picks_decorator = WaiverPicksDecorator.new(\n @fpl_team.waiver_picks.where(round_id: (params[:round_id] || Round.current_round.id))\n )\n\n render json: { waiver_picks: waiver_picks_decorator.all_data }\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_dungeons.to_ext_json(:class => Dungeon, :count => Dungeon.count(options_from_search(Dungeon))) }\n end\n end",
"def index\n @expense_buddies = ExpenseBuddy.all\n end",
"def index\n @dices = Dice.all\n\n render json: @dices\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end"
] | [
"0.60715854",
"0.5926916",
"0.5924033",
"0.59208554",
"0.5827693",
"0.5801998",
"0.58001655",
"0.5779875",
"0.57729566",
"0.57603973",
"0.5757087",
"0.573221",
"0.57222956",
"0.57210886",
"0.5703818",
"0.5697461",
"0.5694296",
"0.56819487",
"0.5681444",
"0.56712115",
"0.5664017",
"0.56538755",
"0.5652742",
"0.564924",
"0.56334853",
"0.5632199",
"0.56266016",
"0.56192255",
"0.5612449",
"0.5608942",
"0.55859923",
"0.55794257",
"0.5575643",
"0.5559972",
"0.554607",
"0.55120957",
"0.5509699",
"0.5509364",
"0.55007684",
"0.5496231",
"0.5492677",
"0.54870427",
"0.54865533",
"0.5483821",
"0.547476",
"0.54742205",
"0.54737955",
"0.5471257",
"0.54698324",
"0.54685503",
"0.5467131",
"0.54654455",
"0.5461893",
"0.5460441",
"0.5446839",
"0.5439546",
"0.54395014",
"0.5438781",
"0.5428973",
"0.5422234",
"0.5411416",
"0.5411416",
"0.53917915",
"0.5389343",
"0.5382828",
"0.5380697",
"0.5377756",
"0.53774613",
"0.537169",
"0.5370462",
"0.5367353",
"0.53649807",
"0.5362615",
"0.53576565",
"0.5357189",
"0.5354169",
"0.5353138",
"0.5347568",
"0.53469396",
"0.534121",
"0.53399146",
"0.5337757",
"0.5332776",
"0.5327389",
"0.53200835",
"0.5318641",
"0.5309887",
"0.5309887",
"0.5309887",
"0.5301744",
"0.5301478",
"0.52968603",
"0.5295517",
"0.52913976",
"0.5291211",
"0.52862823",
"0.5279269",
"0.5277601",
"0.527199",
"0.5264103"
] | 0.73732185 | 0 |
GET /buddyfights/1 GET /buddyfights/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buddyfights = Buddyfight.all\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end",
"def show\n @buddy = Buddy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @buddy }\n end\n end",
"def index\n @buddies = Buddy.all\n end",
"def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end",
"def show\n @buddy_list = current_user.buddy_list\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def show\n render json: @heartbeat\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def show\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heartbeat }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def count\n @battles_count = Battle.all\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def breakdown\n @points = current_user.points.limit(5)\n render json: @points, status: 200\n end",
"def index\n @fights = Fight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def index\n @friends = Friend.all\n render json: @friends\n end",
"def state_beers\n render json: BreweryDb::ShowBeers.new('state', params[:state]).results\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def show\n @beacon = Beacon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beacon }\n end\n end",
"def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def friends\n #get friends page\n #get json from friends page\n #parse\n []\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def index\n @blood_pressures = BloodPressure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blood_pressures }\n end\n end",
"def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def index\n @weights = current_user.weights.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bot_bingo_number }\n end\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def show\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @badge }\n end\n \n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid flag #{params[:id]}\"\n redirect_to root_path, notic: 'Invalid page'\n end",
"def show\n render json: @dice\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end",
"def index\n #Moving this to the application controller because this isn't called by a partial rendering.\n #@zombie_sightings = ZombieSighting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @zombie_sightings }\n end\n end",
"def sleep_goals\n get_json(path_user_version('/sleep/goal'))\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end",
"def index\n @goals = @user.goals\n \n render json: @goals\n end",
"def index\n @bitches = Bitch.all\n end",
"def show\n @wager = Wager.find(params[:id])\n\n render json: @wager\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def show\n @weights = @rabbit.weights.order(\"registered_on DESC\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end",
"def show\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @witch }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @user = User.find(params[:id])\n unless @user.uuid == current_user.uuid\n unless current_user.rels(dir: :outgoing, type: :visits, between: @user).blank?\n rel = current_user.rels(dir: :outgoing, type: :visits, between: @user)\n rel[0].count = rel[0].count + 1\n rel[0].save!\n else\n rel = Visit.new\n rel.from_node = current_user\n rel.to_node = @user\n rel.count = 1\n rel.save!\n end\n current_user.save!\n end\n #@b = current_user.badges(:u, :r).where( uuid: @user.uuid ).pluck(:r)\n #@badges = @b.map {|b| b.badgeType}.uniq\n @uniq_badges = @user.rels(dir: :incoming, type: :badges).each.map {|r| r.badgeType}.uniq\n @all_badges = {}\n @uniq_badges.each do |badge|\n @all_badges[badge] = @user.rels(dir: :incoming, type: :badges).each.select{|r| r.badgeType == badge }.count\n end\n @my_badges = []\n @badges_count = @user.rels(dir: :incoming, type: \"badges\").count\n if current_user.uuid != @user.uuid\n current_user.rels(dir: :outgoing, type: :badges, between: @user).each do |r|\n #current_user.badges(:u, :r).where( uuid: @user.uuid ).each_with_rel do |u, r| \n @my_badges << r[:badgeType]\n end\n end\n @pictures = @user.pictures\n @testimonials = @user.testimonials\n\n unless @user.uuid == current_user.uuid\n @like = current_user.rels(dir: :outgoing, type: :likes, between: @user).blank? ? true : false\n end\n @likes_count = @user.rels(dir: :incoming, type: \"likes\").count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @winning_numbers = WinningNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winning_numbers }\n end\n end",
"def show\n @bowl = Bowl.find(params[:id])\n @visits = Visit.find_all_by_user_id(@bowl.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bowl }\n end\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def set_buddyfight\n @buddyfight = Buddyfight.find(params[:id])\n end",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end",
"def index\n @bowlers = Bowler.all\n respond_with(@bowlers)\n end",
"def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end",
"def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def index\n @friends = current_user_or_guest.friends.order(:name) \\\n .includes(bills: :participations)\n\n debts = @friends.map { |friend| [friend, friend.debt] }\n owe_you = debts.select { |_, debt| debt > 0 }\n @owe_you = owe_you.map(&:last).sum\n @owe_you_friends = owe_you.sort_by(&:last).map(&:first)\n\n you_owe = debts.select { |_, debt| debt < 0 }\n @you_owe = you_owe.map(&:last).sum.abs\n @you_owe_friends = you_owe.sort_by(&:last).map(&:first)\n\n even = debts.select { |_, debt| debt == 0 }\n @even_friends = even.map(&:first).sort_by(&:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @friends }\n format.json { render json: @friends }\n end\n end",
"def index\n respond_to do |format|\n format.json {\n user_leaderboard = []\n userid = params[:user_id]\n if userid\n # First, get the list of leaderboard values for current user\n current_user = User.find(userid)\n user_leaderboard << get_leaderboard_values_for_user(userid, current_user.fbid, current_user.fb_name, current_user.membertime)\n\n # Then, get leaderboard values for user's friends\n fbid_array = current_user.fb_friends\n if fbid_array.length > 0\n fbid_array = fbid_array.split(\"|\")\n friends_list = User.where(\"fbid in (?)\", fbid_array)\n\n friends_list.each do |friend|\n user_leaderboard << get_leaderboard_values_for_user(friend.id, friend.fbid, friend.fb_name, friend.membertime)\n end\n end\n\n log_event(:user_leaderboard, :get, user_leaderboard)\n render json: user_leaderboard.as_json\n else\n create_error(:unprocessable_entity, :get, \"\", \"Missing user\")\n end\n }\n end\n end",
"def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traffic }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def show\n @fight = Fight.find(params[:id])\n @fighters = [@fight.fighter_one, @fight.fighter_two]\n @pick = Pick.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fight }\n end\n end",
"def index\n @my_badges = current_account.my_badges \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_my_badges }\n end\n end",
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def index\n @bookmark_stats = BookmarkStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bookmark_stats }\n end\n end",
"def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end",
"def show\n @zombie = Zombie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie }\n end\n end",
"def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end",
"def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def index\n @dices = Dice.all\n\n render json: @dices\n end"
] | [
"0.72476643",
"0.63128006",
"0.62903166",
"0.60897577",
"0.60348153",
"0.60020787",
"0.597076",
"0.5914595",
"0.5908769",
"0.58838147",
"0.5833816",
"0.58067745",
"0.5801884",
"0.5792441",
"0.5785414",
"0.57534134",
"0.57490456",
"0.572998",
"0.5719566",
"0.5714669",
"0.5713165",
"0.57035017",
"0.57004964",
"0.5690131",
"0.56838596",
"0.5677433",
"0.56749004",
"0.56626755",
"0.565707",
"0.56532073",
"0.56448245",
"0.56406623",
"0.5618135",
"0.56026316",
"0.56018305",
"0.5601099",
"0.55947393",
"0.5588755",
"0.5581644",
"0.55796546",
"0.5575498",
"0.55673695",
"0.5561169",
"0.5557517",
"0.55574214",
"0.55574214",
"0.55570936",
"0.555562",
"0.55523384",
"0.5537628",
"0.5529822",
"0.55189604",
"0.55152875",
"0.5509018",
"0.550853",
"0.54994756",
"0.5497112",
"0.5496284",
"0.54695714",
"0.54692584",
"0.54677236",
"0.5464936",
"0.54588246",
"0.5456157",
"0.5448115",
"0.54477966",
"0.5442612",
"0.54398364",
"0.5437768",
"0.54348946",
"0.54334027",
"0.5429023",
"0.542835",
"0.54279137",
"0.5427833",
"0.54252845",
"0.5423072",
"0.54200554",
"0.5419163",
"0.54176706",
"0.541746",
"0.5414526",
"0.5405207",
"0.5394954",
"0.53946507",
"0.53898335",
"0.5385258",
"0.53843325",
"0.53785574",
"0.53732026",
"0.53618366",
"0.53593326",
"0.5358874",
"0.535731",
"0.5356203",
"0.53501827",
"0.5348314",
"0.534676",
"0.53467506",
"0.53375316",
"0.53367877"
] | 0.0 | -1 |
POST /buddyfights POST /buddyfights.json | def create
@buddyfight = Buddyfight.new(buddyfight_params)
respond_to do |format|
if @buddyfight.save
format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully created.' }
format.json { render :show, status: :created, location: @buddyfight }
else
format.html { render :new }
format.json { render json: @buddyfight.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @buddyfights = Buddyfight.all\n end",
"def create\n #@buddy = Buddy.new(buddy_params)\n @buddy = current_user.buddies.build(buddy_params)\n\n respond_to do |format|\n if @buddy.save\n format.html { redirect_to @buddy, notice: \"Buddy was successfully created.\" }\n format.json { render :show, status: :created, location: @buddy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @buddy = Buddy.new(params[:buddy])\n\n respond_to do |format|\n if @buddy.save\n flash[:notice] = 'New buddy added.'\n format.html {redirect_to(user_path(session[:user_id]))}\n else\n errors = []\n @buddy.errors.each do |field,error|\n errors << error\n end\n flash[:notice] = errors\n format.html { redirect_to(user_path(session[:user_id]))}\n end\n end\n end",
"def create\n @expense_buddy = ExpenseBuddy.new(expense_buddy_params)\n\n respond_to do |format|\n if @expense_buddy.save\n format.html { redirect_to @expense_buddy, notice: 'Expense buddy was successfully created.' }\n format.json { render :show, status: :created, location: @expense_buddy }\n else\n format.html { render :new }\n format.json { render json: @expense_buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n gateway_alive = GatewayAlive.create(gateway_id: params[:gatewayId])\n render json: gateway_alive.to_json, status: :ok\n end",
"def create\n @settlebuddy_support = SettlebuddySupport.new(settlebuddy_support_params)\n\n respond_to do |format|\n if @settlebuddy_support.save\n format.html { redirect_to @settlebuddy_support, notice: 'Settlebuddy support was successfully created.' }\n format.json { render :show, status: :created, location: @settlebuddy_support }\n else\n format.html { render :new }\n format.json { render json: @settlebuddy_support.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_buddies_to_friends_list\n if user_id.blank?\n render :status=>401,\n :json=>{:Message=>\"The user id cannot be blank for this api.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n friend = User.find_by_id(user_id)\n friend.follow(requested_user)\n render :status=>200,\n :json=>{:Message=>\"Added #{friend.name} to buddy list!\",\n :Response => \"Success\",\n :Data => nil} \n end",
"def create\n \t@fight = current_user.fights.new(fights_params)\n \t@fight.save\n end",
"def update\n respond_to do |format|\n if @buddy.update(buddy_params)\n format.html { redirect_to @buddy, notice: \"Buddy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buddy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @twentyeight = Twentyeight.new(twentyeight_params)\n\n respond_to do |format|\n if @twentyeight.save\n format.html { redirect_to @twentyeight, notice: 'Twentyeight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twentyeight }\n else\n format.html { render action: 'new' }\n format.json { render json: @twentyeight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dinner = Dinner.new(dinner_params)\n @dinner.seats_available = @dinner.seats\n @dinner.host = current_user\n current_user.n_hosted += 1\n respond_to do |format|\n if current_user.save and @dinner.save\n format.html { redirect_to @dinner, notice: 'Supper successfully created.' }\n format.json { render :show, status: :created, location: @dinner }\n else\n format.html { render :new }\n format.json { render json: @dinner.errors, status: :unprocessable_entity }\n logger.error @dinner.errors.full_messages\n end\n end\n end",
"def create\n @twizzle = Twizzle.new(twizzle_params)\n\n respond_to do |format|\n if @twizzle.save\n format.html { redirect_to @twizzle, notice: 'Twizzle was successfully created.' }\n format.json { render :show, status: :created, location: @twizzle }\n else\n format.html { render :new }\n format.json { render json: @twizzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_buddyfight\n @buddyfight = Buddyfight.find(params[:id])\n end",
"def create\n @pledgenewee = Pledgenewee.new(pledgenewee_params)\n\n respond_to do |format|\n if @pledgenewee.save\n format.html { redirect_to @pledgenewee, notice: 'Pledgenewee was successfully created.' }\n format.json { render :show, status: :created, location: @pledgenewee }\n else\n format.html { render :new }\n format.json { render json: @pledgenewee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @heartbeat = Heartbeat.new(heartbeat_params)\n\n if @heartbeat.save\n render json: @heartbeat, status: :created, location: @heartbeat\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def alive\n @heartbeat = Heartbeat.create(heartbeats_params)\n if @heartbeat.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create heartbeat' }, status: :internal_server_error\n end\n end",
"def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end",
"def create_voted_beer\n render json: BreweryDb::CreateVotedbeer.new(params[:beerId]).create\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n # @alert_message = \"Meter Maid is around.\"\n @sighting = current_user.sightings.build(sighting_params)\n # @sighting.notify\n respond_to do |format|\n\n # send_message(\"+17049955069\", @alert_message)\n\n if @sighting.save\n\n format.html { redirect_to @sighting, notice: 'Sighting was successfully created.' }\n format.json { render :show, status: :created, location: @sighting }\n\n ################################################################\n @sighting.alert_users(InterestLocation.all)\n \n # users = @sighting.target_users(post_array, locations)\n # @sighting.send_email(users)\n ################################################################\n else\n format.html { render :new }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def create\n @banned = Banned.new(banned_params)\n\n respond_to do |format|\n if @banned.save\n format.html { redirect_to @banned, notice: 'Banned was successfully created.' }\n format.json { render :show, status: :created, location: @banned }\n else\n format.html { render :new }\n format.json { render json: @banned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end",
"def new\n @zombie_sighting = ZombieSighting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zombie_sighting }\n end\n end",
"def set_buddy\n @buddy = Buddy.find(params[:id])\n end",
"def index\n gateway_alive = GatewayAlive.all\n render json: gateway_alive.to_json(:except => [:id])\n end",
"def create\n @waiter = Waiter.new(params[:waiter])\n\n respond_to do |format|\n if @waiter.save\n format.html { redirect_to @waiter, notice: 'Waiter was successfully created.' }\n format.json { render json: @waiter, status: :created, location: @waiter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bid_winner = BidWinner.new(bid_winner_params)\n\n respond_to do |format|\n if @bid_winner.save\n format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully created.' }\n format.json { render :show, status: :created, location: @bid_winner }\n else\n format.html { render :new }\n format.json { render json: @bid_winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end",
"def count\n @battles_count = Battle.all\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def create\n @freight_bill = FreightBill.new(freight_bill_params)\n\n respond_to do |format|\n if @freight_bill.save\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully created.' }\n format.json { render :show, status: :created, location: @freight_bill }\n else\n format.html { render :new }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scribble = Scribble.new(params[:scribble])\n @scribble.posted_by_uid=current_user.beamer_id\n @scribble.posted_by=current_user.first_name+\" \"+current_user.last_name\n @scribble.ups=0\n @scribble.downs=0\n respond_to do |format|\n if @scribble.save!\n format.html { redirect_to root_path }\n format.json { render :json => @scribble, :status => :created, :location => @scribble }\n else\n format.html { redirect_to root_path }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def breakdown\n @points = current_user.points.limit(5)\n render json: @points, status: 200\n end",
"def create\n @buyer = Buyer.new(params[:buyer])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @buyer.save\n @users.each do |user|\n BuyerMailer.registration_welcome(@buyer, user).deliver\n Buyer.increment_counter(\"times_forwarded\", @buyer.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @buyer, :status => :created, :location => @buyer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @buyer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def zweet_params\n params.require(:zweet).permit(:status, :zombie_id)\n end",
"def create\n @dinner = Dinner.new(dinner_params)\n @dinner.host_id = @current_user.json_hash[:id]\n if @dinner.valid?\n @dinner.save\n render json: @dinner.all_info\n else\n puts @dinner.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @dinner.errors.messages\n }\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def index\n @buddies = Buddy.all\n end",
"def create\n party = []\n (1..6).each do |p_number|\n level = params[:dungeon_instance][\"hero#{p_number}_level\"].to_i\n party << level if level > 0\n end\n\n dungeon = Dungeon.new\n dungeon.generate( params[:dungeon_instance][:size].to_i, party,\n encounters_difficulty: params[:dungeon_instance][:difficulty].to_sym )\n # p dungeon.to_json\n\n @dungeon_instance = DungeonInstance.new( dungeon_instance_params.merge( dungeon_data: dungeon.to_json ) )\n\n respond_to do |format|\n if current_user.dungeon_instances << @dungeon_instance\n format.html { redirect_to dungeon_instance_play_path( @dungeon_instance ), notice: 'Dungeon instance was successfully created.' }\n else\n format.html { redirect_to dungeon_instances_path, error: 'Dungeon instance was successfully created.' }\n end\n end\n end",
"def create\n @won_count = WonCount.new(won_count_params)\n\n respond_to do |format|\n if @won_count.save\n format.html { redirect_to @won_count, notice: 'Won count was successfully created.' }\n format.json { render :show, status: :created, location: @won_count }\n else\n format.html { render :new }\n format.json { render json: @won_count.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fights_params\n params.require(:fight).permit('opponent_1_name', 'opponent_1_strength', 'opponent_1_life', 'opponent_1_adv', 'opponent_2_name', 'opponent_2_strength', 'opponent_2_life', 'opponent_2_adv', 'opponent_3_name', 'opponent_3_strength', 'opponent_3_life', 'opponent_3_adv', 'opponent_4_name', 'opponent_4_strength', 'opponent_4_life', 'opponent_4_adv', 'opponent_5_name', 'opponent_5_strength', 'opponent_5_life', 'opponent_5_adv')\n end",
"def create\n @zombie_sighting = ZombieSighting.new(lat: params[:lat],\n lng: params[:lng])\n\n respond_to do |format|\n if @zombie_sighting.save\n format.html { redirect_to action: \"index\", notice: 'Zombie sighting was successfully created.' }\n format.json { render json: @zombie_sighting, status: :created, location: @zombie_sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def buddyfight_params\n params.fetch(:buddyfight, {})\n end",
"def create\n @bet_winner = BetWinner.new(bet_winner_params)\n\n respond_to do |format|\n if @bet_winner.save\n format.html { redirect_to @bet_winner, notice: 'Bet winner was successfully created.' }\n format.json { render :show, status: :created, location: @bet_winner }\n else\n format.html { render :new }\n format.json { render json: @bet_winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @heartbeat = Heartbeat.new(params[:heartbeat])\n\n respond_to do |format|\n if @heartbeat.save\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully created.' }\n format.json { render json: @heartbeat, status: :created, location: @heartbeat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @buddyfight.update(buddyfight_params)\n format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully updated.' }\n format.json { render :show, status: :ok, location: @buddyfight }\n else\n format.html { render :edit }\n format.json { render json: @buddyfight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grumble = Grumble.new(grumble_params)\n\n respond_to do |format|\n if @grumble.save\n format.html { redirect_to @grumble, notice: 'Grumble was successfully created.' }\n format.json { render :show, status: :created, location: @grumble }\n else\n format.html { render :new }\n format.json { render json: @grumble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def expense_buddy_params\n params.require(:expense_buddy).permit(:buddy_id, :expense_id)\n end",
"def create\n @witness = Witness.new(params[:witness])\n\n respond_to do |format|\n if @witness.save\n #format.html { redirect_to action: \"index\" }\n format.json { render json: @witness, status: :created, location: @witness }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n sighting = Sighting.create(sighting_params)\n if sighting.valid?\n render json: sighting\n else\n render json: sighting.errors\n end\n end",
"def data_add_wagons\n @trains[0].add_wagon(PassengerWagon.new(35.to_i))\n @trains[1].add_wagon(PassengerWagon.new(32.to_i))\n @trains[2].add_wagon(CargoWagon.new(428.to_i))\n end",
"def create\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n description = params[:description]\n \n timestamp = params[:timestamp]\n total_sleep_seconds = params[:total_sleep]\n deep_sleep_seconds = params[:deep]\n light_sleep_seconds = params[:light]\n awake_seconds = params[:awake]\n \n if timestamp.nil? || total_sleep_seconds.nil?\n \n puts 'timestamp is nil or total_sleep_seconds is nil :('\n \n else\n \n total_sleep = total_sleep_seconds / 60.0\n deep = deep_sleep_seconds / 60.0\n light = light_sleep_seconds / 60.0\n awake = awake_seconds / 60.0\n \n post_to_twitter = false\n post_to_facebook = false\n \n # FellAsleepAt is formatted: August 23, 2013 at 11:01PM\n # Convert to Runkeeper's preferred format: Sat, 1 Jan 2011 00:00:00\n timestamp_datetime = DateTime.parse(timestamp)\n formatted_timestamp = timestamp_datetime.strftime(\"%a, %d %b %Y %H:%M:%S\")\n \n json_hash['timestamp'] = formatted_timestamp\n json_hash['total_sleep'] = deep\n json_hash['deep'] = deep\n json_hash['light'] = light\n json_hash['awake'] = awake\n json_hash['post_to_twitter'] = post_to_twitter\n json_hash['post_to_facebook'] = post_to_facebook\n \n url = 'https://api.runkeeper.com/sleep'\n \n uri = URI.parse(url)\n \n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri)\n request[\"Authorization\"] = \"Bearer \" + RUNKEEPER_ACCESS_TOKEN\n request[\"Content-Type\"] = \"application/vnd.com.runkeeper.NewSleep+json\"\n request.body = json_hash.to_json\n \n response = http.request(request)\n \n puts response.body\n \n end\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n \n end",
"def create_friend\n user = current_user\n @user = User.find_by_id(params[:id])\n @friendship = Friendship.find_by_friend_id_and_user_id(user.id,@user.id)\n if @friendship.nil? then\n @friendship = Friendship.new\n @friendship.user_id = user.id\n @friendship.friend_id = @user.id\n @friendship.accepted = false\n @friendship.save\n\n @typed = @friendship.class.to_s\n @az = @friendship\n activation_activity\n end\n\n respond_to do |format|\n format.js\n format.json\n end\n\n begin\n permissioning = Permissioning.find_by_user_id_and_network_id(user.id, current_network.id)\n mixpanel_properties = { \n 'Network' => current_network.name.capitalize,\n 'Subdomain' => current_network.subdomain,\n 'Role' => permissioning.role.title.capitalize\n }\n MixpanelTrackerWorker.perform_async user.id, 'Friend Requests', mixpanel_properties\n rescue\n puts \"\\e[1;31m[ERROR]\\e[0m error sending data to mixpanel\"\n end\n\n end",
"def battlepoint_params\n params.require(:battlepoint).permit(:battle_id, :hashtag, :count)\n end",
"def create\n @friends = params[:friends] || []\n @hack = Hack.new(params[:hack])\n @hack.sort_rand = Random.rand\n @hack.event_id = @event.id\n\n if !@hack.save\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n return\n end\n\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = @current_user\n assoc.confirmed = true\n assoc.save!\n @friends.each do |friend_id|\n friend = User.get_or_create_by_fbid(friend_id, @api);\n assoc = HackMembersAssoc.new\n assoc.hack = @hack\n assoc.user = friend\n assoc.confirmed = true\n assoc.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @event, :notices => ['Hack was successfully created.'] }\n format.json { render :json => @hack, :status => :created, :location => [@event, @hack] }\n end\n end",
"def add_winner_badges\n\t\trespond_to do |format|\n\t\t\tformat.json{\n\t\t\t\tscrimage = Scrimage.find(params[:scrimage_id])\n\n\t\t\t\tmaxVotes = scrimage.photos.maximum(\"votes\")\n\n\t\t\t\twinningPhotoIDs = scrimage.photos.where(\"votes = ?\", maxVotes)\n\n\t\t\t\tscrimage.winner_id = winningPhotoIDs.first.id\n\t\t\t\t\n\t\t\t\tscrimage.save()\n\n\t\t\t\twinningPhotoIDs.each do |photoID|\n\t\t\t\t\tphoto = Photo.find(photoID)\n\t\t\t\t\tnotification = Notification.new(:user_id => photo.user_id, :message => \"100 Points Awarded - You won the scrimage with your photo, \"+photo.description+\"!\")\n\n\t\t\t\t\t#Ensures that all winners receive points for their winning photos\n\t\t\t\t\tuser = User.find(photo.user_id)\n\t\t\t\t\tuser.update(points: user.points + 100)\n\n\t\t\t\t\tnotification.save()\n\t\t\t\tend\n\n\t\t\t\t#render :json => {:winningPhotoID => winningPhotoIDs} \n\t\t\t\trender :json => {:html => render_to_string({:partial => \"scrimages/displayChildPhotos\", :formats => [:html, :js], :locals => {:scrimage => scrimage, :layout => false}})}\n \t\t\t}\t\t\t\n \t\tend\n\tend",
"def buddy_params\n params.require(:buddy).permit(:first_name, :last_name, :email, :phone, :twitter, :user_id)\n end",
"def create\n @bowling = Bowling.new(bowling_params)\n\n respond_to do |format|\n if @bowling.save\n format.html { redirect_to @bowling, notice: 'Bowling was successfully created.' }\n format.json { render :show, status: :created, location: @bowling }\n else\n format.html { render :new }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @fights = Fight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n end\n end",
"def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @fight = Fight.new(params[:fight])\n\n respond_to do |format|\n if @fight.save\n format.html { redirect_to @fight, notice: 'Fight was successfully created.' }\n format.json { render json: @fight, status: :created, location: @fight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fight = Fight.new(params[:fight])\n\n respond_to do |format|\n if @fight.save\n format.html { redirect_to @fight, notice: 'Fight was successfully created.' }\n format.json { render json: @fight, status: :created, location: @fight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, :notice => 'Badge was successfully created.' }\n format.json { render :json => @badge, :status => :created, :location => @badge }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_weight = TestWeight.new(params[:test_weight])\n\n respond_to do |format|\n if @test_weight.save\n format.html { redirect_to @test_weight, notice: 'Test weight was successfully created.' }\n format.json { render json: @test_weight, status: :created, location: @test_weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bowler = Bowler.new(bowler_params)\n @bowler.save\n respond_with(@bowler)\n end",
"def create\n @goal_reward = GoalReward.new(params[:goal_reward])\n\n respond_to do |format|\n if @goal_reward.save\n format.html { redirect_to [@goal_reward.user, GoalReward], notice: 'Goal reward was successfully created.' }\n format.json { render json: @goal_reward, status: :created, location: @goal_reward }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goal_reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scheduled_fights_scraper\n BoxingSchedules::Scraper.scrape_scheduled_fights\n end",
"def create\n @wfeat = Wfeat.new(wfeat_params)\n\n respond_to do |format|\n if @wfeat.save\n format.html { redirect_to @wfeat, notice: 'Wfeat was successfully created.' }\n format.json { render :show, status: :created, location: @wfeat }\n else\n format.html { render :new }\n format.json { render json: @wfeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @twenty = Twenty.new(twenty_params)\n\n respond_to do |format|\n if @twenty.save\n format.html { redirect_to @twenty, notice: 'Twenty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twenty }\n else\n format.html { render action: 'new' }\n format.json { render json: @twenty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @buddyfight.destroy\n respond_to do |format|\n format.html { redirect_to buddyfights_url, notice: 'Buddyfight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @neighbourhood = Neighbourhood.new(neighbourhood_params)\n\n respond_to do |format|\n if @neighbourhood.save\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def create\n @fighter = Fighter.new(fighter_params)\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tombstone_timehold = TombstoneTimehold.new(tombstone_timehold_params)\n\n respond_to do |format|\n if @tombstone_timehold.save\n format.html { redirect_to @tombstone_timehold, notice: 'Tombstone timehold was successfully created.' }\n format.json { render :show, status: :created, location: @tombstone_timehold }\n else\n format.html { render :new }\n format.json { render json: @tombstone_timehold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board_post_upvote = BoardPostUpvote.new(board_post_upvote_params)\n\n respond_to do |format|\n if @board_post_upvote.save\n format.html { redirect_to @board_post_upvote.board_post, notice: 'Board post upvote was successfully created.' }\n format.json { render :show, status: :created, location: @board_post_upvote }\n else\n format.html { render :new }\n format.json { render json: @board_post_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bot_bingo_number = BotBingoNumber.new(bot_bingo_number_params)\n\n respond_to do |format|\n if @bot_bingo_number.save\n format.html { redirect_to @bot_bingo_number, notice: 'Bot bingo number was successfully created.' }\n format.json { render json: @bot_bingo_number, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @bot_bingo_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bow = Bow.new(bow_params)\n\n respond_to do |format|\n if @bow.save\n format.html { redirect_to @bow, notice: 'Bow was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bow }\n else\n format.html { render action: 'new' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Friendship.request(@user, @friend)\n @friend = Friendship.find_by_user_id_and_friend_id(@user, @friend)\n render :json => { :success => true, :new_friend => @friend }\n end",
"def create\n @bunch = Bunch.new(bunch_params)\n\n respond_to do |format|\n if @bunch.save\n format.html { redirect_to @bunch, notice: 'Bunch was successfully created.' }\n format.json { render :show, status: :created, location: @bunch }\n else\n format.html { render :new }\n format.json { render json: @bunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = @harbour.boats.build(boat_params)\n @boat.save\n redirect_to harbour_boats_path(@harbour)\n # respond_to do |format|\n # if @boat.save\n # format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n # else\n # format.html { render :new }\n # format.json { render json: @boat.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @friendship = Friendship.new(params[:friendship])\n current_user.un_black_ball(@friendship.proposee)\n @user = @friendship.proposee\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to @friendship, notice: \"Your Friend Request was sent\" }\n format.json { render json: @friendship, status: :created, location: @friendship }\n format.js {}\n else\n format.html { render action: \"new\" }\n format.js {}\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_bonuses\n return if @invitation.present?\n return unless @client.currency&.casecmp?('rub')\n\n request_path = '/api/internal/v1/payments.json'\n request_params = {\n payment: {\n puid: @client.id,\n source: 'new_registration',\n client_id: @client.id,\n amount: REDEEMING_AMOUNT,\n currency: @client.currency,\n },\n }\n\n if Rails.env == 'development'\n puts '================================'\n puts 'Services::Users::Registration#add_bonuses'\n puts request_path\n puts JSON.pretty_generate(request_params)\n puts '================================'\n return\n end\n\n service = Diplomat::Service.get('accounting')\n url = \"http://#{service.Address}:#{service.ServicePort}/\"\n\n conn = Faraday.new(url: url) do |faraday|\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n\n res = conn.post(request_path) do |req|\n req.body = request_params.to_json\n end\n end",
"def add datapoints, opts={}\n datapoints = [*datapoints]\n\n datapoints.each do |dp|\n # we grab these datapoints for ourselves\n dp.goal = self\n \n data = {\n \"sendmail\" => opts[:sendmail] || false\n }.merge(dp.to_hash)\n\n # TODO create_all doesn't work because Ruby's POST encoding of arrays is broken.\n @user.post \"users/me/goals/#{@slug}/datapoints.json\", data\n end\n end",
"def index\n #Moving this to the application controller because this isn't called by a partial rendering.\n #@zombie_sightings = ZombieSighting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @zombie_sightings }\n end\n end",
"def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end",
"def create\n @whitelist_follower = WhitelistFollower.new(whitelist_follower_params)\n\n respond_to do |format|\n if @whitelist_follower.save\n format.html { redirect_to @whitelist_follower, notice: 'Whitelist follower was successfully created.' }\n format.json { render :show, status: :created, location: @whitelist_follower }\n else\n format.html { render :new }\n format.json { render json: @whitelist_follower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weight = Weight.new(weight_params)\n @tournament = Tournament.find(weight_params[:tournament_id])\n respond_to do |format|\n if @weight.save\n format.html { redirect_to @tournament, notice: 'Weight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @weight }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reward = current_business.rewards.build(reward_params)\n\n respond_to do |format|\n if @reward.save\n format.html { redirect_to @reward, notice: 'Reward was successfully created.' }\n format.json { render :show, status: :created, location: @reward }\n else\n format.html { render :new }\n format.json { render json: @reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t@bet = Bet.find(params[:bet_id])\n @winner = @bet.build_winner(winner_params)\n\n respond_to do |format|\n if @winner.save\n @bet.participations.each do |participation|\n if participation.choice == @winner.choice\n user = participation.user\n winnings = ParticipationsController.winnings(participation) + participation.amount\n user.balance += winnings\n user.save\n \t\t MailConfirmationMailer.close_bet_email(participation,@bet,@winner).deliver_later\n end\n end\n format.html { redirect_to @bet, notice: 'Winning choice was successfully selected.' }\n format.json { render :show, status: :created, location: @winner }\n else\n format.html { render :new, status: 422 }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meetup = Meetup.new(meetup_params)\n @meetup.on_ranking = true\n authorize @meetup\n respond_to do |format|\n if @meetup.save\n @meetup.sessions.create(location_id: Location.where(active: true).first.id)\n @activity = @meetup.create_activity(current_user.id)\n @notifications = @activity.create_notification\n @meetup.holdings.create(user_id: current_user.id)\n notify_collaborators\n format.html { redirect_to meetup_path(@meetup) }\n format.json do\n render :show,\n status: :created, location: @meetup\n end\n else\n format.html { render :new }\n format.json do\n render json: @meetup.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n # @bonu = Bonus.new(bonus_params)\n #\n # if @bonus.save\n # render :show, status: :created, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end",
"def create\n @witch = Witch.new(params[:witch])\n\n respond_to do |format|\n if @witch.save\n format.html { redirect_to @witch, notice: 'Witch was successfully created.' }\n format.json { render json: @witch, status: :created, location: @witch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @witch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gateway_balance opts={}\n params = {\n account: opts.delete(:account) || client_account,\n strict: true, \n hotwallet: [],\n ledger_index: 'validated'\n }.merge!(opts)\n post(:gateway_balance, params)\n end",
"def create\n @weight = current_user.weights.new(params[:weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to weight_path(@weight), notice: 'Weight was successfully created.' }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end",
"def state_beers\n render json: BreweryDb::ShowBeers.new('state', params[:state]).results\n end"
] | [
"0.6472698",
"0.59794897",
"0.5909013",
"0.5754998",
"0.56470066",
"0.5450042",
"0.54413",
"0.539094",
"0.5339248",
"0.5324998",
"0.5297267",
"0.52962697",
"0.5288078",
"0.5266932",
"0.524439",
"0.522984",
"0.5226278",
"0.5203779",
"0.5200533",
"0.5156734",
"0.51198804",
"0.5114009",
"0.51027477",
"0.50985014",
"0.5089782",
"0.50852746",
"0.50677603",
"0.5061235",
"0.5053376",
"0.5042213",
"0.50343883",
"0.5030638",
"0.5022005",
"0.50194",
"0.50066614",
"0.50038356",
"0.50021",
"0.50012547",
"0.49980584",
"0.4996726",
"0.49943128",
"0.4989199",
"0.49886107",
"0.4982996",
"0.49771324",
"0.49730882",
"0.4958419",
"0.49532312",
"0.49479848",
"0.4944789",
"0.49425668",
"0.494055",
"0.4930006",
"0.49269196",
"0.49176416",
"0.49109828",
"0.49042055",
"0.49032044",
"0.48978487",
"0.48935202",
"0.4891473",
"0.48914602",
"0.4886512",
"0.4886512",
"0.4885577",
"0.48771396",
"0.4877118",
"0.48742718",
"0.4860959",
"0.48546857",
"0.48497298",
"0.4847875",
"0.48477668",
"0.4846443",
"0.48460758",
"0.48435962",
"0.4841462",
"0.48410633",
"0.483578",
"0.48338506",
"0.48330545",
"0.48318166",
"0.48284492",
"0.48268867",
"0.4814944",
"0.48115665",
"0.48115134",
"0.48085037",
"0.48072124",
"0.4805572",
"0.48033425",
"0.4799749",
"0.4798642",
"0.47970513",
"0.47961664",
"0.479148",
"0.47912338",
"0.47878867",
"0.4786261",
"0.4783728"
] | 0.6356847 | 1 |
PATCH/PUT /buddyfights/1 PATCH/PUT /buddyfights/1.json | def update
respond_to do |format|
if @buddyfight.update(buddyfight_params)
format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully updated.' }
format.json { render :show, status: :ok, location: @buddyfight }
else
format.html { render :edit }
format.json { render json: @buddyfight.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @buddy.update(buddy_params)\n format.html { redirect_to @buddy, notice: \"Buddy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buddy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @buddy = Buddy.find(params[:id])\n\n respond_to do |format|\n if @buddy.update_attributes(params[:buddy])\n flash[:notice] = 'Buddy was successfully updated.'\n format.html { redirect_to(@buddy) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @buddy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @expense_buddy.update(expense_buddy_params)\n format.html { redirect_to @expense_buddy, notice: 'Expense buddy was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_buddy }\n else\n format.html { render :edit }\n format.json { render json: @expense_buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @waiter = Waiter.find(params[:id])\n\n respond_to do |format|\n if @waiter.update_attributes(params[:waiter])\n format.html { redirect_to @waiter, notice: 'Waiter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bunch.update(bunch_params)\n format.html { redirect_to @bunch, notice: 'Bunch was successfully updated.' }\n format.json { render :show, status: :ok, location: @bunch }\n else\n format.html { render :edit }\n format.json { render json: @bunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def update\n respond_to do |format|\n if @settlebuddy_support.update(settlebuddy_support_params)\n format.html { redirect_to \"/users/edit\", notice: 'Settlebuddy settings were successfully updated.' }\n format.json { render :show, status: :ok, location: @settlebuddy_support }\n else\n format.html { render :edit }\n format.json { render json: @settlebuddy_support.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @witness = Witness.find(params[:id])\n\n respond_to do |format|\n if @witness.update_attributes(params[:witness])\n # commented so hosts font receive emails off season\n # if(params[:witness][:host_id].present?)\n # HostMailer.witness_assigned(\n # params[:witness][:host_id],\n # @witness.id,\n # I18n.locale\n # ).deliver\n\n #@host = Host.find(params[:witness][:host_id])\n #@host.update_attributes(assignment_time: Time.now.utc.localtime)\n #end\n\n\n \n format.json { render json: @witness, status: :created, location: @witness }\n else\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bowler.update(bowler_params)\n\n @bowler.record :update, current_user, selected_tournament\n \n format.html { redirect_to @bowler, notice: \"Bowler [#{@bowler.full_name}] was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n if @witch.update_attributes(params[:witch])\n format.html { redirect_to @witch, notice: 'Witch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @witch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @super_bowl_pick = SuperBowlPick.find(params[:id])\n\n respond_to do |format|\n if @super_bowl_pick.update_attributes(params[:super_bowl_pick])\n format.html { redirect_to @super_bowl_pick, notice: 'Super bowl pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_bowl_pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @friendship = Friendship.find(params[:id])\n\n if (params[:ignore])\n @friendship.ignore = params[:ignore] == \"true\"\n end\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { render @friendship }\n format.json { render json: { success: true } }\n else\n format.html { render action: \"index\" }\n format.json { render json: @friendship.errors, \n status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(data, **opts)\n @id = data[\"id\"]\n @username = data[\"username\"]\n @resource_state = data[\"resource_state\"]\n @firstname = data[\"firstname\"]\n @lastname = data[\"lastname\"]\n @city = data[\"city\"]\n @state = data[\"state\"]\n @country = data[\"country\"]\n @sex = data[\"sex\"]\n @premium = data[\"premium\"]\n @created_at = data[\"created_at\"]\n @updated_at = data[\"updated_at\"]\n @badge_type_id = data[\"badge_type_id\"]\n @profile_medium = data[\"profile_medium\"]\n @profile = data[\"profile\"]\n @friend = data[\"friend\"]\n @follower = data[\"follower\"]\n @follower_count = data[\"follower_count\"]\n @friend_count = data[\"friend_count\"]\n @mutual_friend_count = data[\"mutual_friend_count\"]\n @athlete_type = data[\"athlete_type\"]\n @date_preference = data[\"date_preference\"]\n @measurement_preference = data[\"measurement_preference\"]\n @email = data[\"email\"]\n @ftp = data[\"ftp\"]\n @weight = data[\"weight\"]\n @bikes = parse_data(@gear, data['bikes'], klass: Gear, client: @client)\n @shoes = parse_data(@gear, data['shoes'], klass: Gear, client: @client)\n\n parse_data(@clubs, data['clubs'], klass: Club, client: @client)\n\n self\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bitch.update(bitch_params)\n format.html { redirect_to @bitch, notice: 'Bitch was successfully updated.' }\n format.json { render :show, status: :ok, location: @bitch }\n else\n format.html { render :edit }\n format.json { render json: @bitch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: UserBoards.update(params[\"id\"], params[\"user_board\"])\n end",
"def patch\n end",
"def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: _(\"Boat was successfully updated\") }\n format.js\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.js\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n if @goat.update_attributes(params[:goat])\n format.html { redirect_to @goat, notice: 'Goat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zombie = Zombie.find(params[:id])\n\n respond_to do |format|\n if @zombie.update_attributes(params[:zombie])\n format.html { redirect_to @zombie, notice: 'Zombie was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zombie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_following = Api::V1::Following.find(params[:id])\n\n # if @api_v1_following.update(api_v1_following_params)\n # head :no_content\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end",
"def update_my_hobbies\n\t \tif @user.update_attributes(my_hobby: params[:my_hobby])\n\t \t# response to the JSON\n\t\t\trender json: { success: true,message: \"My hobby Successfully Updated.\", response: {my_hobby: @user.my_hobby} },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend",
"def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to(@monkey, :notice => 'Monkey was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @monkey.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n if @banana.update_attributes(params[:banana])\n format.html { redirect_to @banana, :notice => 'Banana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n get_my_badge\n respond_to do |format|\n if @my_badge.update_attributes(params[:my_badge])\n flash[:notice] = 'Your badge was successfully updated.'\n format.html { redirect_to user_my_badge_url(@my_badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @my_badge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n if @zombie_sighting.update_attributes(params[:zombie_sighting])\n format.html { redirect_to @zombie_sighting, notice: 'Zombie sighting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @twizzle.update(twizzle_params)\n format.html { redirect_to @twizzle, notice: 'Twizzle was successfully updated.' }\n format.json { render :show, status: :ok, location: @twizzle }\n else\n format.html { render :edit }\n format.json { render json: @twizzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(boat_params)\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n if @brewhouse.update_attributes(params[:brewhouse])\n format.html { redirect_to @brewhouse, notice: 'Brewhouse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brewhouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pending_friend_request.update(pending_friend_request_params)\n format.html { redirect_to @pending_friend_request, notice: 'Pending friend request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pending_friend_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @kind_of_boat.update(kind_of_boat_params)\n format.html { redirect_to @kind_of_boat, notice: 'Kind of boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @kind_of_boat }\n else\n format.html { render :edit }\n format.json { render json: @kind_of_boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @freight_bill.update(freight_bill_params)\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @freight_bill }\n else\n format.html { render :edit }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @believer = Believer.find(params[:id])\n\n respond_to do |format|\n if @believer.update_attributes(params[:believer])\n format.html { redirect_to @believer, notice: 'Believer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @believer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @badge }\n else\n format.html { render :edit }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n thing_name = params[:id]\n is_on = params[:on].to_i\n client = Broker::Wrapper.new(current_user, thing_name)\n result = client.set_state(is_on)\n\n result_hash = result.as_json\n render json: result_hash, status: 200\n end",
"def update\n respond_to do |format|\n if @great.update(great_params)\n format.html { redirect_to @great, notice: 'Great was successfully updated.' }\n format.json { render :show, status: :ok, location: @great }\n else\n format.html { render :edit }\n format.json { render json: @great.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end",
"def update\n respond_to do |format|\n if @bot_bingo_number.update(bot_bingo_number_params)\n format.html { redirect_to @bot_bingo_number, notice: 'Bot bingo number was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bot_bingo_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n respond_to do |format|\n if @bowling.update(bowling_params)\n format.html { redirect_to @bowling, notice: 'Bowling was successfully updated.' }\n format.json { render :show, status: :ok, location: @bowling }\n else\n format.html { render :edit }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bourbon.update(bourbon_params)\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n if @hacker.update_attributes(params[:hacker])\n format.html { redirect_to @hacker, notice: 'Hacker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mueble.update(mueble_params)\n format.html { redirect_to @mueble, notice: 'Mueble was successfully updated.' }\n format.json { render :show, status: :ok, location: @mueble }\n else\n format.html { render :edit }\n format.json { render json: @mueble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end",
"def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end",
"def update\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n if @beat.update_attributes(params[:beat])\n format.html { redirect_to @beat, notice: 'Beat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n begin\n balloon = Balloon.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n balloon = nil\n end\n \n if balloon != nil && balloon.update_attributes(balloon_params) \n render json: {status: 'SUCCESS', message:'Updated balloon', data:balloon},status: :ok\n else\n render json: {status: 'ERROR', message:'Balloon not updated', data:\"balloon.error - balloon id doesnt exist\"},status: :unprocessable_entity\n end\n end",
"def update\n wall = Wall.find_by(path: params[:path])\n\n respond_to do |format|\n if wall.update_attributes wall_attrs\n flash[:notice] = 'Update Successful'\n format.html { redirect_to wall_path wall }\n format.json { render json: { success: status, state: 'Saved' }, status: 200 }\n else\n flash[:notice] = 'Update Failed'\n format.html { redirect_to wall_path wall }\n format.json { render json: { success: status }, status: 406 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booth.update(booth_params)\n format.html { redirect_to event_booth_path(@booth), notice: 'Booth was successfully updated.' }\n format.json { render :show, status: :ok, location: @booth }\n else\n format.html { render :edit }\n format.json { render json: @booth.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68470675",
"0.6527308",
"0.6415726",
"0.6158539",
"0.60426503",
"0.5983439",
"0.5982167",
"0.59356016",
"0.5917969",
"0.59163165",
"0.59081644",
"0.59080803",
"0.58849",
"0.5881259",
"0.5870572",
"0.5870572",
"0.5870572",
"0.5869069",
"0.5864077",
"0.5863633",
"0.5853311",
"0.5848109",
"0.5835514",
"0.5784742",
"0.5783699",
"0.57830095",
"0.57730985",
"0.5765358",
"0.5744458",
"0.57413274",
"0.57194865",
"0.5712434",
"0.57060254",
"0.5704542",
"0.56997097",
"0.56995195",
"0.5689882",
"0.5689429",
"0.56874704",
"0.56857383",
"0.568434",
"0.5682773",
"0.567857",
"0.5678003",
"0.56724143",
"0.5672397",
"0.5670833",
"0.5668826",
"0.5668755",
"0.56685",
"0.5663718",
"0.5662836",
"0.5660721",
"0.5657632",
"0.56543887",
"0.5652474",
"0.5649096",
"0.5647989",
"0.56460917",
"0.5644283",
"0.563371",
"0.5630851",
"0.56299466",
"0.56292593",
"0.56275666",
"0.56275636",
"0.5624249",
"0.56191033",
"0.56188047",
"0.56163734",
"0.5606959",
"0.5603808",
"0.5597748",
"0.5594591",
"0.5580373",
"0.5576832",
"0.5572425",
"0.5569709",
"0.5569709",
"0.5569709",
"0.5568395",
"0.55624324",
"0.55623484",
"0.55587655",
"0.555733",
"0.555696",
"0.5556725",
"0.55471927",
"0.55464387",
"0.55421275",
"0.55412036",
"0.55410075",
"0.55342495",
"0.55339",
"0.55333203",
"0.55298066",
"0.5527961",
"0.5525429",
"0.5525265",
"0.5523557"
] | 0.6139885 | 4 |
DELETE /buddyfights/1 DELETE /buddyfights/1.json | def destroy
@buddyfight.destroy
respond_to do |format|
format.html { redirect_to buddyfights_url, notice: 'Buddyfight was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @buddy.destroy\n respond_to do |format|\n format.html { redirect_to buddies_url, notice: \"Buddy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @buddy = Buddy.find(params[:id])\n @buddy.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_path(session[:user_id]))} if session[:user_id]\n format.html { redirect_to(buddies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @expense_buddy.destroy\n respond_to do |format|\n format.html { redirect_to expense_buddies_url, notice: 'Expense buddy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @twentyeight.destroy\n respond_to do |format|\n format.html { redirect_to twentyeights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heart_beat.destroy\n respond_to do |format|\n format.html { redirect_to heart_beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zombie = Zombie.find(params[:id])\n @zombie.destroy\n\n respond_to do |format|\n format.html { redirect_to zombies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to monkeys_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n name = @bowler.full_name\n @bowler.record :destroy, current_user, selected_tournament\n @bowler.destroy\n respond_to do |format|\n format.html { redirect_to bowlers_url, notice: \"Bowler #{name} has been successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beat = Beat.find(params[:id])\n @beat.destroy\n\n respond_to do |format|\n format.html { redirect_to beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\n format.json {head :no_content}\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @great.destroy\n respond_to do |format|\n format.html { redirect_to greats_url, notice: 'Great was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @breach.destroy\n respond_to do |format|\n format.html { redirect_to breaches_url, notice: 'Breach was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to(admin_badges_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted badge: #{@badge.name}\")\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @battalion = Battalion.find(params[:id])\n @battalion.destroy\n\n respond_to do |format|\n format.html { redirect_to(battalions_url) }\n format.xml { head :ok }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @click_thru = ClickThru.find(params[:id])\n @click_thru.destroy\n\n respond_to do |format|\n format.html { redirect_to click_thrus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bones_segment.destroy\n respond_to do |format|\n format.html { redirect_to bones_segments_url, notice: 'Bones segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.info(\"Delete friend_id 33333\")\n logger.info(\"Delete friend_id #{params[:user_id]}\")\n @friendship.destroy\n if request.format.json?\n render text: \"Delete\"\n else\n @friendship.destroy\n redirect_to friendships_url \n end \n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @boat.destroy\n\n head :no_content\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @twenty.destroy\n respond_to do |format|\n format.html { redirect_to twenties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grumble.destroy\n respond_to do |format|\n format.html { redirect_to grumbles_url, notice: 'Grumble was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @goal = Mg::Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to mg_goals_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banned.destroy\n respond_to do |format|\n format.html { redirect_to banneds_url, notice: 'Banned was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to badges_url, notice: 'Badge was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts 'callin'\n friendship = Friendship.find(params[:id])\n user = friendship.user\n friend = friendship.friend\n reciprocal_friendship = Friendship.find_by(user: friend, friend: user)\n friendship.destroy\n reciprocal_friendship.destroy\n respond_to do |format|\n # format.html do\n # { redirect_back(fallback_location: root_path, notice: \"Friendship with #{friend.name} ended.\") }\n format.json do\n render json: {\n status: 'deleted',\n notice: \"Friendship with #{friend.name} ended.\"\n }\n end\n end\n end",
"def destroy\n @twentyfour.destroy\n respond_to do |format|\n format.html { redirect_to twentyfours_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @v_goal = VGoal.find(params[:id])\n @v_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to v_goals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tournament = Tournament.find(@weight.tournament_id)\n @weight.destroy\n respond_to do |format|\n format.html { redirect_to @tournament }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_badge = User::MyBadge.find(params[:id])\n @my_badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_my_badges_url) }\n format.xml { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: _(\"Boat was successfully destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit.destroy\n respond_to do |format|\n format.html { redirect_to visits_url, notice: 'Visita eliminada con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hold.destroy\n respond_to do |format|\n format.html { redirect_to member_furloughs_url(@member), notice: 'Hold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end",
"def destroy\n @fight = Fight.find(params[:id])\n @fight.destroy\n\n respond_to do |format|\n format.html { redirect_to fights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fight = Fight.find(params[:id])\n @fight.destroy\n\n respond_to do |format|\n format.html { redirect_to fights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @neighbour.destroy\n respond_to do |format|\n format.html { redirect_to neighbours_url, notice: 'Neighbour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tombstone_timehold.destroy\n respond_to do |format|\n format.html { redirect_to tombstone_timeholds_url, notice: 'Tombstone timehold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit_stat = VisitStat.find(params[:id])\n @visit_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_visit_stats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @grab.destroy\n respond_to do |format|\n format.html { redirect_to grabs_url, notice: 'Grab was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bot = Bot.find(params[:id])\n @bot.destroy\n\n respond_to do |format|\n format.html { redirect_to bots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to(boats_url) }\n format.xml { head :ok }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @honey_badger.destroy\n respond_to do |format|\n format.html { redirect_to honey_badgers_url, notice: 'Honey badger was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.70315355",
"0.6775857",
"0.67417806",
"0.67115635",
"0.6507376",
"0.64911884",
"0.64599603",
"0.64336133",
"0.6394245",
"0.63872856",
"0.63478756",
"0.63468444",
"0.6346075",
"0.6331447",
"0.63210344",
"0.63184744",
"0.6318289",
"0.6315614",
"0.62983215",
"0.628507",
"0.62795997",
"0.62782145",
"0.62635815",
"0.6253211",
"0.62461054",
"0.6241329",
"0.6222786",
"0.62189364",
"0.6217048",
"0.6217048",
"0.6217048",
"0.6217048",
"0.621273",
"0.62111205",
"0.62024915",
"0.6200784",
"0.61978006",
"0.61978006",
"0.6197141",
"0.6192254",
"0.61914563",
"0.61867046",
"0.6177137",
"0.6173394",
"0.61704725",
"0.61675787",
"0.61631185",
"0.61611825",
"0.6160721",
"0.6159826",
"0.6157229",
"0.61274844",
"0.612688",
"0.6126587",
"0.6126096",
"0.61236995",
"0.6118689",
"0.6115348",
"0.61147076",
"0.61104643",
"0.61104643",
"0.61104643",
"0.6108085",
"0.61080474",
"0.61063933",
"0.61041576",
"0.6102234",
"0.6100731",
"0.6099438",
"0.6098965",
"0.6098214",
"0.6095909",
"0.6092304",
"0.6087815",
"0.6083345",
"0.6079043",
"0.6079043",
"0.60789067",
"0.6078619",
"0.6077222",
"0.607245",
"0.60698116",
"0.6065433",
"0.6065359",
"0.6065359",
"0.606448",
"0.60623485",
"0.6057232",
"0.6054966",
"0.60548913",
"0.6053761",
"0.6053621",
"0.6053621",
"0.6053265",
"0.6051857",
"0.6049194",
"0.6048818",
"0.60483015",
"0.6045724",
"0.6045666"
] | 0.7034131 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_buddyfight
@buddyfight = Buddyfight.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_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def 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 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 action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n 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 startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def 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 action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); 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 before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); 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 setup_signals; 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 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 after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; 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 save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \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 setup(&blk)\n @setup_block = blk\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 callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\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 duas1(action)\n action.call\n action.call\nend"
] | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def buddyfight_params
params.fetch(:buddyfight, {})
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 |
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Get a specific selected actor or current actor i : index of the selected actor GET | def selected_actor(i=nil)
actor = nil
if i == nil
actor = @data[self.index]
else
actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])
end
return actor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_actor\n return nil unless actor_selected?\n get_actor @active_index\n end",
"def get_actor(index)\n @data[index]\n end",
"def selected_reserve_actor(i=nil)\n actor = nil\n if i == nil\n actor = @data[self.index]\n else\n actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])\n end\n return actor\n end",
"def act\n return @actor\n end",
"def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end",
"def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end",
"def index(actor_id)\n result = nil\n if @actors.include?(actor_id)\n result = @actor_positions[@actors.index(actor_id)]\n end\n return result\n end",
"def main_variable\r\n super\r\n # Get actor\r\n @actor = $game_party.actors[@actor_index]\r\n end",
"def main_variable\r\n super\r\n # Get actor\r\n @actor = $game_party.actors[@actor_index]\r\n end",
"def main_variable\r\n super\r\n # Get actor\r\n @actor = $game_party.actors[@actor_index]\r\n end",
"def iterate_actor_index(param)\n if param == -1 # All\n for actor in $game_party.members do yield actor end\n else # One\n actor = $game_party.members[param]\n yield actor unless actor == nil\n end\n end",
"def show\n @actor=Actor.find(params[:id])\n end",
"def iterate_actor_index(param)\r\n if param < 0\r\n $game_party.members.each {|actor| yield actor }\r\n else\r\n actor = $game_party.members[param]\r\n yield actor if actor\r\n end\r\n end",
"def index\r\n return $game_party.actors.index(self)\r\n end",
"def getActor(actorIdentifier, context)\r\n if actorIdentifier.is_a?(Game_Actor)\r\n return actorIdentifier\r\n elsif actorIdentifier.is_a?(Integer)\r\n return context[actorIdentifier]\r\n elsif actorIdentifier.is_a?(String)\r\n return context.find{|actor| actor.name == actorIdentifier}\r\n else\r\n return nil\r\n end\r\n end",
"def current_actor\n begin\n if (class_name=session[:useritem_type]).present? and (id=session[:useritem_id]).present?\n @actor = eval(class_name).find(id)\n else\n @actor = current_user\n end\n rescue =>exp\n logger.error \"Error in CurrentActor :=> #{exp.message}\"\n end\n end",
"def actors\n actor\n end",
"def id\r\n return @actor_id\r\n end",
"def next_actor\n @actor\n end",
"def current_actor\n current_user.actor\n end",
"def get_actor_info actor\n return get_user_info actor.user unless actor.user.nil?\n\n get_one_of actor\nend",
"def main_variable\r\n super\r\n # Get actor\r\n @actor = $game_actors[$game_temp.name_actor_id]\r\n end",
"def on_actor_selection\n if any_actor_selected?\n exchange_members\n else\n active_window.select_actor\n end\n end",
"def item_target_actors\n [$game_party.members[0]]\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def actors\n Actor.where(:movie_id => id)\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def item_target_actors\r\n if !item.for_friend?\r\n []\r\n elsif item.for_all?\r\n $game_party.members\r\n else\r\n [$game_party.members[@actor_window.index]]\r\n end\r\n end",
"def contact_to(actor)\n sent_contacts.received_by(actor.id).first\n end",
"def select_last\n select($game_party.target_actor.index || 0)\n end",
"def prev_actor\n @actor\n end",
"def actors \n self.characters.collect{ |character| character.actor}\n end",
"def iterate_actor_id(param)\r\n if param == 0\r\n $game_party.members.each {|actor| yield actor }\r\n else\r\n actor = $game_actors[param]\r\n yield actor if actor\r\n end\r\n end",
"def getActorDeets(actor)\n sleep(5)\n actor = Tmdb::Person.detail(actor[\"id\"])\n if !actor[\"status_code\"]\n actor\n end\nend",
"def iterate_actor_id(param)\n if param == 0 # All\n for actor in $game_party.members do yield actor end\n else # One\n actor = $game_actors[param]\n yield actor unless actor == nil\n end\n end",
"def name\n @actor and @actor.name\n end",
"def index\n @actors = Actor.all\n end",
"def actors\n self.roles.map do |role|\n role.actor\n end\n end",
"def select_last\n select($game_party.menu_actor.index || 0)\n end",
"def actor_id_from_cmd\n @command_window.actors[@command_window.index]\n end",
"def select_last\r\n select($game_party.menu_actor.index || 0)\r\n end",
"def actors\n self.characters.collect{ |character| character.actor }\n end",
"def next_actor_command()\n @actor_index += 1\n @actor_index %= $game_party.members.size\n $scene = Scene_Status.new(@actor_index)\n end",
"def iterate_actor(parameter)\r\n if parameter == 0\r\n $game_party.actors.each { |actor| yield actor }\r\n else\r\n actor = $game_actors[parameter]\r\n yield actor if actor\r\n end\r\n end",
"def index\n $game_party.positions.index(@actor_id)\n end",
"def next_actor\n @actor_index += 1\n @actor_index %= $game_party.members.size\n $scene = Scene_Status.new(@actor_index)\n end",
"def select_for_item(item)\n @cursor_fix = item.for_user?\n @cursor_all = item.for_all?\n if @cursor_fix\n select($game_party.menu_actor.index)\n elsif @cursor_all\n select(0)\n else\n select_last\n end\n end",
"def actor\nactor = {:name => \"Dwayne The Rock Johnson\"}\nend",
"def prev_actor_command()\n @actor_index += $game_party.members.size - 1\n @actor_index %= $game_party.members.size\n $scene = Scene_Status.new(@actor_index)\n end",
"def fiber_obj\n $game_temp.actors_fiber[id]\n end",
"def actor\n #actor_name = 'Jack Nicholson'\n # @actor_name = params[:actor_name] # in order to be available in the view\n results = search_query([:actorName], %[\n ?movies movie:actor ?a .\n ?a rdf:type movie:actor .\n ?a movie:actor_name ?actorName .\n FILTER regex(?actorName, '^.*#{query_param(true)}', 'i')\n ])\n @groups = results.group_by(&:actorName) unless results.empty?\n render 'results', locals: {title: \"Movies with one of the actor name containing '#{query_param}'\"}\n end",
"def process_ok\n super\n $game_party.menu_actor = $game_party.members[index]\n end",
"def process_ok\r\n super\r\n $game_party.menu_actor = $game_party.members[index]\r\n end",
"def selected_item\n # @list[@current_index]\n end",
"def get_actors(id)\n # get targets\n return (id ? [$BlizzABS.actors[id]].compact : $BlizzABS.actors.clone)\n end",
"def set_actor_character\n @actor_character = ActorCharacter.find(params[:id])\n @actor = @actor_character.actor\n end",
"def index\n @child_actors = ChildActor.all\n end",
"def show\n @actor = Actor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actor }\n end\n end",
"def actor_inventory(actor)\n actor = actors[actor] if actor.is_a?(Numeric)\n [actor.weapon] + actor.armors\n end",
"def getSelectedItem()\n # ennek mindig az elso oszlop itemjet kell visszaadni\n #midx = @tv.selectionModel.currentIndex\n mi = @treeview.selectionModel.selectedRows.first\n return unless mi\n item = mi.model.itemFromIndex mi\n #puts \"getSelectedItem:\", mi, item\n return item, mi\n end",
"def prev_actor\n @actor_index += $game_party.members.size - 1\n @actor_index %= $game_party.members.size\n $scene = Scene_Status.new(@actor_index)\n end",
"def initialize(actor_index = 0)\n @actor_index = actor_index\n end",
"def actors_list\n # characters.where(show_id: self.id)\n self.characters.map do |character|\n character.actor.full_name\n end\n end",
"def item() $data_enemies[SES::Bestiary.get_enemy_list[@index]] end",
"def actors\n this_movies_performances = Performance.where(\"movie_id\" => self.id)\n\n this_movies_actors_ids = []\n this_movies_performances.each do |performance|\n this_movies_actors_ids << performance.actor_id\n end\n\n Actor.where(\"id\" => this_movies_actors_ids)\n end",
"def set_show_actor\n @show_actor = ShowActor.find(params[:id])\n end",
"def actor\n actor = {name: \"Dwayne The Rock Johnson\"}\nend",
"def menu_actor=(actor)\n @menu_actor_id = actor ? actor.id : 0\n end",
"def [](i)\n get unless loaded\n self.objects.first[1][i] rescue nil\n end",
"def player\n return $BlizzABS.actors[0]\n end",
"def actors\n request = Message::List.new(Thread.mailbox)\n list = send_request request\n list.map!(&:to_sym)\n end",
"def pick_actor\n ACTOR.sample\nend",
"def set_child_actor\n @child_actor = ChildActor.find(params[:id])\n end",
"def action_show( contact, i )\n contact = contact[i-1]\n\n puts\n show( contact )\n puts\nend",
"def actors\n\n # 1) get all film_actors (from the join table)\n # 2) get their actors\n film_actors = FilmActor.where film_id: film_id\n Actor.where actor_id: film_actors.pluck(:actor_id)\n\n # Actor.where actor_id: [3, 22, 38, ...]\n\n # Actor.where film_id:\n end",
"def selected_item\n get_content()[focussed_index()]\n end",
"def actor_search\n if params[:actor].present?\n @results = MovieDataService.get_movies_for_actor(\n actor_name: params[:actor],\n page: params[:page],\n sort_by: params[:sort_by]\n )\n end\n end",
"def add_actor(actor)\n @actors << actor\n return actor\n end",
"def show\n @actor = Actor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actor }\n end\n end",
"def getProjectActorByRole\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view roles for this project\" }, :unauthorized)\n return\n end\n r = @project.roles.find(params[\"role_id\"])\n json_response(Actor.find(r.actor_id))\n end",
"def find_angelina\n #find Angelina Jolie by name in the actors table\n Actor.find_by(name: 'Angelina Jolie')\nend",
"def update_phase3_actor_select\n # Update actor arrow\n @actor_arrow.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End actor selection\n end_actor_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.target_index = @actor_arrow.index\n # End actor selection\n end_actor_select\n # If skill window is showing\n if @skill_window != nil\n # End skill selection\n end_skill_select\n end\n # If item window is showing\n if @item_window != nil\n # End item selection\n end_item_select\n end\n # Go to command input for next actor\n phase3_next_actor\n end\n end",
"def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end",
"def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end",
"def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end",
"def process_ok\n $game_party.menu_actor = $game_party.member_at_position(index)\n super\n end",
"def selected_item\n get_content()[focussed_index()]\n end",
"def show\n if params == [:tweet_id,:id]\n @tweet = Tweet.find(params[:tweet_id])\n end\n if params == [:actor_id,:id]\n @actors = Actor.find(params[:actor_id])\n end\n @actor_tweet = ActorTweet.find(params[:id])\n end",
"def current\n self.players[self.current_turn]\n end",
"def [](name, index = 0)\n __send__(self.class::MEMBERS_GETFN[name], index)\n end",
"def draw_item(index)\n actor_id = $game_party.positions[index]\n return unless actor_id\n actor = $game_actors[actor_id]\n enabled = $game_party.battle_members.include?(actor)\n rect = item_rect(index)\n draw_item_background(index)\n #if actor.back_row?\n # draw_actor_face(actor, rect.x + 20, rect.y + 1, enabled)\n #else\n # draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n #end\n draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)\n end",
"def execute actor, target=[nil]\n def himher thing\n multiple = thing.count > 1 \n\n if multiple \n return \"them\"\n end\n\n case thing[0]\n when Player then \"him\"\n when ItemFacade then \"it\"\n else \"\"\n end\n end\n room_msg, self_msg, vict_msg = @ofound.dup, @found.dup, @tfound.dup\n\n\n if target.include?(actor) # if they're the same person then it's an auto\n target = [actor]\n room_msg = @oauto.dup\n self_msg = @auto.dup\n vict_msg = nil\n elsif target[0] == nil\n room_msg = @onoarg.dup\n self_msg = @noarg.dup\n vict_msg = nil\n end\n room_msg.gsub!(\"$n\", \"<%=other.peek(actor)%>\")\n room_msg.gsub!(\"$N\", \"<%=other.peek(if arg[0].include?(other) then arg[0]-[other]+['You'] else arg[0] end)%>\")\n room_msg.gsub!(\"$m\", himher([actor]))\n room_msg.gsub!(\"$M\", himher(target))\n\n self_msg.gsub!(\"$M\", himher(target))\n self_msg.gsub!(\"$m\", himher([actor]))\n if target\n self_msg.gsub!(\"$N\", actor.peek(target))\n end\n actor.view(\"#G\"+self_msg+\"#n\" + ENDL)\n \n room_msg.untaint\n if target[0]\n if target.count > 1 \n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor], \"#G\"+room_msg+\"#n\", target)\n else\n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor, *target], \"#G\"+room_msg+\"#n\", target)\n target.each do |one_targ|\n vm = vict_msg.dup\n vm.gsub!(\"$n\", one_targ.peek(actor))\n one_targ.view(\"#G\"+vm+ \"#n\" + ENDL)\n end\n end\n else\n puts room_msg\n actor.in_room.display([:visual, \"other.can_see?(actor)\"], actor, [actor], \"#G\"+room_msg+\"#n\", \"\")\n end\n end",
"def inactive_actor\n end",
"def get_name(conn, id)\n conn.exec_params(\"SELECT name FROM actors WHERE id=$1\",\n [id])[0][\"name\"]\nend",
"def get_movie(actor=\"Brad Pitt\")\n movie_count = show_movies(actor).size\n show_movies(actor)[rand(movie_count)]\n end",
"def select_last\n select(@data.index(@actor.current_title) || 0)\n end",
"def actor=(new_actor)\n return if @actor == new_actor\n\n @actor = new_actor\n refresh\n end"
] | [
"0.81715715",
"0.76902163",
"0.71803135",
"0.66437393",
"0.66295344",
"0.66295344",
"0.66063595",
"0.6575213",
"0.6575213",
"0.6575213",
"0.655686",
"0.647524",
"0.6469444",
"0.64618087",
"0.64066714",
"0.635936",
"0.634233",
"0.6334411",
"0.6279572",
"0.6268531",
"0.61687344",
"0.61641186",
"0.6117815",
"0.61035985",
"0.6072688",
"0.6002454",
"0.59997666",
"0.59997666",
"0.59997666",
"0.5990765",
"0.58831555",
"0.58566964",
"0.5828965",
"0.58281064",
"0.582288",
"0.58175933",
"0.5814251",
"0.5798722",
"0.5791058",
"0.57810706",
"0.5760399",
"0.5748717",
"0.57189333",
"0.5668435",
"0.5652151",
"0.5627446",
"0.56225705",
"0.5618228",
"0.561771",
"0.5594621",
"0.5579497",
"0.5577389",
"0.5576094",
"0.55600965",
"0.5543121",
"0.55308986",
"0.55187684",
"0.54983425",
"0.54901856",
"0.54750735",
"0.5466036",
"0.54601383",
"0.545002",
"0.54437387",
"0.5439946",
"0.5438555",
"0.5434812",
"0.5419819",
"0.53932244",
"0.5391879",
"0.5380985",
"0.53806835",
"0.53549445",
"0.5353126",
"0.5343734",
"0.53283",
"0.53151464",
"0.52888894",
"0.52836",
"0.52785796",
"0.52517873",
"0.52468944",
"0.5245954",
"0.52351373",
"0.5222728",
"0.5222728",
"0.5222728",
"0.5213731",
"0.519704",
"0.51857203",
"0.51817197",
"0.51693815",
"0.5159714",
"0.51558816",
"0.5154508",
"0.5150652",
"0.5143292",
"0.513506",
"0.51343024"
] | 0.8488137 | 1 |
////////////////////////////////////////////////////////////////////////// Constructors ////////////////////////////////////////////////////////////////////////// Object Initialization x : window xcoordinate y : window ycoordinate width : window width height : window height members : party members | def initialize(x, y, width, height, members)
super(x, y, width, height, 10, 156 - 32)
@column_max = 4
@ucCharFacesList = []
window_update(members)
self.index = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(window)\n super(window)\n @width = 1\n @height = 1\n rebuild_vertices\n end",
"def initialize(x, y, width, height, party_id, actors=nil)\n super(x, y, width, height, 28, 48)\n @column_max = 2\n @ucPartyActorsList = []\n @party_id = party_id\n window_update(actors)\n self.index = 0\n @cursor_transfer = false\n end",
"def initialize(window, x, y, width, height)\n @@colors ||= {\n green: Gosu::Color.argb(0xff00ff00),\n red: Gosu::Color.argb(0xffff0000),\n grey: Gosu::Color.argb(0xff808080),\n lightcyan: Gosu::Color.argb(0xffe0ffff),\n cyan: Gosu::Color.argb(0xff00ffff),\n white: Gosu::Color.argb(0xffffffff),\n yellow: Gosu::Color.argb(0xffffff00),\n }\n @@window ||= window\n @x = x\n @y = y\n @width = width\n @height = height\n @color = @@colors[:white]\n @neighbors = []\n end",
"def initialize(window, dimensions)\n @window = window\n @dimensions = dimensions\n end",
"def initialize(x,y,w,h)\n \t\t@x,@y,@w,@h=x,y,w,h\t\n \tend",
"def initialize\r\n\t super(0,Graphics.height-WIN_HEIGHT,Graphics.width,WIN_HEIGHT)\r\n\t @x, @y, @i = 10, 50, 0\r\n\t @party_size = $game_party.all_members.size\r\n contents.font.size = FONT_SIZE\r\n\t self.back_opacity = WIN_OPACITY\r\n self.opacity = FRAME_OPACITY\r\n @actor_hp = []\r\n @actor_mp = []\r\n\t fhiz_hud\r\n\t check_visible\r\n end",
"def initialize(x, y, w, h)\r\n @x = x\r\n @y = y\r\n @w = w\r\n @h = h\r\n end",
"def initialize(x, y, width)\r\n super(x, y, width, window_height)\r\n @actor = nil\r\n refresh\r\n end",
"def initialize(x, y, w, h)\n @x = x; @y = y; @w = w; @h = h\n end",
"def initialize(window)\n @window = window\n @color = Gosu::Color::BLACK\n\n @a = CP::Vec2.new(0,0)\n @b = CP::Vec2.new(SCREEN_WIDTH - (PADDING * 2), 0)\n\n # CHIPMUNK BODY\n @body = CP::Body.new(INFINITY, INFINITY)\n @body.p = CP::Vec2.new(PADDING, SCREEN_HEIGHT - PADDING)\n @body.v = CP::Vec2.new(0, 0)\n\n # CHIPMUNK SHAPE\n @shape = CP::Shape::Segment.new(@body,\n @a,\n @b,\n 1)\n @shape.e = 0\n @shape.u = 1\n\n # STATIC SO THAT THE GRAVITY OF THE SPACE DOESN'T HAVE ITS WAY\n @window.space.add_static_shape(@shape)\n\n end",
"def initialize(window, x, y, width, height, color=0xffff0000, z_order=0)\n\t\t\t@window = window\n\t\t\t@x = x\n\t\t\t@y = y\n\t\t\t@width = width\n\t\t\t@height = height\n\t\t\t@color = color\n\t\t\t@z_order = z_order\t\n\t\tend",
"def initialize(x, y, appearance, window, type=Type[:BLOCK])\n @x = x\n @y = y\n @type = type\n @window = window\n @appearance = appearance\n end",
"def initialize(height, width)\n @visible = true\n # do we set height and width ?? XXX\n @window = Ncurses.newpad(height, width)\n @padheight = height\n @padwidth = width\n @height = height\n @width = width\n @sheight = height\n @swidth = width\n init_vars\n end",
"def initialize\n @x = 0\n @y = 0\n set_obj(self)\n end",
"def initialize(x, y, w, h)\n @x, @y, @w, @h = x, y, w, h\n @rect = Rect.new(@x, @y, @w, @h) #Overall Dimensions of the room\n\n # We keep a rectangle per side/wall for collision detection\n @top_rectangle = Rect.new(@rect.a.x, @rect.a.y, @w, LINE_WIDTH)\n @right_rectangle = Rect.new(@rect.b.x, @rect.b.y, LINE_WIDTH, @h)\n @left_rectangle = Rect.new(@rect.a.x, @rect.a.y, LINE_WIDTH, @h)\n @bottom_rectangle = Rect.new(@rect.c.x, @rect.c.y, @w, LINE_WIDTH)\n @neighbours = {}\n @links = {}\n end",
"def initialize(x, y)\r\n super(x, y, window_width, window_height)\r\n @pending_index = -1\r\n refresh\r\n end",
"def initialize(w,h)\n\t\t@width, @height = w, h #@ -> instance variables\n\t\t@@count += 1\n\tend",
"def initialize(x, y)\n super(x, y, window_width, window_height)\n @pending_index = -1\n refresh\n end",
"def initialize()\n get_dimensions()\n get_start_p()\n get_end_p()\n end",
"def initialize x, y, width, height\n @x = x\n @y = y\n @width = width\n @height = height\n end",
"def initialize(width, height)\n @width = width\n @height = height\n @x = 0\n @y = 0\n end",
"def initialize(x, y, width, height, actors=nil)\n super(x, y, width, height, 28, 48)\n @column_max = 8\n @ucReserveActorsList = []\n window_update(actors)\n self.index = 0\n @cursor_transfer = false\n end",
"def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end",
"def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end",
"def initialize(window)\n\t\t@window = window\n\n\t\t@components = []\n\tend",
"def initialize (x, y, w, h)\n @x1 = x\n @y1 = y\n @x2 = x + w\n @y2 = y + h\n end",
"def initialize(x, y, w, h, passable = false)\n @x = x; @y = y; @w = w; @h = h\n @passable = passable\n end",
"def initialize(x, y, width, height, characters)\n super(x, y, width, height, 8, height - 32)\n @column_max = 4\n @ucPartyCharStatusList = []\n window_update(characters)\n self.index = -1\n end",
"def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n @title_prefix = title_prefix\n @max_contents_len = @win.maxx - 3 # 2 for borders\n end",
"def initialize(n,h,w)\n @name = n #@name -- > Instance variable - scoped at the object level.\n #It is a variable that exists as long as the object instance exists\n @height = h\n @weight = w\n end",
"def initialize(starting_x: 0, starting_y: 400)\n @starting_x = starting_x\n @starting_y = starting_y\n @flat_group = nil\n @sheet = WikiHouse.sheet.new\n Sk.find_or_create_layer(name: outside_edge_layer_name)\n Sk.find_or_create_layer(name: inside_edge_layer_name)\n @components_flattened = []\n end",
"def initialize\n @msg_win = MessageWindow.new\n @opts_win = OptionsWindow.new\n @board_win = BoardWindow.new\n end",
"def initialize(width, height)\r\n \t#variables de instancia\r\n @width = width\r\n @height = height\r\n end",
"def initialize(window)\n # @x & @y to set the postion on the window\n @x = 200\n @y = 200\n @angle = 0\n #store the img on the @image instance variable\n @image = Gosu::Image.new('images/ship.png')\n # add instance variables for speed\n @velocity_x = 0\n @velocity_y = 0\n #instance variable to define the edges of the window \n #Gosu::Window class has methods that let us use our @window reference to get the width and height of the window\n @window = window\n #radius method to take the center of the ship\n @radius = 0\n end",
"def initialize(x, y, window)\n\t\tsuper(\"images/alien.png\") \n\t\t@x = x\n \t @y = y\n \t\t@window = window\n\tend",
"def initialize(x, y, w, h)\n @remove = false\n @xoff = @yoff = @zoff = 0\n @x, @y, @w, @h = x, y, w, h\n end",
"def create_mission_window\n @mission_window = Window_Mission.new(0, 0)\n @mission_window.y = Graphics.height - @mission_window.height\n end",
"def initialize\n @lines = 6\n @x = 0\n @y = Graphics.height - window.fitting_height(lines)\n @width = Graphics.width\n @height = window.fitting_height(lines)\n @opacity = 256\n end",
"def initialize(x, y, width, height, modes)\n super(x, y, width, height, 32, 32)\n \n @row_max = modes.size\n @column_max = 1\n \n @modesList = []\n window_update(modes)\n self.index = 0\n end",
"def initialize w\n self.w = w\n\n self.x, self.y = rand(w.w), rand(w.h)\n self.a = 0.0\n self.ga = 0.0\n self.m = 0.0\n end",
"def create_info_window\n y = @enemy_list_window.y\n x = @enemy_list_window.width\n @info_window = Window_EnemyInfo.new(x, y, Graphics.width - x, Graphics.height - y)\n @enemy_list_window.set_info_window(@info_window)\n @category_window.z = 9999\n @info_window.viewport = @viewport\n end",
"def window\n Window_Base.new(0, 0, 0, 0)\n end",
"def initialize( myHeight, myWidth, myTop,myLeft)\n @myHeight = myHeight\n @myWidth = myWidth\n @myTop = myTop\n @myLeft = myLeft\n #puts \" left = #{@myLeft} top =#{@myTop}\"\n\n end",
"def initialize(window, width, height, rooms_width, rooms_height)\n @window = window\n @width, @height = width, height\n @rooms_width, @rooms_height = rooms_width, rooms_height\n\n # Create RoomGenerator\n generator = RoomGenerator.new(@window, @rooms_width, @rooms_height)\n \n @rooms = Array.new(@height) do |l|\n Array.new(@width) do |c|\n generator.generate_room(c, l)\n end\n end\n \n puts \"Created maze of #{@width}*#{@height} rooms.\"\n puts \"=> #{@width*@rooms_width}*#{@height*@rooms_height} squares\"\n end",
"def initialize (window, x, y)\n # Establishes a sprite for the palyer\n @image = Gosu::Image.new(window, \"media/Starfighter.bmp\", false)\n # Initializes the x,y and last position\n @x, @y = x, y\n @lastPosX = @lastPosY = @lastShot = 0\n # Initializes x-y-velocity\n @vel_x = @vel_y = 0\n # Stores instance of window\n @window = window\n # Establishes constant velocity for x and y directions\n @VELOCITY = 3\n # Boolean which measures if the ship is dead or not\n @isKill = false\n end",
"def initialize(viewport, x = 2, y = 2, width = 316, height = 48, skin: DEFAULT_SKIN)\n super(viewport)\n lock\n set_position(x, y)\n set_size(width, height)\n self.windowskin = RPG::Cache.windowskin(skin)\n self.window_builder = current_window_builder(skin)\n unlock\n end",
"def initialize\n super(0, 0, window_width, window_height) \n @item = nil\n @max = 1\n @number = 1\n end",
"def initialize\n super(0, 0, window_width, window_height) \n @item = nil\n @max = 1\n @number = 1\n @cursor_y = 0\n end",
"def initialize(width: 100, height: 100, size: 5)\n @width = width.clamp(0, 1000) # width of cell grid\n @height = height.clamp(0, 1000) # height of cell grid\n @size = size.clamp(3, 100) # size of each cell on viewport\n\n # calculate game viewport size\n @viewport_width = width * size\n @viewport_height = height * size\n\n # setup game environment\n @environment = Environment.new(\n width: width,\n height: height\n )\n\n # populate environment with random\n # population of live cells\n @environment.seed_random\n\n # setup tick\n @tick = Tick.new(@environment)\n\n # setup gosu window config\n super @viewport_width, @viewport_height\n self.caption = \"Game of Life\"\n end",
"def initialize(x, y, w, h, solid)\n super(x, y, w, h)\n @event_tiks = 0\n @recoil_frames = 35\n @recoil_magnitude = 4\n @inv_frames = 0\n @dying_frames = 20\n @solid = solid\n @floater = false\n end",
"def initialize(x, y, width, height, actor)\n super(x, y, width, height)\n @ucEquipItemsList = []\n window_update(actor)\n self.index = 0\n end",
"def create_bestiary_window\n y = @enemy_list_window.height\n w = @enemy_list_window.width\n @bestiary_window = Window_BestiaryInfo.new(0, y, w)\n @bestiary_window.viewport = @viewport\n end",
"def initialize(window)\n super(\"images/ufo.png\")\n @x = window.width / 2\n @y = window.height - HEIGHT\n @velocity = SPEED\n @window = window\n end",
"def initialize(x, y)\n @camX = x\n @camY = y\n @width = 600\n @height = 400\n end",
"def initialize(n,h,w)\n\t\t@name=n\n\t\t@height=h\n\t\t@weight=w\n\tend",
"def initialize(window, x, y, radius, flip=false, color=0xffff0000, z_order=0)\n\t\t\t@window = window\n\t\t\t@x = x\n\t\t\t@y = y\n\t\t\t@radius = radius\n\t\t\t@color = color\n\t\t\t@z_order = z_order\n\t\t\t@flip = flip\n\t\t\t@height = Math::sin(60)*@radius\n\t\t\t@length = Math::sin(30)*@radius\t\n\t\t\tconvertVertices\n\t\tend",
"def initialize_dimensions\n @width = 150\n @height = 48\n @wheels_front = 31\n @wheels_rear = 126\n end",
"def initialize(size: , window: )\r\n #TODO: allow size to be even\r\n @size = size.even? ? size + 1 : size\r\n @window = window.new(size: size)\r\n end",
"def initialize(x, y, width, height, actor, dataview=nil)\n super(x, y, width, height)\n @column_max = 1\n @ucSkillsList = []\n window_update(actor, dataview)\n self.index = 0\n end",
"def initialize(width, height)\n @ticks = 100\n @width = width\n @height = height\n @current_map_number = 1\n\n reset_vars\n end",
"def initialize(window, x, y, radius, color1, filled=true, color2=color1, \n border=0, br_color1=color1, br_color2=br_color1,\n active=true, visible=true)\n super(window, color1, filled, color2, \n border, br_color1, br_color2, \n active, visible)\n self.x = x\n self.y = y\n self.radius = radius\n end",
"def create_materials_window\n width = Graphics.width / 2\n @materials_window = Window_ForgeMaterials.new(0, 0, width)\n y = Graphics.height - @materials_window.height\n #y = @gold_window.y - @materials_window.height\n @materials_window.y = y\n end",
"def initialize(x=3,y=3)\n @x=x\n @y=y \n\tdraw_new\n end",
"def initialize(x, y)\n super(x, y, 84, WLH + 32)\n refresh\n end",
"def create_enemy_window() end",
"def initialize(n, h, w)\n @name = n # The @ symbol beforehand defines an instance variable\n @height = h\n @weight = w\n end",
"def initialize\n self.x, self.y = 0, 0\n end",
"def initialize(window,text,x,y,width,height)\n # Call initialize method of SpriteWindow_Base\n SpriteWindow_Base.instance_method(:initialize).bind(self).call(x,y,width,height)\n @window = window\n self.windowskin = nil\n self.contents.font.name = @window.fontName\n self.contents.font.size = 20\n @helper = CharacterEntryHelper.new(text)\n @heading = nil\n self.active = false\n @frame = 0\n self.refresh\n #self.recalculate_maxlength\n self.maxlength = 50\n @history_index = 0\n @history = []\n end",
"def initialize(n, h, w)\r\n @name = n #@ symbol is called an instance variable\r\n @height = h\r\n @weight = w\r\n end",
"def initialize(n, h, w) #changed name to n; added h & w\n @name = n\n @height = h\n @weight = w\n end",
"def initialize(window, origin)\n @window = window\n move(origin[:y], origin[:x])\n end",
"def initialize(start, w, h, generation_frame, game)\n super(start, w, h, generation_frame, game)\n end",
"def initialize(start, w, h, generation_frame, game)\n super(start, w, h, generation_frame, game)\n end",
"def initialize(start, w, h, generation_frame, game)\n super(start, w, h, generation_frame, game)\n end",
"def initialize(window, rect, enemy, align=0, opacity=255, valign=0, resize_mode=nil, \n active=true, visible=true)\n super(active, visible)\n self.enemy = enemy\n @cEnemyGraphic = CResizableImage.new(window, rect, \n nil, nil, align, opacity, valign, resize_mode, \n active, visible)\n end",
"def create_enemy_list_window\n y = 0 #@category_window.height + @category_window.y\n h = Graphics.height - y - 80\n @enemy_list_window = Window_EnemyList.new(0, y, 180, h)\n @category_window.set_list(@enemy_list_window)\n @enemy_list_window.set_category_window(@category_window)\n @enemy_list_window.viewport = @viewport\n end",
"def initialize(max_x, max_y)\n self.width = max_x + 1\n self.height = max_y + 1\n self\n end",
"def initialize(x, y)\r\n super(x, y, window_width, window_height)\r\n refresh\r\n self.top_row = @@last_top_row\r\n select(@@last_index)\r\n activate\r\n end",
"def initialize settings={:x => 0, :y => 0, :width => 0, :height => 0, :life => 1, :depth => 0}\n\t\t\ts = {:x => 0, :y => 0, :width => 0, :height => 0, :life => 1, :depth => 0}.merge! settings\n\t\t\tUtil.hash_to_var(s, [:x, :y, :width, :height, :life, :depth], self)\n\t\t\t@@game.add self\n\t\tend",
"def initialize(window)\n \t# all setup is done in reset so it can be reused\n reset(window)\n end",
"def __init__(self, width=10, height=10):\n super(VacuumEnvironment, self).__init__(width, height)\n self.add_walls()\n end",
"def initialize # A normal initialization method\n @n, @totalX, @totalY = 0, 0.0, 0.0\n end",
"def initialize # A normal initialization method\n @n, @totalX, @totalY = 0, 0.0, 0.0\n end",
"def create_face_window\n @face_window = Window_Face.new(FACE_X, FACE_Y, @actor)\n end",
"def initialize()\n @grid = []\n @rows = 0\n @cols = 0\n end",
"def initialize(x, y, width, height)\n super\n @data = []\n self.index = 0\n activate\n end",
"def initialize\n @n, @totalX, @totalY = 0, 0.0, 0.0\n end",
"def initialize(x, y, width, height, items, dataview=nil)\n super(x, y, width, height)\n @column_max = 2\n @ucItemsList = []\n window_update(items, dataview)\n self.index = 0\n end",
"def initialize h=0, w=0, top=0, left=0\n @height, @width, @top, @left = h, w, top, left\n\n @height = FFI::NCurses.LINES if @height == 0 # 2011-11-14 added since tired of checking for zero\n @width = FFI::NCurses.COLS if @width == 0\n @pointer = FFI::NCurses.newwin(@height, @width, @top, @left) # added FFI 2011-09-6 \n\n @panel = FFI::NCurses.new_panel(@pointer)\n FFI::NCurses.keypad(@pointer, true)\n return @pointer\n end",
"def initialize window, x, y\n images = Gosu::Image::load_tiles(window, \"media/SlugSlime.png\", WIDTH, HEIGHT, true)\n\n super(window, x, y, WIDTH, HEIGHT, images)\n\n @creation_milliseconds = Gosu.milliseconds\n end",
"def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)\n @dest_scroll_oy = 0\n super(x, y, w, h)\n @dest_scroll_oy = self.oy\n self.layout = layout\n end",
"def initialize(x, y, width, height)\n @ax, @ay = x, y\n @v = Viewport.new(x,y,width,height)\n @v.z = 99999\n # create the actual sprite\n super(@v)\n # set dimensions\n @width = width\n @height = height\n # create background sprite\n create_background_sprite\n # set position\n self.x, self.y, self.z = 0,0,1000#x, y, 1000\n # store variables\n @active = true\n end",
"def initialize(br)\n @br = br # get battle result\n @messages_index = 0 # shows the actual mesage of the window\n @messages = [] # array of mesages: exp, gold,e tc\n super(0, 0, 640, (Wep::Lines_to_show * 32) + 32)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.y = 0\n self.back_opacity = 160\n self.visible = false\n generate_messages\n refresh\n end",
"def create_active_members_window\n y = @left_window.bottom_corner\n @active_members_window = Window_ActiveMembers.new(0, y)\n @active_members_window.set_handler(:right, method(:pass_on_right))\n @active_members_window.set_handler(:cancel, method(:on_cancel))\n @active_members_window.set_handler(:ok, method(:on_actor_selection))\n @active_members_window.y = Graphics.height - @active_members_window.height\n @active_members_window.activate\n end",
"def initialize\n @dimension = {}\n @xrandr = `xrandr`\n #Screen 0: minimum 0 x 0, current 1266 x 998, maximum 4096 x 4096\n xrandr_re = Regexp.new ', current (?<x>[1-9][0-9]*) x (?<y>[1-9][0-9]*),'\n xrandr_re =~ @xrandr\n [:x, :y].each{|dim| @dimension[dim] = $~[dim].to_i }\n end",
"def initialize(window, rect, img_bitmap, src_rect, align=0, opacity=255, \n valign=0, active=true, visible=true)\n super(window, active, visible)\n self.rect = rect\n self.img_bitmap = img_bitmap\n self.src_rect = src_rect\n self.align = align\n self.opacity = opacity\n self.valign = valign\n end",
"def initialize(width, height)\n # default width and height are set to max to use the validations functions\n @width = MAX_WIDTH\n @height = MAX_HEIGHT\n validate_x_y_coords(width, height)\n @width = width\n @height = height\n clear\n end",
"def initialize(window, x, y, a, b, color1, filled=true, color2=color1, \n border=0, br_color1=color1, br_color2=br_color1,\n active=true, visible=true)\n super(window, color1, filled, color2, \n border, br_color1, br_color2, \n active, visible)\n self.x = x\n self.y = y\n self.a = a\n self.b = b\n end",
"def initialize(n, h, w)\n @name = n\n @height = h\n @weight = w\n puts \"This object was initialized with the name #{@name}\"\n end",
"def initialize(x,y)\n @x,@y = x, y # Sets initial values for instance variables\n \n # Use the class variables in this instance method to collect data\n @@n += 1 # Keep track of how many Points have been created\n @@totalX += x # Add these coordinates to the totals\n @@totalY += y\n end"
] | [
"0.7197765",
"0.7058596",
"0.7026573",
"0.7022096",
"0.6948037",
"0.6931735",
"0.6910408",
"0.6810857",
"0.6753257",
"0.6732402",
"0.6682165",
"0.66670364",
"0.6510932",
"0.6477286",
"0.6465317",
"0.6453747",
"0.64535826",
"0.64493585",
"0.6413301",
"0.6392259",
"0.63895935",
"0.638588",
"0.63838595",
"0.63838595",
"0.6368102",
"0.63649493",
"0.6344572",
"0.63252544",
"0.6309344",
"0.62968963",
"0.62872905",
"0.6283173",
"0.6278976",
"0.6277043",
"0.6270485",
"0.6261116",
"0.6254809",
"0.6239715",
"0.6193095",
"0.6175318",
"0.6168918",
"0.6164303",
"0.6146941",
"0.6128836",
"0.61134064",
"0.61081415",
"0.6089101",
"0.6088529",
"0.60881007",
"0.608792",
"0.60647553",
"0.6048341",
"0.6009461",
"0.6008287",
"0.60080504",
"0.59865534",
"0.5983793",
"0.5977477",
"0.5975756",
"0.597129",
"0.5967963",
"0.5960169",
"0.59489965",
"0.5940979",
"0.5932821",
"0.5926322",
"0.59259605",
"0.5912765",
"0.59124994",
"0.58970255",
"0.58912814",
"0.58835614",
"0.58835614",
"0.58835614",
"0.5883118",
"0.58789897",
"0.58722824",
"0.58631974",
"0.5861399",
"0.58494025",
"0.584752",
"0.5840477",
"0.5840477",
"0.58392644",
"0.58322096",
"0.583181",
"0.5809772",
"0.5807171",
"0.5798727",
"0.57916886",
"0.5790639",
"0.5790576",
"0.5787332",
"0.57872576",
"0.5782949",
"0.5781192",
"0.57795084",
"0.57746506",
"0.57723504",
"0.5771713"
] | 0.65772164 | 12 |
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Update members : party members | def window_update(members)
@data = []
for i in @data.size .. 4-1
@data.push(nil)
end
if members != nil
index = 0
for member in members
@data[$game_party.actor_positions[index]] = member
index += 1
end
end
@item_max = @data.size
create_contents()
@ucCharFacesList.clear()
for i in 0..@item_max-1
@ucCharFacesList.push(create_item(i))
end
refresh()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n \tsuper\r\n \tcheck_visible\r\n \tif @party_size != $game_party.all_members.size\r\n \t refresh\r\n \tend\r\n i = 0\r\n while i < @party_size\r\n if $game_party.members[i].hp != @actor_hp[i] or $game_party.members[i].mp != @actor_mp[i]\r\n\t refresh\r\n\t end\r\n i += 1\r\n end\r\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @person_id = args[:person_id] if args.key?(:person_id)\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @membership_count = args[:membership_count] if args.key?(:membership_count)\n @membership_state = args[:membership_state] if args.key?(:membership_state)\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @membership_count = args[:membership_count] if args.key?(:membership_count)\n @membership_state = args[:membership_state] if args.key?(:membership_state)\n end",
"def local_update_members\n if self.respond_to?(:members)\n self.members.each do |member|\n member.reload.update_index\n end\n end\n end",
"def local_update_members\n if self.respond_to?(:members)\n self.members.each do |member|\n member.reload.update_index\n end\n end\n end",
"def update_members\n unless self.list_members.blank?\n #create new members\n self.list_members.each do |api_member|\n member_params = {}\n api_member.each_pair do |key, value|\n unless key == \"id\"\n if Member.attribute_names.include? key\n member_params[key] = value\n end\n end\n end\n #member already exists\n temp = Member.find_by guid: member_params[\"guid\"]\n if !!temp\n temp.attributes = member_params\n if temp.valid? \n temp.save\n else\n return \"problem updating existing member\"\n end\n else\n member = Member.new(member_params)\n if member.valid?\n member.save\n else\n return \"problem with member params\"\n end\n end\n #delete denied members\n if api_member[\"connection_status\"] != \"CONNECTED\"\n Member.find_by(guid: member_params[\"guid\"]).delete\n Member.delete_member(self.guid, member_params[\"guid\"])\n end\n end\n end\n end",
"def update\n\t\t\n\t\t# check if the current use is this person\n\t\t\t\t\n\t\t\n\tend",
"def update_memberships\n update_children\n update_parents\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @square_id = args[:square_id] if args.key?(:square_id)\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @square_id = args[:square_id] if args.key?(:square_id)\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n @uplines = Member.where.not(id: @member.self_and_descendants.collect(&:id)).order(\"fullname\")\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_existing_members hash\n hash.each_pair do |key, value|\n send \"#{key}=\", value if respond_to? \"#{key}=\".to_sym\n end\n self\n end",
"def update!(**args)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update!(**args)\n @membership = args[:membership] if args.key?(:membership)\n end",
"def update!(**args)\n @membership = args[:membership] if args.key?(:membership)\n end",
"def update!(**args)\n @abridged_roster_memberships = args[:abridged_roster_memberships] if args.key?(:abridged_roster_memberships)\n @metadata = args[:metadata] if args.key?(:metadata)\n @roster_member_count = args[:roster_member_count] if args.key?(:roster_member_count)\n end",
"def update_group_member_set(principal, members)\n end",
"def update!(**args)\n @chat_id = args[:chat_id] if args.key?(:chat_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def update!(**args)\n @chat_id = args[:chat_id] if args.key?(:chat_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def update!(**args)\n @affected_member = args[:affected_member] if args.key?(:affected_member)\n @prior_membership_role = args[:prior_membership_role] if args.key?(:prior_membership_role)\n @prior_membership_state = args[:prior_membership_state] if args.key?(:prior_membership_state)\n @target_membership_role = args[:target_membership_role] if args.key?(:target_membership_role)\n end",
"def update_inherited_members\n if parent\n if inherit_members? && !inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n add_inherited_member_roles\n add_inherited_member_functions # PATCH\n elsif !inherit_members? && inherit_members_before_last_save\n remove_inherited_member_roles\n remove_inherited_member_functions # PATCH\n end\n end\n end",
"def touch_members\n members.each do |mem|\n mem.touch\n end\n end",
"def update_guild_member(data)\n server_id = data['guild_id'].to_i\n server = self.server(server_id)\n\n member = server.member(data['user']['id'].to_i)\n member.update_roles(data['roles'])\n member.update_nick(data['nick'])\n member.update_boosting_since(data['premium_since'])\n member.update_communication_disabled_until(data['communication_disabled_until'])\n end",
"def setup_starting_members\r\n @actors = []\r\n log_info(\"Initial party members : #{$data_system.party_members}\")\r\n for i in $data_system.party_members\r\n @actors.push($game_actors[i])\r\n end\r\n end",
"def set_owner_member\n self.organizations << self.owner\n end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def update!(**args)\n @avatar_url = args[:avatar_url] if args.key?(:avatar_url)\n @id = args[:id] if args.key?(:id)\n @is_membership_visible_to_caller = args[:is_membership_visible_to_caller] if args.key?(:is_membership_visible_to_caller)\n @membership_count = args[:membership_count] if args.key?(:membership_count)\n @name = args[:name] if args.key?(:name)\n @roster_gaia_key = args[:roster_gaia_key] if args.key?(:roster_gaia_key)\n @roster_state = args[:roster_state] if args.key?(:roster_state)\n @segmented_membership_counts = args[:segmented_membership_counts] if args.key?(:segmented_membership_counts)\n end",
"def update_from_old_member\n if self.old_member\n old_member = self.old_member\n\n # If this member is a committee member\n if old_member.tier_id == 3\n\n name = old_member.position.chomp(\"Committee Member\").strip\n committee_type = CommitteeType.committee\n cm_type = CommitteeMemberType.cm\n\n # If this member is a committee chair\n elsif old_member.tier_id == 4\n\n name = old_member.position.chomp(\"Chair\").strip\n committee_type = CommitteeType.committee\n cm_type = CommitteeMemberType.chair\n\n # If this member is an executive\n elsif old_member.tier_id == 5\n\n name = \"Executive\"\n committee_type = CommitteeType.admin\n cm_type = CommitteeMemberType.exec(old_member.position)\n\n # Exit with nil if the correct cm_type was not found\n return nil if cm_type.nil?\n\n # If this member is a general member\n elsif old_member.tier_id == 2\n\n name = \"General Members\"\n committee_type = CommitteeType.general\n cm_type = CommitteeMemberType.gm\n\n end\n\n self.add_to_committee(name, committee_type, cm_type)\n\n # Remove from any general committees unless the member belongs there\n self.remove_from_general unless old_member.tier_id == 2\n\n return self.save\n end\n end",
"def update!(**args)\n @role = args[:role] unless args[:role].nil?\n @members = args[:members] unless args[:members].nil?\n end",
"def update\n respond_to do |format|\n if @household.update(household_params)\n\n params[:household][:household_members_attributes].each do |member|\n predecessor_name = member[1][:name]\n successor_name = member[1][:name_related]\n relationship_kind = member[1][:relationship]\n\n @household.add_household_member(@household.household_members.find_by_name(predecessor_name))\n @household.add_relationship(predecessor_name, successor_name, relationship_kind)\n #byebug\n end\n format.html { redirect_to @household, notice: 'Household was successfully updated.' }\n format.json { render :show, status: :ok, location: @household }\n else\n format.html { render :edit }\n format.json { render json: @household.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_guild_member(data)\n server_id = data['guild_id'].to_i\n server = self.server(server_id)\n\n member = server.member(data['user']['id'].to_i)\n member.update_roles(data['roles'])\n member.update_nick(data['nick'])\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @member = args[:member] if args.key?(:member)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"def adjust_party(party)\n parties = {}\n party.each do |pokemon|\n sub_party = (parties[pokemon.party_id] ||= [])\n sub_party << pokemon\n end\n party.clear\n i = 0\n did_something = true\n while did_something\n did_something = false\n parties.each_value do |sub_party|\n next unless (pokemon = sub_party[i])\n party << pokemon\n did_something = true\n end\n i += 1\n end\n end",
"def associate_member_with_community\n self.community.members << self.member unless self.community.members.include? self.member\n end",
"def update!(**args)\n @role = args[:role] if args.key?(:role)\n @members = args[:members] if args.key?(:members)\n end",
"def update!(**args)\n @affected_member_profiles = args[:affected_member_profiles] if args.key?(:affected_member_profiles)\n @affected_members = args[:affected_members] if args.key?(:affected_members)\n @affected_memberships = args[:affected_memberships] if args.key?(:affected_memberships)\n @initiator = args[:initiator] if args.key?(:initiator)\n @initiator_profile = args[:initiator_profile] if args.key?(:initiator_profile)\n @initiator_type = args[:initiator_type] if args.key?(:initiator_type)\n @type = args[:type] if args.key?(:type)\n end",
"def set_members\n members_ids = params[:contest][:members].reject(&:empty?)\n @contest.members.destroy_all if params[:action] == \"update\"\n members_ids.each do |members_id|\n member = Member.create(:user_id => members_id.to_i, :invitable => @contest)\n #send notification\n reciver = User.find(members_id)\n notifications = reciver.notifications.unread \n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has invited you to join a contest #{@contest.topic} \", notificable: @contest, :accept => false, :is_acceptable=>true)\n PrivatePub.publish_to \"/profiles/new_#{members_id}\", \"jQuery('#all-notifications').html('#{notifications.count}'); jQuery('#all-notifications').addClass('push-notification');\"\n\n end\n end\n end",
"def update!(**args)\n @all_users = args[:all_users] if args.key?(:all_users)\n @domain_users = args[:domain_users] if args.key?(:domain_users)\n @membership = args[:membership] if args.key?(:membership)\n @person = args[:person] if args.key?(:person)\n end",
"def party_memberships\n respond_to?(:partyHasPartyMembership) ? partyHasPartyMembership : []\n end",
"def add_members(members)\n @members.merge!(members)\n end",
"def update\n @member = Member.find(params[:id])\n\n if @member.vend_total.nil?\n @member.vend_total = 0\n end\n\n if @member.vend_credits.nil?\n @member.vend_credits = 1\n end\n \n if @member.door_count.nil?\n @member.door_count = 0\n end\n \n\n raise CanCan::AccessDenied if cannot? :edit, @member\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def members\n self.u_members + self.g_members\n end",
"def update!(**args)\n @avatar_url = args[:avatar_url] if args.key?(:avatar_url)\n @description = args[:description] if args.key?(:description)\n @developer_name = args[:developer_name] if args.key?(:developer_name)\n @dnd_state = args[:dnd_state] if args.key?(:dnd_state)\n @entity_type = args[:entity_type] if args.key?(:entity_type)\n @is_membership_visible_to_caller = args[:is_membership_visible_to_caller] if args.key?(:is_membership_visible_to_caller)\n @member_count = args[:member_count] if args.key?(:member_count)\n @organization_info = args[:organization_info] if args.key?(:organization_info)\n @presence_prop = args[:presence_prop] if args.key?(:presence_prop)\n @segmented_membership_counts = args[:segmented_membership_counts] if args.key?(:segmented_membership_counts)\n end",
"def changing_members(&block)\n _assigning do\n ids = members.map(&:to_key)\n instance_eval(&block)\n new_ids = members.map(&:to_key)\n\n added, removed = (new_ids - ids), (ids - new_ids)\n\n @original_members ||= ids\n @members_added ||= []; @members_removed ||= []\n @members_added -= removed; @members_removed -= added\n @members_added.concat(added).uniq!; @members_removed.concat(removed & @original_members).uniq!\n end\n self\n end",
"def update\n # save the new value to a member object\n @member = Member.find(params[:id])\n @member.attributes = params[:member]\n @member.skip_password_validation = true\n @member.disabled = @member.enabled ? false : true\n @member.disabled = false if @member.super_member?\n\n if @member.valid?\n \n @member.save\n\n # if member becomes super then remove all property access\n if @member.super_member?\n MemberPropertyAccess.where(:member_id => @member.id).destroy_all\n else\n # add new access\n @member.assigned_properties.each do |prop_id|\n prop = Property.active_only.find(prop_id)\n puts \"#{prop} #{prop.account == @member.account} #{MemberPropertyAccess.find_by_member_id_and_property_id(@member.id, prop.id).blank?}\"\n if prop.account == @member.account and MemberPropertyAccess.find_by_member_id_and_property_id(@member.id, prop.id).blank?\n MemberPropertyAccess.create(:member_id => @member.id, :property_id => prop.id)\n end\n end\n\n # remove access\n MemberPropertyAccess.find_all_by_member_id(@member.id).each do |mpa|\n if !@member.assigned_properties.include?(mpa.property_id.to_s)\n mpa.destroy\n end\n end\n end\n\n flash[:notice] = t('members.update.message.success')\n redirect_to members_path\n else\n put_model_errors_to_flash(@member.errors)\n render 'edit'\n end\n end",
"def update_tier_members_count\n if self.tier && self.tier.class.columns.to_a.map {|a| a.name.to_sym}.include?(:members_count)\n self.tier.class.transaction do \n self.tier.lock!\n self.tier.update_attribute(:members_count,\n self.tier.members.count(\"people.id\", self.class.find_options_for_active_state({:distinct => true})))\n end\n end\n end",
"def update\n add_abo_types_to_member(@member)\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to members_url, notice: t('flash.notice.updating_member') }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit, alert: t('flash.alert.updating_member') }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n super\n @members.each do |m|\n m.tm_team_id = @data_object.team_id\n m.save\n end\n end",
"def commandnewgame_partysetup\r\n # Set up initial party\r\n $game_party.setup_starting_members\r\n end",
"def update!(**args)\n @members = args[:members] if args.key?(:members)\n @resource = args[:resource] if args.key?(:resource)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @role = args[:role] if args.key?(:role)\n end",
"def update(uid, params, membership)\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n patch(\"https://people.i.bolkhuis.nl/persons/#{uid}\", data)\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\nend",
"def change_membership(gym_membership, person_name, membership)\n gym_membership[person_name.to_sym][:\"membership type\"] = membership\n \n if membership == \"yellow\"\n gym_membership[person_name.to_sym][:\"payment details\"][:\"monthly payment\"] = 10\n gym_membership[person_name.to_sym][:\"privileges\"] = []\n else\n gym_membership[person_name.to_sym][:\"privileges\"].push(\"Suana\", \"Massage chair\", \"Bathing\")\n gym_membership[person_name.to_sym][:\"payment details\"][:\"monthly payment\"] = 20\n end\n \n gym_membership\nend",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @member = args[:member] if args.key?(:member)\n @name = args[:name] if args.key?(:name)\n @role = args[:role] if args.key?(:role)\n @state = args[:state] if args.key?(:state)\n end",
"def update\n @issue_tracker_member.update(issue_tracker_member_params)\n @issue_tracker_member = IssueTrackerMember.new\n @issue_tracker_members = IssueTrackerMember.all \n end",
"def min_up_members_state\n super\n end",
"def update!(**args)\n @event_id = args[:event_id] if args.key?(:event_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def update!(**args)\n @event_id = args[:event_id] if args.key?(:event_id)\n @member_type = args[:member_type] if args.key?(:member_type)\n end",
"def changed_memberships(env, work_members)\n existing_member_ids = env.curation_concern.member_ids\n members_attributes = work_members.values\n changed_member_ids(members_attributes, existing_member_ids)\n end",
"def set_party_info\n @party_info = PartyInfo.find(params[:id])\n end",
"def update!(**args)\n @avatar_info = args[:avatar_info] if args.key?(:avatar_info)\n @avatar_url = args[:avatar_url] if args.key?(:avatar_url)\n @description = args[:description] if args.key?(:description)\n @group_id = args[:group_id] if args.key?(:group_id)\n @inviter_email = args[:inviter_email] if args.key?(:inviter_email)\n @is_external = args[:is_external] if args.key?(:is_external)\n @name = args[:name] if args.key?(:name)\n @num_members = args[:num_members] if args.key?(:num_members)\n @user_membership_state = args[:user_membership_state] if args.key?(:user_membership_state)\n end",
"def update\n super\n for charStatus in @ucPartyCharStatusList\n charStatus.ucActStates.update()\n end\n end",
"def set_enemy_party_info\n @enemy_party_info = EnemyPartyInfo.find(params[:id])\n end",
"def update\n # byebug \n respond_to do |format|\n if self.current_member && self.current_member.id == params[:id].to_i\n if @member.update(member_params)\n format.json { render :show, status: :ok, location: @member }\n else\n return api_error(status: :unprocessable_entity, message: @member.errors)\n end\n else\n return api_error(status: 401, message: '没有操作权限')\n end\n end\n end",
"def members(*) end",
"def update_house\n get_rep_from_api[\"results\"][0][\"members\"].each do |rep|\n Representative.create(\n pp_id: rep[\"id\"],\n first_name: rep[\"first_name\"],\n last_name: rep[\"last_name\"],\n party: rep[\"party\"],\n in_office: rep[\"in_office\"],\n state: rep[\"state\"],\n votes_with_party_pct: rep[\"votes_with_party_pct\"],\n district: rep[\"district\"]\n )\n end\nend",
"def update_followers_and_members\n #self.reload\n #puts \"follower size #{self.follower_ids.size}\"\n self.follower_count = self.follower_ids.size\n #puts \"member size #{self.member_ids.size}\"\n self.member_count = self.member_ids.size\n puts \"now followers #{self.follower_count} and members #{self.member_count} for #{self.name}\"\n puts \"is the model valid #{self.valid?}\"\n end",
"def update\n @party = Party.find(params[:id])\n @setweather = false\n \n if params[:party][:partyname].blank?\n params[:party][:partyname] = params[:party][:partyfirstname] + \" \" + params[:party][:partylastname]\n end\n #logger.debug \"WEATHER PARTY *** #{@party.inspect}\" \n if @party.partyweatherpostalcode != params{:partyweatherpostalcode}\n if !params{:partyweatherpostalcode}.nil?\n @setweather = true\n end\n end\n\n respond_to do |format|\n if @party.update_attributes(params[:party])\n \n if @setweather == true\n Party.get_weather(session[:s_user_id])\n end\n \n format.html { redirect_to(\"/partyview\" , :notice => 'Party was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @party.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def members=(value)\n @members = value\n end",
"def members=(value)\n @members = value\n end",
"def members=(value)\n @members = value\n end",
"def members=(value)\n @members = value\n end",
"def set_party\n \t@party = Party.find(params[:id])\n end",
"def rt_update\n Realtime::Publisher.instance.batch_update all_members\n end",
"def set_member\n @member = @current_enterprise.members.find(params[:id])\n end",
"def update\n @member = Member.find(params[:id])\n unless params[:item_id].blank?\n i = Item.find(params[:item_id])\n i.member = @member\n i.warband = nil\n i.save!\n end\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @member }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n format.json { render :json => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_member_roles\n eve_api = Eve::API.new(key_id: \"4233755\", v_code: \"1fu1tvYX38Ub5GE6K6W7zc1DWAd5UMpNzebSX32ZSapWmRBOMk00duZKDSDhLaKf\")\n result = eve_api.account.apikeyinfo\n eve_api[:character_id] = result.key.characters[0].character_id\n # Query EVE for member roles\n member_security = eve_api.corporation.member_security\n\n\n # Find the roles the member should have\n members = {}\n # Iterate over each returned member\n member_security.members.each do |member|\n # Build a hash of each member's roles, keyed by character_id\n members.store(\"#{member.character_id}\", [])\n members[\"#{member.character_id}\"] << \"Corp Member\"\n # Retrieve the member's roles from the returned API data\n member[\"roles\"].each do |role|\n # Since member's roles appear to start with 'role', slice it off\n name = role.role_name.slice(4, role.role_name.length)\n # Append 'Corp' to match the role names and insert it into the member's role array\n members[\"#{member.character_id}\"] << \"Corp #{name}\"\n end\n end\n\n # Iterate over each member in the members hash\n members.each do |key, value|\n # Retrieve the member using the character_id key in the members hash\n member = Member.where(\"\\\"characterID\\\" = ?\", key)[0]\n # Find the member's current roles\n roles = member.roles.pluck(:id, :name)\n # If there are current roles\n if roles.present?\n # iterate over each existing role and remove any the member should no longer have\n roles.each do |role|\n # if the member should have the role\n if value.include?(role[1])\n # delete that role from the hash value\n value.delete(role[1])\n else\n # otherwise, delete the role from the member\n MembersRole.where(\"member_id = ? AND role_id = ?\", member.id, role[0])[0].destroy\n end\n end\n end\n\n # Retrieve the IDs of each remaining role from the database\n role_ids = Role.where(name: value).pluck(:id)\n # Iterate over the role_ids array building a hash for batch insertion\n members_role_array = []\n role_ids.each do |role_id|\n members_role_array << {member_id: member.id, role_id: role_id}\n end\n # Batch insert the new MembersRoles into the database\n MembersRole.create(members_role_array)\n end\n end",
"def update!(**args)\n @people = args[:people] if args.key?(:people)\n end",
"def members=(value)\n self.users = value\n end",
"def update\n \n end",
"def exchange_members\n $game_party.switch_members(selected_actor, current_actor)\n @active_members_window.reset\n @reserve_members_window.reset\n active_window.activate\n end",
"def party_members(party_index)\n actors = []\n for ucPartyActor in @ucPartyActorsList\n actors.push(ucPartyActor.actor)\n end\n return actors\n end",
"def member_params\n params.require(:member).permit(:attend, :user_id, :party_id)\n end",
"def update!(**args)\n @memberships = args[:memberships] if args.key?(:memberships)\n @request_id = args[:request_id] if args.key?(:request_id)\n @space = args[:space] if args.key?(:space)\n end",
"def update_team\n \n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n logger.info(\"User #{current_user.email} updated Member '#{@member.first_name} #{@member.last_name}' in properties \n '#{@member.audits.last.audited_changes}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_party\n @party = Party.find(params[:id])\n end",
"def process_ok\n super\n $game_party.menu_actor = $game_party.members[index]\n end",
"def min_up_members\n super\n end",
"def add_member(input_jury)\n\t\t@members << input_jury\n\tend",
"def process_ok\r\n super\r\n $game_party.menu_actor = $game_party.members[index]\r\n end",
"def use_item_to_actors\n $game_party.members[0].item_apply(user, item)\n end",
"def set_party\n @party = Party.find(params[:party_id])\n end",
"def update_presence(data)\n # Friends list presences have no server ID so ignore these to not cause an error\n return unless data['guild_id']\n\n user_id = data['user']['id'].to_i\n server_id = data['guild_id'].to_i\n server = server(server_id)\n return unless server\n\n member_is_new = false\n\n if server.member_cached?(user_id)\n member = server.member(user_id)\n else\n # If the member is not cached yet, it means that it just came online from not being cached at all\n # due to large_threshold. Fortunately, Discord sends the entire member object in this case, and\n # not just a part of it - we can just cache this member directly\n member = Member.new(data, server, self)\n debug(\"Implicitly adding presence-obtained member #{user_id} to #{server_id} cache\")\n\n member_is_new = true\n end\n\n username = data['user']['username']\n if username && !member_is_new # Don't set the username for newly-cached members\n debug \"Implicitly updating presence-obtained information for member #{user_id}\"\n member.update_username(username)\n end\n\n member.update_presence(data)\n\n member.avatar_id = data['user']['avatar'] if data['user']['avatar']\n\n server.cache_member(member)\n end"
] | [
"0.68839043",
"0.6731065",
"0.66302663",
"0.66302663",
"0.6463374",
"0.6463374",
"0.64317214",
"0.63836825",
"0.633099",
"0.6313046",
"0.6313046",
"0.63062865",
"0.63037014",
"0.6283841",
"0.6249791",
"0.6230665",
"0.6230665",
"0.6133379",
"0.61207014",
"0.611562",
"0.611562",
"0.61117786",
"0.6085177",
"0.60589945",
"0.60413057",
"0.6037591",
"0.5999984",
"0.5998576",
"0.5998576",
"0.5998576",
"0.5998576",
"0.5998576",
"0.5998576",
"0.5998576",
"0.59885764",
"0.59839606",
"0.59504175",
"0.5947432",
"0.59095067",
"0.59013104",
"0.58981544",
"0.588999",
"0.5889645",
"0.5888318",
"0.5876271",
"0.58647066",
"0.5864445",
"0.58565533",
"0.5850517",
"0.58467454",
"0.5835359",
"0.58186996",
"0.58137375",
"0.57982105",
"0.5790525",
"0.5785963",
"0.5782471",
"0.57747877",
"0.5769075",
"0.5762614",
"0.5753853",
"0.5751654",
"0.5751077",
"0.5736445",
"0.5736445",
"0.5729792",
"0.57293034",
"0.5723621",
"0.5713747",
"0.56893474",
"0.5689304",
"0.5680192",
"0.56754977",
"0.565003",
"0.5645416",
"0.5642607",
"0.5642607",
"0.5642607",
"0.5642607",
"0.5642017",
"0.56400955",
"0.5638607",
"0.56278694",
"0.56181073",
"0.56109464",
"0.5588758",
"0.5572023",
"0.55706745",
"0.5549708",
"0.55381024",
"0.55331767",
"0.5525462",
"0.55178523",
"0.5517675",
"0.5513852",
"0.5511425",
"0.55077016",
"0.5503239",
"0.54991317",
"0.5487926",
"0.5484164"
] | 0.0 | -1 |
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Create an item for CharFacesList index : item index | def create_item(index)
actor = @data[index]
rect = item_rect(index, true)
ucChar = UCFormationCharFace.new(self, actor, rect)
return ucChar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacterGraphic.new(self, Rect.new(rect.x+9,rect.y+9,30,30), actor,\n 0, 255, 0, PARTY_CONFIG::CHARS_FACING_DIRECTION)\n \n if actor != nil && actor.reserve_locked\n ucItem.cCharGraphic.opacity = 125\n end\n \n return ucItem\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n ucItem = UCVictoryItem.new(self, item, rect)\n \n return ucItem\n end",
"def create_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacterGraphic.new(self, Rect.new(rect.x+9,rect.y+9,30,30), actor,\n 0, 255, 0, PARTY_CONFIG::CHARS_FACING_DIRECTION)\n \n if actor != nil && actor.party_locked\n ucItem.cCharGraphic.opacity = 125\n end\n \n return ucItem\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n\n case index\n when 0\n if @actor.two_swords_style\n kindDesc = Vocab::weapon1\n else\n kindDesc = Vocab::weapon\n end\n when 1\n if @actor.two_swords_style\n kindDesc = Vocab::weapon2\n else\n kindDesc = Vocab::armor1\n end\n when 2\n kindDesc = Vocab::armor2\n when 3\n kindDesc = Vocab::armor3\n when 4\n kindDesc = Vocab::armor4\n end\n \n rect.y += WLH*index \n equipItem = UCEquipItem.new(self, item, rect, kindDesc)\n \n f = Font.new()\n f.color = system_color\n equipItem.cEquipKind.font = f\n return equipItem\n end",
"def create_item(index)\n actor = @data[index]\n rect = item_rect(index, true, true)\n \n charStatus = UCPartyCharStatus.new(self, actor, rect)\n \n return charStatus\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n ucItem = UCItem.new(self, item, rect)\n ucItem.active = enable?(item)\n \n if $game_party.newest_items.include?(item)\n ucItem.cItemName.font.color = Color.new_item_color\n ucItem.cItemNumber.font.color = Color.new_item_color\n end\n \n return ucItem\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n cLabel = CLabel.new(self, rect, item.name)\n \n return cLabel\n end",
"def create_item\n @item = Fox_Item.new(self, @content.join(\"\\t\"), @icon, @icon)\n end",
"def create_item(index)\n dataview = @data[index]\n rect = item_rect(index)\n \n viewItem = UCLabelIcon.new(self, Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,24,24),\n dataview.label,\n dataview.icon_index)\n \n viewItem.cLabel.align = 1\n \n return viewItem\n end",
"def create_item(index)\n dataview = @data[index]\n rect = item_rect(index)\n \n viewItem = UCLabelIcon.new(self, Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,24,24),\n dataview.label,\n dataview.icon_index)\n \n viewItem.cLabel.align = 1\n \n return viewItem\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n if item.used\n icon_index = Wora_NSS::SAVED_SLOT_ICON\n else\n icon_index = Wora_NSS::EMPTY_SLOT_ICON\n end\n \n ucSave = UCLabelIcon.new(self, Rect.new(rect.x+24,rect.y,rect.width-24-32-2,24), \n Rect.new(rect.x,rect.y,24,24),\n item.slot_name, icon_index, item.used)\n \n return ucSave\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n if item.used\n icon_index = Wora_NSS::SAVED_SLOT_ICON\n else\n icon_index = Wora_NSS::EMPTY_SLOT_ICON\n end\n \n ucSave = UCLabelIcon.new(self, Rect.new(rect.x+24,rect.y,rect.width-24-32-2,24), \n Rect.new(rect.x,rect.y,24,24),\n item.slot_name, icon_index, item.used)\n \n return ucSave\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n # Lists\n $game_system.outline_enable = [] if $game_system.outline_enable == nil\n $game_system.outline_complete = [] if $game_system.outline_complete == nil\n \n # Generate Title\n text = ($game_system.outline_complete[item.index] ?\n KGC::Outline::OLINE_COMPLETION_SYMBOL : KGC::Outline::OLINE_INCOMPLETION_SYMBOL) +\n (KGC::Outline::OLINE_SERIAL_NUMBER ? sprintf(\"%0*d : \",\n KGC::Outline::OLINE_SERIAL_NUMBER_DIGITS, item.index + 1) : \"\") +\n item.title\n\n cOutline = CLabel.new(self, rect, text)\n cOutline.active = $game_system.outline_enable[item.index]\n \n return cOutline\n end",
"def create_item(index)\n mode = @data[index]\n rect = item_rect(index)\n \n modeItem = CLabel.new(self, rect, mode.name, 1, Font.optimize_mode_font)\n\n return modeItem\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n shopItem = UCShopItem.new(self, item, rect,\n SHOP_CONFIG::ITEM_NUMBER_PATTERN)\n \n shopItem.cItemPrice.align = 2\n shopItem.cItemPossess.align = 2 \n shopItem.cItemPossess.font = Font.shop_possess_font\n shopItem.ucItemNumber.cLabelNumber.align = 2\n shopItem.ucItemNumber.min = 0\n shopItem.ucItemNumber.max = shopItem.inventory_quantity\n return shopItem\n end",
"def draw_item(index)\n return unless @actor\n contents.font.size = Revoked::Menu::FONT_SMALL\n contents.font.name = Revoked::Menu::FONT_NAME\n contents.font.color = Revoked::Menu::FONT_BROWN\n contents.font.color.alpha = 128\n contents.font.shadow = false\n contents.font.outline = false\n rect = item_rect_for_text(index)\n #draw_text(rect.x + 22, rect.y, 92, line_height, \":\")\n #draw_icon(Revoked::Menu::EQUIP_SLOT_ICON[index], rect.x - 3, rect.y)\n draw_item_name(@actor.equips[index], rect.x + 28, rect.y, enable?(index))\n end",
"def addItem(item)\n item_number = @list_size\n widest_item = self.WidestItem\n temp = ''\n have = 0\n\n if self.allocListArrays(@list_size, @list_size + 1) &&\n self.allocListItem(item_number, temp, have,\n if @numbers then item_number + 1 else 0 end,\n item)\n # Determine the size of the widest item.\n widest_item = [@item_len[item_number], widest_item].max\n\n self.updateViewWidth(widest_item)\n self.setViewSize(@list_size + 1)\n end\n end",
"def write_item item_code, index\n write_raw_value item_code, index*16\n end",
"def create_item(index)\n skill = @data[index]\n rect = item_rect(index, true)\n \n ucSkill = UCSkill.new(self, skill, rect, @actor.calc_mp_cost(skill))\n ucSkill.active = enable?(skill)\n \n return ucSkill\n end",
"def make_item_list\n @data = equips_for_enchant\n end",
"def pack(item, index); end",
"def draw_item(index)\n rect = item_rect(index)\n contents.clear_rect(rect)\n draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))\n end",
"def make_item_list\n @data = $game_temp.avatars.all_faces;\n end",
"def add_to_index(item)\n @content << '\\index{' + (item) + '}'\n end",
"def create(key, item)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end",
"def make_item_list\n end",
"def create_item_list\n @item_button_list = ButtonList.new(@viewport)\n update_item_button_list\n end",
"def create_item_window\n @index ||= 0\n wy = @help_window.y + @help_window.height\n wh = Graphics.height - wy\n @item_window = Window_BestiaryEnemyList.new(wy, wh)\n @item_window.viewport = @viewport\n @item_window.help_window = @help_window\n @item_window.set_handler(:ok, method(:on_item_ok))\n @item_window.set_handler(:cancel, method(:return_scene))\n @item_window.refresh\n @item_window.index = @index\n @item_window.activate\n end",
"def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n item = @data[index]\n enabled = enable?(item)\n #draw_icon(item.icon_index, rect.x, rect.y, enabled)\n #contents.font.color.alpha = enabled ? 255 : translucent_alpha\n draw_item_name(item, rect.x, rect.y, enabled, contents_width)\n #draw_text(rect.x+24, rect.y, rect.width-24, WLH, item.name)\n text = sprintf('x%d', item_number(item))\n draw_text(rect.x + 24, rect.y, rect.width - 24, line_height, text, 2)\n end",
"def draw_item(index)\n item = @data[index]\n return if item.nil?\n rect = item_rect_for_text(index)\n draw_save_name(item, rect)\n end",
"def add_item(glist, item, count=1)\n\tglist[item] = 1\n\treturn glist\nend",
"def draw_item(index)\n rect = item_rect_for_text(index)\n self.contents.clear_rect(rect)\n item = @data[index]\n if $game_party.known_enemy?(item.id)\n self.contents.font.color.alpha = 255\n self.draw_text(rect.x, rect.y, rect.width, line_height, item.name)\n else\n self.contents.font.color.alpha = 128\n str = item.name.gsub(/\\w/, BestiaryConfig::UNKNOWNCHAR)\n self.draw_text(rect.x, rect.y, rect.width, line_height, str)\n end\n end",
"def draw_item(index)\n end",
"def draw_item(index)\n rect = item_rect(index)\n item = @data[index]\n change_color(normal_color, enable?(item))\n draw_item_name(item, rect.x, rect.y, rect.width)\n text = sprintf('x%d', item_number(item))\n draw_text(rect.x + 24, rect.y, rect.width - 24, line_height, text, 2)\n end",
"def draw_item(index)\n actor_id = $game_party.positions[index]\n return unless actor_id\n actor = $game_actors[actor_id]\n enabled = $game_party.battle_members.include?(actor)\n rect = item_rect(index)\n draw_item_background(index)\n #if actor.back_row?\n # draw_actor_face(actor, rect.x + 20, rect.y + 1, enabled)\n #else\n # draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n #end\n draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)\n end",
"def insertItem(item)\n widest_item = self.WidestItem\n temp = ''\n have = 0\n\n if self.allocListArrays(@list_size, @list_size + 1) &&\n self.insertListItem(@current_item) &&\n self.allocListItem(@current_item, temp, have,\n if @numbers then @current_item + 1 else 0 end,\n item)\n # Determine the size of the widest item.\n widest_item = [@item_len[@current_item], widest_item].max\n\n self.updateViewWidth(widest_item)\n self.setViewSize(@list_size + 1)\n self.resequence\n end\n end",
"def item; @data[@index]; end",
"def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n item = create_item(index)\n item.draw()\n end",
"def initialize(window, victory_item, rect, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @victory_item = victory_item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], victory_item.item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cItemName = CLabel.new(window, rects[1], victory_item.item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n \n @cItemNumber = CLabel.new(window, rects[2], \n sprintf(VICTORY_CONFIG::ITEM_NUMBER_PATTERN, \n victory_item.quantity), 2)\n @cItemNumber.active = active\n @cItemNumber.visible = visible\n end",
"def generate_item(item)\n item\n end",
"def initialize(window, item, rect, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @item = item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cItemName = CLabel.new(window, rects[1], item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n \n @cItemNumber = CLabel.new(window, rects[2], \n sprintf(MENU_CONFIG::ITEM_NUMBER_PATTERN, \n $game_party.item_number(item)), 2)\n @cItemNumber.active = active\n @cItemNumber.visible = visible\n end",
"def get_item(list_item_idx)\n @list[list_item_idx]\n end",
"def item; @data[self.index]; end",
"def draw_item(index)\n item = @data[index]\n if item\n rect = item_rect_for_text(index)\n draw_item_name(item, rect.x, rect.y, enable?(item))\n draw_item_state(rect, item)\n end\n end",
"def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end",
"def draw_item(index)\n item = @data[index]\n if item\n rect = item_rect(index)\n change_color(normal_color, enable?(index))\n draw_text(rect.x, rect.y, contents_width / col_max, line_height, item)\n end\n end",
"def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend",
"def add item\n self[index item] = item if check item\n# check item ? super : free key # delete key\n end",
"def draw_item(index)\n item = @data[index] # get item\n if item # if Item passed\n rect = item_rect(index) # get rect\n contents.clear_rect(rect)\n maiil_draw_item_icon(rect, item) # draw icon\n draw_item_number(rect, item) # draw number of items held\n end\n end",
"def item\n @list[@index][:symbol];\n end",
"def build_bibliography_item(key, index = 0)\n index += 1\n result = ''\n\n begin\n cptext = if @biblio[key].nil?\n nil\n else\n @citeproc.render :bibliography, id: key\n end\n rescue Exception => e\n puts \"Failed to render #{key}: #{e}\"\n end\n\n result << \"[[#{key}]]\" if @links\n if StyleUtils.is_numeric? @style\n result << \"#{@bibtex_ob}#{index}#{@bibtex_cb} \"\n end\n if cptext.nil?\n return result + key\n else\n result << cptext.first\n end\n\n StringUtils.html_to_asciidoc(result)\n end",
"def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n item = @data[index]\n self.draw_text(rect.x, rect.y, rect.width, line_height, item.name)\n end",
"def draw_item(index)\n item = @data[index]\n rect = item_rect(index)\n enabled = enable?(item)\n draw_item_name(item.item, rect.x, rect.y, enabled)\n draw_item_number(item, rect)\n draw_item_forge_cost(item, rect, enabled)\n end",
"def construct_item type, description, options\n type = type.downcase\n if type_allowed? type\n # Create and return a new item of the type passed in\n @@list_types[type.to_sym].new(description, options)\n else\n # Raise the invalid item type error if the type does not exist\n raise UdaciListErrors::InvalidItemType if !type_allowed? type\n end\n end",
"def draw_item(index)\n item = @data[index]\n if item\n rect = item_rect(index)\n rect.width -= 4\n draw_item_name(item, rect.x, rect.y, enable?(item))\n draw_item_state(rect, item)\n end\n end",
"def create_list(list, string_of_items)\r\n\tlist = {}\r\n\titem_array = string_of_items.split(\" \")\r\n\titem_array.each do |item|\r\n\t\titem_key = item.to_sym\r\n\t\tlist[item_key] = 1\r\n\tend\r\n\treturn list\r\nend",
"def initialize(window, item, rect, itemNumberPattern, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @item = item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n\n @cItemName = CLabel.new(window, rects[1], item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n\n @cItemPrice = CLabel.new(window, rects[2], item.price)\n @cItemPrice.active = active\n @cItemPrice.visible = visible\n\n @cItemPossess = CLabel.new(window, rects[3], $game_party.item_number(item))\n @cItemPossess.active = active\n @cItemPossess.visible = visible\n\n @ucItemNumber = UCNumericUpDown.new(window, rects[4], 0, itemNumberPattern)\n @ucItemNumber.active = active\n @ucItemNumber.visible = visible\n end",
"def add_item(list_item,user_list)\n#user_list is later defined/used to store a new list of information created when create_list method is called.\n#Uses create_list method to format information properly before allowing edits and updates to be done. \n#user_list = create_list(string) \n user_list[list_item] = 1\n user_list\nend",
"def new\n \t@item=Item.new({:ItemName =>'def'})\n end",
"def create_list(item, quantity = 1)\n\tlist = {}\n\tsplit_item = item.split(\" \")\n\tsplit_item.each do |item_name|\n\t\tlist[item_name] = quantity\n\tend\n\treturn list\nend",
"def at(idx)\n return GameStopWishListItem.new(@name_links.at(idx), @remove_buttons.at(idx))\n end",
"def pbItemEditor\n selection = 0\n items = [\n [_INTL(\"Internal Name\"),ReadOnlyProperty,_INTL(\"Internal name that appears in constructs like PBItems::XXX.\")],\n [_INTL(\"Item Name\"),ItemNameProperty,_INTL(\"Name of the item as displayed by the game.\")],\n [_INTL(\"Item Name Plural\"),ItemNameProperty,_INTL(\"Plural name of the item as displayed by the game.\")],\n [_INTL(\"Pocket\"),PocketProperty,_INTL(\"Pocket in the bag where the item is stored.\")],\n [_INTL(\"Purchase price\"),LimitProperty.new(999999),_INTL(\"Purchase price of the item.\")],\n [_INTL(\"Description\"),StringProperty,_INTL(\"Description of the item\")],\n [_INTL(\"Use Out of Battle\"),EnumProperty.new([\n _INTL(\"Can't Use\"),_INTL(\"On a Jermon\"),_INTL(\"Use directly\"),\n _INTL(\"TM\"),_INTL(\"HM\"),_INTL(\"On Jermon reusable\")]),\n _INTL(\"Specifies how this item can be used outside of battle.\")],\n [_INTL(\"Use In Battle\"),EnumProperty.new([\n _INTL(\"Can't Use\"),_INTL(\"On a Jermon\"),_INTL(\"Use directly\"),\n _INTL(\"On Jermon reusable\"),_INTL(\"Use directly reusable\")]),\n _INTL(\"Specifies how this item can be used within a battle.\")],\n [_INTL(\"Special Items\"),EnumProperty.new([\n _INTL(\"None of Below\"),_INTL(\"Mail\"),_INTL(\"Mail with Pictures\"),\n _INTL(\"Snag Ball\"),_INTL(\"Jermo Ball\"),_INTL(\"Plantable Berry\"),\n _INTL(\"Key Item\"),_INTL(\"Evolution Stone\"),_INTL(\"Fossil\"),\n _INTL(\"Apricorn\"),_INTL(\"Type-boosting Gem\"),_INTL(\"Mulch\"),\n _INTL(\"Mega Stone\")]),\n _INTL(\"For special kinds of items.\")],\n [_INTL(\"Machine\"),MoveProperty,_INTL(\"Move taught by this TM or HM.\")]\n ]\n pbListScreenBlock(_INTL(\"Items\"),ItemLister.new(selection,true)){|button,trtype|\n if trtype\n if button==Input::A\n if trtype>=0\n if Kernel.pbConfirmMessageSerious(\"Delete this item?\")\n data = readSerialRecords(\"Data/items.dat\")\n removeConstantValue(PBItems,trtype)\n data.delete_if{|item| item[0]==trtype }\n for x in data\n p x if data[0]==0\n end\n writeSerialRecords(\"Data/items.dat\",data)\n pbSaveItems\n Kernel.pbMessage(_INTL(\"The item was deleted.\"))\n end\n end\n elsif button==Input::C\n selection = trtype\n if selection<0\n newid = pbItemEditorNew(nil)\n if newid>=0\n selection = newid\n end\n else\n data = [getConstantName(PBItems,selection)]\n itemdata = readItemList(\"Data/items.dat\")\n data.push(itemdata[selection][ITEMNAME])\n data.push(itemdata[selection][ITEMPLURAL])\n data.push(itemdata[selection][ITEMPOCKET])\n data.push(itemdata[selection][ITEMPRICE])\n data.push(itemdata[selection][ITEMDESC])\n data.push(itemdata[selection][ITEMUSE])\n data.push(itemdata[selection][ITEMBATTLEUSE])\n data.push(itemdata[selection][ITEMTYPE])\n data.push(itemdata[selection][ITEMMACHINE])\n save = pbPropertyList(data[ITEMNAME],data,items,true)\n if save\n itemdata[selection][ITEMNAME] = data[ITEMNAME]\n itemdata[selection][ITEMPLURAL] = data[ITEMPLURAL]\n itemdata[selection][ITEMPOCKET] = data[ITEMPOCKET]\n itemdata[selection][ITEMPRICE] = data[ITEMPRICE]\n itemdata[selection][ITEMDESC] = data[ITEMDESC]\n itemdata[selection][ITEMUSE] = data[ITEMUSE]\n itemdata[selection][ITEMBATTLEUSE] = data[ITEMBATTLEUSE]\n itemdata[selection][ITEMTYPE] = data[ITEMTYPE]\n itemdata[selection][ITEMMACHINE] = data[ITEMMACHINE]\n writeSerialRecords(\"Data/items.dat\",itemdata)\n pbSaveItems\n end\n end\n end\n end\n }\nend",
"def add_item(list, item_name_string, quantity=1)\r\n\titem_key = item_name_string.to_sym\r\n\tlist[item_key] = quantity\r\n\treturn list\r\nend",
"def new\n @character = Character.find(params[:id])\n @item = Item.new\n end",
"def create_list(item)\r\n\tlist = {}\r\n\tnew_items = item.split(' ')\r\n\tnew_items.each do |one_item|\r\n\t\tlist[one_item] = 0\r\n\tend\r\n\tlist\r\nend",
"def create_list(items)\n\n\tgrocery_list_hash = {}\n\tlist_array = items.split(\" \")\n\n\tlist_array.each do |item|\n\t\tgrocery_list_hash.store(item.to_sym, 1)\n\tend\n\n\tgrocery_list_hash\nend",
"def item\n IITEncoder.new(@ole.Item)\n end",
"def item_by_name\n IITEncoder.new(@ole.ItemByName)\n end",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def item_rect(index)\n index -= 1 if index == @max_char\n x = index % max_col\n y = index / max_col\n n = [(@max_char - y * max_col), max_col].min\n \n x = left(n) + x * char_width\n x = width - x - 48 if not @ltr\n y = 24 + y * (line_height + 4)\n Rect.new(x, y, char_width, line_height)\n end",
"def create_items(item)\n grcy_array = item.split(\" \")\n grcy_hash = {}\n grcy_array.map do |item|\n \tgrcy_hash[item] = 0\n end\n grcy_hash\nend",
"def create_items(item)\n grcy_array = item.split(\" \")\n grcy_hash = {}\n grcy_array.map do |item|\n \tgrcy_hash[item] = 0\n end\n grcy_hash\nend",
"def add_instance_item(item)\n container = item_container(item.class)\n container[item.template_id] ||= 0\n container[item.template_id] += 1\n container[item.id] = 1\n container_list = item_container_list(item)\n container_list.push(item)\n end",
"def create_list (items)\n item_array = []\n item_array = items.split(' ')\n item_hash = {}\n item_array.each do |list_item|\n item_hash[list_item] = 0\n end\nend",
"def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \nend",
"def item_rect(index)\n rect = Rect.new(0, 0, 0, 0)\n rect.x = index % 10 * 32 + index % 10 / 5 * 16\n rect.y = index / 10 * WLH\n rect.width = 32\n rect.height = WLH\n return rect\n end",
"def create_equip_list_window\n x = @enchant_list.width; y = @enchant_list.y\n w = Graphics.width - @enchant_list.width; h = @enchant_list.height\n @equip_window = Window_EquipEnchantList.new(x, y, w, h)\n @equip_window.help_window = @help_window\n @equip_window.active = true\n @enchant_list.equip_window = @equip_window\n @equip_window.set_item(@enchant_list.item)\n @equip_window.index = 0\n @equip_window.set_handler(:ok, method(:equip_selected))\n @equip_window.set_handler(:cancel, method(:equip_unselected))\n @equip_window.viewport = @viewport1\n end",
"def draw_item(index)\n rect = item_rect(index)\n self.contents.clear_rect(rect)\n skill = @data[index]\n if skill != nil\n rect.width -= 4\n enabled = @actor.skill_can_use?(skill)\n draw_item_name(skill, rect.x, rect.y, enabled)\n self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)\n end\n end",
"def initialize(window, equipItem, rect, equipKindLabel, \n active=true, visible=true)\n super(active, visible)\n @equipItem = equipItem\n \n @cEquipKind = CLabel.new(window, rect, equipKindLabel)\n @cEquipKind.active = active\n @cEquipKind.visible = visible\n \n if equipItem != nil\n icon_index = equipItem.icon_index\n name = equipItem.name\n else\n icon_index = nil\n name = nil\n end\n \n # Changes y to draw items under the equipkind label\n temp = Rect.new(rect.x,rect.y+rect.height,rect.width,rect.height)\n \n # Determine rectangles to position controls\n rects = determine_rects(temp)\n\n @ucIcon = UCIcon.new(window, rects[0], icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cEquipName = CLabel.new(window, rects[1], name)\n @cEquipName.active = active\n @cEquipName.visible = visible\n @cEquipName.cut_overflow = true\n end",
"def add_item(attribute_hash)\n i = TempArea.new(attribute_hash)\n if @index[i.index]\n @collision_count += 1\n @duplicate_names.push(i)\n @index[i.index].temp_area.add_shape(attribute_hash)\n else\n @index.merge!(i.index => RecordLink.new(temp_area: i, geographic_area: nil))\n end\n i\n end",
"def add_item(list,name,value)\n list = List.find(list)\n list.add(Item.new(name,value))\n say_set list.name, name, value\n end",
"def create(*args)\n item = build_virtual_item(*args)\n @conglomerate.items.push(item)\n [item]\n end",
"def draw_item(index, color)\n self.contents.font.color = color\n rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)\n self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))\n self.contents.draw_text(rect, @commands[index].name)\n end",
"def add_item(list, string, integer=1)\n\tlist[string] = integer\n\treturn list\nend",
"def add_item(list, string, integer=1)\n\tlist[string] = integer\n\treturn list\nend",
"def create_list(items)\n\tcurrent_items = items.split(' ')\n\tlist = {}\n\tcurrent_items.each do |item|\n\t\tlist[item] = 1 \n\tend\n\tlist \nend",
"def generate_item_tag\n ItemTag.new(\"c#{rank}\", \"#{file_name}.xhtml\", 'application/xhtml+xml', nil)\n end",
"def add_item(list,new_item,item_count)\n\tlist[new_item] = item_count\nend",
"def create\n\t\t\tobj = []\n\t\t\t@@fonts[@font]['n'].size.times do\n\t\t\t\tobj << []\n\t\t\tend\n\t\t\tcurrent = 0\n\n\t\t\tcount = 0\n\t\t\t@text.each_byte do |c|\n\t\t\t\tif @@chars.include? c.chr\n\t\t\t\t\t@@fonts[@font][c.chr].each_with_index do |fr,ri|\n\t\t\t\t\t\tfr.each do |fc|\n\t\t\t\t\t\t\tif @rainbow\n\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@@rainbow[current], @colors[0].bg,fc)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@colors[current].fg,@colors[current].bg,fc)\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tif @rainbow != true\n\t\t\t\t\t\t\t\tcurrent += 1 if @colors.size > 1\n\t\t\t\t\t\t\t\tcurrent = 0 if current > @colors.size\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif @rainbow\n\t\t\t\t\t\tcurrent += 1\n\t\t\t\t\t\tcurrent = 0 if current >= @@rainbow.size\n\t\t\t\t\tend\n\n\t\t\t\t\tif count < @text.size-1\n\t\t\t\t\t\t@@fonts[@font]['n'].size.times do |ri|\n\t\t\t\t\t\t\t@space.times do\n\t\t\t\t\t\t\t\tif @rainbow\n\t\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@@rainbow[current], @colors[0].bg,Theme.get(:background).symbol)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@colors[current].fg,@colors[current].bg,Theme.get(:background).symbol)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t# SPace\n\t\t\t\telse\n\t\t\t\t\t@@fonts[@font]['n'].size.times do |ri|\n\t\t\t\t\t\t3.times do\n\t\t\t\t\t\t\tif @rainbow\n\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@@rainbow[current], @colors[0].bg, Theme.get(:background).symbol)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tobj[ri] << Pixel.new(@colors[current].fg,@colors[current].bg, Theme.get(:background).symbol)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\t@obj = obj\n\t\tend",
"def list_creation(items_string)\r\n\tshopping_list = {}\r\n\tintit_list = items_string.split(' ')\r\n\tintit_list.each do|item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\tshopping_list\r\nend",
"def get_item(index)\n # TODO\n end",
"def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end",
"def create_list\n @list = Array.new(6) { |i| DexButton.new(@viewport, i) }\n end",
"def build_item(item,doc)\n xml_item = Nokogiri::XML::Node.new(\"item\",doc)\n\n # Loop through each attributes of item\n item.each do |k,v|\n new_node = Nokogiri::XML::Node.new(\"#{k}\",doc)\n new_node.content = v\n xml_item.add_child(new_node)\n end\n xml_item\n end",
"def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend",
"def new_item(x = 0, y = 0, w = 1, h = 1)\n l = Layout.new\n l.sizes.set x, y, w, h\n add_item l\n end",
"def list_style(item); end",
"def create_index\n index = ''\n\n @items.each do |key, item|\n value = item.chapter == 'Y' ? '' : ' '\n index += \"<option value=\\\"#{key}\\\">#{value}#{item.title}</option>\\n\"\n end\n\n $document.at_css('#tryruby-index').inner_html = index\n $document.on(:change, '#tryruby-index') { do_goto }\n end",
"def add_item(str,list)\n list[str]=1\n list\nend",
"def create_items items\n list = RDoc::Markup::List.new :NOTE\n\n items.each do |item|\n item =~ /\\A(.*?(?:\\([^)]+\\))?):\\s*/\n\n title = $1\n body = $'\n\n paragraph = RDoc::Markup::Paragraph.new body\n list_item = RDoc::Markup::ListItem.new title, paragraph\n list << list_item\n end\n\n list\n end"
] | [
"0.7662621",
"0.7636722",
"0.7592121",
"0.72477305",
"0.7087319",
"0.70122004",
"0.6987993",
"0.6957028",
"0.6855867",
"0.6855867",
"0.66067153",
"0.66067153",
"0.6596195",
"0.6519527",
"0.630674",
"0.58808196",
"0.58012563",
"0.5765026",
"0.569752",
"0.5696452",
"0.5666526",
"0.5612162",
"0.5564795",
"0.5546372",
"0.55340934",
"0.5522377",
"0.5486522",
"0.5484407",
"0.54796845",
"0.5478991",
"0.54760706",
"0.547118",
"0.5446969",
"0.5439985",
"0.5434245",
"0.54321027",
"0.5425847",
"0.542225",
"0.5415961",
"0.5402908",
"0.53993785",
"0.5398355",
"0.5397261",
"0.5396562",
"0.53920543",
"0.5370964",
"0.53572565",
"0.53534424",
"0.5347833",
"0.53401273",
"0.5333748",
"0.5307859",
"0.52916646",
"0.528624",
"0.52772397",
"0.5276684",
"0.52708614",
"0.5269212",
"0.5263292",
"0.5249381",
"0.52412164",
"0.52402663",
"0.5234783",
"0.522268",
"0.5216789",
"0.5206299",
"0.5204611",
"0.5199509",
"0.5193336",
"0.519054",
"0.51883745",
"0.51883745",
"0.51843333",
"0.51766026",
"0.51726145",
"0.51717615",
"0.51688766",
"0.5164726",
"0.5154908",
"0.51532406",
"0.514413",
"0.51421064",
"0.5141259",
"0.5141039",
"0.5141039",
"0.51334834",
"0.5121665",
"0.5119005",
"0.51161975",
"0.51116496",
"0.51108986",
"0.5109971",
"0.51022583",
"0.51014745",
"0.51010793",
"0.5100909",
"0.50979704",
"0.50936365",
"0.50890553",
"0.50886047"
] | 0.8059416 | 0 |
puts "nyan" break end counter + 1 while counter < 11 puts counter counter = counter + 1 end def hungry_sb kitkat = 0 while < 30 puts "Give me another kitkat!" kitkat += | def hungry_person
mango= 0
until mango == 10
puts "Give me my mango! i only want #{mango}"
mango += 1
end
puts "thank you"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monkey(n)\n i = n\n loop do\n if i > 1\n p \"#{i} little monkeys jumping on the bed,\"\n p \"One fell off and bumped his head,\"\n p \"Mama called the doctor and the doctor said,\"\n p \"No more monkeys jumping on the bed\"\n else\n p \"#{i} little monkey jumping on the bed,\"\n p \"One fell off and bumped his head,\"\n p \"Mama called the doctor and the doctor said,\"\n p \"Get those monkeys right to bed!\"\n return 0 \n end\n i -= 1\n end\nend",
"def using_while\n\tlevitation_force = 6\n\twhile levitation_force < 10\n puts \"Wingardium Leviosa\"\n levitation_force += 1\n end\nend",
"def hungry_andrew\n food = 5\n \n until food == 21\n puts \"PLEASE OH PLEASE COME BACK MARIE!\"\n puts food \n food += 1 \n end\nend",
"def using_while\nlevitation_force = 6\nwhile levitation_force < 10\n puts \"Wingardium Leviosa\"\n levitation_force += 1\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end # Add an \"end\" here\nend",
"def scream(number)\r\n\r\n if number == 0\r\n print \"crickets\"\r\n elsif number > 0\r\n print \"lol\"\r\n number.times do\r\n print \"ol\"\r\n end\r\n end\r\n \r\n\r\nend",
"def yo_dawg(num)\n n.times do\n n.times do\n puts \"I put a loop in your loop so you can loop while you loop.\"\n end\n end\nend",
"def repeatHello()\n counter = 1\n while counter <= 5\n puts \"hello\"\n counter += 1\n end\nend",
"def counter_with_global_var\n score = 0\n while $count <= 10\n puts $count\n $count += 1\n end\nend",
"def hungry_river\n food = 5\n until food == 21\n puts \"please oh please give me marie back\"\n puts food \n food *= 2 \n end \nend",
"def count_sheep \n 5.times do |sheep| \n puts sheep\n if sheep >= 2\n return\n end \n end \nend",
"def cartman_hates(thing)\nwhile true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend; end",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def greeting(count)\n while count > 0\n puts 'Hello!'\n count -= 1\n end\nend",
"def beer\n i = 99\n while i >= 0\n # binding.pry\n if i > 2\n puts i.to_s + ' bottles of beer on the wall, ' + i.to_s + ' bottles of beer.'\n puts 'Take one down and pass it around, ' + (i - 1).to_s + ' bottles of beer on the wall.',''\n elsif i == 2\n puts i.to_s + ' bottles of beer on the wall, ' + i.to_s + ' bottles of beer.'\n puts 'Take one down and pass it around, ' + (i - 1).to_s + ' bottle of beer on the wall.',''\n elsif i == 1\n puts i.to_s + ' bottle of beer on the wall, ' + i.to_s + ' bottle of beer.'\n puts 'Take one down and pass it around, no more beer on the wall.',''\n else\n puts 'No more bottles of beer on the wall, no more bottles of beer. '\n puts 'Go to the store and buy some more, 99 bottles of beer on the wall.'\n end \n\n i -= 1\n end\nend",
"def runner\n # code runner here\n welcome\n num = initial_round\n \n\n until (num>21) do\n num = hit? (num)\n #num = num + x \n end\n\n puts \"Your cards add up to #{num}\"\n end_game (num)\n \n \n\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end # fix\nend",
"def ninety_nine_bottles_of_beer\n #99 bottles of beer on the wall, 99 bottles of beer.\n #Take one down and pass it around, 98 bottles of beer on the wall.\n number_of_bottles = 99\n while number_of_bottles > 1\n puts \"#{number_of_bottles} bottles of beer on the wall, #{number_of_bottles} bottles of beer\"\n puts \"Take one down and pass it around, #{number_of_bottles - 1} bottles of beer on the wall.\"\n number_of_bottles -= 1\n end\n#################################\n puts \"1 bottle of beer on the wall, 1 bottle of beer\"\n puts \"Take one down and pass it around, no more bottles of beer on the wall.\"\n#################################\n puts \"No more bottles of beer on the wall, no more bottles of beer.\"\n puts \"Go to the store and buy some more, 99 bottles of beer on the wall.\"\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n end\n 10\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n return if sheep >= 2\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\nend\nend",
"def jumping_jacks(number, energy)\n count = 0\n while count < number\n if energy >= 15\n count += 1\n energy -= 15\n puts \"Did #{count} jumping jacks, you have #{energy} energy left.\"\n else\n puts \"Waiting, #{energy} energy left.\"\n energy += 5\n end\n end\nend",
"def repeat_hi(num)\n i = 0\n while i < num\n puts \"hi\"\n i += 1\n end\nend",
"def cartman_hates(thing)\n\twhile true\n \tputs \"What's there to hate about #{thing}?\"\n end\nend",
"def counter_with_local_var\n count = 0\n while count <= 10\n puts count\n count += 1\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def hailstone2(num)\n count = 0\n\n if num == 1\n puts '1'\n puts 'HAILSTONE 2 - Number of steps: 0'\n return\n end\n\n print \"#{num} \"\n\n hailoop(num, count)\n\n puts\n puts \"HAILSTONE 2 - Number of steps: #{count}\"\nend",
"def repeat_hi(num)\n i = 0\n while i < num\n puts 'hi'\n i += 1\n end\nend",
"def cartman_hates(thing)\n\twhile true\n puts \"What's there to hate about #{thing}?\"\nend end",
"def cartman_hates(thing)\n # while true\n puts \"What's there to hate about #{thing}?\"\nend",
"def runner\n\n welcome\n counter = initial_round\n \n until counter > 21 do\n counter = hit?(counter)\n display_card_total(counter)\nend\nend_game(counter) \nend",
"def runner\n welcome\n current_total = initial_round # rand1 + rand 2 p \"total = 14\" =>14\n # puts \"initializing until loop...\"\n until current_total > 21\n # puts \"INCREMENT\"\n current_total = hit?(current_total) # \"h or s?\" h--> 14 + 4 s--> \n display_card_total(current_total)\n end\n end_game(current_total)\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n\tend\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def cartman_hates(thing)\n while true\n puts \"What's there to hate about #{thing}?\"\n end\nend",
"def ninety_nine_bottles_of_beer\n for i in 1..98\n puts \"#{100 - i} bottles of beer on the wall, #{100 - i} bottles of beer.\"\n puts \"Take one down and pass it around, #{99 - i} bottles of beer on the wall.\"\n puts \"\"\n end\n puts \"1 bottle of beer on the wall, 1 bottle of beer.\"\n puts \"Take one down and pass it around, no more bottles of beer on the wall.\"\n puts \"\"\n puts \"No more bottles of beer on the wall, no more bottles of beer.\"\n puts \"Go to the store and buy some more, 99 bottles of beer on the wall.\"\nend",
"def little_monkeys(num)\n i = num\n num.times do\n # For the last monkey, the nursery line is different\n if (i == 1)\n print \"#{i} little monkey jumping on the bed.\\n He fell off and bumped his head,\\n Mama called the doctor and the doctor said,\\n Get those monkeys right to bed!\\n\"\n else\n print \"#{i} little monkeys jumping on the bed.\\n One fell off and bumped his head,\\n Mama called the doctor and the doctor said,\\n No more monkeys jumping on the bed!\\n\"\n end\n i -= 1\n end\nend",
"def count_sheep\n\t5.times do |sheep|\n\t\tputs sheep\n\tend\nend",
"def hailstone1(num)\n count = 0\n\n if num == 1\n print \"#{num} \"\n num = (num * 3) + 1\n count += 1\n end\n\n print \"#{num} \"\n\n hailoop(num, count)\n\n puts\n puts \"HAILSTONE 1 - Number of steps: #{count}\"\nend",
"def runner\n welcome\n begnum = initial_round\n final = hit?(begnum)\n display_card_total(final)\n until final >21\n res = hit?(final)\n display_card_total(res)\n end\n puts \"Sorry, you hit #{final}. Thanks for playing!\"\nend",
"def beer_bottles(beer)\n\n while beer > 0\n p english_number(beer) + \" bottles of beer on the wall, \" + english_number(beer) + \" bottles of beeeeeer.\" + \n \" Take one down, pass it around. \" + english_number(beer-1) + \" bottles of beer on the wall.\"\n \n beer -= 1\n end\nend",
"def modify_while\n x = 0\n puts x += 1 while x<10\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def print_hello(number_of_times)\n i = 0\n while i < number_of_times\n puts \"hello\"\n i += 1\n end\nend",
"def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend",
"def looper\n for i in 1..10\n puts i\n end\nend",
"def looper \r\n for i in 1..10\r\n puts i\r\n end\r\nend",
"def beer_song number\r\n\r\n\twhile number != 0\r\n\t\tputs number.to_s + \" bottles of beer on the wall, \" + number.to_s + \" bottles of beer.\"\r\n\t\tnumber -= 1\r\n\t\tputs \"Take one down and pass it around, \" + number.to_s + \" bottles of beer on the wall.\"\r\n\t\tputs\r\n\tend\r\nend",
"def repeat_yourself(str, int)\n count = 0\n loop do\n break if count == int \n\t puts str\n count +=1\n end\nend",
"def runner\n num = 0\n until num > 21 do\n welcome\n num = initial_round\n num = hit?(num)\n display_card_total(num)\n end\n end_game(num)\nend",
"def runner\n num = 0\n welcome\n first = initial_round\n until num >= 21\n num += hit?(first)\n display_card_total(num)\n\n end\n end_game(num)\nend",
"def bark_var(i)\n i.times do\n puts \"wow!\"\n end\n end",
"def bar\n count = 0\n puts \"Welcome to HP's tavern\"\n while count <=5\n puts \"#{count} drinks\"\n puts \"What can I get ya \\n1.beer \\n2.tequila \\n3.water \\n4.Leave Tavern \"\n print'>'\n choice = gets.chomp.to_i\n if choice == 0\n puts \"try again\"\n bar\n end\n if count == 4\n dead(\"To many drink for liver to handle\")\n end\n if choice == 1 #&& count < 3\n count +=1\n puts \"Fizz beer good\"\n # puts \"#{count} drinks\"\n\n elsif choice == 2 #&& count < 3\n count += 1\n puts \"Ariibaaa salt.. shot.. lime!!\"\n\n elsif choice == 3\n dead(\"The water had Ecoli, done son\")\n elsif choice == 4 &&\n walking\n else\n dead(\"To many drink for liver to handle\")\n end\nend\nend"
] | [
"0.70303243",
"0.6988207",
"0.6977826",
"0.6949915",
"0.6896138",
"0.68927455",
"0.68828565",
"0.68824446",
"0.6852196",
"0.68253917",
"0.6818178",
"0.6788263",
"0.6782082",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744941",
"0.6744105",
"0.67430943",
"0.6727722",
"0.67101496",
"0.66952807",
"0.6665392",
"0.66459435",
"0.66459435",
"0.66459435",
"0.66459435",
"0.66459435",
"0.66459435",
"0.66459435",
"0.664426",
"0.66300803",
"0.66163",
"0.66163",
"0.66163",
"0.660762",
"0.660567",
"0.6595422",
"0.6589026",
"0.6566963",
"0.6563035",
"0.65604633",
"0.65587795",
"0.6529123",
"0.6519472",
"0.65128136",
"0.65098363",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6501074",
"0.6494112",
"0.64804775",
"0.64672166",
"0.6455576",
"0.64536095",
"0.64534646",
"0.6434585",
"0.643055",
"0.643055",
"0.643055",
"0.643055",
"0.6429594",
"0.6423201",
"0.64229053",
"0.6413318",
"0.6403091",
"0.6392184",
"0.63821757",
"0.6362042",
"0.636063",
"0.63604045"
] | 0.7084161 | 0 |
this method removes some digits from the solution to create a puzzle | def puzzle(sudoku)
sudoku.map {|x| rand < 0.75 ? 0 : x }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puzzle(sudoku)\n#this method is yours to implement\n#need to remove 2 numbers from grid\nsudoku =sudoku.dup\n# [10,20,30,40,23,45,56,76,34,56,77,21].each do |index| \n(1.upto(81).to_a.shuffle.slice(0,25)).each do |index|\n sudoku[index]=''\nend\n # random_values =Array.new(10.upto(37).to_a).shuffle\n\t# random.values.each {|index| sudoku[index] =''}\n\t# sudoku[9]=0\n\t# sudoku[5]=0\n\tsudoku\nend",
"def map_and_remove_nine(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 6 && number_to_digits[4].subset?(digits) }\n map_and_remove(9, digits, digits_to_number, number_to_digits, input)\nend",
"def map_and_remove_seven(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 3 }\n map_and_remove(7, digits, digits_to_number, number_to_digits, input)\nend",
"def map_and_remove_eight(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 7 }\n map_and_remove(8, digits, digits_to_number, number_to_digits, input)\nend",
"def solution_set_remove_zeros\n @solution_set = solution_set.map { |num| num.digits.include?(0) ? nil : num }\n @solution_set = solution_set.compact\n end",
"def map_and_remove_zero(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 6 && number_to_digits[7].subset?(digits) }\n map_and_remove(0, digits, digits_to_number, number_to_digits, input)\nend",
"def unused_digits(*a)\n numbers = [*a].join.split(\"\")\n digits_left = (0..9).to_a\n\n digits_left.length.times do |num|\n if numbers.include?(num.to_s) == true\n digits_left.delete(num)\n end\n end\n\n return digits_left.join\n\nend",
"def clear_steps arreglo\n convert = arreglo.select { |x| x.scan(/\\D/).length < 1 if x}\n convert.map! {|x| x.to_i}\n convert.reject { |x| x.to_i < 200 || x.to_i > 100000} \nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def map_and_remove_three(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 5 && number_to_digits[7].subset?(digits) }\n map_and_remove(3, digits, digits_to_number, number_to_digits, input)\nend",
"def update_possible!()\r\n\r\n #falls es keine Hits gibt, werden ale Tipps geloescht, die eine der Ziffern enthalten\r\n if (@last_hits == [0,0])\r\n @digits.times do |i|\r\n\r\n @left.delete_if{ |x|\r\n x.include?(@last_guess[i])\r\n }\r\n\r\n end\r\n\r\n end\r\n\r\n #falls es keine Black Hits gibt, werden alle Tipps mit einer identischen Stelle geloescht\r\n if @last_hits[0]==0\r\n\r\n @digits.times do |i|\r\n\r\n @left.delete_if { |x|\r\n x[i]==@last_guess[i]\r\n }\r\n end\r\n\r\n end\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Black Hits entspricht\r\n @left.delete_if { |x|\r\n @last_hits[0] != @mastermind.hits(@last_guess,x)[0]\r\n }\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Total Hits entspricht\r\n @left.delete_if { |x|\r\n (@last_hits[0] + @last_hits[1]) != (@mastermind.hits(@last_guess,x)[0]+@mastermind.hits(@last_guess,x)[1])\r\n }\r\n\r\n end",
"def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end",
"def clean number\n clean! number && number.dup\n end",
"def solve(board_string)\n board_array = []\n separated_board_string = board_string.split('')\n board_array << (separated_board_string[0..8])\n board_array << (separated_board_string[9..17])\n board_array << (separated_board_string[18..26])\n board_array << (separated_board_string[27..35])\n board_array << (separated_board_string[36..44])\n board_array << (separated_board_string[45..53])\n board_array << (separated_board_string[54..62])\n board_array << (separated_board_string[63..71])\n board_array << (separated_board_string[72..80])\n board_array\n\n# temp_array = board_array.join\n# while board_array.include?(\"-\")\n 50.times { sudoku_solver(board_array) }\n # end\n board_array\nend",
"def map_and_remove_six(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 6 }\n map_and_remove(6, digits, digits_to_number, number_to_digits, input)\nend",
"def delete_digit_x(n)\n n.digits.reverse.combination(n.digits.size-1).max.join.to_i\nend",
"def map_and_remove_four(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 4 }\n map_and_remove(4, digits, digits_to_number, number_to_digits, input)\nend",
"def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend",
"def map_and_remove_one(input, digits_to_number, number_to_digits)\n digits = input.find { |digits| digits.size == 2 }\n map_and_remove(1, digits, digits_to_number, number_to_digits, input)\nend",
"def problem_79\n digits = []\n lines = open(\"keylog.txt\").reduce([]) do |a,l|\n a << l.chomp.split(//).map(&:to_i)\n end\n p = lines.transpose\n loop do \n first = (p[0] - p[1]).uniq\n if first.length == 1\n d = first[0]\n digits << d \n puts \"Remove #{d}\"\n # shift off leading 'd' values\n lines.select {|l| l[0] == d}.map {|l| l.shift; l.push nil }\n # Rebuild out first, second, third arrays\n p = lines.transpose\n return digits.map(&:to_s).join if p.flatten.compact.length == 0\n puts \"len = #{p.flatten.compact.length}\"\n else\n raise \"Trouble - 2 candidates : #{first.inspect}, rework algorithm\"\n end\n end\nend",
"def clean\n @number.gsub!(/\\D/,\"\")\n\n if has_11_digits? and starts_with_1?\n @number = @number[1..-1] \n elsif invalid_length?\n @number = nil\n end\n end",
"def clean_numbers(original)\n number = original.delete(\"()-. \")\n\n if number.length == 10\n\n elsif number.length == 11\n if number.start_with?(\"1\")\n number = number[1..-1]\n else\n number = INVALID_PHONE\n end\n\n else\n number = INVALID_PHONE\n end\n return number\n end",
"def delete_digit(n)\n nums = []\n array = n.digits.reverse\n array.each_with_index do |int, index|\n copy = array.clone\n copy.delete_at(index)\n nums << copy.join.to_i\n end\n nums.max\nend",
"def set_solution\n if @game_mode == 1\n @solution = @solution[0..3]\n else\n @solution = []\n puts \"Very Brave of you!\"\n puts \"Enter your combination. Don't worry the computer isn't looking.\"\n 4.times do |i|\n valid = false\n puts \"Enter position #{i + 1} \"\n position = gets.chomp.to_i\n until valid\n if @solution.include?(position)\n puts \"You already entered that number. Try again:\"\n position = gets.chomp.to_i\n elsif ((position > 6) || (position < 0))\n puts \"Enter a valid number:\"\n position = gets.chomp.to_i\n else\n @solution << position\n valid = true\n end\n end \n end\n \n end\n end",
"def puzzle(sudoku,removed_cells=20)\n # this method is yours to implement\n random = (0..81).to_a.sample(removed_cells)\n @puzzled = []\n sudoku.each_with_index do |element,index|\n if random.include?(index) then @puzzled.push(0)\n else @puzzled.push(element) end\n end\n @puzzled\n # random.each { |index| sudoku[index] = 0 }\n # sudoku\nend",
"def solve\n\t\t\n\t\tcell_index = 0\n\t\t# move to the right position..\n\t\t# puts @unsolved.length.to_s + \" unknown cells!\"\n\n\t\twhile cell_index >= 0 && cell_index < @unsolved.length do\n\t\t\tcell = @unsolved[cell_index];\n\t\t\t\n\t\t\tpossible = cell.nextPossible()\t\n\n\t\t\tif possible > 9 || possible <= 0\n\t\t\t\tcell.set(0)\n\t\t\t\tcell_index -= 1\n\t\t\telse\n\t\t\t\tcell.set(possible)\n\t\t\t\tcell_index += 1\n\t\t\tend\t\t\t\t\t\t\t\n\t\tend\n\n\t\tif cell_index < 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def reduce_solution_set(secret_code)\n clue = Clues.new(guess: @guess, code: secret_code).keys\n @solution_set = @solution_set.map do |num|\n Clues.new(guess: num.digits.reverse, code: @guess).keys == clue ? num : nil\n end\n # remove the nil values just added\n @solution_set = @solution_set.compact\n end",
"def unused_digits(*num)\n digits = (0..9)\n arr = *num.join.split('')\n \n unused_digits = digits.select do |num|\n !arr.include?(num.to_s)\n end\n unused_digits.sort.join\nend",
"def delete_digit(number)\n deleted = number.digits.reverse.combination(number.digits.length - 1).to_a\n int_to_string = deleted.map do |sub_arr|\n sub_arr.map do |num|\n num.to_s\n sub_arr.join\n end\n end\n \n int_to_string.flatten.sort_by {|a| a.to_i}.last.to_i\nend",
"def map_and_remove_two_and_five(input, digits_to_number, number_to_digits)\n # 8 - 6 equals whatever character is in position c\n position_c = number_to_digits[8].difference(number_to_digits[6]).to_a.first\n\n # only 2 has position c in it\n two_digits = input.find { |digits| digits.include?(position_c) }\n new_input = map_and_remove(2, two_digits, digits_to_number, number_to_digits, input)\n\n # 5 is all that is left\n five_digits = new_input.first\n map_and_remove(5, five_digits, digits_to_number, number_to_digits, new_input)\nend",
"def clean! number\n number.gsub!(@@basic_cleaning_pattern, EMPTY_STRING) || number\n end",
"def hidden_digits(num)\r\n\t\t\tarray = num.match(/(\\d{3})-(\\d{3})-(\\d{3})/).captures\r\n\t\t\tarray2= array.join()\r\n\t\t\tarray2.gsub(/.(?=.{4})/,'*')\r\n\t\tend",
"def unused_digits (*nums)\n \"0123456789\".delete(*nums.to_s)\nend",
"def solve!\n return false unless valid?\n return @board.join if solved?\n\n unsolved = @board.index(\"0\")\n\n (1..9).each do |possible|\n @board[unsolved] = possible\n solution = Sudoku.new(@board.join).solve!\n return solution if solution\n end\n\n false\n end",
"def delete_digit(n)\n (s = n.to_s.chars).combination(s.size-1).max.join.to_i\nend",
"def solution\n 971 * (-61)\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend",
"def solution(n)\n n.to_s.reverse.scan(/\\d{1,3}/).join(',').reverse\nend",
"def unused_digits *integer_array\n remaining_nums = Array(0..9) - integer_array.flatten.join.scan(/\\d/).sort.map(&:to_i)\n remaining_nums.join.to_s\nend",
"def remove_numbers\n self.split(\"\\n\").map do |parragraph|\n parragraph unless parragraph.strip.valid_number?\n end.compact.join(\"\\n\")\n end",
"def clean_numbers(number)\n number.gsub /\\D/, ''\n end",
"def busqueda6\n 9899.step(999999999999999999999,9899){|x|break (x) unless (p x).to_s =~ /[^0-2]/}\nend",
"def set(digit)\n raise ImpossibleGrid unless @alternatives.include?(digit)\n\n @alternatives.delete(digit)\n removed_digits = @alternatives \n @alternatives = [digit]\n\n changed()\n notify_observers(@row+1, @col+1)\n\n return removed_digits\n end",
"def clear_puzzle\n @puzzle = [0] * 81\n @rows = [[], [], [], [], [], [], [], [], []]\n @columns = [[], [], [], [], [], [], [], [], []] \n @boxes = [[], [], [], [], [], [], [], [], []]\n end",
"def reevaluate_board_and_eliminate\n can_continue = false\n # iteration = 0\n while can_continue ==false\n can_continue =true\n # iteration += 1\n @squares.each do |squarename|\n if @done[squarename] = false\n if @values[squarename].length <= 1\n eliminate(squarename,@values[squarename])\n @done[squarename] = true\n can_continue = false\n end\n end\n end\n end\n end",
"def solve(puzzle, row, column = 0)\n return puzzle.flatten if column == 4\n return nil if permissible_values(puzzle, row, column).empty?\n p \"puzzle: #{puzzle}\"\n p \"row: #{row}\"\n p \"column: #{column}\"\n blank_puzzle.each { |i_in_row|\n i_in_row.each { |i_in_column|\n permissible_values(puzzle, i_in_row, i_in_column).map do |value|\n solve(update_puzzle(puzzle.dup, value, row, column), row, column + 1)\n end\n }\n }\nend",
"def solve(board)\n position = board.first_empty_position\n return board unless position\n board.options(position).each do |option|\n solution = solve(Board.new(\n board.digits[0...position] + option + board.digits[position + 1..-1]\n ))\n return solution if solution\n end\n nil\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def reduce_solved\n before = 9*9*9\n after = entropy\n while before > after\n before = after\n reduce_line\n reduce_col\n reduce_grid\n after = entropy\n end\n self\n end",
"def validate(n)\nl = n.to_s.length\ni = 0\nsplit = n.to_s.reverse.split(//).map!{|x|x.to_i}\ndestination = []\n l.times do\n if i.odd?\n if split[i] * 2 <= 9\n destination << split[i] * 2\n else\n destination << (split[i] * 2 - 9)\n end\n else \n destination << split[i] \n end\n i += 1\n end\n p destination\n if destination.reduce(:+) %10 == 0\n true\n else\n false\n end\nend",
"def double_whammer(sudoku_cells)\n\n # 1. obtain the lists of cells that still need a value\n # 2. for each cell in the list look for other cells\n # which are in the same row, column or subgrid\n # that has the same potential values\n # 3. if such cells are found, remove from other\n # cells all those values from them\n working_list = get_working_list(sudoku_cells)\n\n #Those that are of the same row/column/subgrid\n #check if any of them has the same potential values\n working_list.each do |cell_a|\n check_list = working_list.find_all do |cell_b| \n !cell_a.eql?(cell_b) && (cell_a.row == cell_b.row || cell_a.column == cell_b.column || cell_a.same_subgrid?(cell_b))\n end\n \n check_list.each do |cell|\n if cell_a.same_potential?(cell)\n #if the match is found on the same row\n if cell_a.row == cell.row\n sudoku_cells[cell_a.row].each do |x|\n if x.value.zero? && !x.eql?(cell_a) && !x.eql?(cell)\n cell_a.potential_value_stack.each {|v| x.potential_value_stack.delete(x)}\n end\n end\n elsif cell_a.column == cell.column\n i = 0\n until i >= sudoku_cells.size do\n cell_a.potential_value_stack.each do |v|\n if !sudoku_cells[i][cell_a.column].eql?(cell_a) && !sudoku_cells[i][cell_a.column].eql?(cell)\n sudoku_cells[i][cell_a.column].potential_value_stack.delete(v)\n end\n end\n i += 1\n end\n elsif cell_a.same_subgrid?(cell)\n cell_a.block_family.each do |indexes|\n if !sudoku_cells[indexes[0]][indexes[1]].eql?(cell_a) && !sudoku_cells[indexes[0][1]].eql?(cell)\n cell_a.potential_value_stack.each do |v|\n sudoku_cells[indexes[0]][indexes[1]].potential_value_stack.delete(v)\n end\n end\n end\n end\n end\n end\n end\n\n # working_list.each do |cell|\n # puts \"[#{cell.row}, #{cell.column}]\"\n # end\n # puts \"Working list: #{working_list.size}\"\n # binding.pry\nend",
"def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def prime_digit_replacement()\r\n\treturner = 1000000\r\n\t# Loop through not repeated digits\r\n\tfor digits in (11..999).step(2)\r\n\t\t# Sum of 3 repeated digits is divisable by 3\r\n\t\tnext if digits % 3 == 0\r\n\t\t# The last digit is 1, 3, 7 or 9\r\n\t\tnext if digits % 5 == 0\r\n\t\t\r\n\t\t\r\n\t\tthe_patterns = (digits < 100)? five_digit_pattern() : \r\n\t\t\t\t\t\t\t\t\t\tsix_digit_pattern()\r\n\t\t\r\n\t\tfor a_pattern in the_patterns\r\n\t\t\t# Check 'the smallest' members of '8 primes' family\r\n\t\t\tfor repeated_d in (0..2)\r\n\t\t\t\tnext if ((a_pattern[0] == 0) and (repeated_d == 0))\r\n\t\t\t\t\r\n\t\t\t\t# Create a number\r\n\t\t\t\tto_test = []\r\n\t\t\t\ttmp_digits = digits\r\n\t\t\t\tfor i in a_pattern.reverse()\r\n\t\t\t\t\tif i == 1\r\n\t\t\t\t\t\tto_test.unshift(tmp_digits % 10)\r\n\t\t\t\t\t\ttmp_digits /= 10\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tto_test.unshift(repeated_d)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\ta_number = to_test.inject(0){ |multi, val| multi*10 + val }\r\n#\t\t\t\tputs \"\\t#{a_number}\"\r\n\t\t\t\t\r\n\t\t\t\t# Check for prime\r\n\t\t\t\tif (a_number < returner) && (Prime.prime?(a_number))\r\n\t\t\t\t\t# Check for family\r\n\t\t\t\t\tfamily_size = 0\r\n\t\t\t\t\tfor i in (repeated_d..9)\r\n\t\t\t\t\t\ttmp = to_test.map{ |a| (a == repeated_d)? i : a }\r\n\t\t\t\t\t\ttmp_num = tmp.inject(0){ |multi, val| multi*10 + val }\r\n\t\t\t\t\t\tif Prime.prime?(tmp_num)\r\n\t\t\t\t\t\t\tfamily_size += 1\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\treturner = a_number if family_size > 7\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn returner\r\nend",
"def mask_with_gsub s\n s.gsub(/\\d[\\d\\s-]+\\d/) do |broad_match|\n masked = nil\n match_from = 0\n mi = 0\n broad_digits = broad_match.scan(/\\d/).map{|v| v.to_i }\n next broad_match if broad_digits.length < 14\n while true\n found, match_start, match_len = iterate(broad_digits, mi)\n if found\n mi += match_start + 1\n n = match_from\n masked = broad_match[0..-1] if not masked\n while match_start > 0\n match_start -= 1 if DIGITS[broad_match[n]]\n n += 1\n end\n match_from = -1\n while match_len > 0\n if DIGITS[broad_match[n]]\n match_from = n + 1 if match_from < 0\n masked[n] = 'X'\n match_len -= 1\n end\n n += 1\n end\n else\n break\n end\n end\n masked || broad_match\n end\n end",
"def problem8(text)\n\tdigits = text.split('').map {|x| x.to_i }\n\t\n\treturn -1 if digits.length < 5\n\ti = 0\n\tj = 4\n\t\n\tmax = 1\n\tdigits[0..4].each do |d|\n\t\tmax *= d\n\tend\n\t\n\tmaxdigits = digits[0..4]\n\t\n\tbuffernum = max\n\twhile j < (digits.length - 1)\n\n\t\t#pop left digit\n\t\tif digits[i] == 0\n\t\t\tbuffernum = 1\n\t\t\tdigits[i+1..j].each { |x| buffernum *= x}\n\t\t\tputs buffernum\n\t\telse\n\t\t\tbuffernum /= digits[i]\n\t\tend\n\t\ti += 1\n\n\t\t#push right digit\n\n\t\tj += 1\n\t\tbuffernum *= digits[j]\n\t\tif buffernum > max\n\t\t\tmax = buffernum\n\t\t\tmaxdigits = digits[i..j]\n\t\tend\n\t\t\n\n\n\tend\n\t\n puts \"Max Product : #{max}\"\n\tputs \"Max Digits : #{maxdigits}\"\n\t\n\t\nend",
"def cleanup_board(board)\n for y in (0...9)\n for x in (0...9)\n assign = 0\n for p in (1...10)\n if board[y][x][p] != 0 \n if assign == 0\n assign = board[y][x][p]\n else\n assign = 0\n break\n end\n end\n end\n if assign != 0 and board[y][x][0] == 0\n board[y][x][0] = assign\n for p in (1...10)\n board[y][x][p] = 0\n end\n end\n end\n end\n return\n end",
"def empty_puzzle\n result = []\n @amount_row.times do |index|\n result << [0]*@amount_column\n end\n result\n end",
"def solution4\n palindrome = 1000\n (900..999).each do |num1| # checks between 900-999, likely solutions are probably here\n (900..999).each do |num2|\n product = num1 * num2\n palindrome = product if palindrome?(product) && product > palindrome\n end\n end\n palindrome\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend",
"def unused_digits(*args)\n numbers = *args.join.split(\"\")\n digits = (0..9).to_a.map(&:to_s)\n \n (digits - numbers).join\n \nend",
"def solve!\n \t# keep looping if previous board doesn't match current board (new grids are being solved)\n\t \twhile true do\n\t\t \t@sudoku.each_with_index do |row, rowindex|\n\t\t \t\trow.each_with_index do |cell, cellindex|\n\t\t \t\t\t# duplicate sudoku board to solve grids and compare with previous board\n\t\t \t\t\t@sudokudup = @sudoku.dup\n\t\t \t\t\t# get the array of numbers from current column \n\t\t \t\t\tcol = @sudoku.transpose[cellindex]\n\t\t \t\t\t# find unsolved grids\n\t\t \t\t\tnext if cell != 0\n\t\t \t\t\t# form an array of possible solutions, starting with all numbers from 1 to 9\n\t\t \t\t\tsolutions=(1..9).to_a\n\t\t \t\t\t# loop through numbers from 1 to 9, delete the number from solutions if it appears in current row/column\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if row.include?(x)}\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if col.include?(x)}\n\n\t\t \t\t\t# get the numbers from current box(3x3 grid)\n\t\t \t\t\t# example (number in each grids represent column index):\n\t\t \t\t\t# | 0 1 2 | - 0 (row/array index)\n\t\t \t\t\t# | 0 1 2 | - 1\n\t\t \t\t\t# | 0 1 2 | - 2\n\t\t \t\t\t# ---------\n\t\t \t\t\t# box_x returns the array/row index of the top left number of current box (refer to sample board)\n\t\t \t\t\tbox_x = (rowindex./3)*3\n\t\t \t\t\tbox = []\n\t\t \t\t\t# loop through the 3 rows in the box\n\t\t \t\t\t3.times do\n\t\t \t\t\t\t# box_y returns the column index of the top left number of current box (refer to sample board)\n\t\t \t\t\t\tbox_y=(cellindex./3)*3\n\t\t \t\t\t\t# loop through the 3 columns for each rows\n\t\t \t\t\t\t3.times do\n\t\t \t\t\t\t\t# insert current number into the 'box' array\n\t\t \t\t\t\t\tbox << @sudoku[box_x][box_y]\n\t\t \t\t\t\t\t# get the next column index from the current row\n\t\t \t\t\t\t\tbox_y += 1\n\t\t \t\t\t\tend\n\t\t \t\t\t\t# get the next row/array index\n\t\t \t\t\t\tbox_x += 1\n\t\t \t\t\tend\n\t\t \t\t\t# delete number from solutions if it appears in current box\n\t\t \t\t\t1.upto(9) {|x| solutions.delete(x) if box.include?(x)}\n\t\t \t\t\t# if solutions contain only 1 number, the current grid will be replaced with the number\n\t\t \t\t\t@sudoku[rowindex][cellindex] = solutions[0] if solutions.length == 1\n\t\t \t\tend\n\t\t \tend\n\t\t \tif @sudoku == @sudokudup\n\t\t \t\tguess\n\t\t \t\treturn @sudoku.flatten.join\n\t\t \t\tbreak\n\t\t \tend\n\t\tend\n end",
"def solve(puzzle = @puzzle)\n #make sure we have unknown spaces\n puts \"SOLVE CALLED\"\n puzzle.propogate_constraints\n puts puzzle.present\n if puzzle.solved?\n puts \"SOLVED\"\n return puzzle\n elsif puzzle.invalid?\n puts \"INVALID\"\n return false\n else\n puts \"PUZZLE NOT SOLVED AND PUZZLE NOT INVALID\"\n new_copy = copy(puzzle)\n puts new_copy.present\n\n unknown = new_copy.spaces.select { |space| !space.known? }\n space_to_guess = unknown.sort { |a, b| a.possibilities.size <=> b.possibilities.size } [0]\n puts \"#{space_to_guess}\"\n guess = space_to_guess.possibilities.to_a[0]\n puts \"Assigning #{guess} to #{space_to_guess.coords}\"\n new_copy.assign(space_to_guess, guess)\n puts new_copy.present\n if(solve(new_copy))\n return new_copy\n else\n puts \"eliminating #{guess} from #{space_to_guess.coords}\"\n puzzle.eliminate(puzzle.get_space(space_to_guess.coords), guess)\n puzzle.propogate_constraints\n solve(puzzle)\n end\n end\n end",
"def solution(number)\n str = '' \n\n ROMAN_DIC.each_with_index do |dic, index|\n if number > 5\n if index > 0 && index < ROMAN_DIC.size - 1 && (number > (dic[0] + (ROMAN_DIC[index + 1][0] * 3)))\n str = str + ROMAN_DIC[index + 1][1] + ROMAN_DIC[index - 1][1]\n number = number - (ROMAN_DIC[index - 1][0] - ROMAN_DIC[index + 1][0])\n end \n else\n if index > 0 && index < ROMAN_DIC.size - 1 && (number > (ROMAN_DIC[index + 1][0] * 3))\n str = str + ROMAN_DIC[index + 1][1] + dic[1]\n number = number - (ROMAN_DIC[index + 1][0] + dic[0])\n end\n end \n\n while number >= dic[0]\n str = str + dic[1]\n number = number - dic[0]\n end \n end \n\n str\nend",
"def solve(arr = @input_arr)\n number_array = NumberArray.new\n pos = number_array.first_free_position arr\n # sudoku is solved, there are no free spaces in output_arr\n return arr unless pos\n ('1'..'9').each do |num|\n arr[pos] = num\n next unless number_array.valid_sudoku? pos, arr\n temp_sol = solve arr.dup\n return temp_sol if temp_sol\n end\n false\n end",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def brute_resolve(num)\n while num != 1 && num != 89 do\n num = shrink num\n end\n num\nend",
"def ispan?(x)\n #creates an array of 1..9\n a = Array.new(9) {|i| i + 1}\n for i in (0 .. 8)\n #removes when it finds the number\n a = a - [x[i].to_i]\n end\n #if all were removed, it is true\n return true if (a == [])\n return false\nend",
"def hidden_digits(num)\n\t\tarray = @deposit_account.match(/(\\d{3})-(\\d{3})-(\\d{3})/).captures\n\t\tarray2 = array.join()\n\t\tarray2.gsub(/.(?=.{4})/,'*')\n\tend",
"def solve(board_string)\n sudoku_board = string_breaker(board_string)\n i = 0\n until solved?(sudoku_board) || i == 80\n sudoku_board.each_with_index do |row, row_idx|\n row.each_with_index do |square, col_idx|\n if row[col_idx].is_a?(Array)\n row[col_idx] = solve_suite(row, square, row_idx, col_idx, sudoku_board)\n row[col_idx] = row[col_idx][0].to_i if row[col_idx].length == 1\n end\n end\n end\n i += 1\n end\n sudoku_board\nend",
"def solve(nums, target)\n bs = nil\n nums.sort.reverse.combination(2).each do |i, j|\n %I{+ - * /}.each do |op|\n next if op == :* && (i == 1 || j == 1)\n next if op == :/ && (j == 1 || i % j != 0)\n res = i.send(op, j)\n next if op == :- && res == 0\n\n return \"#{i} #{op} #{j} = #{res}\" if res == target\n\n nn = nums.dup + [res]\n nn.delete_at(nn.index(i))\n nn.delete_at(nn.index(j))\n if ss = solve(nn, target)\n bs = \"#{i} #{op} #{j} = #{res}\\n#{ss}\"\n end\n end\n end\n bs\nend",
"def validate(n)\n # reverse the number\n reversed = reverser(n)\n cleaned = cleaner(reversed)\n checker(cleaned)\n # reversed_number_string = n.to_s.reverse.chars\n # double every other number\n # doubler(reversed_number_string)\n # doubled = reversed_number_string.map.with_index do |number, index|\n # if index % 2 != 0\n # number.to_i * 2\n # else\n # number.to_i\n # end\n # end\n # check to see if each number is > 10\n # cleaned = doubler(reversed).map do |number|\n # if number / 10 >= 1\n # number - 9\n # else\n # number\n # end\n # end\n # # binding.pry\n # # if so, subtract 9\n # # if not, leave as is\n # # sum the numbers (reduce), check to see if divisbile by 10, return boolean\n # cleaned.reduce(:+) % 10 == 0\nend",
"def calculate_guess(guess, analisis)\n if analisis.nil?\n @all_guesses = (1111..6666).map(&:to_s).reject { |g| g.include?('0') }\n '1122'\n else\n @all_guesses.delete(guess)\n @all_guesses.select! { |g| 4 - (g.chars - guess.chars).size == analisis.count('?') + analisis.count('!') }\n @all_guesses.select! do |g|\n g.chars.select.with_index { |c, idx| c == guess.chars[idx] }.size == analisis.count('!')\n end\n @all_guesses[0]\n end\n end",
"def solve(board_string)\n # Get location of empty cell\n position = board_string.index(\"-\")\n return board_string if position == nil\n # Figure out which potential numbers can go into empty cell\n possible_numbers = checker(position, board_string)\n # For each potential number...\n possible_numbers.each do |number|\n # Fill in current cell with potential number\n board_string[position] = number.to_s\n # Call solve method on that modified board\n puts pretty_board(board_string)\n sleep(0.01)\n output = solve(board_string)\n # If board is solved, return solved board\n return output if solved?(output)\n end\n board_string[position] = \"-\"\n return board_string\nend",
"def cpu_get_correct_digits(result)\n to_return = []\n result.each do |guess_digit, result_digit|\n if(result_digit == \"○\")\n to_return.push(guess_digit)\n end\n end\n to_return\n end",
"def remove_invalid_combs(board, hi, combs_pre)\n board_view = board_row_from_i(board, hi)\n\n # Examples of board_view:\n # [[6], [2], [7], [3], [1], [5], [4]]\n # [[5], [3], [1, 2], [1, 2], [6], [4], [7]]\n # [[4], [6], [3], [1, 2, 3], [2], [7], [5]]\n\n fbv = board_view.flatten\n if fbv.length == SIZE\n return [fbv]\n elsif fbv.length == SIZE * SIZE\n return combs_pre\n end\n\n combs_pre.select do |c|\n board_view[0].include?( c[0] ) && board_view[1].include?( c[1] ) && board_view[2].include?( c[2] ) && board_view[3].include?( c[3] ) && board_view[4].include?( c[4] ) && board_view[5].include?( c[5] ) && board_view[6].include?( c[6] )\n end\n\n #pp '---'\n #pp board_view\n #pp '--'\n\n ##r = combs_pre.select{ |c| validate_comb(board_view, c) }\n ##r\nend",
"def solve(arr)\n answer = \"Every num has a match.\"\n arr.each do |num|\n if !arr.include?(num * -1)\n answer = num\n end\n end\n answer\nend",
"def reduce_possibility\n @input = stdin.gets.chomp\n input.each do |num| #what enum better than each? delete_if? select?\n if @possibilities.include?(num)\n deleted = @possibilities.delete(num)\n end\n end\n return @possibilities\n end",
"def removewalls \n\t\t@drawnmaze.chars.each_index do |index|\n\t\t\tif @arg[index] == \"0\" \n\t\t\t\t@drawnmaze[index] = \" \"\n\t\t\tend\n\t\tend\n\tend",
"def puzzle(sudoku)\n\tfor i in (1..65)\n\t\tb = rand(81)\n\t\tsudoku[b] = 0\n\tend\n\tsudoku\nend",
"def temp_test(sudoku_datas)\n sudoku_cells = prepare_sudoku_cells(sudoku_datas)\n # display_sudoku(sudoku_cells, \"Sudoku to solve\")\n # build the potential list of values for each cell\n build_potential_value_list(sudoku_cells)\n update_cells(sudoku_cells) # update the value of each cell\n counter = 0\n # continue to the try to solve\n # if the counter goes beyond a million\n # it's probably a bad sudoku\n \n display_sudoku(sudoku_cells, \"Test\")\n shed_potential_value_list(sudoku_cells)\n \n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n double_whammer(sudoku_cells)\n update_cells(sudoku_cells)\n display_sudoku(sudoku_cells, \"Test\")\n \nend",
"def clean_digit_lines(separated_digit_lines)\n separated_digit_lines.each do |chunk|\n chunk.delete_at(3)\n if chunk[0].length == 0\n chunk[0] = \" \"\n end\n end\nend",
"def guess\n \t# loop 1\n\t while true do\n\t\t @sudoku.each_with_index do |row, rowindex|\n\t\t row.each_with_index do |cell, cellindex|\n\t\t \t# *******************************************************\n\t\t \t# this part same as solve! method\n\t\t col = @sudoku.transpose[cellindex]\n\t\t # return to previous loop (loop 2) if sudoku board is completely solved\n\t\t return if !@sudoku.flatten.include?(0)\n\t\t next if cell != 0\n\t\t solutions=(1..9).to_a\n\t\t 1.upto(9) {|x| solutions.delete(x) if row.include?(x)}\n\t\t 1.upto(9) {|x| solutions.delete(x) if col.include?(x)}\n\t\t box_x=(rowindex./3)*3\n\t\t box=[]\n\t\t 3.times do\n\t\t \tbox_y=(cellindex./3)*3\n\t\t \t3.times do\n\t\t \t\tbox << @sudoku[box_x][box_y]\n\t\t \t\tbox_y += 1\n\t\t \tend\n\t\t box_x += 1\n\t\t \tend\n\t\t \t\t1.upto(9) {|x| solutions.delete(x) if box.include?(x)}\n\t\t \t\t# *******************************************************\n\t\t \t\t# return to previous loop/previous unsolved grid(loop 2) if no solutions found for current grid\n\t\t \treturn if solutions == []\n\t\t \tsolutions_index = 0\n\t\t \t# loop through each number in solutions array (loop 2)\n\t\t \twhile true do\n\t\t \t\t# replace current grid with a number with in solutions\n\t\t\t @sudoku[rowindex][cellindex] = solutions[solutions_index]\n\t\t\t # call itself\n\t\t\t guess\n\t\t\t # code start from this line if no solution found from previous recursion (from return if solutions == [])\n\t\t\t # break the loop if sudoku board is completely solved\n\t\t\t break if !@sudoku.flatten.include?(0) \n\t\t\t # change index to the next number in solutions\n\t\t\t solutions_index += 1\n\t\t\t \tif rowindex == 0 && cellindex ==0 && solutions_index == solutions.length\n\t\t\t\t \t@sudoku[rowindex][cellindex] = 0\n\t\t\t\t \t# stop recursion and goes to next loop(loop 1) if no solutions found at all\n\t\t\t\t \tbreak\n\t\t\t \telsif solutions_index == solutions.length\n\t\t\t \t@sudoku[rowindex][cellindex] = 0\n\t\t\t \t# return to previous loop/previous unsolved grid(loop 2) if no solutions found for current grid\n\t\t\t \treturn\n\t\t\t \tend\n\t\t \tend\n\t \tend\n\t \tend\n \tend\n end",
"def removNb(n)\n numbers = (1..n).to_a\n all_combinations = numbers.combination(2).to_a\n possible_pairs = []\n sum = numbers.reduce(:+)\n all_combinations.each do |pair|\n if (sum - pair.reduce(:+)) == pair.reduce(:*)\n possible_pairs << pair\n possible_pairs << pair.reverse\n end\n end\n possible_pairs\nend",
"def featured(int)\n int += 1\n int += 1 until int % 7 == 0 && int.odd?\n \n loop do\n double_check = int.to_s.split(\"\")\n if double_check.uniq == double_check\n return int\n else\n int += 14\n end \n break if int >= 9_876_543_210 \n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def validSolution(board)\n array_of_boxes = Array.new\n box = Array.new\n i = 0\n\n add_box_array = lambda do\n 3.times do\n 3.times do\n row = board[i]\n box.push(row[0]).push(row[1]).push(row[2])\n i += 1\n end\n\n array_of_boxes << box\n box = Array.new\n end\n end\n\n reset_and_rotate = lambda do\n i = 0\n board.each{ |row| row.rotate!(3) }\n end\n\n add_reset_rotate = lambda do\n add_box_array.call\n reset_and_rotate.call\n end\n\n 2.times {add_reset_rotate.call}\n add_box_array.call\n all_possible_arrays = (1..9).to_a.permutation.to_a\n\n # each row & each column is a unique permutation of base_array\n board.all?{ |row| all_possible_arrays.include?(row) } &&\n board.uniq.size == 9 &&\n board.transpose.all?{ |column| all_possible_arrays.include?(column) } &&\n board.transpose.uniq.size == 9 &&\n array_of_boxes.all? { |box| all_possible_arrays.include?(box) }\nend",
"def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend",
"def solution(number)\n roman_numeral = { 1 => 'I', 4 => 'IV', 5=> 'V', 6 => 'VI', 10=> 'X', 50=> 'L', 100=> 'C', 500=> 'D', 1000=> 'M' }\n numbers = number.digits.map.with_index{ |int, idx| int * 10**idx }\n numbers.map{ |number| roman_numeral[number] }.reverse.join\nend",
"def Dragon n\n return '' unless n.is_a?(Integer) && n >= 0 \n\n string = 'Fa'\n n.times do\n string = string.gsub(/[ab]/, 'a' => 'aRbFR', 'b' => 'LFaLb') \n end\n string.gsub(/[ab]/, '')\nend",
"def solve_sudoku(board, empty_positions)\n i = 0\n\n while i < empty_positions.length\n rrow = empty_positions[i][0]\n ccolumn = empty_positions[i][1]\n number = board[rrow][ccolumn] + 1\n found = false\n\n while !found && number <= 9\n if check_value(board, rrow, ccolumn, number)\n found = true\n board[rrow][ccolumn] = number\n i += 1\n else\n number += 1\n end\n end\n\n if !found\n board[rrow][ccolumn] = 0\n i -= 1\n end\n end\n \n board\nend",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def check4aces num\n \tnum.each do |x|\n\t\tif x == 11\n\t\t\t@pScore.delete(11)\n\t\t\t@pScore << 1\n\t\tend\n\tend\n end",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number > 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def reduce_possibilities!\n @status = :impossible unless valid?\n @possibilities.each_with_index do |row, i|\n break if @status == :impossible\n row.each_with_index do |cell, j|\n break if @status == :impossible\n next if cell.length == 1\n\n neighbors = find_row_neighbors(i, j) + find_col_neighbors(i, j) + find_square_neighbors(i, j)\n @possibilities[i][j] -= neighbors\n if @possibilities[i][j].length == 0\n @status = :impossible\n elsif @possibilities[i][j].length == 1\n @board[i][j] = @possibilities[i][j][0]\n end\n end\n end\n end",
"def remove_invalid_combs(board, hi, combs_pre)\n board_view = board_row_from_i(board, hi)\n r = combs_pre.select{ |c| validate_comb(board_view, c) }\n r\nend",
"def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def load_puzzle\n puzzle_filename = ARGV[0]\n raise 'No puzzle file given' unless puzzle_filename\n puzzle_str = File.read(puzzle_filename)\n puzzle_str.gsub(/[^0-9\\.]/, '')\nend",
"def generate_solution\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n until ary.count(0).zero?\n ary.each_with_index do |num, ind|\n row = calculate_area(ind + 1, :row)\n col = calculate_area(ind + 1, :col)\n box = calculate_area(ind + 1, :box)\n row_neighbours = tile_range.to_a.select {|n| calculate_area(n, :row).eql? row}\n col_neighbours = tile_range.to_a.select {|n| calculate_area(n, :col).eql? col}\n box_neighbours = tile_range.to_a.select {|n| calculate_area(n, :box).eql? box}\n neighbours = (row_neighbours + col_neighbours + box_neighbours).uniq!.map {|n| n -= 1}\n neighbouring_values = []\n neighbours.each {|n| neighbouring_values << ary[n]}\n options = (0..area_size).to_a.reject! {|x| neighbouring_values.compact.include?(x)}\n if options == []\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n break\n end\n ary[ind] = options.sample\n end\n end\n return ary.join\n end",
"def first_puzzle a\n # write down your solution to puzzle 1 here\nend",
"def strip_non_digits\n country_code.gsub!(/[^\\d]/, '') unless country_code.blank?\n local_number.gsub!(/[^\\d]/, '') unless local_number.blank?\n extension.gsub!(/[^\\d]/, '') unless extension.blank?\n end",
"def\treduced_form(objets_g, objets_d)\n\tobjets_g.each do |objetg|\n\t\tobjets_d.each do |objetd|\n\t\t\tif objetg.puissance == objetd.puissance\n\t\t\t\tif objetg.signe == '-'\n\t\t\t\t\tobjetg.number = -(objetg.number)\n\t\t\t\tend\n\t\t\t\tif objetd.signe == '-'\n\t\t\t\t\tobjetd.number = -(objetd.number)\n\t\t\t\tend\n\t\t\t\tobjetg.number = objetg.number + (-1 * objetd.number)\n\n\t\t\t\tif objetg.number < 0 && objetg.signe == '+'\n\t\t\t\t\tobjetg.signe = '-'\n\t\t\t\tend\n\t\t\t\tobjetg.number = objetg.number.round(2)\n\t\t\t\tobjets_d.delete(objetd)\n\t\t\tend\n\t\tend\n\tend\n\tobjets_g.each do |objetg|\n\t\tif objetg.number == 0\n\t\t\tobjets_g.delete(objetg)\n\t\tend\n\tend\n\tobjets_d.each do |objetd|\n\t\tif objetd.number != 0\n\t\t\tobjets_g << objetd\n\t\tend\n\tend\nend"
] | [
"0.6630241",
"0.6603103",
"0.6479867",
"0.645885",
"0.643311",
"0.6350987",
"0.63352233",
"0.6247261",
"0.6136404",
"0.6121963",
"0.611602",
"0.61033034",
"0.60841864",
"0.6058191",
"0.6054813",
"0.5986607",
"0.5978528",
"0.5911764",
"0.5894846",
"0.5894596",
"0.5866746",
"0.58367157",
"0.5835396",
"0.58019614",
"0.5787534",
"0.57873696",
"0.57810813",
"0.57694715",
"0.5755087",
"0.57455266",
"0.5737669",
"0.5722163",
"0.5690774",
"0.5677357",
"0.5665508",
"0.5651061",
"0.56494457",
"0.56379557",
"0.5632509",
"0.5628051",
"0.5606757",
"0.55903995",
"0.5537954",
"0.55295",
"0.5527952",
"0.5527265",
"0.5523301",
"0.55201966",
"0.551396",
"0.5502437",
"0.5494283",
"0.54903966",
"0.54892415",
"0.54857635",
"0.54808176",
"0.54646796",
"0.5463697",
"0.54538566",
"0.54254055",
"0.5411165",
"0.54066384",
"0.54061514",
"0.53906137",
"0.5387124",
"0.5385482",
"0.53796434",
"0.5373684",
"0.53712565",
"0.53299314",
"0.5309739",
"0.5309099",
"0.53068787",
"0.5305881",
"0.53039443",
"0.5301373",
"0.5299229",
"0.5298893",
"0.5295254",
"0.528458",
"0.528399",
"0.52810144",
"0.5273005",
"0.52636117",
"0.5263076",
"0.5260966",
"0.52553105",
"0.5243294",
"0.5239356",
"0.5235632",
"0.52349204",
"0.5231397",
"0.52275074",
"0.52234316",
"0.5222114",
"0.5216291",
"0.5209641",
"0.5207306",
"0.5206503",
"0.52048165",
"0.52046674",
"0.520454"
] | 0.0 | -1 |
return the move a piece in danger can use | def escaping_moves(board)
# all_possible_moves(board).map{}
# p pieces_in_danger(board)
pieces_in_danger = pieces_in_danger(board)
positions_of_pieces_in_danger = pieces_in_danger.map(&:pos)
# p "Printing pieces in danger..."
# p positions_of_pieces_in_danger
safe_moves(board).select { |move| positions_of_pieces_in_danger.include?(move.first) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPiece move\n case move[0]\n when /^[Pa-h]/\n return Pawn.new(@colour)\n when \"R\" \n return Rook.new(@colour)\n when \"N\" \n return Knight.new(@colour)\n when \"B\"\n return Bishop.new(@colour)\n when \"Q\"\n return Queen.new(@colour)\n when \"K\" \n return King.new(@colour)\n else \n return false\n end\n end",
"def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end",
"def en_passant_make_move\n piece = current_player.selected_piece\n return unless piece.piece_name == 'Pawn'\n return if piece.en_passant_move.nil?\n\n piece.pawn_move\n end",
"def get_move\n @players[0].get_move(@board)\n end",
"def side_moving\n return @piece_moving.side if @piece_moving\n end",
"def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend",
"def move_piece(move_string)\n raise BoardLockedError, \"Board was set from FEN string\" if @fen\n (move, extended) = *move_string.match(/^([a-h][1-8][a-h][1-8])([a-z]{1}?)$/)[1..2]\n\n start_pos = move.downcase.split('')[0..1].join\n end_pos = move.downcase.split('')[2..3].join\n (piece, player) = get_piece(start_pos)\n\n place_piece(player, piece, end_pos)\n clear_position(start_pos)\n\n if extended.to_s.size > 0\n if %w[q r b n].include?(extended)\n place = move.split('')[2..3].join\n p, player = get_piece(place)\n log(\"pawn promotion: #{p} #{player}\")\n place_piece(player, piece_name(extended), place)\n else\n raise UnknownNotationExtensionError, \"Unknown notation extension: #{move_string}\"\n end\n end\n\n # detect castling\n if piece == :king\n start_rank = start_pos.split('')[1]\n start_file = start_pos.split('')[0].ord\n end_file = end_pos.split('')[0].ord\n if(start_file - end_file).abs > 1\n # assume the engine knows the rook is present\n if start_file < end_file # king's rook\n place_piece(player, :rook, \"f#{start_rank}\")\n clear_position(\"h#{start_rank}\")\n elsif end_file < start_file # queen's rook\n place_piece(player, :rook, \"d#{start_rank}\")\n clear_position(\"a#{start_rank}\")\n else\n raise \"Unknown castling behviour!\"\n end\n end\n end\n\n @moves << move_string\n end",
"def move(move)\n\n \n \n \n \n\n if @rules.isCastleShort?(move)\n if move.piece.colour == :white\n r = \"h1\" ; r2 = \"f1\";\n else\n r = \"h8\"; r2= \"f8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n elsif @rules.isCastleLong?(move)\n if move.piece.colour == :white\n r = \"a1\" ; r2 = \"d1\";\n else\n r = \"a8\"; r2= \"d8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n end\n\n @pieces[move.piece.colour][move.piece.class.to_s.to_sym].delete(move.from)\n setSquare(move.from, nil)\n move.piece.firstMove = false\n setSquare(move.to, move.piece)\n\n return self\n end",
"def move_piece(move, color) \n squares = find_start_and_end(move) # [start, end]\n\n return false if @display[squares[0][0]][squares[0][1]].guest == ' '\n\n start_piece = @display[squares[0][0]][squares[0][1]].guest\n\n return false if start_piece.color != color \n\n moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0]))\n\n\n if moves.include?(squares[1])\n\n # castling\n if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] \n make_move(squares[0], squares[1], start_piece)\n make_move([7, 0], [7, 2], @display[0][0].guest)\n elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == []\n make_move(squares[0], squares[1], start_piece)\n make_move([0, 0], [0, 2], @display[7][0].guest)\n\n # pawn -> queen upgrade\n elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero?\n make_move(squares[0], squares[1], Queen.new('white'))\n elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7\n make_move(squares[0], squares[1], Queen.new('black'))\n\n else\n make_move(squares[0], squares[1], start_piece)\n end\n else\n false\n end\n end",
"def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end",
"def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end",
"def move_piece(piece_name, team, coordinate)\n\t\tpieces = @board.get_pieces(piece_name, team)\n\t\tcan_move = []\n\t\tpieces.each do |piece|\n\t\t\tcan_move << piece if @board.can_move?(piece, coordinate)\n\t\tend\n\t\t#CHECK CASTLING\n\t\tif piece_name == \"King\"\n\t\t\tunless pieces[0].has_moved \n\t\t\t\tif check_castle(team, coordinate)\n\t\t\t\t\tcastle(team, coordinate)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#if there are no pieces on that team that can move there, return false\n\t\tif can_move.length == 0\n\t\t\t#puts \"RETURNING FALSE!1\"\n\t\t\treturn false\n\t\t#if there are more than 1 piece list all of the pieces and give the option to choose\n\t\telsif can_move.length >1\n\t\t\tgoodInput = false\n\t\t\tuntil goodInput == true\n\t\t\t\tputs \"Which of the following pieces would you like to move?\"\n\t\t\t\tcan_move.each_with_index do |piece, index|\n\t\t\t\t\tputs \"#{index + 1} : #{piece.name} at [#{piece.xCord},#{piece.yCord}]\"\n\t\t\t\tend\n\t\t\t\tputs \"Alternatively, enter -1 to quit out of this selection and invalidate the move.\"\n\t\t\t\tindex = gets.chomp.to_i - 1\n\t\t\t\treturn false if index == -2 \n\t\t\t\tgoodInput = true if @board.move_piece(can_move[index], coordinate)\n\t\t\t\tputs \"Incorrect input!\" unless goodInput\n\t\t\tend\n\t\t\t#puts \"RETURNING TRUE!2\"\t\t\t\n\t\t\treturn true\n\t\t#if there's one piece, call the move method\n\t\telsif can_move.length == 1\n\t\t\tmoved = @board.move_piece(can_move[0], coordinate)\n\t\t\t#puts \"RETURNING TRUE!3\" if moved\n\t\t\t#puts \"RETURNING FALSE!3\" if !moved\n\t\t\treturn moved\n\t\tend\n\t\treturn false\n\tend",
"def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end",
"def validate_move(piece, to_pos)\n if piece.regular_moves.include?(to_pos) # if its a regular move\n return \"regular\"\n elsif piece.jump_moves.include?(to_pos) # if its a jump move\n return \"jump\"\n else # if it is not a valid move\n return nil\n end\n end",
"def notate\n # allow calling outside of activerecord lifecycle\n analyze_board_position unless @board\n\n mynotation = @piece_moving.abbrev.upcase.sub('P', from_coord.file)\n \n # disambiguate which piece moved if a 'sister_piece' could have moved there as well\n if( @piece_moving.function==:rook) || (@piece_moving.function==:knight)\n mynotation = mynotation.file\n\n # look for a piece of the same type which also could have moved \n sister_piece_pos, sister_piece = @board.consider_move(self) do |b|\n b.sister_piece_of(@piece_moving, from_coord)\n end\n\n if( sister_piece != nil && sister_piece.allowed_moves(@board).include?(to_coord.to_sym) )\n mynotation += ( from_coord.file != sister_piece_pos.file) ? from_coord.file : from_coord.rank.to_s\n end\n end\n \n if @piece_moved_upon && (@piece_moving.side != @piece_moved_upon.side) || @board.en_passant_capture?( from_coord, to_coord )\n mynotation += 'x' \n captured = true\n end\n\n #notate the destination square - a straight append except for noncapturing pawns\n mynotation = '' if( (@piece_moving.function==:pawn) && !captured )\n mynotation += to_coord\n \n #castling 3 O's if queenside otherwise 2 O's\n if castled == 1\n mynotation = 'O-O' + ((to_coord.file=='c') ? '-O' : '' ) \n end\n\n #promotion\n if @piece_moving.function == :pawn && to_coord.to_s.rank == @piece_moving.promotion_rank\n mynotation += \"=#{promotion_choice || 'Q'}\"\n end\n \n #check/mate\n mynotation += '+' if @board.consider_move(self) do |b|\n b.in_check?( @piece_moving.side==:white ? :black : :white )\n end\n\n return mynotation\n end",
"def move board\n free_pieces = board.free_pieces\n piece = free_pieces.random\n moves = board.possible_moves(piece)\n return [piece.x, piece.y], moves.random \n end",
"def get_move\n\t\tif(row_winning_move)\n\t\t\treturn row_winning_move\n\t\tend\n\t\tif(column_winning_move)\n\t\t\treturn column_winning_move\n\t\tend\n\t\tif(left_diag_winning_move)\n\t\t\treturn left_diag_winning_move\n\t\tend\n\t\tif(right_diag_winning_move)\n\t\t\treturn right_diag_winning_move\n\t\tend\n\n\t\t[rand(3), rand(3)]\n\tend",
"def pawn_move\n position_index = Generic.find_square_index(en_passant_move, board)\n\n colour == 'White' ? pawn_move_white(position_index) : pawn_move_black(position_index)\n end",
"def normal_moves\n direction = NORMAL_MOVES[self.color]\n \n [check_validity(direction)]\n \n if pos_valid \n item_at_pos = @board.get_piece(current_row,current_col)\n \n if item_at_pos.nil? || item_at_pos.color != self.color\n [current_row, current_col]\n end\n end\n \nend",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move? piece, square\n if square.piece.nil? || square.piece.color != piece.color\n case piece.symbol\n\n when \"♟︎\", \"♙\"\n # Return true if square is adjacent and in the correct direction for pawn of that color\n pawn_move?(piece, square)\n when \"♞\", \"♘\"\n # Return true if move is an 'L' shape\n knight_move?(piece.square, square)\n when \"♝\", \"♗\"\n # Return true if move is diagonal and the path is not blocked by a piece\n if bishop_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♜\", \"♖\"\n # Return true if move is vertical/horizontal and path not blocked by a piece\n if rook_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♛\", \"♕\"\n # Return true if move is a straight line and path is not blocked by a piece\n if queen_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♚\", \"♔\"\n # Return true if move is in any direction but only to an adjacent square, and the square is not under attack from a piece\n king_move?(piece, square)\n else\n false\n end\n else\n false\n end\n end",
"def select_piece\n piece_pos = get_piece_locations.sample\n return select_piece if @board[piece_pos].valid_moves.empty?\n piece_pos\n end",
"def get_move\n STDOUT.print(\"\\tPlayer #{self.name}/#{self.type} -- \" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect}\" +\n \" // side: #{@move_side.inspect}\\n\") if $VERBOSE\n # play center\n if rand(2) > 0 && !@move_center.empty? # plus some randomness for IA vs IA\n # maybe a problem - if it the only valid move!\n m = _play_center\n return m if m > 0\n end\n # play opposite corner\n if !@move_corner.empty?\n m = _find_free_opp_corner\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying corner...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n # play opposite side\n if !@move_side.empty?\n m = _find_free_side\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying side...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n raise ArgumentError,\n \"No more move to play for #{self.name} / #{self.type} /\\n\" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect} // side: #{@move_side.inspect}\"\n end",
"def handle_one_move(str, sente=nil)\n if (str =~ /^([\\+\\-])(\\d)(\\d)(\\d)(\\d)([A-Z]{2})/)\n sg = $1\n x0 = $2.to_i\n y0 = $3.to_i\n x1 = $4.to_i\n y1 = $5.to_i\n name = $6\n elsif (str =~ /^%KACHI/)\n raise ArgumentError, \"sente is null\", caller if sente == nil\n if (good_kachi?(sente))\n return :kachi_win\n else\n return :kachi_lose\n end\n elsif (str =~ /^%TORYO/)\n return :toryo\n else\n return :illegal\n end\n \n if (((x0 == 0) || (y0 == 0)) && # source is not from hand\n ((x0 != 0) || (y0 != 0)))\n return :illegal\n elsif ((x1 == 0) || (y1 == 0)) # destination is out of board\n return :illegal\n end\n \n if (sg == \"+\")\n sente = true if sente == nil # deprecated\n return :illegal unless sente == true # black player's move must be black\n hands = @sente_hands\n else\n sente = false if sente == nil # deprecated\n return :illegal unless sente == false # white player's move must be white\n hands = @gote_hands\n end\n \n ## source check\n if ((x0 == 0) && (y0 == 0))\n return :illegal if (! have_piece?(hands, name))\n elsif (! @array[x0][y0])\n return :illegal # no piece\n elsif (@array[x0][y0].sente != sente)\n return :illegal # this is not mine\n elsif (@array[x0][y0].name != name)\n return :illegal if (@array[x0][y0].promoted_name != name) # can't promote\n end\n\n ## destination check\n if (@array[x1][y1] &&\n (@array[x1][y1].sente == sente)) # can't capture mine\n return :illegal\n elsif ((x0 == 0) && (y0 == 0) && @array[x1][y1])\n return :illegal # can't put on existing piece\n end\n\n tmp_board = deep_copy\n return :illegal if (tmp_board.move_to(x0, y0, x1, y1, name, sente) == :illegal)\n return :oute_kaihimore if (tmp_board.checkmated?(sente))\n tmp_board.update_sennichite(sente)\n os_result = tmp_board.oute_sennichite?(sente)\n return os_result if os_result # :oute_sennichite_sente_lose or :oute_sennichite_gote_lose\n return :sennichite if tmp_board.sennichite?\n\n if ((x0 == 0) && (y0 == 0) && (name == \"FU\") && tmp_board.uchifuzume?(sente))\n return :uchifuzume\n end\n\n move_to(x0, y0, x1, y1, name, sente)\n\n update_sennichite(sente)\n return :normal\n end",
"def moversPieces\n case @whitesMove\n when true then return whitePieces\n when false then return blackPieces\n end\n end",
"def move_piece(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column] \n new_location = [to_row, to_column]\n @state[to_row][to_column] = piece.class.new(piece.color, new_location)\n @state[from_row][from_column] = nil\n \n moved_piece = @state[to_row][to_column]\n if moved_piece.class == Pawn\n special_pawn_rules(moved_piece, from_row, to_column)\n end\n # Once a move has been made, disallow\n disallow_all_en_passant(piece.color) # taking en_passant on enemy pawns \n end",
"def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end",
"def do_the_move(move)\n @log.debug \"do_the_move #{move.move_to_str}\"\n color, row_s, col_s, row_e, col_e, movetype = strip_pos_argument(move)\n \n if check_if_moveisvalid(move) == :invalid\n @log.debug \"invalid move #{argument}, info#{@last_move_error}\"\n return\n end\n start_item = @infosquare[row_s][col_s]\n end_item = @infosquare[row_e][col_e]\n if movetype == :shortcastle or movetype ==:longcastle\n move_castle(start_item, end_item)\n elsif movetype == :enpassant\n col_enp = end_item.column_start\n row_enp = start_item.row_start\n eated_item = @infosquare[row_enp][col_enp]\n eated_item.clear\n BoardInfoItem.exchange(start_item, end_item)\n elsif movetype == :promotion\n BoardInfoItem.exchange(start_item, end_item)\n end_item.setinfo(move.promoted, move.color)\n else\n if @infosquare[row_s][col_s].type_piece == :vuoto\n raise \"Invalid board state, try to move an empty cell\"\n end\n BoardInfoItem.exchange(start_item, end_item)\n end\n move.fen_after_move = calculate_current_fen\n \n @last_moved_item = end_item\n @moves_in_match << move\n end",
"def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend",
"def get_move(game_board)\n position = game_board.index(\"\") # get the index of the first open position\n move = @moves[position] # get the corresponding location for the index\n end",
"def get_computer_move\r\n \r\n #Define and array containing a list of three possible moves\r\n moves = [\"ROCK\", \"PAPER\", \"SCISSORS\"]\r\n \r\n #Generate and return a random number between 0 and 2\r\n randomNo = rand(3)\r\n \r\n #Return a randomly selected move to the calling statement\r\n return moves[randomNo] \r\n \r\n end",
"def get_move\n cols = %w(a b c d e f g h)\n rows = %w(8 7 6 5 4 3 2 1)\n\n from_pos, to_pos = nil, nil\n until from_pos && to_pos\n @display.draw\n if from_pos\n row, col = from_pos\n piece = @display.board[from_pos].class\n puts \"#{piece} at #{cols[col]}#{rows[row]} selected. Where to move to?\"\n to_pos = @display.get_keyboard_input\n else\n @display.reset_errors_notification\n puts \"#{@color.capitalize}'s move\"\n puts 'What piece do you want to move?'\n selection = @display.get_keyboard_input\n from_pos = selection if selection && valid_selection?(selection)\n end\n end\n [from_pos, to_pos]\n end",
"def move_legality_pawn(to, piece)\n diagonals_possible = piece.possible_next_moves(all_occupied_spaces)[0]\n front_possible = piece.possible_next_moves(all_occupied_spaces)[1]\n ((diagonals_possible.include?(to) && all_occupied_spaces.include?(to)) || (front_possible.include?(to) && board[to[0]][to[1]] == ' '))\n end",
"def breed_move\n return data.breed_moves\n end",
"def move_pawn(p1)\n col = get_col_from_index(p1)\n valid = []\n\n # Piece color defines direction of travel. Enemy presence defines\n # the validity of diagonal movements\n if Move.color == :red\n valid << (p1 - 8) if unoccupied?(p1 - 8)\n valid << (p1 - 7) if piece_color(p1 - 7) == Move.enemy_color && col < 8\n valid << (p1 - 9) if piece_color(p1 - 9) == Move.enemy_color && col > 1\n # Only if the pieces is unmoved, can it move forward two rows\n valid << (p1 - 16) if !Move.pieces[p1][:moved] && unoccupied?(p1 - 8) && unoccupied?(p1 - 16)\n\n elsif Move.color == :black\n\n valid << (p1 + 8) if unoccupied?(p1 + 8)\n valid << (p1 + 7) if piece_color(p1 + 7) == Move.enemy_color && col > 1\n valid << (p1 + 9) if piece_color(p1 + 9) == Move.enemy_color && col < 8\n valid << (p1 + 16) if !Move.pieces[p1][:moved] && unoccupied?(p1 + 8) && unoccupied?(p1 + 16)\n end\n\n valid\n end",
"def try_move_piece(move)\n raise InputError.new unless valid_format?(move)\n from = translate_move_notation(move[0..1])\n to = translate_move_notation(move[-2..-1])\n raise PieceNotOwnedError.new if !@board.occupied?(from) ||\n @board.color(from) != @current_player.color\n raise IllegalMoveError.new unless @board.move_legal?(from, to)\n raise CheckError.new if @board.leaves_self_in_check?(from, to, @current_player.color)\n @board.move_piece(from, to)\n end",
"def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"def getPossibleFrom move\n possibleFrom = []\n move.board.pieces[move.piece.colour][move.piece.class.to_s.to_sym].each do |coord, piece|\n possibleFrom << coord\n end\n possibleFrom\n end",
"def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end",
"def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend",
"def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end",
"def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend",
"def pawn_move_type(player, coord_string, from_row, _from_col, to_row, to_col)\n if ((player == :white && from_row == 4) ||\n (player == :black && from_row == 3)) &&\n board.square(from_row,to_col) && board.square(from_row,to_col).passantable\n :passant\n elsif (player == :white && from_row == 6 && to_row == 7) ||\n (player == :black && from_row == 1 && to_row == 0)\n\n if m = coord_string.match(/(\\w)(\\d)(R|K|N|B|Q)/)\n case m[3]\n when 'R'\n :promote_rook\n when 'N'\n :promote_knight\n when 'K'\n :promote_knight\n when 'B'\n :promote_bishop\n when 'Q'\n :promote_queen\n else\n messages << 'ERROR: Not a valid promotion piece.'\n :illegal\n end\n else\n messages << 'ERROR: Must choose a promotion piece (R, N, B, or Q).'\n :illegal\n end\n else\n # Not passant or promotion\n :normal\n end\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def moves\n end",
"def get_moves; raise NotImplementedError end",
"def move_piece(position_array)\n\n old_position = position_array[0]\n piece_to_move = board_obj.board[old_position[0]][old_position[1]]\n\n castling_move(position_array) if piece_to_move.instance_of?(King)\n pawn_move_two(position_array) if piece_to_move.instance_of?(Pawn)\n\n board_obj.board[old_position[0]][old_position[1]] = \" \"\n\n new_position = position_array[1]\n\n piece_to_move.new_position(new_position)\n new_square = board_obj.board[new_position[0]][new_position[1]]\n\n if enpassant_square(new_position)\n rank = new_position[0]\n file = new_position[1]\n\n adjust = piece_to_move.colour == 'WHITE' ? -1 : 1\n if board_obj.board[rank + adjust][file].instance_of?(Pawn)\n remove_piece(board_obj.board[rank+adjust][file])\n board_obj.board[rank + adjust][file] = ' '\n end\n\n end\n\n if new_square != \" \"\n remove_piece(new_square)\n @piece_taken = true\n else\n @piece_taken = false\n end\n\n board_obj.board[new_position[0]][new_position[1]] = piece_to_move\n end",
"def getMove()\n\t\t# Null warning\n\t\tputs(\"NO getMove() FUNCTION FOUND!!\")\n\t\treturn nil\n\tend",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def moves\n\n end",
"def pawn_promotion(move, current)\n if current.piece.class.name == \"Board::Pawn\"\n if current.piece.color == \"white\"\n if move[-1].to_i == 8\n promotion_piece = promotion_validity_check\n\n case promotion_piece\n when \"Q\"\n current.piece = Queen.new(current, \"♕\", \"white\" )\n when \"R\"\n current.piece= Rook.new(current, \"♖\", \"white\")\n when \"B\"\n current.piece = Bishop.new(current, \"♗\", \"white\")\n when \"N\"\n current.piece = Knight.new(current, \"♘\", \"white\")\n end\n end\n end\n\n if current.piece.color == \"black\"\n if move[-1].to_i == 1\n promotion_piece = promotion_validity_check\n\n case promotion_piece\n when \"Q\"\n current.piece = Queen.new(current, \"♛\", \"black\" )\n when \"R\"\n current.piece= Rook.new(current, \"♜\", \"black\")\n when \"B\"\n current.piece = Bishop.new(current, \"♝\", \"black\")\n when \"N\"\n current.piece = Knight.new(current, \"♞\", \"black\")\n end\n end\n end\n\n end\nend",
"def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end",
"def move_castling(short, color)\n\n if short\n if color == 'black'\n board[0][5].piece, board[0][6].piece = board[0][7].piece, board[0][4].piece\n board[0][7].piece, board[0][4].piece = nil, nil\n board[0][5].piece.position, board[0][6].piece.position = [0,5], [0,6]\n update_possible_movement_all_pieces()\n turns[board[0][5].piece.COLOR.to_sym] += 1\n board[0][5].piece.number_of_move += 1 if board[0][5].piece.instance_of?(Rook)\n board[0][6].piece.number_of_move += 1 if board[0][6].piece.instance_of?(King)\n \n return board[0][5].piece\n else\n board[7][5].piece, board[7][6].piece = board[7][7].piece, board[7][4].piece\n board[7][7].piece, board[7][4].piece = nil, nil\n board[7][5].piece.position, board[7][6].piece.position = [7,5], [7,6]\n update_possible_movement_all_pieces()\n turns[board[7][5].piece.COLOR.to_sym] += 1\n board[7][5].piece.number_of_move += 1 if board[7][5].piece.instance_of?(Rook)\n board[7][6].piece.number_of_move += 1 if board[7][6].piece.instance_of?(King)\n \n return board[7][5].piece\n end\n else\n if color == 'black'\n board[0][3].piece, board[0][2].piece = board[0][0].piece, board[0][4].piece\n board[0][0].piece, board[0][4].piece = nil, nil\n board[0][3].piece.position, board[0][2].piece.position = [0,3], [0,2]\n update_possible_movement_all_pieces()\n\n turns[board[0][3].piece.COLOR.to_sym] += 1\n board[0][3].piece.number_of_move += 1 if board[0][3].piece.instance_of?(Rook)\n board[0][2].piece.number_of_move += 1 if board[0][2].piece.instance_of?(King)\n\n return board[0][3].piece\n else\n board[7][3].piece, board[7][2].piece = board[7][0].piece, board[7][4].piece\n board[7][0].piece, board[7][4].piece = nil, nil\n board[7][3].piece.position, board[7][2].piece.position = [7,3], [7,2]\n update_possible_movement_all_pieces()\n \n turns[board[7][3].piece.COLOR.to_sym] += 1\n board[7][3].piece.number_of_move += 1 if board[7][3].piece.instance_of?(Rook)\n board[7][2].piece.number_of_move += 1 if board[7][2].piece.instance_of?(King)\n\n return board[7][3].piece\n end\n end\n\n end",
"def get_move(state)\n value = min_max(state, FIXNUM_MIN, FIXNUM_MAX, true)\n result_action\n end",
"def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end",
"def get_good_move\n loop do\n\t\t @player_move = self.get_player_move\n break if @current_state[@player_move].nil?\n puts \"That position is taken. Try another.\"\n end\n @player_move\n end",
"def piece_moves(piece_type, start_arr, finish_arr, player)\n\t\tcase piece_type\n\t\twhen \"Pawn\"\n\t\t\tpawn_moves(start_arr, finish_arr, player)\n\t\twhen \"Rook\"\n\t\t\trook_moves(start_arr, finish_arr, player)\n\t\twhen \"Bishop\"\n\t\t\tbishop_moves(start_arr, finish_arr, player)\n\t\twhen \"Knight\"\n\t\t\tknight_moves(start_arr, finish_arr, player)\n\t\twhen \"Queen\"\n\t\t\tqueen_moves(start_arr, finish_arr, player)\n\t\telse\n\t\t\tking_moves(start_arr, finish_arr, player)\t\t\t\n\t\tend\t\t\n\t\t# Determines if there is \"check\" or \"checkmate\"? If checkmate, game over.\n\t\tcheck?\n\t\tcheckmate?\n\tend",
"def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end",
"def player_select_move_piece(player)\n puts \"#{player.name}, select which piece you would like to move, in the form of a1, b3 etc\"\n response_coords = player_select_coordinates\n move_piece = board.get_board_coord(response_coords[0], response_coords[1])\n if !move_piece.respond_to?(:color) || move_piece.color != player.color\n puts \"#{player.name}, that's not a piece of yours. Please select another\"\n response_coords = player_select_move_piece(player)\n end\n response_coords\n end",
"def moves\n state.moves_taken\n end",
"def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end",
"def legal_moves\n # Fill this in\n end",
"def next_state(state, move)\n # Deep copy position (is this the easiest way?)\n position = Marshal.load(Marshal.dump(state[:position]))\n player = state[:player]\n opp = opponent(player)\n pieces = Marshal.load(Marshal.dump(state[:pieces]))\n from = move[0]\n to = move[1]\n force_analysis = false\n check = false\n moving_piece = pieces[player].find { |piece| piece.location == from }\n if !moving_piece\n puts \"ERROR--no piece to move!\"\n end\n # Check for capture\n if position[to[0]][to[1]] != \".\"\n # Remove enemy piece\n pieces[opp].delete_if { |piece| piece.location == to }\n # Force AI to continue analysis\n force_analysis = true\n end\n # Check for promotion\n if moving_piece.class == Pawn && to[0] == end_row(player)\n # Replace pawn with queen\n # (Underpromotion not yet implemented)\n pieces[player].delete(moving_piece)\n moving_piece = Queen.new(self, to, player)\n pieces[player] << moving_piece\n end\n # Move piece\n position[from[0]][from[1]] = \".\"\n position[to[0]][to[1]] = moving_piece.icon\n moving_piece.location = to\n # Complete castling by moving rook\n if moving_piece.class == ChessKing && (from[1] - to[1]).abs == 2\n rook_column = to[1] == 6 ? 7 : 0\n castling_rook = pieces[player].find { |piece| piece.location == [from[0], rook_column] }\n if castling_rook\n rook_dest = to[1] == 6 ? 5 : 3\n position[from[0]][rook_column] = \".\"\n position[to[0]][rook_dest] = castling_rook.icon\n castling_rook.location = [to[0], rook_dest]\n else\n puts \"Castling error -- can't find rook!\"\n end\n end\n # Switch active player\n next_player = opp\n # # Create new state for testing whether king is in check\n # new_position_state = {\n # :position => position,\n # :player => player,\n # :pieces => pieces,\n # :check => false,\n # :force_analysis => false\n # }\n # # Test whether opponent's king is now in check\n # check = check?(new_position_state)\n # force_analysis = true if check\n # Return new state\n {\n :position => position,\n :player => next_player,\n :pieces => pieces,\n :check => check,\n :force_analysis => force_analysis\n }\n end",
"def player_select_valid_piece_destination\n puts \"Where would you like to move this piece?\"\n response = player_select_coordinates\n end",
"def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend",
"def move_piece(coord)\n @game.move_piece_to(coord)\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def move to_move\r\n\t\tif to_move == 0\r\n\t\t\tvia_road = driver.location.west_road\r\n\t\t\tdriver.location = driver.location.west_location\r\n\t\t\treturn via_road\r\n\t\telsif to_move == 1\r\n\t\t\tvia_road = driver.location.north_road\r\n\t\t\tdriver.location = driver.location.north_location\r\n\t\t\treturn via_road\r\n\t\telsif to_move == 2\r\n\t\t\tvia_road = driver.location.east_road\r\n\t\t\tdriver.location = driver.location.east_location\r\n\t\t\treturn via_road\r\n\t\telsif to_move == 3\r\n\t\t\tvia_road = driver.location.south_road\r\n\t\t\tdriver.location = driver.location.south_location\r\n\t\t\treturn via_road\r\n\t\tend\r\n\t\t\r\n\tend",
"def parse(board, color, move_str)\n str = move_str.gsub(/[+\\#!]/, '')\n capture = str.delete!('x')\n\n # the promotion piece setting, e.g. h8=Q\n if str =~ /^.*(=.).*$/\n Pawn.set_promotion_piece(color, \n Board::PieceLetterMap.detect{|k,v| v.include?($1[1,1])}[0])\n str.gsub!($1, '')\n end\n \n case str.length\n when 2\n move_to = send(str)\n piece_pos = [move_to[0], move_to[1] - Piece.advance_direction(color)]\n piece = board.at(piece_pos)\n piece ||= board.at([piece_pos[0], \n piece_pos[1] - Piece.advance_direction(color)])\n \n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n \n when 3\n if str == 'O-O'\n mv = board.king(color).moves.detect{|m| m.to_s == 'O-O'}\n else\n c = str[0,1]\n move_to = send(str[1,2])\n \n if c == c.capitalize\n klass = Board::PieceLetterMap.detect{|k,v| v.include?(c)}[0]\n moves = board.pieces.select do |p|\n p.class == klass and p.color == color\n end.map(&:moves).flatten\n mv = moves.detect{|m| m.to == move_to}\n elsif capture\n x_diff = str[0,1] > str[1,1] ? 1 : -1\n \n pieces = board.pieces.select do |p| \n p.class == Pawn and p.color == color and \\\n p.x == move_to[0] + x_diff\n end\n \n mv = pieces.map{|p| p.moves}.flatten.detect{|m| [move_to, [move_to[0], move_to[1]+m.piece.advance_direction]].include?(m.to)}\n end\n end\n \n when 4\n c = str[0,1]\n move_to = send(str[2,2])\n \n if c == c.capitalize\n klass = Board::PieceLetterMap.detect{|k,v| v.include?(c)}[0]\n x_diff = nil\n y_pos = nil\n if str[1,1] <= '9'\n y_pos = str[1,1].to_i - 1\n else\n x_diff = str[1] - str[2]\n end\n piece = board.pieces.detect do |p|\n p.class == klass and p.color == color and \\\n (x_diff ? p.x == move_to[0] + x_diff : p.y == y_pos)\n end\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n else\n move_from = send(str[0,2])\n piece = board.at(move_from)\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n end\n \n when 5\n if str == 'O-O-O'\n mv = board.king(color).moves.detect{|m| m.to_s == 'O-O-O'}\n else\n move_from = send(str[1,2])\n move_to = send(str[3,2])\n piece = board.at(move_from)\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n end\n end\n \n raise ParseError.new(\"Invalid move: #{move_str}\") if mv.nil?\n \n mv\n end",
"def move_ludfm(mv_tsr, color)\r\n #p mv_tsr\r\n if mv_tsr.length <= 0\r\n return\r\n end\r\n mv_tsr.gsub!('O-O', '')\r\n mv_tsr.gsub!('-O', '') #long catsle\r\n if mv_tsr.length == 0\r\n raise 'Problem with recognizing castle..., please change the code'\r\n end\r\n @last_move_pgn = ''\r\n # recognize piece\r\n tmp = mv_tsr.split('-')\r\n start = tmp.first \r\n dest = tmp.last\r\n type = BoardInfoItem.TypeLud(start[0,1])\r\n # start position\r\n start_pos = LudoFrmHelper.eatpiecepos(type, start)\r\n # end position\r\n end_pos = dest[0..1]\r\n # check if the piece is ok\r\n arr_ix_start = LudoFrmHelper.coord_to_arrpos(start_pos)\r\n row_s = arr_ix_start[0]\r\n col_s = arr_ix_start[1]\r\n if @infosquare[row_s][col_s].check_unequal(type, color)\r\n # inconsistent format\r\n print_board\r\n raise \"Start position on #{mv_tsr}(#{color}) is not compatible with piece: #{@infosquare[row_s][col_s].to_ascii_board_piece}\"\r\n end\r\n arr_ix_end = LudoFrmHelper.coord_to_arrpos(end_pos)\r\n row_e = arr_ix_end[0]\r\n col_e = arr_ix_end[1]\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n # check for castle\r\n castle_pgn = LudoFrmHelper.check_castle(mv_tsr)\r\n if castle_pgn\r\n # castle\r\n @last_move_pgn = castle_pgn\r\n move_castle(start_item, end_item)\r\n return @last_move_pgn\r\n end\r\n \r\n # check if piece take\r\n rest_move_pgn = '' \r\n if dest.length > 2\r\n # we have more info, like + or x\r\n rest_move_pgn = dest[2..-1].gsub('x', '')\r\n end\r\n eat_pgn = ''\r\n destplace_pgn = ''\r\n piece_pgn = start_item.to_string_piece\r\n # check conflict for horse or rook and set moreinfo_pgn\r\n moreinfo_pgn = check_conflict_move(type, start_item, end_item)\r\n \r\n take_en_passant = false\r\n if end_item.type_piece != :vuoto\r\n # some pice is taken\r\n unless LudoFrmHelper.check_taken_onmove(mv_tsr)\r\n raise \"Move not compatible with board, no take piece on #{mv_tsr}, expect take #{end_item.to_ascii_board_piece}\"\r\n end\r\n # in case of pawn there is no information about piece\r\n if piece_pgn == ''\r\n piece_pgn = start_item.colix_tostr\r\n end\r\n eat_pgn = 'x'\r\n else\r\n # en passant has an empty destination\r\n take_en_passant = check_taken_enpassant(start_item, end_item)\r\n end\r\n \r\n #if moreinfo_pgn.length > 0\r\n # p \"Move with conflict #{mv_tsr}\"\r\n #end\r\n \r\n # 5 check promotion\r\n # promotion is simple a pawn that belong to line 1 for black or 8 for white\r\n # I have to add extra info if the promotion is not the queen, e.g a2-a1=C\r\n # for promition to horse\r\n if (start_item.type_piece == :ped and start_item.color_piece == :black and end_item.row == 0 ) or\r\n # promotion of black\r\n (start_item.type_piece == :ped and start_item.color_piece == :white and end_item.row == 7)\r\n #promotion of white\r\n \r\n #p \"promotion black #{start_item}\"\r\n if rest_move_pgn =~ /=/\r\n # promoted piece is given\r\n rest_move_pgn = rest_move_pgn\r\n #\r\n else\r\n # promotion to queen\r\n rest_move_pgn = '=D' \r\n end\r\n # for the move we set the start piece to the promoted\r\n char_piece_lud = rest_move_pgn.gsub('=', '')[0..1]\r\n start_item.setinfo( BoardInfoItem.TypeLud(char_piece_lud), start_item.color_piece)\r\n # adjoust rest removing ludopoli part and insert the pgn part\r\n rest_move_pgn = \"=#{start_item.to_string_piece}\" \r\n \r\n end\r\n \r\n if take_en_passant\r\n #p 'enpassant move'\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n # clear the piece taken en passant\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n piece_pgn = start_item.colix_tostr\r\n eat_pgn = 'x'\r\n #print_board\r\n end\r\n \r\n destplace_pgn = end_item.to_dest_pgn\r\n # build pgn\r\n @last_move_pgn = piece_pgn + moreinfo_pgn + eat_pgn + destplace_pgn + rest_move_pgn\r\n # make the move\r\n @last_moved_item = end_item\r\n BoardInfoItem.exchange(start_item, end_item)\r\n #if take_en_passant\r\n # after en passant\r\n # print_board\r\n #end\r\n return @last_move_pgn \r\n end",
"def towerofhanoi(pieces, sourcepeg, destinationpeg, extrapeg)\n if pieces == 0 then\n return \"no pieces to move\"\n end\n towerofhanoi(pieces-1,sourcepeg,extrapeg,destinationpeg)\n puts \"moved #{pieces} from \" + \"#{sourcepeg} to #{destinationpeg}\"\n towerofhanoi(pieces-1,extrapeg,destinationpeg,sourcepeg)\nend",
"def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end",
"def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end",
"def pbCheckMove(move)\n if move.is_a?(String) || move.is_a?(Symbol)\n move = getID(PBMoves,move)\n end\n return nil if !move || move<=0\n for i in $Trainer.party\n next if i.egg?\n for j in i.moves\n return i if j.id==move\n end\n end\n return nil\nend",
"def move\n fetch('games.street_fighter.moves')\n end",
"def get_computer_move\r\n\r\n #Define and array containing a list of three possible moves\r\n moves = [\"ROCK\", \"PAPER\", \"SCISSORS\"]\r\n\r\n #Generate and return a random number between 0 and 2\r\n randomNo = rand(3)\r\n\r\n #Return a randomly selected move to the calling statement\r\n return moves[randomNo]\r\n\r\n end",
"def ki_get_move\n field2 = @field.clone\n srand\n\n while true\n tryx, tryy = rand(3), rand(3)\n next unless field2[tryx][tryy].player == 0\n\n field2[tryx][tryy].player = @player\n if check_winner(field2) != nil and check_winner(field2).first.player == @player then\n return tryx, tryy\n end\n\n other = @player == 1 ? 2 : 1\n field2[tryx][tryy].player = other\n if check_winner(field2) != nil and check_winner(field2).first.player == other then\n if rand(10) > 1 then\n return tryx, tryy\n end\n end\n\n field2[tryx][tryy].player = 0\n if rand(10) > 8 then return tryx,tryy end\n end\n end",
"def moves_pawn(color, a, b)\n \t_moves = []\n \tif color == :white\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b + 2] if @board[a][b + 2].piece == nil \t\t\n \t\tend\n\n \t\tx, y = up(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = up_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_left(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_left(a, b)\n \t\tend\n \t\t\n \t\tx, y = up_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_right(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_right(a, b)\n \t\tend\n\n \telse\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b - 2] if @board[a][b - 2].piece == nil\n \t\tend\n\n \t\tx, y = down(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = down_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_left(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_left(a, b)\n \t\tend\n\n \t\tx, y = down_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_right(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_right(a, b)\n \t\tend\n \tend\n \treturn _moves.compact\n end",
"def move(board)\n\t\tif(board.cells[4] == \" \")\n\t\treturn final_cell_move =\t\"5\"\n\t\telse\n\t\t\tif(attack_against_opponent(board) != nil)\n\t\t\t\t return final_cell_move = attack_against_opponent(board)\n\t\t\telsif(defend_against_opponent(board) !=nil)\n\t\t\t\t return final_cell_move = defend_against_opponent(board)\n\t\t\telsif(find_empty_corner(board) != nil)\n\t\t\t\t return final_cell_move = find_empty_corner(board)\n\t\t\t elsif(find_move(board) != nil)\n\t \t\t\t return final_cell_move = find_move(board) # +1\n\t\t\t elsif(all_corners_filled?(board))\n\t\t\t\t return final_cell_move = find_random_cell(board)\n\t\t\tend\n\t\tend\n\tend",
"def get_action(full_move)\n full_move.last\n end",
"def pawn_move? piece, square\n if piece.moved == false && two_squares_vertical?(piece.square, square) && square.piece.nil?\n true\n elsif (diagonal?(piece.square, square) && adjacent?(piece.square, square)) && square.piece != nil\n true\n elsif vertical?(piece.square, square) && adjacent?(piece.square, square)\n pawn_direction?(piece, square)\n else\n false\n end\n end",
"def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end",
"def select_piece(player)\n piece = \"\"\n moves = []\n\n king = (player.colour == 'WHITE') ? @W_K : @B_K\n if king.in_check && check_mate(player)\n return [nil, []]\n end\n\n until defined?(piece.colour) && valid_piece?(player, piece) && moves.length.positive?\n piece_input = prompt_for_piece\n piece_pos = format_coords(piece_input)\n rank = piece_pos[0]\n file = piece_pos[1]\n next unless rank.between?(0, 7) && file.between?(0, 7) && @board_obj.board[rank][file] != \" \"\n\n piece = @board_obj.board[rank][file]\n moves = allowed_moves(piece)\n moves = moving_into_check(piece, moves)\n moves = add_castling_moves(piece, moves) if piece.instance_of?(King)\n end\n [piece.position, moves]\n end",
"def special_pawn_rules(moved_piece, from_row, to_column)\n if en_passant_allowed?(moved_piece, from_row)\n moved_piece.allow_en_passant = true\n end\n\n if valid_en_passant_move?(moved_piece.color, from_row, to_column)\n @state[from_row][to_column] = nil\n end\n\n if promotion?(moved_piece)\n moved_piece.can_promote = true\n end\n\n moved_piece.moved = true\n end",
"def perform_move(move)\n start_location = move[0]\n destination = move[1]\n i,j = start_location\n a,b = destination\n jumped = false\n #unless on_board?(destination)\n #raise error\n\n piece = @rows[i][j]\n all_possible_moves = piece.slide_moves(@rows) + piece.jump_moves(@rows)\n\n unless !all_possible_moves.include?(destination)#change to throw error\n\n jump = piece.jump_moves(@rows)\n if jump.include?(destination)\n jumped = true\n #removes jumped piece from board\n add = (piece.color == :white ? -1 : 1)\n if destination[1] > start_location[1]\n middle_b = destination[1] - 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n else\n middle_b = destination[1] + 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n end\n end\n\n @rows[i][j] = nil\n piece.location = [a,b]\n @rows[a][b] = piece\n end\n #checks if moved piece should be kinged, if so sets king to true\n piece.make_king\n if jumped\n #go_again unless (@rows[a][b]).jump_moves(@rows).nil?\n end\n end",
"def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end",
"def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def pawn_direction? piece, square\n if piece.color == 0\n if square.coordinate[0] > piece.square.coordinate[0]\n true\n else\n false\n end\n elsif piece.color == 1\n if square.coordinate[0] < piece.square.coordinate[0]\n true\n else\n false\n end\n end\n \n end",
"def piece_possible_moves(color, x, y, start, check)\n\t\ta, b = start\n\t\tcase @board[a][b].piece.class.name\n\t\twhen \"King\"\n\t\t\tpossible_moves = moves_king(color, a, b, check)\n\t\twhen \"Queen\"\n\t\t\tpossible_moves = moves_queen(color, a, b)\n\t\twhen \"Bishop\"\n\t\t\tpossible_moves = moves_bishop(color, a, b)\n\t\twhen \"Knight\"\n\t\t\tpossible_moves = moves_knight(color, a, b)\n\t\twhen \"Rook\"\n\t\t\tpossible_moves = moves_rook(color, a, b)\n\t\twhen \"Pawn\"\n\t\t\tpossible_moves = moves_pawn(color, a, b)\n\t\tend\n\t\tpossible_moves\n\tend",
"def can_move?(cordx, cordy , x_dest, y_dest)\n\t\t\n\t\tif @pieces == nil \n\t\t\tputs \"No piece at.\"\n\t\telsif x_dest == cordx && y_dest == cordy\n\t\t\tputs \"no change\"\n\t\telsif x_dest > 8 || y_dest > 8\n\t\t\t puts \"Offboard.\"\n\t\telse \n\t\t\t@pieces[cordx][cordy].can_move?(x_dest, y_dest)\n\t\tend\n\tend",
"def get_piece(pos)\n @grid[pos[0]][pos[1]]\n end",
"def process_move(move, state)\n from = move[1].to_i - 1\n to = move[3].to_i - 1\n\n #check if there's a disk to move\n if state[from].first == nil\n puts \"There's no disk in tower #{from + 1}!\"\n #check if destination tower has space\n elsif state[to].length == @disk\n puts \"Tower #{to + 1} is at full capacity!\"\n #check if \"from\" disk is smaller than \"to\" disk\n elsif state[to].last != nil && state[from].last > state[to].last\n puts \"This disk is larger than the destination disk! Illegal move!\"\n #otherwise proceed to move the plates\n else\n state[to].push(state[from].last)\n state[from].pop\n end\n\n return state\n end",
"def try_move(move)\n\t\tsetup if !ready?\n\n\t\t# gen all possible moves\n\t\tmoves = generate_moves(self.pieces, self.turn)\n\t\treturn nil if moves.length == 0\n\t\tvalid_move = moves.find { | m | m.from == move.from && m.to == move.to }\n\t\treturn nil if valid_move.nil?\n\n\t\t# filter out moves that would leave us in check\n\t\tmoves = filter_for_self_check(self.pieces, moves, self.turn)\n\t\treturn nil if moves.length == 0\n\t\tvalid_move = moves.find { | m | m.from == move.from && m.to == move.to }\n\t\treturn nil if valid_move.nil?\n\n\t\t# perform the move\n\t\tvalid_move = perform_move(valid_move)\n\t\tif valid_move.promoted.nil?\n\t\t\tvalid_move = update_after_move(valid_move)\n\t\tend\n \n\t\t# create a new board and set it equal to this one, then save it\n\t\tnext_board = Board.new\n\t\tnext_board.game = self.game\n\t\tnext_board.set(self.fen)\n\t\tif !next_board.save!\n\t\t\treturn nil\n\t\tend\n\n\t\t# finally return our move to the game model\n\t\treturn valid_move\n\tend",
"def validMove(piece, newLocation)\n # piece can move to any empty adjacent space.\n # might need to account for placing pieces. can be counted as a fly move i guess \n\n if newLocation == nil || piece == nil\n return false\n end\n\n # check if its a fly move. \n if @player1.isActive\n if @player1.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n else\n if @player2.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n end\n\n\n #checks if space is empty:\n if newLocation.isEmpty()\n # check if its a fly move\n if fly\n # if its a fly and the target location is empty its allowed. \n return true\n elsif piece.location == nil\n return true\n else\n # should return true if the move is valid.\n return @board.isAdjacent(piece,newLocation)\n end\n else\n # should the space is not empty, the move is invalid\n return false\n end\n\n end",
"def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend",
"def move_battle\n #move1_cd = 0\n #move1 = ((@battle_health_points/3) * 2)\n #move1. = @battle_health_points - @battle_health_points/3\n #move1.. = move1_cd = 3\n #crit_strike = move1 && move1. && move1_cd\n\n\n end",
"def get_move(user_move = gets.chomp)\n human_move_to_coord(user_move)\n end",
"def valid_moves\n\n end",
"def move_ludfm(mv_tsr, color)\n #p mv_tsr\n if mv_tsr.length <= 0\n return\n end\n mv_tsr.gsub!('O-O', '')\n mv_tsr.gsub!('-O', '') #long catsle\n if mv_tsr.length == 0\n raise 'Problem with recognizing castle..., please change the code'\n end\n @last_move_pgn = ''\n # recognize piece\n tmp = mv_tsr.split('-')\n start = tmp.first \n dest = tmp.last\n type = BoardInfoItem.TypeLud(start[0,1])\n # start position\n start_pos = LudoFrmHelper.eatpiecepos(type, start)\n # end position\n end_pos = dest[0..1]\n # check if the piece is ok\n arr_ix_start = LudoFrmHelper.coord_to_arrpos(start_pos)\n row_s = arr_ix_start[0]\n col_s = arr_ix_start[1]\n if @infosquare[row_s][col_s].check_unequal(type, color)\n # inconsistent format\n print_board\n raise \"Start position on #{mv_tsr}(#{color}) is not compatible with piece: #{@infosquare[row_s][col_s].to_ascii_board_piece}\"\n end\n arr_ix_end = LudoFrmHelper.coord_to_arrpos(end_pos)\n row_e = arr_ix_end[0]\n col_e = arr_ix_end[1]\n start_item = @infosquare[row_s][col_s]\n end_item = @infosquare[row_e][col_e]\n # check for castle\n castle_pgn = LudoFrmHelper.check_castle(mv_tsr)\n if castle_pgn\n # castle\n @last_move_pgn = castle_pgn\n move_castle(start_item, end_item)\n return @last_move_pgn\n end\n \n # check if piece take\n rest_move_pgn = '' \n if dest.length > 2\n # we have more info, like + or x\n rest_move_pgn = dest[2..-1].gsub('x', '')\n end\n eat_pgn = ''\n destplace_pgn = ''\n piece_pgn = start_item.to_string_piece\n # check conflict for horse or rook and set moreinfo_pgn\n moreinfo_pgn = check_conflict_move(type, start_item, end_item)\n \n take_en_passant = false\n if end_item.type_piece != :vuoto\n # some pice is taken\n unless LudoFrmHelper.check_taken_onmove(mv_tsr)\n raise \"Move not compatible with board, no take piece on #{mv_tsr}, expect take #{end_item.to_ascii_board_piece}\"\n end\n # in case of pawn there is no information about piece\n if piece_pgn == ''\n piece_pgn = start_item.colix_tostr\n end\n eat_pgn = 'x'\n else\n # en passant has an empty destination\n take_en_passant = check_taken_enpassant(start_item, end_item)\n end\n \n #if moreinfo_pgn.length > 0\n # p \"Move with conflict #{mv_tsr}\"\n #end\n \n # 5 check promotion\n # promotion is simple a pawn that belong to line 1 for black or 8 for white\n # I have to add extra info if the promotion is not the queen, e.g a2-a1=C\n # for promition to horse\n if (start_item.type_piece == :ped and start_item.color_piece == :black and end_item.row == 0 ) or\n # promotion of black\n (start_item.type_piece == :ped and start_item.color_piece == :white and end_item.row == 7)\n #promotion of white\n \n #p \"promotion black #{start_item}\"\n if rest_move_pgn =~ /=/\n # promoted piece is given\n rest_move_pgn = rest_move_pgn\n #\n else\n # promotion to queen\n rest_move_pgn = '=D' \n end\n # for the move we set the start piece to the promoted\n char_piece_lud = rest_move_pgn.gsub('=', '')[0..1]\n start_item.setinfo( BoardInfoItem.TypeLud(char_piece_lud), start_item.color_piece)\n # adjoust rest removing ludopoli part and insert the pgn part\n rest_move_pgn = \"=#{start_item.to_string_piece}\" \n \n end\n \n if take_en_passant\n #p 'enpassant move'\n col_enp = end_item.col\n row_enp = start_item.row\n # clear the piece taken en passant\n eated_item = @infosquare[row_enp][col_enp]\n eated_item.clear\n piece_pgn = start_item.colix_tostr\n eat_pgn = 'x'\n #print_board\n end\n \n destplace_pgn = end_item.to_dest_pgn\n # build pgn\n @last_move_pgn = piece_pgn + moreinfo_pgn + eat_pgn + destplace_pgn + rest_move_pgn\n # make the move\n @last_moved_item = end_item\n BoardInfoItem.exchange(start_item, end_item)\n #if take_en_passant\n # after en passant\n # print_board\n #end\n return @last_move_pgn \n end"
] | [
"0.729062",
"0.72682714",
"0.7221892",
"0.70854187",
"0.69375086",
"0.6926393",
"0.6908807",
"0.69065803",
"0.6900929",
"0.6885741",
"0.6883427",
"0.68811166",
"0.6870572",
"0.6827892",
"0.68186325",
"0.68059045",
"0.67936265",
"0.67819095",
"0.6760928",
"0.67469805",
"0.67469805",
"0.6719655",
"0.6712634",
"0.6701212",
"0.66893494",
"0.66813886",
"0.66695005",
"0.6629562",
"0.6618433",
"0.66135293",
"0.660735",
"0.66004574",
"0.66000295",
"0.65988225",
"0.65896875",
"0.6585806",
"0.6565616",
"0.65573454",
"0.65553904",
"0.6540757",
"0.65379083",
"0.65370566",
"0.65314496",
"0.6524569",
"0.65236306",
"0.65203553",
"0.6501589",
"0.6473932",
"0.6471715",
"0.6470425",
"0.6463893",
"0.64600277",
"0.6454101",
"0.64533585",
"0.6441831",
"0.64353544",
"0.64352083",
"0.6434466",
"0.6431124",
"0.6420554",
"0.6416409",
"0.6416031",
"0.6406506",
"0.6405756",
"0.64019746",
"0.6392791",
"0.63888323",
"0.6384991",
"0.6380534",
"0.6378157",
"0.637224",
"0.6368546",
"0.63681954",
"0.63681954",
"0.635844",
"0.6357052",
"0.6346619",
"0.63429564",
"0.63394976",
"0.6333514",
"0.6332764",
"0.6325793",
"0.63213223",
"0.63204014",
"0.6313944",
"0.6312202",
"0.63121915",
"0.6310234",
"0.63078856",
"0.6303217",
"0.6299435",
"0.6294619",
"0.6293817",
"0.6291331",
"0.62880373",
"0.62792724",
"0.6273488",
"0.6273404",
"0.62610614",
"0.626024",
"0.625185"
] | 0.0 | -1 |
GET /charges GET /charges.json | def index
@charges = Charge.all
@cart = current_cart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_charges(opts = {})\n data, _status_code, _headers = get_charges_with_http_info(opts)\n data\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def index\n @charges = Charge.all\n end",
"def index\n\t\t@charges = Charge.all\n\tend",
"def all(params = {})\n req = WebPay::ChargeListRequest.create(params)\n raw_response = @client._request(:get, 'charges', req)\n WebPay::ChargeResponseList.new(raw_response)\n end",
"def charge(company_number, charge_id)\n client.get(\"company/#{company_number}/charges/#{charge_id}/\")\n end",
"def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end",
"def get_charges_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.get_charges ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/charges'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetChargesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ChargesApi.get_charges\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChargesApi#get_charges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def charges(company_number, items_per_page = nil, start_index = nil)\n params = {}\n if items_per_page\n params[:items_per_page] = items_per_page\n end\n if start_index\n params[:start_index] = start_index\n end\n client.get(\"company/#{company_number}/charges/\", params)\n end",
"def charges\r\n @charges ||= ChargesController.new(configuration: @configuration)\r\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def get_charge(charge_id)\r\n # Prepare query url.\r\n _path_url = '/charges/{charge_id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'charge_id' => charge_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesResponse.from_hash(decoded)\r\n end",
"def index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end",
"def new\n @charge = Charge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge }\n end\n end",
"def show(charge_token)\n api_response(api_get(\"#{PATH}/#{charge_token}\"))\n end",
"def retrieve(id)\n Charge.new(attrs: { 'id' => id }, client: client).refresh\n end",
"def index\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to user_path(:id => $stripe_customer.id), notice: 'Payment was succesfull.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @gnc_charges = GncCharge.all\n @gnc_charges = @gnc_charges.order(:name).page(params[:page] || 1)\n end",
"def index\n @accommodation_charges = AccommodationCharge.all\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def get_charge\n @charge\n end",
"def index\n @failed_charges = CreditCardCharge.failed\n @disputed_charges = CreditCardCharge.disputed\n @successful_charges = CreditCardCharge.successful\n @credit_card_charges = CreditCardCharge.all\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def show\n @patient_charge = PatientCharge.find(params[:id])\n @patient_payments = @patient_charge.patient_payments\n @patient_payment = PatientPayment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def index\n @time_charges = TimeCharge.all\n end",
"def index\n @organization_charges = OrganizationCharge.all.page params[:page]\n end",
"def index\n @creaditcharges = Creaditcharge.all\n end",
"def generation_charges\n [ [{ :content => \"Current Supplier: THE FLYING BLINKY LIGHTS COMPANY\", :colspan => 4 }],\n [\"Generation Service Charge\", \"491 kWh X $.090041\", \"$\", \"44.21\"],\n [{ :content => \"Total Generation Services Charges\", :colspan => 2 }, \"$\", \"44.21\"]]\n end",
"def creditCardIndex\n render json: Approved.allCreditCard\n end",
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end",
"def show\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def stripe_charge\n return nil if stripe_charge_id.nil?\n\n Stripe::Charge.retrieve(stripe_charge_id)\n end",
"def show\n @service_charge = Charge.new\n end",
"def get_charges\n #fill in the remaining claim info\n # box 28\n text_box sprintf(\"%.2f\", @charges_for_service.to_s), :at => [370, 82]\n # box 29\n text_box sprintf(\"%.2f\", @copay_amount.to_s), :at => [450, 82]\n # box 30\n text_box sprintf(\"%.2f\", @balance_owed.to_s), :at => [520, 82]\n end",
"def index\n @accommodation_charges = @company.accommodation_charges\n end",
"def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end",
"def pricing\n request('pricing', :get)\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def charge\n starting = format_date(params['starting_date'.to_sym])\n ending = format_date(params['ending_date'.to_sym])\n chargeable = params[:chargeable].upcase unless params[:chargeable].nil?\n charged = params[:charged].upcase unless params[:charged].nil?\n charged_date = params[:charged_date]\n charged_code = params[:charged_code]\n project_id = params[:project]\n task_id = params[:task]\n activities = Activity.filter(starting, ending, chargeable, charged, project_id, task_id, charged_code)\n # unless params[:filter].blank?\n # project_ids = Project.where(\"name ILIKE ?\", \"%#{params[:filter]}%\").ids\n # activities = activities.where(project_id: project_ids)\n # end\n filter_condition = {starting: starting, ending: ending, chargeable: chargeable, charged: charged, project: project_id}\n activities = activities.order(:project_id, :task_id)\n quantity = activities.size\n charged_code = generate_random_string\n activities.update_all(charged: true, charged_code: charged_code, charged_date: charged_date.in_time_zone, updated_at: DateTime.now)\n activities.reload\n response = {result: 'updated', quantity: quantity, charged_code: charged_code, charged_date: charged_date}\n render json: response.to_json\n end",
"def all_charges(scans)\n scans.map do |scan|\n {\n title: scan.product.title,\n quantity: scan.quantity,\n amount: priceify_number(scan.total_cost(apply_discount: false))\n }\n end\n end",
"def index\n @recharges = Recharge.where(:user_id => current_user.id).order('created_at DESC')\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n render json: @pricing\n end",
"def billing\n request('billing', :get)\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def create_charge(body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/Charges'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesResponse.from_hash(decoded)\r\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def fawry_api_response\n { 'type' => 'ChargeResponse',\n 'referenceNumber' => '931215518',\n 'merchantRefNumber' => 'io5jxf3jp27kfh8m719arcqgw7izo7db',\n 'expirationTime' => 1_572_884_477_505,\n 'statusCode' => 200,\n 'statusDescription' => 'Operation done successfully' }.to_json\nend",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def index\n @admin_pricing_fabrics = Admin::Pricing::Fabric.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_fabrics.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def get(access_token)\n payload = { access_token: access_token }\n @client.post_with_auth('credit_details/get', payload)\n end",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def charge_params\n params.fetch(:charge, {})\n end",
"def index\n @title=\"Listing Discharges\"\n @discharges = Discharge.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discharges }\n end\n end",
"def create\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to @charge, notice: 'Charge was successfully created.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @gnc_charge.destroy\n respond_to do |format|\n format.html { redirect_to gnc_charges_url, notice: \"Gnc charge was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def show\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plate_cost }\n end\n end",
"def cost(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:cost),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def retrieve_product_rate_plan_charge_object(product_rate_plan_charge_id, fields = nil, zuora_version = nil)\n uri = Addressable::URI.parse(\"/object/product-rate-plan-charge/#{product_rate_plan_charge_id}\")\n uri.query_values = { fields: fields.to_s } if !fields.nil?\n @connection.rest_get(uri.to_s, zuora_version)\n end",
"def show\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proof_cost }\n end\n end",
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def show\n @cheque_payment = ChequePayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheque_payment }\n end\n end",
"def charges\n charges = []\n self.students.each do |student|\n student.charges.each do |charge|\n if charge.promotion_id == self.id\n charges << charge\n end\n end\n end\n return charges\n end",
"def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end",
"def show\n @charging_order = ChargingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charging_order }\n end\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n find_payment\n render json: @payment\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def index\n @paymentcashes = Paymentcash.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paymentcashes }\n end\n end",
"def show\n @breadcrumb = 'read'\n @billing_frequency = BillingFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_frequency }\n end\n end",
"def new\n @charge_master = ChargeMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def commission\n get 'commission'\n end",
"def info_premium\n render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def verify_charge(id)\n\n response = get_request(\"#{base_url}/transactions/#{id}/verify\")\n return response\nend",
"def show\n render json: @fund\n end",
"def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end",
"def show\n @registration_contract = Registration::Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration_contract }\n end\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def retrieve(id)\n @client.make_request(:get, \"carrier_accounts/#{id}\", MODEL_CLASS)\n end",
"def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end"
] | [
"0.7544956",
"0.74264014",
"0.7300223",
"0.71588546",
"0.7057038",
"0.70192325",
"0.6964819",
"0.6954642",
"0.69070524",
"0.67966926",
"0.67279094",
"0.65885085",
"0.65502703",
"0.6523561",
"0.6451186",
"0.64396286",
"0.63823134",
"0.63137037",
"0.63024515",
"0.62901855",
"0.620857",
"0.6192479",
"0.61741704",
"0.6164442",
"0.61606765",
"0.6091985",
"0.6083479",
"0.608175",
"0.604972",
"0.60477376",
"0.6021836",
"0.6018974",
"0.6017115",
"0.6011076",
"0.60082865",
"0.59577423",
"0.5954306",
"0.5904931",
"0.59003526",
"0.5899283",
"0.5881854",
"0.58502334",
"0.58483016",
"0.58476937",
"0.58423275",
"0.5838111",
"0.5838111",
"0.5838111",
"0.5837163",
"0.5828556",
"0.5800851",
"0.5798722",
"0.5796317",
"0.5770551",
"0.5770018",
"0.57626504",
"0.5756572",
"0.57413054",
"0.5739645",
"0.5731582",
"0.57311016",
"0.5728093",
"0.5724225",
"0.572147",
"0.57196414",
"0.5718136",
"0.56988513",
"0.5683596",
"0.56787086",
"0.56780314",
"0.5675631",
"0.5669791",
"0.5668263",
"0.5663115",
"0.5649823",
"0.56493026",
"0.5645248",
"0.56328297",
"0.56209916",
"0.56178206",
"0.5612067",
"0.5609378",
"0.56066376",
"0.56025165",
"0.5602474",
"0.56016105",
"0.5599117",
"0.5595805",
"0.55889666",
"0.5584995",
"0.55831623",
"0.55811304",
"0.557362",
"0.5566341",
"0.55487853",
"0.55475783",
"0.5545963",
"0.55387783",
"0.55387783",
"0.5538518"
] | 0.6035707 | 30 |
GET /charges/1 GET /charges/1.json | def show
@cart = current_cart
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end",
"def charge(company_number, charge_id)\n client.get(\"company/#{company_number}/charges/#{charge_id}/\")\n end",
"def index\n @charges = Charge.all\n end",
"def index\n\t\t@charges = Charge.all\n\tend",
"def get_charges(opts = {})\n data, _status_code, _headers = get_charges_with_http_info(opts)\n data\n end",
"def retrieve(id)\n Charge.new(attrs: { 'id' => id }, client: client).refresh\n end",
"def new\n @charge = Charge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge }\n end\n end",
"def get_charge(charge_id)\r\n # Prepare query url.\r\n _path_url = '/charges/{charge_id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'charge_id' => charge_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesResponse.from_hash(decoded)\r\n end",
"def charges(company_number, items_per_page = nil, start_index = nil)\n params = {}\n if items_per_page\n params[:items_per_page] = items_per_page\n end\n if start_index\n params[:start_index] = start_index\n end\n client.get(\"company/#{company_number}/charges/\", params)\n end",
"def all(params = {})\n req = WebPay::ChargeListRequest.create(params)\n raw_response = @client._request(:get, 'charges', req)\n WebPay::ChargeResponseList.new(raw_response)\n end",
"def get_charges_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.get_charges ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/charges'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetChargesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ChargesApi.get_charges\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChargesApi#get_charges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def show\n @patient_charge = PatientCharge.find(params[:id])\n @patient_payments = @patient_charge.patient_payments\n @patient_payment = PatientPayment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_charge }\n end\n end",
"def show(charge_token)\n api_response(api_get(\"#{PATH}/#{charge_token}\"))\n end",
"def index\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to user_path(:id => $stripe_customer.id), notice: 'Payment was succesfull.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charges\r\n @charges ||= ChargesController.new(configuration: @configuration)\r\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def get_charge\n @charge\n end",
"def show\n @service_charge = Charge.new\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def stripe_charge\n return nil if stripe_charge_id.nil?\n\n Stripe::Charge.retrieve(stripe_charge_id)\n end",
"def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end",
"def index\n @gnc_charges = GncCharge.all\n @gnc_charges = @gnc_charges.order(:name).page(params[:page] || 1)\n end",
"def show\n @cheque_payment = ChequePayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheque_payment }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def creditCardIndex\n render json: Approved.allCreditCard\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def show\n @charging_order = ChargingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charging_order }\n end\n end",
"def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end",
"def retrieve(id)\n @client.make_request(:get, \"carrier_accounts/#{id}\", MODEL_CLASS)\n end",
"def index\n @charges = Charge.all\n @cart = current_cart\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def new\n @charge_master = ChargeMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge_master }\n end\n end",
"def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def show\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plate_cost }\n end\n end",
"def show\n render json: @pricing\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def retrieve_product_rate_plan_charge_object(product_rate_plan_charge_id, fields = nil, zuora_version = nil)\n uri = Addressable::URI.parse(\"/object/product-rate-plan-charge/#{product_rate_plan_charge_id}\")\n uri.query_values = { fields: fields.to_s } if !fields.nil?\n @connection.rest_get(uri.to_s, zuora_version)\n end",
"def show\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proof_cost }\n end\n end",
"def show\n find_payment\n render json: @payment\n end",
"def show\n @carbontaxrefund = Carbontaxrefund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carbontaxrefund }\n end\n end",
"def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end",
"def index\n @accommodation_charges = AccommodationCharge.all\n end",
"def index\n @organization_charges = OrganizationCharge.all.page params[:page]\n end",
"def index\n @time_charges = TimeCharge.all\n end",
"def index\n @creaditcharges = Creaditcharge.all\n end",
"def show\n @money = Money.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money }\n end\n end",
"def show\n @contribution = Contribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contribution }\n end\n end",
"def show\n @breadcrumb = 'read'\n @billing_frequency = BillingFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_frequency }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end",
"def show\n @registration_contract = Registration::Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration_contract }\n end\n end",
"def fawry_api_response\n { 'type' => 'ChargeResponse',\n 'referenceNumber' => '931215518',\n 'merchantRefNumber' => 'io5jxf3jp27kfh8m719arcqgw7izo7db',\n 'expirationTime' => 1_572_884_477_505,\n 'statusCode' => 200,\n 'statusDescription' => 'Operation done successfully' }.to_json\nend",
"def billing\n request('billing', :get)\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"def create\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to @charge, notice: 'Charge was successfully created.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @failed_charges = CreditCardCharge.failed\n @disputed_charges = CreditCardCharge.disputed\n @successful_charges = CreditCardCharge.successful\n @credit_card_charges = CreditCardCharge.all\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end",
"def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credito }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def verify_charge(id)\n\n response = get_request(\"#{base_url}/transactions/#{id}/verify\")\n return response\nend",
"def retrieve_rate_plan_charge_tier_object(rate_plan_charge_tier_id, fields = nil, zuora_version = nil)\n uri = Addressable::URI.parse(\"/object/rate-plan-charge-tier/#{rate_plan_charge_tier_id}\")\n uri.query_values = { fields: fields.to_s } if !fields.nil?\n @connection.rest_get(uri.to_s, zuora_version)\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment }\n end\n end",
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end",
"def show\n @donation = Donation.find(params[:id])\n\n # return json object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation.to_json }\n end\n end",
"def new\n @crate = Crate.new\n @payers = get_cratepayers()\n @types = get_crate_types()\n @priorities = get_crate_priorities()\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate }\n end\n end",
"def show\n @breadcrumb = 'read'\n @currency = Currency.find(params[:id])\n @currency_instruments = @currency.currency_instruments.by_value\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def show\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_type }\n end\n end",
"def create_charge(body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/Charges'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesResponse.from_hash(decoded)\r\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def show\n respond_to do |format|\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount}\n format.json { render json: response_json, status: 200 }\n end\n end",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n @paymentcash = Paymentcash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paymentcash }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end",
"def show\n @payment = Payment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @payment }\n end\n end",
"def show\n @unpaid_debt = UnpaidDebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unpaid_debt }\n end\n end",
"def show\n quote = Quote.find(params[:id])\n render json: quote\n end",
"def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end",
"def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_fund }\n end\n end"
] | [
"0.74812806",
"0.7350248",
"0.72522545",
"0.7103907",
"0.69858915",
"0.6856662",
"0.67906594",
"0.67368233",
"0.6654566",
"0.6603766",
"0.65610653",
"0.65597296",
"0.6554744",
"0.64294314",
"0.6333491",
"0.6329944",
"0.63016343",
"0.62653667",
"0.62309116",
"0.62274677",
"0.6203634",
"0.6184046",
"0.61624163",
"0.6156903",
"0.6127542",
"0.6095396",
"0.60889345",
"0.6068696",
"0.60446554",
"0.6025802",
"0.6016224",
"0.6010959",
"0.60053647",
"0.6001993",
"0.59858143",
"0.59816027",
"0.5971555",
"0.5964278",
"0.5954944",
"0.59524286",
"0.59482425",
"0.59223264",
"0.59128124",
"0.59070385",
"0.5899108",
"0.5897348",
"0.5892988",
"0.5886873",
"0.58852714",
"0.5877461",
"0.58720183",
"0.58595455",
"0.58476514",
"0.58383346",
"0.5836095",
"0.5833564",
"0.58319724",
"0.58319724",
"0.58319724",
"0.5827424",
"0.5827424",
"0.58161527",
"0.58158183",
"0.5813837",
"0.5813467",
"0.58089375",
"0.58055913",
"0.5796091",
"0.57929385",
"0.57929045",
"0.57816964",
"0.57755876",
"0.57752985",
"0.5769945",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57662046",
"0.57561815",
"0.5754189",
"0.5751357",
"0.57452637",
"0.57440126",
"0.5742615",
"0.5738962",
"0.5737638",
"0.57351094",
"0.57312024",
"0.57301086",
"0.5728242",
"0.57246757",
"0.57246757",
"0.5724618",
"0.5724373",
"0.57214767",
"0.5721262",
"0.5721103"
] | 0.0 | -1 |
POST /charges POST /charges.json | def create
@user = current_user
@charge = current_user.charges.build(charge_params)
@cart = current_cart
@charge.add_line_items_from_cart(current_cart)
@order = current_user.orders.last
@pages = Page.where(id: [$pageIds])
secondary_amount = @cart.total_price * 100
overall_amount = secondary_amount.floor
@charge.status = "complete"
@amount = overall_amount
@description = "#{current_user.name} Order ID: "
if session[:last_created_at].to_i > params[:timestamp].to_i
redirect_to @order, notice: 'Order has already been confirmed. You were not charged again.'
else
respond_to do |format|
@time_stamp = Time.now.to_i
session[:last_created_at] = @time_stamp
if @charge.save
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
OrderNotifierMailer.confirmed(@order, @user).deliver
@pages.each do |page|
OrderNotifierMailer.producerConfirmed(@order, page, @user).deliver
end
if @order.pay_type == "Card"
begin
customer = Stripe::Customer.create(
email: params[:stripeEmail],
source: params[:stripeToken]
)
charge = Stripe::Charge.create(
customer: customer.id,
amount: @amount,
description: @description + @order.id.to_s,
currency: 'cad'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
format.html { redirect_to @order, notice: 'Thank you for buying from Markset, here is your purchased list.' }
format.json { render :show, status: :created, location: @order }
elsif @order.pay_type == "Cash"
format.html { redirect_to @order, notice: 'Thank you for buying from Markset, here is your purchased list.' }
format.json { render :show, status: :created, location: @order }
end
else
format.html { render :new }
format.json { render json: @charge.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end",
"def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end",
"def create\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to @charge, notice: 'Charge was successfully created.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_charge\n # Amount in cents\n @amount = 500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n end",
"def create\n\n\t\t# Get the credit card details submitted by the form\n\t\ttoken = params[:stripeToken]\n\n\t\t# Amount in cents\n\t\t@amount = 500\n\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => 'example@stripe.com',\n\t\t\t:card => params[:stripeToken]\n\t\t)\n\n\t\t# Create the charge on Stripe's servers - this will charge the user's card\n\t\tcharge = Stripe::Charge.create(\n\t\t\t:customer => customer.id,\n\t\t\t:amount => @amount,\n\t\t\t:description => 'Rails Stripe customer',\n\t\t\t:currency => 'usd',\n\t\t\t:card => token\n\t\t)\n\n\trescue Stripe::CardError => e\n\t flash[:error] = e.message\n\t redirect_to charges_path\n\tend",
"def create \n\t\t# amoutn in cents \n\t\t#@amount = 500 \n\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => 'example@stripe.com',\n\t\t\t:card => params[:stripeToken]\n\t\t\t)\t\n\n\t\tcharge = Stripe::Charge.create(\n\t\t\t:customer => customer.id,\n\t\t\t:amount => @amount,\n\t\t\t:description => 'Rails Stripe customer',\n\t\t\t:currency => 'usd'\n\t\t\t)\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to charges_path \n\tend",
"def create\n @charge = Charge.new(params[:charge])\n @charge.charged_at = Date.today\n\n respond_to do |format|\n if @charge.save\n format.html { redirect_to @charge, notice: 'Charge was successfully created.' }\n format.json { render json: @charge, status: :created, location: @charge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @charge = Charge.new\n respond_to do |format|\n if @charge.save\n format.html { redirect_to user_path(:id => $stripe_customer.id), notice: 'Payment was succesfull.' }\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charge_params\n params.require(:charge).permit(:amount, :charged_id, :charged_type, :is_registration_fee, :is_donation, :stripeEmail, :stripeToken, :email)\n end",
"def create\n\n @charge = Charge.new(charge_params)\n \n customer = StripeTool.create_customer(email: params[:stripeEmail], \n stripe_token: params[:stripeToken])\n\n charge = StripeTool.create_charge(customer_id: customer.id, \n amount: (@charge.amount*100).to_i,\n description: @charge.topic)\n\n @charge.stripe_id = customer.id\n \n\n respond_to do |format|\n if @charge.save\n if @charge.owner_type == \"User\"\n format.html { redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (I18n.t :thxpayment) }\n end\n if @charge.owner_type == \"Company\"\n format.html { redirect_to company_path(:id => @charge.owner_id, :topic => \"institutionen_charges\"), notice: 'Charge was successfully created.' }\n end\n format.json { render :show, status: :created, location: @charge }\n else\n format.html { render :new }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: (:I18n.t :nopayment)\n \n end",
"def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n :description => 'Prlayvous Ticket',\n :currency => 'usd'\n )\n\n #After paying with Stripe, consumers are prompt to confirm their shipping address.\n redirect_to edit_consumer_order_path(current_consumer, @order)\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\n end",
"def charge_params\n params.require(:charge).permit(:amount, :paid, :refunded, :customer_id, :amount_currency)\n end",
"def create\n customer = StripeTool.create_customer(email: params[:stripeEmail], stripe_token: params[:stripeToken])\n\n\tcharge = StripeTool.create_charge(customer_id: customer.id, amount: @amount, description: @description)\n\n current_user.stripe_id = customer.id\n\n\treceipt = Charge.new charge_stripe_token: charge.id, price: @amount, description: @description)\n\n\tif Charge.save\n\n\telse\n\n\tend",
"def create\n #Take amount from the right place\n\n if params[:amount_entry] == \"\"\n amount = params[:amount_select]\n else\n amount = params[:amount_entry]\n end\n\n #Charge Stripe fees to customer\n\n final_float = amount.to_i + (amount.to_i * 0.029) + 30\n final_amount = final_float.round\n\n @transaction = Transaction.new(user_id: current_user.id, event_id: params[:event_id], amount: final_amount, support: params[:support])\n\n #Create the charge with Stripe\n\n charge = Stripe::Charge.create({\n :amount => final_amount,\n :currency => \"usd\",\n :customer => get_stripe_customer_id,\n :description => \"Tally Contribution\",\n :application_fee => 100\n },\n Pac.find(params[:pac_id]).stripe_secret_key\n )\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_charge(body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/Charges'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesResponse.from_hash(decoded)\r\n end",
"def charge( amount_in_cents )\n resp = client.charge(\n token: payment.token,\n expires_at: payment.expires_at,\n amount: amount_in_cents.to_i.abs\n ).body\n\n user.charges.create!(\n amount_in_cents: resp.AuthorizedAmount.to_i,\n description: I18n.t('transactions.charge'),\n metadata: resp.as_json\n )\n rescue BridgePay::ResponseError => ex\n raise ChargeFailure.new( ex.response )\n end",
"def create\n @gnc_charge = GncCharge.new(gnc_charge_params)\n\n respond_to do |format|\n if @gnc_charge.save\n format.html { redirect_to @gnc_charge, notice: \"Gnc charge was successfully created.\" }\n format.json { render :show, status: :created, location: @gnc_charge }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gnc_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Each shop can have only one recurring charge per app. When a new recurring application charge is activated for a shop\n # that already has one, the existing recurring charge is canceled and replaced by the new charge.\n # The new recurring charge is then activated.\n\n plan_info = @subscriptions_info[params[:subscription_type]]\n local_charge = @shop.charges.create\n\n shopify_charge = ShopifyAPI::RecurringApplicationCharge.new(\n name: plan_info[\"name\"],\n price: plan_info[\"price\"],\n return_url: \"#{ENV['APP_URL']}/charges/#{local_charge.id}/activate\",\n test: plan_info[\"test\"],\n capped_amount: plan_info[\"capped_amount\"],\n terms: plan_info[\"terms\"]\n )\n if shopify_charge.save\n fullpage_redirect_to shopify_charge.confirmation_url\n else\n # make sure this works\n local_charge.delete\n # recurring charge could not be created\n end\n end",
"def charge_params\n params[:charge].permit(:reward_id, :token)\n end",
"def stripe_charge\n donation = Donation.create(user_id: current_user.id, disaster_id: params[:disaster_id], charity_id: params[:id], amount: params[:donation_amount])\n\n Stripe.api_key = ENV['STRIPE_SECRET']\n token = params[:stripeToken]\n\n customer = Stripe::Customer.create(\n :source => token,\n :description => \"Example customer\"\n )\n # current_user.token = customer //save user token\n begin\n charge = Stripe::Charge.create(\n :amount => donation.amount, # in cents\n :currency => \"usd\",\n :customer => customer.id\n )\n flash[:good] = \"Thanks for donating!\"\n rescue Stripe::CardError => e\n flash[:problem] = e.message\n end\n redirect_to root_path\n\n end",
"def charges_params\n \tparams.require(:charges).permit(\n \t\t:stripeToken,:stripeEmail,\n \t\t:stripeShippingName,:stripeShippingAddressLine1,:stripeShippingAddressLine2,:stripeShippingAddressZip,:stripeShippingAddressState,:stripeShippingAddressCity,:stripeShippingAddressCountry\n \t\t)\n end",
"def create\n @credit_card_charge = CreditCardCharge.new(credit_card_charge_params)\n\n respond_to do |format|\n if @credit_card_charge.save\n format.html { redirect_to @credit_card_charge, notice: 'Credit card charge was successfully created.' }\n format.json { render :show, status: :created, location: @credit_card_charge }\n else\n format.html { render :new }\n format.json { render json: @credit_card_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p params\n donation = Donation.new(\n amount: params[:amount],\n frequency: params[:frequency])\n # save the information from user input to create a new donation.\n donation.save!\n if donation.save!\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end",
"def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end",
"def create\n @charge = Charge.new(params[:charge])\n if @charge.save\n redirect_to @charge, notice: 'Charge was successfully created.' \n else\n render action: \"new\"\n end\n end",
"def new\n @charge = Charge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge }\n end\n end",
"def charge_params\n params.require(:charge).permit(:owner_id, :owner_type, :stripe_id, :appparam_id, :date_from, :date_to, :amount, :plan)\n end",
"def create\n @patient_charge = PatientCharge.new(params[:patient_charge])\n @patient = Patient.find params[:patient_charge][:patient_id]\n @patient_charge.amount = @patient.cost\n @patient_charge.liquidated = \"no\"\n @patient_charge.date = Time.now\n @patient_charge.patient_id = @patient.id\n\n respond_to do |format|\n if @patient_charge.save\n format.html { redirect_to people_charges_path(@patient_charge.patient.person), notice: 'Cargo de Sesion Guardado Correctamente' }\n format.json { render json: @patient_charge, status: :created, location: @patient_charge }\n else\n format.html { redirect_to people_charges_path(@patient_charge.patient.person), notice: 'No se guardo cargo!' }\n format.json { render json: @patient_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @Payment = Payment.new\n @Payment.user_id = current_user\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => (25 * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for purchasing!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n\n @Payment.stripe_id = charge.id\n @Payment.amount = charge.amount\n\n if current_user.subscribed != true\n current_user.subscribed = true\n current_user.credit = 25.00\n else\n current_user.credit = current_user.credit + 25.00\n end\n\n current_user.save\n redirect_to caves_path\n end",
"def create\n # Amount in cents\n @amount = 1300\n\n customer = Stripe::Customer.create(\n :email => 'example@stripe.com',\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'usd'\n )\n\nrescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to charges_path\nend",
"def create\n # Amount in cents\n @amount = Car.deposit\n # ID of car\n @carID = params[:carID]\n\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :source => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Tesla Model 3 Custom Order',\n :currency => 'usd'\n )\n\n Car.update(@carID.to_i, paid: true)\n OrderConfirmationMailer.order_confirmation_email(User.find(session[:user_id]).email, Car.find(@carID)).deliver_now\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n puts \"Error occured #{new_charge_path}\"\n redirect_to new_charge_path\n end",
"def pay\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Charge $10.\n amount = 1000\n # Calculate the fee amount that goes to the application.\n fee = (amount * Rails.application.secrets.fee_percentage).to_i\n\n begin\n charge = Stripe::Charge.create(\n {\n amount: amount,\n currency: user.currency,\n card: params[:token],\n description: \"Test Charge via Stripe Connect\",\n application_fee: fee\n },\n\n # Use the user-to-be-paid's access token\n # to make the charge.\n user.secret_key\n )\n flash[:notice] = \"Charged successfully! <a target='_blank' rel='connected-account' href='https://dashboard.stripe.com/test/payments/#{charge.id}'>View in dashboard »</a>\"\n\n rescue Stripe::CardError => e\n error = e.json_body[:error][:message]\n flash[:error] = \"Charge failed! #{error}\"\n end\n\n redirect_to user_path( user )\n end",
"def create\n @charge_transaction = ChargeTransaction.new(params[:charge_transaction])\n if params[:transaction]\n # they used the form on main/index\n t = params[:transaction]\n \n @charge_transaction.description = t[:description]\n \n amount = Money.new(t[:amount].to_f * 100)\n t[:other_people].each do |p|\n other = Housemate.find p\n charge = Charge.new\n if t[:is_creditor] == '0'\n charge.debtor = current_housemate\n charge.creditor = other\n elsif t[:is_creditor] == '1'\n charge.creditor = current_housemate\n charge.debtor = other\n else\n flash[:error_messages] = [\"You must select who paid in the transaction.\"]\n return redirect_to(:controller => :main, :action => :index)\n end\n \n charge.amount = amount / (t[:other_people].length)\n charge.save\n @charge_transaction.charges.push charge\n end\n \n @charge_transaction.save\n end\n\n respond_to do |format|\n if @charge_transaction.save\n flash[:notice] = 'ChargeTransaction was successfully created.'\n format.html { redirect_to :controller => \"main\", :action => \"index\" }\n format.xml { head :created, :location => charge_transaction_url(@charge_transaction) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @charge_transaction.errors.to_xml }\n end\n end\n end",
"def create\n @organization_charge = OrganizationCharge.new(organization_charge_params)\n\n respond_to do |format|\n if @organization_charge.save\n format.html { redirect_to @organization_charge, notice: 'Organization charge was successfully created.' }\n format.json { render :show, status: :created, location: @organization_charge }\n else\n format.html { render :new }\n format.json { render json: @organization_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charge_params\n params.require(:charge).permit(:order_id, :status)\n end",
"def charge_credit_invoice\n @invoice = Invoice.find(params[:id])\n Stripe.api_key = \"\"\n total_invoice_stripe = Money.new(@invoice.total_due, \"USD\")\n \n charge = Stripe::Charge.create(\n :amount => total_invoice_stripe.cents,\n :currency => \"usd\",\n :card => params[:invoice][:stripe_card_token],\n :description => @invoice.invoice_number\n )\n \n @invoice.stripe_card_token = charge.id\n if(@invoice.save!)\n @invoice.payment_received = true\n @invoice.save!\n redirect_to invoice_path(@invoice.id)\n else\n redirect_to root_path\n end\n end",
"def create_charge(amount)\n raise 'No amount specified for credit card charge!' if amount.nil?\n Stripe.api_key = 'sk_test_xvxhe0dUKfbGI2MJOWOg1N8j'\n\n charge = Stripe::Charge.create(\n amount: amount,\n currency: 'cad',\n customer: self.stripe_customer_id\n )\n\n charge\n end",
"def create\n @accommodation_charge = AccommodationCharge.new(accommodation_charge_params)\n\n respond_to do |format|\n if @accommodation_charge.save\n format.html { redirect_to @accommodation_charge, notice: 'Accommodation charge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @accommodation_charge }\n else\n format.html { render action: 'new' }\n format.json { render json: @accommodation_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_charge\n #if params[:charge][:room_list_id].to_s == \"\"\n # if params[:charge][:product_id].to_s != \"\"\n # pd_tmp = Product.find(params[:charge][:product_id]).config\n # if pd_tmp != '4' # not payment\n # respond_to do |format|\n # format.json { render json: {success: false} }\n # end\n # return \n # end\n # else\n # respond_to do |format|\n # format.json { render json: {success: false} }\n # end\n # return \n # end\n #end\n \n if params[:charge][:product_id].to_s == \"\"\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n return\n end\n \n folio = Folio.where(input_type_id: params[:charge][:input_type_id]).order(:id).first \n expense = Expense.new(params[:charge])\n expense.folio_id = folio.id\n if expense.save\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def bulk_tokenized_charge(data)\n base_url = flutterwave_object.base_url \n required_parameters = [\"title\", \"retry_strategy\", \"bulk_data\"]\n check_passed_parameters(required_parameters, data)\n\n payload = data.to_json\n\n response = post_request(\"#{base_url}/bulk-tokenized-charges/\", payload)\n return response\n end",
"def create\n if @current_user.has_privilege?('charges', 'insert')\n @charge = Charge.new(params[:charge])\n if @charge.save\n redirect_to(charges_path, :notice => '新建收费项目成功.')\n else\n render :action => \"new\"\n\n end\n else\n flash[:notice] = \"你没有新建收费项目的权限,请联系管理员\"\n render_403\n end\n\n end",
"def create\n\n amount = params[:amount].to_i\n charity = params[:charity]\n\n\n\t customer = Stripe::Customer.create(\n\t :email => params[:stripeEmail],\n\t :card => params[:stripeToken]\n\t )\n\n\t charge = Stripe::Charge.create(\n\t :customer => customer.id,\n\t :amount => amount,\n\t :description => 'Easy Giving Customer',\n\t :currency => 'usd'\n\t )\n\n new_donation= Donation.create(\n amount: amount,\n charity_name: charity\n )\n\n new_donation.user = current_user\n new_donation.save\n\n @donation = new_donation\n redirect_to donation_path(@donation) #donation show\n\n #if there's a processing error, show error,redirect to make a new donation\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_donation_path\n\tend",
"def new_charge\n end",
"def charge_reservation (amount_fee, token, currency_type, stripe_user_id)\n charge = Stripe::Charge.create({\n amount: amount_fee,\n source: token,\n currency: currency_type\n },\n stripe_account: stripe_user_id\n )\n end",
"def charge_params\n params.require(:charge).permit(:txn_id, :source, :amount, :app_id)\n end",
"def pay\n # Find the user to pay.\n captain = User.find( params[:id] )\n\n # Charge amount owed over .971 to account for Stripe fee. This needs to be done here because the fee is being charged to the captain, so he needs to charge his players extra to account for the money being taken out of his take.\n amount = session[:amount_owed]/0.971\n # Calculate the fee amount that goes to the application.\n fee = (amount * Rails.application.secrets.fee_percentage).to_i\n\n begin\n charge_attrs = {\n amount: amount,\n currency: user.currency,\n source: params[:token],\n description: \"Test Charge via Stripe Connect\",\n application_fee: fee,\n destination: captain.stripe_user_id\n }\n\n # case params[:charge_on]\n # when 'connected'\n # p charge_attrs\n # # Use the user-to-be-paid's access token\n # # to make the charge directly on their account\n # charge = Stripe::Charge.create( charge_attrs, user.secret_key )\n # when 'platform'\n # # Use the platform's access token, and specify the\n # # connected account's user id as the destination so that\n # # the charge is transferred to their account.\n # charge_attrs[:destination] = user.stripe_user_id\n charge = Stripe::Charge.create( charge_attrs )\n # end\n\n flash[:notice] = \"Charged successfully! <a target='_blank' rel='#{params[:charge_on]}-account' href='https://dashboard.stripe.com/test/payments/#{charge.id}'>View in dashboard »</a>\"\n\n rescue Stripe::CardError => e\n error = e.json_body[:error][:message]\n flash[:error] = \"Charge failed! #{error}\"\n end\n\n redirect_to session[:saved_url]\n end",
"def charges\r\n @charges ||= ChargesController.new(configuration: @configuration)\r\n end",
"def create\n begin\n purchase = Purchase.new(history_params)\n purchase.package = @package\n purchase.user = current_user\n\n # Get the credit card details submitted by the form\n token = stripe_token_params\n\n # Create the charge on Stripe's servers - this will charge the user's card\n Purchase.transaction do\n promo = ParamsHelper.parse_promo_code_query(params)\n total = @package.total\n if promo\n total = promo.discount_price(total)\n purchase.promo_code = promo\n purchase.discount = @package.total - total\n end\n begin\n charge = Stripe::Charge.create(\n :amount =>(total * 100).to_i(), # amount in cents\n :currency => \"cad\",\n :source => token[:id],\n :description => \"#{@package.quantity} bids purchased\"\n )\n purchase.transaction_id = charge.id\n purchase.total = total\n\n if purchase.save\n render json: purchase\n else\n # This should NEVER happen, if it does, it requires immediate investigation\n logger.fatal \"Trying to create purchase #{purchase.inspect} resulted in errors: #{purchase.errors.full_messages}\"\n errors = errors_to_hash(purchase)\n render json: errors, status: :unprocessable_entity\n end\n rescue Stripe::CardError => e\n logger.warn \"Card declined for purchase #{purchase.inspect}\"\n warn_exception(e)\n errors = [ \"Your credit card was declined by Stripe, please contact support\"]\n render json: errors, status: :unprocessable_entity\n end\n end\n rescue ActiveRecord::RecordNotFound\n render json: {:promo_code => \"Promotion code is invalid\"}, status: :bad_request\n end\n end",
"def create\n @creaditcharge = Creaditcharge.new(creaditcharge_params)\n\n respond_to do |format|\n if @creaditcharge.save\n format.html { redirect_to @creaditcharge, notice: 'Creaditcharge was successfully created.' }\n format.json { render :show, status: :created, location: @creaditcharge }\n else\n format.html { render :new }\n format.json { render json: @creaditcharge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n @content.user = current_user\n\n charge = Stripe::Charge.create(\n :amount => 2000,\n :currency => \"usd\",\n :source => params[:stripeToken],\n :description => \"Charge for jayden.smith@example.com\"\n )\n\n @content.charge_id = charge.id\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to app_content_path(@content), notice: 'Content was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charge!\n # get the credit card details submitted by the form\n # create the charge on Stripe's servers - this will charge the user's card\n currency = Selfstarter::Application::CURRENCY\n\n charge = Stripe::Charge.create({\n :amount => @campaign_level.price_to_cents, # amount in cents\n :currency => currency,\n :card => @card_id,\n :description => @campaign_level.title,\n :application_fee => @campaign_level.application_fee_cents # amount in cents\n },\n @campaign_level.campaign.user.stripe_token # user's access token from the Stripe Connect flow\n )\n\n charge['id']\n end",
"def removalcharge_params\n params.require(:charge).permit(:charge)\n end",
"def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def charge!(token = nil)\n return nil if !structure.can_receive_payments?\n\n customer = user.stripe_customer || user.create_stripe_customer(token)\n return nil if customer.nil?\n\n charge = Stripe::Charge.create({\n amount: amount.to_i * 100,\n currency: GiftCertificate::CURRENCY,\n customer: customer.id,\n destination: structure.stripe_managed_account\n })\n\n self.stripe_charge_id = charge.id\n self.save\n\n send_emails\n self.delay.retrieve_fees\n\n charge\n end",
"def create_charge(stripe_customer)\n begin\n str = Stripe::Charge.create({\n customer: stripe_customer,\n amount: (amount*100).to_i,\n description: description,\n currency: 'inr',\n })\n rescue Stripe::InvalidRequestError => e\n self.errors.add(:base,e.message)\n e.message\n end\n end",
"def create\n if not params[:stripeToken].present?\n charge_record = Charge.create!(charge_params)\n DonationMailer.donation_notification(charge_record).deliver_later\n redirect_to(:back)\n elsif params[:stripeToken].present?\n # determine if the charge is a donation or registration fee\n @description = \"\"\n if params[:is_donation].present?\n @description = \"Wake \\'N Shake Donation\"\n elsif params[:is_registration_fee].present?\n @description = \"Wake \\'N Shake Registration Fee\"\n end\n\n # registration fee amount - $20\n @amount = 20\n\n # if not registration fee, set donation amount\n if params[:donation_amount].present?\n @amount = params[:donation_amount].to_i\n end\n\n customer = Stripe::Customer.create(\n email: params[:stripeEmail],\n source: params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n customer: customer.id,\n amount: @amount*100,\n description: @description,\n currency: 'usd'\n )\n\n # associate the charge to a team or dancer\n if params[:charge_type] == \"Dancer\"\n @dancer = Dancer.find(params[:dancer_id])\n charge_record = @dancer.charges.new(amount: @amount, email: params[:stripeEmail])\n if params[:is_donation].present?\n charge_record.is_donation = true\n charge_record.save\n elsif params[:is_registration_fee].present?\n charge_record.is_registration_fee = true\n charge_record.save\n end\n elsif params[:charge_type] == \"Team\"\n @team = Team.find(params[:team_id])\n charge_record = @team.charges.new(amount: @amount, email: params[:stripeEmail], is_donation: true)\n elsif params[:charge_type] == \"All\"\n charge_record = Charge.new(amount: @amount, email: params[:stripeEmail], is_donation: true)\n end\n\n if charge_record.save\n if charge_record.is_registration_fee.present?\n redirect_to dancer_path(@dancer)\n elsif charge_record.is_donation.present?\n DonationMailer.donation_notification(charge_record).deliver_later\n redirect_to charge_record\n end\n end\n else\n redirect_to root_path\n end\n rescue Stripe::CardError => e\n logger.debug e.message\n redirect_to :back, flash: { error:\"#{e.message} Please try again or try another card.\" }\n end",
"def capture(params = {})\n req = WebPay::ChargeRequestWithAmount.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'capture', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def charge(company_number, charge_id)\n client.get(\"company/#{company_number}/charges/#{charge_id}/\")\n end",
"def create\n # Amount in cents\n @amount = params[:price].to_i * 100\n \n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :source => params[:stripeToken]\n )\n \n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Rails Stripe customer',\n :currency => 'aud'\n )\n \n set_available_to_false(params[:product_id])\n add_user_balance(params[:price])\n redirect_to root_path\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to new_charge_path\n end",
"def charge_bill_source bill_src_id, bill_id, amount\n url = 'https://%s:@api.omise.co/charges' % [ ENV['OMISE_SECRET_KEY'] ]\n api_uri = URI.parse(url)\n # must convert amout to satang\n data = {'amount' => (amount * 100).to_i.to_s, 'currency' => 'thb', 'source' => bill_src_id.to_s,\n 'description' => 'Charge for bill id ' + bill_id.to_s}\n puts data\n res = Net::HTTP.post_form(api_uri, data)\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n puts res.body\n JSON.parse res.body\n else\n puts res.body\n puts res.error!\n\n nil\n end\n end",
"def charge amount=0.0, method=\"pcc\", note=''\n\n invoice_item_category = InvoiceItemCategory.where(code:method).first\n\n #check the invoice category\n if invoice_item_category.nil? then\n raise \"Category not found\"\n return\n end\n\n #create a new invoice_item w/ the appropiate category\n Invoice.transaction do\n invoice_item = self.invoice_items.new({\n invoice_item_category_id:invoice_item_category.id,\n charges:amount,\n note:note\n })\n\n if invoice_item.save! then\n #update the total billing\n self.update_attribute(:total_billing, self.generate_total_billing)\n if self.total_billing.zero? then\n self.settled!\n end\n else\n raise \"failed to save transaction\"\n return\n end\n\n end\n end",
"def new_charge!(charge_payment_method_id, charge_amount)\n\n charge_attributes = {:date => Time.now,\n :amount => charge_amount,\n :payment_method_id => charge_payment_method_id,\n :currency => SystemConfiguration::Variable.get_value('payments.default_currency', 'EUR')}\n charge_attributes.merge!({:sales_channel_code => self.sales_channel_code}) unless self.sales_channel_code.nil?\n\n charge = Payments::Charge.create(charge_attributes)\n self.charges << charge\n return charge\n end",
"def create\n customer = Stripe::Customer.create({\n :description => current_user.id,\n :email => current_user.email,\n :card => params[:stripeToken],\n })\n\n current_user.stripe_id = customer.id\n current_user.save!\n\n Stripe::Charge.create(\n :customer => current_user.stripe_id,\n :amount => 250,\n :description => 'Fantasy Rocket Monthly Subscription',\n :currency => 'usd',\n )\n\n current_user.create_subscription!\n redirect_to params[:redirect_to] || root_url, notice: \"Thanks! You're now subscribed.\"\n rescue Stripe::CardError => e\n redirect_to new_subscriptions_url, alert: e.message\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def charge(json_input, firestore_service)\n # Check that input is not empty, otherwise continue\n halt 400, 'Invalid request - no JSON given' if json_input.empty?\n\n # Check that required params are passed\n cust_id = json_input['customer_id']\n firebase_store_id = json_input['firebase_store_id']\n amount = json_input['amount']\n payment_src = json_input['source']\n charge_description = json_input['description']\n statement_descriptor = json_input['statement_descriptor']\n customer_email = json_input['email']\n\n # Note : we don't need payment source because Stripe's mobile SDK\n # automatically updates payment method via standard integration\n if cust_id.nil? || firebase_store_id.nil? || amount.nil? || payment_src.nil?\n return_error 400, 'Invalid request - required params not passed'\n end\n\n # Try getting the Store object from firebase\n store_from_firebase = firestore_service.get_store firebase_store_id\n return_error 400, \"Store #{firebase_store_id} not found\" if store_from_firebase.nil?\n\n store_stripe_id = store_from_firebase.stripe_user_id\n\n # Calculate the fee to charge\n application_fee = amount * store_from_firebase.txn_fee_percent / 100\n application_fee += store_from_firebase.txn_fee_base\n application_fee = application_fee.to_i # Stripe requires an integer\n\n begin\n # This creates a shared customer token, required for connected accounts\n token = Stripe::Source.create({\n customer: cust_id,\n original_source: payment_src,\n usage: 'reusable'\n }, stripe_account: store_stripe_id)\n # This creates a charge token - the customer MUST have a payment method\n # Payment method should be pre-populated with Stripe's mobile SDKs\n charge = Stripe::Charge.create({\n amount: amount,\n currency: 'cad',\n source: token.id,\n application_fee_amount: application_fee,\n description: charge_description,\n receipt_email: customer_email,\n statement_descriptor: statement_descriptor\n }, stripe_account: store_stripe_id)\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating charge: #{e.message}\"\n end\n\n # Charge successful\n log_info 'Charge successful'\n status 201\n # Return the charge ID\n { charge_id: charge.id }.to_json\n end",
"def create\n\n @recharge = Recharge.recharge_by_credit_card(user: current_user, recharge: recharge_params)\n\n respond_to do |format|\n if @recharge.save\n\n # create recharge\n receipt = Receipt.create({user_id: @recharge.user.id, agent_id: @recharge.agent.id, amount: @recharge.amount, ip_address: request.remote_ip})\n receipt.save\n\n format.html { redirect_to @recharge, notice: 'Recharge was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def creaditcharge_params\n params.require(:creaditcharge).permit(:paid, :amount, :currency, :refunded)\n end",
"def index\n @charges = Charge.all\n end",
"def subscribe\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Calculate the fee percentage that applies to\n # all invoices for this subscription.\n fee_percent = (Rails.application.secrets.fee_percentage * 100).to_i\n begin\n if user.stripe_customer_id\n customer = Stripe::Customer.retrieve(user.stripe_customer_id)\n customer.coupon = 'ahip200off'\n customer.save\n\n customer.subscriptions.create({:plan => params[:plan]})\n #customer.application_fee_percent = fee_percent\n # customer.save\n else\n # Create a customer and subscribe them to a plan\n # in one shot.\n # Normally after this you would store customer.id\n # in your database so that you can keep track of\n # the subscription status/etc. Here we're just\n # fire-and-forgetting it.\n customer = Stripe::Customer.create(\n {\n card: params[:token],\n email: current_user.email,\n plan: params[:plan],\n application_fee_percent: fee_percent,\n metadata: {name: user.name},\n # coupon: 'ahip200off',\n },\n user.secret_key\n )\n user.stripe_customer_id = customer.id\n user.save!\n\n end\n flash[:notice] = \"Subscribed! <a target='_blank' rel='app-owner' href='https://dashboard.stripe.com/test/customers/#{customer.id}'>View in dashboard »</a>\"\n\n rescue Stripe::CardError => e\n error = e.json_body[:error][:message]\n flash[:error] = \"Charge failed! #{error}\"\n end\n\n redirect_to user_path( user )\n end",
"def create\n plan = params[\"payment\"][\"plan\"]\n plan=\"premium_monthly\" if plan.empty?\n stripe_token = params[:payment][:stripe_customer_token]\n cardHolderName = params[\"cardHolderName\"]\n email = params[\"payment\"][\"email\"]\n flag = false\n\n if stripe_token\n begin\n @payment = current_user.payments.new(payment_params)\n customer = current_user.do_transaction(params[:payment_type], stripe_token, plan, cardHolderName, email)\n if customer\n @payment.stripe_customer_token = customer.id\n subcripted_detail = customer.subscriptions[\"data\"][0]\n flash[:notice] = 'Card charged successfully'\n else\n flag = true\n flash[:alert] = 'Some error happened while charging you, please double check your card details'\n end\n rescue Stripe::APIError => e\n flash[:alert] = e\n flag = true\n end\n else\n flag = true\n flash[:alert] = 'You did not submit the form correctly'\n end\n\n if flag\n render new_payment_path({plan: plan, error: e})\n end\n\n respond_to do |format|\n if @payment.save\n plan = Payment.plans[plan]\n current_user.update_attributes(subscription: plan, remaining_days: -1, stripe_customer_id: customer.id, is_paid_user: true)\n NotificationMailer.monthly_subscription_email(current_user, subcripted_detail).deliver_now\n format.html { redirect_to \"/users/edit\", notice: 'Payment made successfully.'}\n format.json { render json: @payment, status: :created, location: @payment }\n end\n end\n\n end",
"def create_creditcard\n \n @creditcard = Creditcards.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creditcard }\n end\n end",
"def create\n\n campaign_id = params[:campaign_id]\n credit_card_id = params[:credit_card_id]\n amount = params[:amount]\n\n #testing\n campaign = Campaign.find_by_id(campaign_id)\n user_id = campaign.user_id\n wepay_payment_type = \"credit_card\"\n if(amount>1)\n if(campaign!=nil)\n #create the payment object\n payment = Payment.new({\n campaign_id: campaign_id,\n payer_id: user_id,\n wepay_payment_id: credit_card_id,\n wepay_payment_type: wepay_payment_type,\n amount: amount\n })\n if !payment.valid?\n render json: error(payment.errors.full_messages)\n end\n if payment.valid? && payment.create_checkout && payment.save\n campaign.update_amount_donated\n render json: {\"checkout_id\" => payment[\"wepay_checkout_id\"]}\n else\n render json: payment_invalid_error\n end\n end\n end\n end",
"def create\n @payment = @contract.payments.new(payment_params)\n\n if @payment.save\n render :show, status: :created, location: url_for([@contract, @payment])\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end",
"def charge_params\n params.fetch(:charge, {})\n end",
"def charge(customer_to_be_charged)\n payments.create(:customer => customer_to_be_charged)\n end",
"def charge\n starting = format_date(params['starting_date'.to_sym])\n ending = format_date(params['ending_date'.to_sym])\n chargeable = params[:chargeable].upcase unless params[:chargeable].nil?\n charged = params[:charged].upcase unless params[:charged].nil?\n charged_date = params[:charged_date]\n charged_code = params[:charged_code]\n project_id = params[:project]\n task_id = params[:task]\n activities = Activity.filter(starting, ending, chargeable, charged, project_id, task_id, charged_code)\n # unless params[:filter].blank?\n # project_ids = Project.where(\"name ILIKE ?\", \"%#{params[:filter]}%\").ids\n # activities = activities.where(project_id: project_ids)\n # end\n filter_condition = {starting: starting, ending: ending, chargeable: chargeable, charged: charged, project: project_id}\n activities = activities.order(:project_id, :task_id)\n quantity = activities.size\n charged_code = generate_random_string\n activities.update_all(charged: true, charged_code: charged_code, charged_date: charged_date.in_time_zone, updated_at: DateTime.now)\n activities.reload\n response = {result: 'updated', quantity: quantity, charged_code: charged_code, charged_date: charged_date}\n render json: response.to_json\n end",
"def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def create\n render json: ::Transaction::CreditSerializer.new( do_credit! ), status: :created\n end",
"def credit_card_charge_params\n params.require(:credit_card_charge).permit(:paid, :amount, :currency, :refunded, :customer_id)\n end",
"def create\n @discharge = Discharge.new(params[:discharge])\n\n respond_to do |format|\n if @discharge.save\n flash[:notice] = 'Discharge was successfully created.'\n format.html { redirect_to(@discharge) }\n format.xml { render :xml => @discharge, :status => :created, :location => @discharge }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @discharge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plate_cost = PlateCost.new(params[:plate_cost])\n\n respond_to do |format|\n if @plate_cost.save\n format.html { redirect_to @plate_cost, notice: 'Plate Cost was successfully created.' }\n format.json { render json: @plate_cost, status: :created, location: @plate_cost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plate_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Amount in cents\n @amount = 1500\n\n customer = Stripe::Customer.create(\n :email => current_user.email,\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => @amount,\n :description => 'Tshirtgram T-shirt',\n :currency => 'GBP'\n )\n\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_path\n\n @addtosaletable=Sale.create(:email=>current_user.email, :user_id=>current_user.id, :amount=>@amount, :stripe_id=>customer.id,\n :stripe_token=>params[:stripeToken], :picture_id=>params[:picture_id], :size=>params[:size], :address=>params[:address], :country=>params[:country], :postal_code=>params[:postal_code], :card_expiration=>Date.new(charge.card.exp_year,charge.card.exp_month,1) )\n \n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def chargeUser(msisdn,amount,userToken)\n \tcontent = open('https://devapi.globelabs.com.ph/payments/2307').read\n\tjson = JSON.parse(content)\n\tincrement = json['result'].first['reference_code'].to_i+1\n\turi = URI.parse(\"https://devapi.globelabs.com.ph/payment/v1/transactions/amount/\")\n uri.query = \"access_token=#{userToken}\"\n response = HTTParty.post(uri,\n\t:body => {:description => 'desc', :endUserId => msisdn, :amount => amount, :referenceCode => 91131000001,\n\t:transactionOperationStatus => 'charged'})\n output(response)\n response.code.eql?(201) ? (Transaction.successful(msisdn,amount) ; sendSms(msisdn,amount,userToken)) : (Transaction.failed(msisdn,amount))\n end",
"def gnc_charge_params\n params.require(:gnc_charge).permit(:charge_moment, :weather, :celsius_temperature, :cost_on_argentinian_pesos, :car_id, :service_station_id, :client_id)\n end",
"def create\n respond_with client, @_resource = CreditContractService.new.create(client, credit_contract_params)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def recharge_params\n params.require(:recharge).permit(:user_id, :agent_id, :last4, :card_type, :paid, :amount, :currency, :refunded, :fee, :captured, :failure_message, :failure_code, :amount_refunded, :customer, :invoice, :description, :dispute, :number, :card_name, :exp_month, :exp_year, :cvc)\n end",
"def create\n #@order = Order.new(order_params)\n @order = current_user.orders.build(order_params)\n @order.add_line_items_from_cart(@cart)\n \n @amount = @cart.total_price.to_i * 100\n\n customer = Stripe::Customer.create(\n email: params[:stripeEmail],\n source: params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n customer: customer.id,\n amount: @amount,\n description: 'Grassy Payment',\n currency: 'cad'\n )\n\n # GET SWIFT INTEGRATION\n # api_key = ENV[\"swift_api_key\"]\n \n dropoffAddress = \"#{current_user.street_address}, #{current_user.city}, #{current_user.postal_code}, #{current_user.province}\"\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": ENV[\"swift_api_key\"],\n \"booking\":{\n \"items\": $items,\n \"pickupDetail\": {\n \"name\": \"Grassy\",\n \"phone\": \"7788368819\",\n \"address\": \"375 Water Street, Vancouver, BC V6B 5C6\"\n },\n \"dropoffDetail\": {\n \"name\": current_user.name,\n \"phone\": current_user.telephone,\n \"address\": dropoffAddress\n }\n }\n }.to_json, \n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n\n respond_to do |format|\n if @order.save\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n UserNotifier.send_order_confirmation(@order).deliver # sends order confirmation email to user\n UserNotifier.send_order_confirmation_to_grassy_owner(@order).deliver # sends order confirmation email to user\n format.html { redirect_to root_url, notice: 'Thank you for your order.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Stripe::CardError => e\n flash[:error] = e.message\n redirect_to root_url and return\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge.destroy\n respond_to do |format|\n format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contract = Contract.new(contract_params)\n @contract.daily_premium_prices.push(params[:daily_premium_prices])\n\n respond_to do |format|\n if @contract.save\n # format.html { redirect_to @contract, notice: 'Contract was successfully created.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n valor1 = customer_invoice_params[\"invoice_value\"].gsub('$','').gsub(',','')\n params[\"invoice_value\"] = valor1\n\n @customer_invoice = CustomerInvoice.create(customer_invoice_params)\n\n if @customer_invoice.save\n recalculate_cost_center(@customer_invoice.sales_order.cost_center_id)\n render :json => {\n message: \"¡El Registro fue creado con exito!\",\n register: @customer_invoice,\n type: \"success\"\n }\n else\n render :json => {\n message: \"¡El Registro no fue creado!\",\n type: \"error\",\n message_error: @customer_invoice.errors.full_messages\n }\n end\n \t\n end",
"def orders_create_charge_with_http_info(id, charge_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.orders_create_charge ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ChargesApi.orders_create_charge\"\n end\n # verify the required parameter 'charge_request' is set\n if @api_client.config.client_side_validation && charge_request.nil?\n fail ArgumentError, \"Missing the required parameter 'charge_request' when calling ChargesApi.orders_create_charge\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/orders/{id}/charges'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(charge_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ChargeOrderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ChargesApi.orders_create_charge\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChargesApi#orders_create_charge\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def donate_cash\n @donation_cash = DonationCash.new(donation_cash_params)\n @sender = User.find(@donation_cash.user_id)\n @donation_cash.pot = @pot\n @donation_cash.user = @sender\n @pot.cash_collected = @pot.cash_collected + @donation_cash.amount\n\n respond_to do |format|\n if @donation_cash.save && @pot.save\n format.json\n else\n format.json { render json: @donation_cash.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7672574",
"0.7215251",
"0.68520707",
"0.6689371",
"0.66431886",
"0.66290617",
"0.65909123",
"0.6544708",
"0.6541061",
"0.65237236",
"0.65159947",
"0.65101594",
"0.64668536",
"0.6451828",
"0.64515865",
"0.6396128",
"0.63951296",
"0.63783294",
"0.6332698",
"0.6322661",
"0.62856615",
"0.62774783",
"0.62634194",
"0.62592894",
"0.6255359",
"0.6243685",
"0.6196784",
"0.61722744",
"0.6161052",
"0.6154757",
"0.61486",
"0.614158",
"0.61361665",
"0.6128327",
"0.6111237",
"0.610895",
"0.61031055",
"0.6096373",
"0.60885483",
"0.6071986",
"0.6056917",
"0.60537976",
"0.6047437",
"0.6038193",
"0.6037441",
"0.60318613",
"0.6027488",
"0.6026142",
"0.60224926",
"0.5998073",
"0.5979802",
"0.5973167",
"0.5963664",
"0.5956529",
"0.59492564",
"0.5940139",
"0.5928337",
"0.59273696",
"0.5904019",
"0.5895224",
"0.5895151",
"0.58843046",
"0.58838356",
"0.5878861",
"0.5870921",
"0.5867095",
"0.5862137",
"0.5827961",
"0.58239114",
"0.5815233",
"0.5811798",
"0.58104324",
"0.5808931",
"0.58047336",
"0.5803638",
"0.5800002",
"0.5793101",
"0.57885563",
"0.5784098",
"0.578026",
"0.57609177",
"0.57419384",
"0.57394683",
"0.5738058",
"0.57371086",
"0.5735721",
"0.5728136",
"0.5720582",
"0.57150996",
"0.5694829",
"0.5694694",
"0.5681632",
"0.5679041",
"0.56787014",
"0.56787014",
"0.56787014",
"0.5673779",
"0.56692946",
"0.5668497",
"0.56674",
"0.56661063"
] | 0.0 | -1 |
PATCH/PUT /charges/1 PATCH/PUT /charges/1.json | def update
respond_to do |format|
if @charge.update(charge_params)
format.html { redirect_to @charge, notice: 'Charge was successfully updated.' }
format.json { render :show, status: :ok, location: @charge }
else
format.html { render :edit }
format.json { render json: @charge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n if @charge.update_attributes(params[:charge])\n format.html { redirect_to @charge, notice: 'Charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @charge.update(charge_params)\n if @charge.owner_type == \"User\"\n format.html { redirect_to user_path(:id => @charge.owner_id, :topic => \"personen_charges\"), notice: 'Charge was successfully created.' }\n end\n if @charge.owner_type == \"Company\"\n format.html { redirect_to company_path(:id => @charge.owner_id, :topic => \"institutionen_charges\"), notice: 'Charge was successfully created.' }\n end\n format.json { render :show, status: :ok, location: @charge }\n else\n format.html { render :edit }\n format.json { render json: @charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @recharge.update(recharge_params)\n format.html { redirect_to @recharge, notice: 'Recharge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recharge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n if @charge_master.update_attributes(params[:charge_master])\n format.html { redirect_to @charge_master, notice: 'Charge master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @charge_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patient_charge = PatientCharge.find(params[:id])\n\n respond_to do |format|\n if @patient_charge.update_attributes(params[:patient_charge])\n format.html { redirect_to @patient_charge, notice: 'Patient charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n @variable_charge = VariableCharge.find(params[:id])\n\n respond_to do |format|\n if params[:taxes]\n params[:taxes].each do |t|\n\t tax = Taxrate.find_by_name t[0]\n\t # t is the key\n\t if t[1] == '1'\n\t @variable_charge.taxrates << tax unless @variable_charge.taxrates.exists?(tax)\n\t else\n\t @variable_charge.taxrates.delete(tax) if @variable_charge.taxrates.exists?(tax)\n\t end\n\tend\n end\n if @variable_charge.update_attributes(params[:variable_charge]) || params[:taxes]\n format.html { redirect_to(variable_charges_path, :notice => 'VariableCharge was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @variable_charge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to new_charge_path }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate = Crate.find(params[:id])\n\n paid = @crate.paid\n\n respond_to do |format|\n if @crate.update_attributes(params[:crate])\n \n # Only sending the mail, in case the paid date was newly added.\n if (paid.nil? == true) && (@crate.paid.nil? == false)\n CratesNotifier.crate_paid(@crate).deliver\n end\n\n format.html { redirect_to @crate, :notice => 'Crate was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @gnc_charge.update(gnc_charge_params)\n format.html { redirect_to @gnc_charge, notice: \"Gnc charge was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gnc_charge }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gnc_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Discharge\n respond_to do |format|\n if @discharge.update(discharge_params)\n format.html { redirect_to @discharge, notice: 'Discharge was successfully updated.' }\n format.json { render :show, status: :ok, location: @discharge }\n else\n format.html { render :edit }\n format.json { render json: @discharge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @charge = Charge.find(params[:id])\n if @charge.update_attributes(params[:charge])\n redirect_to @charge, notice: 'Charge was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end",
"def update\n respond_to do |format|\n charge_deposit if @keycard_checkout.payment_type == 'Stripe' && params[:keycard_checkout][:deposit] == '1'\n refund_deposit if @keycard_checkout.payment_type == 'Stripe' && params[:keycard_checkout][:refund] == '1'\n\n if @keycard_checkout.update(keycard_checkout_params)\n format.html { redirect_to @member, notice: 'keycard_checkouts record was successfully updated.' }\n format.json { render :show, status: :ok, location: @keycard_checkouts }\n else\n format.html { render :edit }\n format.json { render json: @keycard_checkout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @accommodation_charge.update(accommodation_charge_params)\n format.html { redirect_to @accommodation_charge, notice: 'Accommodation charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @accommodation_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @organization_charge.update(organization_charge_params)\n format.html { redirect_to @organization_charge, notice: 'Organization charge was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization_charge }\n else\n format.html { render :edit }\n format.json { render json: @organization_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @congress.update(congress_params)\n format.html { redirect_to @congress, notice: 'Congress was successfully updated.' }\n format.json { render :show, status: :ok, location: @congress }\n else\n format.html { render :edit }\n format.json { render json: @congress.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n if @plate_cost.update_attributes(params[:plate_cost])\n format.html { redirect_to @plate_cost, notice: 'Plate Cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plate_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment].has_key?(a)\n params[:payment][a].gsub!(/[$,]/, \"\")\n params[:payment][a] = (params[:payment][a].to_f * 100).to_i\n end\n\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to :payments, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n @editable = true\n format.html { render :show }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_charge_card(charge_id,\r\n body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/charges/{charge_id}/card'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'charge_id' => charge_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.patch(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesCardResponse.from_hash(decoded)\r\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single donation based on the id\n donation = Donation.find_by(id: the_id)\n\n # update it\n if donation.update!(\n amount: params[:amount],\n frequency: params[:frequency])\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @creaditcharge.update(creaditcharge_params)\n format.html { redirect_to @creaditcharge, notice: 'Creaditcharge was successfully updated.' }\n format.json { render :show, status: :ok, location: @creaditcharge }\n else\n format.html { render :edit }\n format.json { render json: @creaditcharge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @credit_card_charge.update(credit_card_charge_params)\n format.html { redirect_to @credit_card_charge, notice: 'Credit card charge was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card_charge }\n else\n format.html { render :edit }\n format.json { render json: @credit_card_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_charge.update(time_charge_params)\n format.html { redirect_to @time_charge, notice: 'Time charge was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_charge }\n else\n format.html { render :edit }\n format.json { render json: @time_charge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n # if @delivery.paid_for != (delivery_params[:paid_for] == \"1\")\n if !@delivery.paid_for && delivery_params[:paid_for] == \"1\"\n create_payment(@delivery)\n end\n # end\n if @delivery.update(delivery_params)\n format.html { redirect_to @delivery, notice: 'Delivery was successfully updated.' }\n format.json { render :show, status: :ok, location: @delivery }\n else\n format.html { render :edit }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n if @proof_cost.update_attributes(params[:proof_cost])\n format.html { redirect_to @proof_cost, notice: 'Proof cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proof_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @cage.update_attributes(params[:cage])\n format.json { head :no_content }\n else\n format.json { render json: @cage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, contract: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_charge_payment_method(charge_id,\r\n body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/charges/{charge_id}/payment-method'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'charge_id' => charge_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.patch(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n ChargesPaymentMethodResponse.from_hash(decoded)\r\n end",
"def update\n @registration_contract = Registration::Contract.find(params[:id])\n\n respond_to do |format|\n if @registration_contract.update_attributes(params[:registration_contract])\n format.html { redirect_to @registration_contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registration_contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @current_user.has_privilege?('charges', 'update')\n @charge = Charge.find(params[:id])\n if @charge.update_attributes(params[:charge])\n redirect_to(charges_path, :notice => '更新收费项目成功.')\n\n else\n render :action => \"edit\"\n end\n else\n flash[:notice] = \"你没有修改收费项目的权限,请联系管理员\"\n render_403\n end\n\n end",
"def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.status == \"preparing\"\n format.json { render text: '', status: 409 }\n else\n if @order.update(order_params)\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, additions: @order.additions, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render text: response_json, status: :created, location: @order }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n # @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_request = GiftRequest.find(params[:id])\n \n respond_to do |format|\n if @gift_request.update_attributes(params[:gift_request])\n format.html { redirect_to @gift_request, notice: 'Gift request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_request.errors.full_messages.to_sentence, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compound = Compound.find(params[:id])\n\n respond_to do |format|\n if @compound.update_attributes(params[:compound])\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(order_id: nil, shipping_carrier: nil, shipping_confirmation: nil)\n api_request(\"/charges/#{id}/update\", :post, order_id: order_id,\n shipping_carrier: shipping_carrier,\n shipping_confirmation: shipping_confirmation)\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: 'Billing was successfully updated.' }\n format.json { render :show, status: :ok, location: @billing }\n else\n format.html { render :edit }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @charge_transaction = ChargeTransaction.find(params[:id])\n\n respond_to do |format|\n if @charge_transaction.update_attributes(params[:charge_transaction])\n flash[:notice] = 'ChargeTransaction was successfully updated.'\n format.html { redirect_to charge_transaction_url(@charge_transaction) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @charge_transaction.errors.to_xml }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @contracting_request_document_type = ContractingRequestDocumentType.find(params[:id])\n @contracting_request_document_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @contracting_request_document_type.update_attributes(params[:contracting_request_document_type])\n format.html { redirect_to @contracting_request_document_type,\n notice: (crud_notice('updated', @contracting_request_document_type) + \"#{undo_link(@contracting_request_document_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contracting_request_document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crate.update(crate_params)\n format.html { redirect_to tenant_crates_path(@tenant), notice: 'Crate was successfully updated.' }\n format.json { render :show, status: :ok, location: @crate }\n else\n format.html { render :edit }\n format.json { render json: @crate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cheque_payment = ChequePayment.find(params[:id])\n\n respond_to do |format|\n if @cheque_payment.update_attributes(params[:cheque_payment])\n format.html { redirect_to @cheque_payment, notice: 'Cheque payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cheque_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(invoice_params)\n format.html { redirect_to action: 'index', notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n end\n end\n\n end",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paid.update(paid_params)\n format.html { redirect_to @paid, notice: 'Paid was successfully updated.' }\n format.json { render :show, status: :ok, location: @paid }\n else\n format.html { render :edit }\n format.json { render json: @paid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_document.update(contract_document_params)\n format.html { redirect_to @contract_document, notice: 'Contract document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n notify_admin(\"Card Updated (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discharge = Discharge.find(params[:id])\n\n respond_to do |format|\n if @discharge.update_attributes(params[:discharge])\n flash[:notice] = 'Discharge was successfully updated.'\n format.html { redirect_to(@discharge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discharge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_form.update(contract_form_params)\n format.html { redirect_to @contract_form, notice: 'Contract form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: \"Billing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @billing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end"
] | [
"0.6709213",
"0.63224685",
"0.6219971",
"0.62160665",
"0.6205336",
"0.61869967",
"0.6182331",
"0.61630267",
"0.61559904",
"0.61324704",
"0.61324704",
"0.61280996",
"0.60937095",
"0.6074652",
"0.606247",
"0.6043708",
"0.59999967",
"0.5996834",
"0.5993192",
"0.59772927",
"0.5939196",
"0.593757",
"0.59256715",
"0.59138286",
"0.59030616",
"0.5896982",
"0.5891773",
"0.5891773",
"0.58797896",
"0.58755445",
"0.58752894",
"0.58741367",
"0.5873128",
"0.58600044",
"0.58371055",
"0.5835919",
"0.5835562",
"0.58311766",
"0.5811356",
"0.58056",
"0.57923913",
"0.57889885",
"0.57879287",
"0.578024",
"0.5769626",
"0.576491",
"0.5762608",
"0.5757622",
"0.5754383",
"0.5714205",
"0.5712896",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5712133",
"0.5709531",
"0.5700639",
"0.5687894",
"0.5681769",
"0.5672073",
"0.56710875",
"0.56708056",
"0.5670676",
"0.5670676",
"0.5665761",
"0.56634796",
"0.56603396",
"0.5655689",
"0.56539446",
"0.5634861",
"0.5618798",
"0.56181073",
"0.5618088",
"0.5614256",
"0.56142133",
"0.56138706",
"0.5610949",
"0.5602554",
"0.5599661",
"0.5599539",
"0.5596638",
"0.5591034",
"0.55897087",
"0.55890673",
"0.55872",
"0.5585714",
"0.558393",
"0.5581758",
"0.55816925",
"0.55779123",
"0.5576416",
"0.55758965",
"0.5575427",
"0.5572455",
"0.5572069"
] | 0.6472606 | 2 |
DELETE /charges/1 DELETE /charges/1.json | def destroy
@charge.destroy
respond_to do |format|
format.html { redirect_to charges_url, notice: 'Charge was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n redirect_to charges_url\n end",
"def destroy\n @gnc_charge.destroy\n respond_to do |format|\n format.html { redirect_to gnc_charges_url, notice: \"Gnc charge was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n authorize! :destroy, Discharge\n @discharge.destroy\n respond_to do |format|\n format.html { redirect_to discharges_url, notice: 'Discharge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @creaditcharge.destroy\n respond_to do |format|\n format.html { redirect_to creaditcharges_url, notice: 'Creaditcharge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_masters_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @accommodation_charge.destroy\n respond_to do |format|\n format.html { redirect_to accommodation_charges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @charge_type.charges.count.positive?\n flash[:error] = 'Cannot delete a charge type until all charges of that type are deleted.'\n redirect_to charge_types_url\n return\n end\n @charge_type.destroy\n respond_with(@charge_type)\n end",
"def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @credit_card_charge.destroy\n respond_to do |format|\n format.html { redirect_to credit_card_charges_url, notice: 'Credit card charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @congress.destroy\n respond_to do |format|\n format.html { redirect_to congresses_url, notice: 'Congress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @variable_charge = VariableCharge.find(params[:id])\n @variable_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(variable_charges_url) }\n format.xml { head :ok }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @plate_cost = PlateCost.find(params[:id])\n @plate_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_costs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cheque_payment = ChequePayment.find(params[:id])\n @cheque_payment.destroy\n\n respond_to do |format|\n format.html { redirect_to cheque_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charging_order = ChargingOrder.find(params[:id])\n @charging_order.destroy\n\n respond_to do |format|\n format.html { redirect_to charging_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cost.destroy\n respond_to do |format|\n format.html { redirect_to costs_url, notice: \"Cost was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cost.destroy\n respond_to do |format|\n format.html { redirect_to costs_url, notice: t('Cost was successfully destroyed.') }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diapo = current_church.diapos.find(params[:id])\n @diapo.destroy\n\n respond_to do |format|\n format.html { redirect_to diapos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to @fee.booth, flash: { warning: 'Fee was deleted.' } }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(charge_masters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paymentcash = Paymentcash.find(params[:id])\n @paymentcash.destroy\n\n respond_to do |format|\n format.html { redirect_to paymentcashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultationcharge = Consultationcharge.find(params[:id])\n @consultationcharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultationcharges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @unpaid_debt = UnpaidDebt.find(params[:id])\n @unpaid_debt.destroy\n\n respond_to do |format|\n format.html { redirect_to unpaid_debts_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n @crate.destroy\n respond_to do |format|\n format.html { redirect_to tenant_crates_url, notice: 'Crate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"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 @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @cost.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: @cost.delivery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @coinrate.destroy\n respond_to do |format|\n format.html { redirect_to exchanges_path, notice: 'La cotizacion se ha eliminado con exito.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.76896924",
"0.7397849",
"0.7170086",
"0.7155251",
"0.70793885",
"0.7073027",
"0.7067324",
"0.7063051",
"0.70048577",
"0.70018744",
"0.6968353",
"0.6931584",
"0.69189745",
"0.6872579",
"0.6861695",
"0.6851218",
"0.6824666",
"0.68158454",
"0.6783234",
"0.67831796",
"0.6772752",
"0.67561245",
"0.67561245",
"0.6741886",
"0.67328644",
"0.67171824",
"0.67171824",
"0.67171824",
"0.67171824",
"0.6711363",
"0.6678949",
"0.6674257",
"0.66622317",
"0.66608346",
"0.66608006",
"0.66586137",
"0.6657381",
"0.6655831",
"0.6647012",
"0.66435236",
"0.6640628",
"0.66339517",
"0.6632012",
"0.6623942",
"0.6621391",
"0.6619136",
"0.661405",
"0.66085416",
"0.6606395",
"0.6602541",
"0.66006696",
"0.65991807",
"0.6593538",
"0.6592832",
"0.6591892",
"0.65913904",
"0.65913904",
"0.65913904",
"0.65913904",
"0.65895265",
"0.65890414",
"0.65833473",
"0.6578463",
"0.6575992",
"0.6575992",
"0.65753037",
"0.6568811",
"0.6568811",
"0.6568811",
"0.6568811",
"0.6568811",
"0.6568811",
"0.6568811",
"0.6567124",
"0.65665084",
"0.6562603",
"0.6561856",
"0.6561283",
"0.6561283",
"0.6561283",
"0.6561283",
"0.6561283",
"0.6561283",
"0.6561283",
"0.655863",
"0.65584266",
"0.65551925",
"0.65548426",
"0.65536803",
"0.65536803",
"0.6549948",
"0.6549566",
"0.654943",
"0.65466315",
"0.654245",
"0.654245",
"0.654245",
"0.654245"
] | 0.74057406 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_charge
@charge = Charge.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def charge_params
params.require(:charge).permit(:order_id, :status)
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 |
args are [length, [arrays...]] all args get gobbled into arrays to get our array of arrays, need to index into arrays | def zip_to_length(length, *arrays)
(0...length).map do |i|
arrays[-1].map { |array| array[i] }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getArray _args\n \"getArray _args;\" \n end",
"def array(arg)\n if arg\n arg = arg.chomp.rstrip.lstrip\n name = arg.scan(/\\s*(\\w*)\\[\\d*\\]?/).first.first\n \n # following 10 lines seem to be unnecessary\n # and are left over from early array work\n # but they are still here for a bit\n # determine if there is an array assignement, and how many\n # then eliminate the assignment and update the array size\n # if /\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/ =~ arg\n # assignment = arg.scan(/\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/).first.first\n # array_size = assignment.split(\",\").length\n # if /\\[(\\s*)\\]/ =~ arg\n # arg.gsub!(/(\\[\\d*\\])/, \"[#{array_size}]\")\n # end\n # end\n # arg = arg.scan(/^((\\s*|\\w*)*\\s*\\w*\\[\\d*\\])?/).first.first\n\n # help rad_processor do a better job with array types\n types = [\"int\", \"long\", \"char*\", \"unsigned int\", \"unsigned long\", \"byte\", \"bool\", \"float\" ]\n types.each_with_index do |type, i|\n @type = types[i] if /#{type}/ =~ arg\n end\n raise ArgumentError, \"type not currently supported.. got: #{arg}. Currently supporting #{types.join(\", \")}\" unless @type\n\n arg = \"#{arg};\" unless arg[-1,1] == \";\"\n $array_types[name] = @type\n @type = nil\n $external_var_identifiers << name unless $external_var_identifiers.include?(name)\n # add array_name declaration\n $external_array_vars << arg unless $external_array_vars.include?(arg)\n end\n end",
"def cast_array_for_args\n <<-CODE\n next_int;\n c->args = _int;\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n c->args += N2I(array_get_total(t1));\n CODE\n end",
"def slice_args(out)\n out.shape.map {:*}\n end",
"def array_converter(*args)\n \nend",
"def converted_arrays; end",
"def variable_length( *args )\n return args\nend",
"def isArray _args\n \"isArray _args;\" \n end",
"def lnbAddArray _args\n \"lnbAddArray _args;\" \n end",
"def arrays(args={})\n get(\"/arrays.json\",args)\n end",
"def multi_array_op(func, *args)\n elem = args[0]\n if elem.is_a?(Array)\n elem.each_with_index.collect do |_item, index|\n indexed_args = args.collect { |a| a = a.is_a?(Array) ? a : [a]; a[index] }\n multi_array_op(func, *indexed_args)\n end\n else\n func.call(*args)\n end\n end",
"def g *args # accept multiple arguments as an array\n\targs # returns an array\nend",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def calls_array\n a = return_array\n a[1]\n end",
"def args() return @args end",
"def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend",
"def array(*args)\n args_ = (args.size == 1) && (args[0].is_a? ::Array) ? args[0] : args\n args_.each_with_object(newObject('Array')) do |val, obj|\n obj.add val\n end\n end",
"def double_array(array)\n # your code here\nend",
"def Array(p0) end",
"def array_from_functions(*args)\n counts = Array.new(26).fill(0)\n for arg in args\n if arg.is_a?(Array)\n arg.each do |o| @add_word[o].call(counts); end\n else\n p arg\n @add_word[arg].call(counts);\n end\n end\n counts\n end",
"def arrayize_arguments(args)\n # Go through trailing arguments and suck them in if they don't seem\n # to have an owner.\n array = []\n until args.empty? || args.first.match(/^-/)\n array << args.shift\n end\n array\n end",
"def poorly_written_ruby(*arrays)\n \n # create an empty combined array\n combined_array = []\n \n # for each array in the arrays object, add it to the combined array\n arrays.each do |array|\n combined_array += array\n end\n\n return combined_array\nend",
"def args()\n #This is a stub, used for indexing\n end",
"def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend",
"def statusArgsToArray( *args )\n dataArray = Array.new\n #\n # If only one argument, then assume its already an array.\n #\n if( args.size == 1 )\n dataArray = args[0]\n #\n # Otherwise, take the individual arguments, create a hash and insert into an array.\n #\n elsif( args.size >= 2 )\n data = { :name => args[0], :value => args[1] }\n if( args.size >= 3 )\n data[:unit] = args[2]\n end\n dataArray.push( data )\n end\n #\n # Return the result.\n #\n return dataArray\n end",
"def zip(*args)\n \n multi = Array.new(args[0].length) {[]}\n\n (0...args.length).each do |i|\n (0...args[0].length).each do |j|\n multi[j] << args[i][j]\n end\n end\n multi\nend",
"def lcts(array)\nend",
"def lesson_1\n array = [[1,2,3],['a','b','c'],[0,0,0]]\n\n # Display number of array elements\n array.count\n array.length\n\n # Turn multi-dimension array to single dimension\n array.flatten\nend",
"def how_many_args *args\n args.length\nend",
"def array_concat (*args)\n\t\tfull = Array.new\n\t\targs.each { |item|\n\t\t\tfull << item\n\t\t}\n\n\t\tfull.flatten!\n\t\tfull\n\tend",
"def load(arg)\n\t\tif not arg.length.eql?(@m*@n)\n\t\t\traise \"Bad dimensions, must be #{@n} by #{@m}\"\n\t\tend\n\t\tself.concat(arg.chars.map{|ele| ele.to_i}.each_slice(@n).to_a.transpose)\n\tend",
"def how_many_args(*args)\n\targs.length\nend",
"def mutliplied(array)\nend",
"def build_array(param1, param2, param3)\n\t[param1, param2, param3]\nend",
"def extract_argument_lists(args, splittable_args); end",
"def to_args(arity)\n case arity\n when -1\n full_arguments\n when (min_argument_count..full_argument_count)\n full_arguments.slice(full_argument_count - arity, arity)\n else\n raise ArgumentError, \"Arity must be between #{min_argument_count} \"\\\n \"and #{full_argument_count}\"\n end\n end",
"def to_args(arity)\n case arity\n when -1\n full_arguments\n when (min_argument_count..full_argument_count)\n full_arguments.slice(full_argument_count - arity, arity)\n else\n raise ArgumentError, \"Arity must be between #{min_argument_count} \"\\\n \"and #{full_argument_count}\"\n end\n end",
"def how_many_args(*arg)\n arg.length\nend",
"def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend",
"def [](index); @args[index] end",
"def args(*) end",
"def how_many_args(*args)\n args.length\nend",
"def fetch\n\t\t\t\t[self.[], @args]\n\t\t\tend",
"def length; @args.length end",
"def indices(*rest) end",
"def indices(*rest) end",
"def zany_zip(*args)\n length = args.map(&:length).max\n multi = Array.new(length) {[]}\n\n (0...args.length).each do |i|\n (0...length).each do |j|\n if j >= args[i].length\n multi[j] << nil\n else\n multi[j] << args[i][j]\n end\n end\n end\n multi\nend",
"def args\n @args \n end",
"def parse_splat_args\n unless self.empty?\n args = self#.flatten\n case args.size\n when 1\n return args.first # if there was only one arg passed, return just that, without the array\n when 0\n return nil # if no args were passed return nil\n else\n return args # else return the array back, cause chances are that's what they passed you!\n end\n end\n end",
"def vcat(*narrays) ; cat(1, *narrays) end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def __args_index(sexp)\n args = _vector(sexp)\n args_length = length(sexp) + @incr[]\n args + [:pushl, args_length]\n end",
"def array_of_array_multi(array)\n # YOUR CODE HERE\n multiArr = array.map{ |arr| arr.map{ |num| num * num } }\n p multiArr\n p array\n # array\nend",
"def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end",
"def args\n n = self.num_args\n a = []\n n.times { |i|\n a.push Arg::new(self, i)\n }\n return a\n end",
"def build_array(it1, it2, it3)\n\tnew_array = [it1, it2, it3]\n\tp new_array\nend",
"def extract_build_args args # :nodoc:\n return [] unless offset = args.index('--')\n build_args = args.slice!(offset...args.length)\n build_args.shift\n build_args\n end",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def process_args(args_node)\n return [] unless args_node\n if args_node.first == :array\n args_node.last.map { |node| to_sexp(node) }\n else\n raise \"variable arguments not allowed\"\n end\n end",
"def array?\n GtaScm::Types::ARRAY_TYPES.include?(self.arg_type_id)\n end",
"def resolve_command_args(command_args)\n return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array)\n\n command_args\n end",
"def args\n @args.args\n end",
"def arrays_of_arrays(names, specialties)\n result = []\n\n # initialize iterator\n i = 0\n\n #loops through names\n specialties.each do |specialty|\n\n # shovel sub_array into result\n result.push([names[i]] + [specialty])\n\n # increment iterator\n i += 1\n end\n return result\n\nend",
"def my_function(argument_a, argument_b, *args)\n puts argument_a\n puts argument_b\n p args.class.name # this is now an array\n puts args\nend",
"def build_array\n arr = []\n yield(arr)\n arr \n end",
"def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend",
"def args\n ret = []\n @x.each do |e|\n ret << e.args\n end\n ret.flatten.uniq\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def resolve_command_args(command_args)\n return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array)\n\n command_args\n end",
"def load_data(*args)\n init_data_arrays # wipes all preexisting data in @data_collections and @data_objects\n \n args[0].each.with_index do |array_or_variable, i|\n if i < data_collection_names.count\n @data_collections[i] += array_or_variable \n else\n j = i - data_collection_names.count\n @data_objects[j] = array_or_variable # if array_or_variable.class != Array\n end\n end\n self\n end",
"def arg_size; end",
"def getInput(array)\n # handle bad input\n if ARGV[0] == nil\n printf(\"Bad input\\n\")\n printf(\"Usage: d2p1.rb '<numbers, cols by \\\\t, rows by \\\\n>'\\n\")\n exit\n end\n temp = ARGV[0].split(/\\n/)\n for i in 0...temp.length\n array[i] = temp[i].split(/\\t/)\n end\n for i in 0...array.length\n for j in 0...array[i].length\n array[i][j] = array[i][j].to_i\n end\n end\nend",
"def length_finder(input_array)\n input_array.map(&:length)\nend",
"def split_array(array, number)\n size = number\n \nend",
"def together_slice(*args)\n if_not_contain_array_rails_type_error\n reduce([]) { |ret, list|ret << list.slice(*args) }\n end",
"def arrays_to_hashes\n end",
"def arguments; end",
"def arguments; end",
"def arguments; end"
] | [
"0.72085196",
"0.6706875",
"0.66030556",
"0.652929",
"0.62340826",
"0.62146765",
"0.61685103",
"0.61206514",
"0.6107678",
"0.6088064",
"0.6083156",
"0.6063542",
"0.6036628",
"0.60332185",
"0.6031445",
"0.60296476",
"0.60219175",
"0.60188574",
"0.59962803",
"0.59715825",
"0.5965649",
"0.59621435",
"0.5952879",
"0.59505206",
"0.5913173",
"0.5902036",
"0.5881998",
"0.5865757",
"0.57678604",
"0.5764974",
"0.5763934",
"0.57622766",
"0.5759095",
"0.57306933",
"0.5716979",
"0.5705074",
"0.570448",
"0.56970006",
"0.5679025",
"0.56736064",
"0.5658462",
"0.5655295",
"0.5631626",
"0.5622667",
"0.5619042",
"0.5619042",
"0.56132466",
"0.5603346",
"0.5596859",
"0.55860656",
"0.558493",
"0.558493",
"0.55685",
"0.55657977",
"0.555552",
"0.555552",
"0.55473214",
"0.5535418",
"0.55149496",
"0.55149496",
"0.55115473",
"0.5501528",
"0.54728204",
"0.5455549",
"0.543643",
"0.5433838",
"0.54329336",
"0.5414053",
"0.54073983",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.53947717",
"0.5392087",
"0.5391606",
"0.53880113",
"0.5382779",
"0.53818524",
"0.53817266",
"0.537985",
"0.5376142",
"0.5375878",
"0.5375878",
"0.5375878"
] | 0.6143612 | 7 |
GET /calllists GET /calllists.json | def index
@calllists = Calllist.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end",
"def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end",
"def get_lists(user)\n get(\"/#{user}/lists.json\")\n end",
"def lists\n client.get_lists\n end",
"def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend",
"def list(id)\n get(\"lists/#{id}\").list\n end",
"def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end",
"def get_lists()\n lists = api_request(\"list\")\n return lists.split(\"\\n\")\n end",
"def lists_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling ContactListApi.lists_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactListApi.lists_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/lists'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def playlists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end",
"def lists_by_list_id_get_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_get ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_get\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end",
"def get_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_lists, must be smaller than or equal to 50.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetLists')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n json_response(@board.lists)\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end",
"def index\n paginate json: @user.playlists.all\n end",
"def index\n @lists = List.all\n render json: @lists\n end",
"def get_for_list(list_id, page)\n full_path = full_resource_path(\"/#{list_id}/contacts\", 'lists')\n query_params = MaropostApi.set_query_params({page: page})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def playlists(user)\n get(:standard, {:method => \"user.getPlaylists\", :user => user})\n end",
"def own_playlists\n check_auth :own_playlists\n \n response = connection.post do |req|\n req.url '/user/playlists'\n req.body = { :format => @format }\n end\n response\n end",
"def lists(client_id)\n response = Client_GetLists(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"List\"].collect{|l| List.new(l[\"ListID\"].to_i, l[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end",
"def get_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetExtendedList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def call\n list = JSON.parse(Base64.urlsafe_decode64(@params['list']))\n Success(list)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request,\n message: 'Project list not found'))\n end",
"def mcget_list_menbers(list_id)\n # 82dfd7f973, a38ec3df9c\n begin\n lists_res = setup_mcapi.lists.list({'list_id' => list_id})\n @list = lists_res['data'][0]\n members_res = setup_mcapi.lists.members(list_id)\n @members = members_res['data']\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n redirect_to \"/lists/\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:error] = ex.message\n else\n flash[:error] = \"An unknown error occurred\"\n end\n redirect_to \"/lists/\"\n end\n end",
"def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end",
"def index\n @call_list_memberships = CallListMembership.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @call_list_memberships }\n end\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end",
"def index\n @lists = @user.lists\n end",
"def list\n get('/')\n end",
"def get_list(id)\n record \"/todos/list/#{id}\"\n end",
"def get_all_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.get_all_lists ...\"\n end\n # resource path\n local_var_path = \"/lists/\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_all_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list\n get()\n end",
"def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend",
"def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end",
"def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end",
"def lists(options = { :filter => :open })\n return @lists if @lists\n @lists = Client.get(\"/boards/#{id}/lists\", options).json_into(List)\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calls }\n end\n end",
"def index\n @calls = Call.order('id DESC')\n\n respond_to do |format|\n format.html\n format.json { render json: @calls }\n end\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def user_playlists(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/playlists\", simple_params(options)\n end\n response.body\n end",
"def index\n @lists = current_user.lists\n end",
"def index\n @lists = current_user.lists\n end",
"def get_list(list_name)\n @lib.get_list(list_name)\n end",
"def set_call_list\n @call_list = CallList.find(params[:id])\n end",
"def get_lists(options={})\n visibility = options[:visibility]\n list_type = options[:list_type]\n folder_id = options[:folder_id]\n include_all_lists = options[:include_all_lists]\n include_tags = options[:include_tags]\n\n raise ArgumentError, \"visibility option is required\" unless visibility\n raise ArgumentError, \"list_type option is required\" unless list_type\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetLists do\n xml.VISIBILITY visibility\n xml.LIST_TYPE list_type\n xml.FOLDER_ID folder_id if folder_id.present?\n xml.INCLUDE_ALL_LISTS 'true' if include_all_lists.present?\n xml.INCLUDE_TAGS 'true' if include_tags.present?\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['LIST']\n end",
"def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def lists\n @lists = response[\"lists\"]\n if @lists and @lists[\"groups\"]\n @lists[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::List.new(client, item)}\n end\n end\n @lists\n end",
"def index\n @lists = current_user.lists.all\n end",
"def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def index\n\t\tu = User.find_by(:id => session[:user_id]) \n\t\tif u \n\t\t\t@lists = u.lists.order('id asc')\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'index'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @lists, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend",
"def find_list(id)\n check_token\n response = self.class.get(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n Todoable::List.build_from_response(response.parsed_response)\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end",
"def lists\n load_user_lists\n end",
"def fetch_latest_task_lists\n\t\tresponse = @client.execute(api_method: @gtasks.tasklists.list)\n\t\tputs \"***************** ERROR FETCHING TASK LISTS *****************\" if response.status != 200\n\t\tputs response.body\n\t\t@task_lists = response.data.items\n\tend",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def index\n @lists = current.user.list\n end",
"def get_watchlists(opts={})\n request_params = { source: @source_id }\n request_params.merge(opts) # valid values are accountid and listid - see the API docs for details\n\n uri = URI.parse GET_WATCHLISTS_URL\n uri.query = URI.encode_www_form(request_params)\n\n response = HTTParty.get(uri, headers: {'Cookie' => \"JSESSIONID=#{@session_id}\"}, timeout: 10)\n if response.code != 200\n raise TDAmeritradeApiError, \"HTTP response #{response.code}: #{response.body}\"\n end\n\n watchlists = Array.new\n w = Nokogiri::XML::Document.parse response.body\n w.css('watchlist').each do |watchlist|\n watchlist_name = watchlist.css('name').text\n watchlist_id = watchlist.css('id').text\n watchlist_symbols = Array.new\n\n watchlist.css('watched-symbol').each do |ws|\n watchlist_symbols << ws.css('security symbol').text\n end\n\n watchlists << { name: watchlist_name, id: watchlist_id, symbols: watchlist_symbols }\n end\n\n watchlists\n\n rescue Exception => e\n raise TDAmeritradeApiError, \"error retrieving watchlists - #{e.message}\" if !e.is_ctrl_c_exception?\n end",
"def tasklists\n get gtasks_tasklists_url\n end",
"def showListPendingPays\n puts @current_user\n results = HTTParty.get(\"http://192.168.99.101:4055/lists/by_user?user_id=\"+(@current_user[\"id\"]).to_s)\n if results.code == 200\n render json: results.parsed_response, status: 200\n else\n render json: results.parsed_response, status: results.code\n end\n end",
"def list()\n _params = {}\n return @master.call 'webhooks/list', _params\n end",
"def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end",
"def index\n @task_lists = @project.task_lists.all\n\n respond_with @task_lists\n end",
"def lists\n\t\tRails.cache.fetch(\"#{owner_screen_name}.lists\", :expires_in => 12.hours) do\n\t\t\tbegin\n\t\t\t\tlist = Twitter.lists(owner_screen_name)\n\t\t\trescue Twitter::Error::TooManyRequests\n\n\t\t\trescue Twitter::Error::NotFound\n\t\t\t\t[]\n\t\t\tend\n\t\t\tif list\n\t\t\t\tlist.collect do |item|\n\t\t\t\t\t[item.name, item.slug]\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend\n\tend",
"def index\n @api_v1_shopping_lists = ShoppingList.all\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def list\n call(:get, path)\n end",
"def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end",
"def lists(project_id, complete=nil)\n records \"todo-list\", \"/projects/#{project_id}/todos/lists\", :complete => complete\n end",
"def playlists(all = false, next_url: nil)\n uri = next_url.nil? ? 'https://api.deezer.com/user/me/playlists' : next_url\n headers = {params: {access_token: @access_token}}\n if all\n iterator_wrapper(__method__, next_url: uri)\n else\n response = RestWrapper.perform_request(uri, :get, headers)\n next_url.nil? ? response['data'] : response\n end\n end",
"def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend",
"def get_lists_of_contact_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_lists_of_contact ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TextMagicApi.get_lists_of_contact\"\n end\n # resource path\n local_var_path = '/api/v2/contacts/{id}/lists'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetListsOfContactPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_lists_of_contact\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list\n call! :list\n end",
"def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def index\n @user = current_user\n @playlists = current_user.playlists\n end",
"def index\n # Hubspot::Contact.create!(\"aaron@coderfactory.com\", {firstname: \"Test\", lastname: \"Contact\"})\n lists = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts \"HHHHHHHHHHH\"\n listp = lists.first.last.select { |list| list[\"name\"] == \"New Test List\"}\n listp = listp.first\n puts listp[\"name\"]\n puts \"FFFFFFFFFFFFFFF\"\n contact_list = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists/#{listp['listId'].to_i}/contacts/all?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts contact_list[\"contacts\"].first[\"properties\"][\"firstname\"][\"value\"]\n puts \"LLLLLLLLLLLLLL\"\n puts listp\n @enquiries = Enquiry.all\n end",
"def refresh_lists\n settings = current_user.settings_for(\"mailchimp\")\n unless settings && settings.settings[\"api_key\"]\n flash[:warning] = \"You need to configure your Mailchimp API key!\"\n redirect_to(root_url) and return\n end\n counts = Mailchimp.refresh_lists_for(current_user)\n\n flash[:notice] = \"Successfully cached #{pluralize counts[:lists], 'list'}, #{pluralize counts[:groupings], 'grouping'}, and #{pluralize counts[:groups], 'group'}.\"\n redirect_to(root_url)\n end",
"def index\n @stopword_lists = StopwordList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopword_lists }\n end\n end",
"def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end",
"def get_tasklists\n @tasklists = []\n array = @client.execute(@api.tasklists.list).data.to_hash[\"items\"]\n array.each { |h|\n @tasklists.push Tasklist[h]\n }\n end",
"def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end"
] | [
"0.7363616",
"0.7230093",
"0.722831",
"0.70862454",
"0.68135136",
"0.6797734",
"0.6694339",
"0.6470458",
"0.6460293",
"0.6459647",
"0.64155036",
"0.63093925",
"0.62856966",
"0.628545",
"0.62800384",
"0.62745154",
"0.62738174",
"0.6267455",
"0.6256401",
"0.6215297",
"0.6207788",
"0.6189466",
"0.6166337",
"0.61479884",
"0.61313725",
"0.6125627",
"0.6108218",
"0.60924315",
"0.60865897",
"0.6074722",
"0.6071501",
"0.6070082",
"0.60700375",
"0.60646814",
"0.6052453",
"0.6050818",
"0.60105836",
"0.6001399",
"0.598874",
"0.59827685",
"0.5981624",
"0.5974408",
"0.5972821",
"0.5972821",
"0.59596187",
"0.5921961",
"0.59088707",
"0.58952606",
"0.5870852",
"0.5869077",
"0.58602774",
"0.5852317",
"0.5852317",
"0.58518773",
"0.58490616",
"0.583777",
"0.5835309",
"0.583394",
"0.583394",
"0.583394",
"0.58308434",
"0.58221",
"0.5810818",
"0.58097076",
"0.58097076",
"0.58086026",
"0.5805585",
"0.5804574",
"0.5803986",
"0.57948065",
"0.5788457",
"0.57852536",
"0.5783054",
"0.577309",
"0.57559204",
"0.5749784",
"0.5736349",
"0.57325363",
"0.57277006",
"0.57255715",
"0.57221717",
"0.5718371",
"0.5718352",
"0.5714049",
"0.5705509",
"0.5684626",
"0.5679539",
"0.5679357",
"0.56769484",
"0.5676558",
"0.5666504",
"0.56653845",
"0.5664497",
"0.56585926",
"0.5649184",
"0.5646633",
"0.5645225",
"0.56437683",
"0.5638107"
] | 0.6958071 | 5 |
GET /calllists/1 GET /calllists/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end",
"def index\n @calllists = Calllist.all\n end",
"def index\n @calllists = Calllist.all\n end",
"def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def get_lists(user)\n get(\"/#{user}/lists.json\")\n end",
"def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end",
"def get_for_list(list_id, page)\n full_path = full_resource_path(\"/#{list_id}/contacts\", 'lists')\n query_params = MaropostApi.set_query_params({page: page})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def list(id)\n get(\"lists/#{id}\").list\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def lists_by_list_id_get_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_get ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_get\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def get_list(id)\n record \"/todos/list/#{id}\"\n end",
"def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_call_list\n @call_list = CallList.find(params[:id])\n end",
"def index\n @call_list_memberships = CallListMembership.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @call_list_memberships }\n end\n end",
"def call\n list = JSON.parse(Base64.urlsafe_decode64(@params['list']))\n Success(list)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request,\n message: 'Project list not found'))\n end",
"def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end",
"def get_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetExtendedList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end",
"def lists_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling ContactListApi.lists_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ContactListApi.lists_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/lists'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n # Hubspot::Contact.create!(\"aaron@coderfactory.com\", {firstname: \"Test\", lastname: \"Contact\"})\n lists = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts \"HHHHHHHHHHH\"\n listp = lists.first.last.select { |list| list[\"name\"] == \"New Test List\"}\n listp = listp.first\n puts listp[\"name\"]\n puts \"FFFFFFFFFFFFFFF\"\n contact_list = HTTParty.get \"https://api.hubapi.com/contacts/v1/lists/#{listp['listId'].to_i}/contacts/all?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n puts contact_list[\"contacts\"].first[\"properties\"][\"firstname\"][\"value\"]\n puts \"LLLLLLLLLLLLLL\"\n puts listp\n @enquiries = Enquiry.all\n end",
"def mcget_list_menbers(list_id)\n # 82dfd7f973, a38ec3df9c\n begin\n lists_res = setup_mcapi.lists.list({'list_id' => list_id})\n @list = lists_res['data'][0]\n members_res = setup_mcapi.lists.members(list_id)\n @members = members_res['data']\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n redirect_to \"/lists/\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:error] = ex.message\n else\n flash[:error] = \"An unknown error occurred\"\n end\n redirect_to \"/lists/\"\n end\n end",
"def show\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @call_list_owner }\n end\n end",
"def playlists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end",
"def index\n @calls = Call.order('id DESC')\n\n respond_to do |format|\n format.html\n format.json { render json: @calls }\n end\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def lists\n client.get_lists\n end",
"def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calls }\n end\n end",
"def index\n json_response(@board.lists)\n end",
"def show\n @call_list_membership = CallListMembership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @call_list_membership }\n end\n end",
"def get_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_lists, must be smaller than or equal to 50.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetLists')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @lists = List.all\n render json: @lists\n end",
"def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end",
"def showListPendingPays\n puts @current_user\n results = HTTParty.get(\"http://192.168.99.101:4055/lists/by_user?user_id=\"+(@current_user[\"id\"]).to_s)\n if results.code == 200\n render json: results.parsed_response, status: 200\n else\n render json: results.parsed_response, status: results.code\n end\n end",
"def index\n @api_v1_shopping_lists = ShoppingList.all\n end",
"def show\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mailing_list }\n end\n end",
"def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end",
"def index\n paginate json: @user.playlists.all\n end",
"def get_contact_list\n\t\tbegin\n @contact_list = current_political_campaign.contact_lists.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n \tflash[:error] = \"The requested Contact List was not found.\"\n \tredirect_back_or_default customer_control_panel_url\n end\n\tend",
"def list\n get()\n end",
"def get_contact_for_list(list_id, contact_id)\n full_path = full_resource_path(\"/#{list_id}/contacts/#{contact_id}\", 'lists')\n query_params = MaropostApi.set_query_params\n \n MaropostApi.get_result(full_path, query_params)\n end",
"def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end",
"def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend",
"def get_all_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.get_all_lists ...\"\n end\n # resource path\n local_var_path = \"/lists/\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_all_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"def get_list(list_name)\n @lib.get_list(list_name)\n end",
"def show\n @call = Call.find(params[:id])\n @participants = @call.participants\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n end\n end",
"def list\n get('/')\n end",
"def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end",
"def create\n @calllist = Calllist.new(calllist_params)\n\n respond_to do |format|\n if @calllist.save\n format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }\n format.json { render :show, status: :created, location: @calllist }\n else\n format.html { render :new }\n format.json { render json: @calllist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calllist = Calllist.new(calllist_params)\n\n respond_to do |format|\n if @calllist.save\n format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }\n format.json { render :show, status: :created, location: @calllist }\n else\n format.html { render :new }\n format.json { render json: @calllist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def own_playlists\n check_auth :own_playlists\n \n response = connection.post do |req|\n req.url '/user/playlists'\n req.body = { :format => @format }\n end\n response\n end",
"def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end",
"def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end",
"def index\n @request_calls = RequestCall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_calls }\n end\n end",
"def index\n @lists = @user.lists\n end",
"def find_list(id)\n check_token\n response = self.class.get(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n Todoable::List.build_from_response(response.parsed_response)\n end",
"def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end",
"def new\n @call_list_owner = CallListOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @call_list_owner }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end",
"def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end",
"def fetch_latest_task_lists\n\t\tresponse = @client.execute(api_method: @gtasks.tasklists.list)\n\t\tputs \"***************** ERROR FETCHING TASK LISTS *****************\" if response.status != 200\n\t\tputs response.body\n\t\t@task_lists = response.data.items\n\tend",
"def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end",
"def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end",
"def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend",
"def destroy\n @calllist.destroy\n respond_to do |format|\n format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calllist.destroy\n respond_to do |format|\n format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_updates(list_id, contact_id)\n get(\"contactLists/#{list_id}/#{contact_id}/updates\")\n end",
"def get_member_of_list(user, list, member_id)\n get(\"/#{user}/#{list}/members/#{member_id}.json\")\n end",
"def find_list\n @list = current_user.lists.find params[:id]\n end",
"def get_contacts_from_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_contacts_from_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_contacts_from_list\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_contacts_from_list, must be smaller than or equal to 500.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetContacts')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_contacts_from_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end",
"def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end",
"def find_list_id(list_name)\n begin\n mailing_lists = @api.call(\"lists\", @api_key)\n @list = mailing_lists.find {|list| list[\"name\"] == list_name} unless mailing_lists.nil?\n @list_id = @list['id']\n rescue\n return nil\n end\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end",
"def get(id:)\n list = client.get_list(id: id)\n\n Todoable::List.new(list)\n end",
"def rest_lead_stream url, list_id\n\n response = self.get url\n json = JSON.parse(response.body, :symbolize_names => true)\n results = json[:result]\n\n if results\n results.each { |result| @csv << [result[:id]] }\n @csv.flush\n puts \"#{Time.now} => REST:leadList:#{list_id}:Results:#{results.length}\" if GoodDataMarketo.logging\n end\n\n next_page_token = json[:nextPageToken]\n\n # If there is another page, remember it and then attempt the next load.\n if next_page_token\n\n self.remember_next_page :token => token, :list => list_id\n domain = @marketo_domain\n parameters = \"&fields=#{@fields}\"\n endpoint= \"/rest/v1/list/#{list_id}/leads.json\"\n url = domain + endpoint + @token_uri + parameters + \"&nextPageToken=\" + next_page_token\n rest_lead_stream url, list_id\n\n else\n\n # Update the local and remote lead lists\n File.open('lead_list_ids.json','w'){ |f| JSON.dump(@lead_list_ids, f) }\n @webdav.upload('lead_list_ids.json')\n\n end\n\n end",
"def show\n @lists = @cocktail.lists.where(user_id: @current_user)\n # raise \"hell\"\n end",
"def index\n @call_statuses = CallStatus.all\n end",
"def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end",
"def get_list_id(client,list_name)\n puts \"Getting the listName\" if @enable_debug_logging\n # Send the request to get the list info\n begin\n response = client.request(:get_list) do\n soap.body = {:listName => list_name}\n end\n rescue Savon::SOAP::Fault\n raise StandardError, \"The list '#{@parameters['list_name']}' cannot be found on the Sharepoint site\"\n rescue Exception => ex\n raise\n end\n\n # Retrieving the from the response\n return response.body[:get_list_response][:get_list_result][:list][:@name]\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def get_watchlists(opts={})\n request_params = { source: @source_id }\n request_params.merge(opts) # valid values are accountid and listid - see the API docs for details\n\n uri = URI.parse GET_WATCHLISTS_URL\n uri.query = URI.encode_www_form(request_params)\n\n response = HTTParty.get(uri, headers: {'Cookie' => \"JSESSIONID=#{@session_id}\"}, timeout: 10)\n if response.code != 200\n raise TDAmeritradeApiError, \"HTTP response #{response.code}: #{response.body}\"\n end\n\n watchlists = Array.new\n w = Nokogiri::XML::Document.parse response.body\n w.css('watchlist').each do |watchlist|\n watchlist_name = watchlist.css('name').text\n watchlist_id = watchlist.css('id').text\n watchlist_symbols = Array.new\n\n watchlist.css('watched-symbol').each do |ws|\n watchlist_symbols << ws.css('security symbol').text\n end\n\n watchlists << { name: watchlist_name, id: watchlist_id, symbols: watchlist_symbols }\n end\n\n watchlists\n\n rescue Exception => e\n raise TDAmeritradeApiError, \"error retrieving watchlists - #{e.message}\" if !e.is_ctrl_c_exception?\n end",
"def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend"
] | [
"0.74661916",
"0.7078063",
"0.6896423",
"0.6896423",
"0.65365624",
"0.6412983",
"0.63802004",
"0.63655066",
"0.6283037",
"0.62794334",
"0.62382066",
"0.6234962",
"0.62295103",
"0.6202455",
"0.6189692",
"0.61784637",
"0.6176848",
"0.6176848",
"0.6176848",
"0.61673087",
"0.61497885",
"0.6145667",
"0.61286706",
"0.6125098",
"0.6063936",
"0.6056923",
"0.60458255",
"0.6043216",
"0.6018449",
"0.6014258",
"0.6007007",
"0.6004672",
"0.60033643",
"0.5977172",
"0.59679765",
"0.5957795",
"0.5928798",
"0.5920265",
"0.589294",
"0.5870422",
"0.5846971",
"0.5843616",
"0.5836884",
"0.5835577",
"0.58054537",
"0.58001083",
"0.579384",
"0.5783739",
"0.57812077",
"0.57676816",
"0.5757582",
"0.57494813",
"0.5734506",
"0.5726333",
"0.57191795",
"0.5713297",
"0.5712605",
"0.5712605",
"0.5712605",
"0.5712605",
"0.57109135",
"0.57084876",
"0.57014567",
"0.56824106",
"0.568212",
"0.568212",
"0.56817746",
"0.5678896",
"0.56785303",
"0.5675573",
"0.5670074",
"0.56698924",
"0.56288755",
"0.5626473",
"0.5621724",
"0.5618944",
"0.56122434",
"0.56010056",
"0.559613",
"0.5593052",
"0.55927473",
"0.55847836",
"0.55847836",
"0.55841637",
"0.5584013",
"0.558173",
"0.55788815",
"0.5574382",
"0.5573607",
"0.5570645",
"0.5568984",
"0.5568984",
"0.5566626",
"0.5563778",
"0.5563084",
"0.55487984",
"0.5548045",
"0.5544956",
"0.5536519",
"0.5534116",
"0.5529247"
] | 0.0 | -1 |
POST /calllists POST /calllists.json | def create
@calllist = Calllist.new(calllist_params)
respond_to do |format|
if @calllist.save
format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }
format.json { render :show, status: :created, location: @calllist }
else
format.html { render :new }
format.json { render json: @calllist.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end",
"def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end",
"def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')\n url = build_url(url)\n payload = list.to_json\n response = RestClient.post(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def create\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.new(new_list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: my_list_path(@list) }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end",
"def create\n @call_list_owner = CallListOwner.new(params[:call_list_owner])\n\n respond_to do |format|\n if @call_list_owner.save\n format.html { redirect_to @call_list_owner, :notice => 'Call list owner was successfully created.' }\n format.json { render :json => @call_list_owner, :status => :created, :location => @call_list_owner }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @call_list_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @twitter_list = TwitterList.new(params[:twitter_list])\n\n respond_to do |format|\n if @twitter_list.save\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully created.' }\n format.json { render json: @twitter_list, status: :created, location: @twitter_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lists_post_with_http_info(contact_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_post ...'\n end\n # verify the required parameter 'contact_list' is set\n if @api_client.config.client_side_validation && contact_list.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_list' when calling ContactListApi.lists_post\"\n end\n # resource path\n local_var_path = '/lists'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end",
"def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def create\n @invite_list = InviteList.new(params[:invite_list])\n\n respond_to do |format|\n if @invite_list.save\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully created.' }\n format.json { render json: @invite_list, status: :created, location: @invite_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_list_contacts(list_ids, params = {})\n contact_params = params[:contacts].each_with_object({}).with_index do |(value, hash), index|\n hash[index.to_s.to_sym] = value\n end\n request = @request.post(self_path, {\n list_ids: list_ids.join(','),\n contact: contact_params,\n **params.except(:contacts)\n })\n response = Response.new(request).parse\n if response[:status] == 'error'\n raise Errors::UnprocessableEntityError.new, response[:message]\n end\n end",
"def push_list(stream, *array)\n post stream, 'list' => array.flatten.map{|item| {'listItem' => item}}\n end",
"def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end",
"def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_list = TaskList.new(params[:task_list])\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saved_list = SavedList.new(saved_list_params)\n\n respond_to do |format|\n if @saved_list.save\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully created.\" }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = @project.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@project, @list], notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calllist_params\n params.require(:calllist).permit(:calllists_day, :custname, :custcode, :shipto, :rep, :csr, :dept, :item, :phone, :manager, :totalitems, :called, :called_date, :id, :ordered, :notes, :called_csr, :called_day, :called_route, :callback_day, :callback_date, :instructions)\n end",
"def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end",
"def create\n @list = Blog::List.new(list_params)\n\n respond_to do |format|\n if @list.save\n ActionCable.server.broadcast \"board\",\n { commit: 'addList', \n payload: render_to_string(:show, formats: [:json]) }\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @list = List.find(params[:list_id])\n @comment = Comment.where(list_id: @list.id).new(comment_params)\n @comment.user = @current_user\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @list = List.new(list_params)\n @list.user = current_user\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n if @list.save\n respond_successfully(I18n.t('integral.backend.lists.notification.creation_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.creation_failure'), :new)\n end\n end",
"def create\n # @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_list_with_http_info(list_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.add_new_list ...\"\n end\n # verify the required parameter 'list_name' is set\n if @api_client.config.client_side_validation && list_name.nil?\n fail ArgumentError, \"Missing the required parameter 'list_name' when calling ListsApi.add_new_list\"\n end\n # resource path\n local_var_path = \"/lists/\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"listName\"] = list_name\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#add_new_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_list(params)\n MailManager::List.create(params)\n end",
"def list_post(api_key, access_token, list, body, opts = {})\n list_post_with_http_info(api_key, access_token, list, body, opts)\n return nil\n end",
"def create\n @list = @organization.lists.build(list_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: [@list.organization, @list] }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end",
"def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend",
"def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully created.\" }\n format.json { render :json=>@todo_list, :status=>:created, :location=>@todo_list }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@todo_list.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def create\n @call_list = CallList.find(params[:call_list_id])\n params[:call_list_membership][:oncall_candidate] = false if params[:call_list_membership][:oncall_candidate] == 0\n @call_list_membership = @call_list.call_list_memberships.build(params[:call_list_membership])\n\n respond_to do |format|\n if @call_list_membership.save\n format.js { render 'update_listing', :layout => false }\n format.html { redirect_to @call_list_membership, :notice => 'Call list membership was successfully created.' }\n format.json { render :json => @call_list_membership, :status => :created, :location => @call_list_membership }\n else\n format.js { render :partial => 'shared/error', :locals => {:target => @call_list_membership} }\n format.html { render :action => \"new\" }\n format.json { render :json => @call_list_membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n @list.save\n broadcast\n end",
"def create\n @mailing_list = MailingList.new(params[:mailing_list])\n\n respond_to do |format|\n if @mailing_list.save\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully created.' }\n format.json { render json: @mailing_list, status: :created, location: @mailing_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mailing_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.build(params[:list])\n location = @list.save ? my_list_url(@list.id) : new_my_list_url\n respond_with(@list, :location => location )\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def create\n @list = List.new(params[:list])\n @list.feeds_by_id = ''\n @list.user_id = current_user.id\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to(@list, :notice => 'List was successfully created.') }\n format.xml { render :xml => @list, :status => :created, :location => @list }\n format.js {render :layout => false}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end",
"def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end",
"def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def lists_post(contact_list, opts = {})\n data, _status_code, _headers = lists_post_with_http_info(contact_list, opts)\n data\n end",
"def create\n @task_list = Task::List.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @waiting_list = WaitingList.new(params[:waiting_list])\n\n respond_to do |format|\n if @waiting_list.save\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully created.' }\n format.json { render json: @waiting_list, status: :created, location: @waiting_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate_list(input)\n list_request = input[:list_request].call\n if list_request.success?\n Success(input.merge(list: list_request.value!))\n else\n Failure(list_request.failure)\n end\n end",
"def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end",
"def create\n @friendslist = Friendslist.new(params[:friendslist])\n\n respond_to do |format|\n if @friendslist.save\n format.html { redirect_to @friendslist, notice: 'Friendslist was successfully created.' }\n format.json { render json: @friendslist, status: :created, location: @friendslist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendslist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/#{@version}/list/create/\"\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n make_post_request(endpoint, custom_params)\n end",
"def create\n @watchlist = Watchlist.new(watchlist_params)\n\n if @watchlist.save\n render json: {\n message: \"Watchlist successfully created!\",\n status: 201,\n watchlist: @watchlist\n }, status: :created, location: @watchlist\n else\n render json: {\n status: 422,\n errors: @watchlist.errors.full_messages.join(\", \")\n }, status: :unprocessable_entity\n end\n end",
"def create\n list = current_user.lists.build(params[:list])\n list.current_users << current_user\n\n if list.save\n flash[:notice] = t('messages.list.success.create', title: list.title)\n redirect_to list_experts_url(list)\n else\n flash[:alert] = t('messages.list.errors.create')\n redirect_to lists_url\n end\n end",
"def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }\n format.json { render json: @todo_list, status: :created, location: @todo_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@list = List.new(list_params)\n @list = current_user.lists.create(list_params)\n if params[:campsite_id] && @list.listeds.find_by_campsite_id(params[:campsite_id]).blank?\n campsite = Campsite.find(params[:campsite_id])\n @listed = campsite.listeds.create(list:@list.id, user_id:current_user.id)\n #@listed = Listed.new()\n #@listed.list_id = @list.id\n #@listed.user_id = current_user.id\n #@listed.save\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to management_lists_path, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url_list = UrlList.new(url_list_params)\n\n respond_to do |format|\n if @url_list.save\n format.html { redirect_to @url_list, notice: 'Url list was successfully created.' }\n format.json { render :show, status: :created, location: @url_list }\n else\n format.html { render :new }\n format.json { render json: @url_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def create\n @watch_list = WatchList.new(params[:watch_list])\n\n respond_to do |format|\n if @watch_list.save\n format.html { redirect_to @watch_list, notice: 'Watch list was successfully created.' }\n format.json { render json: @watch_list, status: :created, location: @watch_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @watch_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_list = ActivityList.new(activity_list_params)\n\n respond_to do |format|\n if @activity_list.save & current_user.admin?\n format.html { redirect_to @activity_list, notice: 'Activity list was successfully created.' }\n format.json { render :show, status: :created, location: @activity_list }\n else\n format.html { render :new }\n format.json { render json: @activity_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todoslist = Todoslist.new(todoslist_params)\n\n respond_to do |format|\n if @todoslist.save\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully created.\" }\n format.json { render :show, status: :created, location: @todoslist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n if @list.save\n redirect_to @list, :notice =>\"List successfully created.\"\n else\n flash[:error] = \"Your list could not be saved.\"\n render :action => \"new\"\n end\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def add_post(api_key, access_token, list, body, opts = {})\n data, _status_code, _headers = add_post_with_http_info(api_key, access_token, list, body, opts)\n return data\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Funcionario adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@list = List.new(list_params)\n\t\t@list.save\n\t\t\tredirect_to '/tasks'\n\tend",
"def set_call_list\n @call_list = CallList.find(params[:id])\n end",
"def create\n @list = List.new(list_params)\n if @list.save\n \t#flash notice on successful creation of a list\n \tflash[:notice] = \"List successfully added!\"\n redirect_to lists_path(@list)\n else\n render :new\n flash[:alert] = \"ERROR :(\"\n end\n end",
"def create\n @todoit_list = TodoitList.new(todoit_list_params)\n\n respond_to do |format|\n if @todoit_list.save\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully created.' }\n format.json { render action: 'show', status: :created, location: @todoit_list }\n else\n format.html { render action: 'new' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.find params[:list_id]\n @task = @list.tasks.build(params[:task])\n authorize! :read, @list\n authorize! :create, @task\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @list, notice: I18n.t('tasks.create_success') }\n format.json { render json: @task, status: :created, location: list_task_path(@list, @task) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n @lists = List.not_deleted\n format.js\n else\n format.js { render json: @list.errors}\n end\n end\n end",
"def create\n @service_list = ServiceList.new(service_list_params)\n\n respond_to do |format|\n if @service_list.save\n format.html { redirect_to @service_list, notice: 'Service list was successfully created.' }\n format.json { render :show, status: :created, location: @service_list }\n else\n format.html { render :new }\n format.json { render json: @service_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @email_list = EmailList.new(email_list_params)\n\n respond_to do |format|\n if @email_list.save\n format.html { redirect_to @email_list, notice: 'Email list was successfully created.' }\n format.json { render :show, status: :created, location: @email_list }\n else\n format.html { render :new }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end",
"def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save(list_params)\n if(cookies[:list].blank?)\n cookies[:list]=\"\"\n end\n cookies[:list]=cookies[:list]+\",#{@list.id}\"\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n \n else\n @lists=set_lists\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mailer_to_list(list, options = {})\n list = list.join(',') if list.is_a?(Array)\n options = {:list_name => list}.merge(options)\n response = post('mailer/to_list', options)\n # response was a string that included RestClient::AbstractResponse,\n # and it overrided #to_i method (which returns status code)\n String.new(response).to_i\n end",
"def create\n @todo_list = TodoList.new(todo_list_params)\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to :back, notice: 'Todo list was successfully created.' }\n format.json { render :show, status: :created, location: :back }\n else\n format.html { render :new }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @black_list = BlackList.new(params[:black_list])\n\n respond_to do |format|\n if @black_list.save\n format.html { redirect_to black_lists_path, notice: 'Balck list was successfully created.' }\n format.json { render json: @black_list, status: :created, location: @black_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @black_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @calllist.destroy\n respond_to do |format|\n format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calllist.destroy\n respond_to do |format|\n format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @friends_list = FriendsList.new(friends_list_params)\n\n respond_to do |format|\n if @friends_list.save\n format.html { redirect_to @friends_list, notice: 'Friends list was successfully created.' }\n format.json { render :show, status: :created, location: @friends_list }\n else\n format.html { render :new }\n format.json { render json: @friends_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.find params[:list_id]\n @item = @list.items.build(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }\n #format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7110512",
"0.6961915",
"0.6842721",
"0.67839736",
"0.66024226",
"0.65687096",
"0.6445054",
"0.6407429",
"0.6344443",
"0.63354605",
"0.6321155",
"0.63176143",
"0.62924296",
"0.6289217",
"0.6266322",
"0.62657166",
"0.62535435",
"0.6247331",
"0.62464195",
"0.6243584",
"0.62333184",
"0.62189776",
"0.6211129",
"0.6211129",
"0.6209813",
"0.6176635",
"0.6168472",
"0.61599094",
"0.61568314",
"0.6145111",
"0.6139708",
"0.6126171",
"0.61089957",
"0.61006254",
"0.6085544",
"0.6081169",
"0.6080957",
"0.6067763",
"0.60666376",
"0.60657054",
"0.6051738",
"0.6048377",
"0.60405064",
"0.6033024",
"0.6018689",
"0.60099065",
"0.6008858",
"0.6008448",
"0.6001312",
"0.6001275",
"0.5999904",
"0.5996065",
"0.59790087",
"0.59779006",
"0.59729934",
"0.5964101",
"0.5959995",
"0.5955641",
"0.59536004",
"0.594776",
"0.59219843",
"0.5920118",
"0.59144807",
"0.58988184",
"0.5894252",
"0.5884972",
"0.587777",
"0.5877136",
"0.5875756",
"0.5865446",
"0.5859104",
"0.58552",
"0.58480865",
"0.58452404",
"0.58387655",
"0.58244365",
"0.58213544",
"0.5820672",
"0.5820672",
"0.5820672",
"0.58201206",
"0.581761",
"0.58104956",
"0.580928",
"0.5808415",
"0.57927006",
"0.57917464",
"0.5783864",
"0.57829297",
"0.57808167",
"0.577829",
"0.5777301",
"0.57709086",
"0.57689345",
"0.5762256",
"0.57616514",
"0.57616514",
"0.57369524",
"0.57360005"
] | 0.6974059 | 2 |
PATCH/PUT /calllists/1 PATCH/PUT /calllists/1.json | def update
respond_to do |format|
if @calllist.update(calllist_params)
format.html { redirect_to @calllist, notice: 'Calllist was successfully updated.' }
format.json { render :show, status: :ok, location: @calllist }
else
format.html { render :edit }
format.json { render json: @calllist.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n if @call_list_owner.update_attributes(params[:call_list_owner])\n format.html { redirect_to @call_list_owner, :notice => 'Call list owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @call_list_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end",
"def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end",
"def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end",
"def update\n @call_list_membership = CallListMembership.find(params[:id])\n params[:call_list_membership][:oncall_candidate] = false if params[:call_list_membership][:oncall_candidate] == 0\n\n respond_to do |format|\n if @call_list_membership.update_attributes(params[:call_list_membership])\n format.html { redirect_to @call_list_membership, :notice => 'Call list membership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @call_list_membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(existing_list_params)\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: my_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end",
"def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end",
"def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lists_by_list_id_put_with_http_info(list_id, contact_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_put ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_put\"\n end\n # verify the required parameter 'contact_list' is set\n if @api_client.config.client_side_validation && contact_list.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_list' when calling ContactListApi.lists_by_list_id_put\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(contact_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task_list = TaskList.find(params[:id])\n\n if @task_list.update(task_list_params)\n head :no_content\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end",
"def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end",
"def update\n @list = @project.lists.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to [@project, @list], notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task_list = TaskList.find(params[:id])\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo_list.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @list] }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list.update_attributes list_params\n end",
"def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"lists/#{self[\"id\"]}\", \"{\\\"list\\\": #{options.to_json}}\").body)\n end",
"def update\n list = List.find_by_title(params[:task][:list_title])\n task_params = Task.format_params(params[:task][:title], params[:task][:description], list.id)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to lists_url, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :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 @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: blog_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reminder_task_list = ReminderTaskList.find(params[:id])\n\n respond_to do |format|\n if @reminder_task_list.update_attributes(params[:reminder_task_list])\n format.html { redirect_to(@reminder_task_list, :notice => 'Reminder task list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reminder_task_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def set_calllist\n @calllist = Calllist.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n format.html { redirect_to @task_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def update\n respond_to do |format|\n if @email_list.update(email_list_params)\n format.html { redirect_to @email_list, notice: 'Email list was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_list }\n else\n format.html { render :edit }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_call_list\n @call_list = CallList.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @todoit_list.update(todoit_list_params)\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grocery_list = GroceryList.find(params[:id])\n\n if @grocery_list.update(grocery_list_params)\n render json: @grocery_list\n else\n render json: {\n errors: @grocery_list.errors.full_messages\n },\n status: 404\n end\n end",
"def update(id, params = {})\n @client.call(method: :put, path: \"recipient-lists/#{id}\", body_values: params.slice(:name, :description, :attributes, :recipients))\n end",
"def update\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n if @mailing_list.update_attributes(params[:mailing_list])\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mailing_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @list = List.find(params[:id])\n @list.user = current_user\n @user = @list.user\n\n respond_to do |format|\n if @list.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @list.update(list_params)\n respond_successfully(I18n.t('integral.backend.lists.notification.edit_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.edit_failure'), :show)\n end\n end",
"def update\n @watch_list = WatchList.find(params[:id])\n\n respond_to do |format|\n if @watch_list.update_attributes(params[:watch_list])\n format.html { redirect_to @watch_list, notice: 'Watch list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watch_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n if @twitter_list.update_attributes(params[:twitter_list])\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\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 @saved_list.update(saved_list_params)\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @saved_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @applist.update(applist_params)\n format.html { redirect_to @applist, notice: 'Applist was successfully updated.' }\n format.json { render :show, status: :ok, location: @applist }\n else\n format.html { render :edit }\n format.json { render json: @applist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todolists.update(todolist_params)\n format.html { redirect_to @todolists, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolists }\n else\n format.html { render :edit }\n format.json { render json: @todolists.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @activities_list.update(activities_list_params)\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully updated.' }\n format.json { render :show, status: :ok, location: @activities_list }\n else\n format.html { render :edit }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n list_attributes = params[:list] || params[:check_list]\n \n if @list.update(list_attributes)\n flash[:notice] = t(:list_saved)\n redirect_to @list\n else\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @waiting_list = WaitingList.find(params[:id])\n\n respond_to do |format|\n if @waiting_list.update_attributes(params[:waiting_list])\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@list = List.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @list.update_attributes(params[:list])\n\t\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html\t{ render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @list.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @service_list.update(service_list_params)\n format.html { redirect_to @service_list, notice: 'Service list was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_list }\n else\n format.html { render :edit }\n format.json { render json: @service_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id:, name:)\n list = client.update_list(id: id, name: name)\n\n Todoable::List.new(list)\n end",
"def update_call_list(call_job, twilio_contact=nil)\n\n #if !twilio_contact.nil?\n #\ttwilio_contact.contacted = true;\n #\ttwilio_contact.save\n #end\n call_next_provider(call_job)\n end",
"def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todo_list.update(todo_list_params)\n format.html { redirect_to work_todo_list_path, notice: 'Todo list was successfully updated.' }\n format.json { render :show, status: :ok, location: work_todo_list_path }\n else\n format.html { render :edit }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: CALL_UPDATED }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todolist.update(todolist_params)\n format.html { redirect_to @todolist, notice: 'Todolist was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolist }\n else\n format.html { render :edit }\n format.json { render json: @todolist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def action_update_contacts_with_http_info(list_id, update_contacts_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.action_update_contacts ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactsApi.action_update_contacts\"\n end\n if @api_client.config.client_side_validation && list_id < 1\n fail ArgumentError, 'invalid value for \"list_id\" when calling ContactsApi.action_update_contacts, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'update_contacts_request' is set\n if @api_client.config.client_side_validation && update_contacts_request.nil?\n fail ArgumentError, \"Missing the required parameter 'update_contacts_request' when calling ContactsApi.action_update_contacts\"\n end\n # resource path\n local_var_path = '/lists/{list_id}/contacts/actions/update'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(update_contacts_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.action_update_contacts\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#action_update_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch!\n request! :patch\n end",
"def update_contact(list_id, email, attributes={})\n endpoint = \"/api/v1/list/#{list_id}/update-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email,\n 'attributes' => attributes\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def update\n respond_to do |format|\n if @listtodo.update(listtodo_params)\n format.html { redirect_to @listtodo, notice: 'Listtodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @listtodo }\n else\n format.html { render :edit }\n format.json { render json: @listtodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @listitem.update(listitem_params)\n render :show, status: :ok, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend",
"def update\n @task = current_user.lists.find(params[:list_id]).tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.js\n else\n render :js => \"TODO_IT.UI.show_alert('Something went wrong.')\"\n end\n end\n end",
"def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @activity_list.update(activity_list_params) & current_user.admin?\n format.html { redirect_to @activity_list, notice: 'Activity list was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_list }\n else\n format.html { render :edit }\n format.json { render json: @activity_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_list = GiftList.find(params[:id])\n\n respond_to do |format|\n if @gift_list.update_attributes(params[:gift_list])\n format.html { redirect_to @gift_list, notice: 'Gift list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_user.update(playlist_names: params[:playlists])\n render json: current_user\n end",
"def update\n @call = current_user.calls.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, :notice => 'Call was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n begin\n @task_list = @project.task_lists.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.js {render 'projects/create_task_list'}\n format.html { redirect_to project_task_list_path(@project, @task_list), :notice => 'Task list was successfully updated.' }\n else\n format.js {render :create_fail}\n format.html { render :action => \"edit\" }\n end\n end\n rescue ActiveRecord::RecordNotFound\n logger.info { \"User #{current_user.email} try update a task list #{params[:id]} without permission\" }\n redirect_to project_path(@project)\n end\n end",
"def update\n @email_list = EmailList.find(params[:id])\n\n respond_to do |format|\n if @email_list.update_attributes(params[:email_list])\n format.html { redirect_to(@email_list, :notice => 'Email list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end",
"def patch_calendar_list(opts = {})\n update_calendar_list\n end"
] | [
"0.6996695",
"0.6796956",
"0.6646768",
"0.65260017",
"0.64233965",
"0.64014107",
"0.636995",
"0.635389",
"0.6289805",
"0.627942",
"0.62759566",
"0.62745863",
"0.6246258",
"0.62419814",
"0.62419814",
"0.6230335",
"0.622694",
"0.62245065",
"0.6214325",
"0.6212348",
"0.61828446",
"0.61828446",
"0.617786",
"0.6164169",
"0.61484873",
"0.61175406",
"0.6093831",
"0.6093499",
"0.6082886",
"0.6082886",
"0.6082886",
"0.6082886",
"0.6082886",
"0.6080659",
"0.6080175",
"0.6072657",
"0.6058807",
"0.6057369",
"0.60566777",
"0.60523325",
"0.6051588",
"0.6047249",
"0.60457337",
"0.60263634",
"0.6022011",
"0.60047245",
"0.60047245",
"0.60047245",
"0.5994163",
"0.5992885",
"0.5972067",
"0.5960369",
"0.5951059",
"0.594863",
"0.5942215",
"0.5939172",
"0.5936228",
"0.59327906",
"0.59293973",
"0.59259355",
"0.59251297",
"0.5923554",
"0.5915179",
"0.59143597",
"0.5911489",
"0.5892786",
"0.58865047",
"0.5885553",
"0.5878773",
"0.58686435",
"0.58579576",
"0.58579576",
"0.58495176",
"0.5845943",
"0.58386177",
"0.583353",
"0.5831332",
"0.5830355",
"0.581764",
"0.58174306",
"0.5815516",
"0.5805045",
"0.5804706",
"0.580459",
"0.58010924",
"0.5799381",
"0.57968277",
"0.5787772",
"0.5784978",
"0.5784042",
"0.5783857",
"0.57830125",
"0.57830125",
"0.578301",
"0.57772404",
"0.57726777",
"0.57705617",
"0.576494",
"0.57646984"
] | 0.70516884 | 1 |
DELETE /calllists/1 DELETE /calllists/1.json | def destroy
@calllist.destroy
respond_to do |format|
format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def destroy\n @invite_list = InviteList.find(params[:id])\n @invite_list.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_lists_url }\n format.json { head :no_content }\n end\n end",
"def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end",
"def delete_list(id)\n query(\"DELETE FROM todos WHERE list_id = $1\", id)\n query(\"DELETE FROM lists WHERE id = $1\", id)\n end",
"def destroy\n @list = @project.lists.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to project_lists_url(@project) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_list.destroy\n respond_to do |format|\n format.html { redirect_to activity_lists_url, notice: 'Activity list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_list = CallList.find(params[:call_list_id])\n @call_list_membership = CallListMembership.find(params[:id])\n @call_list_membership.destroy\n\n respond_to do |format|\n format.js { render 'update_listing', :layout => false }\n format.html { redirect_to call_list_memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailing_list = MailingList.find(params[:id])\n @mailing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to mailing_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_list.destroy\n respond_to do |format|\n format.html { redirect_to email_lists_url, notice: 'Email list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sent_list.destroy\n respond_to do |format|\n format.html { redirect_to sent_lists_url, notice: 'Sent list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_list_owner = CallListOwner.find(params[:id])\n @call_list_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to call_list_owners_url }\n format.json { head :no_content }\n end\n end",
"def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to my_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url_list.destroy\n respond_to do |format|\n format.html { redirect_to url_lists_url, notice: 'Url list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @applist.destroy\n respond_to do |format|\n format.html { redirect_to applists_url, notice: 'Applist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"List was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_shopping_list.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_shopping_lists_url, notice: 'Shopping list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to task_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end",
"def delete!(id:)\n client.delete_list(id: id)\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reminder_task_list = ReminderTaskList.find(params[:id])\n @reminder_task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(reminder_task_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @twitter_list = TwitterList.find(params[:id])\n @twitter_list.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_list.destroy\n respond_to do |format|\n format.html { redirect_to saved_lists_url, notice: \"Saved list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailing_list.destroy\n respond_to do |format|\n format.html { redirect_to mailing_lists_url, notice: 'Mailing list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to organization_lists_url(@organization), notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end",
"def lists_by_list_id_delete_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactListApi.lists_by_list_id_delete ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ContactListApi.lists_by_list_id_delete\"\n end\n # resource path\n local_var_path = '/lists/{list_id}'.sub('{' + 'list_id' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactListApi#lists_by_list_id_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @activities_list.destroy\n respond_to do |format|\n format.html { redirect_to activities_lists_url, notice: 'Activities list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'The List was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_list.destroy\n respond_to do |format|\n format.html { redirect_to task_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list_invite.destroy\n respond_to do |format|\n format.html { redirect_to list_invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_list.destroy\n respond_to do |format|\n format.html { redirect_to task_lists_url, notice: 'Task list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = current_user.lists.find(params[:id])\n @list.destroy\n respond_with(@list, :location => my_lists_url)\n end",
"def destroy\n @watch_list = WatchList.find(params[:id])\n @watch_list.destroy\n\n respond_to do |format|\n format.html { redirect_to watch_lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def delete(email, list_id = nil)\n query = \"email=#{CGI.escape(email)}\"\n query += \"&list_id=#{list_id}\" if list_id\n\n del \"#{@endpoint}?#{query}\", nil\n end",
"def destroy\n @bolog_list.destroy\n respond_to do |format|\n format.html { redirect_to bolog_lists_url, notice: 'Bolog list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mail_list.destroy\n respond_to do |format|\n format.html { redirect_to admin_mail_lists_url, notice: 'Mail list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todoit_list.destroy\n respond_to do |format|\n format.html { redirect_to todoit_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_list.destroy\n respond_to do |format|\n format.html { redirect_to service_lists_url, notice: 'Service list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = current_user.calls.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n end\n end",
"def destroy\n @call_status.destroy\n respond_to do |format|\n format.html { redirect_to call_statuses_url, notice: 'Call status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phone_call.destroy\n respond_to do |format|\n format.html { redirect_to phone_calls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_delete(\"/listings/#{@listing_id}\")\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to(calls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to(calls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @coffeeshoplist.destroy\n respond_to do |format|\n format.html { redirect_to coffeeshoplists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_list = EmailList.find(params[:id])\n @email_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @keylist.destroy\n respond_to do |format|\n format.html { redirect_to keylists_url, notice: 'Keylist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailinglist = Mailinglist.find(params[:id])\n @mailinglist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailinglists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fwlist = Fwlist.find(params[:id])\n @fwlist.destroy\n\t\n respond_to do |format|\n format.html { redirect_to fwlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: CALL_DESTROYED }\n format.json { head :no_content }\n end\n end",
"def destroy\n @waiting_list = WaitingList.find(params[:id])\n @waiting_list.destroy\n\n respond_to do |format|\n format.html { redirect_to waiting_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendslist = Friendslist.find(params[:id])\n @friendslist.destroy\n\n respond_to do |format|\n format.html { redirect_to friendslists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :delete, @ml_list\n @ml_list.destroy\n respond_to do |format|\n format.html { redirect_to ml_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calllog.destroy\n respond_to do |format|\n format.html { redirect_to calllogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_history = CallHistory.find(params[:id])\n @call_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(call_histories_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @reference_list.destroy\n respond_to do |format|\n format.html { redirect_to reference_lists_url, notice: 'Reference list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end",
"def destroy\n @cyclist = Cyclist.find(params[:id])\n @cyclist.destroy\n\n respond_to do |format|\n format.html { redirect_to cyclists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ro_r_list.destroy\n respond_to do |format|\n format.html { redirect_to ro_r_lists_url, notice: 'Ro r list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_list(id:)\n check_token\n response = self.class.delete(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n true\n end",
"def destroy\n @waitlist = WaitList.find(params[:id])\n @waitlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wait_lists_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url, notice: \"Check list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'Funcionario deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @todoslist.destroy\n respond_to do |format|\n format.html { redirect_to todoslists_url, notice: \"Todoslist was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @list = List.find(params[:id])\n @list.destroy\n flash[:notice] = \"List successfully deleted\"\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n format.html { redirect_to(lists_url) }\n format.xml { head :ok }\n format.js {render :layout => false}\n end\n end",
"def destroy\n @page_title = \"Task List Delete\"\n @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(task_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @app_list.app_resouces.destroy\n @app_list.destroy\n respond_to do |format|\n format.html { redirect_to app_lists_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_lists(contact_id, lists_to_delete_from)\n full_path = full_resource_path(\"/#{contact_id}\")\n query_params = MaropostApi.set_query_params({'list_ids' => lists_to_delete_from.join(',')})\n \n MaropostApi.delete_result(full_path, query_params)\n end",
"def remove_contact(list_id, email)\n endpoint = \"/api/v1/list/#{list_id}/remove-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end"
] | [
"0.737909",
"0.7237097",
"0.7104932",
"0.69288784",
"0.68634534",
"0.680756",
"0.6781529",
"0.6768832",
"0.6768832",
"0.6768832",
"0.67651886",
"0.6722435",
"0.6722435",
"0.6722435",
"0.6710659",
"0.6681779",
"0.6681386",
"0.6678337",
"0.6671298",
"0.66649324",
"0.6655452",
"0.6651152",
"0.6642423",
"0.66306055",
"0.6613021",
"0.6613021",
"0.6613021",
"0.6613021",
"0.6613021",
"0.6613021",
"0.6613021",
"0.66118526",
"0.6605247",
"0.6594759",
"0.6594759",
"0.6594759",
"0.6590805",
"0.65784526",
"0.65746236",
"0.65742385",
"0.6570341",
"0.6558674",
"0.6546628",
"0.6544462",
"0.654226",
"0.6536707",
"0.6531946",
"0.65311664",
"0.65297985",
"0.65147215",
"0.65128833",
"0.65118384",
"0.6510519",
"0.6508739",
"0.650194",
"0.6501887",
"0.6496208",
"0.64934146",
"0.64934146",
"0.64931524",
"0.6483179",
"0.6477449",
"0.6474409",
"0.6472438",
"0.64712924",
"0.64701915",
"0.6456316",
"0.6453586",
"0.64465904",
"0.6439072",
"0.6439072",
"0.64354855",
"0.6427599",
"0.64204854",
"0.6417911",
"0.6417789",
"0.6416861",
"0.64166814",
"0.6415124",
"0.64143974",
"0.63991725",
"0.638459",
"0.6372323",
"0.63709444",
"0.63518953",
"0.63480717",
"0.6341614",
"0.63384724",
"0.63298833",
"0.63266486",
"0.6321295",
"0.63210475",
"0.63199866",
"0.6313928",
"0.631247",
"0.6309021",
"0.6306778",
"0.6297063",
"0.62961096"
] | 0.7562142 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_calllist
@calllist = Calllist.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def calllist_params
params.require(:calllist).permit(:from_num, :to_num)
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 |
Now add this, and see that given the proper values, the first method will come out as true | def my_array_sorting_method(source)
source.sort_by{|x| x.to_s}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trueish?\n %w(1 t).include? self\n end",
"def add(this, that)\n\tthis + that\nend",
"def enotsup?() super; end",
"def method_missing(*_args)\n true\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def add_a_b\n end",
"def and_this(&b)\n\t\t\t\tnil? ? nil : this(&b)\n\t\t\tend",
"def is_addable? (hose_duck)\n hose_duck.respond_to?(:next) && hose_duck.respond_to?(:add_trib__dispatch)\n end",
"def same; end",
"def check ; true ; end",
"def add(value)\n add?(value) || self\n end",
"def hooked?\n self == self.class.get(base_object, method_name, singleton_method)\n end",
"def internship_passed; end",
"def could_be_second?(second); end",
"def hook_solution?(a); end",
"def double?\n if self.id\n return true if self.torrent_url && Torrent.not_self(self.id).find_by_torrent_url(self.torrent_url)\n return true if self.transmission_hash_string && Torrent.not_self(self.id).find_by_transmission_hash_string(self.transmission_hash_string)\n return true if self.name && Torrent.not_self(self.id).find_by_name(self.name)\n else\n return true if self.torrent_url && Torrent.find_by_torrent_url(self.torrent_url)\n return true if self.transmission_hash_string && Torrent.find_by_transmission_hash_string(self.transmission_hash_string)\n return true if self.name && Torrent.find_by_name(self.name) \n end\n \n \n return false\n end",
"def positive?; end",
"def add_single toadd\n case toadd\n when Dist\n dist << @len.Dist\n dist.last_born << toadd\n else\n return false\n end\n true\n end",
"def include?(key)\n\t\t\t\tsuper || @l2.include?(key)\n\t\t\tend",
"def true(_argvs)\n return nil\n end",
"def add_item_to_list?(_item)\n raise NoMethodError, \"Subclass must define the #{__method__} method and return true or false\", caller\n end",
"def missed?; end",
"def qwerty\n\t\tfalse\n\tend",
"def canAdd _obj, _args\n \"_obj canAdd _args;\" \n end",
"def set_reciprocal_to_self?\n true\n end",
"def method_one; end",
"def checked?; end",
"def has_next()\n \n end",
"def has_next()\n \n end",
"def checks; end",
"def execute_this(meth, *args)\n alert \" #{meth} not found ! \"\n $log.debug \"app email got #{meth} \" if $log.debug?\n cc = @form.get_current_field\n [cc].each do |c|\n if c.respond_to?(meth, true)\n c.send(meth, *args)\n return true\n end\n end\n false\nend",
"def true?\n self == true\n end",
"def method_missing(m, *args)\n return false\n end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def method_and_value; end",
"def amicable_with?(other)\n factors.reduce(:+) == other &&\n other.factors.reduce(:+) == self &&\n self != other\n end",
"def ==(*)\n true\n end",
"def matches? actual\n super\n\n raise ArgumentError.new('must specify a new method name') if new_method_name.nil?\n\n responds_to_methods? && aliases_method?\n end",
"def multiple?; end",
"def valid?\n return false if !super\n true\n end",
"def spare?\n @ball1 + @ball2 == PINS\n end",
"def set_reciprocal_to_self?\n true\n end",
"def recursive_this?(instance)\n this_map[instance.object_id] == true\n end",
"def method_731(base); end",
"def got_set\n return self.bid != self.tricks\n end",
"def and_a\n end",
"def f\n self.class == Self or raise\n\n # Self can be ommited for method calls.\n self.f2 == 2 or raise\n f2 == 2 or raise\n end",
"def gr_append_check? obj\n return false if obj.class!=self.class\n return false if !respond_to(\"each\")\n myEnum=to_enum\n objEnum=obj.to_enum\n while true\n begin\n myEle=myEnum.next\n rescue\n return true\n end\n begin\n objEle=objEnum.next\n rescue\n return false\n end\n return false if myEle!=objEle\n end\n return true\n end",
"def add(val)\n \n end",
"def crossing?(other); end",
"def crossing?(other); end",
"def crossing?(other); end",
"def and\n self\n end",
"def is_addop(c)\n ADDOPS.include?(c)\nend",
"def is_addop(c)\n ADDOPS.include?(c)\nend",
"def respond_to?(method, *args)\n return true if self.links && self.links.respond_to?(method)\n return true if self.attributes && self.attributes.respond_to?(method)\n return true if self.objects && self.objects.respond_to?(method)\n super\n end",
"def add_this(instance)\n if (@state & SELF_RECURSION_IN_THIS) == 0\n @state = @state | SELF_RECURSION_IN_THIS if map_put(this_map, instance)\n end\n @state\n end",
"def add\n super\n return 77\n end",
"def multi_check\n raise NotImplementedError\n end",
"def include?(something); end",
"def for_one?\n fail NotImplementedError\n end",
"def + b\n 1.plus self.plus(b)\n end",
"def success?() end",
"def binary_method_operator?\n arguments.one? && Types::BINARY_METHOD_OPERATORS.include?(selector)\n end",
"def multi_arged?\n false\n end",
"def method_missing(name, *args)\n words = name.to_s.split(\"_\")\n return super(name, *args) unless words.shift == 'add'\n words.each do |word|\n next if word == 'and'\n add_cd if word == 'cd'\n add_dvd if word == 'dvd'\n add_hard_disk(100000) if word == 'harddisk'\n turbo if word == 'turbo'\n end \n end",
"def despined?(*)\n end",
"def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend",
"def passes; end",
"def passes; end",
"def applicable?\n true\n end",
"def add?(o)\n if include?(o)\n nil\n else\n add(o)\n end\n end",
"def add?(o)\n if include?(o)\n nil\n else\n add(o)\n end\n end",
"def add_reversed?\n @add_reversed\n end",
"def sos_piedra?() raise NotImplementedError end",
"def respond_to?(meth)\n super(meth) || @value.respond_to?(meth)\n end",
"def applicable?\n true\n end",
"def next?\n raise NotImplementedError\n end",
"def next?\n raise NotImplementedError\n end",
"def sadd?(key, *members); end",
"def sadd?(key, *members); end",
"def method_missing(method, *args, &block)\n method.to_s =~ /^(\\w+)\\?$/ ? !!self[$1] : super\n end",
"def fifteen?\n @points == 1\n end",
"def begin_adding(*) end",
"def valid?\n true && super\n end",
"def super_and_sub?(sup, sub); end",
"def positive; end",
"def positive; end",
"def and_b\n end",
"def generic?; true; end",
"def calls_super # :nodoc:\n false\n end",
"def add_two(number)\n if number.respond_to? :+\n if number.respond_to? :push\n if number.respond_to? (:to_str)\n number.push 2\n else\n number + 2\n end\n end\n end\nend",
"def and_l\n end",
"def and_d\n end",
"def check\n \n end",
"def check\n \n end",
"def validate_self?\n @validate_self.is_a?(FalseClass) ? false : true\n end",
"def lent_out?\n if @@on_loan.include?(self)\n return true\n else\n return false\n end\nend",
"def added?\n\t\treturn self.status == 'A'\n\tend"
] | [
"0.57765615",
"0.5665845",
"0.5657031",
"0.5611802",
"0.5557766",
"0.5557766",
"0.5557766",
"0.5537145",
"0.5510125",
"0.5504218",
"0.5497452",
"0.54910374",
"0.54880494",
"0.548695",
"0.5486572",
"0.54860955",
"0.5473144",
"0.5471921",
"0.5467681",
"0.5453532",
"0.5447502",
"0.54261446",
"0.5414822",
"0.5396286",
"0.53909665",
"0.53814816",
"0.5373002",
"0.53534365",
"0.5350253",
"0.5348579",
"0.5348579",
"0.53324956",
"0.53252935",
"0.532344",
"0.53155065",
"0.5298057",
"0.5297366",
"0.5289197",
"0.52860856",
"0.52847654",
"0.5282476",
"0.5281314",
"0.5278617",
"0.5269053",
"0.5266901",
"0.52565825",
"0.5249417",
"0.5239319",
"0.5239056",
"0.52377814",
"0.5237534",
"0.52311575",
"0.52311575",
"0.52311575",
"0.5230775",
"0.5230199",
"0.5230199",
"0.52154297",
"0.52138925",
"0.52111423",
"0.5210525",
"0.5208685",
"0.52074695",
"0.5207267",
"0.5204143",
"0.5200642",
"0.5195912",
"0.51927",
"0.5187569",
"0.51870745",
"0.5186686",
"0.5186686",
"0.51852924",
"0.5180452",
"0.5180452",
"0.51777124",
"0.51717925",
"0.5170896",
"0.51660115",
"0.51656014",
"0.51656014",
"0.51616555",
"0.51616555",
"0.51615256",
"0.5159766",
"0.51593024",
"0.51577115",
"0.5153666",
"0.51523525",
"0.51523525",
"0.5149481",
"0.5142108",
"0.51367265",
"0.5131607",
"0.51312935",
"0.5128203",
"0.5127784",
"0.5127784",
"0.51266336",
"0.51266104",
"0.51264054"
] | 0.0 | -1 |
Policy is based on passphrase and location data | def initialize(pass, location)
@pass = pass
@location = location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passphrase\n super\n end",
"def searchpolicy\n eval @policy_key\n end",
"def create_adr_policy(policy, password)\n adr_policy_name_select.select(policy)\n save_adr_policy_btn.click\n password_input.type_text(password)\n submit_adr_policy_btn.click\n if alert_present?\n alert_accept\n Log.debugger \"Input incorrect password and get alert dialog\"\n end\n end",
"def generate_policy\n {}\n end",
"def create_adr_policy_on_popup(policy, password)\n adr_policy_name_select.select(policy)\n save_adr_policy_btn.click\n password_input.type_text(password)\n submit_adr_policy_btn.click\n if alert_present?\n alert_accept\n Log.debugger \"Input incorrect password and get alert dialog.\"\n end\n end",
"def apply_password_policy\n build_password_policy.apply\n end",
"def policy; end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def policy\n @policy ||= init_policy\n end",
"def passphrase_required?\n true\n end",
"def update_passphrase\n converge_by(\"Update #{new_resource} passphrase\") do\n Chef::Log.info \"Update #{new_resource} passphrase\"\n load_balancer.client['LocalLB.ProfileClientSSL'].set_passphrase([\"/Common/#{new_resource.sslprofile_name}\"], [{\"value\" => \"#{new_resource.passphrase}\", \"default_flag\" => \"false\" }])\n current_resource.passphrase(new_resource.passphrase)\n\n new_resource.updated_by_last_action(true)\n end\n end",
"def priv_policy_params\n params.require(:priv_policy).permit(:store_name, :policy)\n end",
"def policy_params\n params[:policy][:policy_file]\n end",
"def policy_hash\n @policy_hash ||= policy.try(:to_hash) || {}\n end",
"def policies; end",
"def getPasswordServletPolicy\n passwdpolicy= \"Delete CertPolicyServletAuth\n Policy PasswordPolicyServletAuth = [ \n ServletAuthenticationTemplate\n All users must use Password authentication when accessing the servlet named TestUserPolicyServlet\n]\"\n\n return passwdpolicy\n end",
"def passphrase= pp\n unless pp.nil? or pp.empty?\n write_attribute(:passphrase, Digest::MD5.hexdigest(pp))\n else\n write_attribute(:passphrase, nil)\n end\n end",
"def policy\n if resource[:plist]\n return File.readlines(resource[:plist]).to_s\n end \n resource[:content]\n end",
"def chkpolicy(session)\n\tprint_status(\"Checking password policy...\")\n\toutput = []\n\tbegin\n\t\tr = session.sys.process.execute(\"net accounts\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\toutput << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n\t\t# Parsing output of net accounts\n\t\tlockout = output.to_s.scan(/Lockout\\sthreshold:\\s*(\\d*)/)\n\t\tminpass = output.to_s.scan(/Minimum\\spassword\\slength:\\s*(\\d*)/)\n\t\tfailcount = output.to_s.scan(/Lockout\\sobservation\\swindow\\s\\(minutes\\)\\:\\s*(\\d*)/)\n\t\tlcktime = output.to_s.scan(/Lockout\\sduration\\s\\(minutes\\)\\:\\s*(\\d*)/)\n\t\t# check for account lockout\n\t\tif lockout.empty?\n\t\t\tprint_status \"\\tNo account lockout threshold configured\"\n\t\telse\n\t\t\tprint_status \"\\tWARNING Lockout threshold configured, if #{lockout} attempts in #{failcount} minutes account will be locked\"\n\t\t\tprint_status \"\\tThe account will be locked out for #{lcktime}\"\n\t\tend\n\t\t# check for password lenght\n\t\tif minpass.to_s == \"0\"\n\t\t\tprint_status \"\\tNo minimun password lenght is configured\"\n\t\telse\n\t\t\tprint_status \"\\tThe minumun password lengh configured is #{minpass}\"\n\t\t\tprint_status \"\\tyour dictionary should start with passwords of #{minpass} length\"\n\t\tend\n\trescue ::Exception => e\n\t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\nend",
"def passphrase\n Digistore24.configuration.passphrase\n end",
"def initialize(policy = {}, opt = {})\n # set options\n @opt = Gem::Security::OPT.merge(opt)\n\n # build policy\n policy.each_pair do |key, val|\n case key\n when :verify_data then @verify_data = val\n when :verify_signer then @verify_signer = val\n when :verify_chain then @verify_chain = val\n when :verify_root then @verify_root = val\n when :only_trusted then @only_trusted = val\n when :only_signed then @only_signed = val\n end\n end\n end",
"def load_data_private_key(data, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), filename = T.unsafe(nil), prompt = T.unsafe(nil)); end",
"def policy(policy_file)\n Policy.new(policy_file)\n end",
"def policy_title\n \"storage-policy:#{name}\"\n end",
"def parse_policy\n parts = policy.split(' ')\n self.letter = parts.last\n parts = parts.first.split('-')\n self.position1 = parts.first.to_i - 1\n self.position2 = parts.last.to_i - 1\n end",
"def gdpr_policy\n end",
"def policy_params\n params.fetch(:policy, {})\n end",
"def eval_policy(policy_type) \n\n # Bail out on the policy evaluation if 'override_policy' is defined \n # in the current Thread. This indicates that there is some function \n # privileging that should take the place of the actual policy.\n\n return Thread.current['override_policy'].call unless Thread.current['override_policy'].nil?\n\n # If there is no policy object defined, then we assume that \n # access should be allowed. This is part of our philopsophy that\n # GuardRails should not interfere with existing functionality\n # unless explicity told to do so.\n\n if policy_object.nil?\n if policy_type == :append_access\n # Not sure whether defering to :write_access in this case\n # actually does anything since the entire object is nil\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # If there is a policy_object, but it has no rule for the \n # specific type of access we are concerned with, true is the\n # default response, except in the case of append access, which\n # should defer to write access if undefined. After all, if\n # you do not have write access, you should not be able to\n # append anything.\n\n function = policy_object[policy_type]\n if function.nil?\n if policy_type == :append_access\n return eval_policy(:write_access)\n else\n return true\n end\n end\n\n # Loopbreak is a thread variable that prevents infinite loops\n # from occuring when an access control check occurs within\n # an annotation's function that are mutually dependent.\n # For now, we just run the annotation functions in a universally\n # privileged environment.\n\n return true if Thread.current['loopbreak'] == true\n Thread.current['loopbreak'] = true\n\n # The number of parameters passed to the policy's function depends\n # on how many parameters it wants. It can have no parameters, the\n # current user if it has one parameter, and the current user and \n # response information if it has two.\n\n func = eval(function)\n if func.arity == 0\n ret = eval(function).call\n elsif func.arity == 1\n ret = eval(function).call(Thread.current['user'])\n elsif func.arity == 2\n ret = eval(function).call(Thread.current['user'], Thread.current['response'])\n else\n raise GuardRailsError, \"Annotation Policy Requires Too Many Parameters\"\n end\n\n # Turn of the extra privileges\n Thread.current['loopbreak'] = false\n\n # Return true if the access is allowed, false otherwise\n ret\n end",
"def set_passphrase\n @pass = get_passphrase()\n end",
"def init_policy\n policy = PolicyConfig.new\n static_statements.each do |statement|\n policy.add_statement(statement)\n end\n template_statements.each do |statement|\n policy.add_statement(statement)\n end\n inline_statements.each do |statement|\n policy.add_statement(statement)\n end\n policy\n end",
"def set_password_policy(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetPasswordPolicy'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :minimum_password_length\n\t\t\targs[:query]['MinimumPasswordLength'] = optional[:minimum_password_length]\n\t\tend\n\t\tif optional.key? :require_lowercase_characters\n\t\t\targs[:query]['RequireLowercaseCharacters'] = optional[:require_lowercase_characters]\n\t\tend\n\t\tif optional.key? :require_numbers\n\t\t\targs[:query]['RequireNumbers'] = optional[:require_numbers]\n\t\tend\n\t\tif optional.key? :require_symbols\n\t\t\targs[:query]['RequireSymbols'] = optional[:require_symbols]\n\t\tend\n\t\tif optional.key? :require_uppercase_characters\n\t\t\targs[:query]['RequireUppercaseCharacters'] = optional[:require_uppercase_characters]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_sandbox\n policy_base = File.join(config[:kitchen_root], '.kitchen', 'poise_policy')\n # Copy all my halite-y stuff to a folder. This should probably use a\n # temp dir instead.\n FileUtils.rm_rf(policy_base)\n convert_halite_cookbooks(policy_base) unless poise_helper_instance.options['no_gem']\n copy_test_cookbook(policy_base)\n copy_test_cookbooks(policy_base)\n # Generate a modified policy to use the cookbooks we just made.\n policy_path = generate_poise_policy(policy_base)\n # Compile that policy because the base provider doesn't do that.\n compile_poise_policy(policy_path)\n # Tell the base provider code to use our new policy instead.\n if $use_policyfile_zero\n config[:policyfile] = \"#{config[:kitchen_root]}/#{policy_path}\"\n else\n config[:policyfile_path] = policy_path\n end\n super\n end",
"def initialize(name, policy = {}, opt = {})\n @name = name\n\n # set options\n @opt = opt\n\n # build policy\n policy.each_pair do |key, val|\n case key\n when :verify_data then @verify_data = val\n when :verify_signer then @verify_signer = val\n when :verify_chain then @verify_chain = val\n when :verify_root then @verify_root = val\n when :only_trusted then @only_trusted = val\n when :only_signed then @only_signed = val\n end\n end\n end",
"def generate_policy\n statements = []\n compile.resources.keys!.each do |r_name|\n r_object = compile.resources[r_name]\n if(r_object['Policy'])\n r_object['Policy'].keys!.each do |effect|\n statements.push(\n 'Effect' => effect.to_s.capitalize,\n 'Action' => [r_object['Policy'][effect]].flatten.compact.map{|i| \"Update:#{i}\"},\n 'Resource' => \"LogicalResourceId/#{r_name}\",\n 'Principal' => '*'\n )\n end\n r_object.delete!('Policy')\n end\n end\n statements.push(\n 'Effect' => 'Allow',\n 'Action' => 'Update:*',\n 'Resource' => '*',\n 'Principal' => '*'\n )\n Smash.new('Statement' => statements)\n end",
"def get_password_policy(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'GetPasswordPolicy'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tself.run(args)\n\tend",
"def policy(user, record)\n policy = ::Pundit::PolicyFinder.new(record).policy\n policy.new(user, record, self) if policy\n end",
"def handle_auth data\n CERTIFICATE.to_pem\n end",
"def policy_scopes; end",
"def set_passphrase(opts)\n opts = check_params(opts,[:passphrases])\n super(opts)\n end",
"def process_policy_options(po)\n\n if po.at(2) == :'prefix-list'\n unless $h_prefix_lists.has_key?(po.at(3))\n $h_prefix_lists[po.at(3)] = Array.new\n $prefix_list_count += 1\n end\n\n $h_prefix_lists[po.at(3)] << po.at(4)\n $prefix_list_address_count += 1\n\n elsif po.at(2) == :'policy-statement'\n unless $h_policy_statements.has_key?(po.at(3))\n $h_policy_statements[po.at(3)] = Hash.new\n $policy_statement_count += 1\n end\n unless $h_policy_statements[po.at(3)].has_key?(po.at(5))\n $h_policy_statements[po.at(3)][po.at(5)] = {:source => Hash.new, :action => nil, :metric => nil, \\\n :'next-hop' => nil, :tag => nil, :origin => nil, :pref => nil, :'local-pref' => nil, :next => nil, \\\n :'lb-perpacket' => nil}\n\n $policy_statement_term_count += 1\n end\n\n # Populate policy-statement term details\n case po.at(6)\n # source detail\n when :from\n $h_policy_statements[po.at(3)][po.at(5)][:source][po.at(8)] = po.at(7)\n\n # actions\n when :then\n case po.at(7)\n when :accept\n $h_policy_statements[po.at(3)][po.at(5)][:action] = po.at(7)\n when :discard\n $h_policy_statements[po.at(3)][po.at(5)][:action] = po.at(7)\n when :reject\n $h_policy_statements[po.at(3)][po.at(5)][:action] = po.at(7)\n when :metric\n $h_policy_statements[po.at(3)][po.at(5)][:metric] = po.at(8)\n when :'next-hop'\n $h_policy_statements[po.at(3)][po.at(5)][:'next-hop'] = po.at(8)\n when :tag\n $h_policy_statements[po.at(3)][po.at(5)][:tag] = po.at(9)\n when :origin\n $h_policy_statements[po.at(3)][po.at(5)][:origin] = po.at(8)\n when :'local-preference'\n $h_policy_statements[po.at(3)][po.at(5)][:'local-pref'] = po.at(8)\n when :preference\n $h_policy_statements[po.at(3)][po.at(5)][:pref] = po.at(8)\n when :next\n $h_policy_statements[po.at(3)][po.at(5)][:next] = po.at(8)\n else\n p \"policy-statement: action-type not supported, skipping: #{po.at(7)} --> #{po.at(8)}\" if $opts[:verbose]\n end\n end\n\n else\n p \"policy-option: type not supported, skipping: #{po.at(2)}\" if $opts[:verbose]\n end\nend",
"def policy_hash\n to_hash\n end",
"def searchpolicy=(val)\n if val.is_a?(String)\n eval @policy_key+\"= val\"\n else\n eval @policy_key+\"= #{val}\"\n end\n end",
"def populate_policies\n end",
"def load_policy\n model.clear_policy\n adapter.load_policy model\n\n init_rm_map\n model.print_policy\n build_role_links if auto_build_role_links\n end",
"def policy=(_arg0); end",
"def permissions_policy(&block); end",
"def passphrase= new_passphrase\n return if new_passphrase.blank?\n @passphrase = pw_hash(new_passphrase)\n write_attribute(:passphrase, @passphrase)\n end",
"def policy name, &body\n self.active_policy = {}\n instance_exec &body\n self.ctx[name] = self.active_policy\n end",
"def passphrase_confirmation= new_passphrase\n @passphrase_confirmation = pw_hash(new_passphrase)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def load_private_key(filename, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), prompt = T.unsafe(nil)); end",
"def get_policy_id(policy)\n key = Blake2b::Key.none\n policy_id = Blake2b.hex(hex_to_bytes(\"01#{policy}\"), key, 28)\n policy_id\nend",
"def build_password_policy\n Password.new(policy: password_policy,\n endpoints: selected_endpoints)\n end",
"def generate_iam_policy(pwd, data, generate_code, generate_docs)\n if generate_code \\\n && (!data.object.iam_policy.min_version \\\n || data.object.iam_policy.min_version >= data.version)\n product_name = @api.api_name\n target_folder = File.join(folder_name(data.version), 'services', product_name)\n FileUtils.mkpath target_folder\n data.generate(pwd,\n 'templates/terraform/iam_policy.go.erb',\n \"#{target_folder}/iam_#{full_resource_name(data)}.go\",\n self)\n\n # Only generate test if testable examples exist.\n unless data.object.examples.reject(&:skip_test).empty?\n data.generate(\n pwd,\n 'templates/terraform/examples/base_configs/iam_test_file.go.erb',\n \"#{target_folder}/iam_#{full_resource_name(data)}_generated_test.go\",\n self\n )\n end\n end\n\n return unless generate_docs\n\n generate_iam_documentation(pwd, data)\n end",
"def post_initialize(**args)\n args[:profile].nil? && (@profile = Yasst::Profiles::OpenSSL.new) ||\n (@profile = args[:profile])\n validate_passphrase(@passphrase)\n end",
"def policy=( val )\n val = val.to_s\n raise \"Invalid policy\" unless val == \"allow\" || val == \"deny\"\n\n self.permissions['policy'] = val\n end",
"def resolve_with_policyfile\n Kitchen.mutex.synchronize do\n Chef::Policyfile.new(policyfile, sandbox_path,\n logger: logger,\n always_update: config[:always_update_cookbooks]).resolve\n end\n end",
"def pubek(status)\n pass_file = \"#{Puppet[:vardir]}/simp/tpm_ownership_owner_pass\"\n enabled = status['enabled'] == 1\n owned = status['owned'] == 1\n\n out = Hash.new\n raw = ''\n\n if !enabled\n out['_status'] = 'error: tpm not enabled'\n return out\n elsif !owned\n raw = get_pubek_unowned\n out['_status'] = 'success: tpm unowned'\n else\n if File.exists?(pass_file)\n owner_pass = Facter::Core::Execution.execute(\"cat #{pass_file} 2>/dev/null\")\n if owner_pass.eql? \"\"\n out['_status'] = 'error: the password file is empty'\n return out\n else\n raw = get_pubek_owned(owner_pass)\n out['_status'] = 'success: raw pubek grabbed' unless raw.nil?\n end\n else\n out['_status'] = 'error: password file not found'\n return out\n end\n end\n\n if raw.nil? or raw == \"\"\n out['_status'] = 'error: trousers is not running, the tpm is not enabled, or the password in the password file is incorrect'\n else\n pubek = YAML.load(raw.gsub(/\\t/,' '*4).split(\"\\n\").drop(1).join(\"\\n\"))\n pubek['Public Key'].gsub!(/ /, '')\n pubek['raw'] = raw\n out.merge!( Hash[pubek.map{ |k,v| [k.downcase.gsub(/ /, '_'), v] }] )\n out['_status'] = 'success: raw parsed'\n end\n\n out\n end",
"def setup_passphrase_file\n return false if passphrase.to_s.empty?\n\n dir = Dir.mktmpdir(\"backup-gpg_passphrase\", Config.tmp_path)\n @tempdirs << dir\n file = Tempfile.open(\"backup-gpg_passphrase\", dir)\n file.write passphrase.to_s\n file.close\n\n file.path\n rescue => err\n Logger.warn Error.wrap(err, \"Error creating temporary passphrase file.\")\n false\n end",
"def policy_document\n return @policy if @policy\n \n ret = { \n expiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n conditions: [ \n { bucket: ENV['S3_BUCKET'] },\n { acl: \"public-read\" },\n [\"starts-with\", \"$key\", \"#{@picture.user.email}/#{@picture.type}/\"],\n [\"starts-with\", \"$Content-Type\", \"\"],\n { success_action_status: '201' }\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n|\\r/, '')\n end",
"def policy1(*_)\n return true\nend",
"def create_but_cancel_adr_policy(policy, password)\n adr_policy_name_select.select(policy)\n save_adr_policy_btn.click\n password_input.type_text(password)\n cancel_adr_policy_btn.click\n end",
"def policy\n ensure_service!\n grpc = service.get_instance_policy path\n policy = Policy.from_grpc grpc\n return policy unless block_given?\n yield policy\n update_policy policy\n end",
"def call\n shell.create_file private_key_filepath, rsa_private_key.to_pem\n shell.create_file protected_key_filepath, rsa_protected_key\n shell.create_file public_key_filepath, rsa_public_key.to_pem\n\n `chmod 600 #{private_key_filepath}`\n `chmod 600 #{protected_key_filepath}`\n `chmod 644 #{public_key_filepath}`\n\n ::FileUtils.touch gitignore_filepath\n\n unless ::File.read(gitignore_filepath) =~ /^.chamber.pem$/\n shell.append_to_file gitignore_filepath, \"\\n# Private and protected key files for Chamber\\n\"\n shell.append_to_file gitignore_filepath, \"#{private_key_filename}\\n\"\n shell.append_to_file gitignore_filepath, \"#{protected_key_filename}\\n\"\n end\n\n shell.copy_file settings_template_filepath, settings_filepath\n\n shell.say ''\n shell.say 'The passphrase for your encrypted private key is:', :green\n shell.say ''\n shell.say rsa_key_passphrase, :green\n shell.say ''\n shell.say 'Store this securely somewhere.', :green\n shell.say ''\n shell.say 'You can send them the file located at:', :green\n shell.say ''\n shell.say protected_key_filepath, :green\n shell.say ''\n shell.say 'and not have to worry about sending it via a secure medium (such as', :green\n shell.say 'email), however do not send the passphrase along with it. Give it to', :green\n shell.say 'your team members in person.', :green\n shell.say ''\n shell.say 'In order for them to decrypt it (for use with Chamber), they can run:', :green\n shell.say ''\n shell.say \"$ cp /path/to/{#{protected_key_filename},#{private_key_filename}}\", :green\n shell.say \"$ ssh-keygen -p -f /path/to/#{private_key_filename}\", :green\n shell.say ''\n shell.say 'Enter the passphrase when prompted and leave the new passphrase blank.', :green\n shell.say ''\n end",
"def set_priv_policy\n @priv_policy = PrivPolicy.find(params[:id])\n end",
"def have_policy_for?(app_name)\n @policies ||= Vault.sys.policies\n @policies.include?(app_name)\n end",
"def credential=(_arg0); end",
"def credential=(_arg0); end",
"def update!(**args)\n @policy = args[:policy] unless args[:policy].nil?\n end",
"def validate(passphrase)\n words = passphrase.split\n words == words.uniq\nend",
"def set_policy\n @policy = Policy.find(params[:id])\n end",
"def set_policy\n @policy = Policy.find(params[:id])\n end",
"def set_policy\n @policy = Policy.find(params[:id])\n end",
"def set_policy\n @policy = Policy.find(params[:id])\n end",
"def policy(name)\n json = client.get(\"/v1/sys/policy/#{encode_path(name)}\")\n return Policy.decode(json)\n rescue HTTPError => e\n return nil if e.code == 404\n raise\n end",
"def policy_params\n params.require(:policy).permit(:name, :carrier, :kind, :commission)\n end",
"def policy\n ensure_service!\n grpc = service.get_database_policy instance_id, database_id\n policy = Policy.from_grpc grpc\n return policy unless block_given?\n yield policy\n update_policy policy\n end",
"def policy\n ensure_service!\n grpc = service.get_database_policy instance_id, database_id\n policy = Policy.from_grpc grpc\n return policy unless block_given?\n yield policy\n update_policy policy\n end",
"def policy_class\n nil\n end",
"def is_valid_passphrase?(passphrase)\n words = passphrase.split(' ')\n words.uniq.length == words.length\nend",
"def authorization_mode; end",
"def credential; end",
"def credential; end",
"def setPolicies\n=begin\n Util.modifyPolicy(ncaEnclave, '', '\nPolicy DamlBootPolicyNCAServletForRearPolicyAdmin = [\n A user in role RearPolicyAdministration can access a servlet named NCAServlets\n]\n')\n=end\n end",
"def skip_policy_scope; end",
"def policy(user, record)\n policy = policy_finder(record).policy\n policy.new(user, record) if policy\n end",
"def set_policy\n @policy = Policy.find(params[:id])\n @broker = @policy.broker\n end",
"def part_two\n count_valid_passwords(NewPolicy)\n end",
"def add_policy_uri(policy_uri)\n unless @preferred_auth_policies.member? policy_uri\n @preferred_auth_policies << policy_uri\n end\n end",
"def credential_hsh\n h = {s: \"Seal\", l: \"Letter\", c: \"Certificate\", p: \"PSA/DNA\", o: \"Official Seal\"}\n end"
] | [
"0.62416947",
"0.61088634",
"0.6086485",
"0.60613376",
"0.6040584",
"0.60325545",
"0.6008921",
"0.5992994",
"0.5934717",
"0.59248143",
"0.5913577",
"0.5840207",
"0.5824734",
"0.57596356",
"0.5751527",
"0.5696536",
"0.56575817",
"0.56310415",
"0.5613634",
"0.5611024",
"0.5585841",
"0.5584653",
"0.5531922",
"0.553015",
"0.5507828",
"0.55050755",
"0.5502557",
"0.5435251",
"0.54253477",
"0.5415769",
"0.5407674",
"0.5376906",
"0.5368684",
"0.5366284",
"0.5361814",
"0.53479284",
"0.5345214",
"0.53451055",
"0.5341186",
"0.531629",
"0.5303226",
"0.5285326",
"0.527384",
"0.52738136",
"0.5256971",
"0.5254691",
"0.52470124",
"0.5245769",
"0.52326083",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5223542",
"0.5220346",
"0.52171314",
"0.521656",
"0.521449",
"0.52012295",
"0.5198896",
"0.5168691",
"0.5166649",
"0.51592237",
"0.5145127",
"0.5128768",
"0.51239026",
"0.51111877",
"0.510919",
"0.51005954",
"0.5081957",
"0.50686157",
"0.50686157",
"0.50652516",
"0.5059491",
"0.5053012",
"0.5053012",
"0.5053012",
"0.5053012",
"0.50428885",
"0.5039865",
"0.5028296",
"0.5028296",
"0.5020671",
"0.5017475",
"0.50152636",
"0.50145316",
"0.50145316",
"0.50139594",
"0.5013855",
"0.50135386",
"0.5012411",
"0.50086164",
"0.50075763",
"0.49917853"
] | 0.0 | -1 |
Scope is based on passphrase | def initialize(pass, scope)
@pass = pass
@scope = scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passphrase\n super\n end",
"def scope_name; end",
"def scope\n read_attr :scope, :to_sym\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def insecure\n @scope\n end",
"def scope\n parameter[:scope]\n end",
"def create_scope\n sprintf \"%s/%s/signer\", @self_key, @client_id\n end",
"def scope_options; end",
"def scope_options; end",
"def scopes; end",
"def passphrase\n Digistore24.configuration.passphrase\n end",
"def policy_scopes; end",
"def scope\n @scope ||= \"study.#{app_name}\"\n end",
"def scope=(_); end",
"def scope() binding end",
"def credential_scope\n [\n date[0, 8],\n region,\n service,\n \"aws4_request\"\n ].join(\"/\")\n end",
"def internet_passwords\n Scope.new(Sec::Classes::INTERNET)\n end",
"def stradivari_scopes\n @_stradivari_scopes ||= {}\n end",
"def scope_level; end",
"def scope\n @scope ||= {}\n end",
"def scope\n @scope ||= {}\n end",
"def stradivari_scope(name, *args, &block)\n callable, options = stradivari_scope_options(*args, &block)\n\n scope(name, callable)\n options[:type] ||= :string\n stradivari_scopes.store(name.to_sym, options)\n end",
"def scope(*args); end",
"def internet_passwords\n Scope.new(Sec::Classes::INTERNET, self)\n end",
"def scopeName _args\n \"scopeName _args;\" \n end",
"def scope\n @attributes[:scope]\n end",
"def scope\n @options[:scope]\n end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope_context\n @sssn\n end",
"def params_auth_hash\n params[scope]\n end",
"def params_auth_hash\n params[scope]\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def set_Scope(value)\n set_input(\"Scope\", value)\n end",
"def scopes\n ENV.fetch('SCOPES', 'store_v2_products')\nend",
"def credential_scope\n [request_datestamp,\n region,\n service,\n \"aws4_request\"].join(\"/\")\n end",
"def scope\n @scope\n end",
"def scope\n @scope\n end",
"def authenticate_scope!\n super\n end",
"def create_washington_auth_request(scope)\n post user_session_path, params: {user: { \n email: users(:washington).email,\n password: \"georgepass\"\n }}\n \n context = {}\n context[\"scope\"] = scope\n context[\"state\"] = SecureRandom.urlsafe_base64(10)\n context[\"code_verifier\"] = SecureRandom.urlsafe_base64(10)\n context[\"client_id\"] = \"http://localhost:12345\"\n context[\"redirect_uri\"] = \"http://localhost:12345/redirect\"\n\n approval_params = {}\n scope.split(\" \").each {|s| approval_params[s] = 1}\n approval_params[\"code_challenge\"] = \n Base64.urlsafe_encode64(\n Digest::SHA256.digest(\n context[\"code_verifier\"])).chomp(\"=\")\n approval_params[\"commit\"] = \"Approve\"\n [\"state\", \"client_id\", \"redirect_uri\"].each do |p|\n approval_params[p] = context[p]\n end\n\n\n post indie_auth_approval_path, params: approval_params\n return context\n end",
"def skip_policy_scope; end",
"def quoted_scope(name = nil, type: nil)\n schema, name = extract_schema_qualified_name(name)\n type =\n case type # rubocop:disable Style/HashLikeCase\n when \"BASE TABLE\"\n \"'r','p'\"\n when \"VIEW\"\n \"'v','m'\"\n when \"FOREIGN TABLE\"\n \"'f'\"\n end\n scope = {}\n scope[:schema] = quote(schema || shard.name)\n scope[:name] = quote(name) if name\n scope[:type] = type if type\n scope\n end",
"def devise_scope(scope); end",
"def generic_passwords\n Scope.new(Sec::Classes::GENERIC)\n end",
"def passphrase_required?\n true\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def policy_scope(target, options={})\n policy(target, options).scope\n end",
"def generic_passwords\n Scope.new(Sec::Classes::GENERIC, self)\n end",
"def scope(scope_name)\n Scope.new(@backend, @name, scope_name)\n end",
"def verify_scope(scope)\n self.user_scope.each do |sym|\n raise RuntimeError, \"Expected to be passed a scope containing the key '#{sym.to_s}'\" unless scope.has_key? sym\n end\n scope\n end",
"def dampen_scope(scope)\n define_method(:dampening_scope) do\n scope\n end\n end",
"def scope\n scope_hash = [settings.force_mode,state.total].hash\n return @state.scope unless @state.scope.nil? or scope_hash != @state.scope_hash\n state.scope_at = [\n settings.force_mode || ($stdout.isatty ? :tty : :notty),\n :unknown == state.total ? :infinite : :finite\n ]\n state.scope = state.settings\n state.scope_at.each do |s|\n begin\n state.scope = state.scope[s]\n rescue NoMethodError\n raise StandardError, \"Invalid configuration: #{state.scope_at.join('.')} \"+\n \"(Can't resolve: #{state.scope_at[state.scope_at.index(s)-1]})\"\n end\n end\n state.scope_hash = scope_hash\n state.scope\n end",
"def auth_options\n { scope: resource_name }\n end",
"def scope(parameters)\n scope_proxy.ad_hoc(parameters)\n end",
"def oauth2_scope(value = nil)\n rw_config(:oauth2_scope, value, '')\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def custom_scope_get scope_name\n\t\t\tThread.current[SESSION].custom_scope_get scope_name\n\t\tend",
"def scope_token(para1, para2 = nil, para3 = nil)\n if ( para2.nil? )\n data = { \"auth\" => { \"tenantName\" => para1, \"token\" => { \"id\" => token() } } }\n @data = post_request(address(\"/tokens\"), data, token())\n else \n authenticate(para1, para2, token(), para3)\t\t\t\n end\n end",
"def scope\n Pundit.policy_scope!(user, record.class)\n end",
"def privacy_scope=(scope)\r\n\t\t\t@privacy_scope = scope\r\n\t\tend",
"def resolve\n pass_id = Pass.where(phrase: pass&.phrase).pluck(:id)\n scope.where(pass_id: pass_id)\n end",
"def scope!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n\n type = SCOPE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 8:9: 'scope'\n match(\"scope\")\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__, 2)\n\n end",
"def scopes\n env['HTTP_X_AUTHENTICATED_SCOPE'].to_s.split(',')\n end",
"def scope *args\n [main_scope, args, graphite_identifier].flatten.compact.map(&:to_s).join('.')\n end",
"def passphrase= pp\n unless pp.nil? or pp.empty?\n write_attribute(:passphrase, Digest::MD5.hexdigest(pp))\n else\n write_attribute(:passphrase, nil)\n end\n end",
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def determine_scope\n # Transform the CL arguments in a dictionary in the form \"::option\" => argument\n scope = Hash[ARGV.map { |kv| \"::#{kv.sub('--', '')}\".split('=') }]\n abort(usage \"Error: --fqdn=FQDN is required.\") unless scope['::fqdn']\n scope['::hostname'] = scope['::fqdn'][/^[^.]+/]\n if scope['::fqdn'].end_with?('.wmflabs') || scope['::fqdn'].end_with?('.labtest')\n scope['::realm'] = 'labs'\n else\n scope['::realm'] = 'production'\n end\n\n # Detect labs project/site\n if scope['::realm'] == 'labs'\n bits = scope['::fqdn'].split('.')\n unless bits.length == 4\n Kernel.abort('labs FQDN must be <hostname>.<project>.<site>.(wmflabs|labtest)')\n end\n scope['::labsproject'] = bits[1]\n scope['::site'] = bits[2]\n end\n\n # Attempt at determining the site\n scope['::site'] ||= scope['::fqdn'].split('.')[-2]\n if scope['::site'] == 'wikimedia' || scope['::site'].nil?\n abort(usage \"\\nError: --site=SITE is required if the FQDN doesn't contain it\")\n end\n\n # Transform roles in the form puppet expects\n if scope['::roles']\n scope['_roles'] = Hash[scope['::roles'].split(',').map { |role| [role.gsub('role::', ''), true] }]\n scope.delete('::roles')\n end\n scope\nend",
"def prov_scope(opts)\n scope = []\n # Request date (created since X days ago)\n scope << [:created_recently, opts[:time_period].to_i] if opts[:time_period].present?\n # Select requester user across regions\n scope << [:with_requester, current_user.id] unless approver?\n scope << [:with_requester, opts[:user_choice]] if opts[:user_choice] && opts[:user_choice] != \"all\"\n\n scope << [:with_approval_state, opts[:applied_states]] if opts[:applied_states].present?\n scope << [:with_type, MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].keys]\n scope << [:with_request_type, opts[:type_choice]] if opts[:type_choice] && opts[:type_choice] != \"all\"\n scope << [:with_reason_like, opts[:reason_text]] if opts[:reason_text].present?\n\n scope\n end",
"def scope_handler(scope_string)\n str = scope_string.split(\":\", 3)\n raise ScopeNotHandled, \"Wrong format for scope string\" if str.length != 3\n\n case str[0]\n when \"repository\"\n auth_scope = Namespace::AuthScope.new(scope_string)\n when \"registry\"\n auth_scope = Registry::AuthScope.new(scope_string)\n else\n raise ScopeNotHandled, \"Scope not handled: #{str[0]}\"\n end\n\n [auth_scope, auth_scope.scopes.dup]\n end",
"def scope_from_params(params)\n return default_scope if params[:scope].blank?\n scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',')\n scope = scope.map(&:downcase).map(&:strip)\n return scope & default_scope\n end",
"def scopes\n params['scope']\n end",
"def doe_scope\n scope = \"none\"\n @envelopeLevel.each_index do |index|\n @envelopeLevel[index].each do |name|\n if (@commandName == name )\n scope = \"envelope\"\n end\n end\n end\n\n @hvacLevel.each_index do |index|\n @hvacLevel[index].each do |name|\n if (@commandName == name )\n scope = \"hvac\"\n end\n end\n end\n return scope\n end",
"def chef_scope(field, term=\"*\")\n scopes = fetch(:chef_scopes) || []\n scopes.delete_if { |scope| scope =~ /chef_environment/ }\n set :chef_scopes, scopes << [field, term].join(\":\")\n end",
"def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end",
"def scope_name scope\n\t\traise \"No data-source set\" unless data_source\n\t\tdata_source.scopes.get(scope).human_name\n\tend"
] | [
"0.64734966",
"0.6261137",
"0.6158956",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60982",
"0.60980564",
"0.59548336",
"0.58726656",
"0.5827765",
"0.5827765",
"0.58026713",
"0.57970184",
"0.57333654",
"0.5731722",
"0.57224995",
"0.57071555",
"0.56957936",
"0.5693119",
"0.5680136",
"0.5667211",
"0.56615967",
"0.56615967",
"0.56445485",
"0.5641181",
"0.56202483",
"0.5615711",
"0.5604302",
"0.5595154",
"0.5580724",
"0.5580724",
"0.5580724",
"0.5572417",
"0.55650145",
"0.55650145",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.5516862",
"0.55135405",
"0.55135405",
"0.55113",
"0.5493799",
"0.54914093",
"0.54914093",
"0.5485885",
"0.54737073",
"0.54718655",
"0.546962",
"0.5455736",
"0.5454921",
"0.5438173",
"0.54338455",
"0.54338455",
"0.54338455",
"0.54338455",
"0.54338455",
"0.54338455",
"0.54238",
"0.5411249",
"0.540819",
"0.54068136",
"0.5391762",
"0.5375917",
"0.53591394",
"0.5351901",
"0.5347858",
"0.5345104",
"0.53377616",
"0.5336662",
"0.5334558",
"0.5325676",
"0.53101104",
"0.5306484",
"0.5300525",
"0.52939296",
"0.52893734",
"0.52784014",
"0.5256429",
"0.5250448",
"0.5249945",
"0.5231475",
"0.5226357",
"0.52239835",
"0.5220229",
"0.52164805",
"0.52106416"
] | 0.0 | -1 |
Resolves indexing on location data matching passphrase | def resolve
pass_id = Pass.where(phrase: pass&.phrase).pluck(:id)
scope.where(pass_id: pass_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_for_location(offense); end",
"def autoindex(loc, switch = 'on')\n oputs <<-eos\n location #{loc} {\n autoindex #{switch};\n }\n eos\nend",
"def index_location_description # :nologin: :norobots:\n query = find_or_create_query(:LocationDescription, :by => params[:by])\n show_selected_location_descriptions(query, :id => params[:id].to_s,\n :always_index => true)\n end",
"def search_key\n \"#{location}_search\".to_sym\n end",
"def lindex(key, index); end",
"def lindex(key, index); end",
"def pfind(name, location)\n result = nil\n [name, name.upcase, name.downcase].each do |n|\n next if result\n result = location[n].first if location[n] && location[n].size > 0\n end\n STDERR.puts \"found #{result} for #{name}\" if $test\n\n result\nend",
"def do_local_indexing(solr_doc); end",
"def build_localities_index(data_directory)\n\n locality_fields = %w{ LocalityCode Country State County Locality Park BodyOfWater NS Lat_deg Lat_min Lat_sec EW Long_deg Long_min Long_sec Latitude Longitude Elev_m Elev_ft Elevation PrecisionCode Comments DrainageBasinLesser DrainageBasinGreater StreamSize INDrainage WisconsinGlaciated OldLocalityCode CreatedOn ModifiedOn CreatedBy ModifiedBy }\n\n localities_file = data_directory + 'TXT/localities.txt'\n raise 'file not found' if not File.exists?(localities_file)\n lo = CSV.open(localities_file, col_sep: \"\\t\", :headers => true)\n\n puts \"Indexing localities.\"\n\n localities = {}\n lo.each do |row|\n tmp_l = {}\n locality_fields.each do |c|\n tmp_l.merge!(c => row[c]) unless row[c].blank?\n end\n localities.merge!(row['LocalityCode'] => tmp_l)\n end\n\n localities\n end",
"def default_index_subaction\n list_locations\n end",
"def index_location # :nologin: :norobots:\n query = find_or_create_query(:Location, :by => params[:by])\n show_selected_locations(query, :id => params[:id].to_s, :always_index => true)\n end",
"def location_search # :nologin: :norobots:\n query = create_query(:Location, :pattern_search, :pattern => Location.user_name(@user, params[:pattern].to_s))\n show_selected_locations(query, :link_all_sorts => true)\n end",
"def locate_pins(location); end",
"def require_index(name); end",
"def require_index(name); end",
"def looked_up!( local_index )\n \n @requires_lookup[ local_index ] = false\n \n return self\n \n end",
"def full_search(keywords, options = {})\n latitude = nil\n longitude = nil\n bounds = options[:bounds]\n where = nil\n \n if options[:alternate].blank? && options[:specific].blank? && options[:skip_where].blank?\n where_results = Atlas::Geography.where_am_i(keywords, options.dup)\n \n keywords = where_results[:query]\n where = where_results[:where].models\n \n unless where.blank?\n selected = where.first\n bounds = selected.bounds\n end\n \n options.delete :fq\n \n # The user has indicated that our \"where\" guess was incorrect, and selected another.\n elsif options[:alternate].present?\n selected = Atlas::Geography.find(options[:alternate])\n bounds = selected.bounds \n \n # Record when a user selects an alternate where result, i.e. we got it wrong!\n # Atlas::GeographicQueryLog.create :status => 'alternate', :query => query, :session_id => options[:session_id]\n\n # The user has sent in a specific bounding box in which to search. Presumably the user is looking\n # at a map, dragging it around, and re-performing searches.\n elsif options[:specific].present?\n bounds = options[:specific]\n end\n\n keywords = '*' if keywords.blank?\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n if results.documents.empty? && where.present?\n where[1..-1].each do |geography|\n selected = geography\n envelope = geography.read_attribute(:bounds).envelope\n center = envelope.center\n top_center = center.y + (center.y - envelope.lower_corner.y)\n radius = center.spherical_distance(Point.from_x_y(center.x, top_center)) / 1000.0\n\n results = solr_server.find(\"{!spatial lat=#{center.lat} long=#{center.lng} radius=#{radius} unit=km calc=arc threadCount=2}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n break unless results.documents.empty?\n end\n end\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => selected, :where => where, :query => (keywords == '*' && '' || keywords) }\n end",
"def lttfindex\n end",
"def requires_lookup!( local_index )\n \n @requires_lookup[ local_index ] = true\n \n return self\n \n end",
"def load_results\n FindSalon::SalonSearch.new(user_location).resolve\n end",
"def grant_search(grants, grant_number)\n # set up location = nil\n return if grant_number == nil\n duplicate_index = nil\n\n # search grant hash in the array and if find the duplicate, then set up index # location\n grants.each_with_index do |grant, i|\n if grant[:grant_number] == grant_number\n duplicate_index = i\n break\n end\n end\n duplicate_index\nend",
"def convert_key_to_index key\n i = IDX.index(key)\n return nil unless i\n\n # @log.debug \"get_index with #{key}: #{i}. #{@stact}. #{@vps}\"\n # TODO: if very high key given, consider going to last file ?\n # that way one can press zz or ZZ to go to last file.\n # 2019-04-11 - XXX actually this doesnt place the cursor on last file\n # it opens it, which may not be what we want\n retnil = nil # vps - 1 # nil\n # user has entered a key that is outside of range, return nil\n return retnil if @stact == 0 && i + @stact >= @vps\n\n # again, key out of range\n # return nil if @stact > 0 && i + @stact >= @vps && i + @stact - @vps >= @stact\n return retnil if @stact > 0 && i + @stact >= @vps && i - @vps >= 0\n\n # panning case, hints are recycled\n return (i + @stact) - @vps if i + @stact >= @vps\n\n # regular hint\n return i + @stact # if i\n\nend",
"def execute(index)\n matches = index.hashes_for @search_term, restrict_type: @object_type, restrict_field: @field_name\n return matches.map do |matched_object|\n # Polymorphism of some kind would probably be cleaner than this, but this is literally the\n # only part of the codebase that cares, so... ¯\\_(ツ)_/¯\n case @object_type\n when 'organization'\n ticket_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'organization_id'\n end\n user_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'user', restrict_field: 'organization_id'\n end\n next {\n '_tickets' => ticket_matches&.map { |t| t.slice('_id', 'subject')},\n '_users' => user_matches&.map { |t| t.slice('_id', 'name')},\n }.merge(matched_object)\n when 'ticket'\n asignee_matches = if matched_object['assignee_id']\n index.hashes_for matched_object['assignee_id'], restrict_type: 'user', restrict_field: '_id'\n end\n submitter_matches = if matched_object['submitter_id']\n index.hashes_for matched_object['submitter_id'], restrict_type: 'user', restrict_field: '_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assignee' => asignee_matches&.map { |t| t.slice('_id', 'name') },\n '_submitter' => submitter_matches&.map { |t| t.slice('_id', 'name') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n when 'user'\n asignee_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'assignee_id'\n end\n submitter_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'submitter_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assigned_tickets' => asignee_matches&.map { |t| t.slice('_id', 'subject') },\n '_submitted_tickets' => submitter_matches&.map { |t| t.slice('_id', 'subject') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n\n end \n end\n end",
"def check_index_finder\n # Leave it alone\n end",
"def test_get_location_index_invalid\n finder = MapLocationFinder.new\n assert_nil finder.get_location_index(\"INVALID LOCATION\")\n end",
"def requires_lookup?( local_index )\n \n return @requires_lookup ? @requires_lookup[ local_index ] || false : false\n \n end",
"def contains_alias(aliaz)\n\n end",
"def update_pose_index\n update_pose_words if Pose.perform_search?\n end",
"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 search\n \n # Populate the @traveler variable\n get_traveler\n \n query = params[:query]\n query_str = query + \"%\"\n Rails.logger.debug query_str\n\n # This array will hold the list of matching places\n matches = [] \n # We create a unique index for mapping etc for each place we find\n counter = 0 \n \n # First search for matching names in my places\n rel = Place.arel_table[:name].matches(query_str)\n places = @traveler.places.active.where(rel)\n places.each do |place|\n matches << {\n \"index\" => counter,\n \"type\" => PLACES_TYPE,\n \"name\" => place.name,\n \"id\" => place.id,\n \"lat\" => place.location.first,\n \"lon\" => place.location.last,\n \"address\" => place.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => place.name, :address => place.address} })\n }\n counter += 1\n end\n \n # Second search for matching address in trip_places. We manually filter these to find unique addresses\n rel = TripPlace.arel_table[:raw_address].matches(query_str)\n tps = @traveler.trip_places.where(rel).order(\"raw_address\")\n old_addr = \"\"\n tps.each do |tp|\n if old_addr != tp.raw_address\n matches << {\n \"index\" => counter,\n \"type\" => CACHED_ADDRESS_TYPE,\n \"name\" => tp.raw_address,\n \"id\" => tp.id,\n \"lat\" => tp.lat,\n \"lon\" => tp.lon,\n \"address\" => tp.raw_address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => tp.name, :address => tp.raw_address} })\n }\n counter += 1\n old_addr = tp.raw_address\n end \n end\n \n # Lastly search for matching names in the POI table\n rel = Poi.arel_table[:name].matches(query_str)\n pois = Poi.where(rel).limit(MAX_POIS_FOR_SEARCH)\n pois.each do |poi|\n matches << {\n \"index\" => counter,\n \"type\" => POI_TYPE,\n \"name\" => poi.name,\n \"id\" => poi.id,\n \"lat\" => poi.lat,\n \"lon\" => poi.lon,\n \"address\" => poi.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => poi.name, :address => poi.address} })\n }\n counter += 1\n end\n \n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n end",
"def index(loc, offset=0) end",
"def mineLocation field\n location=[]\n field.each_with_index do |row,index|\n if row.include?(1)\n location << index\n row.each_with_index do |col, idx|\n if col==1\n location << idx\n end\n end\n end\n end\n return location\nend",
"def croucher_index_confidentiality\n \"private\"\n end",
"def rindex(p0) end",
"def legislators_locate(*args)\n get('/legislators/locate', extract_location(args))\n end",
"def location\n recommendations 'location'\n end",
"def lookup(name)\n locations.find do |v|\n v.name.casecmp(name).zero? || (v.code == name)\n end\n end",
"def x_occi_location_key!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = X_OCCI_LOCATION_KEY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 137:4: 'X-OCCI-Location'\n match( \"X-OCCI-Location\" )\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__, 9 )\n\n end",
"def stored_search_index\n @updated_search_index ||= begin\n if search_index_path.exist?\n require 'json'\n index = JSON.parse(search_index_path.read)\n index if index.is_a?(Hash) # TODO: should we also check if hash has correct hierarchy?\n end\n end\n end",
"def _voyager_lookup code\n\n metadata = {}\n\n voyager = OCI8.new($config['voyager']['user'], $config['voyager']['pass'], $config['voyager']['host'])\n\n # Do the main Voyager query to get bibid from barcode\n voyager.exec(\"select bt.* from item_barcode ib, bib_item bi, bib_text bt where ib.item_barcode='#{code}' and ib.item_id=bi.item_id and bi.bib_id = bt.bib_id\") do |result|\n metadata[:bibid] = result[0]\n metadata[:author] = result[1]\n metadata[:title] = result[3]\n end\n\n # Do a secondary query to collect oclc number\n index_fields = voyager.exec(\"select normal_heading from bib_index where bib_id='#{metadata[:bibid]}' and index_code='0350'\")\n while field = index_fields.fetch\n if result = /.*OCOLC\\D*(\\d+)/i.match(field[0])\n metadata[:oclc_id] = result.captures[0]\n end\n end\n\n return metadata\n\nend",
"def user_location_to_indexes(user_location)\n column = \"abcdefgh\".index(user_location[0])\n row = user_location[1].to_i - 1\n \n [column, row]\n end",
"def index(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n\n ### Start of new indexing code.\n # Index the MATERIALS field, splitting on semicolons.\n row['MATERIALS'].to_s.split(';').each do |material|\n material.strip!\n material.downcase!\n doc.add_boolean_term(\"XM#{material}\") if material.length.positive?\n end\n ### End of new indexing code.\n\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"def search_locally(search_term:)\n return [] unless search_term.present? && search_term.length > 2\n\n orgs = local_search(search_term: search_term)\n prepare(search_term: search_term, records: orgs)\n end",
"def find(index_key)\n index[index_key]\n end",
"def lookup_key(key)\n hash = get_hash(key)\n path = File.join(@index_folder, \"#{hash}.index\")\n @logger.fine(\"Using index file '#{path}'\")\n return nil unless File.exist?(path)\n\n index_data = []\n File.open(path, 'rb') do |f|\n timestamp = read_int(0, f)\n raise IndexError.new('Index is out of date') if timestamp != @data_timestamp\n index_data = f.read\n end\n\n it = index_data.each_byte\n while it.peek\n k = unpack_string(it) # First read a null terminated string.\n o = unpack_int(it) # Then a long that represents the offset.\n return o if k.eql?(key) # If the string and key match, then the long is the required offset.\n return nil if k > key # If the unpacked key is greater than the required key, we can return immediately.\n end\n rescue StopIteration\n # EOF without finding anything.\n rescue IndexError\n raise IndexError.new(\"Error encountered while processing index file '#{path}'\", $!)\n end",
"def reverse_lookup(password, file=nil)\n \n dx = if file then\n Dynarex.new file\n elsif @dx\n @dx\n else\n raise 'dynarex-password: please supply a lookup file'.error\n end\n \n fixed_size = (dx.summary[:fixedsize] || 2).to_i\n puts 'fixed_size: ' +fixed_size.inspect if @debug\n \n h = dx.to_a.inject({}){|r, x| r.merge({x[:value] => x[:index]})}\n\n password.split('-').map do |linex| \n linex.split('_').map do |x|\n x.split(//).each_slice(fixed_size).map {|chars| h[chars.join]}.join \n end.join '_'\n end.join '-'\n\n end",
"def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end",
"def biodiversity_index(specimens)\nend",
"def biodiversity_index(specimens)\nend",
"def contain_match_at_indices(word, indices, guess)\n\t\t#Set secret_word to word from candidate_words\n\t\t#so we can use ComputerPlayer#check_guess method\n\t\t@secret_word = word\n\t\tmatching_indices = check_guess(guess)\n\t\t(indices == matching_indices) ? true : false\t\t\n\tend",
"def locations; end",
"def construct_index\n end",
"def index_query_results\n query = find_or_create_query(:Location, by: params[:by])\n show_selected_locations(query, id: params[:id].to_s, always_index: true)\n end",
"def index(p0) end",
"def index(p0) end",
"def anchors_index\n ANCHORS_INDEX_PLACEHOLDER\n end",
"def refresh_aliases(e, params)\n return unless params.first == @password\n load_aliases\nend",
"def find_index(params = {})\n name = if params.one?\n params.keys.first.to_s\n else\n params.keys.join('_and_')\n end\n index = model[association.name]['index'][name]\n\n return if index.blank? && Embedded.config.scan_tables\n raise NoSolutionsError, name if index.blank?\n\n index\n end",
"def open_index_file\n end",
"def index\n return patterned_index if params[:pattern].present?\n\n index_full\n end",
"def lookups; end",
"def index_for_authority(authority)\n SUBAUTHORITIES[authority]\n end",
"def search_with_geography(keywords, options = {})\n unless keywords.blank?\n # For backwards compatibility\n options[:count] ||= options[:rows] || 10\n \n parameters = {\n :start => options[:start] && options[:start].to_i || 0,\n :rows => options[:count] && options[:count].to_i > 0 && options[:count].to_i < 100 && options[:count].to_i || 10\n }\n \n parameters[:fq] = bounds_query(options[:bounds]) if options[:bounds].present?\n \n places = []\n facets = []\n \n results = PublicEarth::Db::Place.search_for keywords, parameters\n places = results.models\n \n # Tack on a possible map location, such as a city or country? Maybe the user was searching\n # to move the map, not look for places?\n where = nil\n unless options[:e]\n where = PublicEarth::Db::Where.am_i?(keywords, options[:bounds])\n where = nil if where.score.nil?\n end\n \n # A bold substitute for a rules engine! (There is a paper flowchart of this somewhere...)\n if options[:bounds]\n if places.blank?\n if where.present? \n [:reposition, where, nil, nil]\n else\n [:display, nil, nil, nil]\n end\n else\n if where.present?\n if where.score > 3.0\n [:prompt, where, results]\n else\n [:display, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n else\n if places.blank? && where.blank?\n [:display, nil, nil]\n else\n if where.present?\n if where.score > 0.4 && !options[:recursed]\n if where.score > 2.0\n k = keywords.downcase\n # Temporary stop terms...FIX!!!\n (\"in for from near by where around over under \" + where.name.downcase).split(/\\s+/).each do |word|\n k.gsub! /\\b#{word}\\b/, ''\n end\n options.merge!({ :bounds => where.bounds, :recursed => true })\n \n again = search_with_geography(k, options)\n if again[2].blank?\n [:reposition, where, nil, nil]\n else\n [:display, where, again.last]\n end\n else\n [:prompt, where, results]\n end\n else\n [:suggest, where, results]\n end\n else\n [:display, nil, results]\n end\n end\n end\n else\n [:display, nil, nil, nil]\n end\n end",
"def index\n @result = request.location\n if user_signed_in?\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n if params[:tag]\n @ideas = Idea.where('city = ? OR country = ?', @location.city_name, @location.country_name).near([@result.latitude, @result.longitude], 5, :units => :km).tagged_with(params[:tag])\n else\n @ideas = Idea.where('city = ? OR country = ?', @location.city_name, @location.country_name).near([@result.latitude, @result.longitude], 5, :units => :km)\n end\n else\n @ideas = Idea.all.near([@result.latitude, @result.longitude], 5, :units => :km)\n end\n end",
"def method_missing ( method, *args )\n # Handle all valid *_index/*_key calls:\n return _addIndexes( method, *args ) if VALID_INDEX_HINTS.include? method \n super\n end",
"def doppelganger_index\n @doppelgangers =\n if params[:query].blank?\n Doppelganger.all\n else\n Doppelganger.search_by_name_and_description(params[:query])\n end\n @doppelgangers = @doppelgangers.near(params[:city], 10)\n end",
"def lookup_text\n\t\t$app.data_controller.search_matching_links_to @search_text\n\tend",
"def dns_find(key)\n \n end",
"def lookup_general(model, accepted = false)\n matches = []\n suggestions = []\n type = model.type_tag\n id = params[:id].to_s.gsub(/[+_]/, \" \").strip_squeeze\n begin\n if id.match(/^\\d+$/)\n obj = find_or_goto_index(model, id)\n return unless obj\n matches = [obj]\n else\n case model.to_s\n when \"Name\"\n if (parse = Name.parse_name(id))\n matches = Name.find_all_by_search_name(parse.search_name)\n if matches.empty?\n matches = Name.find_all_by_text_name(parse.text_name)\n end\n matches = fix_name_matches(matches, accepted)\n end\n if matches.empty?\n suggestions = Name.suggest_alternate_spellings(id)\n suggestions = fix_name_matches(suggestions, accepted)\n end\n when \"Location\"\n pattern = \"%#{id}%\"\n conditions = [\"name LIKE ? OR scientific_name LIKE ?\",\n pattern, pattern]\n matches = Location.find(:all,\n limit: 100,\n conditions: conditions)\n when \"Project\"\n pattern = \"%#{id}%\"\n matches = Project.find(:all,\n limit: 100,\n conditions: [\"title LIKE ?\", pattern])\n when \"SpeciesList\"\n pattern = \"%#{id}%\"\n matches = SpeciesList.find(:all,\n limit: 100,\n conditions: [\"title LIKE ?\", pattern])\n when \"User\"\n matches = User.find_all_by_login(id)\n matches = User.find_all_by_name(id) if matches.empty?\n end\n end\n rescue => e\n flash_error(e.to_s) unless Rails.env == \"production\"\n end\n\n if matches.empty? && suggestions.empty?\n flash_error(:runtime_object_no_match.t(match: id, type: type))\n action = model == User ? :index_rss_log : model.index_action\n redirect_to(controller: model.show_controller,\n action: action)\n elsif matches.length == 1 || suggestions.length == 1\n obj = matches.first || suggestions.first\n if suggestions.any?\n flash_warning(:runtime_suggest_one_alternate.t(match: id, type: type))\n end\n redirect_to(controller: obj.show_controller,\n action: obj.show_action,\n id: obj.id)\n else\n obj = matches.first || suggestions.first\n query = Query.lookup(model, :in_set, ids: matches + suggestions)\n if suggestions.any?\n flash_warning(:runtime_suggest_multiple_alternates.t(match: id,\n type: type))\n else\n flash_warning(:runtime_object_multiple_matches.t(match: id,\n type: type))\n end\n redirect_to(add_query_param({ controller: obj.show_controller,\n action: obj.index_action },\n query))\n end\n end",
"def handle_ead_loc(ead_loc)\n df('856', '4', '2').with_sfs(\n ['z', \"Finding aid online:\"],\n ['u', ead_loc]\n ) if ead_loc\n end",
"def findAccession(name)\n if arr = @obo[name]\n arr\n else\n# @missedMappings << name\n# [\"\", \"\"]\n @non_obo_mappings << name\n [\"\", name]\n end\n end",
"def autocomplete_known_uri_search\n @known_uris = params[:term].blank? ? [] : search_known_uris_by_name_or_uri(params[:term])\n render_autocomplete_results\n end",
"def location=(_arg0); end",
"def find_guess_position(needle)\n get_index = lambda { |character, index| index if character == needle }\n indexes = @secret_word.split(\"\").map.with_index(&get_index).reject { |c| c.nil? }\n end",
"def lookup_index(set,index)\n @index_lookup_table ||= {}\n @index_lookup_table[set] ||= @set_indices[set].invert\n @index_lookup_table[set][index.to_i]\n\n # raise @index_lookup_table[set]\n end",
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Location)\n show_selected_locations(query, :link_all_sorts => true)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search_form')\n end\n end",
"def relaxed_locate?\n @relaxed_locate\n end",
"def alias_manager(covert_spy_name)\n\n spy_name = covert_spy_name.downcase.split(' ')\n reversed_spy_name = spy_name.reverse\n first_name = reversed_spy_name.first.to_s\n last_name = reversed_spy_name.last.to_s\n full_name = first_name + \" \" + last_name\n full_name_id = full_name.gsub(/[abcdefghijklmnopqrstuvwxyz]/, 'a' => 'e', 'b' => 'c', 'c' => 'd', 'd' => 'f', 'e' => 'i', 'f' => 'g', 'g' => 'h', 'h' => 'j', 'i' => 'o', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'n' => 'p', 'o' => 'u', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 't' => 'v', 'u' => 'a', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z', 'z' => 'b')\n full_name_idx = full_name_id.split.map {|x| x.capitalize}.join(' ')\nend",
"def primary_key_index_re\n /\\Asys_/i\n end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def from_search_document(document)\n place = Atlas::ReadOnly::Place.new\n place.readonly!\n\n place.id = document.delete('id')\n\n place.category = Atlas::Category.new :name => document.delete('category_name'), :slug => document.delete('category_slug')\n place.category.id = document.delete('category_id')\n place.category.readonly!\n \n place.slug = document.delete('slug') || ''\n place.latitude = document.delete('latitude')\n place.longitude = document.delete('longitude')\n place.created_at = Time.parse(document.delete('created_at')) if document['created_at']\n place.updated_at = Time.parse(document.delete('updated_at')) if document['updated_at']\n \n place.route = document.delete('route') if document['route']\n place.region = document.delete('region') if document['region']\n \n place.score = document['score']\n \n if document['contributor_id']\n document.delete('contributor_id').zip(document.delete('contributor')).each do |contrib_params|\n contributor = Atlas::Source.new(:name => contrib_params[1])\n contrib_params[0] =~ /([\\w\\-]+)([\\!\\+])(\\*)?/\n contributor.id = $1\n \n # TODO!!!\n # contributor.publicly_visible = ($2 == \"+\")\n # contributor.creator = ($3 == '*')\n \n contributor.readonly!\n place.contributors << contributor\n end\n end\n \n place.tags = document.delete('keyword').map do |keyword| \n t = Atlas::Tag.new(:name => keyword) \n t.readonly!\n t\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Tag)\n\n place.moods = document.delete('mood').map do |mood| \n m = Atlas::Mood.new(:name => mood) \n m.readonly!\n m\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Mood)\n \n place.features = document.delete('feature').map do |feature| \n f = Atlas::Feature.new(:name => feature) \n f.readonly!\n f\n end rescue Atlas::Util::ArrayAssociation.new(self, Atlas::Feature)\n\n place.average_rating = document.delete('average_rating')\n place.number_of_ratings = document.delete('number_of_ratings').to_i || 0\n \n # TODO!!!\n # place.photo = ...\n \n place_attributes = Atlas::Util::ArrayAssociation.new(self, Atlas::ReadOnly::PlaceAttribute, :place_id)\n document.each do |key, value|\n if key =~ /\\Aattr_(?:text|date|int|float)_(.*?)\\Z/\n name = $1\n pa = Atlas::ReadOnly::PlaceAttribute.new :place => place, :attribute_definition => name\n pa.values = value.map { |v| Atlas::PlaceValue.new :value => v }\n place_attributes << pa\n end\n end\n place.place_attributes = place_attributes\n \n place\n end",
"def findAllPepLocations\n hits = @doc.xpath(\"//#{@xmlns}search_hit\")\n all = []\n @locations = []\n i = 0\n \n # Parses out each peptide and protein\n hits.each do |hit|\n all << [hit.xpath(\"./@peptide\").to_s, proteinID(hit.xpath(\"./@protein\").to_s)]\n i += 1\n end\n \n all.uniq!\n dataHash = Hash.new\n \n Ms::Fasta.foreach(@database) do |entry|\n @sequences += 1\n pID = proteinID(entry.header)\n dataHash[pID] = entry.sequence\n @proteinIndices << pID\n end\n \n all.each do |set|\n if dataHash[set[1]] != nil\n startVal = dataHash[set[1]].scan_i(set[0])[0]\n \n if startVal != nil\n @locations << [set[0], set[1], startVal + 1, startVal + set[0].length]\n end\n end\n end\n end",
"def set_index_match_type(type)\n set_nested_global(\"indexed_search/word\", :index_match_types, [type])\nend",
"def add_to_location # :norobots:\n if location = find_or_goto_index(Location, params[:location])\n where = params[:where].strip_squeeze rescue ''\n if not where.blank? and\n update_observations_by_where(location, where)\n flash_notice(:runtime_location_merge_success.t(:this => where,\n :that => location.display_name))\n end\n redirect_to(:action => 'list_locations')\n end\n end",
"def get_locations(lines, filename, params)\n positions = Hash.new\n missing_pos = Array.new\n first = true\n\t\n\tif(params[:has_positions])\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snpid]\n\t\t\tif data[@location] =~ /\\d/\n\t\t\t\tpositions[snpid] = Hash.new\n\t\t\t\tpositions[snpid]['chr'] = data[@chromnum]\n\t\t\t\tpositions[snpid]['chr'] =~ /(\\d+)/ or positions[snpid]['chr'] =~ /(\\w+)/\n\t\t\t\tpositions[snpid]['chr'] = $1\n\t\t\t\tpositions[snpid]['pos'] = data[@location]\n\t\t\telsif data[@snpid] =~ /\\w/\n\t\t\t\t# missing so will try to get information from database\n\t\t\t\tmissing_pos << snpid\n\t\t\tend\n\t\tend\n\n\t\t# if any missing try database for location if have mysql support\n\t\tif @@mysql_support and !missing_pos.empty?\n\t\t\tfinder = SNPpos.new\n\t\t\tsnpsinfo = finder.get_pos(missing_pos)\n\t\t\tstill_missing = Array.new\n\t\t\tmissing_pos.each do |rsid|\n\t\t\t\tif snpsinfo.has_key?(rsid) and snpsinfo[rsid]['chr'] != nil\n\t\t\t\t\tpositions[rsid] = snpsinfo[rsid]\n\t\t\t\telse\n\t\t\t\t\tstill_missing << rsid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmissing_pos = still_missing\n\t\tend\n\n\t\tif !missing_pos.empty?\n\t\t\twrite_missing_log(filename, missing_pos)\n\t\tend\n\telse\n\t\t# set arbitrary positions in order of input\n\t\tpos=1\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snp1] + '_' + data[@snp2]\n\t\t\tnext if positions.has_key?(snpid)\n\t\t\tpositions[snpid] = Hash.new\n\t\t\tpositions[snpid]['chr'] = 1\n\t\t\tpositions[snpid]['pos'] = pos\n\t\t\tpos += 1\n\t\tend\n\tend\n\n return positions\nend",
"def index_ontology_terms( ontology_term_conf, doc, data_row_obj, map_data )\n ontology_term_conf.each do |term_conf|\n attribute = term_conf[\"attr\"]\n value_to_index = extract_value_to_index( attribute, data_row_obj[attribute], map_data[:attribute_map], { attribute => data_row_obj[attribute] } )\n \n if value_to_index and !value_to_index.gsub(\" \",\"\").empty?\n cached_data = @ontology_cache[value_to_index]\n if cached_data != nil\n index_ontology_terms_from_cache( doc, term_conf, cached_data )\n else\n index_ontology_terms_from_fresh( doc, term_conf, value_to_index )\n end\n end\n end\n end",
"def create_search_index\n Tire.index Person.index_name do\n create(\n settings: {\n analysis: {\n filter: {\n name_ngrams: {\n 'side' => 'front',\n 'max_gram' => 10,\n 'min_gram' => 1,\n 'type' => 'edgeNGram'\n }\n },\n analyzer: {\n full_name: {\n 'filter' => %w(standard lowercase asciifolding),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n partial_name: {\n 'filter' => %w(standard lowercase asciifolding name_ngrams),\n 'type' => 'custom',\n 'tokenizer' => 'standard'\n },\n keyword: {\n 'filter' => %w(lowercase),\n 'tokenizer' => 'keyword'\n }\n }\n },\n store: {\n type: Rails.env.test? ? :memory : :niofs\n }\n },\n mappings: {\n person: {\n properties: {\n first_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n first_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n last_name: {\n fields: {\n partial: {\n search_analyzer: 'full_name',\n index_analyzer: 'partial_name',\n type: 'string'\n },\n last_name: {\n type: 'string',\n analyzer: 'full_name'\n }\n },\n type: 'multi_field'\n },\n initials: {\n type: 'string',\n analyzer: 'simple'\n },\n profession: {\n type: 'string',\n analyzer: 'keyword'\n },\n email: {\n type: 'string',\n analyzer: 'simple'\n },\n login: {\n type: 'string',\n analyzer: 'simple'\n },\n year_entrance: {\n type: 'date',\n format: 'YYYY'\n },\n year_out: {\n type: 'date',\n format: 'YYYY'\n }\n }\n }\n }\n )\n end\n end",
"def search\n\n \tparser = AddressParser.new\n \taddress_hash = {}\n \t\n \tunless params[:location].nil?\n\t \tif is_number?(params[:location]) then \n\t \t\t# zip code\n\t\t \taddress_hash = parser.zip.parse(params[:location])\n\t\telsif params[:location].length == 2 then\n\t\t\t# state only\n\t\t\tparams[:location] = params[:location].strip.upcase\n\t\t\taddress_hash = parser.state.parse(params[:location])\n\t\telse\n\t\t\t# city, state, zip\n\t\t\tbegin address_hash = parser.csz.parse(params[:location])\n\t\t\t\trescue\n\t\t\t\t# city\n\t\t\t \taddress_hash = parser.city1.parse(params[:location]) unless params[:location].nil?\n\t\t\tend \n\t\tend\n\tend\n\t\n\t# new hash for search keys\n\tskeys = {}\n\t\n\tif address_hash[:city] then \n\t\tskeys[\"CIT\"] = /#{address_hash[:city]}/i\n\t\tparams['city'] = address_hash[:city]\n\tend\n\tif address_hash[:city1] then \n\t\tskeys[\"CIT\"] = /#{address_hash[:city1]}/i\n\t\tparams['city'] = address_hash[:city]\n\tend\n \tif address_hash[:state] then \n \t\tskeys[\"STATE\"] = \"#{address_hash[:state]}\" \n \t\tparams['state'] = address_hash[:state]\n \tend\n \tif address_hash[:zip] then \n \t\tskeys[\"ZP\"] = address_hash[:zip].to_s \n \t\t#params['zip'] = CGI::escape(address_hash[:zip])\n \t\tparams['zip'] = address_hash[:zip]\n \tend\n \t\n \tif(params.has_key?('bathrooms') ) then\n \t\tskeys[\"BTH\"] = \"#{params[:bathrooms].to_f}\"\n \tend\n \t\n \tif(params.has_key?('bedrooms') ) then\n \t\tskeys[\"BR\"] = params[:bedrooms].to_i\n \tend\n\n \tif(params.has_key?('minyear') ) then\n \t\tskeys[\"BLT-MIN\"] = params[:minyear].to_i\n \tend\n \t\n \tif(params.has_key?('maxyear') ) then\n \t\tskeys[\"BLT-MAX\"] = params[:minyear].to_i\n \tend\n \t\n \tif(params.has_key?('price_low') ) then\n \t\tskeys[\"LP-MIN\"] = params[:price_low].to_i\n \tend\n \t\n \tif(params.has_key?('price_high') ) then\n \t\tskeys[\"LP-MAX\"] = params[:price_high].to_i\n \tend\n \t\n \tif(params.has_key?('zipcode') ) then\n \t\tskeys[\"ZP\"] = params[:zipcode]\n \tend\n\t\n\tquery = {}\n\n\tskeys.each do |key, value|\n\t\tcase key\n\t\t\t when 'BTH'\n\t\t\t query.merge!({ key.to_sym.gte => value.to_f })\n\t\t\t when 'BR'\n\t\t\t query.merge!({ key.to_sym.gte => value.to_i })\n\t\t\t when 'BLT-MIN'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'BLT'.to_sym.gte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'BLT-MAX'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'BLT'.to_sym.lte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'LP-MIN'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'LP'.to_sym.gte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'LP-MAX'\n\t\t\t \tif value.to_i > 0 then\n\t\t\t \t\tquery.merge!({ 'LP'.to_sym.lte => value.to_i })\n\t\t\t \tend\n\t\t\t when 'ZP'\n\t\t\t \tif value != \"\" then\n\t\t\t \t\tquery.merge!({ 'ZP'.to_sym => value })\n\t\t\t \tend\n\t\t\t when 'CIT', 'STATE', 'ZP'\n\t\t\t query.merge!({ key.to_sym => value })\n\t\t end\n\tend\n\t\t\n \t@listings = Listing.where( query ).paginate({\n\t\t :sort => :LP.desc,\n\t\t :per_page => 10, \n\t\t :page => params[:page],\n\t\t})\n \t\n \trender :template => 'find/search', :collection => @listings\n \t \t\n end",
"def index\n store_location()\n @search = Search.new\n @search.update_columns(keys: params[:keys])\n \n if params[:keys].present?\n \n end\n \n redirect_back_or(admin_search_url)\n end",
"def get_by_index(longitude_index,latitude_index,doy)\n if @layers[doy]\n val = @layers[doy].get(longitude_index,latitude_index)\n val == mD.badVal ? nil : val\n else\n nil\n end\n end",
"def test_get_location_index_positive\n finder = MapLocationFinder.new\n assert_nil finder.get_location_index(1)\n end",
"def search_index\n part_of_index = params[:term]\n indexes = []\n \n if part_of_index\n indexes = PostIndex.where('\"index\" like ?', part_of_index + '%').select('\"index\", region, city').collect { |pi| {:value => pi.index, :label => pi.index + '-' + pi.city! } }\n end\n\n respond_to do |format|\n format.html { render :text => indexes.to_json }\n end\n end",
"def advanced_search\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Location)\n show_selected_locations(query, link_all_sorts: true)\n rescue StandardError => e\n flash_error(e.to_s) if e.present?\n redirect_to(search_advanced_path)\n end",
"def create_index( dictionary )\n\n\t# test the existence of the index, and exit\n\tFile.stat( dictionary.index )\n\n\t# unless there is an error, so\n\trescue\n\n\t# 1 - it creates the index\n\tFile.open( dictionary.index, \"a\" ) do |index_file|\n\t\t# 2 - it opens the dictionary\n\t\tFile.open( dictionary ) do |dictionary_file|\n\t\t\t# 3 - for each word of the dictionary\n\t\t\tdictionary_file.readlines.each do |dictionary_line|\n\t\t\t\t# 4 - puts in the index the canonical form\n\t\t\t\tindex_file.puts dictionary_line.chomp.canonical\n\t\t\tend\n\t\tend\n\tend\nend",
"def search(term, opts = {})\n raise \"Index not found at path #{@index_path}\" unless File.exists? @index_path\n\n results = []\n\n query = make_query(term, opts[:exact])\n\n @index.execute(\"SELECT sequence_number, kanji, kana, senses, bm25(search) as score FROM search WHERE search MATCH ? LIMIT ?\", query, opts[:max_results]) do |row|\n entry = Entry.from_sql(row)\n score = 0.0\n\n is_exact_match = entry.kanji.include?(term) || entry.kana.include?(term)\n score = 1.0 if is_exact_match\n\n should_add = !opts[:exact] || (opts[:exact] && is_exact_match)\n\n # add the result\n results << [score, entry] if should_add\n end\n\n # Sort the results by first column (score) and return only the second column (entry)\n results.sort_by { |entry| -entry[0] }.map { |entry| entry[1] }\n end",
"def index_keywords!\n all.each { |d| d.index_keywords! ? MongoidSearch::Log.green(\".\") : MongoidSearch::Log.red(\"F\") }\n end",
"def loc; end",
"def loc; end",
"def loc; end",
"def test_get_location_index_valid\n finder = MapLocationFinder.new\n assert_equal 4, finder.get_location_index(\"Matzburg\")\n end",
"def art_directors_hash\n search_by_text_hash 'художник'\n end"
] | [
"0.56463295",
"0.5576413",
"0.54254687",
"0.5375601",
"0.5365921",
"0.5365921",
"0.53657",
"0.5359279",
"0.5321872",
"0.53075194",
"0.52972305",
"0.528984",
"0.5272637",
"0.5252646",
"0.5252646",
"0.5233713",
"0.5232985",
"0.5209967",
"0.5141896",
"0.5122398",
"0.51071024",
"0.5095165",
"0.50931495",
"0.50912434",
"0.50766224",
"0.5059769",
"0.50532687",
"0.5049166",
"0.5046078",
"0.5041812",
"0.50357306",
"0.5033472",
"0.5029236",
"0.50236773",
"0.50143015",
"0.5011326",
"0.5003252",
"0.4996317",
"0.49913982",
"0.49704403",
"0.49677277",
"0.49617222",
"0.49468443",
"0.4944512",
"0.4929508",
"0.49244308",
"0.489748",
"0.48936504",
"0.48936504",
"0.48929578",
"0.4866445",
"0.48591277",
"0.4849599",
"0.48474008",
"0.48474008",
"0.48470977",
"0.4832431",
"0.48264688",
"0.4824841",
"0.48247093",
"0.4811557",
"0.48089024",
"0.48076123",
"0.4806945",
"0.4795695",
"0.47892216",
"0.47887754",
"0.4784758",
"0.47835827",
"0.47776607",
"0.47737485",
"0.4768462",
"0.47655645",
"0.4765365",
"0.47601926",
"0.47586367",
"0.47565404",
"0.47555518",
"0.47523886",
"0.4747459",
"0.47446787",
"0.47393912",
"0.4739321",
"0.4734062",
"0.47286224",
"0.47280973",
"0.47165227",
"0.47120965",
"0.47107914",
"0.4710714",
"0.47094446",
"0.47055003",
"0.47037247",
"0.4699701",
"0.46956757",
"0.46930316",
"0.46924943",
"0.46924943",
"0.46924943",
"0.46922946",
"0.46922106"
] | 0.0 | -1 |
parse String value into Date for date attribute | def date
date_parser(self[:date])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(value)\n ::Date.parse(value)\n end",
"def parse_date(date_str)\n new_date = Date.parse(date_str)\nend",
"def string_to_date(string)\n super(handle_date_parse_input(string))\n end",
"def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def d(date_string)\n Date.parse(date_string)\nend",
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def parse_date(date_str)\n split = date_str.split('-')\n Date.new(split[0].to_i, split[1].to_i, split[2].to_i)\nend",
"def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end",
"def parse_date(date)\n Icalendar::Values::DateOrDateTime.new(date)\n end",
"def match_date( val )\n\t\treturn Date.parse( val ) rescue nil\n\tend",
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def handle_date_parse_input(string)\n string\n end",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def _date_parse(string)\n super(handle_date_parse_input(string))\n end",
"def to_date(string)\n Date.parse(string)\n rescue\n nil\n end",
"def parse_date(date_string)\n selected_format = DATE_FORMATS.select{|date_format| date_string =~ date_format[:format]}[0]\n Date.strptime(date_string, selected_format[:type]) if selected_format\n end",
"def parse_date(date_string)\n match = date_string.match(/([0-9]{1,2})\\/([0-9]{1,2})\\/([0-9]{4})/)\n month = match[1].to_i\n day = match[2].to_i\n year = match[3].to_i\n Date.new(year, month, day)\nend",
"def parse_date(text)\n begin\n @current_match = Match.new( Date.parse(text.strip) )\n rescue ArgumentError\n parse_error \"Invalid date format: please use YYYY-MM-DD.\"\n end\n end",
"def extract_date(str)\n\t\tDate.strptime(str, '%m/%d/%Y')\n\tend",
"def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end",
"def parse(key, value, obj)\n key[/^date_*/] && value ? DateTime.strptime(value, DATETIME_FORMAT) : value\n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError # Help out to find what issue - user typing issues.eg date instead of sentence\n default\n end",
"def parse_date(str)\n return nil if str.nil? || str.empty?\n return \"#{str}-01-01\" if str =~ /^\\d{4}/\n format = str =~ /^\\d{2}\\./ ? '%d.%m.%Y' : '%m-%d-%Y'\n begin\n return Date.strptime(str, format).to_date\n rescue\n logger.warn \"Failed to parse date [#{str}] with [#{format}] format\"\n return nil\n end\n end",
"def date\n parse!\n @date\n end",
"def parse_date(date_string)\n result = sugarcube_detect(date_string).first\n if result\n return result.date\n else\n return iso8601(date_string)\n end\n end",
"def parse_date( day )\n day.is_a?(Date) ? day : Date.parse( day.to_s )\n end",
"def parse_date(date)\n date = DateTime.parse(date.to_s)\n rescue ArgumentError\n raise ArgumentError, \"#{date} is not a valid date\"\n end",
"def parse_date(date)\n parsed = @date_cache[date]\n if parsed\n parsed\n else\n if date =~ /^(\\d{4})(\\d{2})(\\d{2})$/\n parsed = Date.new($1.to_i, $2.to_i, $3.to_i)\n elsif date =~ /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/\n parsed = Date.new($3.to_i, $1.to_i, $2.to_i)\n else\n raise \"unknown format\"\n end\n if :month == date_type\n parsed = Date.new(parsed.year, parsed.month)\n end\n @date_cache[date] = parsed\n end\n end",
"def parse_date(date)\n date.to_date\n rescue\n Date.strptime(date, '%m/%d/%Y') rescue nil\n end",
"def date=(value)\n @date = value.is_a?(String) ? DateTime.parse(value) : value\n end",
"def parse_date(date)\n if date.is_a?(Date)\n date\n else\n date_str = date.to_s.match?(/\\d\\d\\d\\d-(1[012]|0[1-9])/) ? \"#{date}-01\" : date.to_s\n Date.parse(date_str)\n end\n end",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def parse_i18n_date(date_str)\n Date.strptime(date_str, I18n.t('date.formats.default'))\n end",
"def date(string)\n return if string.blank?\n return string if string.is_a?(Date)\n\n Date.parse(string)\n rescue Date::Error\n components = string\n .split(\"-\")\n .map(&:to_i)\n .reject(&:zero?)\n .compact\n\n return if components.empty?\n\n Date.new(*components)\n rescue ArgumentError\n nil\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end",
"def parse_date(date)\n month, day, year = date.split(\"/\")\n\n DateTime.new year.to_i, month.to_i, day.to_i\n end",
"def handle_date(attrs, key, warnings)\n if attrs.has_key?(key) && attrs[key].present?\n begin\n # check if it's US looking date\n if attrs[key].respond_to?(:match) && attrs[key].match(/\\d{1,2}\\/\\d{1,2}\\/\\d{4}/)\n attrs[key] = Date.strptime(attrs[key], '%m/%d/%Y').to_s # converts to YYYY-MM-DD\n end\n\n # try to parse it as Rails will\n Date.parse(attrs[key])\n rescue => e\n warnings[key.to_sym] ||= []\n warnings[key.to_sym] << \"#{e}, use YYYY-MM-DD or MM/DD/YYYY format\"\n end\n end\n end",
"def date\n Date.parse(@data['date'])\n end",
"def date_value\n Time.parse(value) if value.present?\n end",
"def to_date(value)\n if value.nil? or value.strip.empty?\n nil\n else\n Date.strptime(value, date_format)\n end\n end",
"def parse_date\n REGEX_DATE.match(@request[FTIME]) ? Date.parse($1) : nil\n end",
"def date\n Date.parse(@obj['date'])\n end",
"def date_parse(date)\n date if date && Date.strptime(date, '%Y-%m-%d').to_s == date\n rescue => _ # for rubocop :)\n nil\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse(str)\n match_data = str.match(DATE_REGEXP)\n # Oh my god, I hate this shit. Basically it prepares dates for \n # Time.parse consuming because it's so stupid and ignorant it wants\n # to make me puke :(\n from = extract_time_string_from_match_data(match_data)\n to = extract_time_string_from_match_data(match_data, 12)\n\n begin\n from = Time.parse(from) unless from.nil?\n rescue ArgumentError\n from = nil\n end\n\n begin\n if to.nil? and not from.nil?\n case extract_context_from_match_data(match_data)\n when :year\n to = from.end_of_year\n when :month\n to = from.end_of_month\n when :day\n to = from.end_of_day\n when :hour\n to = from + (59 - from.min).minutes + (59 - from.sec)\n when :minute\n to = from + (59 - from.sec)\n end \n else\n to = Time.parse(to)\n end\n rescue ArgumentError\n to = nil\n end\n\n [from, to]\n end",
"def parse_iso_8601_date(string)\n if string =~ ISO_8601_DATE\n Date.parse(string) rescue nil\n end\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def convert_to_date(string)\n return nil if string.blank?\n Chronic.parse(string).to_date\n end",
"def date_parse(value)\n translate(value)&.to_date&.strftime\n rescue\n nil\n end",
"def convert_to_date(string)\n return nil if (string.nil? || string.class != String)\n tmp = Chronic.parse(string)\n tmp ? tmp.to_date : nil\n end",
"def make_date(_input, _starts_at, _ends_at, elements)\n value = elements.first\n\n case value\n when String\n _date_from_string(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def parse_datetime_string\r\n dt = String.new\r\n self.date_of_birth.split('/').each{|x| dt = dt + (x.to_i < 10 ? '0'+ x + '/' : x + \"/\")}\r\n self.date_of_birth = DateTime.strptime(dt, \"%m/%d/%Y/\")\r\n self\r\n end",
"def extract_date(value)\n return value if value.respond_to?(:to_date)\n\n @formats.each do |format|\n if (date = Date.strptime(value, format))\n return date\n end\n end\n\n nil\n rescue => e\n raise DataWrangler::Configuration::Error, e.message\n end",
"def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end",
"def parse_date\n # must access headers via @headers. Using h() would case a stack overflow\n # because parsing isn't yet complete, the page is still 'fresh'.\n if @headers[:date] \n @date = Chronic.parse(@headers[:date])\n elsif @title =~ /:/ && @date.nil?\n plausible_date = @title.split(':').first\n @date = Chronic.parse(plausible_date)\n unless @date\n date_regexp = /\\s*(\\d\\d?)-([a-zA-Z]{3})\\s*/\n match = date_regexp.match(plausible_date)\n @date = Chronic.parse(\"#{match[2]} #{match[1]}\") if match\n end\n if @date\n @title.sub!(/^[^:]*:/, '')\n end\n end\n end",
"def make_date(input, start, _end, elements)\n value = elements.first\n\n case value\n when String\n DateTime.parse(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def to_date( value )\n effectively_empty( value ) ? nil : Date.parse( value.to_s )\n end",
"def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end",
"def convert_day_to_date string\r\n Date.strptime(string.to_s,\"%Y%m%d\")\r\n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def parsed_start_date\n Date.parse(start_date)\n end",
"def parse_date(date_string)\n datetime = Time.zone.parse(date_string) if date_string.present?\n return datetime.to_date unless datetime.nil?\n nil\n end",
"def parse_date(date_string)\n datetime = Time.zone.parse(date_string) if date_string.present?\n return datetime.to_date unless datetime.nil?\n nil\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def price_date=(date_string)\n if !date_string.blank? && date_string.split(\"/\")[2].length == 2\n date = Date.strptime(date_string, \"%m/%d/%y\") rescue nil\n else\n date = Date.strptime(date_string, \"%m/%d/%Y\") rescue nil\n end\n write_attribute(:price_date, date)\n end",
"def parse(date)\n value = date.strftime(VALUE_DATE_FORMAT)\n {\n name: date.strftime(DISPLAY_DATE_FORMAT),\n value: value,\n today: date.today?\n }\n end",
"def parse_date date\n\t\tunless date =~ /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})Z/\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\tyear = $1\n\t\tmonth = $2\n\t\tday = $3\n\t\thour = $4\n\t\tmin = $5\n\t\tsec = $6\n\n\t\treturn Time.mktime(year, month, day, hour, min, sec)\n\tend",
"def parse_date(date, fmt = nil)\n return nil if(date.blank?)\n return DateTime.strptime(date, fmt) if(fmt) # format given\n return DateTime.new(date.to_i) if(date.size < 5) # this short should be a year\n DateTime.parse(date)\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def flexible_value_to_date(value, options = {})\n allow_string = options[:allow_string]\n string_condition = allow_string.kind_of?(Regexp) ? allow_string : String\n case value\n when Hash\n if value[:year].blank? || value[:month].blank? || value[:day].blank?\n nil\n else\n begin\n Date.new(value[:year].to_i,value[:month].to_i, value[:day].to_i)\n rescue\n nil\n end\n end\n else\n if allow_string\n case value\n when string_condition\n begin\n Date.parse(value)\n rescue\n nil\n end\n end\n else\n nil\n end\n end\n end",
"def vali_date(str)\n # Define month and day variables\n month, day = str.split('/').map(&:to_i)\n\n # Case month variable and return month and day if they are valid\n case month\n when 2 # February (28 days)\n return month, day if (1..28).include? day\n when 4, 6, 9, 11 # April, June, September, November (30 days)\n return month, day if (1..30).include? day\n when 1, 3, 5, 7, 8, 10, 12 # January, March, May, July, August, October, December (31 days)\n return month, day if (1..31).include? day\n end\n\n # Return nil otherwise\n nil\n end",
"def parse_date(datestring)\n days = 0\n if datestring =~ /^\\+(\\d+)$/\n days = (60 * 60 * 24 * $1.to_i)\n newdate = Time.now + days\n else\n newdate = Chronic.parse(datestring, {context: :future, ambiguous_time_range: 8})\n end\n # parsed = newdate.strftime('%D %l:%M%p').gsub(/\\s+/,' ');\n # return parsed =~ /1969/ ? false : parsed\n return newdate\n end",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def parse_date(date)\n case date\n when /\\A\\s*(\\d+)-(\\d+)-(\\d+)(?:[ T](\\d+):(\\d+):(\\d+) *([-+]\\d\\d):?(\\d\\d))?\\b/\n Time.new($1, $2, $3, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3}, +(\\d+) (\\w{3}) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $2, $1, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $1, $2, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+):(\\d+):(\\d+) (\\d+)\\b/\n Time.new($6, $1, $2, $3, $4, $5)\n else\n raise ArgumentError, \"bad date: #{date}\"\n end\n end",
"def date=(date_value)\n @date = date_value.class <= Date ? date_value : Date.parse(date_value)\n end",
"def parse_date(content)\n return content.lstrip.rstrip\n end",
"def get_datetime(str)\n return nil if str == \"\"\n return DateTime.strptime(str, \"%d-%m-%Y\")\n end",
"def date_parsed\n if created_at?\n Date.parse(valid_params[\"created_at\"])\n elsif updated_at?\n Date.parse(valid_params[\"updated_at\"])\n end\n end",
"def parse_date date, options = {}\n date = Time.parse(date)\n date = date.beginning_of_day if options[:beginning_of_day]\n date = date.end_of_day if options[:end_of_day]\n date\n end",
"def parse_date_field(*keys, params:)\n value = params.dig(*keys)\n\n return nil unless value\n\n begin\n Time.zone.parse(value)\n rescue ArgumentError\n raise InvalidFormatError.new(keys.join('/'))\n end\n end",
"def typecast_to_date(value)\n if value.kind_of?(Hash)\n typecast_hash_to_date(value)\n else\n Date.parse(value.to_s)\n end\n end",
"def extract_date(value)\n\t\t\treturn nil if value.nil?\n\n\t\t\tif value.is_a?(String)\n\t\t\t\treturn value\n\t\t\telsif value.respond_to?(:strftime)\n\t\t\t\treturn value.strftime(\"%m/%Y\")\n\t\t\tend\n\t\tend",
"def entity_date(str)\n Time.at(str[/\\d{6,}/].to_i / 1000)\n end",
"def to_date\n ::Date.parse(self, false) unless blank?\n end",
"def to_date(date)\n return date if date.is_a?(Date)\n Date.parse(date)\n end",
"def parse_and_validate_date_if_necessary(value, type)\n # note: cannot use 'case type' as that expands to === which checks for instances of rather than type equality\n if type == Date\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}$/)\n Date.strptime(value, \"%Y-%m-%d\")\n elsif type == DateTime\n expect(value).to match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/)\n DateTime.strptime(value, \"%Y-%m-%dT%H:%M:%SZ\")\n else\n value\n end\n end",
"def typecast_to_date(value)\n if value.is_a?(Hash)\n typecast_hash_to_date(value)\n elsif value.is_a?(Time) # sometimes people think date is time!\n value.to_date\n elsif value.to_s =~ /ˆ(\\d{4})[\\-|\\/](\\d{2})[\\-|\\/](\\d{2})$/\n # Faster than parsing the date\n Date.new($1.to_i, $2.to_i, $3.to_i)\n else\n Date.parse(value)\n end\n rescue ArgumentError\n nil\n end",
"def parse_datetime(str)\n parts = str.scan(/.{2}/)\n year = Time.now.year.to_s[0..1] + parts[0]\n month = parts[1]\n day = parts[2]\n hour = parts[3]\n minute = parts[3]\n \"#{year}-#{month}-#{day} #{hour}:#{minute}\"\n end",
"def parse_date_param(date_param)\n date_param.blank? ? nil : Date.parse(date_param)\n end",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def parse_date(row)\n raw_date = row[0]\n if raw_date\n Date.strptime(raw_date, '%m/%d/%y')\n else\n nil\n end\nend",
"def coerce_date(value, options = {})\n value = coerce(value, String)\n begin\n Date.strptime(value, \"%Y-%m-%d\")\n rescue ArgumentError\n nil\n end\n end",
"def date=(date)\n @date = case date\n when String\n Date.parse(date)\n else\n date\n end\n end"
] | [
"0.77893156",
"0.7623741",
"0.7572967",
"0.7562203",
"0.7455002",
"0.74343103",
"0.7428058",
"0.73742354",
"0.7292935",
"0.7254805",
"0.7242775",
"0.72346556",
"0.71632606",
"0.7144458",
"0.71287286",
"0.7120739",
"0.7109873",
"0.70848984",
"0.7063075",
"0.7061004",
"0.705968",
"0.7053212",
"0.704369",
"0.70371073",
"0.7009419",
"0.70081466",
"0.6982768",
"0.696598",
"0.69651335",
"0.69349563",
"0.69292784",
"0.692263",
"0.689896",
"0.68941635",
"0.6860165",
"0.68413717",
"0.68413717",
"0.684089",
"0.68332934",
"0.68326014",
"0.6821823",
"0.6818167",
"0.6803509",
"0.6798904",
"0.6789818",
"0.678967",
"0.678967",
"0.67694193",
"0.6752081",
"0.67489046",
"0.67489046",
"0.6732279",
"0.6718005",
"0.6658689",
"0.66497934",
"0.66490465",
"0.6631369",
"0.6593719",
"0.6588052",
"0.65824896",
"0.65757895",
"0.6572766",
"0.65722084",
"0.6570457",
"0.6540575",
"0.65381587",
"0.65163636",
"0.64926064",
"0.64772666",
"0.6458913",
"0.6453695",
"0.6448692",
"0.6444805",
"0.6427274",
"0.6422186",
"0.64148545",
"0.64035743",
"0.6391722",
"0.6382177",
"0.637652",
"0.6369304",
"0.6361355",
"0.6357755",
"0.63564354",
"0.6353408",
"0.63430136",
"0.6310488",
"0.63026494",
"0.6287421",
"0.6277891",
"0.6275268",
"0.62752306",
"0.6269828",
"0.62489873",
"0.6219983",
"0.6218272",
"0.62114537",
"0.62056243",
"0.62006867"
] | 0.6887317 | 35 |
an alias for goal attribute | def goal_points
self[:goal]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute(name); end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def achieve(goal)\n @goal = goal\n self\n end",
"def aref_prefix\n 'attribute'\n end",
"def attr(name); end",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end",
"def attr; end",
"def aliased_name; end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def alias_attribute(new_name, old_name)\n module_eval <<-STR, __FILE__, __LINE__+1\n def #{new_name}; self.#{old_name}; end # def subject; self.title; end\n def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end\n def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end\n STR\n end",
"def arel_attribute\n target && target.arel_table[column, arel_table]\n end",
"def alias_attribute(new_name, old_name)\n module_eval <<-STR, __FILE__, __LINE__ + 1\n def #{new_name}; self.#{old_name}; end # def subject; self.title; end\n def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end\n def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end\n STR\n end",
"def goal(desc)\n\t\t\t@sprint.goal = desc.to_s.strip\n\t\tend",
"def the_goal\n UserGroup::PAYMENT_GOALS[goal.to_sym] if goal\n end",
"def label_target\n :\"#{attribute_name}_gteq\"\n end",
"def alias_of; end",
"def goal\n 28\n end",
"def target_def; target.name; end",
"def set_goal\n @goal = Goal.friendly.find(params[:id])\n end",
"def attribute(name, *args, **opt)\n add_single_property(name, *args, **opt)\n end",
"def attribute(turn_on, turn_off)\n RDoc::Markup::AttrChanger.new turn_on, turn_off\n end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute(*args, **opt)\n add_single_property(*args, **opt)\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def target_alias\n decode_string_member(:target_alias)\n end",
"def attr_alias(name)\n name = name.intern\n if synonym = self.class.attr_alias(name)\n return synonym\n else\n return name\n end\n end",
"def attribute_alias(name)\n attribute_aliases[name.to_s]\n end",
"def attribute attr\n @ref.attribute(TRANSLATOR.cocoaify(attr)).to_ruby\n end",
"def goal(calling_goal = nil)\n Goal.new(self, calling_goal)\n end",
"def attribute_alias?(new_name)\n attribute_aliases.key? new_name.to_s\n end",
"def set_goal\n @goal ||= Goal.find(params[:id])\n end",
"def alias_attribute(new_name, old_name)\n self.attribute_aliases = attribute_aliases.merge(new_name.to_s => old_name.to_s)\n CodeGenerator.batch(self, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n matcher_new = matcher.method_name(new_name).to_s\n matcher_old = matcher.method_name(old_name).to_s\n define_proxy_call false, owner, matcher_new, matcher_old\n end\n end\n end",
"def is_alias?; end",
"def alias_param(attr, alias_name, original_name)\n def_delegator attr, original_name, alias_name\n def_delegator attr, :\"#{original_name}=\", :\"#{alias_name}=\"\n def_delegator attr, :\"#{original_name}?\", :\"#{alias_name}?\" # FIXME: Only alias this for Booleans\n end",
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def goalNode?(node)\n node.name == 'Goal'\nend",
"def print_attribute(*) end",
"def targeting\n @things.targeting\n end",
"def target\n relation\n end",
"def target\n relation\n end",
"def target; end",
"def target; end",
"def attribute\n if to.is_a?(Symbol)\n to\n else\n name\n end\n end",
"def inspect\n ::Ice::__stringify(self, T_GoalEvaluator)\n end",
"def target\n location ||\n name ||\n observation ||\n project ||\n species_list ||\n glossary_term ||\n article\n end",
"def a(name)\n self.attributes[name]\n end",
"def set_goal(x)\n @layout[@goal[0]][@goal[1]] = '•'\n @layout[x[0]][x[1]] = 'G'\n @goal = x\n end",
"def add_goals\n end",
"def dom_attribute(name); end",
"def target\n self['target']\n end",
"def potion; end",
"def name_alias(arg=nil)\n\t\t\t\tset_or_return(:name_alias, arg, :kind_of => String)\n\t\t\tend",
"def override_attr(attr, own_attr_val)\n return own_attr_val if own_attr_val\n award.send(attr) if award\n end",
"def attribute(name, namespace = T.unsafe(nil)); end",
"def target=(target)\n @target = target\n @ori_target = target\n end",
"def adventuring() skill(:adventuring) end",
"def aon; end",
"def aliases=(_arg0); end",
"def aliases=(_arg0); end",
"def aref\n type = singleton ? 'c' : 'i'\n \"#alias-#{type}-#{html_name}\"\n end",
"def alias_attribute(alias_name, fully_qualified_name)\n self.class_eval <<-EOF\n def #{alias_name}\n read_attribute(\"#{fully_qualified_name}\")\n end\n def #{alias_name}=(value)\n write_attribute(\"#{fully_qualified_name}\", value)\n end\n EOF\n end",
"def attr_writer(sym, *more) end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def to_alias\n \"-#{@alias}\"\n end",
"def attr(symbol, writable=false) end",
"def define_attribute(name, reference = false)\n self.class_eval(\"def #{name};@#{name};end\")\n if reference\n self.class_eval(\"def #{name}=(val);@#{name}=Lobbyist::V2::#{name.camelize}.new(val);end\")\n else\n self.class_eval(\"def #{name}=(val);@#{name}=val;end\")\n end\n end",
"def attribute?\n @attribution\n end",
"def attribute(name, domain, options = {})\n raise \"Invalid attribute definition #{name}\" unless Symbol===name and Class===domain\n @relvar.add_attribute(name, domain, options)\n end",
"def [](attribute)\n @aliases.fetch(attribute, attribute)\n end",
"def set_goal\n @goal = Goal.find(params[:id])\n end",
"def attribute_for live_property\n live_property = live_property.to_sym\n attribute =\n case live_property\n when :id\n :live_id # avoid conflicts with Ruby's Object#id()\n else\n live_property\n end\n return attribute, \"@#{attribute}\"\n end",
"def target_name\n return alias_name || expression || aggregation_type.to_s\n end",
"def name\n target['name']\n end",
"def rel; end",
"def set_goal\n @goal = ::Goal.in_account(current_user.account.id).find(params[:id])\n end",
"def attribute(name = T.unsafe(nil)); end",
"def attribute(name)\n state << name\n state\n end",
"def arg; end",
"def trail\n attribute_get(:linkname)\n end",
"def hint(attribute_name, options = T.unsafe(nil)); end",
"def target; true; end",
"def attributes=(_arg0); end"
] | [
"0.6258468",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6228538",
"0.6164495",
"0.59150785",
"0.5899401",
"0.5828215",
"0.5828215",
"0.5797423",
"0.5790445",
"0.5783975",
"0.5783975",
"0.5783975",
"0.57605445",
"0.5693495",
"0.56294894",
"0.56182706",
"0.5583627",
"0.5560508",
"0.5541151",
"0.55258745",
"0.55225915",
"0.5518173",
"0.5508107",
"0.5501695",
"0.54642564",
"0.54642564",
"0.54642564",
"0.54642564",
"0.54642564",
"0.54642564",
"0.54642564",
"0.5462294",
"0.54462385",
"0.54462385",
"0.54372257",
"0.5427888",
"0.54243606",
"0.5411738",
"0.5376713",
"0.5349894",
"0.5347459",
"0.53388053",
"0.5319238",
"0.5304075",
"0.53037363",
"0.53037363",
"0.53037363",
"0.5300203",
"0.5225446",
"0.52226293",
"0.52175415",
"0.52175415",
"0.5201397",
"0.5201397",
"0.52006847",
"0.5199511",
"0.5195059",
"0.5183054",
"0.5167181",
"0.5161064",
"0.51567125",
"0.5156192",
"0.5155573",
"0.51550627",
"0.51519156",
"0.5148802",
"0.51275843",
"0.5124738",
"0.5121427",
"0.51060575",
"0.51060575",
"0.5097192",
"0.5094096",
"0.5082241",
"0.5072585",
"0.5071942",
"0.50691354",
"0.5063545",
"0.5060161",
"0.50596404",
"0.5048927",
"0.50466156",
"0.50313073",
"0.5030619",
"0.50191",
"0.50119674",
"0.50117683",
"0.5008442",
"0.5007601",
"0.50067645",
"0.5006664",
"0.5006467",
"0.50059265",
"0.50019026"
] | 0.5547266 | 24 |
TODO: Figure out how to test document= | def notest_should_remove_blank_char_from_filename
document_field = CGI.new( :multipart => true )
puts document_field.inspect
document = Document.new(document_field)
puts document.inspect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document=(_arg0); end",
"def document?; end",
"def document?; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def initialize(document)\n @document = document\n end",
"def request_doc\n \n end",
"def documents; end",
"def documents; end",
"def get_doc \n @doc\n end",
"def document\r\n Document.new(\"#{DOCUMENT_VAR}\")\r\n end",
"def document=(name)\n @document = name\n end",
"def document\n capture_parameters\n capture_return_type\n super\n end",
"def initialize(document)\n @document = document\n end",
"def initialize(document)\n @document = document\n end",
"def current_document=(_arg0); end",
"def document\n self\n end",
"def document\n self\n end",
"def initialize(document)\n @document=document\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\r\n @document = Document.find(params[:id])\r\n end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc=(doc)\n @doc = doc\n end",
"def set_document\n @document = Document.find(params[:document_id])\n end",
"def set_document\r\n @document = Document.find(params[:id])\r\n end",
"def docs=(_arg0); end",
"def assign_current_document!; end",
"def document\n params[:document]\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def document\n capture_args\n capture_return\n super\n end",
"def initialize(name, document); end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def set_document\n @document = Document.find(params[:id])\n end",
"def document(path); end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def docs_to_write; end",
"def document?\n self.type == \"Document\"\n end",
"def document_params\n params.require(:document).permit(:title, :doc)\n end",
"def process!(document); end"
] | [
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.79439324",
"0.7721279",
"0.7721279",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7673313",
"0.7104157",
"0.70406705",
"0.698879",
"0.698879",
"0.69325703",
"0.6894308",
"0.68761694",
"0.67893374",
"0.67771393",
"0.67747176",
"0.6754037",
"0.67311376",
"0.67311376",
"0.6722081",
"0.6686006",
"0.6686006",
"0.6686006",
"0.6686006",
"0.6685214",
"0.666008",
"0.666008",
"0.666008",
"0.666008",
"0.66498464",
"0.6648323",
"0.66464835",
"0.6640853",
"0.6624641",
"0.6619766",
"0.65965223",
"0.65887654",
"0.65887654",
"0.65880233",
"0.6585657",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6569587",
"0.6568429",
"0.65654707",
"0.65518993",
"0.6521853",
"0.6518752",
"0.64767766"
] | 0.0 | -1 |
TODO: Figure out why the commented out line causes an error | def test_document_max_length
new_document = Document.new( #:data => 'a' * (Document::MAX_FILE_SIZE - 1),
:data => 'a' * 100,
:unpacked => 0,
:name => 'dummy.doc',
:content_type => 'text/html',
:created_by => @cathy.id)
documents = Document.find(:all)
design_review_documents = DesignReviewDocument.find(:all)
new_document.attach(@mx234a_placement,
document_types(:stackup),
@cathy)
updated_documents = Document.find(:all)
updated_design_review_documents = DesignReviewDocument.find(:all)
new_document_list = updated_documents - documents
new_design_review_document_list = updated_design_review_documents - design_review_documents
assert_equal(1, new_document_list.size)
assert_equal(1, new_design_review_document_list.size)
new_doc = new_document_list[0]
new_design_review_document = new_design_review_document_list[0]
assert_equal(new_document.id, new_doc.id)
assert_equal(new_document.id, new_design_review_document.document_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def source_line=(_); end",
"def culprit\n @culprit\n end",
"def source_line; end",
"def missed_lines; end",
"def missed_lines; end",
"def probers; end",
"def fresh_line?; end",
"def last_magic_comment(source); end",
"def original_line; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def verify_comment(line) \n end",
"def irrelevant_line(source_line); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def ignore; end",
"def ignores; end",
"def code_point; end",
"def line_comments_option; end",
"def line_num; end",
"def code_point=(_); end",
"def missed?; end",
"def as_you_like_it_quote; end",
"def current_line_number; end",
"def bug\n end",
"def line_cache; end",
"def never_lines; end",
"def never_lines; end",
"def line=(_); end",
"def line=(_); end",
"def missing?; end",
"def single_line?; end",
"def comment?; end",
"def comment?; end",
"def comments_hash_flag=(_arg0); end",
"def comments_hash_flag=(_arg0); end",
"def lex_comment line\n # do nothing\n end",
"def big_bad; end",
"def missing; end",
"def extra; end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def lines_of_code; end",
"def lines_of_code; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def uses_legacy_comments?\n end",
"def default_allows_comments?; true; end",
"def line=(_arg0); end",
"def consume_comments; end",
"def wine_comment\n end",
"def buzzword; end",
"def buzzword; end",
"def continued_exception; end",
"def faint; end",
"def faint; end",
"def skipped; end",
"def skipped!; end",
"def sharp; accidental; end",
"def placebo?; false end",
"def exception_on_syntax_error; end",
"def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend",
"def pass; end",
"def pass; end",
"def semact?; false; end",
"def run_line_length_cop; end",
"def comment_line?(line_source); end",
"def comment_line?(line_source); end",
"def refutal()\n end",
"def throw_away_meaningless_line\n\t\tputs \"I have no idea what you are talking about\"\n\tend",
"def prev_line=(_arg0); end",
"def start_line_number; end",
"def start_line_number; end",
"def first_line; end"
] | [
"0.6695561",
"0.6261798",
"0.6253075",
"0.6199866",
"0.6187976",
"0.6187976",
"0.6119457",
"0.61019135",
"0.60794467",
"0.6020298",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.59909004",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.5990194",
"0.59881324",
"0.5969845",
"0.59312046",
"0.59312046",
"0.59312046",
"0.59312046",
"0.5851714",
"0.58332986",
"0.58091307",
"0.5800556",
"0.57968056",
"0.5773588",
"0.5771251",
"0.57697546",
"0.57654554",
"0.57115304",
"0.57088387",
"0.5703288",
"0.5703288",
"0.5700362",
"0.5700362",
"0.57000154",
"0.56985134",
"0.5695983",
"0.5695983",
"0.5692427",
"0.56907344",
"0.5682028",
"0.56815034",
"0.566739",
"0.5661835",
"0.565092",
"0.565092",
"0.565092",
"0.565092",
"0.565092",
"0.56477094",
"0.56477094",
"0.5645694",
"0.5645694",
"0.5645694",
"0.5643789",
"0.56345505",
"0.5628036",
"0.5622437",
"0.56202817",
"0.5607513",
"0.5607513",
"0.55974114",
"0.559195",
"0.559195",
"0.55895156",
"0.5584791",
"0.5563109",
"0.5544265",
"0.55432373",
"0.5540897",
"0.5528033",
"0.5528033",
"0.5527096",
"0.5524757",
"0.552175",
"0.552175",
"0.55067956",
"0.5506461",
"0.5502901",
"0.5499724",
"0.5499724",
"0.54992044"
] | 0.0 | -1 |
Add a stock rating to Database. | def stocks2_category(db,company,ticker,price,exchange,recomm)
db.execute("INSERT INTO stocks2 (company_name,
stock_ticker,
stock_price,
stock_exchange,
recommendation_id) VALUES (?,?,?,?,?)",[company,ticker,price,exchange,recomm])
puts "==========================================="
puts "#{ticker} has been added to the database."
puts "==========================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(rating)\n @rating_list[rating.movie_id] = rating\n end",
"def add(rating)\n @rating_list[rating.movie_id] = rating\n end",
"def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end",
"def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, recipe: recipe, star_rating: rating)\n end",
"def add_rating(value, user)\n current_rating = Rating.find_by(rateable: self, user: user)\n if current_rating\n current_rating.update(value: value)\n else\n ratings.create(value: value, user: user)\n end\n end",
"def update_rating_entry(db, rating, id)\n\tdb.execute(\"UPDATE books SET rating=? WHERE id=?\", [rating, id])\nend",
"def update_rating (db,stock_ticker,rating)\r\n db.execute(<<-SQL\r\n UPDATE stocks2 \r\n SET recommendation_id=\"#{rating}\" \r\n Where stock_ticker=\"#{stock_ticker}\";\r\n SQL\r\n )\r\n puts \"#{stock_ticker} has been changed to '#{rating}'\"\r\nend",
"def add_volatility_rows(db, q1, q2, q3, q4, q5)\n db.execute(\"INSERT INTO volatility_table \n (quintile_1, quintile_2, quintile_3, quintile_4, quintile_5) \n VALUES (?, ?, ?, ?, ?)\", [q1, q2, q3, q4, q5])\nend",
"def rate score, post\n ratings.create :score => (score.is_a?(Integer) ? score : Rating.score_for(score)), :post_id => Post.wrap(post).id\n end",
"def add_rating(user_id, rating, timestamp)\n @user_ratings << UserRating.new(user_id, rating, timestamp)\n @sum_ratings = nil\n end",
"def rate(new_rate)\n @ratings << new_rate\n @average_rating = @ratings.sum / @ratings.length\n end",
"def add_stock\n @item.stock += params[:stock].to_i\n @item.save\n flash[:success] = \"Stock updated\"\n redirect_back(fallback_location: root_path)\n end",
"def addRating _obj, _args\n \"_obj addRating _args;\" \n end",
"def update_rating(db, rating, song)\n db.execute(\"UPDATE music SET rating=(?) WHERE song=(?)\", [rating, song])\nend",
"def add_rating(rating)\n if @count < TRAINING_SET_SIZE\n add_movie(rating)\n add_user(rating)\n @count += 1\n else\n @test_set << rating\n end\n end",
"def create_stock(stockname, amount)\n $db.execute('INSERT INTO stocks (stockname, amount) VALUES (?, ?)', stockname, amount)\n end",
"def add_book(db, title, author, rating)\n db.execute(\"INSERT INTO books (title, author, rating) VALUES (?, ?, ?)\", [title, author, rating])\nend",
"def add_interest(db, interest)\n db.execute(\"INSERT INTO interests (interest) VALUES (?)\", [interest])\nend",
"def add_price(asin, title, price_s, price_i, day, day_i)\r\n $db.execute(\"INSERT INTO prices (asin, title, price_s, price_i, day, day_i) VALUES (?,?,?,?,?,?)\", [asin, title, price_s, price_i, day, day_i])\r\nend",
"def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end",
"def create_rating\n return unless valid?\n @rating_class.create(\n social_entry: @social_entry,\n rateable: @rateable,\n rater: @rater,\n ratee: @ratee,\n rating_type: @rating_type,\n rating_metrics: @rating_metrics\n )\n update_rating_aggregates\n end",
"def satisfaction_rating_increase(amount)\n self.satisfaction_rating = satisfaction_rating + amount\n record_transaction\n end",
"def update_star(review)\n self.average_stars = self.average_stars + review.star_rating\n # self.average_stars = (self.average_stars + review.star_rating)/review.count\n\n self.save\n end",
"def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def addStars(num)\n self.stars += num\n end",
"def add_movie(db, title, rating, comments)\r\n\t\tdb.execute(\"INSERT INTO movies(title, rating, comments) VALUES(?, ?, ?)\", [title, rating, comments])\t\r\n\tend",
"def set_rating\n if !current_user\n raise \"MUST BE LOGGED IN\"\n end\n student_id = current_user.id\n company_id = params[:id]\n student_company_rating = StudentCompanyRating.find_or_create_by_student_id_and_company_id(student_id, company_id)\n student_company_rating.rating = params[:rating]\n student_company_rating.save!\n\n head :no_content\n end",
"def save()\n\n qty_available = Album.qty_available(@sli_alb_id)\n\n if(qty_available >= @sli_qty)\n\n if(@sli_id && @sli_id != 0)\n update()\n else\n insert()\n end\n end\n end",
"def rating_id=(rating_id)\n self.rating = Rating.find rating_id\n end",
"def add_movie(rating)\n @movie_list[rating.movie_id] ||= Movie.new\n @movie_list[rating.movie_id].add(rating)\n end",
"def add_entry(db, book_name, year_pubished, genre, author, rating, read)\n\tdb.execute(\"INSERT INTO books (book_name, year_pubished, genre, author, rating, read) VALUES (?, ?, ?, ?, ?, ?)\", [book_name, year_pubished, genre, author, rating, read])\nend",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def rate(new_rating, save_object = true)\n new_rating = new_rating.to_i\n if new_rating >= Rateable.min and new_rating <= Rateable.max\n unless @rate_count\n @rating = new_rating\n @rate_count = 1\n else\n sum = @rating * @rate_count\n @rate_count += 1\n @rating = (sum + new_rating) / @rate_count\n end\n self.update(:only => [:rating, :rate_count]) if save_object\n end\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def create\n # Check if already exists\n if Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n update\n else\n @rating = Rating.new(rating_params)\n @rating.event_id = params[:event_id]\n @rating.user_id = current_user.id\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :new }\n end\n end\n end\n end",
"def set_rating\n @rating = Rating.find_by_name(params[:id])\n end",
"def add_new_stock_holding(quantity, cost)\n stkh = Porp::StockHolding.create(self, quantity, cost)\n redis.sadd(\"#{Porp.ns}:stockholding:id:#{id}:stockholdings\", stkh.id)\n end",
"def add_stock(ticker, number_of_shares)\n if has_stock(ticker)\n @stocks.each do |item|\n if item.ticker == ticker\n item.shares += number_of_shares\n end\n end\n else\n @stocks << Stock.new(ticker, number_of_shares)\n end\n end",
"def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = UserRating.new(params[:rating])\n user_rating.rating_id = params[:rating_id]\n user_rating.user_id = current_user.id\n\n if user_rating.save\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n if current_user.provider == 'twitter' && current_user.facebook_share\n current_user.twitter.update(\"I've rated an idea on #Idearator ! available on: \" + root_url + \"ideas/\" + idea.id.to_s) rescue Twitter::Error\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea, :notice => 'Your rating has been saved successfully!' }\n format.js\n end\n else\n respond_to do |format|\n format.html { redirect_to idea, :alert => 'Your rating has not been saved, please retry!' }\n format.js\n end\n end\n end",
"def post_selling(userid, stockid, amount, price)\n $db.execute('INSERT INTO relation_user_stock_sale (userid, stockid, amount, price) VALUES (?, ?, ?, ?)', userid, stockid, amount, price)\n end",
"def add_wine(db,wine_name,vineyard,vintage_year,rating,region_id)\n\tdb.execute(\"INSERT INTO wine_type (wine_name, vineyard,vintage_year,rating,region_id) \n\tVALUES (?,?,?,?,?)\",[wine_name,vineyard,vintage_year,rating,region_id])\nend",
"def add_reciever(db, name, gift, cost)\n db.execute(\"INSERT INTO personal_gift (name, gift, cost, purchased_id) VALUES (?, ?, ?, 2)\", [name, gift, cost])\nend",
"def add_song(db, artist, song, rating, explicit_lyrics, user_id, platform_id)\n db.execute(\"INSERT INTO music (artist, song, rating, explicit_lyrics, user_id, platform_id) VALUES (?, ?, ?, ?, ?, ?)\", [artist, song, rating, explicit_lyrics, user_id, platform_id])\nend",
"def rating_params\n params.require(:rating).permit(:rank, :fragrance_id, :user_id)\n end",
"def rate\n @album = Album.find(params[:id])\n authorize! :rate, @album\n @album_rating = AlbumRating.new({\n :user_id => current_user.id,\n :album_id => params[:id],\n :rating => params[:rating]\n })\n\n if @album_rating.save\n flash[:notice] = 'Thanks for rating'\n else\n flash[:alert] = \"Could not save your rating. You may have rated this already!\"\n end\n\n redirect_to :back\n end",
"def rate(rateable, rate)\n already_rated = Rating.find(:first, :conditions => [\n \"rater_id = ? AND rater_type = ? AND rateable_id = ? AND rateable_type = ?\",\n self.id, self.class.name, rateable.id, rateable.class.name\n ])\n if already_rated\n already_rated.update_attribute(:rating, rate)\n else\n rate = Rating.new(:rating => rate, :rateable => rateable, :rater => self)\n rate.save\n end\n end",
"def set_rating(id)\n @rating = Rating.find(id)\n end",
"def save\n # Assign the Postgre connect to variable\n conn = Star.open_connection\n # If the Post instance has an it means it already exists so we are going to update an existing record\n if(self.id)\n sql = \"UPDATE star SET title='#{self.title}', info='#{self.info}', image='#{self.image}' WHERE id = #{self.id}\"\n # If the star has no id this means the star is new and needs creating\n else\n sql = \"INSERT INTO star (title, info, image) VALUES ('#{self.title}', '#{self.info}','#{self.image}')\"\n end\n # Execute the sql in Postgres\n conn.exec(sql)\n end",
"def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end",
"def add_user(rating)\n @user_list[rating.user_id] ||= User.new\n @user_list[rating.user_id].add(rating)\n end",
"def rate_post\n render nothing: true\n\n post = Post.find(params[:id])\n\n assert(@post.kind_of?(Post))\n\n if not post.user_ratings.include? current_user.id\n post.user_ratings.push(current_user.id)\n post.save\n else\n redirect_to_back(root_path)\n end\n end",
"def update_rating!\n # not using count because lates some votes might be something other than +/- 1\n self.positive_vote_count = votes.positive.sum(:value).abs\n self.negative_vote_count = votes.negative.sum(:value).abs\n self.rating = votes.sum(:value)\n save!\n end",
"def rating=(rating)\n rate_attrs = rating.attributes.with_indifferent_access.slice(*Rating::LIST)\n assign_attributes(rate_attrs)\n end",
"def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend",
"def rating(value)\n @ole.Rating = value\n nil\n end",
"def update_user_rateing(db,id,new_value)\n db.execute(\"UPDATE users SET user_rating=#{new_value} WHERE users.id =#{id}\")\nend",
"def add_age_bracket\n unless self.has_special_rate?\n single_version = self.product.versions.where(:detail_type => \"SingleDetail\")\n if single_version.any?\n age_bracket_ids = AgeSet.where(:version_id => single_version.first.id).pluck(:age_bracket_id).map { |i| {:age_bracket_id => i }}\n if age_bracket_ids.any?\n AgeSet.create(age_bracket_ids) do |a|\n a.version_id = self.id\n end\n end\n end\n end\n end",
"def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end",
"def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end",
"def create_movie(db, title, year,rating)\n db.execute(\"INSERT INTO movies (title, year, rating) VALUES (?, ?, ?)\", [title,year,rating])\nend",
"def apples_to_basket(variety, basket)\n basket.apples.create!(variety: variety)\n\n # update fill_rate\n basket.fill_rate = ((basket.apples.size.to_f / basket.capacity.to_f) * 100).round\n basket.save\nend",
"def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend",
"def set_Rating(value)\n set_input(\"Rating\", value)\n end",
"def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_back(fallback_location: presets_path, notice: 'rating was sucessefully added') }\n\n else\n format.html { render :new }\n\n end\n end\n end",
"def create\n @rating_alt = Rating.new(params[:rating_alt])\n\n respond_to do |format|\n if @rating_alt.save\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully created.' }\n format.json { render json: @rating_alt, status: :created, location: @rating_alt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rating_score\n @rating_score = RatingScore.find(params[:id])\n end",
"def rate(rate)\n @rated_times += 1\n @average_rating = (@average_rating + rate) / @rated_times\n end",
"def rating=(new_rating)\n #review = Review.where(video: video, user: user).first \n #review.update_attributes(rating: new_rating) if review\n #review.update!(rating: new_rating) if review\n if review\n review.update_columns(rating: new_rating) \n else\n # using Review.new instead of Review.create to avoid the Valitaion. \n #--->\n #review = Review.new(user: user, video:video, rating: new_rating) \n new_review = Review.new(user: user, video:video, rating: new_rating) \n #review.save(validate: false)\n new_review.save(validate: false) #bypass validation \n #---> \n end\n end",
"def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end",
"def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end",
"def save\n sql = \"\n INSERT INTO discounts\n (name, multiplier, type)\n VALUES\n ($1, $2, $3)\n RETURNING id\n \"\n values = [self.name, @multiplier, @type]\n discount = SqlRunner.run(sql, values).first\n @id = discount[\"id\"].to_i\n end",
"def rate_comment\n render nothing: true\n comment = Comment.find(params[:id])\n\n if(!comment.user_ratings.include? current_user.id)\n comment.user_ratings.push(current_user.id)\n comment.save\n else\n return redirect_to_back(root_path)\n end\n\n end",
"def add_star\n @@number_of_stars += 1\n puts \"Afer adding one, Exoplanet class variable number_of_stars has value #@@number_of_stars\"\n end",
"def add_star\n @@number_of_stars += 1\n puts \"Afer adding one, Exoplanet class variable number_of_stars has value #@@number_of_stars\"\n end",
"def add(quant)\n self.quantity_consumed -= quant\n save\n \"added #{quant} #{name}\"\n end",
"def create_ratings(db,name,address,rating)\ndate_visited = Faker::Date.backward(14).to_s\ndb.execute(\"Insert into restaurants (name, address, rating, date_visited) values (?, ?, ?, ?)\", [name, address, rating, date_visited])\nend",
"def add_friend_interest(db, friend_id, interest_id)\n db.execute(\"INSERT INTO friends_interests (friend_id, interest_id) VALUES (?, ?)\", [friend_id, interest_id])\nend",
"def rating_params\n params.require(:rating).permit(:score, :game_id)\n end",
"def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def item_stock(item)\n item_stocks.create(item_id: item.id)\n end",
"def rating #Getter\n @rating\n end",
"def album_rating(value)\n @ole.AlbumRating = value\n nil\n end"
] | [
"0.6476404",
"0.6476404",
"0.6428312",
"0.6321881",
"0.62484944",
"0.61580354",
"0.61575603",
"0.60726744",
"0.60298854",
"0.60198843",
"0.6010236",
"0.60034364",
"0.59853",
"0.5983888",
"0.59637064",
"0.5948381",
"0.5931595",
"0.59059",
"0.58692276",
"0.58544207",
"0.582988",
"0.5819923",
"0.5805168",
"0.5795147",
"0.5794911",
"0.5768804",
"0.5755211",
"0.573933",
"0.569767",
"0.5688252",
"0.5677661",
"0.567682",
"0.56714153",
"0.56664443",
"0.56641376",
"0.56641376",
"0.56641376",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56543803",
"0.56519914",
"0.56510025",
"0.563533",
"0.5627112",
"0.56218946",
"0.5594802",
"0.5593664",
"0.5555952",
"0.5553552",
"0.5546873",
"0.5532108",
"0.5517879",
"0.5509862",
"0.5508832",
"0.5493502",
"0.5479263",
"0.54746467",
"0.54647887",
"0.5459055",
"0.5446944",
"0.54390275",
"0.5424518",
"0.5416992",
"0.5415365",
"0.54074824",
"0.54028225",
"0.5393191",
"0.5386744",
"0.53619695",
"0.5360577",
"0.5359371",
"0.53545296",
"0.5347898",
"0.5347117",
"0.5337199",
"0.532592",
"0.53243583",
"0.53184515",
"0.5312854",
"0.53107846",
"0.53044826",
"0.530335",
"0.5295142",
"0.52885026",
"0.52885026",
"0.528243",
"0.5281408",
"0.5274869",
"0.52677464",
"0.52676547",
"0.5265693",
"0.5262568",
"0.52615"
] | 0.5875876 | 18 |
update a stock rating | def update_rating (db,stock_ticker,rating)
db.execute(<<-SQL
UPDATE stocks2
SET recommendation_id="#{rating}"
Where stock_ticker="#{stock_ticker}";
SQL
)
puts "#{stock_ticker} has been changed to '#{rating}'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_rating\n @packages = Packages.find(params[:pid])\n @packages.update(:rating => params[:rate])\n end",
"def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end",
"def update!(**args)\n @rating = args[:rating] if args.key?(:rating)\n @rating_system = args[:rating_system] if args.key?(:rating_system)\n end",
"def update\n @rating = Rating.find(params[:id])\n @rating.update_attribute :value, params[:value]\n end",
"def update_star(review)\n self.average_stars = self.average_stars + review.star_rating\n # self.average_stars = (self.average_stars + review.star_rating)/review.count\n\n self.save\n end",
"def update_rating\n\t\tself.user_rating = self.ratings.sum(\"rating_value\")/self.ratings.count\n\t\tself.save(validate: false) #THIS IS TO PREVENT ALL OF THE USER VALIDATIONS FROM RUNNING\n\tend",
"def rate(new_rating, save_object = true)\n new_rating = new_rating.to_i\n if new_rating >= Rateable.min and new_rating <= Rateable.max\n unless @rate_count\n @rating = new_rating\n @rate_count = 1\n else\n sum = @rating * @rate_count\n @rate_count += 1\n @rating = (sum + new_rating) / @rate_count\n end\n self.update(:only => [:rating, :rate_count]) if save_object\n end\n end",
"def update\n idea = Idea.find_by_id(params[:idea_id])\n user_rating = current_user.user_ratings.find_by_rating_id(params[:rating_id])\n\n if user_rating.update_attributes(params[:rating])\n saved_rating = UserRating.where('rating_id' => params[:rating_id])\n\n if saved_rating.size != 0\n rating = Rating.find_by_id(params[:rating_id])\n average_rating = 0\n\n saved_rating.each do |sr|\n average_rating = average_rating.to_i + sr.value.to_i\n end\n\n rating.value = average_rating.to_f / saved_rating.size.to_f\n rating.save\n end\n\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :notice => 'Your rating has been updated successfully!' }\n format.js { render text: \"\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to idea_path(idea), :alert => 'Your rating has not been updated, please retry!' }\n format.js { render text: \"\" }\n end\n end\n end",
"def update_rating_entry(db, rating, id)\n\tdb.execute(\"UPDATE books SET rating=? WHERE id=?\", [rating, id])\nend",
"def update_rating!\n # not using count because lates some votes might be something other than +/- 1\n self.positive_vote_count = votes.positive.sum(:value).abs\n self.negative_vote_count = votes.negative.sum(:value).abs\n self.rating = votes.sum(:value)\n save!\n end",
"def update_rating_and_codes(rating)\n\t@last_rating = rating\n\tupdate_set_of_codes\n end",
"def update\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.update(rating_params)\n flash[:success] = \"Rating has been successfully updated!\"\n redirect_to skate_spot_path(@skate_spot)\n #redirect_to([@rating.skate_spot, @rating], :notice => 'Rating has been successfully updated!') \n else\n flash[:danger] = \"Rating has been unsuccesfully updated. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end",
"def update_rating\n @rating = params[:value]\n @rated_user = params[:rated_user]\n @previous_rating = Rating.find_by rated_user_id: @rated_user, rating_user_id: @current_user.id\n if @previous_rating.blank?\n Rating.create(rated_user_id: @rated_user, rating_user_id: @current_user.id, value: @rating)\n else\n @previous_rating.value = @rating\n @previous_rating.save\n end\n render nothing: true, status: :ok and return\n end",
"def update_ratings\n tournament.rater.update_ratings(self)\n end",
"def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def update\n rating = @coment.comentratings.find_by(user_id: current_user.id)\n respond_to do |format|\n if rating.update(star: params[:star])\n message = \"You updated to #{params[:star]} stars.\"\n format.html { redirect_back(fallback_location: coment_path(@coment), notice: message) }\n format.json { render :show, status: :ok, location: coment_path(coment) }\n else\n format.html { render :edit }\n format.json { render json: @coment.comentrating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rating_accum(food_id, rating_score)\n food = Food.find(food_id)\n current_rating = food.rating\n number_of_ratings = food.number_of_ratings\n total_rating_score = current_rating * number_of_ratings\n total_rating_score = total_rating_score + rating_score\n number_of_ratings = number_of_ratings + 1\n new_rating = total_rating_score / number_of_ratings\n food.update_attributes(rating: new_rating, number_of_ratings: number_of_ratings)\n end",
"def update\n\t\tp \"UPDATE rating\"\n if current_user.nil?\n\t\t\tflash.now[:error] = 'You must be signed in to specify a rating.'\n else\n\t\t\t@rating.ratable = @ratable\n\t\t\t@rating.user = current_user\n\t if @rating.update_attributes(score: params[:score])\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.js { render :nothing => true }\n\t\t\t\tend\n\t else\n\t\t\t\tflash[:error] = \"Something went wrong. Please try again.\"\n\t end\n end\n end",
"def update_recipe_rating(recipe_id)\n new_rating = prompt.ask(\"what new rating would you like to give?\")\n self.user.recipes.where(id: recipe_id).update(rating: new_rating.to_i)\n recipe_ingredients(recipe_id)\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end",
"def update_rating(db, rating, song)\n db.execute(\"UPDATE music SET rating=(?) WHERE song=(?)\", [rating, song])\nend",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end",
"def fix_game_rating(old, new)\n if !old.nil?\n self.game_rating -= 2**(old-1)\n end\n self.game_rating += 2**(new-1)\n save\n end",
"def update\n respond_to do |format|\n if @idea_rating.update(idea_rating_params)\n format.html { redirect_to idea_ratings_path(:idea_id => @idea_rating.idea_id), notice: (I18n.t :act_update) }\n format.json { render :show, status: :ok, location: @idea_rating }\n calc_idea_rating\n else\n format.html { render :edit }\n format.json { render json: @idea_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe.average_rating = @recipe.ratings.average(:rate)\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def satisfaction_rating_increase(amount)\n self.satisfaction_rating = satisfaction_rating + amount\n record_transaction\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n @event = Event.find(params[:rating][:event_id])\n\n @rating.stars = params[:rating][:stars]\n respond_to do |format|\n if @rating.save\n format.json { render :json => { :avg_rating => @event.avg_rating } }\n else\n format.json { render :json => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_user_rateing(db,id,new_value)\n db.execute(\"UPDATE users SET user_rating=#{new_value} WHERE users.id =#{id}\")\nend",
"def update_quant(item, quant)\n\t$grocery_list.store(item, quant)\n\tp \"You updated #{item} number to #{quant}.\"\nend",
"def update_reviews_average(score)\n self.reviews_average = calculate_reviews_average(score)\n self.reviews_count += 1\n self.save\n end",
"def update\n respond_to do |format|\n if @engine_rating.update(engine_rating_params)\n format.html { redirect_to @engine_rating, notice: 'Engine rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_rating }\n else\n format.html { render :edit }\n format.json { render json: @engine_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @atm_weight = args[:atm_weight] if args.key?(:atm_weight)\n @rating = args[:rating] if args.key?(:rating)\n end",
"def update!(**args)\n @best = args[:best] if args.key?(:best)\n @highly_rated = args[:highly_rated] if args.key?(:highly_rated)\n @star_type = args[:star_type] if args.key?(:star_type)\n @stars = args[:stars] if args.key?(:stars)\n @unspecified = args[:unspecified] if args.key?(:unspecified)\n end",
"def rate(new_rate)\n @ratings << new_rate\n @average_rating = @ratings.sum / @ratings.length\n end",
"def update_stock\n\t\tincrease_stock unless new_record?\n\t\tyield\n\t\tdecrease_stock\n\tend",
"def update_rating\n @product.rating = @product.likes.size * 10\n @product.feature_groups.where(singles: false).each do |fg|\n fg.features.each do |f|\n up_rating = f.likes.where(up: true).size\n down_rating = f.likes.where(up: false).size\n @product.rating += up_rating - down_rating\n end\n end\n @product.feature_groups.where(singles: true).each do |singles|\n singles.features.each do |f|\n @product.rating += f.likes.where(up: true).size - f.likes.where(up: false).size\n end\n end\n # here we should somehow incorporate comments on the product into the rating\n @product.save\n end",
"def update_price\n self.update(daily_price: new_daily_price)\n end",
"def rate!(level)\n rating.increment!(level)\n end",
"def update\n @rating = Rating.find_by(user_id: current_user.id, event_id: params[:event_id])\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_back fallback_location: root_path }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n #only for updating the rating field; nothing else can change\n prev_rating = @book.rating\n @book.rating = params[:book][:rating]\n\n if @book.save\n # update user's fav genres score\n case @book.genre\n when \"fantasy\"\n #undo prev rating, if there was one\n unless prev_rating.nil?\n current_user.fantasy -= (prev_rating - 3)\n end\n #add score for new rating. \n #The (rating - 3) allows bad ratings to negatively affect fav genre score\n current_user.fantasy = [0, current_user.fantasy + (@book.rating - 3)].max\n when \"science_fiction\"\n unless prev_rating.nil?\n current_user.scifi -= (prev_rating - 3)\n end\n\n current_user.scifi = [0, current_user.scifi + (@book.rating - 3)].max\n when \"mystery\"\n unless prev_rating.nil?\n current_user.mystery -= (prev_rating - 3)\n end\n\n current_user.mystery = [0, current_user.mystery + (@book.rating - 3)].max\n when \"romance\"\n unless prev_rating.nil?\n current_user.romance -= (prev_rating - 3)\n end\n\n current_user.romance = [0, current_user.romance + (@book.rating - 3)].max\n when \"nonfiction\"\n unless prev_rating.nil?\n current_user.nonfiction -= (prev_rating - 3)\n end\n\n current_user.nonfiction = [0, current_user.nonfiction + (@book.rating - 3)].max\n when \"history\"\n unless prev_rating.nil?\n current_user.history -= (prev_rating - 3)\n end\n\n current_user.history = [0, current_user.history + (@book.rating - 3)].max\n when \"drama\"\n unless prev_rating.nil?\n current_user.drama -= (prev_rating - 3)\n end\n\n current_user.drama = [0, current_user.drama + (@book.rating - 3)].max\n when \"thriller\"\n unless prev_rating.nil?\n current_user.thriller -= (prev_rating - 3)\n end\n\n current_user.thriller = [0, current_user.thriller + (@book.rating - 3)].max\n when \"adventure\"\n unless prev_rating.nil?\n current_user.adventure -= (prev_rating - 3)\n end\n\n current_user.adventure = [0, current_user.adventure + (@book.rating - 3)].max\n when \"poetry\"\n unless prev_rating.nil?\n current_user.poetry -= (prev_rating - 3)\n end\n\n current_user.poetry = [0, current_user.poetry + (@book.rating - 3)].max\n end\n current_user.save()\n\n flash[:notice] = \"Book rating sucessfully updated\"\n redirect_to '/profile'\n else\n flash[:alert] = @book.errors[:rating].first\n redirect_to edit_book_path(Book.find(params[:id]))\n end\n end",
"def update_score\n sum = 0.0\n total = 0.0\n ratings.each do |rating|\n vp = User.find(rating.user_id).voting_power \n sum = sum + rating.score * vp\n total = total + vp\n end\n average = sum / total\n variance = ratings.inject(0.0){ |sum, element| sum + \n (element.score - average) ** 2 }\n penalty = Math.log10((variance / ratings.size) + 1) + 1.0;\n update_attribute(:score, average / penalty)\n end",
"def update\n @ad = Ad.find(params[:id])\n @item=Item.where(ad_id: @ad.id)\n respond_to do |format|\n if @ad.update_attributes(params[:ad])\n format.html { redirect_to @ad, notice: (t :ad_successfully_updated) }\n format.json { render json: @ad }\n @ad.rating=params[:rating]\n @ad.ratingsnumber+=1\n @ad.ratingsum+=@ad.rating\n @ad.rating= @ad.ratingsum / @ad.ratingsnumber\n @ad.save \n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating_alt.update_attributes(params[:rating_alt])\n format.html { redirect_to @rating_alt, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_alt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @best_rating = args[:best_rating] if args.key?(:best_rating)\n @image_url = args[:image_url] if args.key?(:image_url)\n @rating_explanation = args[:rating_explanation] if args.key?(:rating_explanation)\n @rating_value = args[:rating_value] if args.key?(:rating_value)\n @textual_rating = args[:textual_rating] if args.key?(:textual_rating)\n @worst_rating = args[:worst_rating] if args.key?(:worst_rating)\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update_ratings\n uris = Restaurant.pluck(:uri)\n parse = Parse.new\n @new_ratings = {}\n uris.each do |uri|\n @new_ratings[uri] = parse.get_ratings(uri)\n end\n @new_ratings.each do |rating|\n Restaurant.where({uri: rating[0]}).update_all({rating: rating[1][:rating]})\n end\n end",
"def inc_stock\n\t\t@stock += 1\n\tend",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def update\n @level = Level.find(params[:id])\n rating = params[:level][:rating].to_i\n @level.rating = rating\n if @level.save\n flash[:notice] = 'Level was successfully updated.'\n redirect_to :action => \"index\"\n else \n flash[:warning] = 'Invalid Options... Try again!'\n redirect_to :action => \"index\"\n end\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def update_review_rating(user, game, tracer)\n display_menu_header([\"Update My Review of\", \"'#{game.name}'.\"], user)\n rating = 0\n message = []\n until rating > 0 && rating < 101\n entry = display_string_menu([\"Please give this game a rating from 1-100: \"], message)\n message = [\"Sorry, invalid entry.\"]\n rating = entry.to_i\n end\n Review.find_by(user_id: user.id, game_id: game.id).update(rating: rating)\n display_footer([\"Review rating successfully updated for\", \"'#{game.name}'\"])\n menu_routing(user, game, tracer)\nend",
"def standard_update\n lambda do\n update_sell_date\n @quality -= (@sell_in >= 0 ? 1 : 2)\n quality_limits\n end\n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to :back, notice: 'Rating was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def update_stock\n \tproduct = FileOperations.search_by_name(self)\n \tproduct = product[0].split(';')\n \tself.id = product[0]\n \tself.name = product[1]\n \tself.price = product[2]\n \tself.company = product[3]\n \tself.stock = product[4].to_i - 1\n \tFileOperations.update(self)\n end",
"def update\n respond_to do |format|\n if @finale_rating.update(finale_rating_params)\n format.html { redirect_to @finale_rating, notice: 'Finale rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @finale_rating }\n else\n format.html { render :edit }\n format.json { render json: @finale_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_player_rating(id, rating)\n players = @client.query(\"SELECT id FROM players WHERE id = #{id}\")\n return \"couldn't find player with ID #{id}\" if players.size == 0\n return \"found more than one (#{players.size}) players with ID #{id}\" if players.size > 1\n @client.query(\"UPDATE players SET latest_rating = #{rating} WHERE id = #{id}\")\n nil\n rescue Mysql2::Error => e\n return \"mysql error: #{e.message}\"\n rescue => e\n return \"error: #{e.message}\"\n end",
"def rating(value)\n @ole.Rating = value\n nil\n end",
"def double_rating_score\n\t\t\tparams[:comment][:rating] = (params[:comment][:rating].to_f * 2).to_i\n\t\tend",
"def update\n respond_to do |format|\n if @confidence_rating.update(confidence_rating_params)\n format.html { redirect_to @confidence_rating, notice: 'Confidence rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @confidence_rating }\n else\n format.html { render :edit }\n format.json { render json: @confidence_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_Rating(value)\n set_input(\"Rating\", value)\n end",
"def update\n respond_to do |format|\n if @album_rating.update(album_rating_params)\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_rating }\n else\n format.html { render :edit }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @inspiration_score = args[:inspiration_score] if args.key?(:inspiration_score)\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n PostLogger.info(\"Change position - Now: #{@stock.quantity} shares of #{@stock.symbol} in #{@stock.portfolio.user.name}'s - #{@stock.portfolio.name} Portfolio\")\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n stock = Stock.find(params[:stock_id])\n @idea.stock = stock\n \n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_discounted_price\n self.price = product.price * (100-discount)/100 \n end",
"def update\n respond_to do |format|\n if @game_rating.update(game_rating_params)\n format.html { redirect_to @game_rating, notice: 'Game rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_rating }\n else\n format.html { render :edit }\n format.json { render json: @game_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rating #Getter\n @rating\n end",
"def set_rating\n @rating = Rating.find_by_name(params[:id])\n end",
"def update!(**args)\n @risk = args[:risk] if args.key?(:risk)\n end",
"def update!(**args)\n @risk = args[:risk] if args.key?(:risk)\n end",
"def update_price(raw_price)\n model.price = raw_price * 1.10 # our markup is 10%\n model.save!\n end",
"def set_rating\n if !current_user\n raise \"MUST BE LOGGED IN\"\n end\n student_id = current_user.id\n company_id = params[:id]\n student_company_rating = StudentCompanyRating.find_or_create_by_student_id_and_company_id(student_id, company_id)\n student_company_rating.rating = params[:rating]\n student_company_rating.save!\n\n head :no_content\n end",
"def update_price(price)\n model.price = price # * 1.10 # our markup is 10%\n model.save!\n end",
"def update\n respond_to do |format|\n if @dish_rating.update(dish_rating_params)\n format.html { redirect_to @dish_rating, notice: 'Dish rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @dish_rating }\n else\n format.html { render :edit }\n format.json { render json: @dish_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_for_customer\n reviews = Review.find_for_all_product_of_customer(customer.id)\n nb_reviews = reviews.size\n score_reviews = reviews.average(:score)\n customer.nb_reviews = nb_reviews\n customer.score_reviews = score_reviews\n customer.save\n end",
"def update_score\n self.score = posts.inject(0) { |score, post| score += post.rating }\n save\n end",
"def set_rating(id)\n @rating = Rating.find(id)\n end",
"def set_rating_score\n @rating_score = RatingScore.find(params[:id])\n end",
"def update\n @stock = Stock.find(params[:symbol])\n binding.pry\n respond_to do |format|\n if @stock.update_attributes(params[:currentPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:openingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:closingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end",
"def update\n @m_rating = MRating.find(params[:id])\n\n respond_to do |format|\n if @m_rating.update_attributes(params[:m_rating])\n format.html { redirect_to(@m_rating, :notice => 'M rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_rating.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @doc_level_relevance_ratings = args[:doc_level_relevance_ratings] if args.key?(:doc_level_relevance_ratings)\n end"
] | [
"0.74021316",
"0.71803564",
"0.7158744",
"0.7127627",
"0.69602317",
"0.6918255",
"0.6889902",
"0.68546915",
"0.6852867",
"0.6846486",
"0.68398315",
"0.6816089",
"0.6772984",
"0.673968",
"0.66997576",
"0.6652885",
"0.6599967",
"0.65896297",
"0.6561463",
"0.6523203",
"0.6517419",
"0.65104574",
"0.65028375",
"0.6494655",
"0.6492524",
"0.6481512",
"0.6480631",
"0.64723676",
"0.6465869",
"0.6460679",
"0.64581156",
"0.64575714",
"0.64195806",
"0.6413861",
"0.636491",
"0.63612604",
"0.6359183",
"0.63341695",
"0.6327182",
"0.63258266",
"0.632303",
"0.63163614",
"0.6313723",
"0.6307163",
"0.6299404",
"0.6290683",
"0.627712",
"0.6273042",
"0.6270534",
"0.62631017",
"0.6261912",
"0.6260969",
"0.6252856",
"0.62493217",
"0.6245978",
"0.6245978",
"0.6245978",
"0.62413377",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62398",
"0.62373406",
"0.6222317",
"0.6210971",
"0.6195475",
"0.6175929",
"0.6168198",
"0.615414",
"0.61285985",
"0.61277044",
"0.61212933",
"0.61156267",
"0.6101912",
"0.6101688",
"0.61011976",
"0.6099152",
"0.6095848",
"0.6094715",
"0.6076889",
"0.6070518",
"0.60675746",
"0.60675746",
"0.6063279",
"0.60506505",
"0.60506386",
"0.6048943",
"0.6046565",
"0.60465086",
"0.6045331",
"0.60418016",
"0.6040845",
"0.6040822",
"0.60358965"
] | 0.7128225 | 3 |
remove a stock from database | def remove_stock(db,stock_ticker)
db.execute(<<-SQL
DELETE FROM stocks2
Where stock_ticker="#{stock_ticker}";
SQL
)
puts "==================================================="
puts "#{stock_ticker} has been removed from the database."
puts "==================================================="
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def deleteStock\n p params[:ticker]\n Stock.where(:ticker => params[:ticker]).destroy_all \n end",
"def rem_stock_entity(stock_id)\n redis.srem(\"#{Porp.ns}:saleentity:id:#{id}:stockentities\", stock_id) \n redis.hdel(\"#{Porp.ns}:saleentity:id:#{id}:stkequantities\", stock_id)\n end",
"def delete_item(code)\n @stock.delete(code.to_sym)\n end",
"def destroy\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @prescription.drug_id).order(\"updated_at DESC\").first.quantity_available - @prescription.quantity\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @prescription.drug_id)\n @stock.save\n \n @prescription.destroy\n respond_to do |format|\n format.html { redirect_to prescriptions_url }\n format.json { head :no_content }\n end\n end",
"def decrease_stock\n\t\t@stock -= 1\n\tend",
"def db_remove prod\n $db.query \"DELETE FROM produtos WHERE prod=?\", prod\nend",
"def destroy\n @stock.destroy\n redirect_to user_path(current_user)\n end",
"def remove_item_from_stock(product_id)\n\t\tproduct = Product.find(product_id)\n\t\tif product.stock - 1 < 0\n\t\t\trender :json => \"No hay suficientes productos\"\n\t\telse\n\t\t\tproduct.stock -= 1\n\t\t\tproduct.save\n\t\tend\n\n\tend",
"def remove_stock(ticker, number_of_shares)\n @stocks.each do |item|\n if item.ticker == ticker\n item.shares -= number_of_shares\n end\n end\n end",
"def destroy\n redirect_to delete_stock_investments_path(@stock.id)\n @stock.destroy \n end",
"def decrease_stock\n \t\tif @stock > 0\n \t\t\tthen @stock -= 1\n \t\telse \n \t\t\traise OutOfStockError, \"'#{@title}' is out of stock.\"\n \t\tend\n \tend",
"def destroy\n @stock = Stock.find( params[:id] )\n @stock.delete_status = 1\n @stock.save\n #@stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_edit_all_path }\n format.json { head :no_content }\n end\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @dosing.drug_id).order(\"updated_at DESC\").first.quantity_available + 1\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @dosing.drug_id)\n @stock.save\n @dosing.destroy\n respond_to do |format|\n format.html { redirect_to dosings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sp500_stock = Sp500Stock.find(params[:id])\n @sp500_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to sp500_stocks_url }\n format.json { head :no_content }\n end\n end",
"def handle_del( m, params )\n name = params[:name].downcase.sub(/[ ]/, '_')\n unless @stock.has_key?( name )\n m.reply( \"Not in registry.\" ); return\n end\n @stock.delete(name)\n @registry[:stock] = @stock\n m.reply( \"done\" )\n end",
"def purchase\n \t@stock -= 1\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stockist = Stockist.find(params[:id])\n @stockist.destroy\n\n respond_to do |format|\n format.html { redirect_to(stockists_url) }\n format.xml { head :ok }\n end\n end",
"def update_stock\n operador = self.notas_creditos_debito.tipo == 'DevolucionCompra' ? -1 : 1\n if deleted?\n MercaderiaExtracto.eliminar_movimiento(self, self.notas_creditos_debito.fecha, cantidad * operador*-1)\n else\n MercaderiaExtracto.crear_o_actualizar_extracto(self, self.notas_creditos_debito.fecha, cantidad_was.to_f * operador, cantidad * operador)\n end\n end",
"def close_down\n # reset all stores\n update_command = %(\n UPDATE stocks\n SET quantity = 0\n WHERE store_id = #{id})\n\n ActiveRecord::Base.connection().execute(update_command)\n # set to closed\n self.update(closed: true)\n end",
"def destroy\n stock= @sales_order_detail.stock\n stock.update(:quantity=> (stock.quantity+@sales_order_detail.quantity))\n @sales_order_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to new_sales_order_detail_path+'?status=Start&id='+@sales_order_detail.sales_order.id.to_s, notice: 'Sales order detail was successfully deleted.' }\n end\n end",
"def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end",
"def destroy\n @stock_audit = StockAudit.new\n @stock_audit.user = current_user\n @stock_audit.stock = @stock\n @stock_audit.comment = \"destroyed stock unit with an ID of #{@stock.id}\"\n @stock_audit.save\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @total_stock = TotalStock.find(params[:id])\n @total_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to total_stocks_url }\n format.json { head :no_content }\n end\n end",
"def remove_check(id)\n DATABASE.execute(\"DELETE FROM split_checks WHERE id = #{id};\")\nend",
"def delete_if_stock_too_low\n self.status_constant = SupplyItem::DELETED if self.stock < 0\n end",
"def remove_from_list(database, item)\n $database.execute(\"DELETE FROM shopping WHERE item = (?)\", [item])\nend",
"def remove(*args)\n commit('remove', *args)\n end",
"def reduce_stock(amount)\n self.stock = self.stock - amount\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_item = StockItem.find(params[:id])\n @stock_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_items_url) }\n format.xml { head :ok }\n end\n end",
"def remove_good(good_id)\n @shop_goods.delete_at(good_id - 1)\n end",
"def destroy\n @product_stock = ProductStock.find(params[:id])\n @product_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to product_stocks_url }\n format.json { head :ok }\n end\n end",
"def stock_minus(product, amount)\n product = Product.find(product)\n quantity = product.quantity\n quantity -= amount.to_i\n product.update(quantity: quantity)\n end",
"def destroy\n @addstock.destroy\n respond_to do |format|\n format.html { redirect_to addstocks_url, notice: 'Addstock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_stock = ProductStock.find(params[:id])\n @product_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to product_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n db = PG.connect({ dbname: 'Music_Collection', host: 'localhost'})\n sql = \n \"\n DELETE FROM Music_Collection where id = #{@id};\n \"\n db.exec(sql)\n db.close()\nend",
"def destroy\n @incomestock = Incomestock.find(params[:id])\n @incomestock.destroy\n\n respond_to do |format|\n format.html { redirect_to incomestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_stock.destroy\n respond_to do |format|\n format.html { redirect_to model_stocks_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end",
"def destroy\n @producto_stock = ProductoStock.find(params[:id])\n @producto_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(producto_stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @watched_stock = WatchedStock.find_by(watchlist_id: watched_stocks_params[:watchlist_id], stock_symbol: watched_stocks_params[:stock_symbol])\r\n if @watched_stock.destroy\r\n render \"api/watched_stocks/show\"\r\n else\r\n render json: \"Stock was not removed from the watchlist\", status: 422\r\n end \r\n end",
"def destroy\n @paperstock.paperstock_items.each do |paperstock_item|\n paperstock_item.destroy\n end\n @paperstock.destroy\n respond_to do |format|\n format.html { redirect_to paperstocks_url, notice: 'Paperstock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_song(db, song)\n db.execute(\"DELETE FROM music WHERE song=(?)\", [song])\nend",
"def destroy\n @product = Product.find(params[:id])\n if @product.stockvolume == 1\n @product.destroy\n else\n @product.update(stockvolume: @product.stockvolume - 1)\n end\n\n redirect_to products_path\n\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def destroy\n @stock_price = StockPrice.find(params[:id])\n @stock_price.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_prices_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stock_transaction = StockTransaction.find(params[:id])\n @stock_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_entry = StockEntry.find(params[:id])\n @stock_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def purchase_stock!\n nil\n end",
"def delete\n Song.transaction do\n self.status = :deleted\n self.save!\n\n # sets deleted = 0\n self.mixes.destroy_all\n\n # actually deletes\n self.mlabs.destroy_all\n self.featurings.destroy_all\n end\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end",
"def remove_from_cart\n if @cart.candle_carts.count == 1\n destroy\n else\n item = CandleCart.find(cart_params[:id])\n item.destroy\n flash[:alert] = \"Succesfully Removed\"\n redirect_back fallback_location: root_path\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movimiento_stock = MovimientoStock.find(params[:id])\n @detalles_movimientos_stocks = DetalleMovimientoStock.find(:all,:conditions=>['id_movimiento_stock = ? ',@movimiento_stock.id])\n @detalles_movimientos_stocks.each do |detalle_movimiento_stock|\n detalle_movimiento_stock.destroy\n end\n @movimiento_stock.destroy\n CustomLogger.info(\"Se ha eliminado un Movimiento Stock: Fecha: #{@movimiento_stock.fecha.inspect}, Tipo de Movimiento: #{@movimiento_stock.tipo_movimiento.descripcion.inspect},Descripcion: #{@movimiento_stock.descripcion.inspect}. Usuario Responsable:#{current_user.funcionario.full_name.inspect}. Fecha y Hora: #{Time.now}\")\n respond_to do |format|\n format.html { redirect_to movimientos_stocks_url }\n format.json { head :no_content }\n end\n end",
"def remove_item\n\n end",
"def remove_product(name)\n @products_in_cart.delete(Product)\nend",
"def remove\n TickerSymbol.where(symb: params['symb']['name']).destroy_all\n render('covered_symbols')\n end",
"def remove_song\n @song = Song.find_by_id(params[:song_id])\n @mix.remove_song(@song)\n redirect_back(fallback_location: @mix)\n end",
"def destroy\n @uniform_stock_received.destroy\n respond_to do |format|\n format.html { redirect_to uniform_stock_receiveds_url, notice: (t 'uniform_stock_receiveds.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stocklist = Stocklist.find(params[:id])\n @stocklist.destroy\n\n respond_to do |format|\n format.html { redirect_to stocklists_url }\n format.json { head :ok }\n end\n end",
"def destroy \n @job_part.destroy \n increaseStock(@job_part)\n redirect_to job_path(id:params[:job_id])\nend",
"def delete_listing(listingid)\n $db.execute('DELETE FROM relation_user_stock_sale WHERE id=?', listingid)\n end",
"def destroy\n @stock_gabarra = StockGabarra.find(params[:id])\n @stock_gabarra.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_gabarras_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sell.destroy\n\n head :no_content\n end",
"def remove\n if @raw\n @raw.remove(:force => true) if @raw.exist?(@raw.id)\n end\n end",
"def remove_track(*args)\n commit('removeTrack', *args)\n end",
"def destroy\n @feedstock = Feedstock.find(params[:id])\n @feedstock.destroy\n\n respond_to do |format|\n format.html { redirect_to feedstocks_url }\n format.json { head :no_content }\n end\n end",
"def remove\n rows = self.open_import_file\n field = rows.first\n rows.each do |row|\n item_identifier = row['item_identifier'].to_s.strip\n if item = Item.where(:item_identifier => item_identifier).first\n item.destroy\n end\n end\n end",
"def delete\n DATABASE.execute(\"DELETE from students WHERE id = #{id}\")\n end",
"def delete\n DATABASE.execute(\"DELETE FROM students WHERE id = #{@id}\")\n end",
"def remove_item(grocery_list,item_name)\r\n\t \r\n\t grocery_list.delete(item_name)\r\n\r\nend",
"def update_stock\n for charge in self.charges\n charge.item.update_attribute(:stock, (charge.item.stock.to_i-1)) \n end\n end"
] | [
"0.7314341",
"0.7244771",
"0.7157054",
"0.70789826",
"0.70109254",
"0.698456",
"0.69810426",
"0.6920175",
"0.688013",
"0.6864305",
"0.6626184",
"0.6587378",
"0.6523363",
"0.6521096",
"0.65153295",
"0.65153295",
"0.65130085",
"0.64820665",
"0.6475954",
"0.64438754",
"0.6440132",
"0.6440132",
"0.6440132",
"0.6440132",
"0.6440132",
"0.6440132",
"0.64187616",
"0.6411977",
"0.63808113",
"0.6375286",
"0.6360107",
"0.63327444",
"0.6328076",
"0.63137573",
"0.6293344",
"0.62892807",
"0.6253363",
"0.6237824",
"0.62182415",
"0.62182415",
"0.62062216",
"0.6204966",
"0.61946297",
"0.6174196",
"0.616789",
"0.6167516",
"0.6142473",
"0.6142473",
"0.6139936",
"0.61394584",
"0.6130465",
"0.6129298",
"0.61228323",
"0.6120472",
"0.61156267",
"0.6108323",
"0.60999215",
"0.60968995",
"0.6091131",
"0.6091131",
"0.6091131",
"0.6091131",
"0.60851675",
"0.60842764",
"0.60616815",
"0.60519314",
"0.6046183",
"0.6042322",
"0.6033135",
"0.6027933",
"0.6025787",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60243785",
"0.60158044",
"0.6013781",
"0.5993017",
"0.5990434",
"0.598193",
"0.5969805",
"0.594723",
"0.59444296",
"0.5941235",
"0.593885",
"0.5929642",
"0.5927859",
"0.5917375",
"0.591665",
"0.59146065",
"0.59134525",
"0.5908466",
"0.5902346",
"0.58909756"
] | 0.84008443 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.