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
========================================================================== auth not required available to anyone ==========================================================================
def index @user = User.find_by_id(session[:user]) @stories = Story.find :all, :order => 'updated_at DESC', :limit => 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth\n end", "def auth\n end", "def http_auth?; end", "def auth_param; end", "def valid_for_http_auth?; end", "def auth\n {}\n end", "def auth(value); end", "def http_auth_login\n # FIXME: Implement\n end", "def require_auth\n head :unauthorized unless cur...
[ "0.8134642", "0.8134642", "0.8011821", "0.7686608", "0.76802367", "0.7625633", "0.7590445", "0.7573058", "0.7537366", "0.7522947", "0.7503559", "0.7503559", "0.73876065", "0.7386977", "0.73645234", "0.73007107", "0.7285454", "0.724081", "0.72332615", "0.72242916", "0.71924144...
0.0
-1
========================================================================== auth required available to members ==========================================================================
def new @story = Story.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_member!\n end", "def auth\n end", "def auth\n end", "def authenticate_request!\n raise Exceptions::UnauthorizedError unless current_member\n\n current_member\n end", "def auth_methods; end", "def auth_param; end", "def auth(value); end", "def allowed_auth_method...
[ "0.7825281", "0.7579807", "0.7579807", "0.7325686", "0.7305579", "0.70795125", "0.6983063", "0.6935456", "0.6875348", "0.6857479", "0.685348", "0.6807214", "0.68011004", "0.68010664", "0.6797936", "0.6796126", "0.6796126", "0.67555845", "0.67438596", "0.67290306", "0.67207974...
0.0
-1
========================================================================== auth required ADMIN ==========================================================================
def destroy @story = Story.find(params[:id]) if @story.destroy flash[:notice] = "Artigo apagado" else flash[:error] = "Houve um problema ao apagar o artigo" end redirect_to stories_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_auth\n\t\tif signed_out?\n deny_access \"You must sign in first.\"\t\t\t\n\t\telse\n\t deny_access \"You must be an admin to perform that action.\" unless current_user.admin\n\t\tend\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def authe...
[ "0.82346433", "0.81284076", "0.7978326", "0.78942806", "0.78402317", "0.7836018", "0.7776646", "0.77433765", "0.77412987", "0.77393734", "0.77345943", "0.76695806", "0.7664144", "0.76613647", "0.76588535", "0.76515394", "0.76515394", "0.76496047", "0.76496047", "0.7649247", "...
0.0
-1
GET /portal_grades GET /portal_grades.xml
def index # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE # authorize Portal::Grade # PUNDIT_REVIEW_SCOPE # PUNDIT_CHECK_SCOPE (did not find instance) # @grades = policy_scope(Portal::Grade) @portal_grades = Portal::Grade.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @portal_grades } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end", "def get_grades(user_id, course_id, use_source_domain = nil)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_USERGRADEBOOKITEMS \r\n\t if !use_source_domain.nil?\r\n...
[ "0.6848463", "0.6273877", "0.6213627", "0.6159683", "0.60664153", "0.60664153", "0.60664153", "0.60664153", "0.60399175", "0.59853023", "0.5867989", "0.5865154", "0.58452487", "0.57138264", "0.56874514", "0.5670687", "0.5666528", "0.56659317", "0.56618047", "0.565782", "0.565...
0.67424566
1
GET /portal_grades/1 GET /portal_grades/1.xml
def show # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE (did not find instance) # authorize @grade @portal_grade = Portal::Grade.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @portal_grade } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Grade\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (did not find instance)\n # @grades = policy_scope(Portal::Grade)\n @portal_grades = Portal::Grade.all\n\n respond_to do |format|\n format.html # ...
[ "0.6540596", "0.64612347", "0.6276824", "0.6136176", "0.6041952", "0.59894603", "0.5937578", "0.58220696", "0.58220696", "0.58220696", "0.58220696", "0.58079284", "0.57962537", "0.5779074", "0.576844", "0.5750988", "0.57370013", "0.570172", "0.5696609", "0.5673538", "0.566574...
0.63284624
2
GET /portal_grades/new GET /portal_grades/new.xml
def new # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE # authorize Portal::Grade @portal_grade = Portal::Grade.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @portal_grade } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @staffgrade = Staffgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staffgrade }\n end\n end", "def new\n @ratgrade = Ratgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => ...
[ "0.73631287", "0.72598237", "0.7080281", "0.69860333", "0.6914125", "0.68992996", "0.6819383", "0.6804884", "0.6765627", "0.6765627", "0.6713686", "0.6680785", "0.6654715", "0.6653923", "0.6646789", "0.6636223", "0.66305894", "0.6623268", "0.6617407", "0.6612715", "0.65941685...
0.7378837
0
POST /portal_grades POST /portal_grades.xml
def create # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE # authorize Portal::Grade @portal_grade = Portal::Grade.new(params[:portal_grade]) respond_to do |format| if @portal_grade.save flash[:notice] = 'Grade was successfully created.' format.html { redirect_to(@portal_grade) } format.xml { render :xml => @portal_grade, :status => :created, :location => @portal_grade } else format.html { render :action => "new" } format.xml { render :xml => @portal_grade.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @grade = Grade.new(params[:grade])\n respond_to do |format|\n if @grade.save\n @grade.upload_to_scribd!\n format.html { redirect_to \"/assignments/#{@grade.assignment_id}\" }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n ...
[ "0.5947724", "0.5840544", "0.5790898", "0.5761745", "0.57548195", "0.57503563", "0.5746813", "0.571952", "0.568838", "0.56789315", "0.5657114", "0.5634986", "0.5504122", "0.5463288", "0.54486215", "0.5370755", "0.5369821", "0.5328143", "0.53201514", "0.530921", "0.53070384", ...
0.6705665
0
PUT /portal_grades/1 PUT /portal_grades/1.xml
def update # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE (did not find instance) # authorize @grade @portal_grade = Portal::Grade.find(params[:id]) respond_to do |format| if @portal_grade.update_attributes(params[:portal_grade]) flash[:notice] = 'Grade was successfully updated.' format.html { redirect_to(@portal_grade) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @portal_grade.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end", "def update\n @staffgrade = Staffgrade.find(params[:id])\n\n respond_to do |format|\n if @staffgra...
[ "0.6365745", "0.6319611", "0.6290411", "0.62235326", "0.6215058", "0.60693717", "0.60411453", "0.603023", "0.6004324", "0.599807", "0.598671", "0.59574413", "0.5932828", "0.58600396", "0.58561796", "0.5842538", "0.58272594", "0.57889843", "0.57829535", "0.5696921", "0.5694922...
0.683574
0
DELETE /portal_grades/1 DELETE /portal_grades/1.xml
def destroy # PUNDIT_REVIEW_AUTHORIZE # PUNDIT_CHECK_AUTHORIZE (did not find instance) # authorize @grade @portal_grade = Portal::Grade.find(params[:id]) @portal_grade.destroy respond_to do |format| format.html { redirect_to(portal_grades_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ratgrade = Ratgrade.find(params[:id])\n @ratgrade.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratgrades_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @staffgrade = Staffgrade.find(params[:id])\n @staffgrade.destroy\n\n respond_to ...
[ "0.66639835", "0.66347754", "0.65093625", "0.64378923", "0.6200371", "0.61861765", "0.61788267", "0.61274105", "0.61256903", "0.6082417", "0.607264", "0.6048897", "0.6045539", "0.60418683", "0.60165656", "0.6012558", "0.5996852", "0.59816706", "0.598102", "0.5973938", "0.5955...
0.68664056
0
going to be REAL MESSY for now..
def extract if @options[:type] == :text @potential_names += @content.split(/\n/) elsif @options[:type] == :html @potential_names += HTMLNameFinder.new(@content).names @potential_names += @nokogiri_doc.css("title, p, li, span, a").map(&:text) end @name_detector = NameDetector.new(@potential_names) @extract = @name_detector.extract_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def stderrs; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def anchored; end", "def terpene; end", "def malts; end", "def who_we_are\r\n end", "def formation; end", "def berlioz; end", "de...
[ "0.7257328", "0.68424517", "0.657983", "0.63172513", "0.6181113", "0.6181113", "0.6181113", "0.6181113", "0.60980153", "0.6086525", "0.60734385", "0.6031533", "0.602129", "0.60138106", "0.60123116", "0.60042346", "0.59312266", "0.59071344", "0.5890884", "0.5890884", "0.588756...
0.0
-1
GET /group_members/1 ==> [group_id]
def show @group_members = GroupMember.where(group_id:params[:id]) @users_in_group=[] @group_members.each do |f| @user = User.find(f[:user_id]) @users_in_group.push(@user) end render json: @users_in_group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_members(id)\n get(\"/groups/#{id}/members\")\n end", "def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if !@group.nil...
[ "0.806132", "0.80053055", "0.7968689", "0.7826638", "0.7737202", "0.7585207", "0.75556564", "0.744053", "0.744053", "0.7421064", "0.7407898", "0.7395968", "0.73943263", "0.7369341", "0.7352253", "0.7312699", "0.72662914", "0.72488093", "0.7220569", "0.72099614", "0.7141162", ...
0.68238837
39
Use callbacks to share common setup or constraints between actions.
def set_group_member @group_member = GroupMember.find_by(group_id: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 group_member_params params.require(:group_member).permit(:name, :group_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "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
Returns the basic auth credentials if available.
def auth @auth ||= Hash.new if !@auth[:username] && @headers['Authorization'] str = Base64.decode64 @headers['Authorization'].split[1] username, password = str.split(":", 2) @auth = {:username => username, :password => password}.merge @auth end @auth end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end", "def auth_credentials\n auth = Rack::Auth::Basic::Request.new(request....
[ "0.8200519", "0.800249", "0.7944771", "0.76405627", "0.7587219", "0.75267756", "0.7490856", "0.7394724", "0.73705405", "0.73670924", "0.7299923", "0.7291651", "0.7265955", "0.7255012", "0.7255012", "0.7251365", "0.72361594", "0.72281146", "0.7191428", "0.71753514", "0.7160841...
0.0
-1
Assigns the cookie string.
def cookie= cookie_str @headers['Cookie'] = cookie_str if @use_cookies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookie(name, value)\n @cookies[\"flexi_#{@id}_#{name}\"] = value\n return value\n end", "def set_cookie(name, value)\n test_cookies[name] = value\n end", "def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n ca...
[ "0.70979655", "0.68490267", "0.6825364", "0.6768513", "0.673038", "0.67127407", "0.66908425", "0.6681502", "0.6642656", "0.6594423", "0.6581152", "0.6576023", "0.6573805", "0.65453744", "0.65151227", "0.6514807", "0.65130264", "0.6496046", "0.6489468", "0.648389", "0.648389",...
0.78433967
1
Assigns the http method.
def http_method= new_verb @http_method = new_verb.to_s.upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_method(v)\n endpoint_info[:http_method] = v\n end", "def http_method(value = nil)\n if value\n @http_method = value\n else\n @http_method\n end\n end", "def http_method\n\t\t\t\treturn @http_method if defined?(@http_method)\n\n\t\t\t\tmethod_from_met...
[ "0.8014927", "0.7979425", "0.78619057", "0.78400034", "0.7651818", "0.7536041", "0.7244738", "0.7244738", "0.72335696", "0.7164667", "0.6886686", "0.6886241", "0.6867984", "0.6851551", "0.6840861", "0.68332154", "0.68193287", "0.68173474", "0.67559063", "0.6743401", "0.672977...
0.80735403
1
Returns the HTTP request object.
def http_request req = VanillaRequest.new @http_method, @uri.request_uri, @headers req.basic_auth @auth[:username], @auth[:password] if @auth && @auth[:username] req end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_request\n @http_request ||= begin\n request = request_for_verb\n add_post_data(request)\n add_bearer_token(request)\n add_headers(request)\n request\n end\n end", "def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end"...
[ "0.8031314", "0.7869221", "0.78348285", "0.776874", "0.7669509", "0.76209253", "0.7509783", "0.7509783", "0.7473546", "0.74571353", "0.7352305", "0.7310471", "0.7273246", "0.7270176", "0.7265952", "0.72211117", "0.71382", "0.71286505", "0.7107451", "0.7034394", "0.70122355", ...
0.7142474
16
Assign the use of a proxy. The proxy_opts arg can be a uri String or a Hash with the :address key and optional :username and :password keys.
def http_proxy addr, opts={} return Net::HTTP unless addr host, port = addr.split ":" port ||= opts[:port] || 8080 user = opts[:username] pass = opts[:password] Kronk::Cmd.verbose "Using proxy #{addr}\n" if host Net::HTTP::Proxy host, port, user, pass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_proxy(opts)\n opts = check_params(opts,[:proxy_info])\n super(opts)\n end", "def proxy(url, opts={})\n @proxies[url] = opts\n end", "def set_proxy address, port, user = nil, password = nil\n @proxy_addr = address\n @proxy_port = port\n @proxy_user = user\n @proxy_pass =...
[ "0.79281175", "0.77226055", "0.764486", "0.75484395", "0.7518483", "0.72959137", "0.72632235", "0.7262506", "0.7247098", "0.72443813", "0.7212044", "0.7196932", "0.7104773", "0.6890611", "0.6849287", "0.6849287", "0.6808567", "0.680697", "0.6706162", "0.6693766", "0.6685542",...
0.7238561
10
Assign the uri and io based on if the uri is a file, io, or url.
def uri= new_uri @uri = self.class.build_uri new_uri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri= uri_or_string\n if uri_or_string.respond_to?(:host)\n @uri = uri_or_string\n else\n string = uri_or_string =~ /^http/ ? uri_or_string : 'http://' + uri_or_string.to_s\n @uri = URI.parse(string)\n end\n @server = Net::HTTP.new(uri.host, uri.port)\n end", "def u...
[ "0.68373674", "0.67372996", "0.6518025", "0.63698983", "0.6340932", "0.6251896", "0.62003857", "0.61943465", "0.61795276", "0.61668265", "0.6099828", "0.6099828", "0.6078686", "0.6070268", "0.60263735", "0.60109323", "0.60109323", "0.60109323", "0.60109323", "0.5980851", "0.5...
0.5810496
25
Decide whether to use cookies or not.
def use_cookies= bool if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?) cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s @headers['Cookie'] = cookie unless cookie.empty? else @headers.delete 'Cookie' end @use_cookies = bool end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n elsif !bool\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end...
[ "0.76650417", "0.75777227", "0.70494753", "0.69706666", "0.69706666", "0.69706666", "0.69706666", "0.69706666", "0.69706666", "0.69706666", "0.695557", "0.6807186", "0.6799025", "0.6770178", "0.6764302", "0.6694582", "0.6694582", "0.6690253", "0.66819286", "0.66791683", "0.66...
0.75971156
1
Assign a User Agent header.
def user_agent= new_ua @headers['User-Agent'] = new_ua && Kronk.config[:user_agents][new_ua.to_s] || new_ua || Kronk::DEFAULT_USER_AGENT end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end", "def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end", "def user_agent=(user_agent)\n @user_agent = user_agent\n ...
[ "0.79428893", "0.79428893", "0.79428893", "0.79428893", "0.79428893", "0.7754459", "0.7345348", "0.728267", "0.72204864", "0.6961458", "0.69581014", "0.6951192", "0.6935251", "0.6672569", "0.66488934", "0.66488934", "0.66488934", "0.66488934", "0.66488934", "0.66488934", "0.6...
0.7616488
7
Read the User Agent header.
def user_agent @headers['User-Agent'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent\n @data[\"user_agent\"]\n end", "def user_agent\n @request['User-Agent']\n end", "def user_agent_on_header\n request.headers['HTTP_USER_AGENT']\n end", "def user_agent\n headers[\"HTTP_USER_AGENT\"] || headers[\"USER-AGENT\"]\n end", "def get_user_agent\n user...
[ "0.75735027", "0.7495876", "0.74563426", "0.73740244", "0.736895", "0.71271586", "0.7113645", "0.70372796", "0.7019833", "0.6938536", "0.6914303", "0.6914303", "0.6867195", "0.6867195", "0.6867195", "0.6812859", "0.68037176", "0.6702099", "0.6489713", "0.6386898", "0.63736516...
0.79317075
2
Check if this is an SSL request.
def ssl? @uri.scheme == "https" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl?\n return @request_uri.scheme == \"https\"\n end", "def ssl?\n @url.scheme == 'https'\n end", "def ssl?\n uri.scheme == 'https'\n end", "def ssl?\n uri.scheme == 'https'\n end", "def ssl?\n uri_endpoint.scheme == 'https'\n end", "def ssl?\n @head...
[ "0.82689804", "0.78814477", "0.7837875", "0.7837875", "0.7832652", "0.7749303", "0.7702773", "0.7685337", "0.76782733", "0.7668587", "0.7638191", "0.763135", "0.75952905", "0.7589356", "0.75649774", "0.7561973", "0.75456953", "0.7518626", "0.74921393", "0.74803007", "0.746445...
0.7884586
2
Assign whether to use ssl or not.
def ssl= bool @uri.scheme = bool ? "https" : "http" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl=(ssl)\n @ssl = if ssl == true || ssl =~ /(true|t|yes|y|1)$/i\n true\n else\n false\n end\n end", "def use_ssl?; end", "def ssl?; end", "def ssl?; end", "def use_ssl?\n @ssl\n end", "def usessl?\n @usessl\n end", "def use_ssl?\n...
[ "0.8319328", "0.82412237", "0.8113454", "0.8113454", "0.80570805", "0.805706", "0.8051032", "0.80060554", "0.7918468", "0.7877911", "0.7808463", "0.77716917", "0.77716917", "0.77628624", "0.7761831", "0.7761831", "0.77568835", "0.7753574", "0.77359855", "0.77359855", "0.77270...
0.8393315
1
Retrieve this requests' response.
def retrieve http_class = http_proxy @proxy[:host], @proxy @_req = http_class.new @uri.host, @uri.port @_req.read_timeout = @timeout if @timeout @_req.use_ssl = true if @uri.scheme =~ /^https$/ elapsed_time = nil socket = nil socket_io = nil @_res = @_req.start do |http| socket = http.instance_variable_get "@socket" socket.debug_output = socket_io = StringIO.new start_time = Time.now res = http.request self.http_request, @body elapsed_time = Time.now - start_time res end Kronk.cookie_jar.set_cookies_from_headers @uri.to_s, @_res.to_hash if self.use_cookies @response = Response.new socket_io, @_res, self @response.time = elapsed_time @response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Response()\n \t return @outputs[\"Response\"]\n \tend", "def get_Response()\n \t return @outputs[\"Response\"]\n \tend", "def get_Response()\n \t return @outputs[\"Response\"]\n \tend", "def get_Response()\n \t return @outputs[\"Response\"]\n \tend", "def get_Response()\...
[ "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.80271435", "0.8015506", "0.7925372", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925028", "0.7925...
0.0
-1
Returns the raw HTTP request String.
def to_s out = "#{@http_method} #{@uri.request_uri} HTTP/1.1\r\n" out << "host: #{@uri.host}:#{@uri.port}\r\n" self.http_request.each do |name, value| out << "#{name}: #{value}\r\n" unless name =~ /host/i end out << "\r\n" out << @body.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n out = \"#{@http_method} #{@uri.request_uri} HTTP/1.1\\r\\n\"\n out << \"Host: #{@uri.host}:#{@uri.port}\\r\\n\"\n\n http_request.each do |name, value|\n out << \"#{name}: #{value}\\r\\n\" unless name =~ /host/i\n end\n\n out << \"\\r\\n\"\n\n if @body.respond_to?(:re...
[ "0.727364", "0.69600296", "0.66420066", "0.6527482", "0.6520622", "0.64491695", "0.63976574", "0.6271037", "0.6259756", "0.6236128", "0.6132159", "0.6083503", "0.6081281", "0.607472", "0.6061257", "0.5991761", "0.59768283", "0.59693193", "0.59610456", "0.59242535", "0.5910411...
0.7152661
1
This method is for brand users to see their requests that are related to this startup
def requests @requests = @startup.requests.startup_related_requests(current_user.brand_id) .order(created_at: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_started\n intro_and_request_permissions\n end", "def show_startup\n authorize! :investor_connect_with_startups, current_user\n # Only allow temporary investor account access to their suggested startups\n if [2367, 2375, 2435, 2436, 2437, 2438, 2459, 2466].include?(current_user.id)\n cal...
[ "0.6185273", "0.60964185", "0.59822327", "0.59533244", "0.5846475", "0.58300793", "0.58265173", "0.5817101", "0.57669276", "0.5752893", "0.57413894", "0.57252264", "0.56760705", "0.56101936", "0.5583395", "0.55816245", "0.55812365", "0.5568494", "0.55577356", "0.55425817", "0...
0.6791154
0
=> Analyse l'option de ligne de commande
def treat_as_option doption option = nil valeur = nil if doption.start_with? '--' doption.gsub(/^--([^=]+)=?(.*)?$/){ option = $1 valeur = $2 } else option_courte = doption[1..1] option = OPTION_LIST[option_courte] fatal_error(:unknown_option, :option => option_courte) if option.nil? valeur = doption[2..-1] end # Est-ce que c'est une "option-command" if OPTION_COMMAND_LIST.has_key? option @@command = option else @@options = @@options.merge option => valeur end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options(opt); end", "def options(opt); end", "def options() end", "def process_command_line_options\r\n begin\r\n defer, found = \"\", false\r\n opts = GetoptLong.new(\r\n [ \"--help\", \"-h\", \"-?\", GetoptLong::NO_ARGUMENT ],\r\n [ \"--load\", \"-l\", Getop...
[ "0.6377345", "0.637626", "0.63755816", "0.63435525", "0.62745917", "0.6246886", "0.6246886", "0.6246886", "0.62201804", "0.6167451", "0.6167451", "0.6129034", "0.60767967", "0.6074044", "0.6066357", "0.60486495", "0.60095185", "0.59998876", "0.5972892", "0.59635955", "0.59334...
0.67668897
0
=> Produit le pdf et l'ouvre
def generate_pdf begin raise( :lilyfile_does_not_exists ) unless File.exists?( path_lily_file ) `lilypond --output='#{path_affixe_file}' '#{path_lily_file}'` `open '#{path_pdf_file}'` rescue Exception => e fatal_error e.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf1\n \n \n @company =Company.find(1)\n @cabecera =\"Facturacion\"\n @abajo =\"Viatico\"\n \n @cout = Cout.find(params[:id])\n \n Prawn::Document.generate(\"app/pdf_output/#{@cout.id}.pdf\" ,:page_size => \"A4\",:margin=> 2 ) do |pdf|\n pdf.font \"Helvetica\"\n ...
[ "0.71021163", "0.69785696", "0.69780004", "0.69769233", "0.6972289", "0.68994546", "0.6859801", "0.6763033", "0.67473286", "0.6659852", "0.6651626", "0.65888286", "0.65872425", "0.65717244", "0.6569472", "0.6562237", "0.6539161", "0.6523104", "0.6522748", "0.64863497", "0.648...
0.0
-1
=> Message de fin de conversion
def end_conversion # @todo: pour le moment : puts "Fichier converti avec succès".as_blue true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(message) end", "def to_s; message; end", "def message\n to_s\n end", "def message\n to_s\n end", "def message( message )\n\tend", "def parse(msg)\n \"テストアラートメッセージ\"\n # TODO: XMLパース整形処理\n end", "def to_s()\r\n\t\treturn \"Demande inscription n°#{@id} : #{@expediteur},#{@motDe...
[ "0.64140266", "0.63430846", "0.6216361", "0.6216361", "0.6211695", "0.6204494", "0.61525667", "0.6145731", "0.6113799", "0.6089263", "0.60553664", "0.6018015", "0.60098916", "0.59779716", "0.59779716", "0.5956814", "0.5937646", "0.5937646", "0.59304756", "0.5866444", "0.58425...
0.6226916
2
Main engine for analyse of excel file
def run parse do self.current_sheet.processing! ss = Roo::Spreadsheet.open(self.new_file_path) current_uploader = Uploader.find(self.uploader_id) total_count = ss.last_row - 1 current_uploader.update_total_row(total_count) case current_uploader.category when Uploader::TYPES[:default] upload_indicator(ss, current_uploader) when Uploader::TYPES[:indicator_2_0] upload_health_care_indicators(ss, current_uploader) when Uploader::TYPES[:resources] upload_resources(ss, current_uploader) when Uploader::TYPES[:indicator_map_color] upload_indicators_map_color(ss, current_uploader) else upload_description_template(ss, current_uploader) end end self.current_sheet.completed! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n case @options.scan_type\n when :directory\n scan_dirs\n parse_files\n excel_report\n when :file\n @scan_files = Array.new\n @scan_files << @options.scan_file\n parse_files\n excel_report\n end\n end", "def setup(file)\r\n base_xl = (file).gsub('/','\\\\'...
[ "0.64008296", "0.62122273", "0.6113574", "0.6108469", "0.60747164", "0.5990229", "0.59673196", "0.5962253", "0.5925417", "0.58368325", "0.58032674", "0.57836425", "0.5761572", "0.575149", "0.57249206", "0.5722753", "0.57065755", "0.57028043", "0.569796", "0.5684169", "0.56788...
0.5566543
30
Define a method to convert Cartesian (x,y) coordinates to Polar
def polar(x,y) theta = Math.atan2(y,x) # Compute the angle r = Math.hypot(x,y) # Compute the distance [r, theta] # The last expression is the return value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polar_point_from(cartesian_point)\n x = cartesian_point.x\n y = cartesian_point.y\n\n r = Math.sqrt((x * x) + (y * y))\n theta = Math.atan2(y, x)\n\n # :Point is the version 2.0.0 point, so it takes r and theta\n Point.new(r, theta)\nend", "def conv_xy_to_polar(x,y)\r\n# - - - - - - - - - - - - - - - -...
[ "0.6862843", "0.68368924", "0.6514294", "0.6133643", "0.6102403", "0.5994406", "0.58908045", "0.58871937", "0.58569163", "0.58474165", "0.58176476", "0.5815184", "0.57731026", "0.57540697", "0.56985474", "0.5649324", "0.55834126", "0.55675286", "0.552164", "0.550067", "0.5478...
0.5906633
6
trying to define instance level var
def instance_var @instance_var end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_variables() end", "def initialize\n @instance_variable = 3 # Available in instance methods\n end", "def instance_variables; end", "def class_variables() end", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_va...
[ "0.74709916", "0.7251796", "0.7014968", "0.700275", "0.69237417", "0.69237417", "0.69237417", "0.6682963", "0.6671017", "0.6574419", "0.65688634", "0.65688634", "0.65688634", "0.65688634", "0.6534804", "0.6492501", "0.6492501", "0.64875686", "0.6458459", "0.64561015", "0.6412...
0.6944287
4
A method named "x". Always returns 1
def test p x # No variable has been seen; refers to method above: prints 1 # The line below is never evaluated, because of the "if false" clause. But # the parser sees it and treats x as a variable for the rest of the method. x = 0 if false p x # x is a variable, but has never been assigned to: prints nil x = 2 # This assignment does get evaluated p x # So now this line prints 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x; 1; end", "def x\n end", "def x\n end", "def x\n end", "def x; end", "def x; end", "def x; end", "def x; end", "def x; end", "def x() @x end", "def x\n 0\n end", "def x \n @x \n end", "def x #getter method\n\t\t@x\n\tend", "def s(x); 1; end", "def x\n @x\n ...
[ "0.8067429", "0.78561586", "0.78128403", "0.78128403", "0.7523853", "0.7523853", "0.7523853", "0.7523853", "0.7523853", "0.74262017", "0.7038661", "0.70056593", "0.69737977", "0.69182026", "0.6849324", "0.6677228", "0.6626888", "0.6626888", "0.6626888", "0.6568128", "0.653143...
0.0
-1
Recursivly call the transformer_worker with all the the compound data we have collected in the first pass
def transform_and_load_compounds! compound_records.each_slice(batch_size) do |compound_records_batch| transformer_worker_klass.perform_async( compound_records_batch, solr_config, cdm_endpoint, oai_endpoint, field_mappings, batch_size ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_and_transform; end", "def each_needed_transformation(&block)\n if !block_given?\n return enum_for(:each_needed_transformation)\n end\n\n needed_transformations.each(&block)\n supercall(nil, :each_needed_transformation, &block)\n end", "d...
[ "0.6490351", "0.609604", "0.55886", "0.5522557", "0.5509941", "0.54616594", "0.542857", "0.5385354", "0.5308729", "0.5260288", "0.52414185", "0.5203903", "0.52021337", "0.5192116", "0.517876", "0.5143641", "0.5127899", "0.5125328", "0.5124403", "0.51190645", "0.51115704", "...
0.73334426
0
GET /houses GET /houses.json
def index @complex_buildings = ComplexBuilding.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.h...
[ "0.7755468", "0.72251153", "0.72251153", "0.72251153", "0.70419747", "0.70419747", "0.70419747", "0.70419747", "0.7013426", "0.68941134", "0.6879322", "0.6842397", "0.6824697", "0.67889386", "0.6775232", "0.6765745", "0.6748915", "0.67026335", "0.6695037", "0.6578647", "0.653...
0.0
-1
GET /houses/1 GET /houses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end", "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render...
[ "0.7757515", "0.7757515", "0.7757515", "0.7454755", "0.7165616", "0.703296", "0.703296", "0.69945854", "0.6888096", "0.6836465", "0.68340325", "0.6821874", "0.6821874", "0.6821874", "0.6821874", "0.67988986", "0.67411494", "0.66795", "0.6622453", "0.6611221", "0.6591484", "...
0.0
-1
POST /houses POST /houses.json
def create @complex_building = ComplexBuilding.new(complex_building_params.merge(user_id: current_user.id)) respond_to do |format| if @complex_building.save format.html { redirect_to @complex_building, notice: 'Complex Building was successfully created.' } format.json { render :show, status: :created, location: @complex_building } else format.html { render :new } format.json { render json: @complex_building.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @house = House.new(house_params)\n\n if @house.save\n render :show, status: :created, location: @house\n else\n render json: @house.errors, status: :unprocessable_entity\n end\n end", "def create\n @house = House.new(house_params)\n\n respond_to do |format|\n if @ho...
[ "0.71898353", "0.71595514", "0.70852405", "0.6993376", "0.67583257", "0.667636", "0.66742873", "0.66742873", "0.66664743", "0.6618007", "0.65094775", "0.64636993", "0.64609957", "0.6450269", "0.6448202", "0.63951737", "0.63854617", "0.6384249", "0.63433623", "0.6325763", "0.6...
0.0
-1
PATCH/PUT /houses/1 PATCH/PUT /houses/1.json
def update respond_to do |format| if @complex_building.update(complex_building_params) format.html { redirect_to @complex_building, notice: 'complex_building was successfully updated.' } format.json { render :show, status: :ok, location: @complex_building } else format.html { render :edit } format.json { render json: @complex_building.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @house = House.find(params[:id])\n\n respond_to do |format|\n if @house.update_attributes(params[:house])\n format.html { redirect_to @house, notice: 'Gig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\"...
[ "0.69253844", "0.6804635", "0.6692679", "0.6692679", "0.6692679", "0.6692679", "0.66691625", "0.66691625", "0.66691625", "0.6668993", "0.65898436", "0.65022004", "0.65022004", "0.6394387", "0.6343761", "0.6331762", "0.62952375", "0.6277168", "0.6246402", "0.6243866", "0.62156...
0.0
-1
DELETE /houses/1 DELETE /houses/1.json
def destroy @complex_building.destroy respond_to do |format| format.html { redirect_to complex_buildings_url, notice: 'complex_building was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n f...
[ "0.775449", "0.775449", "0.7703315", "0.7703315", "0.7672422", "0.7645576", "0.757675", "0.74771893", "0.74771893", "0.74771893", "0.74771893", "0.74771893", "0.74771893", "0.7450561", "0.7419867", "0.74038297", "0.73984444", "0.72788393", "0.7218025", "0.7164156", "0.7153549...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_complex_building @complex_building = ComplexBuilding.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 list of trusted parameters through.
def complex_building_params params.require(:complex_building).permit(:owner, :address, :units, :sqmt, :price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
topic_reply_count is a count of posts in other users' topics
def update_topic_reply_count self.topic_reply_count = Topic .joins("INNER JOIN posts ON topics.id = posts.topic_id AND topics.user_id <> posts.user_id") .where("posts.deleted_at IS NULL AND posts.user_id = ?", self.user_id) .distinct .count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topics_count\n object.topics.count\n end", "def user_topic_share_count(user_id, topic_neo_id)\n #Rails.cache.fetch(\"neo4j-#{user_id}-#{topic_id}-share_count\", :expires_in => 1.day) do\n count = 0\n query = \"\n START n=node(#{topic_neo_id})\n MATCH n-[:pull*0..20]->...
[ "0.7249491", "0.68897986", "0.68819386", "0.67542744", "0.66232777", "0.6512704", "0.641848", "0.63893986", "0.6151594", "0.6043848", "0.6042928", "0.6040166", "0.60299367", "0.6027247", "0.5970238", "0.59689224", "0.5939298", "0.5925119", "0.59123915", "0.58930373", "0.58873...
0.86833245
0
Queue jobs for OauthTokenRefreshWorker. Accounts whose OAuth tokens will expire in the next 25 minutes will have their tokens refreshed.
def perform Account.tokens_expiring_soon(Time.zone.now).each do |account| OauthTokenRefreshWorker.perform_async(account.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_tokens\n @token = @token.refresh!\n tokens\n end", "def perform\n\n # Get all twitter accounts if any\n accounts = TwitterAccount.exists? ? TwitterAccount.least_checked(LIMIT) : []\n\n accounts.each do |account|\n account_name = account.twitter_name\n\n if Event.exists...
[ "0.60563064", "0.58627564", "0.58311164", "0.5668823", "0.55954665", "0.5591859", "0.5570507", "0.55671525", "0.5549174", "0.55449975", "0.5542361", "0.55396026", "0.55389833", "0.5515025", "0.5481069", "0.54714197", "0.5460772", "0.5455158", "0.54092854", "0.53463215", "0.53...
0.8199903
0
to do that, we need to provide the condition array.size > 1 to the elsif part of the statement i was unsure why an elsif branch will return nil if not provided with a conditional expression but its interesting to know that ruby will find the next expression and evalute its truthiness a good bug to know about def my_method(array)
def my_method(array) if array.empty? [] elsif array.size > 1 array.map do |value| value * value end else [7 * array.first] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1 # missing elsif condition in original code on line 4\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend", "def my_method(array)\n if array.empty?\n []\n elsif array.map {|value| value * va...
[ "0.7621669", "0.73153275", "0.6465137", "0.6452952", "0.63552946", "0.6211735", "0.6188107", "0.6133049", "0.60231674", "0.5973809", "0.5958802", "0.5956553", "0.59466416", "0.5922913", "0.5900802", "0.58919984", "0.5891773", "0.5880807", "0.58797514", "0.5877618", "0.5848849...
0.64917105
4
Build profile after creation
def build_profile Profile.create(user: self) # Associations must be defined correctly for this syntax, avoids using ID's directly. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_profile\n profile || build_profile\n end", "def build_profile\n Profile.create(user: self)\n end", "def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n ...
[ "0.7719582", "0.7672295", "0.7652865", "0.73636985", "0.72576296", "0.7215689", "0.7161155", "0.7064951", "0.7061944", "0.69696933", "0.678461", "0.6732514", "0.6692094", "0.663513", "0.66213346", "0.66147035", "0.6565796", "0.6563821", "0.6544508", "0.6513363", "0.6456759", ...
0.7596895
3
Returns combination of email address and Profile name
def identity "#{email} #{profile.name} " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_display_name\n return self.has_profile? ?\n self.profile.first_name + \" \" + self.profile.last_name :\n self.email\n end", "def name_and_email\r\n if email\r\n return \"#{self.entire_full_name} <#{self.email}>\"\r\n else\r\n return nil\r\n end\r\n end", "def to_s\n ...
[ "0.7697218", "0.7293876", "0.7223716", "0.71921855", "0.7151555", "0.7044281", "0.7034166", "0.70239383", "0.70093167", "0.6962292", "0.69519824", "0.69434667", "0.6897871", "0.68928665", "0.6877373", "0.6874562", "0.686755", "0.68573684", "0.6849019", "0.68449956", "0.681818...
0.7101414
5
Returns under supervision clinics and examining clinics
def related_clinics _clinics = [] under_supervision_clinics.each do |c| unless _clinics.include?(c) _clinics.append(c) end end clinics.each do |c| unless _clinics.include?(c) _clinics.append(c) end end return _clinics end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_related_clinics?\n if under_supervision_clinics.count > 0 || clinics.count > 0\n return true\n end\n return false\n end", "def collect_crime_information\n ### Crime information\n mark_data_crime_information = Array.new\n crime_information = @case_details[:case][:system][:crime]\n\...
[ "0.57600874", "0.5593624", "0.5485031", "0.5426158", "0.541172", "0.5404782", "0.53919417", "0.53701174", "0.5294311", "0.52568156", "0.5213306", "0.52102417", "0.52045923", "0.5204297", "0.5203712", "0.5191047", "0.51907796", "0.51808304", "0.5177272", "0.51751316", "0.51733...
0.65987307
0
Returns all patient in under supervision clinics or patient which has registered by user.
def related_patients _patients=[] under_supervision_clinics.each do |clinic| clinic.registrations.each do |reg| unless _patients.include?(reg.patient) _patients.append(reg.patient) end end end registrations.each do |reg| unless _patients.include?(reg.patient) _patients.append(reg.patient) end end return _patients end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patients \n patients = Patient.all.select do |patient|\n patient.doctor == self\n end\n\n # patients.map do |patient|\n # patient.name\n # end\n end", "def patients \n # patients = []\n # Appointment.all.each do | appointment |\n # ...
[ "0.6718713", "0.6711171", "0.6654876", "0.66456383", "0.6594897", "0.6467883", "0.64512306", "0.63740176", "0.6357986", "0.63559896", "0.6330614", "0.6329396", "0.63286906", "0.6292245", "0.62911683", "0.6262743", "0.626208", "0.6252315", "0.6251028", "0.61814636", "0.616832"...
0.7480559
0
Returns all under supervision Studies plus related Studies.
def related_studies _studies = [] under_supervision_studies.each do |study| unless _studies.include?(study) _studies.append(study) end end studies.each do |study| unless _studies.include?(study) _studies.append(study) end end return _studies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @studies = current_user.available_studies\n end", "def list_studies\n act = StudyListAction.new(self)\n act.get\n end", "def index\n @studies = Study.all\n end", "def index\n @studies = Study.all\n end", "def search_studies\n @studies = Study.search(search_query, query_arg...
[ "0.6606388", "0.6588492", "0.647142", "0.647142", "0.6366238", "0.61600095", "0.61304826", "0.6032676", "0.60041785", "0.5976543", "0.59527296", "0.58857405", "0.5883488", "0.5823642", "0.57641864", "0.5749698", "0.57420963", "0.57380223", "0.57028353", "0.569883", "0.5682165...
0.8671109
0
Returns true if User has at least one related Patient
def has_related_patient? if registrations.count > 0 return true end under_supervision_clinics.each do |clinic| clinic.registrations.each do |reg| return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_implicit?\n @authorized_user.patients.size == 1 \n end", "def recipe_belongs_to_user(user)\n if user.recipes.select {|s| s.users == users}.count > 0\n return true\n else\n return false\n end\n end", "def in_relationship?(user)\n return true if UserProject.where(user: use...
[ "0.7036032", "0.6339519", "0.6283754", "0.62703687", "0.62432325", "0.62104934", "0.61614543", "0.6143775", "0.6142951", "0.61388975", "0.6086811", "0.6022274", "0.5994241", "0.59829044", "0.5973832", "0.59705424", "0.5957213", "0.5952646", "0.5923433", "0.5915635", "0.591428...
0.6925893
1
Returns true if User has at least one related Clinic
def has_related_clinics? if under_supervision_clinics.count > 0 || clinics.count > 0 return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_relationship?(user)\n return true if UserProject.where(user: user, project: self).first\n end", "def recipe_belongs_to_user(user)\n if user.recipes.select {|s| s.users == users}.count > 0\n return true\n else\n return false\n end\n end", "def has_competitor?(user_id)\n get_rel...
[ "0.67243934", "0.6620375", "0.6517182", "0.63059944", "0.6282876", "0.6255948", "0.62288344", "0.6199234", "0.6159448", "0.61420673", "0.6131008", "0.6104984", "0.6049592", "0.6048655", "0.60464734", "0.6042106", "0.6022729", "0.60218203", "0.60066277", "0.59614027", "0.59469...
0.7263277
0
Returns true if User is a supervisor of at least one Clinic
def is_supervisor? not under_supervision_clinics.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def superuser?\n member_of_group?(\"Superusers\")\n end", "def super_user? \n current_user.role.role == \"Super\" \n end", "def validate_supervisor\r\n return false unless @current_user.is_supervisor?\r\n expense = Expense.find(params[:id]) rescue nil\r\n return false if expense.blank?\r\...
[ "0.64548934", "0.64488566", "0.64465547", "0.63090485", "0.6204991", "0.6194085", "0.6141487", "0.61306256", "0.6126601", "0.6125404", "0.6058233", "0.6046268", "0.60306084", "0.6016667", "0.6002127", "0.5987492", "0.5985422", "0.59661233", "0.5956504", "0.5942219", "0.592170...
0.7470939
0
Returns true if User has access to Patient
def can_edit_patient(patient_id) patient = Patient.find(patient_id) if patient patient.registrations.each do | registration | if registration.clinic.supervisor == self || registration.user == self return true end end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_access_patient?(patient_id)\n @authorized_user.patients.map { |patient| patient.id }.include?(patient_id.to_i)\n end", "def patient_implicit?\n @authorized_user.patients.size == 1 \n end", "def can_view_patient?\n has_role?(:enroller) || has_role?(:public_health) || has_role?(:public_health...
[ "0.7958407", "0.7864747", "0.7576885", "0.74688303", "0.7402379", "0.7312102", "0.72564846", "0.7224729", "0.7199617", "0.71819997", "0.71429783", "0.7128856", "0.71084505", "0.70598763", "0.7019079", "0.69949764", "0.69775504", "0.6975886", "0.6951016", "0.69428456", "0.6922...
0.70012325
15
Returns true if User has access to Study
def can_edit_study(study_id) study = Study.find(study_id) if study if study.admin == self return true end study.users.each do | user | if user == self return true end end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_access_allowed?\n return true if scopes.include_any?(Scopes::READ_ALL)\n if username && scopes.include_any?(Scopes::READ_ROLE_BASED)\n return has_any_role? PRIVILEGED_ROLES\n end\n false\n end", "def can_edit_study?(user)\n if self.study.queued_for_deletion?\n re...
[ "0.7554266", "0.74695235", "0.7322401", "0.7247211", "0.72334814", "0.7179571", "0.71436745", "0.7126309", "0.709993", "0.700414", "0.69817096", "0.6959944", "0.6943501", "0.69411284", "0.6924641", "0.6922579", "0.6905834", "0.69035757", "0.69035757", "0.6898159", "0.6872384"...
0.758039
0
Returns true if user is approved or is admin (devise overrides)
def active_for_authentication? super && (approved? || self.admin) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved?\n (status == ConfigCenter::User::APPROVED)\n end", "def is_user_admin?\n user_active && user_active.permission_level == 2\n end", "def admin_user?\n (current_user.role == 'admin') if logged_in?\n end", "def admin_user?\n self.admin ==true\n end", "def admin_require...
[ "0.78165925", "0.7652688", "0.76422215", "0.7614828", "0.7598862", "0.7593871", "0.75682545", "0.75663036", "0.75628185", "0.7550705", "0.75460887", "0.75263524", "0.7524237", "0.75115806", "0.75082296", "0.75049746", "0.7502475", "0.7501267", "0.7489247", "0.74862254", "0.74...
0.7961931
0
execute a block scoped to the current tenant unsets the current tenant after execution
def with_tenant(tenant, &block) Multitenant.current_tenant = tenant Multitenant.in_block = true save_and_change_default_scope_for_all yield ensure restore_default_scope Multitenant.in_block = false Multitenant.current_tenant = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temp(tenant_session, &block)\n original = self.tenant_session\n begin\n self.tenant_session = tenant_session\n yield\n ensure\n self.tenant_session = original\n end\n end", "def scope_current_tenant &block\n if current_user\n ...
[ "0.6456303", "0.64423615", "0.6166946", "0.5938257", "0.58941853", "0.58114016", "0.57852954", "0.5697681", "0.5680729", "0.5643279", "0.5631496", "0.5615195", "0.55845416", "0.557084", "0.5536898", "0.55174583", "0.54833204", "0.5469118", "0.54576856", "0.5455664", "0.545239...
0.7533424
0
The HTTP response code from the API request
def initialize(reason, response_code, response_body) super(reason) @response_code = response_code @response_body = response_body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code\n @http_response.code.to_i\n end", "def status_code\n @response.status\n end", "def status_code\n response_value(:code)\n end", "def response_code\n @response.code\n end", "def code\n response&.code\n end", "def code\n @response.code\n end"...
[ "0.85397816", "0.8427251", "0.83017254", "0.8298403", "0.80762947", "0.8063064", "0.7990457", "0.7990457", "0.7946691", "0.7862803", "0.7841888", "0.7841888", "0.7841888", "0.7841888", "0.78373325", "0.7779508", "0.77710736", "0.77131903", "0.76733774", "0.7647536", "0.760793...
0.0
-1
Return long name if present, otherwise short name
def default_name [long_name, short_name].reject(&:empty?).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_name\n @short_name ||= name.to_s.split('').shift\n end", "def long_name\n if @description\n @name + ' ' + @description\n else\n @name\n end\n end", "def short_name\n if abbreviation.nil? then\n return name\n else\n return abbreviation\n end\n end", ...
[ "0.8192987", "0.81694853", "0.8148014", "0.80879205", "0.80730504", "0.7966315", "0.78832483", "0.78677773", "0.7752153", "0.7751644", "0.7712652", "0.771214", "0.7684387", "0.7666926", "0.76540005", "0.76325667", "0.76071835", "0.7587982", "0.7561847", "0.7558614", "0.753575...
0.79724157
5
Extract short flag name
def short_name short.to_s.sub(/^(-.).*$/, "\\1") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_flag_syntax\n @short_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :short }\n end", "def shortname\n attributes['shortName']\n end", "def get_flag_name(flag)\n if flag.start_with?(\"--no-\")\n flag[5..-1]\n elsif flag.start_with?(\"--\")\n flag[2..-1]\n else\n ...
[ "0.70970756", "0.6883467", "0.68212366", "0.66350996", "0.65941924", "0.6583177", "0.6568417", "0.6537411", "0.64376515", "0.63963157", "0.63786507", "0.63360435", "0.6285403", "0.61831075", "0.6121038", "0.61187553", "0.6074511", "0.6068014", "0.60516274", "0.60179263", "0.5...
0.6882232
2
Extract long flag name
def long_name long.to_s.sub(/^(--.+?)(\s+|\=|\[).*$/, "\\1") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_flag_syntax\n @long_flag_syntax ||= flag_syntax.find_all { |ss| ss.flag_style == :long }\n end", "def get_flag_name(flag)\n if flag.start_with?(\"--no-\")\n flag[5..-1]\n elsif flag.start_with?(\"--\")\n flag[2..-1]\n else\n raise \"Assertion error: we're here by mistake\"\n end\nen...
[ "0.71888006", "0.6685242", "0.63991433", "0.63319576", "0.6254689", "0.62044317", "0.61581546", "0.6124005", "0.6112861", "0.6086082", "0.60566664", "0.60566664", "0.60408974", "0.602815", "0.5951273", "0.5927557", "0.5922415", "0.59057003", "0.58458316", "0.57825786", "0.577...
0.7618007
0
Check if argument is required
def argument_required? !short.to_s.match(SHORT_ARGUMENT_REQUIRED_RE).nil? || !long.to_s.match(LONG_ARGUMENT_REQUIRED_RE).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_missing_required_arg?\n !missing_required_arguments.empty?\n end", "def expects_argument?\n config[:argument] && config[:argument] != :optional\n end", "def arguments_valid?\n true # no required arguments\n end", "def expects_argument?\n true\n end", ...
[ "0.85271156", "0.79506236", "0.7872491", "0.78527254", "0.7667729", "0.7623648", "0.76012856", "0.75835466", "0.75435334", "0.7456895", "0.74532825", "0.74223465", "0.73832244", "0.7344997", "0.73367465", "0.73338157", "0.7332169", "0.7302913", "0.73014456", "0.72946733", "0....
0.7659168
5
Check if argument is optional
def argument_optional? !short.to_s.match(SHORT_ARGUMENT_OPTIONAL_RE).nil? || !long.to_s.match(LONG_ARGUMENT_OPTIONAL_RE).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts_optional_argument?\n config[:optional_argument] || config[:argument] == :optional\n end", "def optional?\n !!options[:optional]\n end", "def optional?\n !@required\n end", "def optional?\n\t\t!required?\n\tend", "def optional?\n not required\n end", "def op...
[ "0.83359367", "0.7920013", "0.7829294", "0.77914596", "0.7682934", "0.75784296", "0.75590235", "0.7533943", "0.72397125", "0.71797913", "0.7150766", "0.7116389", "0.6851712", "0.6771379", "0.6717355", "0.6704472", "0.6704144", "0.6657489", "0.6653102", "0.66073394", "0.660245...
0.78452957
2
Compare this option short and long names
def <=>(other) left = long? ? long_name : short_name right = other.long? ? other.long_name : other.short_name left <=> right end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_use_long_names?\n opts = get_options\n opts['uselongnames']\n end", "def option_parser_short_name\n [ short_prefix, short_name ].join('')\n end", "def valid_option? opt_sym\n @options_with_short_keys.key? opt_sym\n end", "def test_named_option_long_quotes_equal\n ...
[ "0.67539346", "0.66119564", "0.6464744", "0.6457991", "0.6432522", "0.6239315", "0.6055622", "0.60004145", "0.59815294", "0.5942508", "0.5941243", "0.59226096", "0.58708936", "0.58497006", "0.58060706", "0.5719492", "0.57154894", "0.5686374", "0.5681485", "0.5632944", "0.5629...
0.5218183
71
of the original list in reverse order do not modify the original list
def reverse(array) new_array = [] array.reverse_each do |element| new_array << element end new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse!(list)\n list.reverse!\n end", "def reverse_list list\n\tlist.reverse\nend", "def reverse!(list)\n reverse_list = Array.new(list)\n (reverse_list.size - 1).downto(0).each { |index| list[index] = reverse_list[index]}\n list\nend", "def reverse()\r\n self.reduce(List.new) { |new_l...
[ "0.8285506", "0.8222739", "0.8113968", "0.80991423", "0.78875625", "0.7864538", "0.78348476", "0.7805046", "0.7793179", "0.7765299", "0.77573353", "0.7709423", "0.7572536", "0.75637084", "0.753941", "0.75337875", "0.7507064", "0.74747056", "0.73799783", "0.73757946", "0.73632...
0.66922224
87
GET /rental_cars GET /rental_cars.json
def index @rental_cars = RentalCar.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cars = Car.all\n render json: @cars\n end", "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def index\n @rentals = @car.rentals.all\n end", "def user_cars\n @...
[ "0.74109036", "0.7402507", "0.7400949", "0.7326956", "0.7298413", "0.71065223", "0.70806044", "0.70684093", "0.70223176", "0.70073855", "0.6965768", "0.69315463", "0.6925553", "0.68995017", "0.686544", "0.686544", "0.686544", "0.68596566", "0.6783068", "0.6765357", "0.6675924...
0.7289383
5
GET /rental_cars/1 GET /rental_cars/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def show\n @cars = Car.where(dealership_id...
[ "0.7375206", "0.723797", "0.72270614", "0.71540564", "0.71336126", "0.71336126", "0.71336126", "0.70862", "0.7041193", "0.7024044", "0.6993586", "0.69771904", "0.6961181", "0.69234025", "0.6884185", "0.67593974", "0.6746952", "0.6727694", "0.6677513", "0.66536444", "0.6642464...
0.0
-1
POST /rental_cars POST /rental_cars.json
def create @rental_car = RentalCar.new(rental_car_params) respond_to do |format| if @rental_car.save format.html { redirect_to rental_cars_path, notice: 'Rental car was successfully created.' } format.json { render :index, status: :created, location: @rental_car } else format.html { render :new } format.json { render json: @rental_car.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @car = Car.new(car_params)\n\n if @car.save\n render json: @car, status: :created, location: @car\n else\n render json: @car.errors, status: :bad_request\n end\n end", "def create\n @car = Car.new(car_params)\n respond_to do |format|\n if @car.save\n format.h...
[ "0.72345227", "0.69063675", "0.6847033", "0.68284893", "0.68284893", "0.68284893", "0.68284893", "0.68284893", "0.68284893", "0.68284893", "0.68178475", "0.67889917", "0.67889917", "0.6740238", "0.67308533", "0.6710483", "0.6614746", "0.660719", "0.653375", "0.64877975", "0.6...
0.7420582
0
PATCH/PUT /rental_cars/1 PATCH/PUT /rental_cars/1.json
def update respond_to do |format| if @rental_car.update(rental_car_params) format.html { redirect_to rental_cars_path, notice: 'Rental car was successfully updated.' } format.json { render :index, status: :ok, location: @rental_car } else format.html { render :edit } format.json { render json: @rental_car.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n ...
[ "0.7065507", "0.7058446", "0.6793542", "0.6776894", "0.6776894", "0.672278", "0.66935647", "0.66935647", "0.66656405", "0.6629475", "0.66082126", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", "0.6607564", ...
0.7066692
0
DELETE /rental_cars/1 DELETE /rental_cars/1.json
def destroy @rental_car.destroy respond_to do |format| format.html { redirect_to rental_cars_url, notice: 'Rental car was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @car = Car.find(params[:id])\n @car.destroy\n\n respond_to do |format|\n format.html { redirect_to cars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @car = Car.find(params[:id])\n @car.destroy\n\n respond_to do |format|\n format.html { r...
[ "0.73858577", "0.73858577", "0.73850286", "0.73850286", "0.73323447", "0.7266304", "0.72424483", "0.722783", "0.72217613", "0.7181927", "0.71810055", "0.7178219", "0.7172007", "0.71236455", "0.71236455", "0.71236455", "0.71236455", "0.71236455", "0.71236455", "0.71236455", "0...
0.74562234
0
Use callbacks to share common setup or constraints between actions.
def set_rental_car @rental_car = RentalCar.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 rental_car_params params.require(:rental_car).permit(:brand, :model, :additional_information) 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
Method returning the templates used by the renderer. Should be overwritten by the subclasses.
def all_templates @templates = super.merge(TEMPLATES) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered_templates; end", "def templates\n # Some cheap memoiziation\n @templates ||= begin\n files = Dir.glob(template_glob)\n # Check to see what mode we are in, that'll define how we parse the file names\n if Gluttonberg.localized? or Gluttonberg.translat...
[ "0.7450521", "0.72660863", "0.7203362", "0.713576", "0.7061059", "0.69929695", "0.6992193", "0.6953453", "0.68709505", "0.6837034", "0.68202364", "0.6781237", "0.6751528", "0.67395806", "0.6739252", "0.6702205", "0.6696489", "0.6629476", "0.65783674", "0.6538574", "0.65310615...
0.6062949
51
Indicates whether the renderer handles animations or not. false indicates that slides should not be repeated.
def handles_animation? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handles_animation?\n true\n end", "def animated?\n @animated\n end", "def animation?\n return @animation != nil\n end", "def inPartyAnimation?\r\n return @animations.length>0\r\n end", "def animation?\n for sprite in @enemy_sprites + @actor_sprites\n return tru...
[ "0.8096767", "0.76583505", "0.74129844", "0.6555348", "0.62362456", "0.6214282", "0.6214282", "0.61646605", "0.61646605", "0.60942906", "0.6080439", "0.5908779", "0.5886608", "0.5852896", "0.5851341", "0.58097315", "0.58097315", "0.57868123", "0.578375", "0.5780767", "0.57322...
0.8116292
1
Render an UML inline diagram using an external tool
def uml(picture_name, contents, width_slide, width_plain) new_width = calculate_width(width_plain) formats = %w(pdf eps) img_path = super(picture_name, contents, width_slide, width_plain, 'pdf') image(img_path, formats, '', '', new_width, new_width) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(context)\n api = URI.parse('https://www.planttext.com/api/scripting')\n http = Net::HTTP.new(api.host, api.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(api.request_uri)\n request['Content-Type'] = 'application/x-www-form-urlencoded'\n uml = \"\\n@startuml\\n#...
[ "0.6608325", "0.6058108", "0.600414", "0.5879647", "0.58231646", "0.575163", "0.57049733", "0.56710804", "0.566984", "0.56106937", "0.5603775", "0.55910534", "0.55837697", "0.553744", "0.5508813", "0.54329497", "0.53771", "0.5375752", "0.5371835", "0.536338", "0.5321961", "...
0.0
-1
Returns the i18n_scope for the class. Overwrite if you want custom lookup.
def i18n_scope :activemodel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i18n_scope\n self.class.i18n_scope\n end", "def i18n_scope\n self.class.i18n_scope\n end", "def locale_scope\n I18n::Scope.new(locale_translations)\n end", "def i18n_scope\n @i18n_scope ||= nil\n end", "def i18n_scope=(scope)\n @i18n_scope = scope\n end",...
[ "0.81534255", "0.81534255", "0.74639636", "0.7434711", "0.64501226", "0.64040077", "0.64011437", "0.6308559", "0.6280304", "0.6013249", "0.594106", "0.5931121", "0.5868417", "0.5866702", "0.5815899", "0.5815899", "0.580037", "0.580037", "0.580037", "0.580037", "0.580037", "...
0.5757508
27
Transforms attributes names into a more human format, such as "First name" instead of "first_name". Example: Person.human_attribute_name("first_name") => "First name" Specify +options+ with additional translating options.
def human_attribute_name(attribute, options = {}) defaults = lookup_ancestors.map do |klass| :"#{klass.model_name.underscore}.#{attribute}" end defaults << options.delete(:default) if options[:default] defaults << attribute.to_s.humanize options.reverse_merge! :scope => [self.i18n_scope, :attributes], :count => 1, :default => defaults I18n.translate(defaults.shift, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_attribute_name(attribute, options={})\n attribute = Ldaptic.encode(attribute)\n if at = namespace.attribute_type(attribute)\n attribute = at.verbose_name\n end\n attribute = attribute[0..0].upcase + attribute[1..-1]\n attribute.gsub!(/([A-Z])([A-Z][a-z])/) { \"...
[ "0.76447475", "0.73518664", "0.70934385", "0.70898396", "0.70388824", "0.69810474", "0.67747957", "0.66921955", "0.6665899", "0.66610175", "0.6651572", "0.65408146", "0.6479377", "0.6479377", "0.6453617", "0.64374626", "0.6425629", "0.6266602", "0.6254121", "0.620868", "0.618...
0.71905017
2
Model.human_name is deprecated. Use Model.model_name.human instead.
def human_name(*args) ActiveSupport::Deprecation.warn("human_name has been deprecated, please use model_name.human instead", caller[0,1]) model_name.human(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_model_name\n model_name.humanize\n end", "def human_model_name\n model_name.humanize\n end", "def human_model name=nil, pluralize=false\n s = model(name).human_name\n s = s.pluralize if pluralize && pluralize != 1\n s\n end", "def human_model_name(object)\n if object.clas...
[ "0.83423424", "0.83423424", "0.80238086", "0.7833945", "0.77923775", "0.764233", "0.7599657", "0.7581026", "0.7498146", "0.74338466", "0.7408258", "0.74073416", "0.7393924", "0.73533976", "0.7341057", "0.72971845", "0.7202835", "0.71300805", "0.71073735", "0.70728", "0.704662...
0.8492617
0
resource wrappers (wrapped around Localeze elements) element 2935 get categories
def get_categories body = build_request(2935, 1501, "ACTIVEHEADINGS") response = send_to_localeze(body) xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def uhook_category_partial category\n locale = ::Locale.find_by_iso_code(category.locale)\n content_tag(:dt, ::Category.human_attribute_name(\"locale\") + ':') +\n content_t...
[ "0.6873484", "0.6751526", "0.67265433", "0.65874094", "0.6584037", "0.64311963", "0.643012", "0.63962334", "0.6374662", "0.6371184", "0.632317", "0.6268836", "0.6258889", "0.62543905", "0.6233066", "0.6222465", "0.6195614", "0.6193665", "0.6187521", "0.6168951", "0.61427045",...
0.71457523
0
element 3722 check availability
def check_availability(business = {}) xml = Builder::XmlMarkup.new query = xml.tag!("BPMSPost", 'Edition' => "1.1") { xml.tag!("Record") { xml.tag!("Bowser Autio", business[:name]) xml.tag!("Autio", business[:department]) xml.tag!("6675 rivertown rd", business[:address]) xml.tag!("Fairburn", business[:city]) xml.tag!("GA", business[:state]) xml.tag!("30213", business[:zip]) xml.tag!("7708460972", business[:phone]) } } body = build_request(3722, 1510, query) response = send_to_localeze(body) xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text) xml_doc['ErrorCode'] == '1' # success (returns true/false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_rbs_availability!; end", "def XOcheckFor(tag, tvalue)\n\t\turl= @wwBrws.url.to_s\n\t\tres=OK\n\t\t$alog.lwrite(('Checking element '+tag.to_s+' with value /'+tvalue+'/'), 'DEBG')\n\t\tbegin\n\t\t\t$pfd.tstart( url)\n\t\t\tfound= findElement(tag, tvalue)\n\t\t\tif(found)\n\t\t\t\t$pfd.calcApplRes(true,'C...
[ "0.6755433", "0.66027594", "0.65604746", "0.65471834", "0.65050447", "0.64395046", "0.64395046", "0.64282084", "0.64206797", "0.6229034", "0.62003386", "0.61693406", "0.6147397", "0.6146912", "0.6139299", "0.6121195", "0.61167663", "0.61167663", "0.6106032", "0.6104841", "0.6...
0.5849146
42
element 3700 post business
def post_business(business, location) xml = Builder::XmlMarkup.new query = xml.tag!("BPMSPost", 'Edition' => "1.1") { xml.tag!("Record") { xml.tag!("Phone", location.phone) xml.tag!("BusinessName", location.location_name) xml.tag!("Address", location.address) xml.tag!("City", location.city) xml.tag!("State", location.state) xml.tag!("Zip", location.zip) xml.tag!("URL", location.website_url) xml.tag!("TagLine", location.special_offer) #xml.tag!("LogoImage", location.logo) xml.tag!("Categories") { xml.tag!("Category") { xml.tag!("Type", "Primary") xml.tag!("Name", business.industry_primary) } if business.industry_alt_1.present? xml.tag!("Category") { xml.tag!("Type", "Alt1") xml.tag!("Name", business.industry_alt_1) } end if business.industry_alt_2.present? xml.tag!("Category") { xml.tag!("Type", "Alt2") xml.tag!("Name", business.industry_alt_2) } end } } } body = build_request(3700, 1510, query) response = send_to_localeze(body) xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text) xml_doc['Error'] == '0' # success (returns true/false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posts; end", "def all_post\n end", "def get_posts(person)\n person.out_e(:POSTED).in_v(type: 'post')\nend", "def export_post(post) end", "def determine_post_element_xpath\n els = detect_post_element_xpaths\n els.first.andand[0]\n end", "def create_post\n post_title = parse_h...
[ "0.5836325", "0.5753537", "0.5716009", "0.57122976", "0.55392325", "0.5490149", "0.5441593", "0.5418324", "0.5418324", "0.5418324", "0.5418324", "0.53666687", "0.5302566", "0.52677894", "0.526177", "0.52064645", "0.51930887", "0.51930887", "0.51759267", "0.516956", "0.5141989...
0.5385723
11
core methods (resource wrappers use these to connect to Localeze)
def send_to_localeze(xml) client = Savon::Client.new(WSDL_URL) # raise xml.inspect response = client.call(:query, message: xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def verificar_locale\n \n end", "def locale_backend; end", "def use_i18n; end", "def init_translations; end", "def language_clien...
[ "0.70833105", "0.6754446", "0.6754446", "0.6754446", "0.6754446", "0.6754446", "0.6754446", "0.6754446", "0.66449016", "0.6607934", "0.65544283", "0.65278107", "0.6454502", "0.6435958", "0.6418554", "0.6392355", "0.6365142", "0.63400996", "0.6316087", "0.62578976", "0.6233552...
0.0
-1
checks given textpassword against hashedsalted password in db should be is_password?
def is_password?(password) BCrypt::Password.new(password_digest).is_password?(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n...
[ "0.76571256", "0.76571256", "0.7594609", "0.7594609", "0.7580744", "0.75578564", "0.75374705", "0.7493638", "0.746282", "0.7456505", "0.73946065", "0.73697543", "0.73637515", "0.7322672", "0.7316799", "0.7295636", "0.72945386", "0.7293174", "0.7275872", "0.72423446", "0.71884...
0.6847518
82
TODO: check that dependency follows format (i.e. >= 1.0.0)
def validateDependencies params[:dependencies].split("&").each do |dependency| dependency_values = dependency.split("=") versions = Version.where(:part_name => dependency_values[0]) if versions.empty? render :text => "Part: #{dependency_values[0]} does not exist.", status: 400 return else part = versions.where(:version => dependency_values[1]).first if part.nil? render :text => "Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist", status: 400 return end end end render :nothing => true, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def require_matched_dependency_version\n false\n end", "def version\n @dependency.requirement\n end", "def dependencie...
[ "0.7204709", "0.7188479", "0.70727587", "0.6977271", "0.6977271", "0.6977271", "0.68683034", "0.68212616", "0.67924845", "0.6753469", "0.6749332", "0.6637892", "0.65562665", "0.6455662", "0.642381", "0.6410759", "0.6410342", "0.6379445", "0.63411283", "0.62965703", "0.6295484...
0.0
-1
Gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data return @additional_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data=(value) @additional_data = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Instantiates a new numberColumn and sets the default values.
def initialize() @additional_data = Hash.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_values\r\n self.column_position = number_of_columns\r\n end", "def initialize_defaults\n %w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|\n send(\"#{attr}=\", 0)\n end\n end", "def columns=(integer); end", "def initialize(num)\...
[ "0.66636485", "0.6188842", "0.60418034", "0.5989763", "0.59230673", "0.5914368", "0.5881164", "0.5860243", "0.5813049", "0.5801569", "0.57819146", "0.57643604", "0.5744502", "0.5681385", "0.5670119", "0.5664885", "0.5638313", "0.56342304", "0.563242", "0.5619569", "0.56011343...
0.0
-1
Gets the decimalPlaces property value. How many decimal places to display. See below for information about the possible values.
def decimal_places return @decimal_places end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_places=(value)\n @decimal_places = value\n end", "def decimal_places; end", "def decimal_places\n self.class.decimal_places_cache[subunit_to_unit]\n end", "def decimal_places=(decimal_places)\n if !decimal_places.nil? && decimal_places < 0\n fail Argu...
[ "0.79378015", "0.72057074", "0.6854736", "0.6664293", "0.6383574", "0.63156074", "0.59380436", "0.5906819", "0.5783315", "0.571241", "0.5590575", "0.5509442", "0.5485004", "0.54627514", "0.5427095", "0.53781307", "0.5353258", "0.5353258", "0.53439474", "0.53133315", "0.527577...
0.8294227
0
Sets the decimalPlaces property value. How many decimal places to display. See below for information about the possible values.
def decimal_places=(value) @decimal_places = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_places=(decimal_places)\n if !decimal_places.nil? && decimal_places < 0\n fail ArgumentError, 'invalid value for \"decimal_places\", must be greater than or equal to 0.'\n end\n\n @decimal_places = decimal_places\n end", "def decimal_places\n return @decimal_pl...
[ "0.78652674", "0.6619695", "0.6260934", "0.5837648", "0.5775854", "0.57409495", "0.5514737", "0.5460927", "0.5347748", "0.53474444", "0.51275134", "0.5071308", "0.5048323", "0.504428", "0.50328684", "0.5009434", "0.49796298", "0.47458932", "0.474393", "0.45743322", "0.4556078...
0.84519744
0
Gets the displayAs property value. How the value should be presented in the UX. Must be one of number or percentage. If unspecified, treated as number.
def display_as return @display_as end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_as=(value)\n @display_as = value\n end", "def display_value\n case self.value_type\n when 'Numeric'\n unless self.multiplier.nil? || self.multiplier.blank?\n \"#{self.value} #{self.multiplier}(s) <span class='badge'>#{self.convert_value_by_type} bytes...
[ "0.6946745", "0.64114344", "0.6094438", "0.60136867", "0.594675", "0.5850479", "0.58494115", "0.5813908", "0.57994914", "0.5788746", "0.56153053", "0.5596943", "0.5496521", "0.5465239", "0.5362395", "0.5357115", "0.52523196", "0.52523196", "0.5213264", "0.51875585", "0.517661...
0.67938846
1
Sets the displayAs property value. How the value should be presented in the UX. Must be one of number or percentage. If unspecified, treated as number.
def display_as=(value) @display_as = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_as\n return @display_as\n end", "def display_as\n params[:display_as]\n end", "def display_value(value)\n return \"N/A\" if value.zero?\n number_to_currency(value, precision: 0)\n end", "def display_value\n case self.value_type\n when 'Numeric'\n ...
[ "0.6043243", "0.5642977", "0.55330557", "0.54842114", "0.5449902", "0.54137105", "0.5237193", "0.49191257", "0.49078047", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036", "0.4905036"...
0.7724298
0
The deserialization information for the current model
def get_field_deserializers() return { "decimalPlaces" => lambda {|n| @decimal_places = n.get_string_value() }, "displayAs" => lambda {|n| @display_as = n.get_string_value() }, "maximum" => lambda {|n| @maximum = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) }, "minimum" => lambda {|n| @minimum = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) }, "@odata.type" => lambda {|n| @odata_type = n.get_string_value() }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },...
[ "0.6510734", "0.63224316", "0.6322254", "0.63094735", "0.62954384", "0.6238735", "0.6232461", "0.62155676", "0.6200175", "0.6199403", "0.6173917", "0.61733985", "0.61705345", "0.61631054", "0.61620396", "0.6158031", "0.6156071", "0.6142402", "0.613998", "0.6138061", "0.612005...
0.0
-1
Gets the maximum property value. The maximum permitted value.
def maximum return @maximum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum_value\n @maximum_value || store.max\n end", "def maxvalue\n MAXVALUE\n end", "def max\n if valid?\n max_value\n end\n end", "def get_max\n @max\n end", "def max\n @max\n end", "def max\n @max\n end", "def max\n @maxNumber\n end", "def get_ma...
[ "0.819768", "0.8125309", "0.8109553", "0.8096064", "0.7671543", "0.7671543", "0.7614712", "0.7528303", "0.75183874", "0.74943316", "0.7460003", "0.7408084", "0.7402146", "0.7368663", "0.7362322", "0.7266627", "0.7186584", "0.7139369", "0.71207774", "0.70551807", "0.7029055", ...
0.8097301
3
Sets the maximum property value. The maximum permitted value.
def maximum=(value) @maximum = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_inp...
[ "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.8507257", "0.84230936", "0.8355318", "0.81123376", "0.7893373", "0.77636725", "0.77093923", "0.7543677", "0.7543677", "0.7543677", "0.7543677", "0.75425154", "0.75410897...
0.83837426
10
Gets the minimum property value. The minimum permitted value.
def minimum return @minimum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_value\n @minimum_value || store.min\n end", "def get_min()\n @min\n end", "def get_min\n @min\n end", "def minvalue\n MINVALUE\n end", "def get_min()\n @min \n end", "def get_min()\n @data.min\n end", "def minimum\n object.minimum.to_f\n ...
[ "0.8171997", "0.7887271", "0.76492554", "0.7582714", "0.74359554", "0.7310375", "0.72689843", "0.7231755", "0.71982193", "0.71006185", "0.7017271", "0.70034164", "0.698863", "0.693419", "0.692787", "0.6889345", "0.6888529", "0.6815768", "0.67396724", "0.6707904", "0.67045254"...
0.79085547
1
Sets the minimum property value. The minimum permitted value.
def minimum=(value) @minimum = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Minimum(value)\n set_input(\"Minimum\", value)\n end", "def set_min(min)\n\n @min = min \n\n end", "def min(value)\n opts[:min] = value\n end", "def set_min( min )\n if IntegerOption.bounds_ok?( min, @max )\n @min = min\n else\n @min = nil\n ...
[ "0.819543", "0.7879908", "0.7622051", "0.74416244", "0.74145067", "0.7106753", "0.7106753", "0.70925885", "0.70925885", "0.6830137", "0.67900425", "0.67332417", "0.6639685", "0.6613037", "0.65425646", "0.65425646", "0.6509885", "0.6481013", "0.64481896", "0.6441025", "0.64242...
0.83990884
0
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? writer.write_string_value("decimalPlaces", @decimal_places) writer.write_string_value("displayAs", @display_as) writer.write_object_value("maximum", @maximum) writer.write_object_value("minimum", @minimum) writer.write_string_value("@odata.type", @odata_type) writer.write_additional_data(@additional_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", ...
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964"...
0.0
-1
=begin i: array with 'faces'strings o: number of smiling faces r: face has : or ; face may have or ~ face has ) or D nothing else! f: loop throug faces if 2 long: index 0 in valid eyes index 1 in valid mouth if 3 long: index 0 in valid eyes index 1 in valid nose index 2 in valid mouth if valid face up counter output counter =end
def countSmileys(faces) valid_eyes = [':', ';'] valid_nose = ['-', '~'] valid_mouth = [')', 'D'] counter = 0 faces.each do |face| case face.size when 2 if valid_eyes.include?(face[0]) && valid_mouth.include?(face[1]) counter += 1 end when 3 if valid_eyes.include?(face[0]) && valid_nose.include?(face[1]) && valid_mouth.include?(face[2]) counter += 1 end end end counter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_smileys(arr)\n count = 0\n arr.each do |face|\n case\n when face == \":)\"\n count += 1\n when face == \":-)\"\n count += 1\n when face == \":~)\"\n count += 1\n when face == \":D\"\n count += 1\n when face == \":-D\"\n count += 1\n wh...
[ "0.7118032", "0.6936785", "0.6496086", "0.60318416", "0.60110873", "0.58371985", "0.58162344", "0.5764312", "0.5764312", "0.5638524", "0.56019145", "0.55512035", "0.5549019", "0.55447537", "0.5506901", "0.54708034", "0.5418709", "0.54167885", "0.54089683", "0.540799", "0.5400...
0.81330156
0
Show the new movie form
def new @movie = Movie.new @actors = Actor.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # Create an instance variable for the form_for helper\n @movie = Movie.new\n\n # by default we render app/views/movies/new.html.erb\n end", "def new\n @movie = Movie.find(params[:movie_id])\n end", "def new\n @movie = Movie.new\n end", "def new\n @movie = Movie.new\n end", ...
[ "0.7567354", "0.733482", "0.7243992", "0.7243992", "0.7243992", "0.7195505", "0.7176323", "0.7086204", "0.70391816", "0.6888926", "0.68814903", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6859921", "0.6846886", ...
0.68256193
23
Create a new movie with given info from 'new' form and redirect to movies page on success.
def create @movie = Movie.new(movie_params) title = @movie.title title = title.split(' ') title = title.map { |word| word.downcase} title = title.map { |word| word.capitalize} newTitle = "" title.each_with_index { |v,i| if i == title.length - 1 then newTitle += v else newTitle += v + ' ' end } @movie.title = newTitle if @movie.save flash[:notice] = "#{@movie.title} was successfully created." @project = Project.new(actor_params) @project.movie_id = Movie.last.id @project.save redirect_to movies_path else # Create failed, re-render the form render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @movie = Movie.new(movie_params)\n\n if @movie.save\n redirect_to movies_path, notice: \"#{@movie.title} was submitted successfully!\"\n else\n render :new\n end\n end", "def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n ...
[ "0.813226", "0.7950397", "0.78547406", "0.7850082", "0.782687", "0.78156054", "0.7804333", "0.7799138", "0.7778784", "0.77772564", "0.77772564", "0.77450496", "0.7732235", "0.77319443", "0.77280396", "0.77280396", "0.77280396", "0.77280396", "0.77280396", "0.77280396", "0.772...
0.68805444
82