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
Does the bulk of the work, processes messages. Should be overridden by subclasses.
def bot_main(line) puts "IRCBot::bot_main called." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_msgs\n end", "def process_messages\n # Check status for all streams, reopen as necessary\n @streams.each { |_, stream| try { stream.keep_alive } }\n\n # Actual processing of incoming messages happens in event callbacks\n # Oбрабатываем пришедшее сообщение в интерфейсах обратн...
[ "0.7840806", "0.7041069", "0.6972339", "0.67646813", "0.6732298", "0.66977376", "0.66924584", "0.6595347", "0.6574932", "0.65526336", "0.6493054", "0.64361125", "0.6417113", "0.64158845", "0.637989", "0.63761836", "0.63350827", "0.6334679", "0.62840426", "0.62570053", "0.6242...
0.0
-1
Connects to an IRC channel.
def connect say "NICK #{@botname}" say "USER #{@botname} 0 * #{@botname}" say "JOIN #{@channel}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n # We open a new socket connection to the server @server on port @port\n @socket = TCPSocket.open(@server, @port)\n\n # We send an IRC message that's sets the bot's nickname to @name\n irc_send(\"NICK #{@name}\")\n\n # We send an IRC message that's sets users usename and real name to @name\n irc...
[ "0.71047604", "0.706354", "0.68760926", "0.66772515", "0.66203517", "0.6535149", "0.6414526", "0.6401191", "0.6369956", "0.62712216", "0.6241284", "0.6221508", "0.59710175", "0.5955294", "0.59385264", "0.591271", "0.5877955", "0.5867593", "0.58107543", "0.57957536", "0.575069...
0.7220649
0
The main loop. Reads every single message from the IRC server, passes relevant messages along to the bot_main method, which can be overriden by subclasses.
def run until @socket.eof? do line = @socket.gets # Makes sure your bot doesn't timeout! if line.match(PING_MSG) say "PONG #{ $~[1]}" else bot_main(line) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n\t\n\t\twhile true \t\t\t\t\t\t# run forever\n\t\t\n\t\t\tready2read = sockets_ready_for_reading()\n\t\t\t\n\t\t\tnext if not ready2read \t\t\t# if nil, loop again\n\t\n\t\t\tputs \"<Debug> ready2read=#{ready2read.inspect}\" if $DEBUG\n\n\t\t\tready2read.each do |socket|\t\t\n\t\t\t\n\t\t\t\tif socket ==...
[ "0.70785874", "0.6956789", "0.6863956", "0.68116176", "0.6789141", "0.67665297", "0.6660305", "0.6634128", "0.66222054", "0.66127837", "0.6546618", "0.6526205", "0.6518651", "0.6482812", "0.6454105", "0.64490694", "0.6360895", "0.63485926", "0.6281575", "0.62203556", "0.62177...
0.70678794
1
false, false, false, true, true 2
def caps (string) if string.length > 10 string.upcase else string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exercise_1111 (bool_values)\n end", "def reduce_to_all_true(array)\n if array.include? false\n false\n elsif array.each.include? true\n true\n end\nend", "def match_maker setter, *args\n pairs = []\n args.to_a.each_slice(2) do |a,b|\n a = !!a#this will set show if the value is true or...
[ "0.66567415", "0.6522486", "0.61647666", "0.61403984", "0.6131994", "0.60974216", "0.60948443", "0.60948443", "0.60356", "0.6014018", "0.59966475", "0.5971628", "0.59662473", "0.5966002", "0.5920483", "0.5911814", "0.5897475", "0.5889801", "0.5859827", "0.58551455", "0.584679...
0.0
-1
4 false, 'did you get it right?', Alright now! 5
def evaluate_num(num) case when num < 0 puts "please follow directions better" when num < 51 puts " your number is between 0 and 50" when num < 101 puts "your number is between 50 and 100" else number > 100 puts "plelase follow directions better" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revealed? ; false ; end", "def success?() end", "def correction?\n false\n end", "def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n end", "def check ; true ; end", "def at...
[ "0.66982734", "0.66411245", "0.6582534", "0.65562814", "0.6523054", "0.6518347", "0.63913286", "0.63890344", "0.6282984", "0.62385255", "0.6224576", "0.62209374", "0.62201804", "0.61883587", "0.6167412", "0.6160822", "0.61418957", "0.61418957", "0.61331785", "0.61213255", "0....
0.0
-1
Returns a String containing the Python version. This only includes the numerical value, the prefix "Python " is not included.
def python_version return `python --version 2>&1`.split(/([\d\.]+)/)[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def xy\n \"python#{version.major}.#{version.minor}\"\n end", "def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure abou...
[ "0.7028041", "0.69697213", "0.69632125", "0.6897926", "0.6746016", "0.67151785", "0.67070574", "0.6607704", "0.660699", "0.66069275", "0.64978004", "0.64455014", "0.6368314", "0.63500357", "0.63500357", "0.6349569", "0.6342794", "0.6322667", "0.6322667", "0.6322458", "0.63217...
0.80356896
0
Returns a String containing the Pip version in a RubyGems compatible format.
def pip_version return `pip --version 2>&1`.match(/pip\s+([\d\.]+)/)[1].chomp('.') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end", "def gem_version_str(gem)\n return '' unless gem.version\n\n # \"#{gem.version ? \", '#{gem.version}'\" : ''}\"\n \", '#{gem.version}'\"\nend", "def version\n @gemspec.version || @version_helper.to_s\n end", "def version_string(depen...
[ "0.7375572", "0.691535", "0.68831897", "0.6881082", "0.6843599", "0.66399133", "0.6622717", "0.66170734", "0.6494885", "0.6467757", "0.6312123", "0.6299154", "0.6277114", "0.62719786", "0.6248996", "0.62114537", "0.6196941", "0.6183662", "0.6183662", "0.6183662", "0.6183662",...
0.6912522
2
Installs the packages in the requirements file in a specific directory.
def pip_install(file, target) Rake::FileUtilsExt.sh( "pip install --requirement=#{file} --target=#{target} " \ "--ignore-installed" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_python_packages(requirements, directory)\n return unless directory_contents(directory).empty?\n\n pip_install(requirements, directory)\n end", "def install\n cd_and_sh( pkg_dir, install_commands )\n end", "def install\n install_gems(dependencies)\n end", "def instal...
[ "0.7984898", "0.72667426", "0.71790177", "0.6537569", "0.65261376", "0.6481402", "0.6452815", "0.6440559", "0.64120406", "0.6410123", "0.64025885", "0.6400301", "0.6370808", "0.63470095", "0.63223594", "0.63208663", "0.6307851", "0.63015544", "0.62964547", "0.62756616", "0.62...
0.5795899
90
Installs a set of Python packages in a given directory based on a requirements file. If the directory is not empty this process is aborted.
def install_python_packages(requirements, directory) return unless directory_contents(directory).empty? pip_install(requirements, directory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def install\n install_gems(dependencies)\n end", "def install\n cd_and_sh( pkg_dir, install_co...
[ "0.68916804", "0.67640716", "0.6762402", "0.6352384", "0.6301814", "0.62347883", "0.6198691", "0.61870337", "0.6179981", "0.6098434", "0.60423255", "0.602834", "0.6026522", "0.60246634", "0.599553", "0.59788585", "0.59758997", "0.59713453", "0.5954743", "0.5951154", "0.593121...
0.79555345
0
Creates event callback function for provided event_id
def event_callback_for(event_id, &block) event_id_sym = event_id.is_a?(Symbol) ? event_id : enum_type(:event_id)[event_id] callback_name = EVENT_ID_TO_CALLBACK.fetch(event_id_sym) callback_function(callback_name) do |*args| Util.log(:debug, name) { ".event_callback_for #{event_id_sym} CALLBACK #{args.map(&:to_s).join(', ')}," } block.call(*args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event(&blk)\n setup_event(Event.new, &blk)\n end", "def create_event(&blk)\n setup_event(Event.new, &blk)\n end", "def find_or_create_event_by_id(id, &blk)\n setup_event(find_event_by_id(id)[0] || Event.new, &blk)\n end", "def bind_event(event_name, cb_proc)\n event_call...
[ "0.62700474", "0.62700474", "0.6137428", "0.61329013", "0.61004585", "0.60626644", "0.6058835", "0.59284467", "0.5916653", "0.5916653", "0.5916653", "0.5916653", "0.5898772", "0.58287567", "0.5826175", "0.57910836", "0.5724817", "0.5653327", "0.5653327", "0.56499267", "0.5646...
0.794502
0
Saves insumo from new and edit.
def save # If we have ID param this isn't a new insumo if params[:id] @new_product = false @title = "Editar Insumo" @insumo = Insumo.find(params[:id]) else @new_product = true @title = "Nuevo Insumo" @insumo = Insumo.new end @insumo.attributes = params[:insumo] if @insumo.save flash[:notice] = "El Insumo '#{@insumo.name}' Fue Guardado." end render :action => 'edit' and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n temp = eval(self.class.name.to_s + \".find(\" + self.id.to_s + \")\") unless self.new_record? ## moze to zmienic, zeby nie odwolywac sie dodatkowo do bazy ? ;)\n \n ##DO ZMIANY PO ZAINSTALOWANIU BORTA \n self.edited_by = 33\n #self.edited_by = current_user.id\n self...
[ "0.6420873", "0.6393657", "0.635064", "0.635064", "0.6344023", "0.6288675", "0.6266095", "0.62521666", "0.6250807", "0.620609", "0.620609", "0.620609", "0.618785", "0.6183778", "0.6181814", "0.6181814", "0.6178407", "0.6168301", "0.61633843", "0.6162941", "0.60814863", "0.6...
0.8021999
0
Use callbacks to share common setup or constraints between actions.
def set_admin_chatting @admin_chatting = AdminChatting.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.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def admin_chatting_params params.require(:admin_chatting).permit(:admin_id, :chat_id) 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
GET /trips GET /trips.json
def index @trips = current_user.trips_validated @pending_trips = current_user.pending_trips @visitor = current_user respond_to do |format| format.html{} format.js{} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trips\n get '/gtfs/trips'\n end", "def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end", "def index\n @trips = Trip.all\n\n render json: @t...
[ "0.819985", "0.8043565", "0.7999928", "0.7999928", "0.7953077", "0.79234964", "0.7489612", "0.7489612", "0.7489612", "0.7489612", "0.7489612", "0.7489612", "0.7489612", "0.74755937", "0.7470587", "0.74533826", "0.7362053", "0.73253477", "0.73083544", "0.72763485", "0.72763485...
0.630154
59
GET /trips/1 GET /trips/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n @trips = Trip.all...
[ "0.79471594", "0.77817446", "0.77817446", "0.77365565", "0.77221555", "0.76181865", "0.74433213", "0.7313426", "0.72672933", "0.72672933", "0.72672933", "0.72672933", "0.72672933", "0.72672933", "0.72672933", "0.716429", "0.7132913", "0.7085405", "0.70826983", "0.70765644", "...
0.0
-1
POST /trips POST /trips.json
def create @trip = Trip.new(trip_params) respond_to do |format| if @trip.save format.html { redirect_to current_user, notice: 'Trip was successfully created.' } format.json { render :show, status: :created, location: @trip } else format.html { redirect_to current_user, notice: "Trip can't be created" } format.json { render json: @trip.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trips\n get '/gtfs/trips'\n end", "def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n ...
[ "0.7208045", "0.70307076", "0.6864295", "0.68321437", "0.6772133", "0.6772133", "0.6692161", "0.66867685", "0.664916", "0.6610407", "0.6559959", "0.6522311", "0.6514665", "0.6384032", "0.63697636", "0.6347624", "0.6323213", "0.6318997", "0.6318997", "0.6318997", "0.6318997", ...
0.6233168
29
PATCH/PUT /trips/1 PATCH/PUT /trips/1.json
def update @trip = Trip.find(params[:id]) if params[:update] validated = true end respond_to do |format| if @trip.update(validated: validated) if validated == true @trip.participants.each do |u| u.update(token: u.token + 5) end format.js { render :layout => false , notice: 'Success of acceptance of correspondance status' } else flash[:danger] = 'Failure of modification of correspondance status.' redirect_to current_user end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6753414", "0.6745457", "0.6705941", "0.6705941", "0.67014813", "0.66956455", "0.65351546", "0.6472922", "0.6462587", "0.6443802", "0.6443802", "0.64272237", "0.64204776", "0.6391238", "0.63633406", "0.6357337", "0.6348993", "0.63472474", "0.6330405", "0.6330405", "0.633040...
0.0
-1
DELETE /trips/1 DELETE /trips/1.json
def destroy @trip = Trip.find(params[:id]) @trip.destroy respond_to do |format| format.html {} format.js { render :layout => false } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end", "def delete\n @trip = Trips.find_trip( params[ :id ])\n end", "def destroy\n @trip = Trip.find(par...
[ "0.74131525", "0.7404101", "0.73837495", "0.73837495", "0.7373286", "0.7373286", "0.7373286", "0.7302994", "0.7280395", "0.72525823", "0.72525823", "0.72525823", "0.7190258", "0.7190258", "0.7190258", "0.7182205", "0.71414", "0.7120381", "0.70009905", "0.6918324", "0.69046646...
0.6552975
53
Use callbacks to share common setup or constraints between actions.
def set_trip @trip = Trip.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 trip_params params.require(:trip).permit(:correspondance_id, :host_id, :duration, :start_date, :validated) 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.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
GET /depts GET /depts.json
def index respond_with (@depts = Dept.all) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n end", "def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end", "def gov_proposals_proposal_id_deposits_get_with_http_info(proposal_id, o...
[ "0.6545986", "0.6411494", "0.5787647", "0.5712539", "0.5659299", "0.55618864", "0.5465714", "0.5440237", "0.5400269", "0.53766406", "0.53727967", "0.5357003", "0.532205", "0.5307027", "0.5304455", "0.530243", "0.5300189", "0.5286269", "0.5285393", "0.5281438", "0.52688396", ...
0.69290954
0
GET /depts/1 GET /depts/1.json
def show respond_with (@dept = Dept.find(params[:id])) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_with (@depts = Dept.all)\n end", "def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end", "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n end", "def show\n ...
[ "0.6875374", "0.654028", "0.62998414", "0.62898105", "0.61819524", "0.60136217", "0.59722865", "0.59676844", "0.5937836", "0.58926535", "0.5857286", "0.5842698", "0.58400106", "0.57868934", "0.5785043", "0.57630837", "0.57630837", "0.5759462", "0.5757313", "0.57217425", "0.57...
0.5995465
6
GET /depts/new GET /depts/new.json
def new respond_with @dept=Dept.new, @nurse=logged_in_nurse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @dept = Dept.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dept }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n en...
[ "0.7055091", "0.7025551", "0.7025551", "0.7025551", "0.6946606", "0.69077104", "0.6778155", "0.6769143", "0.67227465", "0.67227465", "0.67171735", "0.6714366", "0.66864663", "0.66864663", "0.6682625", "0.6660716", "0.65929383", "0.6558719", "0.655259", "0.653236", "0.653236",...
0.0
-1
POST /depts POST /depts.json
def create @dept = Dept.new params[:dept] flash[:notice] = 'Created Dept' if @dept.save respond_with @dept end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n \n \n @dept = current_user.depts.new(params[:dept])\n \n respond_to do |format|\n if @dept.save\n format.html { redirect_to @dept, :notice => 'Dept was successfully created.' }\n format.json { render :json => @dept, :status => :created, :location => @dept }\n else\n ...
[ "0.5849972", "0.57333535", "0.57243806", "0.57005143", "0.5616476", "0.56078047", "0.55533224", "0.5374643", "0.53442293", "0.53125423", "0.5306127", "0.5304426", "0.53016865", "0.5290088", "0.52727884", "0.5261394", "0.52131754", "0.5191572", "0.51742715", "0.51716965", "0.5...
0.5049301
31
PUT /depts/1 PUT /depts/1.json
def update @dept = Dept.find params[:id] flash[:notice] = 'Updated Dept' if @dept.update_attributes(params[:dept]) respond_with @dept end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @dept = Dept.find(params[:id])\n\n if @dept.update(dept_params)\n head :no_content\n else\n render json: @dept.errors, status: :unprocessable_entity\n end\n end", "def update\n @dept = Dept.find(params[:id])\n\n respond_to do |format|\n if @dept.update_attributes(pa...
[ "0.6193141", "0.6037173", "0.59410244", "0.592442", "0.5871976", "0.5859453", "0.5846196", "0.5816068", "0.5784353", "0.5761451", "0.5759493", "0.57422304", "0.57339853", "0.5715735", "0.5713499", "0.5710812", "0.56888235", "0.5683318", "0.56758964", "0.567335", "0.56575745",...
0.5753319
11
DELETE /depts/1 DELETE /depts/1.json
def destroy @dept = Dept.find(params[:id]) @dept.destroy respond_with @dept end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @apt = Apt.find(params[:id])\n @apt.destroy\n\n respond_to do |format|\n format.html { redirect_to apts_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\...
[ "0.6936037", "0.6896906", "0.68808025", "0.6832572", "0.6815774", "0.6808381", "0.68021065", "0.6699161", "0.6675734", "0.66724384", "0.6663793", "0.66578734", "0.6642979", "0.6626997", "0.66103286", "0.659138", "0.659112", "0.6566812", "0.6565286", "0.6558818", "0.6553283", ...
0.63690966
74
metodo para agregar preguntas
def question_to_csv(array) #mete las preguntas y respuestas a el array @model.ask_csv(array[0],array[1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patterns; end", "def regexps; end", "def pre_match() end", "def pattern; end", "def pattern; end", "def pattern; end", "def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end", "def alter_regex_for_custom_routes(node); end", "def post_match() end", "def pre_match\n end", "...
[ "0.660176", "0.6214884", "0.6116605", "0.60844034", "0.60844034", "0.60844034", "0.60364205", "0.5940867", "0.58698344", "0.5850951", "0.5759693", "0.57407147", "0.5663785", "0.561733", "0.5603258", "0.55912554", "0.55760115", "0.55760115", "0.5566197", "0.5563492", "0.555558...
0.0
-1
Metodo que recorrera el juego
def start_game #crear variable con los elementos de el csv questions = @model.show_asks #recorrer el array de preguntas y respuestas questions.each do |ask| #imprimir la pregunta p ask.question #guardar lo que el usuario escriba res = @view.answer #ver si el usuario tiene algo comparado a la respuesta if res.include? ask.answer #si lo tiene aumenta el contador y muestra mensaje de correcto @counter_correct += 1 @view.correct #si no lo contiene else #aumenta el contador de errores @counter_bad += 1 #muestra mensaje de error @view.incorrect end end #mostrar mensaje de cuantas correctas y cuantas malas tuvo∫ @view.result(@counter_correct, @counter_bad) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def changerEnVide\n\t\t@couleur=-1\n\tend", "def changerEnRouge\n\t\t@couleur=1\n\tend", "def retire\n\n end", "def mi_carrera\n\n\tend", "def aplicar_a_jugador_ir_a_casilla(actual,todos)\r\n casilla = -1\r\n if jugador_correcto(actual,todos)\r\n informe(actual,todos)...
[ "0.67364496", "0.62481976", "0.61398405", "0.6083773", "0.60572094", "0.60299206", "0.60062516", "0.5976691", "0.5892669", "0.58211476", "0.58196276", "0.5805118", "0.57825005", "0.5748543", "0.5744912", "0.5741771", "0.5741771", "0.5741771", "0.5682185", "0.56611043", "0.563...
0.0
-1
setup an output variable
def _parent(a) u = @store col = "" arr = a.split(".") arr[0..-2].each{|x| col << "." << x if u[x] == nil u[x] = {} elsif !u[x].respond_to?(:[]) raise "#{col} is not valid" end u = u[x] } [u, arr[-1]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output=(output)\n @_output = output\n end", "def out= out\n @out = out\n end", "def out= out\n @out = out\n end", "def output\n parent.set(@var_name, @var_value)\n return \"\"\n end", "def output\n @output ||= Output.new\n end", "def set_output\n @outpu...
[ "0.7563902", "0.71563876", "0.71563876", "0.69818026", "0.6950836", "0.6687512", "0.6687512", "0.6687512", "0.6687512", "0.6687512", "0.66244316", "0.6533637", "0.65310866", "0.6434923", "0.6434923", "0.6434923", "0.6434923", "0.6434923", "0.6434923", "0.6434923", "0.6434923"...
0.0
-1
GET /decks GET /decks.json
def new @person = Individual.find_by(id: current_user.meta_id) @deck = @person.decks.new respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n...
[ "0.77891225", "0.77891225", "0.7673465", "0.725741", "0.725741", "0.725741", "0.725741", "0.716536", "0.688506", "0.6660272", "0.6605678", "0.6402723", "0.6349809", "0.6310214", "0.6272577", "0.6239391", "0.62374616", "0.61821723", "0.6094213", "0.6073877", "0.6071988", "0....
0.0
-1
POST /decks POST /decks.json
def create @person = Individual.find_by(id: current_user.meta_id) Rails.logger.info ">>>>>>>>>>>>>>>>>>> #{@person.id} <<<<<<<<<<<<<<<<<<" @deck = @person.decks.new(deck_params) @deck.individual = Individual.find_by(id: current_user.meta_id) @decks = @person.decks.all respond_to do |format| if @deck.save format.js else Rails.logger.info "FAILEDFAILEDFAILEDFAILEDFAILEDFAILEDFAILEDFAILED" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @deck = Deck.new_from_api\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to @deck, notice: 'Deck was successfully created.' }\n format.json { render :show, status: :created, location: @deck }\n else\n format.html { render :new, status: :unproce...
[ "0.6648298", "0.6544418", "0.64548093", "0.64548093", "0.61061776", "0.61061776", "0.61061776", "0.61061776", "0.60603267", "0.6012212", "0.59874314", "0.59874314", "0.5980291", "0.59236974", "0.5856711", "0.58271855", "0.5797524", "0.57556546", "0.5755563", "0.57388157", "0....
0.5832048
15
PATCH/PUT /decks/1 PATCH/PUT /decks/1.json
def update respond_to do |format| if @deck.update(deck_params) format.js else format.js { render :edit } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1...
[ "0.6622699", "0.6507609", "0.6436547", "0.62804174", "0.6222843", "0.61699766", "0.6111849", "0.60882723", "0.60866624", "0.606527", "0.60353893", "0.60353893", "0.5969414", "0.5959243", "0.5887927", "0.58788836", "0.5856345", "0.58487356", "0.5845692", "0.58210564", "0.58210...
0.58610135
16
DELETE /decks/1 DELETE /decks/1.json
def destroy if @deck.destroy respond_to do |format| format.js end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @duck.destroy\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duck.destroy\n\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n ...
[ "0.73900247", "0.738941", "0.72596055", "0.72464466", "0.72438776", "0.7226198", "0.6920882", "0.68949026", "0.68722993", "0.6862942", "0.68552667", "0.68535775", "0.68176407", "0.6816429", "0.6810576", "0.6810467", "0.6784671", "0.6775178", "0.6774329", "0.677064", "0.676835...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_deck if current_user.meta_type == "Individual" @person = Individual.find_by(id: current_user.meta_id) @decks = @person.decks.all @deck = @decks.find(params[:id]) else @deck = Deck.find(params[:id]) end 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 deck_params params.require(:deck).permit(:title, :description, :amount, :pitch, :logo) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
Preview this email at
def new_answer answer = Answer.last UserMailer.new_answer(answer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
English resource of image plugin $Revision: 1.1 $ Image Diary Upload images and insert to diary. image( number, 'altword', thumbnail ) show a image. number image ID as 0, 1, 2... altword alt strings of the img element. thumbnail image ID of thumbnail (optional) image_left( number, 'altword', thumbnail ) show a image with "class=left" image_right( number, 'altword', thumbnail ) show a image with "class=right" image_link( number, 'desc' ) make link to a image. number image ID as 0, 1, 2... desc description of the image. options in tdiary.conf:
def image_error_num( max ); "每則日誌最多可貼 #{max} 張圖片"; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_library\n @title = \"Insert image\"\n # Only interested in images\n get_files(params.merge({:key => 'Image'}))\n render :layout => 'admin_modal'\n end", "def image(opts)\n \"#{opts[:alt] || opts[:title]}\"\n end", "def show_images(options)\n change_dir_images(options[:mo...
[ "0.62310714", "0.6209745", "0.61384606", "0.6082204", "0.60578287", "0.6038087", "0.6023683", "0.6018892", "0.59946966", "0.5963449", "0.59127206", "0.59002894", "0.58759815", "0.5872649", "0.58633333", "0.5854804", "0.5838598", "0.5812774", "0.5810999", "0.5775149", "0.57442...
0.0
-1
code your valid_move? method here
def valid_move?(board, index) if index.between?(0, 8) && board[index] == " " true else position_taken?(board, index) == nil && board[index] == "X" false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(new_x, new_y)\n true\n end", "def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end...
[ "0.82555014", "0.8206571", "0.80988276", "0.8078809", "0.8062644", "0.8059585", "0.80573076", "0.79910356", "0.79760164", "0.7954171", "0.79520303", "0.79362106", "0.7926097", "0.7923089", "0.7916774", "0.7911268", "0.79109216", "0.7906181", "0.79061437", "0.7892746", "0.7857...
0.0
-1
displays your position_taken? method here, so that you can use it in the valid_move? method above.
def position_taken?(board, index) if board[index] == " " false elsif board[index] == "" false elsif board[index] == nil false else board[index] = "X" true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_taken?\nend", "def position_taken?(position)\n @board[position] != \" \"\n end", "def position_taken?(position)\n @board[position] != \" \"\n end", "def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end", "def position_taken?(location)\n ...
[ "0.7757397", "0.72929275", "0.7262038", "0.72190773", "0.72190773", "0.71969354", "0.7174578", "0.71555257", "0.7095083", "0.70655245", "0.7042715", "0.70386976", "0.7034291", "0.7034291", "0.7034291", "0.7034291", "0.7034291", "0.7034291", "0.70289576", "0.701342", "0.699564...
0.0
-1
code your input_to_index and move method here!
def input_to_index(user_input) user_input.to_i - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_to_index(move_index)\r\n move_index = move_index.to_i - 1\r\n move_index\r\n end", "def input_to_index(move)\r\n index = move.to_i - 1\r\nend", "def input_to_index(move)\n move = move.to_i - 1\nend", "def input_to_index(move)\n move.to_i - 1\n end", "def input_to_index(nextmove)\n ...
[ "0.79074955", "0.7827477", "0.77235293", "0.75544167", "0.744666", "0.71021795", "0.70845556", "0.68059075", "0.68041223", "0.6800874", "0.6774234", "0.6750115", "0.66907746", "0.6676504", "0.66618234", "0.66250956", "0.6571919", "0.655892", "0.6532908", "0.65224916", "0.6508...
0.0
-1
GET /vlogs GET /vlogs.json
def index @vlogs = Vlog.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/ap...
[ "0.6752292", "0.6581895", "0.6546922", "0.65399426", "0.649908", "0.6427426", "0.64247966", "0.6420037", "0.641142", "0.63707125", "0.63688064", "0.63196564", "0.62709564", "0.62655294", "0.6231083", "0.62138027", "0.6208478", "0.6190693", "0.6184896", "0.61724615", "0.607797...
0.75289196
0
GET /vlogs/1 GET /vlogs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n @client.get(\"#{path}/log\")\n end", "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n e...
[ "0.7070881", "0.69164056", "0.6688197", "0.6665141", "0.6640305", "0.6631311", "0.6604397", "0.6596119", "0.6563189", "0.65288544", "0.6504933", "0.6504933", "0.6486662", "0.64777154", "0.64547956", "0.64047265", "0.63774127", "0.6305563", "0.6300302", "0.6296057", "0.6290595...
0.0
-1
POST /vlogs POST /vlogs.json
def create @vlog = Vlog.new(vlog_params) respond_to do |format| if @vlog.save format.html { redirect_to @vlog, notice: 'Vlog was successfully created.' } format.json { render :show, status: :created, location: @vlog } else format.html { render :new } format.json { render json: @vlog.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def index\n @vlogs = Vlog.all\n end", "def vlog_params\n params.require(:vlog).permit(:title, :body)\n end", "def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :...
[ "0.66360784", "0.6441897", "0.6294022", "0.6289499", "0.61918986", "0.6063009", "0.6049176", "0.5957518", "0.5947572", "0.5848158", "0.57152283", "0.57024646", "0.56843406", "0.56834036", "0.56615406", "0.5637894", "0.5628648", "0.5612318", "0.55917233", "0.5578927", "0.55674...
0.7244423
0
PATCH/PUT /vlogs/1 PATCH/PUT /vlogs/1.json
def update respond_to do |format| if @vlog.update(vlog_params) format.html { redirect_to @vlog, notice: 'Vlog was successfully updated.' } format.json { render :show, status: :ok, location: @vlog } else format.html { render :edit } format.json { render json: @vlog.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_...
[ "0.62520665", "0.61077106", "0.5993673", "0.59841627", "0.5913179", "0.5896615", "0.58681065", "0.58634293", "0.5846815", "0.5833569", "0.58255774", "0.5822446", "0.58004946", "0.57788855", "0.57764506", "0.57764506", "0.57764506", "0.5775726", "0.5763296", "0.5763296", "0.57...
0.63281894
0
DELETE /vlogs/1 DELETE /vlogs/1.json
def destroy @vlog.destroy respond_to do |format| format.html { redirect_to vlogs_url, notice: 'Vlog was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url }\n...
[ "0.7234015", "0.7079446", "0.7022905", "0.69769645", "0.69769645", "0.69554853", "0.69009256", "0.6892954", "0.68693554", "0.6867014", "0.68451697", "0.68426615", "0.6838871", "0.6809259", "0.67922175", "0.67922", "0.6779264", "0.676268", "0.6736647", "0.6727467", "0.6716119"...
0.7179753
1
Use callbacks to share common setup or constraints between actions.
def set_vlog @vlog = Vlog.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 vlog_params params.require(:vlog).permit(:title, :body) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
end of parse_form_params method
def pad_date(unit) unit.to_i < 10 ? "0" + unit.to_s : unit.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsed_params\n \n end", "def form_fields\n params\n end", "def parse_parameters; end", "def parseForm(form)\n # I'm using the format \"name value\" to be able to use the set_options method\n url = Array[\"\", \"url\", form[\"action\"]]\n method = Array[\"\", \"method\", form...
[ "0.7679545", "0.6981277", "0.69586706", "0.6654163", "0.66460216", "0.6631807", "0.6612779", "0.66000116", "0.65820414", "0.65528715", "0.6530193", "0.64781797", "0.63651454", "0.626918", "0.62612927", "0.6258799", "0.61945057", "0.6175558", "0.6174527", "0.6118552", "0.60848...
0.0
-1
GET /projects GET /projects.json
def index @projects = Project.all respond_to do |format| format.html # index.html.erb format.json { render json: @projects } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8574897", "0.8386689", "0.8355737", "0.8062607", "0.80368364", "0.8002139", "0.78593457", "0.7834634", "0.78324", "0.7799698", "0.77792805", "0.7748103", "0.77139485", "0.7700251", "0.7696023", "0.7677249", "0.7659848", "0.76413786", "0.7627596", "0.76157665", "0.76007134"...
0.7695487
21
GET /projects/1 GET /projects/1.json
def show @show_project = Project.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @show_project } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7868971", "0.76979554", "0.7680216", "0.7611453", "0.75334454", "0.75258976", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74924207", "0.7484109", "0.7479275", "0.7444873", "0.74294627", "0.74224764", "0.7414947", "0....
0.705198
70
POST /projects POST /projects.json
def create @create_project = current_user.projects.build(params[:project]) flash[:notice] = "Project #{@create_project.description} successfully created" if @create_project.save respond_with(@create_project, layout: !request.xhr?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338948", "0.73139244", "0.7308003", "0.7299582", "0.7227503", "0.7225945", "0.71982473", "0.71170384", "0.7104803", "0.7095263", "0.7070636", "0.70408624", "0.70358187", "0.7024969", "0.70191896", "0.7009597", "0.698481", "0.697517", "0.6963753", "0.6963096", "0.6948756",...
0.6806436
67
PUT /projects/1 PUT /projects/1.json
def update @edit_project = Project.find(params[:id]) respond_to do |format| if @edit_project.update_attributes(params[:project]) format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @edit_project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end", "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n re...
[ "0.7379445", "0.7308138", "0.7179816", "0.7166733", "0.71319646", "0.7124661", "0.7081242", "0.70082223", "0.70051754", "0.69998187", "0.6990335", "0.69887996", "0.69887996", "0.69887996", "0.69887996", "0.69823825", "0.6979992", "0.6979992", "0.6976576", "0.6969734", "0.6969...
0.6823821
48
DELETE /projects/1 DELETE /projects/1.json
def destroy project = Project.find(params[:id]) project.destroy respond_to do |format| format.html { redirect_to root_path } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7704753", "0.7704753", "0.7704753", "0.7704753", "0.7704753...
0.7669082
41
Sets the connection information.
def initialize_http_handler(args = {}) @http = HTTPHandler.new(args) logger.debug { "Connection Set: #{http.to_s}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection=(val)\n @@connection = val\n end", "def connect_using conn\n @connection = conn\n end", "def connection=(spec) #:nodoc:\n raise ConnectionNotEstablished unless spec\n @@connection = spec\n end", "def connection=(connection)\n @connection = co...
[ "0.7400925", "0.72404045", "0.7051941", "0.69893485", "0.69825935", "0.69825935", "0.69825935", "0.69042665", "0.6855849", "0.67736375", "0.6706591", "0.66178834", "0.6605279", "0.64474845", "0.6388234", "0.63225836", "0.63080513", "0.6270108", "0.62109786", "0.61874056", "0....
0.0
-1
connect Returns the stored cookie information
def http_cookie http.cookie end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookie_info\n authenticated_crowd_call(:get_cookie_info)\n end", "def getCookie()\n return @cookie\n\tend", "def get_cookie\n ...
[ "0.7160735", "0.7160735", "0.7160735", "0.7160735", "0.7160735", "0.7160735", "0.7160735", "0.7082598", "0.6988047", "0.6784194", "0.67556864", "0.67437834", "0.66451484", "0.66233027", "0.6601572", "0.65720946", "0.65469956", "0.64739555", "0.6439815", "0.6408414", "0.638141...
0.70087355
8
http_cookie Sets the cookie information that will be used with subsequent calls to the HTTP server.
def http_cookie=(content) logger.debug { content ? "Setting Cookie: #{content}" : 'Clearing Cookie' } http.cookie = content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_cookie\n http.cookie\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def cookie= cookie_str\n @...
[ "0.7620678", "0.68841165", "0.6770179", "0.6665859", "0.6665859", "0.65715945", "0.632038", "0.6310317", "0.6299854", "0.6292644", "0.6263467", "0.6263467", "0.6263467", "0.6263467", "0.6263467", "0.6263467", "0.6263467", "0.62613344", "0.62613344", "0.6253395", "0.6238609", ...
0.79497415
0
Executes a HTTP DELETE request
def http_delete(path, headers = {}) clear_response path = process_path(path) @success_code = 204 @response = http.delete(path, headers) parse_response? ? parsed_response : response.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def d...
[ "0.8420704", "0.82075775", "0.82075775", "0.81777793", "0.81290066", "0.8086384", "0.8086384", "0.8012486", "0.7933856", "0.7926384", "0.792521", "0.7872222", "0.7847392", "0.7830726", "0.7799038", "0.77759504", "0.77759504", "0.77759504", "0.77759504", "0.7744501", "0.773645...
0.7581227
29
http_delete Executes a HTTP GET request and returns the response
def http_get(path, headers = { }) clear_response path = process_path(path) @success_code = 200 @response = http.get(path, headers) parse_response? ? parsed_response : response.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(ur...
[ "0.8044596", "0.8044596", "0.7951243", "0.7951243", "0.776669", "0.7715966", "0.7687729", "0.7630742", "0.7454683", "0.74158823", "0.73682195", "0.7358696", "0.7347737", "0.7313847", "0.7311672", "0.7305574", "0.7305574", "0.7305574", "0.7305574", "0.72913665", "0.7288746", ...
0.0
-1
http_get Executes a HTTP POST request
def http_post(path, data, headers = {}) clear_response path = process_path(path) @success_code = 201 @response = http.post(path, data, headers) parse_response? ? parsed_response : response.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post()\n return @http.request(@req)\n end", "def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end", "def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.i...
[ "0.7859831", "0.73862493", "0.7025314", "0.702248", "0.69987893", "0.681959", "0.67228043", "0.6707593", "0.66797507", "0.66650355", "0.6646669", "0.6632746", "0.6584744", "0.65792274", "0.6569377", "0.65641445", "0.6559944", "0.65581995", "0.6537018", "0.65047264", "0.647406...
0.0
-1
put_json The http response code that indicates success for the request being made.
def success_code @success_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _success(data,code)\n status code\n response.headers['Content-Type'] = 'application/json'\n body(data.to_json)\n end", "def json_success(data, extra = nil)\n res = { status: 'success', data: data }\n return res unless extra\n res.merge(extra: extra)\n end", "def json_success(respo...
[ "0.6712966", "0.64356184", "0.6332398", "0.623631", "0.6179835", "0.6157988", "0.6157988", "0.6157988", "0.6146013", "0.6144939", "0.61444265", "0.6122684", "0.6120985", "0.6042261", "0.6042261", "0.5971405", "0.5971405", "0.59656847", "0.59581673", "0.59463435", "0.58643174"...
0.0
-1
Returns true if the response code equals the success code that was set by the method.
def success? return nil unless @success_code response.code == @success_code.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success?\n return nil unless success_code\n response.code == success_code.to_s\n end", "def success?\n [200, 201, 204, 280, 281].include?(code)\n end", "def success?\n code == 200\n end", "def success?\n @response.code == \"200\"\n end", "def success?\n ...
[ "0.86063683", "0.8208406", "0.8108283", "0.81000113", "0.8016281", "0.797116", "0.79479694", "0.7937648", "0.7896536", "0.788043", "0.788043", "0.78595424", "0.7815737", "0.7815448", "0.7691437", "0.7657844", "0.7653911", "0.7635969", "0.7605647", "0.76036024", "0.7590786", ...
0.8623917
0
Returns true if the response body parsing option has been set to true.
def parse_response? parse_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_response_body?\n !response.body.nil? && !response.body.empty?\n end", "def parse_response?\n parse_response\n end", "def has_response_body?\n @raw_link.media_type != \"null\"\n end", "def parse_content?\n options[:parse_content] != false\n end", "def has_...
[ "0.7700283", "0.76595646", "0.71178806", "0.7066681", "0.69874233", "0.6904015", "0.68061084", "0.6793356", "0.67216486", "0.67123675", "0.6651096", "0.6643167", "0.66152114", "0.66039777", "0.65583515", "0.65561587", "0.6482685", "0.6418121", "0.6393934", "0.63677937", "0.62...
0.77648354
0
Parses the response body based on the response's contenttype header value
def parsed_response #logger.debug { "Parsing Response: #{response.content_type}" } @parsed_response ||= ResponseParser.parse(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), uncompress_body(response) ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end", "def parse_response(response)\n if response['content-type']\n [ r...
[ "0.8307762", "0.8304404", "0.80062777", "0.7630168", "0.74053246", "0.7343479", "0.7332263", "0.7321924", "0.7246888", "0.716485", "0.71549356", "0.7027419", "0.69742775", "0.69243693", "0.6885674", "0.6830143", "0.6830009", "0.68259585", "0.6817537", "0.67977184", "0.6774921...
0.6878679
15
parsed_response API METHODS Login.
def login(args = { }) # POST /svc/Login # Host: eval.parkmedia.tv # Content-type: application/x-www-form-urlencoded # Content-length: 25 # # username=foo&password=bar # ERROR RESPONSE # -------------- # HTTP/1.0 403 Access Forbidden # Content-type: text/plain # # Error=BadAuthentication # SUCCESS RESPONSE # ---------------- # HTTP/1.0 200 OK # Content-type: text/plain # Set-Cookie: JSESSIONID=123456789 # # JSESSIONID=123456789 self.http_cookie = nil data = { } username = args[:username] password = args[:password] data['password'] = password if password data['username'] = username if username #logger.debug { "Logging In As User: '#{username}' Using Password: #{password ? 'yes' : 'no'}" } http_post_form('Login', data) self.http_cookie = response['set-cookie'] if response and response.code == '200' http_cookie end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_login_response(email, password, response)\n @email = email\n @password = password\n @token = Parser.extract_user_token response\n @id = Parser.login_object_id response\n @xp = Parser.extract_xp response\n end", "def login\n response = client.call :login, :message => { :username =...
[ "0.7842878", "0.75079954", "0.74343777", "0.7222853", "0.7211954", "0.7195947", "0.71946216", "0.71819866", "0.70956045", "0.708775", "0.70086455", "0.7003659", "0.69876826", "0.6954529", "0.6897747", "0.6891394", "0.68877816", "0.6881785", "0.68738633", "0.68650067", "0.6854...
0.65411025
62
This is called for each scope recursively.
def inspect_variables_in_scope(scope_node) variable_table.push_scope(scope_node) NodeScanner.scan_nodes_in_scope(scope_node) do |node| # puts "scope:#{variable_table.current_scope_level} node:#{node}" process_node(node) end variable_table.pop_scope end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope() yield end", "def scopes; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope_loop\nend", "def find_scope!(obj); end", "def scope()...
[ "0.71065044", "0.6906034", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.671468", "0.6601884", "0.65620893", "0.6533726", "0.64894646", "0.6488208", "0.6308509", "0.62077653", "0.61597466", "0.6153976", "0.612...
0.5639102
64
Check to see if any of the REGEXs appear on the page more than one time if so, abort. Can't do multiple replacements.
def more_than_once?(text, param, regex) count = text.scan(regex).size puts "#{param}: #{count} time" if count > 1 puts "- ERROR: '#{param}' appears more than one time on the page." return true end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_if_match; true; end", "def find_more\n return unless @last_regex\n ix = next_match @last_regex\n return unless ix\n @oldindex = @current_index\n @current_index = ix[0]\n @curpos = ix[1]\n ensure_visible\n end", "def find_more\n return unless @last_regex\n ...
[ "0.5518088", "0.5414091", "0.5319407", "0.5284697", "0.52731943", "0.5168599", "0.50584435", "0.505323", "0.50411904", "0.50293016", "0.5012958", "0.5011664", "0.49808598", "0.49134517", "0.48912886", "0.48845205", "0.483388", "0.48267707", "0.4818621", "0.48050597", "0.47966...
0.6320359
0
These functions are helpers for enforcement(), that implement the different caching systems on a v3 vs v5 backend
def codebase() "Hiera::Backend::Simp_compliance_enforcement_backend" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_on?; end", "def cache_on?; end", "def cached?; end", "def _cache_control; end", "def disable_caching=(_arg0); end", "def disable_caching; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cach...
[ "0.6759209", "0.6759209", "0.6630124", "0.6573062", "0.63803744", "0.63708705", "0.6238761", "0.6238761", "0.6238761", "0.6238761", "0.6238761", "0.6238761", "0.6238761", "0.6231632", "0.6158146", "0.61463094", "0.61463094", "0.61211836", "0.6084361", "0.60404825", "0.6017497...
0.0
-1
This cache is explicitly percatalog
def cache(key, value) @cache[key] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache_store; end", "def cache_store; end", "def instance_cache; end", "def cached\n raise NotImplementedError\n end", "def cached?; end", "def configure_...
[ "0.7445239", "0.7445239", "0.7445239", "0.7445239", "0.7445239", "0.7445239", "0.7445239", "0.728902", "0.728902", "0.688", "0.68652683", "0.68631005", "0.6828487", "0.6707173", "0.66400945", "0.66400945", "0.6618615", "0.661075", "0.6603876", "0.6579906", "0.6562896", "0.6...
0.0
-1
rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity
def changelog_text return unless full_changelog_text changelog_lines = full_changelog_text.split("\n") slice_range = if old_version_changelog_line && new_version_changelog_line if old_version_changelog_line < new_version_changelog_line Range.new(old_version_changelog_line, -1) else Range.new(new_version_changelog_line, old_version_changelog_line - 1) end elsif old_version_changelog_line return if old_version_changelog_line.zero? # Assumes changelog is in descending order Range.new(0, old_version_changelog_line - 1) elsif new_version_changelog_line # Assumes changelog is in descending order Range.new(new_version_changelog_line, -1) else return unless changelog_contains_relevant_versions? # If the changelog contains any relevant versions, return it in # full. We could do better here by fully parsing the changelog Range.new(0, -1) end changelog_lines.slice(slice_range).join("\n").sub(/\n*\z/, "") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def schubert; end", "def refutal()\n end", "def used?; end", "def offences_by; end", "def isola...
[ "0.7540603", "0.62610644", "0.62610644", "0.61756754", "0.6021155", "0.6021155", "0.6021155", "0.6021155", "0.6012703", "0.6002832", "0.5999991", "0.5862893", "0.5850707", "0.5821887", "0.5821887", "0.57759506", "0.57759506", "0.57759506", "0.57756025", "0.5775124", "0.577512...
0.0
-1
rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/CyclomaticComplexity
def upgrade_guide_url upgrade_guide&.html_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def strategy; end", "def used?; end", "def operations; end", "def operat...
[ "0.75868857", "0.63268816", "0.63268816", "0.62727755", "0.6100667", "0.6088745", "0.6088745", "0.6088745", "0.6088745", "0.6034532", "0.6032557", "0.5940613", "0.58680624", "0.58680624", "0.58670104", "0.58644253", "0.5847134", "0.5847134", "0.58448565", "0.58391696", "0.583...
0.0
-1
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
def changelog_line_for_version(version) raise "No changelog text" unless full_changelog_text return nil unless version version = version.gsub(/^v/, "") changelog_lines = full_changelog_text.split("\n") changelog_lines.find_index.with_index do |line, index| next false unless line.include?(version) next false if line.match?(/#{Regexp.escape(version)}\.\./) next true if line.start_with?("#", "!") next true if line.match?(/^v?#{Regexp.escape(version)}:?/) next true if line.match?(/^\d{4}-\d{2}-\d{2}/) next true if changelog_lines[index + 1]&.match?(/^[=\-\+]{3,}\s*$/) false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def schubert; end", "def strategy; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def offences_by; end", "def used?; end", "def isola...
[ "0.7542267", "0.6258994", "0.6208141", "0.6208141", "0.6056929", "0.60494554", "0.6037423", "0.6025232", "0.6025232", "0.6025232", "0.6025232", "0.5935861", "0.5928923", "0.5835105", "0.5835105", "0.5824253", "0.5792975", "0.5792975", "0.57759166", "0.57759166", "0.57759166",...
0.0
-1
rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity
def changelog_contains_relevant_versions? # Assume the changelog is relevant if we can't parse the new version return true unless version_class.correct?(dependency.version) # Assume the changelog is relevant if it mentions the new version # anywhere return true if full_changelog_text.include?(dependency.version) # Otherwise check if any intermediate versions are included in headers versions_in_changelog_headers.any? do |version| next false unless version <= version_class.new(dependency.version) next true unless dependency.previous_version next true unless version_class.correct?(dependency.previous_version) version > version_class.new(dependency.previous_version) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def strategy; end", "def used?; end", "def offences_by; end", "def suivr...
[ "0.75880903", "0.6360674", "0.6273399", "0.6273399", "0.61486995", "0.60898024", "0.60898024", "0.60898024", "0.60898024", "0.6068726", "0.6057893", "0.6008208", "0.5930339", "0.5922163", "0.589988", "0.589988", "0.5863507", "0.5863507", "0.5829884", "0.5829884", "0.5829884",...
0.0
-1
TODO: Refactor me so that Composer doesn't need to be special cased
def git_source? # Special case Composer, which uses git as a source but handles tags # internally return false if dependency.package_manager == "composer" requirements = dependency.requirements sources = requirements.map { |r| r.fetch(:source) }.uniq.compact return false if sources.empty? raise "Multiple sources! #{sources.join(', ')}" if sources.count > 1 source_type = sources.first[:type] || sources.first.fetch("type") source_type == "git" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gemspec?; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "...
[ "0.6416544", "0.6305183", "0.6305183", "0.6305183", "0.6305183", "0.6305183", "0.6305183", "0.6305183", "0.6305183", "0.6243146", "0.6243146", "0.6243146", "0.6243146", "0.6243146", "0.6243146", "0.6205426", "0.61574197", "0.6015995", "0.600599", "0.59309244", "0.59309244", ...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.order_mailer.received.subject
def received(order) @order = order mail to: order.e_mail, subject: 'Eloctronic Shop Store Order Confirmation' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_subject=(value)\n @message_subject = value\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject (recipient)\n subject_variables = alert_v...
[ "0.7114241", "0.70736843", "0.70679504", "0.6997708", "0.67319906", "0.66939694", "0.6645226", "0.65806514", "0.6490231", "0.64177597", "0.64066666", "0.6399676", "0.6077624", "0.5969244", "0.5952799", "0.58398", "0.58398", "0.58398", "0.58398", "0.5790015", "0.5768094", "0...
0.5465087
70
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.order_mailer.shipped.subject
def shipped(order) @order = order mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:...
[ "0.665406", "0.65048856", "0.64657265", "0.6443509", "0.6440042", "0.63969946", "0.6361354", "0.6346641", "0.63257545", "0.6229103", "0.61920714", "0.61490303", "0.6139562", "0.60712665", "0.606504", "0.6045051", "0.60314393", "0.60151535", "0.59641683", "0.59469306", "0.5941...
0.5727807
52
e.backtrack.first looks like this: ..../dnsmadeeasy/lib/dnsmadeeasy/api/client.rb:143:in `create_a_record'
def method_signature(e, method) file, line, call_method = e.backtrace.first.split(':') call_method = call_method.gsub(/[']/, '').split('`').last if call_method && call_method.to_sym == method.to_sym source_line = File.open(file).to_a[line.to_i - 1].chomp! if source_line =~ /def #{method}/ signature = source_line.strip.gsub(/,/, '').split(/[ ()]/) signature.shift # remove def return signature.reject { |a| a =~ /^([={}\)\(])*$/ } end end [] rescue StandardError [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createRecord(sObject,records_to_insert)\n puts \"in @helper::createRecord\"\n puts records_to_insert\n record = @restForce.createRecord(sObject,records_to_insert)\n puts record\n return record\nend", "def create_record_for_not_found_response; end", "def handle_backtrack\n\t\tend", "def create_...
[ "0.61141706", "0.6034092", "0.5685166", "0.5673482", "0.5667236", "0.5639946", "0.5612742", "0.5550854", "0.55002826", "0.55002826", "0.55002826", "0.5498238", "0.54191834", "0.54156667", "0.5346587", "0.5345017", "0.5345017", "0.5345017", "0.5345017", "0.5332147", "0.5331453...
0.0
-1
Retrieves dimensions for image assets
def extract_dimensions return unless image_downloaded tempfile = image.queued_for_write[:original] # Works with uploaded files and existing files path_or_url = if !tempfile.nil? then # Uploading new file tempfile.path else if image.options[:storage] === :s3 image.url else image.path end end geometry = Paperclip::Geometry.from_file(path_or_url) geometry.auto_orient geometry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end", "def extract_dimensions\n return unless is_image?\n {original: 'image_dimensions', resized: 'resized_dimensions'}.eac...
[ "0.7849776", "0.7429998", "0.7373656", "0.7366195", "0.719613", "0.71330637", "0.7126011", "0.7049237", "0.70178336", "0.7005196", "0.70001096", "0.69706863", "0.6949104", "0.6930387", "0.69221824", "0.68911684", "0.68713444", "0.6844494", "0.68427217", "0.6833149", "0.683138...
0.71057665
7
GET /entries/new GET /entries/new.xml
def new @entry = Entry.new respond_to do |format| format.html # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end...
[ "0.7487231", "0.7475742", "0.7358314", "0.7252312", "0.69534063", "0.6934935", "0.69304943", "0.6913238", "0.68988115", "0.68988115", "0.68988115", "0.68988115", "0.68988115", "0.68988115", "0.68988115", "0.68988115", "0.68932796", "0.6866781", "0.68301696", "0.6800907", "0.6...
0.6722702
21
Parses the incoming log record and breaks it up into the
def parse_entry(log_entry) @column = {}; i = 1; if attributes = log_entry.match(regexp) @args.each {|f| @column[f] = attributes[i]; i += 1} parse_datetime! if @column[:time] parse_request! if @column[:request] end @column end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_logline(line) \n line.strip!\n split_line = line.split(/\\|/)\n addr = split_line[0].split(',').last.strip\n\n unless (addr =~ /[\\s|\\-]+/) \n @dns_map.synchronize do\n addr = @dns_map[addr] if @dns_map.include? addr\n end\n details = {}\n ...
[ "0.7069945", "0.64473915", "0.61474854", "0.6113513", "0.61099225", "0.6057938", "0.6043512", "0.6036926", "0.6008296", "0.59663576", "0.5961736", "0.5956022", "0.5946068", "0.59098256", "0.58747995", "0.58585423", "0.5812697", "0.5773514", "0.57636756", "0.5738976", "0.57318...
0.64455575
2
Main method for decoding a log file entry for its analytics content. This method will create the Track, Session and Event objects and serialise them to the database. Feed a parsed row from a log file to this method to save analytics data to the database. See log_tailer.rb for the most relevant usage example or the method parse_log above. option[:geocode] if true will geocode the data. You most likely want this to be true since we are now resolving this data from the hostip.info database locally (no net latency).
def save_web_analytics!(web_analyser, entry, options = {}) unless row = web_analyser.create(entry) Rails.logger.error "[log_parser] Row could not be created from log data:" Rails.logger.error entry.inspect return nil end Session.transaction do if session = Session.find_or_create_from_track(row) session.save! if session.new_record? extract_internal_search_terms!(row, session, web_analyser) if event = Event.create_from_row(session, row) event.save! session.update_viewcount! else Rails.logger.error "[log_parser] Event could not be created" Rails.logger.error row.inspect end else Rails.logger.error "[log_parser] Sesssion was not found or created! Unknown web property?" Rails.logger.error row.inspect end end rescue Mysql::Error => e Rails.logger.warn "[log_parser] Database could not save this data: #{e.message}" Rails.logger.warn row.inspect rescue ActiveRecord::RecordInvalid => e Rails.logger.error "[log_parser] Invalid record detected: #{e.message}" Rails.logger.error row.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_entry(line)\n raw = line.split(@@break)\n map = Hash.new\n raw.each do |keys|\n parts = keys.split(@@value)\n map.store(parts[0],parts[1])\n end\n #unless USEMEMCACHE != true\n # if Staticentry.get_cache(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s)).nil?\n # ...
[ "0.57882255", "0.5443688", "0.53804356", "0.52788997", "0.52620494", "0.518834", "0.51876473", "0.5180811", "0.5153605", "0.5132258", "0.51206857", "0.51023", "0.50983024", "0.50947326", "0.5048698", "0.5029097", "0.5009011", "0.50048965", "0.49141026", "0.48450372", "0.48287...
0.5351966
3
GET /admin/users/1/posts GET /admin/users/1/posts.xml GET /admin/blogs/1/posts GET /admin/blogs/1/posts.xml GET /admin/blogs/1/tags/1/posts GET /admin/blogs/1/tags/1/posts.xml GET /admin/blogs/1/users/1/posts GET /admin/blogs/1/users/1/posts.xml
def index if params[:blog_id] @blog = Blog.find(params[:blog_id]) if params[:user_id] @user = User.find(params[:user_id]) @posts = @blog.posts.by_user(@user) elsif params[:tag_id] @tag = Tag.find(params[:tag_id]) @posts = @blog.posts.with_tag(@tag) elsif @blog @posts = @blog.posts end elsif params[:user_id] @user = User.find(params[:user_id]) @posts = @user.posts end respond_to do |format| format.html { @posts = @posts.paginate(:page => params[:page], :per_page => 10, :include => [:blog, :comments, :user, :tags]) } format.xml { render :xml => @posts.recent } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n...
[ "0.6824609", "0.67540586", "0.65940946", "0.6478443", "0.6433351", "0.63888973", "0.6347254", "0.6252968", "0.6248224", "0.6242455", "0.6238751", "0.6223553", "0.62128335", "0.6195932", "0.61953384", "0.6189965", "0.6170259", "0.61606437", "0.6159372", "0.6138456", "0.6125499...
0.6858871
0
GET /admin/blogs/1/posts/1 GET /admin/blogs/1/posts/1.xml
def show @post = Post.find(params[:id], :include => [:blog, :comments, :user, :tags]) respond_to do |format| format.html format.xml { render :xml => @post } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end", "def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\...
[ "0.69358885", "0.6901485", "0.6898769", "0.6878824", "0.68131435", "0.6778688", "0.67563516", "0.67505795", "0.669816", "0.66535383", "0.66535383", "0.66481763", "0.6616287", "0.65676033", "0.6503538", "0.6503267", "0.64872384", "0.64172095", "0.6415891", "0.6412116", "0.6403...
0.6225742
36
GET /admin/blogs/1/posts/new GET /admin/blogs/1posts/new.xml
def new @blog = Blog.find(params[:blog_id]) @post = Post.new respond_to do |format| format.html format.xml { render :xml => @post } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def new\n @posts = Post.find(:all, :order => 'updated_at DESC')\n @post = Post.new\n @post.title = \"Überschrift*\"\n\n respond_to...
[ "0.72630364", "0.7254443", "0.722657", "0.7147121", "0.7147121", "0.7147121", "0.71281093", "0.7094495", "0.7068475", "0.70002913", "0.69996285", "0.6999049", "0.69844306", "0.69840944", "0.69700295", "0.69700295", "0.69700295", "0.69700295", "0.69700295", "0.69700295", "0.69...
0.7233026
2
POST /admin/blogs/1/posts POST /admin/blogs/1/posts.xml
def create @blog = Blog.find(params[:blog_id]) @post = @blog.posts.build(params[:post]) @post.user = @current_user respond_to do |format| if @post.save flash[:notice] = 'Post was successfully created.' format.html { redirect_to(admin_blog_post_url(@blog, @post)) } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @blog_post = BlogPost.new(params[:blog_post])\n\n respond_to do |format|\n if @blog_post.save\n flash[:notice] = 'BlogPost was successfully created.'\n format.html { redirect_to(@blog_post) }\n format.xml { render :xml => @blog_post, :status => :created, :location => @...
[ "0.6541072", "0.6391962", "0.6291719", "0.62422496", "0.6224636", "0.6223183", "0.6223183", "0.6207425", "0.6177651", "0.6173609", "0.6171595", "0.6161371", "0.6106536", "0.60948807", "0.60922235", "0.6086343", "0.60849535", "0.6079403", "0.60605174", "0.60477006", "0.6024076...
0.6667602
0
PUT /admin/blogs/1/posts/1 PUT /admin/blogs/1/posts/1.xml
def update @post = Post.find(params[:id], :include => :blog) respond_to do |format| if @post.update_attributes(params[:post]) flash[:notice] = 'Post was successfully updated.' format.html { redirect_to(admin_blog_post_url(@post.blog, @post)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @blog_post = @current_user.blogs.find(params[:id])\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n format.html { redirect_to :controller=>\"blog_posts\", :action => \"index\"}\n format.xml { head :ok }\n else\n format.html { ren...
[ "0.6257026", "0.6181345", "0.6135444", "0.60973865", "0.6086506", "0.6085847", "0.6069159", "0.60505474", "0.60330546", "0.6025063", "0.6020805", "0.59775156", "0.58857477", "0.5874981", "0.5850609", "0.58004075", "0.5788399", "0.5772407", "0.575652", "0.5736348", "0.57341164...
0.614604
2
DELETE /admin/blogs/1/posts/1 DELETE /admin/blogs/1/posts/1.xml
def destroy @post = Post.find(params[:id], :include => :blog) @post.destroy respond_to do |format| format.html { redirect_to(admin_blog_posts_url(@post.blog)) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @blogger = Blogger.find(params[:id])\n @blogger.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bloggers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond...
[ "0.6986942", "0.6889613", "0.6879191", "0.6879191", "0.682594", "0.6807869", "0.6807869", "0.6784644", "0.6754477", "0.6745603", "0.6704858", "0.6682088", "0.66331774", "0.66186756", "0.6608111", "0.65982306", "0.6593553", "0.65802675", "0.6575326", "0.65501887", "0.65483767"...
0.6906154
1
execute the block assuming that interrupting to exit is normal, not an exception
def expect_interrupt begin yield rescue Interrupt puts # to separate the typed `^C` from upcoming program output or shell prompt end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(&block)\n block.call\n puts \"End of block\"\nend", "def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n ...
[ "0.6933913", "0.6793665", "0.6645885", "0.6540266", "0.65318733", "0.65163696", "0.6501427", "0.64728886", "0.6471753", "0.64661384", "0.64601576", "0.6456184", "0.6456184", "0.6417382", "0.6401359", "0.6392904", "0.6353819", "0.6353819", "0.6353819", "0.6353819", "0.6353819"...
0.5967458
79
Returns the name of the class without namespacing.
def name return self.class.name.split('::').last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripped_class_name\n name.demodulize\n end", "def class_unqualified_name(clazz)\n name = clazz.name\n if name =~ /::([^:]+)$/\n $1\n else\n name\n end\n end", "def class_name\n self.class.name.split(\"::\").last\n end", "def full_class_name\n ...
[ "0.79711956", "0.7832437", "0.75352097", "0.7505787", "0.7495265", "0.7473552", "0.745335", "0.74374354", "0.7392972", "0.7348632", "0.7334887", "0.73312414", "0.73290837", "0.732338", "0.7179913", "0.71087337", "0.7100301", "0.70770603", "0.70714194", "0.70700914", "0.706457...
0.71024114
16
Initializes a XML builder.
def builder @builder ||= Builder::XmlMarkup.new(:indent => 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_builder\n @xml_builder ||= begin\n @options[:indent] ||= 2\n builder = @options[:builder] ||= ::Builder::XmlMarkup.new(:indent => 2)\n unless @options[:skip_instruct]\n builder.instruct!\n @options[:skip_instruct] = true\n end\n builder\n end\n...
[ "0.6902191", "0.6848582", "0.6759012", "0.6647119", "0.6351373", "0.63473207", "0.62889564", "0.6275849", "0.6261377", "0.62513995", "0.62247765", "0.62164164", "0.6166448", "0.61393356", "0.61116016", "0.60734946", "0.6055937", "0.6013805", "0.59998715", "0.59914494", "0.599...
0.71276015
0
Outputs XML from the builder as a string.
def to_xml builder.target! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n @builder.to_xml\n end", "def to_xml\n Builder.new(self).to_s\n end", "def to_xml\n output=\"\"\n self.to_rexml.write output\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n ...
[ "0.7606556", "0.75568116", "0.7496763", "0.7398573", "0.7398573", "0.73571116", "0.7331682", "0.7216998", "0.7194871", "0.71508735", "0.71508735", "0.7106179", "0.70991004", "0.7085874", "0.70641977", "0.70012945", "0.7000196", "0.69869924", "0.6971138", "0.6970374", "0.68712...
0.77779025
0
Builds the URL of the queue.
def build_url(base_url, queue_name) return "#{base_url}/#{queue_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queue_url(job)\n sqs.create_queue(queue_name: job.queue_name)[:queue_url]\n end", "def queue_url(*_)\n if Settings.active_job_queue.url\n Settings.active_job_queue.url\n else\n super\n end\n end", "def url_for queue_name, optio...
[ "0.72904736", "0.7271876", "0.7251679", "0.7133003", "0.71203864", "0.68022573", "0.6782153", "0.6701442", "0.6692984", "0.66682214", "0.6624459", "0.66011846", "0.6582842", "0.65297866", "0.639527", "0.6358451", "0.63563883", "0.63448673", "0.63297427", "0.6311573", "0.63084...
0.8530125
0
Asserts that the element is not included in the collection.
def assert_not_include(collection, element, message = "") full_message = build_message(message, "<?> expected not to be included in \n<?>.", element, collection) assert_block(full_message) { !collection.include?(element) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_does_not_contain(collection, x) # :nodoc:\n !assert_contains(collection, x)\n end", "def assert_not_includes(expected_items, collection)\n expected_items = [ expected_items ] unless expected_items.respond_to? \"size\"\n expected_items.each { |item| assert_false collection.include?(it...
[ "0.802821", "0.7998541", "0.7810762", "0.7137407", "0.71301025", "0.70426995", "0.6962946", "0.6866169", "0.68553513", "0.6836208", "0.6823467", "0.67542857", "0.67240787", "0.6484405", "0.6421236", "0.63813925", "0.6333262", "0.63102996", "0.6223969", "0.60967195", "0.609384...
0.82090205
0
Asserts that regexp occurs exactly expected times in string.
def assert_count(expected, regexp, string, message = "") actual = string.scan(regexp).size full_message = build_message(message, "<?> expected to occur ? time(s), but occured ? time(s) in \n<?>.", regexp, expected, actual, string) assert_block(full_message) { expected == actual } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_regexp_number_positive\n @numbers.each do |value, expected|\n assert_equal expected, @TS_Regexp.format(value)\n end\n end", "def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end", "def assert_match(pattern, string, ...
[ "0.6705806", "0.6615721", "0.63594437", "0.62778574", "0.62495524", "0.6182002", "0.6125985", "0.61123514", "0.6075411", "0.606692", "0.606692", "0.599966", "0.59985465", "0.59593856", "0.5942523", "0.59070766", "0.58537483", "0.5852295", "0.5847872", "0.5847872", "0.5821418"...
0.7979227
0
Asserts that the given active model record is valid. This method used to be part of Rails but was deprecated, no idea why.
def assert_valid(record, message = "") record.valid? full_message = build_message(message, "? expected to be valid, but has the following errors: \n ?.", record.to_s, record.errors.full_messages.join("\n")) assert_block(full_message) { record.valid? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_valid(record)\n clean_backtrace do\n assert record.valid?, record.errors.full_messages.join(\"\\n\")\n end\n end", "def assert_valid model, msg=nil\n valid = model.valid?\n msg = [\"Expected #{model.class} to be valid but it had these errors:\",\n *model.errors.f...
[ "0.75296456", "0.70627123", "0.69697475", "0.69697475", "0.6855171", "0.68471384", "0.6818669", "0.66030073", "0.65377116", "0.6517548", "0.6452399", "0.64128906", "0.6369189", "0.6311031", "0.6303605", "0.626278", "0.6166031", "0.61659944", "0.612389", "0.6100935", "0.605640...
0.67436856
7
Asserts that the given active model record is not valid. If you provide a set of invalid attribute symbols, all of and only these attributes are expected to have errors. If no invalid attributes are specified, only the invalidity of the record is asserted.
def assert_not_valid(record, *invalid_attrs) message = build_message("", "? expected to be invalid, but is valid.", record.to_s) assert_block(message) { !record.valid? } # assert that the given attributes have errors. invalid_attrs.each do |a| message = build_message("", "Attribute <?> expected to be invalid, but is valid.", a.to_s) assert_block(message) { record.errors[a].present? } end if invalid_attrs.present? # assert that no other than the invalid attributes have errors. record.errors.each do |a, error| message = build_message("", "Attribute <?> not declared as invalid attribute, but has the following error: \n?.", a.to_s, error) assert_block(message) { invalid_attrs.include?(a) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_invalid(model, *attributes)\n assert(!model.valid?, \"#{model.inspect} should be invalid, but isn't.\")\n \n return if attributes.empty?\n\n missing_invalids = attributes - invalid_attributes(model)\n\n assert missing_invalids.empty?,\n \"Attribute(s) #{missing_invalids.join(\", \")}...
[ "0.80615664", "0.73294085", "0.7233475", "0.7178032", "0.7029574", "0.6926216", "0.68624556", "0.6857653", "0.6828262", "0.68104047", "0.67854965", "0.67055196", "0.66985565", "0.66926336", "0.6548701", "0.6522286", "0.6520727", "0.65028995", "0.6491196", "0.6430634", "0.6426...
0.83201426
0
The method used to by Test::Unit to format arguments in build_message. Prints ActiveRecord objects in a simpler format. Only works for Ruby 1.9
def mu_pp(obj) if obj.is_a?(ActiveRecord::Base) obj.to_s else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_arguments; end", "def to_s ; format ; end", "def to_s\n \"#{self.class.to_s}::<#{object_id}> Args: #{args}\"\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "...
[ "0.6516891", "0.63457227", "0.6325064", "0.6251604", "0.6251604", "0.6251604", "0.6251604", "0.6251604", "0.6251604", "0.6251604", "0.6251604", "0.6215248", "0.62089175", "0.6199898", "0.61689675", "0.61689675", "0.61689675", "0.61689675", "0.61689675", "0.6116454", "0.609380...
0.63230854
3
Use callbacks to share common setup or constraints between actions.
def set_city @city = City.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
Only allow a trusted parameter "white list" through.
def city_params params.require(:city).permit(:location, :city) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
A plaintext (html tags removed) description that is also truncated to specified chars. We don't want it escaped here, cause it will be escaped appropriately as point of use (which might be in a URL query param). But also NOT marked html_safe, because it's not! The truncate helper makes that hard, we have to embed it in a string literal to get it neither escaped nor marked html_safe
def format_plain return "" if description.blank? # remove all tags, but no need or desire to escape punctuation etc into HTML entities str = Loofah.fragment(description).text(:encode_special_chars => false) if @truncate str = "#{truncate(str, escape: false, length: @truncate, separator: /\s/)}" end return str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_truncated_description(args)\n truncated_output = String.new\n content_tag :div, class: 'truncate-description' do\n description = args[:value].first\n button = \"<span class='view-more' href>Read More <div class='down-arrow'>&raquo;</div></span></br>\"\n truncated_output <<...
[ "0.7611274", "0.75499386", "0.7490984", "0.7303448", "0.7302652", "0.72778", "0.7276327", "0.7238201", "0.72325736", "0.7172896", "0.7132524", "0.7116818", "0.70275664", "0.7024867", "0.69683945", "0.69668627", "0.69668627", "0.69668627", "0.69437236", "0.691656", "0.6916229"...
0.7541086
2
Sanitize the HTML. Should have been sanitized on input, but just to be safe.
def sanitize(str) DescriptionSanitizer.new.sanitize(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_html\n self.data = self.class.clean_html(self.data) unless self.data.nil?\n end", "def clean_html(html)\n Sanitize.clean(html) rescue html\n end", "def sanitize!(ht...
[ "0.84020996", "0.84020996", "0.8256249", "0.78497964", "0.7811076", "0.7714489", "0.7667715", "0.764667", "0.75642854", "0.75642854", "0.74777883", "0.7448312", "0.73771966", "0.73508894", "0.725127", "0.7136549", "0.7099164", "0.70809454", "0.7065746", "0.7048275", "0.699393...
0.0
-1