query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
POST /gears POST /gears.json
def create @current_usinfo @usinfo=Usinfo.all @usinfo.each do |elt| if(elt.user.email==current_user.email) @current_usinfo=elt end end @gear = @current_usinfo.gears.new(gear_params) respond_to do |format| if @gear.save format.html { redirect_to @gear, notice: 'Gear was successfully created.' } format.json { render :show, status: :created, location: @gear } else format.html { render :new } format.json { render json: @gear.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge, status: :created, location: @hoge }\n else\n format.html { render action: \"...
[ "0.58995456", "0.58931917", "0.5794838", "0.5666305", "0.5658326", "0.5608585", "0.55977917", "0.559703", "0.55921036", "0.55805635", "0.55743784", "0.5565814", "0.5558166", "0.55503505", "0.55340135", "0.55311775", "0.55119294", "0.55114686", "0.5503323", "0.550055", "0.5495...
0.0
-1
PATCH/PUT /gears/1 PATCH/PUT /gears/1.json
def update respond_to do |format| if @gear.update(gear_params) format.html { redirect_to @gear, notice: 'Gear was successfully updated.' } format.json { render :show, status: :ok, location: @gear } else format.html { render :edit } format.json { render json: @gear.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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!(**args)\n @geometries = arg...
[ "0.62767726", "0.6131888", "0.6125057", "0.61098313", "0.60706264", "0.60611045", "0.60294735", "0.5997472", "0.5949212", "0.5912289", "0.59080017", "0.5846397", "0.58446854", "0.5841438", "0.58330303", "0.5825231", "0.5822197", "0.5808913", "0.5803559", "0.5787294", "0.57857...
0.5701789
40
DELETE /gears/1 DELETE /gears/1.json
def destroy @gear.destroy respond_to do |format| format.html { redirect_to gears_url, notice: 'Gear was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n ...
[ "0.68400866", "0.6823084", "0.6697232", "0.6686432", "0.6678645", "0.66611385", "0.66562134", "0.6606179", "0.66030663", "0.65987885", "0.6589246", "0.65831405", "0.6579576", "0.65362775", "0.65352786", "0.65276307", "0.6521699", "0.65040785", "0.65021765", "0.6500294", "0.64...
0.64951694
21
Use callbacks to share common setup or constraints between actions.
def set_gear @gear = Gear.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_...
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def gear_params params.require(:gear).permit(:title, :definitionkey, :usinfo_id, :latitude, :longitude, :address, :description) 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...
[ "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.0
-1
Includes a partial. The path is relative to the Selenium tests root. The starting _ and the file extension don't have to be specified. include test/selenium/_partial. include_partial 'partial' include test/selenium/suite/_partial. include_partial 'suite/partial' include test/selenium/suite/_partial. and provide local assigns include_partial 'suite/partial', :foo => bar
def include_partial path, local_assigns = {} partial = @view.render :partial => path, :locals => local_assigns @output << partial end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_partial(relative_path)\n return if @partial_templates.key?(relative_path)\n\n @partial_templates[relative_path] = nil\n render(Pathname.new(\"#{@script_path}/#{relative_path}\"))\n end", "def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invoke...
[ "0.68579316", "0.6286506", "0.61970615", "0.61375266", "0.61279833", "0.60859585", "0.58853424", "0.5802644", "0.5724634", "0.57098573", "0.5702608", "0.56954813", "0.5687252", "0.5617213", "0.5612826", "0.5583607", "0.5576045", "0.55722475", "0.5568694", "0.55496705", "0.545...
0.7437805
1
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call +wait_for_page_to_load+.
def click locator command 'click', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click\n\tbegin\n\t @selenium.click(@locator)\n\trescue => e\n\t sleep(3)\n\t @selenium.click(@locator)\n\tend\n\n\tbegin\n\t @selenium.wait_for_page_to_load\n\trescue => e\n\t sleep(2)\n\t @selenium.wait_for_condition(\"selenium.browserbot.getCurrentWindow()\", TIMEOUT)\n\tend\n\t\n end", ...
[ "0.69821095", "0.69451565", "0.67499757", "0.6737292", "0.6681251", "0.6659841", "0.66534156", "0.66018605", "0.6596637", "0.65921646", "0.6462643", "0.64394325", "0.63739634", "0.6367312", "0.6353962", "0.6342224", "0.6320168", "0.6247299", "0.62356454", "0.61320055", "0.610...
0.0
-1
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call wait_for_page_to_load.
def click_at locator, coord_string command 'clickAt', locator, coord_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click\n\tbegin\n\t @selenium.click(@locator)\n\trescue => e\n\t sleep(3)\n\t @selenium.click(@locator)\n\tend\n\n\tbegin\n\t @selenium.wait_for_page_to_load\n\trescue => e\n\t sleep(2)\n\t @selenium.wait_for_condition(\"selenium.browserbot.getCurrentWindow()\", TIMEOUT)\n\tend\n\t\n end", ...
[ "0.6902581", "0.6847484", "0.68288517", "0.67822367", "0.66871935", "0.66806656", "0.6621515", "0.6600374", "0.65989035", "0.64404273", "0.6402006", "0.6396098", "0.6364666", "0.6359558", "0.6242625", "0.62425977", "0.621873", "0.62060416", "0.61963314", "0.61458576", "0.6140...
0.0
-1
Explicitly simulate an event (e.g. "focus", "blur"), to trigger the corresponding "on_event_" handler.
def fire_event locator, event_name command 'fireEvent', locator, event_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger(owner, event, *args); end", "def trigger(node, event)\n Capybara.current_session.execute_script(\"arguments[0].#{event}()\", node)\n end", "def on event,&b\n @element.set \"on#{event}\",&b\n end", "def trigger_event(eventSymbol, *args)\n engine.send(eventSymbol, *args)\n end",...
[ "0.65624875", "0.6540697", "0.6539327", "0.6538149", "0.6413261", "0.6406174", "0.63974315", "0.63536614", "0.6310573", "0.62667656", "0.6172383", "0.61198634", "0.61120665", "0.6031996", "0.5956242", "0.59550804", "0.59550804", "0.5951419", "0.59200275", "0.58917105", "0.588...
0.57997626
23
Simulates a user pressing and releasing a key. +keycode+ is the numeric keycode of the key to be pressed, normally the ASCII value of that key.
def key_press locator, keycode command 'keyPress', locator, keycode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 press_keycode(key, metastate: [], flags: [])\n ...
[ "0.7103145", "0.6518238", "0.6518238", "0.6268375", "0.61894727", "0.61248404", "0.61248404", "0.6020581", "0.6017116", "0.59580517", "0.5817396", "0.5737996", "0.57043767", "0.57005626", "0.564944", "0.5619901", "0.56014204", "0.5576751", "0.5564746", "0.5554468", "0.5554468...
0.62748545
4
Simulates a user pressing a key (without releasing it yet). +keycode+ is the numeric keycode of the key to be pressed, normally the ASCII value of that key.
def key_down locator, keycode command 'keyDown', locator, keycode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 press_keycode(key, metastate: [], flags: [])\n ...
[ "0.72402436", "0.68287456", "0.68287456", "0.64481556", "0.63882345", "0.63882345", "0.6264518", "0.6153972", "0.58997905", "0.58930486", "0.5874915", "0.5874915", "0.5845825", "0.5840914", "0.57237774", "0.5711504", "0.5611759", "0.5599707", "0.5574866", "0.5557808", "0.5549...
0.5305396
34
Simulates a user releasing a key. +keycode+ is the numeric keycode of the key to be released, normally the ASCII value of that key.
def key_up locator, keycode command 'keyUp', locator, keycode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def key_released( event )\n @keys -= [event.key]\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_me...
[ "0.6685104", "0.6529529", "0.63903046", "0.62510663", "0.6145858", "0.60009706", "0.5849529", "0.57238495", "0.57238495", "0.5618662", "0.55491483", "0.55491483", "0.5510891", "0.5435164", "0.5338007", "0.5316883", "0.52794236", "0.52316177", "0.522361", "0.5180588", "0.51624...
0.56391865
10
Simulates a user hovering a mouse over the specified element.
def mouse_over locator command 'mouseOver', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_over_element(element)\n driver.action.move_to(element).perform\n end", "def hover_element (element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n wait_until{select.visible?}\n\n select.hover\n end", ...
[ "0.7789843", "0.7561055", "0.75514287", "0.7413604", "0.7379427", "0.72173977", "0.6907109", "0.6802585", "0.677844", "0.6562503", "0.64924705", "0.6471078", "0.6438174", "0.64250255", "0.6333567", "0.6316942", "0.631517", "0.6278317", "0.62777287", "0.6232908", "0.6182475", ...
0.65184844
11
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
def mouse_down locator command 'mouseDown', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press element\n element.perform :press\n end", "def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end", "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def click\n Vedeu.log(type: :input,\n ...
[ "0.7458295", "0.71502155", "0.71259904", "0.6914235", "0.6856933", "0.6848331", "0.6602123", "0.6527265", "0.6421767", "0.6391393", "0.62895757", "0.6270785", "0.62118787", "0.61354506", "0.60891366", "0.6072993", "0.606333", "0.6012703", "0.59778637", "0.59750634", "0.597227...
0.0
-1
Sets the value of an input field, as though you typed it in. Can also be used to set the value of combo boxes, check boxes, etc. In these cases, +value+ should be the value of the option selected, not the visible text.
def type locator, value command 'type', locator, value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(name, value)\n set_text_content(name, 'input-field', @klass, value)\n end", "def set_field(field, value)\n find(:xpath, \"//input[@name='#{field}']\").set(value)\n end", "def text_field_enter(value)\n control = @field.all(:css, 'input[type=\"text\"]').first\n control.set \"#{value...
[ "0.7001082", "0.68968534", "0.6829919", "0.6777252", "0.652977", "0.65186894", "0.6513307", "0.64366263", "0.63665414", "0.63665414", "0.63665414", "0.63572764", "0.6228541", "0.6179237", "0.6179237", "0.6108942", "0.60895807", "0.6083963", "0.6039292", "0.60343057", "0.60145...
0.0
-1
Check a togglebutton (checkbox/radio).
def check locator command 'check', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check\n click unless checked?\n end", "def toggle_field(attrs = {})\n if attrs.has_key?(:checked)\n if attrs[:checked]\n attrs[:checked] = \"checked\"\n else\n attrs.delete(:checked)\n end\n end\n \n check_box(attrs)\n end", "def che...
[ "0.68846136", "0.68083274", "0.6751992", "0.6609702", "0.65960133", "0.6512086", "0.65030104", "0.6387153", "0.638281", "0.63141483", "0.62815034", "0.61913115", "0.61274004", "0.6090666", "0.6074506", "0.60514295", "0.60511833", "0.59693676", "0.5955382", "0.59002954", "0.58...
0.0
-1
Uncheck a togglebutton (checkbox/radio).
def uncheck locator command 'uncheck', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uncheck\n click unless unchecked?\n end", "def unchecks(id_or_name_or_label)\n field = find_field(id_or_name_or_label, CheckboxField)\n field.uncheck\n end", "def uncheck\n action(action: Actions::UNCHECK)\n self\n end", "def uncheck(field_locator)\n locat...
[ "0.8033514", "0.7108564", "0.70739645", "0.69831014", "0.66750646", "0.64087695", "0.6358552", "0.6299613", "0.6103307", "0.6086294", "0.6077194", "0.60344464", "0.5838463", "0.5803889", "0.5675678", "0.55932236", "0.5501412", "0.54863834", "0.5469167", "0.543729", "0.5431399...
0.68385905
5
Select an option from a dropdown using an option locator. Option locators provide different ways of specifying options of an HTML Select element (e.g. for selecting a specific option, or for asserting that the selected option satisfies a specification). There are several forms of Select Option Locator. label=labelPattern matches options based on their labels, i.e. the visible text. (This is the default.) label=regexp:^[Oo]ther value=valuePattern matches options based on their values. value=other id=id matches options based on their ids. id=option1 index=index matches an option based on its index (offset from zero). index=2 If no option locator prefix is provided, the default behaviour is to match on label.
def select locator, option_locator command 'select', locator, option_locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_dropdown(locator, option, method = :value)\n Console.log.info \"Selecting field: #{locator} \\n\\toption: #{option}\n select method: #{method}\"\n select_list = Selenium::WebDriver::Support::Select.new(find(locator))\n select_list.select_by(method, option)\n end", "def select(option_loc...
[ "0.7034256", "0.68587095", "0.67471915", "0.67297506", "0.658079", "0.6499297", "0.64912707", "0.638011", "0.62805694", "0.6278522", "0.62738323", "0.62417895", "0.6230046", "0.61781883", "0.6116308", "0.6002265", "0.5991919", "0.5985307", "0.59189576", "0.58101934", "0.57975...
0.6640405
5
Add a selection to the set of selected options in a multiselect element using an option locator. See the select command for more information about option locators.
def add_selection locator, option_locator command 'addSelection', locator, option_locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_selected_option(option)\n if new_record?\n self.selected_options = build_selected_options\n else\n update_column(:selected_options, build_selected_options(vote_proposal_options + [option]))\n end\n end", "def store_select_options locator, variable_name\r\n command 'storeSelectOptio...
[ "0.66450036", "0.63963354", "0.63625973", "0.60460186", "0.6039635", "0.6022019", "0.6022019", "0.59825194", "0.59673065", "0.5697151", "0.55566144", "0.555519", "0.55261797", "0.5519465", "0.5498487", "0.54579663", "0.5404081", "0.5355633", "0.53060555", "0.52610403", "0.525...
0.669435
1
Remove a selection from the set of selected options in a multiselect element using an option locator. See the +select+ command for more information about option locators.
def remove_selection locator, option_locator command 'removeSelection', locator, option_locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_multi_option_select(how, what)\n select_element=$driver.find_element(how, what)\n select_element.find_elements(:tag_name, \"option\").each do |option|\n if option.selected?\n option.toggle\n end\n end\n end", "def remove_all_selections locator\r\n command 'removeAllSelect...
[ "0.7457269", "0.68023884", "0.67169696", "0.6498675", "0.6164828", "0.6052039", "0.6043551", "0.59594905", "0.5926916", "0.57622933", "0.5711452", "0.569925", "0.5647475", "0.5641553", "0.5609179", "0.55459076", "0.53664416", "0.53641564", "0.5297133", "0.5282017", "0.5189424...
0.7001168
2
Submit the specified form. This is particularly useful for forms without submit buttons, e.g. singleinput "Search" forms.
def submit locator command 'submit', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_form(form)\n @agent.submit(form)\n end", "def submit(form, button = nil, headers = {})\n form.add_button_to_query(button) if button\n\n case form.method.upcase\n when 'POST'\n post_form(form.action, form, headers)\n when 'GET'\n get(form.action.gsub(/\\?[^\\?]*$/, ''),\n ...
[ "0.79387325", "0.76258916", "0.74015117", "0.7384888", "0.7277278", "0.7246576", "0.7137908", "0.710554", "0.70852757", "0.6931294", "0.66373646", "0.66164416", "0.65152353", "0.6364485", "0.6348291", "0.6332506", "0.6279995", "0.6279995", "0.6275278", "0.6264246", "0.6264246...
0.55685633
63
Opens an URL in the test frame. This accepts both relative and absolute URLs. The open command waits for the page to load before proceeding, i.e. you don't have to call +wait_for_page_to_load+. Note: The URL must be on the same domain as the runner HTML due to security restrictions in the browser (Same Origin Policy).
def open url command 'open', url_arg(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(url = @url)\n @browser.goto(url)\n wait_for_page_to_load\n end", "def open_in_browser\n puts url\n `#{open} #{url}`\n end", "def open(url)\n driver.get(url)\n end", "def openURL(step)\n url = @step['Parameter1']\n @browser.goto(url)\n end", "def go()\n\t@selenium.ope...
[ "0.76494616", "0.7229314", "0.6956772", "0.6775287", "0.6741164", "0.6500982", "0.648671", "0.64762646", "0.6465396", "0.6428695", "0.64100754", "0.640556", "0.6404947", "0.63899314", "0.638606", "0.63822156", "0.635228", "0.6344248", "0.62733537", "0.62622356", "0.6247108", ...
0.7124611
3
Selects a popup window; once a popup window has been selected, all commands go to that window. To select the main window again, use +nil+ as the target.
def select_window window_id command 'selectWindow', window_id||'null' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selected_window\n list_windows[@command_window.item]\n end", "def command_select\n @items_window.smooth_move(0 - @items_window.width, @items_window.y)\n @materials_window.smooth_move(0 - @materials_window.width, @materials_window.y)\n #@gold_window.smooth_move(0 - @gold_window.width, @gold_windo...
[ "0.62809134", "0.6073564", "0.6022672", "0.60094774", "0.599787", "0.5973498", "0.59362465", "0.59362465", "0.5925488", "0.58022827", "0.5791248", "0.57736117", "0.571978", "0.5690645", "0.5688694", "0.5666692", "0.5644722", "0.5644722", "0.56007415", "0.56007415", "0.5584952...
0.6254492
2
Waits for a popup window to appear and load up. The +timeout+ is specified in milliseconds.
def wait_for_popup window_id, timeout command 'waitForPopUp', window_id||'null', timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end", "def wait_for_element(element, timeout)\n element.when_present timeout\n element.when_visible timeout\n sleep Utils.click_wait\n end", "def load_window(waittime, window)\n begin\n Timeout::timeout(waittime) do\n ...
[ "0.67727995", "0.65322536", "0.618935", "0.61204183", "0.59789014", "0.5959777", "0.5941881", "0.5924773", "0.5924773", "0.5867076", "0.5864496", "0.5825298", "0.5792088", "0.5713232", "0.5685096", "0.5676842", "0.56285006", "0.5603574", "0.55893207", "0.5570003", "0.5546727"...
0.79213357
1
By default, Selenium's overridden window.confirm() function will return +true+, as if the user had manually clicked OK. After running this command, the next call to confirm() will return +false+, as if the user had clicked Cancel.
def choose_cancel_on_next_confirmation command 'chooseCancelOnNextConfirmation' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm?(text='')\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm?(text)\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm(question)\n CLI::UI.confirm(question)\n end", "def confirm(prompt)\n 'y'\n end", "def confirm(question, append_instructions ...
[ "0.76433855", "0.74781847", "0.7227953", "0.7113574", "0.7058949", "0.7055892", "0.70246726", "0.68944895", "0.67951393", "0.676039", "0.676039", "0.67318195", "0.6710915", "0.6700826", "0.6696433", "0.66524863", "0.66421974", "0.66277665", "0.65891874", "0.65615475", "0.6547...
0.58997667
59
Instructs Selenium to return the specified answer string in response to the next JavaScript prompt (window.prompt()).
def answer_on_next_prompt answer command 'answerOnNextPrompt', answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_prompt(answer)\n\tputs \"The answer to your problem is: #{answer}\"\nend", "def prompt(prompt_string = \"?\", default = \"\")\n print \"#{prompt_string} (#{default}) \"\n response = gets\n response.chomp!\n return response == \"\" ? default : response\n end", "def prompt(question, defau...
[ "0.7306606", "0.69295007", "0.6752206", "0.66363007", "0.6631393", "0.6617939", "0.66150963", "0.65574247", "0.65348", "0.65162057", "0.64809555", "0.6406424", "0.6394429", "0.6394429", "0.63883054", "0.63582027", "0.6341132", "0.6336194", "0.6333684", "0.6318423", "0.6318423...
0.70795363
2
Simulates the user clicking the "back" button on their browser.
def go_back command 'goBack' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_back\n @browser.back\n end", "def back\r\n @browser.navigate.back\r\n end", "def back\n fetch(\"window.history.go(-1)\")\n\n end", "def go_back\n begin\n @driver.back\n\n rescue Exception => e\n @@logger.an_event.error \"browser go back : #{e.message...
[ "0.8658754", "0.8351272", "0.8216751", "0.8181099", "0.8138481", "0.8018701", "0.8018701", "0.793352", "0.7924963", "0.7753032", "0.7753032", "0.7753032", "0.7745229", "0.76320916", "0.75829506", "0.7552698", "0.75072104", "0.74551696", "0.73752326", "0.73166203", "0.73166203...
0.7715111
14
Simulates the user clicking the "Refresh" button on their browser.
def refresh command 'refresh' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh\n @browser.refresh\n end", "def refresh\n driver.navigate.refresh\n end", "def refresh\n driver.navigate.refresh\n end", "def refresh\n driver.navigate.refresh\n end", "def refresh\n send_cmd \"refresh\"\n nil\n end", "def refresh\n command(\"Page.reload\", wai...
[ "0.8199763", "0.7778025", "0.7778025", "0.7778025", "0.77688974", "0.7606692", "0.7599507", "0.73085624", "0.72726357", "0.72669005", "0.7084642", "0.70487535", "0.70370454", "0.696099", "0.6950224", "0.6870822", "0.68665975", "0.68665975", "0.67399365", "0.67103165", "0.6708...
0.7161584
11
Simulates the user clicking the "close" button in the titlebar of a popup window or tab.
def close command 'close' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_window\n end", "def close\n @window.close\n end", "def close\n Window.functions[__method__] ||= AU3_Function.new(\"WinClose\", 'SS', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide)\n nil\n end", "def cookie_popup_close\n get_elem_and_click(:xpath, \"/...
[ "0.75794756", "0.75529367", "0.7407093", "0.72701716", "0.714634", "0.714485", "0.7026673", "0.7026673", "0.68902946", "0.68754786", "0.68754786", "0.6863469", "0.68300515", "0.6789777", "0.67855704", "0.6734649", "0.6690211", "0.6661472", "0.6650177", "0.6628381", "0.6602557...
0.63031524
36
Simulates the user pressing the alt key and hold it down until do_alt_up() is called or a new page is loaded.
def alt_key_down command 'altKeyDown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alt_key_up\r\n command 'altKeyUp'\r\n end", "def enter_alt(alt)\n raise NotImplementedError\n end", "def load_page_with_key_press(key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_loaded(\"\")\n end", "def load_page_with_key_press(k...
[ "0.72400016", "0.6134243", "0.5773372", "0.5773372", "0.5691471", "0.56769526", "0.5587448", "0.5564512", "0.551409", "0.5501384", "0.5487634", "0.5484888", "0.5472499", "0.54629797", "0.5428086", "0.54059994", "0.5395215", "0.5380009", "0.5354265", "0.5317013", "0.53093505",...
0.7090653
1
Simulates the user releasing the alt key.
def alt_key_up command 'altKeyUp' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alt_key_down\r\n command 'altKeyDown'\r\n end", "def key_released( event )\n @keys -= [event.key]\n end", "def button_up(key)\n self.close if key == Gosu::KbEscape\n end", "def key_release *args\n\t\t\tevent(:key_release, *args)\n\t\tend", "def releaseKey(key)\n\t\t@keysPressed.delete(k...
[ "0.71781206", "0.64977336", "0.61834204", "0.61346126", "0.6099386", "0.60806715", "0.5796961", "0.5782629", "0.57585025", "0.57407683", "0.57407683", "0.5729792", "0.5626446", "0.5597214", "0.55585194", "0.5549129", "0.55478543", "0.5514924", "0.5493437", "0.5482966", "0.547...
0.73549134
0
Halt the currently running test, and wait for the user to press the Continue button. This command is useful for debugging, but be careful when using it, because it will force automated tests to hang until a user intervenes manually. NOTE: break is a reserved word in Ruby, so we have to simulate Selenium core's break() with brake()
def brake command 'break' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait\n continue = false\n trap \"SIGINT\" do\n puts \"Continuing...\"\n continue = true\n end\n puts \"Waiting. Press ^C to continue test...\"\n wait_until(3600) { continue }\n trap \"SIGINT\", \"DEFAULT\"\n end", "def _pause_if_needed\n return unless Nenv.cu...
[ "0.6622353", "0.6220131", "0.59026587", "0.584939", "0.5823783", "0.5711176", "0.56882495", "0.5548701", "0.5527768", "0.5438415", "0.5418043", "0.54177445", "0.53967035", "0.537108", "0.5368323", "0.5338758", "0.53374106", "0.53285336", "0.532562", "0.52835774", "0.5270502",...
0.5519459
9
Simulates the user pressing the alt key and hold it down until do_control_up() is called or a new page is loaded.
def control_key_down command 'controlKeyDown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alt_key_up\r\n command 'altKeyUp'\r\n end", "def alt_key_down\r\n command 'altKeyDown'\r\n end", "def control_key_up\r\n command 'controlKeyUp'\r\n end", "def while_key_up *args\n\t\t\tevent(:while_key_up, *args)\n\t\tend", "def ctrl_l() send_keys(:ctrl_l) end", "def send_modified_key(el...
[ "0.7280026", "0.7124824", "0.6042346", "0.5867983", "0.5809598", "0.57798", "0.5756327", "0.5756327", "0.57253754", "0.57208925", "0.57151484", "0.5689603", "0.5664537", "0.5654561", "0.5615121", "0.5611255", "0.5608991", "0.5608974", "0.56033903", "0.5584858", "0.5539292", ...
0.58634657
4
Simulates the user releasing the control key.
def control_key_up command 'controlKeyUp' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_up(key)\n self.close if key == Gosu::KbEscape\n end", "def control_key_down\r\n command 'controlKeyDown'\r\n end", "def key_released( event )\n @keys -= [event.key]\n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def button_down(id)\r\n case id\r\n when...
[ "0.71004444", "0.7075031", "0.6776605", "0.64335394", "0.6366527", "0.6346033", "0.631607", "0.62931114", "0.6287399", "0.6281883", "0.6230533", "0.6169614", "0.61186373", "0.6095681", "0.6080647", "0.6079532", "0.6070555", "0.60401744", "0.6029993", "0.59985405", "0.5992777"...
0.7302922
0
Create a new cookie whose path and domain are same with those of current page under test, unless you specified a path for this cookie explicitly. Arguments: name_value_pair name and value of the cookie in a format "name=value" options_string options for the cookie. Currently supported options include 'path' and 'max_age'. The options_string's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit of the value of 'max_age' is second.
def create_cookie name_value_pair, options_string command 'createCookie', name_value_pair, options_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n ...
[ "0.69611", "0.66825527", "0.6548742", "0.63547105", "0.6351173", "0.6256915", "0.62071717", "0.61513406", "0.6103352", "0.60696465", "0.6057598", "0.6044874", "0.5985113", "0.5978178", "0.59584033", "0.5943332", "0.59138983", "0.5909007", "0.5890583", "0.5864552", "0.5862495"...
0.6608455
2
Delete a named cookie with specified path.
def delete_cookie name, path command 'deleteCookie', name, path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cookie(name); end", "def delete(name)\n @control.delete_cookie(name)\n end", "def delete_cookie name\n @response.delete_cookie name\n end", "def delete_cookie(name)\n browser.delete_cookie(name)\n end", "def delete(name)\n set_cookie(\"name\" => name.to_s, \"value\" => \"\")...
[ "0.80507576", "0.79902595", "0.78462714", "0.78460497", "0.7762308", "0.7753331", "0.7736792", "0.7722644", "0.76973075", "0.766335", "0.7624122", "0.7584712", "0.7552487", "0.74235904", "0.7396429", "0.71628356", "0.69966125", "0.69966125", "0.6991922", "0.69721454", "0.6944...
0.8839943
0
Double clicks on a link, button, checkbox or radio button. If the double click action causes a new page to load (like a link usually does), call wait_for_page_to_load.
def double_click locator command 'doubleClick', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doubleClick\n\t@selenium.double_click(@locator)\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 double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end", "def double_click(nam...
[ "0.72414553", "0.63665897", "0.6324928", "0.6145949", "0.6117014", "0.6070342", "0.5995119", "0.5991177", "0.5963943", "0.59449744", "0.587923", "0.5868195", "0.5858383", "0.58537346", "0.5807184", "0.57931024", "0.57734835", "0.5759906", "0.571925", "0.5707611", "0.56754845"...
0.6170935
3
Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page to load (like a link usually does), call wait_for_page_to_load.
def double_click_at locator, coord_string command 'doubleClickAt', locator, coord_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doubleClick\n\t@selenium.double_click(@locator)\n end", "def click_act_as_link\n act_as_link.click\n sleep(10)\n end", "def click_batch_link\n wait_for_page_and_click batch_link\n end", "def click\n @mech.click self\n end", "def click(link); end", "def click\n @_node.clic...
[ "0.66928685", "0.62854445", "0.6092348", "0.6029516", "0.6002439", "0.5998282", "0.59527886", "0.59223086", "0.5920581", "0.58934367", "0.5889081", "0.5845576", "0.5825619", "0.5805953", "0.5804198", "0.57945234", "0.57842624", "0.5772199", "0.57469606", "0.5745088", "0.57341...
0.0
-1
Drags an element a certain distance and then drops it.
def drag_and_drop locator, movements_string command 'dragAndDrop', locator, movements_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retreat(distance = 1)\n # Don't let the cursor get below zero\n return if @position.x < distance\n\n @position.x -= distance\n end", "def move(distance)\n self.position -= distance\n ensure_bounds\n end", "def shrink_ship\n @length -= 1\n end", "def drop_piece\n return unl...
[ "0.6291463", "0.5994315", "0.5739622", "0.5558997", "0.5538032", "0.54609877", "0.54457396", "0.5436836", "0.54139566", "0.5399398", "0.5311409", "0.52965623", "0.52940357", "0.5273117", "0.52564263", "0.5237877", "0.51937807", "0.51923263", "0.5144261", "0.5097549", "0.50788...
0.0
-1
Drags an element and drops it on another element.
def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graft!(other)\n verify_graft(other)\n other.parent = parent\n parent.children.add other\n parent.children.delete self\n end", "def drop( gobject )\r\n\t\t\t@contents -= [ gobject ]\r\n\t\tend", "def drag_and_drop_by(source, right_by, down_by, device: T.unsafe(nil)); end", "def hand...
[ "0.59738415", "0.5907787", "0.5711887", "0.5687148", "0.56057733", "0.55802524", "0.5513796", "0.55060804", "0.5489238", "0.547944", "0.5426555", "0.53494436", "0.5304165", "0.5298642", "0.52739054", "0.5234847", "0.5163752", "0.5152643", "0.5147337", "0.51200956", "0.510614"...
0.53685355
11
Prints the specified message into the third table cell in your Selenese tables. Useful for debugging.
def echo message command 'echo', message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_doc(retval_arr)\n message = retval_arr[0]\n table = retval_arr[1]\n \n table.each do |row|\n puts row\n end\n puts\n end", "def output\n\t\tif @@message_box.length < 5 \n\t\t\t(5 - @@message_box.length).times { @@message_box << \"\\n\" }\n\t\tend\n\t\tputs @@message_box[0] \n\t\t...
[ "0.5834202", "0.57699615", "0.56857413", "0.56857413", "0.5684039", "0.5614771", "0.5598147", "0.5593911", "0.5524416", "0.5521265", "0.5507472", "0.5472406", "0.54630417", "0.54630417", "0.54630417", "0.54630417", "0.54392004", "0.5431981", "0.5431981", "0.54305005", "0.5425...
0.0
-1
Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.
def highlight locator command 'highlight', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yellow\n colorize(33)\n end", "def yellow\n colorize \"\\033[33m\"\n end", "def highlight(locator)\n execute_script(%(\n arguments[0].style.backgroundColor = '#ff3';\n ), find_element(locator))\n end", "def yellow(string)\n colorize(string, 33)\n end", "def yellow(ou...
[ "0.6527087", "0.6384671", "0.6303622", "0.6282736", "0.62592286", "0.6226689", "0.61911815", "0.5857364", "0.58308905", "0.58069414", "0.58069414", "0.58069414", "0.58069414", "0.5756448", "0.5747222", "0.5741669", "0.5712561", "0.56675494", "0.5649998", "0.56474006", "0.5542...
0.0
-1
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
def meta_key_down command 'metaKeyDown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_key_up\r\n command 'metaKeyUp'\r\n end", "def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end", "def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end", "def load_page_with_key_press(key, *modifiers)\n wait...
[ "0.73959273", "0.5958385", "0.5958385", "0.57138026", "0.57138026", "0.5493059", "0.54181105", "0.5400129", "0.53765786", "0.53765786", "0.5357723", "0.5101127", "0.50555325", "0.50555325", "0.5010577", "0.5010577", "0.4997196", "0.4990738", "0.4990738", "0.4976433", "0.49741...
0.6653389
1
Release the meta key.
def meta_key_up command 'metaKeyUp' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release(key, value)\n return\n end", "def del(key)\n @meta.delete(key.to_sym) if key\n end", "def destroy\n @key.destroy\n end", "def unset key\n storage.delete key\n end", "def delete key\n write_data_entry key, nil, true\n @keydict[key] = nil\n\n sync\n e...
[ "0.7197445", "0.65381044", "0.6269027", "0.61559856", "0.60230446", "0.60089207", "0.60089207", "0.5981219", "0.5959423", "0.5922984", "0.59213674", "0.59212875", "0.5903592", "0.5862747", "0.5847556", "0.57960176", "0.57960176", "0.5795305", "0.5790555", "0.5766674", "0.5737...
0.0
-1
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
def mouse_down_at locator, coord_string command 'mouseDownAt', locator, coord_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press element\n element.perform :press\n end", "def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end", "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def click\n Vedeu.log(type: :input,\n ...
[ "0.7457933", "0.71486145", "0.712525", "0.6915357", "0.6859056", "0.6851255", "0.66038543", "0.65281534", "0.6422567", "0.63917696", "0.62894577", "0.6270494", "0.62123", "0.6135251", "0.6089427", "0.6073249", "0.60639745", "0.6013347", "0.59785193", "0.5976101", "0.59714246"...
0.0
-1
Simulates a user moving the mouse.
def mouse_move locator command 'mouseMove', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_mouse(window_x, window_y)\n old_location = @xdo.mouse.location\n move_mouse_async window_x, window_y\n @xdo.mouse.wait_for_move_from old_location[0], old_location[1]\n end", "def set_mouse_position(x, y); end", "def on_mouse_move(new_point)\n end", "def move_mouse(x_delta, y_delta)\n ...
[ "0.7200083", "0.6847979", "0.6835807", "0.67562014", "0.66624224", "0.6658199", "0.66025347", "0.6555582", "0.652789", "0.6414712", "0.63360834", "0.6311428", "0.6185305", "0.61765814", "0.6164319", "0.6130741", "0.6099895", "0.6095381", "0.6060319", "0.6033424", "0.6031912",...
0.683311
3
Simulates a user moving the mouse relative to the specified element.
def mouse_move_at locator, coord_string command 'mouseMoveAt', locator, coord_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_over_element(element)\n driver.action.move_to(element).perform\n end", "def mouse_over_element(element)\r\n @driver.action.move_to(element).perform\r\nend", "def mouse_move locator\r\n command 'mouseMove', locator\r\n end", "def move_mouse(window_x, window_y)\n old_location = @xdo.m...
[ "0.72543204", "0.7125403", "0.6954894", "0.6909444", "0.67207175", "0.6685737", "0.6566773", "0.6464211", "0.6431148", "0.63728815", "0.635722", "0.6182271", "0.6069073", "0.60624975", "0.60135365", "0.5974087", "0.59176713", "0.5868106", "0.58583367", "0.58514285", "0.584682...
0.6295467
11
Simulates the user moving the mouse off the specified element.
def mouse_out locator command 'mouseOut', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_off(&block)\n self.listen_to :event => :mouseout, &block\n end", "def mouse_over_element(element)\n driver.action.move_to(element).perform\n end", "def mouse_out(mouse_event)\n end", "def mouse_out(e)\n @state = nil\n end", "def mouse_over_element(element)\r\n @driver.action...
[ "0.6569883", "0.6426304", "0.63511056", "0.6227264", "0.611674", "0.59779125", "0.57419497", "0.5704998", "0.5700616", "0.5695627", "0.56000936", "0.54263026", "0.53523606", "0.53523606", "0.5324792", "0.5310525", "0.52759033", "0.5275746", "0.5220234", "0.52154577", "0.52119...
0.63808614
2
Simulates the user releasing the mouse button on the specified element.
def mouse_up locator command 'mouseUp', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_mouse(button)\n XDo::FFILib.xdo_mouseup @_xdo_pointer, @_window, button\n end", "def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend", "def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end", "def mouse_released(componentName, o1 = nil...
[ "0.72497416", "0.65927655", "0.6166525", "0.6025591", "0.58834934", "0.58391625", "0.56883866", "0.5684693", "0.56724447", "0.5662293", "0.5638707", "0.5576783", "0.5576489", "0.55759776", "0.5542504", "0.5527727", "0.54942125", "0.54700303", "0.5426609", "0.5412116", "0.5327...
0.49565053
40
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
def mouse_up_at locator, coord_string command 'mouseUpAt', locator, coord_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def press element\n element.perform :press\n end", "def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end", "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def click\n Vedeu.log(type: :input,\n ...
[ "0.7458295", "0.71502155", "0.71259904", "0.6914235", "0.6856933", "0.6848331", "0.6602123", "0.6527265", "0.6421767", "0.6391393", "0.62895757", "0.6270785", "0.62118787", "0.61354506", "0.60891366", "0.6072993", "0.606333", "0.6012703", "0.59778637", "0.59750634", "0.597227...
0.0
-1
Opens a popup window (if a window with that ID isn't already open). After opening the window, you'll need to select it using the select_window command. This command can also be a useful workaround for bug SEL339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example). In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using an empty (blank) url, like this: open_window("", "myFunnyWindow").
def open_window url, window_id command 'openWindow', url, window_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_window(id)\n driver.switch_to.window(id)\n end", "def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end", "def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end", "def ensure_open_window\n ...
[ "0.69990504", "0.6681354", "0.6681354", "0.66316944", "0.65099555", "0.6451773", "0.6411729", "0.6411729", "0.6404836", "0.62769806", "0.62484086", "0.6238764", "0.621939", "0.6118268", "0.6080029", "0.6063865", "0.60496545", "0.6017028", "0.60162187", "0.59910357", "0.596673...
0.81492454
0
Wait for the specified amount of time (in milliseconds).
def pause wait_time command 'pause', wait_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(seconds)\n @waiting = seconds * 1000\n end", "def wait(timeout, &block)\n end_time = @end_time || (current_time + timeout)\n loop do\n yield(block)\n @remaining_time = end_time - current_time\n break if @remaining_time.negative?\n end\n end", "d...
[ "0.773617", "0.74005187", "0.7322458", "0.7275752", "0.7269518", "0.71708983", "0.7170409", "0.71445405", "0.71216816", "0.7063904", "0.7045436", "0.7031939", "0.6984108", "0.69810474", "0.6970102", "0.6955069", "0.6955069", "0.69401044", "0.6862873", "0.6842004", "0.68379873...
0.6418842
52
Unselects all of the selected options in a multiselect element.
def remove_all_selections locator command 'removeAllSelections', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_multi_option_select(how, what)\n select_element=$driver.find_element(how, what)\n select_element.find_elements(:tag_name, \"option\").each do |option|\n if option.selected?\n option.toggle\n end\n end\n end", "def unselect *params\n opt = parse_params_for_select params\n ...
[ "0.7398284", "0.70754564", "0.6560151", "0.6528219", "0.64798075", "0.646353", "0.6355395", "0.62131923", "0.62049633", "0.6197127", "0.61154103", "0.6053899", "0.5854853", "0.57252765", "0.5656143", "0.55325687", "0.5439404", "0.5435767", "0.5429539", "0.5345924", "0.5334642...
0.648715
4
Selects a frame within the current window. (You may invoke this command multiple times to select nested frames.) To select the parent frame, use "relative=parent" as a locator; to select the top frame, use "relative=top". You may also use a DOM expression to identify the frame you want directly, like this: dom=frames["main"].frames["subframe"]
def select_frame locator command 'selectFrame', locator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame(selector, argument)\n case selector\n when :name\n driver.switch_to.frame(argument)\n when :index\n driver.switch_to.frame(argument.to_i - 1) # index starts from 1 in Watir\n else\n raise OperaWatir::Exceptions::NotImplementedException,\n ...
[ "0.67133945", "0.6637828", "0.6467598", "0.6302869", "0.62870646", "0.6228209", "0.6050934", "0.60387737", "0.59692645", "0.5949901", "0.58981776", "0.58876044", "0.5780057", "0.57478094", "0.5740962", "0.5740382", "0.5737422", "0.572849", "0.57204854", "0.5668381", "0.561242...
0.7479179
0
Moves the text cursor to the specified position in the given input element or textarea. This method will fail if the specified element isn't an input element or textarea.
def set_cursor_position locator, position command 'setCursorPosition', locator, position end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_element(element)\n driver.execute_script('arguments[0].scrollIntoView(true)', element)\n end", "def move_caret_to_mouse\n # Test character by character\n 1.upto(self.text.length) do |i|\n if @window.mouse_x < x + FONT.text_width(text[0...i])\n self.caret_pos = self.selection...
[ "0.5737054", "0.5690897", "0.5686064", "0.5686064", "0.5540334", "0.55158687", "0.5475659", "0.5445528", "0.54310524", "0.5392322", "0.53905773", "0.53389335", "0.5309308", "0.5301979", "0.5290331", "0.52765924", "0.52651703", "0.5264895", "0.52563196", "0.522613", "0.5187994...
0.5751592
0
Configure the number of pixels between "mousemove" events during dragAndDrop commands (default=10). Setting this value to 0 means that we'll send a "mousemove" event to every single pixel in between the start location and the end location; that can be very slow, and may cause some browsers to force the JavaScript to timeout. If the mouse speed is greater than the distance between the two dragged objects, we'll just send one "mousemove" at the start location and then one final one at the end location.
def set_mouse_speed pixels command 'setMouseSpeed', pixels end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mousemove_relative(x, y)\n @logger.info(\"mousemove not supported\")\n end", "def move(x:, y:, steps: 1)\n from_x = @x\n from_y = @y\n @x = x\n @y = y\n\n steps.times do |i|\n new_x = from_x + ((@x - from_x) * ((i + 1) / steps.to_f))\n new_y = from_y + ((@y - from_y...
[ "0.55520976", "0.53963435", "0.53243816", "0.5292193", "0.52682006", "0.52484757", "0.51959443", "0.5171521", "0.5144172", "0.5103676", "0.50555176", "0.50542754", "0.5039077", "0.49192286", "0.48991948", "0.48554626", "0.48400736", "0.48159108", "0.47878376", "0.47598165", "...
0.59022546
0
Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
def shift_key_down command 'shiftKeyDown' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_key_up\r\n command 'shiftKeyUp'\r\n end", "def shift_down\n if GameWindow.instance.button_down?(Gosu::KbRightShift) || GameWindow.instance.button_down?(Gosu::KbLeftShift)\n true\n else\n false\n end\n end", "def ctrl_w() send_keys(:ctrl_w) end", "def shift\n ...
[ "0.7590204", "0.6493804", "0.61667556", "0.6057411", "0.59113073", "0.5875903", "0.5875903", "0.58300763", "0.5730001", "0.57031566", "0.56700045", "0.56697965", "0.5658143", "0.5642233", "0.56276506", "0.56259835", "0.55793124", "0.55793124", "0.5566451", "0.55504555", "0.55...
0.7425063
1
Release the shift key.
def shift_key_up command 'shiftKeyUp' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_key_down\r\n command 'shiftKeyDown'\r\n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def shift\n conn.lpop key\n end", "def release_keysequence(keysequence, delay = 0.012)\n XDo::FFILib.xdo_keysequence_up @_xdo_pointer, @_window, keysequence,\n ...
[ "0.67046523", "0.62143505", "0.6198159", "0.60833585", "0.60808146", "0.6000871", "0.589238", "0.58811814", "0.57741237", "0.57379013", "0.5606869", "0.5606869", "0.5571487", "0.5475465", "0.5427318", "0.5427318", "0.5419669", "0.5419669", "0.53687334", "0.5358958", "0.529877...
0.69267005
0
This command is a synonym for store_expression.
def store expression, variable_name command 'store', expression, variable_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_expression expression, variable_name\r\n command 'storeExpression', expression, variable_name\r\n end", "def store_eval script, variable_name\r\n command 'storeEval', script, variable_name\r\n end", "def eval_expression\n eval(expression, binding)\n end", "def expression; end", "d...
[ "0.8634716", "0.6388004", "0.61340773", "0.60463214", "0.60207146", "0.60176015", "0.59880316", "0.59880316", "0.59457415", "0.58091915", "0.5729557", "0.56832665", "0.5637354", "0.56163424", "0.55896956", "0.55484414", "0.5484326", "0.547495", "0.54747874", "0.5416711", "0.5...
0.8262684
1
Simulates keystroke events on the specified element, as though you typed the value keybykey. This is a convenience method for calling key_down, key_up, key_press for every character in the specified string; this is useful for dynamic UI widgets (like autocompleting combo boxes) that require explicit key events. Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "type_keys" on a form element, you may or may not see the results of what you typed in the field. In some cases, you may need to use the simple "type" command to set the value of the field and then the "type_keys" command to send the keystroke events corresponding to what you just typed.
def type_keys locator, value command 'typeKeys', locator, value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 e...
[ "0.678532", "0.67354816", "0.6682622", "0.63587093", "0.6225669", "0.6225669", "0.6135559", "0.6115631", "0.60594606", "0.6048383", "0.6022832", "0.60227036", "0.59938306", "0.59738773", "0.59339654", "0.59339654", "0.5930502", "0.5903649", "0.58866036", "0.5867132", "0.58555...
0.63075846
4
Gives focus to a window.
def window_focus window_name command 'windowFocus', window_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def focus(window)\n WIN[:focus].call window\n end", "def focus(window)\n WIN[:focus].call window\n end", "def focus_window(win=nil)\n window(win) << '.dialog().dialog(\"focus\");'\n nil\n end", "def focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib....
[ "0.85219616", "0.85219616", "0.8228429", "0.7777055", "0.77721494", "0.75178295", "0.72706217", "0.71527106", "0.68646634", "0.682412", "0.67956877", "0.66836363", "0.66465926", "0.6561443", "0.6542438", "0.64496785", "0.63475627", "0.6340831", "0.6290791", "0.62859464", "0.6...
0.8274748
2
Resize window to take up the entire screen.
def window_maximize window_name command 'windowMaximize', window_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximize_to_screen\n size = execute_script(%(\n return { width: window.screen.width, height: window.screen.height };\n ))\n\n move_window_to(0, 0)\n resize_window_to(size['width'], size['height'])\n end", "def unfullscreen_height\n\n return unless @window\n\n @window.decorated = true\n @...
[ "0.73761135", "0.669949", "0.6638872", "0.6576199", "0.65397024", "0.6513494", "0.6507065", "0.6498855", "0.645071", "0.6394053", "0.63501805", "0.63484734", "0.61672306", "0.6164919", "0.61118096", "0.6039833", "0.59406614", "0.58985895", "0.5883884", "0.5853148", "0.5784310...
0.51145214
85
Writes a message to the status bar and adds a note to the browserside log. +context+ is the message sent to the browser. +log_level_threshold+ can be +nil+, :debug, :info, :warn or :error.
def set_context context, log_level_threshold = nil if log_level_threshold command 'setContext', context, log_level_threshold.to_s else command 'setContext', context end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(context, options = nil)\n options = options.merge(level: 'warning')\n log(context, options)\n end", "def log(context, msg)\n @log << \"#{context}: #{msg}\"\n end", "def notify(message)\n status_bar = @builder['statusbar']\n status_bar.push(status_bar.g...
[ "0.5786788", "0.5582664", "0.5557157", "0.50940627", "0.49781993", "0.48721188", "0.48417515", "0.48007002", "0.47826996", "0.47050846", "0.46999088", "0.46941087", "0.4640209", "0.4624585", "0.46027303", "0.45997378", "0.45621648", "0.45511734", "0.4550646", "0.4541792", "0....
0.6215824
1
Runs the specified JavaScript snippet repeatedly until it evaluates to +true+. The snippet may have multiple lines, but only the result of the last line will be considered. Note that, by default, the snippet will be run in the runner's test window, not in the window of your application. To get the window of your application, you can use the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then run your JavaScript in there. +timeout+ is specified in milliseconds.
def wait_for_condition script, timeout command 'waitForCondition', script, timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breakpoint!(text='Click anywhere to continue...', timeout=0)\n puts \">> breakpoint reached. click anywhere in the browser to continue\"\n\n text = text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n execute_scopejs_script %(\n document.body.appendChild(div(\n {\n id: '_...
[ "0.5836191", "0.574756", "0.56778574", "0.5505119", "0.54550177", "0.538669", "0.5349603", "0.53164285", "0.52733576", "0.5216456", "0.5195725", "0.51545227", "0.51406115", "0.5140196", "0.5140196", "0.5128487", "0.5110636", "0.51089597", "0.5102841", "0.5096742", "0.505757",...
0.5539864
4
Specifies the amount of time that Selenium will wait for actions to complete. Actions that require waiting include +open+ and the wait_for actions. The default timeout is 30 seconds. +timeout+ is specified in milliseconds.
def set_timeout timeout command 'setTimeout', timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_timeout(timeout = nil)\n timeout.nil? ? @open_timeout || DEFAULT_OPEN_TIMEOUT : @open_timeout = timeout\n end", "def open_timeout= open_timeout\n @agent.open_timeout = open_timeout\n end", "def timeout=(timeout)\n @timeout = timeout\n end", "def set_timeout(timeout)\n ...
[ "0.6724241", "0.6654813", "0.66058743", "0.6501768", "0.64912426", "0.6471363", "0.6432314", "0.641971", "0.64179856", "0.6385762", "0.633143", "0.6319724", "0.6307915", "0.6304611", "0.62756854", "0.62651175", "0.6255703", "0.6248465", "0.6204523", "0.6193736", "0.61812675",...
0.62719405
16
Waits for a new page to load. You can use this command instead of the +and_wait+ suffixes, +click_and_wait+, +select_and_wait+, +type_and_wait+ etc. (which are only available in the JS API). Selenium constantly keeps track of new pages loading, and sets a +newPageLoaded+ flag when it first notices a page load. Running any other Selenium command after turns the flag to +false+. Hence, if you want to wait for a page to load, you must wait immediately after a Selenium command that caused a pageload. +timeout+ is specified in milliseconds.
def wait_for_page_to_load timeout command 'waitForPageToLoad', timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_page_load\n @browser.wait_for_load\n end", "def wait(timeout=10)\n Selenium::WebDriver::Wait.new(:timeout => timeout)\n end", "def wait_loading\n puts \"[BrowserOperator] wait_loading\" << '..' * 10\n browser.div(:id, 'pageLoading').wait_while_present()\n end", "def wait_...
[ "0.65442324", "0.64719754", "0.6388002", "0.6318073", "0.62589437", "0.6146749", "0.6137664", "0.60708106", "0.6063093", "0.60538274", "0.60408294", "0.6012535", "0.6002208", "0.59765744", "0.59114164", "0.59082437", "0.59002745", "0.5842679", "0.5834417", "0.5781306", "0.574...
0.7731514
1
utility method for reading yaml data
def read_yaml_file(file) if File.exist?(file) return YAML::load(File.read(file)) end raise "-- ERROR: file doesn't exist: " + file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(filename); end", "def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML ...
[ "0.78454775", "0.7520975", "0.7516884", "0.7506102", "0.7404428", "0.740274", "0.73838675", "0.73838675", "0.7375904", "0.7331", "0.73000216", "0.7194318", "0.7184667", "0.7172474", "0.71660376", "0.7161847", "0.7149153", "0.71231365", "0.71231365", "0.7113149", "0.7084224", ...
0.6371772
68
check connection to Selenium RC
def check_connection one_wait = 5 max_wait = 15 request = Net::HTTP::Get.new('/selenium-server/') wait = 0; while (wait < max_wait) begin response = Net::HTTP.start(@host, @port) {|http| http.request(request) } break if Net::HTTPForbidden === response break if Net::HTTPNotFound === response break if Net::HTTPSuccess === response # When we try to connect to a down server with an Apache proxy, # we'll get Net::HTTPBadGateway and get here rescue Errno::ECONNREFUSED # When we try to connect to a down server without an Apache proxy, # such as a dev instance, we'll get here end sleep one_wait; wait += one_wait end if (wait == max_wait) p("-- ERROR: couldn't connect to Selenium RC on " + @host) return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selenium_env?\n true\nend", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)...
[ "0.630713", "0.6283249", "0.6240378", "0.62243265", "0.6214046", "0.6088339", "0.608336", "0.60715514", "0.6028589", "0.59923273", "0.59914804", "0.5983569", "0.59712005", "0.59671694", "0.59448576", "0.5896287", "0.58333963", "0.5810538", "0.5808582", "0.5798259", "0.5796514...
0.79851687
0
check the page for any abnormalities
def check_page(page) # -- if error is found, it will dump first 2000 characters of the page to the screen raise "-- [ERROR] User name incorrect !\n\n" if /User name or password is incorrect/.match(page) if /An Error Occurred/.match(page) p ("-- Error occured, dumping partial stack trace to the screen...") page[0,2000].each { |s| p s } if page.length >= 2000 raise "-- [ERROR] Exception occured !\n\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_page?\n false\n end", "def guessing?\n ! page.has_content?(\"Your Results\")\n end", "def check_pages\n if pages.length > 0\n return false\n end\n return true\n end", "def error_page?\n popup_msg = get_el(doc.css('div#outsidecontainer'))\n return false if popup_msg...
[ "0.6631442", "0.65320367", "0.6519046", "0.6248915", "0.61190647", "0.60940707", "0.60183764", "0.5983509", "0.5968726", "0.5920787", "0.5914261", "0.59142464", "0.59142464", "0.59142464", "0.59142464", "0.5890747", "0.58886456", "0.5872057", "0.58448946", "0.58171296", "0.57...
0.64959544
3
wait for page to load and verify text
def wait_for_page_and_verify_text(text) @selenium.wait_for_page_to_load(120000) check_page_and_verify_text(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_page_and_verify_text(text)\n #check_page(@selenium.find_element(:id, \"body\").text)\n verify_text(text)\n end", "def wait_page_load(criteria,value,expected_element_text,seconds_wait)\r\n\t \t\ttext_on_page = @driver.find_element(criteria.to_sym, value).text\r\n\t \t\twait_for(seconds_wai...
[ "0.78336734", "0.73089623", "0.7136873", "0.7093599", "0.70578", "0.7016747", "0.69566554", "0.6863478", "0.67435616", "0.673521", "0.673521", "0.66841877", "0.66180944", "0.66152716", "0.65859807", "0.6542829", "0.6514236", "0.6514236", "0.65136313", "0.6485004", "0.64152056...
0.86563647
0
check the page for any abnormalities and verify text
def check_page_and_verify_text(text) #check_page(@selenium.find_element(:id, "body").text) verify_text(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_page(page)\n validator = MarkupValidator.new\n results = validator.validate_text(page)\n return unless results.errors.length > 0\n results.errors.each do |err|\n fail(\"Error #{err.message} on page #{page.current_url}\")\n end\nend", "def check_page(page)\n # -- if error is found, it wi...
[ "0.695017", "0.68800837", "0.6849128", "0.67428565", "0.6643247", "0.66249406", "0.65778935", "0.6534989", "0.6519632", "0.64491427", "0.6311761", "0.6300621", "0.6258856", "0.62335503", "0.6215988", "0.6199817", "0.6123763", "0.60646707", "0.5976177", "0.585029", "0.5847198"...
0.7796433
0
click on something that needs a mouse over
def mouseover_and_click(method, element_over, element_click) p("-- clicking on element: " + element_click.to_s + " by " + method.to_s) @selenium.action.move_to(@selenium.find_element(method, element_over)).perform sleep 5 @selenium.find_element(method, element_click).click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def click; end", "def click; end", "def click; end", "def clicked(mouse_event)\n end", "def hover_click(element)\n driver.action.click(element).perform\n end", "def click\r\n start_point = screen.fin...
[ "0.77243966", "0.76648784", "0.76648784", "0.76648784", "0.7643174", "0.75140417", "0.74957895", "0.71949273", "0.7159618", "0.7159618", "0.7156128", "0.7077946", "0.7069662", "0.7069662", "0.70654905", "0.70642394", "0.7055408", "0.7023907", "0.69852734", "0.69674504", "0.69...
0.6805285
28
click on something that needs a mouse over
def click_by_script(element_click) p("-- execute_script clicking on element: " + element_click.to_s) @selenium.execute_script("document.getElementById('#{element_click}').click();"); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def click; end", "def click; end", "def click; end", "def clicked(mouse_event)\n end", "def hover_click(element)\n driver.action.click(element).perform\n end", "def click\r\n start_point = screen.fin...
[ "0.7725141", "0.7665906", "0.7665906", "0.7665906", "0.7643736", "0.7513308", "0.7496356", "0.7195539", "0.71605915", "0.71605915", "0.7154908", "0.70794725", "0.70690316", "0.70690316", "0.70656794", "0.7064569", "0.70556337", "0.7024552", "0.6985338", "0.69681036", "0.69545...
0.0
-1
setup proper absolute url based on a given relative url
def proper_base_url(relative_url) p("-- evaluating the proper base url to use based on config settings: " + relative_url) if (ENV['qa.base.url'] != nil and ENV['qa.base.url'] != "") p("-- using ENV - URL: " + ENV['qa.base.url']) proper_base = (ENV['qa.base.url'] + relative_url) else p("-- using env.yaml file URL: " + @base_url) proper_base = (@base_url + relative_url) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_url(input); end", "def relative_url_root=(_arg0); end", "def relative_url_root=(_arg0); end", "def make_absolute_url(url)\n return url unless URI.parse(url).relative?\n begin\n URI.parse(@page_url).merge(url).to_s\n rescue URI::Error\n url\n ...
[ "0.7633731", "0.7387293", "0.7387293", "0.7358139", "0.7341919", "0.7237988", "0.7223935", "0.72215563", "0.7171884", "0.71625245", "0.7158445", "0.70986104", "0.70831287", "0.7069311", "0.70651156", "0.70304567", "0.7025488", "0.7025488", "0.7025488", "0.7023712", "0.7014606...
0.6681234
33
setup proper file uri needed for any operations involving selenium.attach_file
def proper_file_uri(file) p("-- setting up proper file uri for file: [ #{file} ]") case RUBY_PLATFORM when /cygwin/, /mswin32/, /i386-mingw32/ new_path = file.gsub(/C:/,'') p("-- new_path (windows only) = #{new_path}") return "file://" + new_path else return "file://" + file end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_url\n file.attached? ? url_for(file) : ''\n end", "def file_url(attachment_name, style=nil); file_path(attachment_name, style); end", "def file_to_uri(file); end", "def file_to_uri(file); end", "def file_url\n end", "def fileUri(f)\n \"file://\" + f.gsub(\" \", \"%20\")\nend", "def attac...
[ "0.640523", "0.633322", "0.62844163", "0.62844163", "0.62150997", "0.61867374", "0.6148343", "0.6095905", "0.60837704", "0.5970621", "0.59636235", "0.5941506", "0.59170514", "0.58973026", "0.58905023", "0.58846337", "0.5863085", "0.58619845", "0.5849972", "0.5843298", "0.5836...
0.59422004
11
phase 2 time complexity= O(n) b/c iterating once through loop
def my_min(list) i = 0 min = list[0] while i < list.length - 1 if list[i + 1] < min min = list[i + 1] end i += 1 end min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_then_iterate_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n hash[i] = index\n end\n indexes = []\n array.each.with_index do |ii, index|\n complement = target - ii \n if hash.has_key?(complement) && hash.fetch(complement) != index\n ...
[ "0.6220414", "0.60307246", "0.60144436", "0.5946644", "0.5867412", "0.58618104", "0.5859785", "0.5846517", "0.5846439", "0.5836396", "0.58059937", "0.5803444", "0.5802831", "0.5777269", "0.57598317", "0.5749091", "0.5745194", "0.57386845", "0.57141775", "0.5694705", "0.566989...
0.0
-1
Phase 1 : O(n^3) because using .sum on sub_arr, which is n^2
def largest_contiguous_subsum_one(list) sub_arr = [] sum = 0 list.each_with_index do |ele, i| (i...list.length).each do |i2| sub_arr << list[i..i2] end end sub_arr.each do |arr| if arr.sum > sum sum = arr.sum end end sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n ...
[ "0.7657547", "0.7573456", "0.755591", "0.7534317", "0.7493759", "0.74923325", "0.74523807", "0.7445718", "0.74379426", "0.7435504", "0.74056447", "0.73941773", "0.7378644", "0.7373692", "0.735482", "0.73370665", "0.73364407", "0.7327034", "0.730906", "0.7296776", "0.7286539",...
0.6828449
80
O(n) time b/c interation done once
def largest_contiguous_subsum_two(list) largest_sum = list[0] current_sum = 0 # list.inject {|acc, ele| acc + ele} list.each do |ele| current_sum = [ele, current_sum + ele].max largest_sum = [largest_sum, current_sum].max end largest_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def cache_intersection2(nums1, nums2)\n outer_cache = {}\n nums1.each do |n|\n next if outer_cache[...
[ "0.617888", "0.5981844", "0.5961592", "0.5759934", "0.57177943", "0.5694345", "0.56548035", "0.5639155", "0.5561465", "0.55609524", "0.5540044", "0.5538744", "0.5538509", "0.5523373", "0.55189", "0.5513113", "0.55106086", "0.5510591", "0.5497293", "0.5452903", "0.5441648", ...
0.0
-1
Returns the org associated with this user
def org client.org(org_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org\n user_id.present? ? User.includes(:org).find_by(id: user_id).org : nil\n end", "def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end", "def org_name\n (org = self.organization) && org.name\n end", "def org\n object.user.org&.handle\n...
[ "0.77694297", "0.69544786", "0.67598236", "0.6711798", "0.66783273", "0.6647725", "0.66399705", "0.6588948", "0.6556434", "0.6502643", "0.64989173", "0.6468849", "0.6464093", "0.64638823", "0.6455913", "0.64344126", "0.6394215", "0.63721603", "0.6369164", "0.6354608", "0.6321...
0.7242927
2
Returns the roles associated with this user
def roles client.user_roles(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roles\r\n @roles ||= user_roles.map(&:name)\r\n end", "def roles\n roles_from_users\n end", "def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end", "def roles\n users.map { |item| item['roles'] }.flatten.uniq\n end", "def roles\n User.valid_roles\n end"...
[ "0.7938685", "0.79179275", "0.7800574", "0.7796106", "0.7716763", "0.76074106", "0.7597818", "0.74161816", "0.73145646", "0.7272813", "0.723718", "0.72232074", "0.7221851", "0.7189618", "0.71150357", "0.7105865", "0.706569", "0.70304334", "0.7020986", "0.6979606", "0.6966958"...
0.8289946
1
Assigns a role to this user
def assign_role(attrs = {}) attrs.merge!(user_id: id) client.assign_role(attrs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_role\n self.add_role!(\"user\")\n end", "def assign_role\n UserRole.create!(user_id: self.id, role_id: 3)\n end", "def assign_role\n member_role = Role.find_by(name: \"member\")\n UserRole.create!(user_id: self.id, role_id: member_role[:id])\n end", "def assign_role(us...
[ "0.8468781", "0.8467363", "0.78720623", "0.7769497", "0.7636212", "0.7557303", "0.7516128", "0.7388484", "0.7382249", "0.7308927", "0.7274297", "0.72372055", "0.7194168", "0.7148235", "0.71345395", "0.7104191", "0.70921385", "0.7081167", "0.7073458", "0.7069615", "0.7066159",...
0.815165
3
end initialize randomly determine if this room will have an enemy
def assign_enemy @has_enemy = rand(1..2)==1 ? true : false #need an enemy value for the room. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enemy_spawned\n enemy_chance = ENEMY_CHANCE_BASE + (@dungeon.level + ENEMY_CHANCE_MOD)\n enemy_chance > rand(100)\n end", "def initialize\n\t\t@enemy = Faker::Name.name\n\tend", "def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n...
[ "0.69565105", "0.6906241", "0.6625656", "0.63867354", "0.63012457", "0.6231034", "0.6211345", "0.6169772", "0.6159238", "0.61444336", "0.60514855", "0.6046907", "0.6016638", "0.60012096", "0.59872174", "0.5908169", "0.58994263", "0.5892252", "0.5884431", "0.5868357", "0.58171...
0.8208505
0
rubocop:enable Metrics/LineLength Creates the URL used for the request.
def url query_url = "#{@url}?q=#{@query}&locale=#{@locale}" query_url << @topics.map { |t| "&topic=#{t}" }.join unless @css_classnames.nil? query_url << "&css_classnames=#{@css_classnames}" end unless @html_attributes.nil? query_url << "&html_attributes=#{@html_attributes}" end query_url << "&highlight=#{@highlight}" unless @highlight.nil? query_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n connection.build_url(url_chunk, params).to_s\n end", "def url\n @url = \"#{@http_mode}://#{self.config.servers[0]}\"\n @url << \"/#{self.config.context}\" if(!self.config.context.empty?)\n #self.config.log.debug_msg(\"Request base URL: #{@url}\")\n @url\n end", "def build_req...
[ "0.79256886", "0.76372886", "0.7559733", "0.7554872", "0.74251467", "0.740126", "0.73417807", "0.73393553", "0.7303162", "0.7298028", "0.7280037", "0.7277138", "0.72542083", "0.72521514", "0.7232481", "0.72272193", "0.72254086", "0.72081095", "0.7190887", "0.7185013", "0.7158...
0.0
-1
Executes the search request.
def execute @result = MdnQuery::SearchResult.from_url(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search\n send_request\n parse_response\n end", "def execute\n @model_class.search(KEYWORD)\n end", "def search\n request.write_attributes request_attributes\n @search ||= request.call\n end", "def execute_search(query)\n search_resource.retrieve(query)\n ...
[ "0.77357465", "0.7695561", "0.7516592", "0.7478814", "0.7317463", "0.7143135", "0.7113031", "0.7112886", "0.70571756", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70462066", "0.70382786", "0....
0.0
-1
Opens the search in the default web browser.
def open html_url = url.sub('.json?', '?') Launchy.open(html_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_browser_with_search(url)\n Launchy.open(url)\nend", "def open_url(term)\n Defcli.open_in_browser search_url(term, :api => false)\n end", "def launch_google_search\n\tLaunchy.open(build_google_search_url)\nend", "def open\n @url = @@youtube_search_base_url + CGI.escape(@keyword)\n ...
[ "0.79448956", "0.75041556", "0.71196944", "0.711244", "0.6867619", "0.6844488", "0.6661564", "0.66269666", "0.649552", "0.6479327", "0.646072", "0.6459731", "0.64449185", "0.6431792", "0.6350298", "0.62809044", "0.6280005", "0.626477", "0.62639666", "0.62571853", "0.621979", ...
0.54774517
97
This makes it easier to spit debugging output to the console. I know I should probably raise exceptions and rescue them, but this is easier. Sue me. Lifted it from jCaster by Jahmaican.
def debug(message) puts "#{Time.now.strftime("%H:%M:%S.%L")} - \t#{message}" if DEBUG end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end", "def debug(text)\n\t\t\tputs text\n\t\t\tnil\n\t\tend", "def print_debug(s)\n config = BeEF::Core::Configuration.instance\n if config.get('beef.debug') || BeEF::Core::Console::CommandLine.parse[:verbose]\n puts Time.now.localtime.strftime(\"...
[ "0.7503434", "0.72581583", "0.714772", "0.7105997", "0.70850897", "0.70751613", "0.70411223", "0.7024826", "0.7006772", "0.69851106", "0.6956015", "0.69428015", "0.6932931", "0.6926794", "0.69198", "0.69165254", "0.69165254", "0.69165254", "0.69165254", "0.69093454", "0.69001...
0.699691
9
Theese are clever and Spooner is a clever man. Also handsome I presume.
def image(name) File.expand_path("tex/#{name}", File.dirname(__FILE__)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spice; end", "def slop!; end", "def slop!; end", "def sharp; accidental; end", "def silly_adjective; end", "def anchored; end", "def buzzword; end", "def buzzword; end", "def most_interesting_man_in_the_world; end", "def sittinae_hooey(scrawny_appulsion, termly)\n end", "def king_richard...
[ "0.6379332", "0.63596606", "0.63596606", "0.63306624", "0.6174131", "0.6155675", "0.6152491", "0.6152491", "0.60627466", "0.60491794", "0.59868675", "0.59827286", "0.5967649", "0.5907232", "0.587368", "0.5872149", "0.58635366", "0.5839072", "0.5833563", "0.58112806", "0.57955...
0.0
-1
Hate programs that hide the cursor.
def needs_cursor? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_cursor(&blk)\n out = esc_code(\"?25l\")\n out << (yield + show_cursor) if block_given?\n out\n end", "def hide_cursor!\n Vedeu.bind(:_hide_cursor_) do |name|\n Vedeu::Cursors::Cursor.hide_cursor(name)\n end\n\n Vedeu.bind_alias(:_cursor_hide_, :_hide_curso...
[ "0.777212", "0.7412854", "0.740636", "0.691776", "0.68918735", "0.6876815", "0.6553782", "0.6486334", "0.6366664", "0.6337149", "0.6320831", "0.6273997", "0.62441057", "0.6241223", "0.6221764", "0.6200152", "0.6200152", "0.61964744", "0.61131525", "0.6094207", "0.6084147", ...
0.0
-1
I'm aware that a lot of these could be oneline'd. I'll probably do that once I'm done.
def button_down(id) # Exit on escape if id == Gosu::KbEscape close end # Cursor Movement # NSEW = 0123 if id == Gosu::KbUp @player.move(0) end if id == Gosu::KbDown @player.move(1) end if id == Gosu::KbRight @player.move(2) end if id == Gosu::KbLeft @player.move(3) end # Camera Movement # These should probably be farther from the load/save keys heh if id == Gosu::KbI if @zoom @camera_y -= 16 * 4 else @camera_y -= 16 end end if id == Gosu::KbK if @zoom @camera_y += 16 * 4 else @camera_y += 16 end end if id == Gosu::KbJ if @zoom @camera_x -= 16 * 4 else @camera_x -= 16 end end if id == Gosu::KbL if @zoom @camera_x += 16 * 4 else @camera_x += 16 end end if id == Gosu::KbM # Toggle lame, janky zoom @zoom = !@zoom # If we're turning zoom on, set the camera so it zooms # to the area the cursor is at, if we're turning zoom off # then just reset the camera to show the full editor field. if @zoom @camera_x = @player.x @camera_y = @player.y else @camera_x = 0 @camera_y = 0 end end # Editor Functions if id == Gosu::KbQ # Scroll left through sprites @player.change(1) end if id == Gosu::KbW # Scroll right through sprites @player.change(2) end if id == Gosu::KbA # Place a tile as a world tile @player.place(1) end if id == Gosu::KbS # Place a tile as a prop, draw above world tiles @player.place(2) end if id == Gosu::KbD # Clear a tiles world/prop/collision info, setting it to nil @player.place(3) end if id == Gosu::KbZ # Mark a tile for collision, only drawn in the editor @player.place(4) end if id == Gosu::KbX # Turn on/off drawing of the red cross-circle that shows where colliders are @map.draw_colliders? end # Save / Load Functions (Still Experimental, but working) # Make sure that the file you're trying to load was made # by the same version of Tyle you're using now, else oddness. if id == Gosu::KbO and DEBUG @map.save(FILENAME) end if id == Gosu::KbP and DEBUG @map.load(FILENAME) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probers; end", "def anchored; end", "def leading; end", "def offences_by; end", "def prev_line=(_arg0); end", "def _reduce_279(val, _values, result)\n result = lexer.line\n \n result\nend", "def lines_of_code; end", "def lines_of_code; end", "def _redu...
[ "0.6078793", "0.5748514", "0.56736916", "0.5663739", "0.56608784", "0.5620129", "0.558306", "0.558306", "0.5547612", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55468225", "0.55...
0.0
-1
extensions gets ticket info for a customer
def tickets sql = "SELECT * FROM tickets" values = [] tickets = SqlRunner.run(sql, values) result = tickets.map { |ticket| Ticket.new( ticket ) } return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket\n @ticket ||= @api.get_ticket['ticket']\n end", "def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticke...
[ "0.6394352", "0.62665135", "0.6226859", "0.61970973", "0.61841875", "0.6138204", "0.61339986", "0.60128057", "0.5964505", "0.5924771", "0.575046", "0.572894", "0.5717856", "0.570582", "0.56874347", "0.5683602", "0.56818885", "0.56806976", "0.56692535", "0.5665405", "0.5626412...
0.0
-1
counts tickets using ticket info array
def count_tickets tickets = self.tickets total_tickets = tickets.count return total_tickets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_count()\n sql = \"SELECT * FROM tickets WHERE customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values).count\n end", "def ticket_status_count\n @ticket_status_count ||= begin\n counts = { \"a\" => 0, \"t\" => 0, \"f\" => 0 }\n counts.merge! assigned_tickets.joins(...
[ "0.7177721", "0.7157538", "0.6958222", "0.6901622", "0.68093836", "0.6690278", "0.66766125", "0.6598204", "0.6578278", "0.6473234", "0.6434859", "0.63869476", "0.6377115", "0.636177", "0.6310528", "0.6284032", "0.62742954", "0.6266023", "0.6170504", "0.61330384", "0.6131447",...
0.7386948
0
finds films a customer has tickets for
def find_films_for_each_customer() sql = "SELECT films.* FROM films INNER JOIN tickets ON tickets.film_id = films.id WHERE customer_id = $1" values = [@id] films = SqlRunner.run(sql, values) result = films.map {|film| Film.new(film)} return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON films.id = tickets.film_id WHERE tickets.cust_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n return films.map{|film| Film.new(film)}\n end", "def films()\n sql = \"SELECT films.* FROM films INNER JOIN...
[ "0.7041169", "0.701063", "0.6978453", "0.6934411", "0.693054", "0.6916352", "0.6895286", "0.6894089", "0.68539536", "0.68207324", "0.6804413", "0.66908926", "0.665471", "0.6647484", "0.6644531", "0.65750116", "0.64996165", "0.6306582", "0.62558943", "0.6215381", "0.6206336", ...
0.73953915
0
this finds the prices for films for a given customer and deducts the total from the customers funds
def remaining_funds() films = self.find_films_for_each_customer() film_fees = films.map{|film| film.price} combined_fees = film_fees.sum return @funds - combined_fees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge_customer()\n array = find_films()\n # charge = ticket_cost\n for film in array\n result = @funds - film.price\n @funds = result\n end\n update\n end", "def buy()\n #films the customer has tickets to\n all_films = films()\n #sum the films (as there can be more than o...
[ "0.7474738", "0.69729006", "0.67230946", "0.62753093", "0.621499", "0.6142677", "0.6037939", "0.60324466", "0.59905887", "0.59789115", "0.59513146", "0.59442306", "0.58459556", "0.58428806", "0.5828465", "0.58105665", "0.5749559", "0.57456857", "0.57196444", "0.5707163", "0.5...
0.7547074
0
GET /distbutors GET /distbutors.json
def index @distbutors = Distbutor.page(params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def show\n @distraction = Distrac...
[ "0.62634605", "0.61989284", "0.6035241", "0.5979277", "0.5971823", "0.59544146", "0.5891396", "0.58873403", "0.5730069", "0.5730069", "0.5672024", "0.5668034", "0.5627325", "0.5575577", "0.55638367", "0.5561043", "0.5556489", "0.55507624", "0.55352765", "0.55317676", "0.55277...
0.6895203
0
GET /distbutors/1 GET /distbutors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @distbutors = Distbutor.page(params[:page])\n end", "def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end", "def show\n @distro = Distro.find(params[:id])\n...
[ "0.68222576", "0.65873146", "0.6289365", "0.6289365", "0.62845737", "0.6253436", "0.6049037", "0.5935956", "0.5915018", "0.5870223", "0.58035475", "0.57883215", "0.5718036", "0.5692167", "0.5684572", "0.56815994", "0.5675257", "0.56667966", "0.5650225", "0.5612822", "0.560673...
0.0
-1
POST /distbutors POST /distbutors.json
def create permision_ok = true distbutor_save = false @distbutor = Distbutor.new(distbutor_params) unless params[:distbutor][:primary_dist_id].nil? params[:distbutor][:included_cities].each do |city_id| if city_id != "" city = City.find_by(id: city_id) state_id = city.state_id country_id = city.state.country_id permision_ok = false unless check_premisions(params[:distbutor][:primary_dist_id], country_id, state_id,city_id) end end if permision_ok params[:distbutor][:included_states].each do |state_id| if state_id != "" country_id = State.find_by(id: state_id).country_id permision_ok = false unless check_premisions(params[:distbutor][:primary_dist_id], country_id, state_id,"") end end end if permision_ok params[:distbutor][:included_countries].each do |country_id| if country_id != "" permision_ok = false unless check_premisions(params[:distbutor][:primary_dist_id], country_id, "","") end end end end (params[:distbutor][:included_countries] - State.where(id: params[:distbutor][:included_states]).pluck(:country_id).uniq).each{ |country_id| @distbutor.included_countries.build country_id: country_id if country_id != ""} (params[:distbutor][:included_states] - City.where(id: params[:distbutor][:included_cities]).pluck(:state_id).uniq).each{ |state_id| @distbutor.included_states.build state_id: state_id if state_id != ""} params[:distbutor][:included_cities].each{ |city_id| @distbutor.included_cities.build city_id: city_id if city_id != ""} (params[:distbutor][:excluded_states] - City.where(id: params[:distbutor][:excluded_cities]).pluck(:state_id).uniq).each{ |state_id| @distbutor.excluded_states.build state_id: state_id if state_id != ""} params[:distbutor][:excluded_cities].each{ |city_id| @distbutor.excluded_cities.build city_id: city_id if city_id != ""} respond_to do |format| if permision_ok distbutor_save = @distbutor.save end if distbutor_save format.html { redirect_to @distbutor, notice: 'Distbutor was successfully created.' } format.json { render :show, status: :created, location: @distbutor } else format.html { render :new } format.json { render json: @distbutor.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @distraction = Distraction.new(params[:distraction])\n\n respond_to do |format|\n if @distraction.save\n format.html { redirect_to @distraction, notice: 'Distraction was successfully created.' }\n format.json { render json: @distraction, status: :created, location: @distractio...
[ "0.61072874", "0.5995997", "0.58573854", "0.5799921", "0.57047284", "0.56995595", "0.56933165", "0.566171", "0.5570877", "0.5405011", "0.5402178", "0.5346824", "0.5346824", "0.5345333", "0.532258", "0.53208166", "0.531193", "0.5310517", "0.5310517", "0.530808", "0.5288895", ...
0.5391399
11
DELETE /distbutors/1 DELETE /distbutors/1.json
def destroy @distbutor.included_countries.destroy_all @distbutor.included_states.destroy_all @distbutor.included_cities.destroy_all @distbutor.excluded_states.destroy_all @distbutor.excluded_cities.destroy_all @distbutor.destroy respond_to do |format| format.html { redirect_to distbutors_url, notice: 'Distbutor was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @distraction = Distraction.find(params[:id])\n @distraction.destroy\n\n respond_to do |format|\n format.html { redirect_to ...
[ "0.6996186", "0.6981359", "0.69567233", "0.69200337", "0.68614525", "0.6808126", "0.6790421", "0.6625706", "0.6623951", "0.659913", "0.6594662", "0.65899205", "0.658851", "0.6575037", "0.65534484", "0.65463495", "0.6545203", "0.6527783", "0.65192175", "0.651793", "0.6515166",...
0.66952485
7
Use callbacks to share common setup or constraints between actions.
def set_distbutor @distbutor = Distbutor.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_...
[ "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.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def distbutor_params params.require(:distbutor).permit(:name) 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...
[ "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.0
-1
41 is length of longest name 40 is it's index
def list_attractions RhodyAttractions::Attraction.all.each do |attraction| attraction.print_description("short") puts "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_prefix(name)\n @symbols.longest_prefix(to_name(name))\n end", "def player_with_longest_name\n longestName.max_by(&:length)\nend", "def player_with_longest_name\n max_name = 0\n player_name = ''\n game_hash.keys.each do |location|\n game_hash[location][:players].keys.each do |name...
[ "0.7096635", "0.7046407", "0.70287293", "0.69985527", "0.69791913", "0.69025165", "0.68990815", "0.68937486", "0.6845222", "0.6801561", "0.6721561", "0.6589064", "0.6568624", "0.65534824", "0.6535399", "0.6535027", "0.6529037", "0.65270656", "0.65081954", "0.6500504", "0.6484...
0.0
-1